-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy pathSg721.react-query.ts
225 lines (223 loc) · 6.86 KB
/
Sg721.react-query.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
/**
* This file was automatically generated by @cosmwasm/ts-codegen@latest.
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
*/
import { useQuery,UseQueryOptions } from "@tanstack/react-query";
import { Sg721QueryClient } from "./Sg721.client";
import { AllNftInfoResponse, AllOperatorsResponse, AllTokensResponse, ApprovalResponse, ApprovalsResponse, CollectionInfoResponse, ContractInfoResponse, MinterResponse, NftInfoResponse, NumTokensResponse, OwnerOfResponse, TokensResponse } from "./Sg721.types";
export interface Sg721ReactQuery<TResponse, TData = TResponse> {
client: Sg721QueryClient;
options?: Omit<UseQueryOptions<TResponse, Error, TData>, "'queryKey' | 'queryFn' | 'initialData'"> & {
initialData?: undefined;
};
}
export interface Sg721CollectionInfoQuery<TData> extends Sg721ReactQuery<CollectionInfoResponse, TData> {}
export function useSg721CollectionInfoQuery<TData = CollectionInfoResponse>({
client,
options
}: Sg721CollectionInfoQuery<TData>) {
return useQuery<CollectionInfoResponse, Error, TData>({
queryKey: ["sg721CollectionInfo", client.contractAddress],
queryFn: () => client.collectionInfo(),
...options});
}
export interface Sg721MinterQuery<TData> extends Sg721ReactQuery<MinterResponse, TData> {}
export function useSg721MinterQuery<TData = MinterResponse>({
client,
options
}: Sg721MinterQuery<TData>) {
return useQuery<MinterResponse, Error, TData>({
queryKey: ["sg721Minter", client.contractAddress],
queryFn: () => client.minter(),
...options
});
}
export interface Sg721AllTokensQuery<TData> extends Sg721ReactQuery<AllTokensResponse, TData> {
args: {
limit?: number;
startAfter?: string;
};
}
export function useSg721AllTokensQuery<TData = AllTokensResponse>({
client,
args,
options
}: Sg721AllTokensQuery<TData>) {
return useQuery<AllTokensResponse, Error, TData>({
queryKey: ["sg721AllTokens", client.contractAddress, JSON.stringify(args)],
queryFn: () => client.allTokens({
limit: args.limit,
startAfter: args.startAfter
}),
...options
});
}
export interface Sg721TokensQuery<TData> extends Sg721ReactQuery<TokensResponse, TData> {
args: {
limit?: number;
owner: string;
startAfter?: string;
};
}
export function useSg721TokensQuery<TData = TokensResponse>({
client,
args,
options
}: Sg721TokensQuery<TData>) {
return useQuery<TokensResponse, Error, TData>({
queryKey: ["sg721Tokens", client.contractAddress, JSON.stringify(args)],
queryFn: () => client.tokens({
limit: args.limit,
owner: args.owner,
startAfter: args.startAfter
}),
...options
});
}
export interface Sg721AllNftInfoQuery<TData> extends Sg721ReactQuery<AllNftInfoResponse, TData> {
args: {
includeExpired?: boolean;
tokenId: string;
};
}
export function useSg721AllNftInfoQuery<TData = AllNftInfoResponse>({
client,
args,
options
}: Sg721AllNftInfoQuery<TData>) {
return useQuery<AllNftInfoResponse, Error, TData>({
queryKey: ["sg721AllNftInfo", client.contractAddress, JSON.stringify(args)],
queryFn: () => client.allNftInfo({
includeExpired: args.includeExpired,
tokenId: args.tokenId
}),
...options
});
}
export interface Sg721NftInfoQuery<TData> extends Sg721ReactQuery<NftInfoResponse, TData> {
args: {
tokenId: string;
};
}
export function useSg721NftInfoQuery<TData = NftInfoResponse>({
client,
args,
options
}: Sg721NftInfoQuery<TData>) {
return useQuery<NftInfoResponse, Error, TData>({
queryKey: ["sg721NftInfo", client.contractAddress, JSON.stringify(args)],
queryFn: () => client.nftInfo({
tokenId: args.tokenId
}),
...options
});
}
export interface Sg721ContractInfoQuery<TData> extends Sg721ReactQuery<ContractInfoResponse, TData> {}
export function useSg721ContractInfoQuery<TData = ContractInfoResponse>({
client,
options
}: Sg721ContractInfoQuery<TData>) {
return useQuery<ContractInfoResponse, Error, TData>({
queryKey: ["sg721ContractInfo", client.contractAddress],
queryFn: () => client.contractInfo(),
...options
});
}
export interface Sg721NumTokensQuery<TData> extends Sg721ReactQuery<NumTokensResponse, TData> {}
export function useSg721NumTokensQuery<TData = NumTokensResponse>({
client,
options
}: Sg721NumTokensQuery<TData>) {
return useQuery<NumTokensResponse, Error, TData>({
queryKey: ["sg721NumTokens", client.contractAddress],
queryFn: () => client.numTokens(),
...options
});
}
export interface Sg721AllOperatorsQuery<TData> extends Sg721ReactQuery<AllOperatorsResponse, TData> {
args: {
includeExpired?: boolean;
limit?: number;
owner: string;
startAfter?: string;
};
}
export function useSg721AllOperatorsQuery<TData = AllOperatorsResponse>({
client,
args,
options
}: Sg721AllOperatorsQuery<TData>) {
return useQuery<AllOperatorsResponse, Error, TData>({
queryKey: ["sg721AllOperators", client.contractAddress, JSON.stringify(args)],
queryFn: () => client.allOperators({
includeExpired: args.includeExpired,
limit: args.limit,
owner: args.owner,
startAfter: args.startAfter
}),
...options
});
}
export interface Sg721ApprovalsQuery<TData> extends Sg721ReactQuery<ApprovalsResponse, TData> {
args: {
includeExpired?: boolean;
tokenId: string;
};
}
export function useSg721ApprovalsQuery<TData = ApprovalsResponse>({
client,
args,
options
}: Sg721ApprovalsQuery<TData>) {
return useQuery<ApprovalsResponse, Error, TData>({
queryKey: ["sg721Approvals", client.contractAddress, JSON.stringify(args)],
queryFn: () => client.approvals({
includeExpired: args.includeExpired,
tokenId: args.tokenId
}),
...options
});
}
export interface Sg721ApprovalQuery<TData> extends Sg721ReactQuery<ApprovalResponse, TData> {
args: {
includeExpired?: boolean;
spender: string;
tokenId: string;
};
}
export function useSg721ApprovalQuery<TData = ApprovalResponse>({
client,
args,
options
}: Sg721ApprovalQuery<TData>) {
return useQuery<ApprovalResponse, Error, TData>({
queryKey: ["sg721Approval", client.contractAddress, JSON.stringify(args)],
queryFn: () => client.approval({
includeExpired: args.includeExpired,
spender: args.spender,
tokenId: args.tokenId
}),
...options
});
}
export interface Sg721OwnerOfQuery<TData> extends Sg721ReactQuery<OwnerOfResponse, TData> {
args: {
includeExpired?: boolean;
tokenId: string;
};
}
export function useSg721OwnerOfQuery<TData = OwnerOfResponse>({
client,
args,
options
}: Sg721OwnerOfQuery<TData>) {
return useQuery<OwnerOfResponse, Error, TData>({
queryKey: ["sg721OwnerOf", client.contractAddress, JSON.stringify(args)],
queryFn: () => client.ownerOf({
includeExpired: args.includeExpired,
tokenId: args.tokenId
}),
...options
});
}