@gitmyabi/wnft 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +108 -0
- package/contracts/EnvelopwNFT721_json.d.ts +1131 -0
- package/contracts/EnvelopwNFT721_json.js +1180 -0
- package/contracts/EnvelopwNFT721_json.ts +1488 -0
- package/contracts/index.d.ts +2 -0
- package/contracts/index.js +7 -0
- package/contracts/index.ts +3 -0
- package/index.d.ts +1 -0
- package/index.js +19 -0
- package/package.json +43 -0
|
@@ -0,0 +1,1488 @@
|
|
|
1
|
+
import type { Abi, Address, PublicClient, WalletClient, GetContractReturnType } from 'viem';
|
|
2
|
+
import { getContract } from 'viem';
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* ETypes.WNFT struct type
|
|
7
|
+
*/
|
|
8
|
+
export type ETypes_WNFT = {
|
|
9
|
+
inAsset: ETypes_AssetItem;
|
|
10
|
+
collateral: ETypes_AssetItem[];
|
|
11
|
+
unWrapDestination: `0x${string}`;
|
|
12
|
+
fees: ETypes_Fee[];
|
|
13
|
+
locks: ETypes_Lock[];
|
|
14
|
+
royalties: ETypes_Royalty[];
|
|
15
|
+
rules: `0x${string}`;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* ETypes.AssetItem struct type
|
|
20
|
+
*/
|
|
21
|
+
export type ETypes_AssetItem = {
|
|
22
|
+
asset: ETypes_Asset;
|
|
23
|
+
tokenId: bigint;
|
|
24
|
+
amount: bigint;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* ETypes.Asset struct type
|
|
29
|
+
*/
|
|
30
|
+
export type ETypes_Asset = {
|
|
31
|
+
assetType: bigint;
|
|
32
|
+
contractAddress: `0x${string}`;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* ETypes.Fee struct type
|
|
37
|
+
*/
|
|
38
|
+
export type ETypes_Fee = {
|
|
39
|
+
feeType: `0x${string}`;
|
|
40
|
+
param: bigint;
|
|
41
|
+
token: `0x${string}`;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* ETypes.Lock struct type
|
|
46
|
+
*/
|
|
47
|
+
export type ETypes_Lock = {
|
|
48
|
+
lockType: `0x${string}`;
|
|
49
|
+
param: bigint;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* ETypes.Royalty struct type
|
|
54
|
+
*/
|
|
55
|
+
export type ETypes_Royalty = {
|
|
56
|
+
beneficiary: `0x${string}`;
|
|
57
|
+
percent: bigint;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* EnvelopwNFT721_json ABI
|
|
61
|
+
*
|
|
62
|
+
* This ABI is typed using viem's type system for full type safety.
|
|
63
|
+
*/
|
|
64
|
+
export const EnvelopwNFT721_jsonAbi = [
|
|
65
|
+
{
|
|
66
|
+
"inputs": [
|
|
67
|
+
{
|
|
68
|
+
"internalType": "string",
|
|
69
|
+
"name": "name_",
|
|
70
|
+
"type": "string"
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"internalType": "string",
|
|
74
|
+
"name": "symbol_",
|
|
75
|
+
"type": "string"
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"internalType": "string",
|
|
79
|
+
"name": "_baseurl",
|
|
80
|
+
"type": "string"
|
|
81
|
+
}
|
|
82
|
+
],
|
|
83
|
+
"stateMutability": "nonpayable",
|
|
84
|
+
"type": "constructor"
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"anonymous": false,
|
|
88
|
+
"inputs": [
|
|
89
|
+
{
|
|
90
|
+
"indexed": true,
|
|
91
|
+
"internalType": "address",
|
|
92
|
+
"name": "owner",
|
|
93
|
+
"type": "address"
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"indexed": true,
|
|
97
|
+
"internalType": "address",
|
|
98
|
+
"name": "approved",
|
|
99
|
+
"type": "address"
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
"indexed": true,
|
|
103
|
+
"internalType": "uint256",
|
|
104
|
+
"name": "tokenId",
|
|
105
|
+
"type": "uint256"
|
|
106
|
+
}
|
|
107
|
+
],
|
|
108
|
+
"name": "Approval",
|
|
109
|
+
"type": "event"
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
"anonymous": false,
|
|
113
|
+
"inputs": [
|
|
114
|
+
{
|
|
115
|
+
"indexed": true,
|
|
116
|
+
"internalType": "address",
|
|
117
|
+
"name": "owner",
|
|
118
|
+
"type": "address"
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
"indexed": true,
|
|
122
|
+
"internalType": "address",
|
|
123
|
+
"name": "operator",
|
|
124
|
+
"type": "address"
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
"indexed": false,
|
|
128
|
+
"internalType": "bool",
|
|
129
|
+
"name": "approved",
|
|
130
|
+
"type": "bool"
|
|
131
|
+
}
|
|
132
|
+
],
|
|
133
|
+
"name": "ApprovalForAll",
|
|
134
|
+
"type": "event"
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
"anonymous": false,
|
|
138
|
+
"inputs": [
|
|
139
|
+
{
|
|
140
|
+
"indexed": true,
|
|
141
|
+
"internalType": "address",
|
|
142
|
+
"name": "previousOwner",
|
|
143
|
+
"type": "address"
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
"indexed": true,
|
|
147
|
+
"internalType": "address",
|
|
148
|
+
"name": "newOwner",
|
|
149
|
+
"type": "address"
|
|
150
|
+
}
|
|
151
|
+
],
|
|
152
|
+
"name": "OwnershipTransferred",
|
|
153
|
+
"type": "event"
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
"anonymous": false,
|
|
157
|
+
"inputs": [
|
|
158
|
+
{
|
|
159
|
+
"indexed": true,
|
|
160
|
+
"internalType": "address",
|
|
161
|
+
"name": "from",
|
|
162
|
+
"type": "address"
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
"indexed": true,
|
|
166
|
+
"internalType": "address",
|
|
167
|
+
"name": "to",
|
|
168
|
+
"type": "address"
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
"indexed": true,
|
|
172
|
+
"internalType": "uint256",
|
|
173
|
+
"name": "tokenId",
|
|
174
|
+
"type": "uint256"
|
|
175
|
+
}
|
|
176
|
+
],
|
|
177
|
+
"name": "Transfer",
|
|
178
|
+
"type": "event"
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
"inputs": [
|
|
182
|
+
{
|
|
183
|
+
"internalType": "address",
|
|
184
|
+
"name": "to",
|
|
185
|
+
"type": "address"
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
"internalType": "uint256",
|
|
189
|
+
"name": "tokenId",
|
|
190
|
+
"type": "uint256"
|
|
191
|
+
}
|
|
192
|
+
],
|
|
193
|
+
"name": "approve",
|
|
194
|
+
"outputs": [],
|
|
195
|
+
"stateMutability": "nonpayable",
|
|
196
|
+
"type": "function"
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
"inputs": [
|
|
200
|
+
{
|
|
201
|
+
"internalType": "address",
|
|
202
|
+
"name": "owner",
|
|
203
|
+
"type": "address"
|
|
204
|
+
}
|
|
205
|
+
],
|
|
206
|
+
"name": "balanceOf",
|
|
207
|
+
"outputs": [
|
|
208
|
+
{
|
|
209
|
+
"internalType": "uint256",
|
|
210
|
+
"name": "",
|
|
211
|
+
"type": "uint256"
|
|
212
|
+
}
|
|
213
|
+
],
|
|
214
|
+
"stateMutability": "view",
|
|
215
|
+
"type": "function"
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
"inputs": [],
|
|
219
|
+
"name": "baseURI",
|
|
220
|
+
"outputs": [
|
|
221
|
+
{
|
|
222
|
+
"internalType": "string",
|
|
223
|
+
"name": "",
|
|
224
|
+
"type": "string"
|
|
225
|
+
}
|
|
226
|
+
],
|
|
227
|
+
"stateMutability": "view",
|
|
228
|
+
"type": "function"
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
"inputs": [],
|
|
232
|
+
"name": "baseurl",
|
|
233
|
+
"outputs": [
|
|
234
|
+
{
|
|
235
|
+
"internalType": "string",
|
|
236
|
+
"name": "",
|
|
237
|
+
"type": "string"
|
|
238
|
+
}
|
|
239
|
+
],
|
|
240
|
+
"stateMutability": "view",
|
|
241
|
+
"type": "function"
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
"inputs": [
|
|
245
|
+
{
|
|
246
|
+
"internalType": "uint256",
|
|
247
|
+
"name": "tokenId",
|
|
248
|
+
"type": "uint256"
|
|
249
|
+
}
|
|
250
|
+
],
|
|
251
|
+
"name": "burn",
|
|
252
|
+
"outputs": [],
|
|
253
|
+
"stateMutability": "nonpayable",
|
|
254
|
+
"type": "function"
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
"inputs": [
|
|
258
|
+
{
|
|
259
|
+
"internalType": "uint256",
|
|
260
|
+
"name": "_tokenId",
|
|
261
|
+
"type": "uint256"
|
|
262
|
+
}
|
|
263
|
+
],
|
|
264
|
+
"name": "exists",
|
|
265
|
+
"outputs": [
|
|
266
|
+
{
|
|
267
|
+
"internalType": "bool",
|
|
268
|
+
"name": "",
|
|
269
|
+
"type": "bool"
|
|
270
|
+
}
|
|
271
|
+
],
|
|
272
|
+
"stateMutability": "view",
|
|
273
|
+
"type": "function"
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
"inputs": [
|
|
277
|
+
{
|
|
278
|
+
"internalType": "uint256",
|
|
279
|
+
"name": "tokenId",
|
|
280
|
+
"type": "uint256"
|
|
281
|
+
}
|
|
282
|
+
],
|
|
283
|
+
"name": "getApproved",
|
|
284
|
+
"outputs": [
|
|
285
|
+
{
|
|
286
|
+
"internalType": "address",
|
|
287
|
+
"name": "",
|
|
288
|
+
"type": "address"
|
|
289
|
+
}
|
|
290
|
+
],
|
|
291
|
+
"stateMutability": "view",
|
|
292
|
+
"type": "function"
|
|
293
|
+
},
|
|
294
|
+
{
|
|
295
|
+
"inputs": [
|
|
296
|
+
{
|
|
297
|
+
"internalType": "address",
|
|
298
|
+
"name": "owner",
|
|
299
|
+
"type": "address"
|
|
300
|
+
},
|
|
301
|
+
{
|
|
302
|
+
"internalType": "address",
|
|
303
|
+
"name": "operator",
|
|
304
|
+
"type": "address"
|
|
305
|
+
}
|
|
306
|
+
],
|
|
307
|
+
"name": "isApprovedForAll",
|
|
308
|
+
"outputs": [
|
|
309
|
+
{
|
|
310
|
+
"internalType": "bool",
|
|
311
|
+
"name": "",
|
|
312
|
+
"type": "bool"
|
|
313
|
+
}
|
|
314
|
+
],
|
|
315
|
+
"stateMutability": "view",
|
|
316
|
+
"type": "function"
|
|
317
|
+
},
|
|
318
|
+
{
|
|
319
|
+
"inputs": [
|
|
320
|
+
{
|
|
321
|
+
"internalType": "address",
|
|
322
|
+
"name": "_to",
|
|
323
|
+
"type": "address"
|
|
324
|
+
},
|
|
325
|
+
{
|
|
326
|
+
"internalType": "uint256",
|
|
327
|
+
"name": "_tokenId",
|
|
328
|
+
"type": "uint256"
|
|
329
|
+
}
|
|
330
|
+
],
|
|
331
|
+
"name": "mint",
|
|
332
|
+
"outputs": [],
|
|
333
|
+
"stateMutability": "nonpayable",
|
|
334
|
+
"type": "function"
|
|
335
|
+
},
|
|
336
|
+
{
|
|
337
|
+
"inputs": [],
|
|
338
|
+
"name": "name",
|
|
339
|
+
"outputs": [
|
|
340
|
+
{
|
|
341
|
+
"internalType": "string",
|
|
342
|
+
"name": "",
|
|
343
|
+
"type": "string"
|
|
344
|
+
}
|
|
345
|
+
],
|
|
346
|
+
"stateMutability": "view",
|
|
347
|
+
"type": "function"
|
|
348
|
+
},
|
|
349
|
+
{
|
|
350
|
+
"inputs": [],
|
|
351
|
+
"name": "owner",
|
|
352
|
+
"outputs": [
|
|
353
|
+
{
|
|
354
|
+
"internalType": "address",
|
|
355
|
+
"name": "",
|
|
356
|
+
"type": "address"
|
|
357
|
+
}
|
|
358
|
+
],
|
|
359
|
+
"stateMutability": "view",
|
|
360
|
+
"type": "function"
|
|
361
|
+
},
|
|
362
|
+
{
|
|
363
|
+
"inputs": [
|
|
364
|
+
{
|
|
365
|
+
"internalType": "uint256",
|
|
366
|
+
"name": "tokenId",
|
|
367
|
+
"type": "uint256"
|
|
368
|
+
}
|
|
369
|
+
],
|
|
370
|
+
"name": "ownerOf",
|
|
371
|
+
"outputs": [
|
|
372
|
+
{
|
|
373
|
+
"internalType": "address",
|
|
374
|
+
"name": "",
|
|
375
|
+
"type": "address"
|
|
376
|
+
}
|
|
377
|
+
],
|
|
378
|
+
"stateMutability": "view",
|
|
379
|
+
"type": "function"
|
|
380
|
+
},
|
|
381
|
+
{
|
|
382
|
+
"inputs": [],
|
|
383
|
+
"name": "renounceOwnership",
|
|
384
|
+
"outputs": [],
|
|
385
|
+
"stateMutability": "nonpayable",
|
|
386
|
+
"type": "function"
|
|
387
|
+
},
|
|
388
|
+
{
|
|
389
|
+
"inputs": [
|
|
390
|
+
{
|
|
391
|
+
"internalType": "address",
|
|
392
|
+
"name": "from",
|
|
393
|
+
"type": "address"
|
|
394
|
+
},
|
|
395
|
+
{
|
|
396
|
+
"internalType": "address",
|
|
397
|
+
"name": "to",
|
|
398
|
+
"type": "address"
|
|
399
|
+
},
|
|
400
|
+
{
|
|
401
|
+
"internalType": "uint256",
|
|
402
|
+
"name": "tokenId",
|
|
403
|
+
"type": "uint256"
|
|
404
|
+
}
|
|
405
|
+
],
|
|
406
|
+
"name": "safeTransferFrom",
|
|
407
|
+
"outputs": [],
|
|
408
|
+
"stateMutability": "nonpayable",
|
|
409
|
+
"type": "function"
|
|
410
|
+
},
|
|
411
|
+
{
|
|
412
|
+
"inputs": [
|
|
413
|
+
{
|
|
414
|
+
"internalType": "address",
|
|
415
|
+
"name": "from",
|
|
416
|
+
"type": "address"
|
|
417
|
+
},
|
|
418
|
+
{
|
|
419
|
+
"internalType": "address",
|
|
420
|
+
"name": "to",
|
|
421
|
+
"type": "address"
|
|
422
|
+
},
|
|
423
|
+
{
|
|
424
|
+
"internalType": "uint256",
|
|
425
|
+
"name": "tokenId",
|
|
426
|
+
"type": "uint256"
|
|
427
|
+
},
|
|
428
|
+
{
|
|
429
|
+
"internalType": "bytes",
|
|
430
|
+
"name": "_data",
|
|
431
|
+
"type": "bytes"
|
|
432
|
+
}
|
|
433
|
+
],
|
|
434
|
+
"name": "safeTransferFrom",
|
|
435
|
+
"outputs": [],
|
|
436
|
+
"stateMutability": "nonpayable",
|
|
437
|
+
"type": "function"
|
|
438
|
+
},
|
|
439
|
+
{
|
|
440
|
+
"inputs": [
|
|
441
|
+
{
|
|
442
|
+
"internalType": "address",
|
|
443
|
+
"name": "operator",
|
|
444
|
+
"type": "address"
|
|
445
|
+
},
|
|
446
|
+
{
|
|
447
|
+
"internalType": "bool",
|
|
448
|
+
"name": "approved",
|
|
449
|
+
"type": "bool"
|
|
450
|
+
}
|
|
451
|
+
],
|
|
452
|
+
"name": "setApprovalForAll",
|
|
453
|
+
"outputs": [],
|
|
454
|
+
"stateMutability": "nonpayable",
|
|
455
|
+
"type": "function"
|
|
456
|
+
},
|
|
457
|
+
{
|
|
458
|
+
"inputs": [
|
|
459
|
+
{
|
|
460
|
+
"internalType": "address",
|
|
461
|
+
"name": "_minter",
|
|
462
|
+
"type": "address"
|
|
463
|
+
}
|
|
464
|
+
],
|
|
465
|
+
"name": "setMinter",
|
|
466
|
+
"outputs": [],
|
|
467
|
+
"stateMutability": "nonpayable",
|
|
468
|
+
"type": "function"
|
|
469
|
+
},
|
|
470
|
+
{
|
|
471
|
+
"inputs": [
|
|
472
|
+
{
|
|
473
|
+
"internalType": "bytes4",
|
|
474
|
+
"name": "interfaceId",
|
|
475
|
+
"type": "bytes4"
|
|
476
|
+
}
|
|
477
|
+
],
|
|
478
|
+
"name": "supportsInterface",
|
|
479
|
+
"outputs": [
|
|
480
|
+
{
|
|
481
|
+
"internalType": "bool",
|
|
482
|
+
"name": "",
|
|
483
|
+
"type": "bool"
|
|
484
|
+
}
|
|
485
|
+
],
|
|
486
|
+
"stateMutability": "view",
|
|
487
|
+
"type": "function"
|
|
488
|
+
},
|
|
489
|
+
{
|
|
490
|
+
"inputs": [],
|
|
491
|
+
"name": "symbol",
|
|
492
|
+
"outputs": [
|
|
493
|
+
{
|
|
494
|
+
"internalType": "string",
|
|
495
|
+
"name": "",
|
|
496
|
+
"type": "string"
|
|
497
|
+
}
|
|
498
|
+
],
|
|
499
|
+
"stateMutability": "view",
|
|
500
|
+
"type": "function"
|
|
501
|
+
},
|
|
502
|
+
{
|
|
503
|
+
"inputs": [
|
|
504
|
+
{
|
|
505
|
+
"internalType": "uint256",
|
|
506
|
+
"name": "index",
|
|
507
|
+
"type": "uint256"
|
|
508
|
+
}
|
|
509
|
+
],
|
|
510
|
+
"name": "tokenByIndex",
|
|
511
|
+
"outputs": [
|
|
512
|
+
{
|
|
513
|
+
"internalType": "uint256",
|
|
514
|
+
"name": "",
|
|
515
|
+
"type": "uint256"
|
|
516
|
+
}
|
|
517
|
+
],
|
|
518
|
+
"stateMutability": "view",
|
|
519
|
+
"type": "function"
|
|
520
|
+
},
|
|
521
|
+
{
|
|
522
|
+
"inputs": [
|
|
523
|
+
{
|
|
524
|
+
"internalType": "address",
|
|
525
|
+
"name": "owner",
|
|
526
|
+
"type": "address"
|
|
527
|
+
},
|
|
528
|
+
{
|
|
529
|
+
"internalType": "uint256",
|
|
530
|
+
"name": "index",
|
|
531
|
+
"type": "uint256"
|
|
532
|
+
}
|
|
533
|
+
],
|
|
534
|
+
"name": "tokenOfOwnerByIndex",
|
|
535
|
+
"outputs": [
|
|
536
|
+
{
|
|
537
|
+
"internalType": "uint256",
|
|
538
|
+
"name": "",
|
|
539
|
+
"type": "uint256"
|
|
540
|
+
}
|
|
541
|
+
],
|
|
542
|
+
"stateMutability": "view",
|
|
543
|
+
"type": "function"
|
|
544
|
+
},
|
|
545
|
+
{
|
|
546
|
+
"inputs": [
|
|
547
|
+
{
|
|
548
|
+
"internalType": "uint256",
|
|
549
|
+
"name": "_tokenId",
|
|
550
|
+
"type": "uint256"
|
|
551
|
+
}
|
|
552
|
+
],
|
|
553
|
+
"name": "tokenURI",
|
|
554
|
+
"outputs": [
|
|
555
|
+
{
|
|
556
|
+
"internalType": "string",
|
|
557
|
+
"name": "_uri",
|
|
558
|
+
"type": "string"
|
|
559
|
+
}
|
|
560
|
+
],
|
|
561
|
+
"stateMutability": "view",
|
|
562
|
+
"type": "function"
|
|
563
|
+
},
|
|
564
|
+
{
|
|
565
|
+
"inputs": [],
|
|
566
|
+
"name": "totalSupply",
|
|
567
|
+
"outputs": [
|
|
568
|
+
{
|
|
569
|
+
"internalType": "uint256",
|
|
570
|
+
"name": "",
|
|
571
|
+
"type": "uint256"
|
|
572
|
+
}
|
|
573
|
+
],
|
|
574
|
+
"stateMutability": "view",
|
|
575
|
+
"type": "function"
|
|
576
|
+
},
|
|
577
|
+
{
|
|
578
|
+
"inputs": [
|
|
579
|
+
{
|
|
580
|
+
"internalType": "address",
|
|
581
|
+
"name": "from",
|
|
582
|
+
"type": "address"
|
|
583
|
+
},
|
|
584
|
+
{
|
|
585
|
+
"internalType": "address",
|
|
586
|
+
"name": "to",
|
|
587
|
+
"type": "address"
|
|
588
|
+
},
|
|
589
|
+
{
|
|
590
|
+
"internalType": "uint256",
|
|
591
|
+
"name": "tokenId",
|
|
592
|
+
"type": "uint256"
|
|
593
|
+
}
|
|
594
|
+
],
|
|
595
|
+
"name": "transferFrom",
|
|
596
|
+
"outputs": [],
|
|
597
|
+
"stateMutability": "nonpayable",
|
|
598
|
+
"type": "function"
|
|
599
|
+
},
|
|
600
|
+
{
|
|
601
|
+
"inputs": [
|
|
602
|
+
{
|
|
603
|
+
"internalType": "address",
|
|
604
|
+
"name": "newOwner",
|
|
605
|
+
"type": "address"
|
|
606
|
+
}
|
|
607
|
+
],
|
|
608
|
+
"name": "transferOwnership",
|
|
609
|
+
"outputs": [],
|
|
610
|
+
"stateMutability": "nonpayable",
|
|
611
|
+
"type": "function"
|
|
612
|
+
},
|
|
613
|
+
{
|
|
614
|
+
"inputs": [
|
|
615
|
+
{
|
|
616
|
+
"internalType": "uint256",
|
|
617
|
+
"name": "tokenId",
|
|
618
|
+
"type": "uint256"
|
|
619
|
+
}
|
|
620
|
+
],
|
|
621
|
+
"name": "wnftInfo",
|
|
622
|
+
"outputs": [
|
|
623
|
+
{
|
|
624
|
+
"components": [
|
|
625
|
+
{
|
|
626
|
+
"components": [
|
|
627
|
+
{
|
|
628
|
+
"components": [
|
|
629
|
+
{
|
|
630
|
+
"internalType": "enum ETypes.AssetType",
|
|
631
|
+
"name": "assetType",
|
|
632
|
+
"type": "uint8"
|
|
633
|
+
},
|
|
634
|
+
{
|
|
635
|
+
"internalType": "address",
|
|
636
|
+
"name": "contractAddress",
|
|
637
|
+
"type": "address"
|
|
638
|
+
}
|
|
639
|
+
],
|
|
640
|
+
"internalType": "struct ETypes.Asset",
|
|
641
|
+
"name": "asset",
|
|
642
|
+
"type": "tuple"
|
|
643
|
+
},
|
|
644
|
+
{
|
|
645
|
+
"internalType": "uint256",
|
|
646
|
+
"name": "tokenId",
|
|
647
|
+
"type": "uint256"
|
|
648
|
+
},
|
|
649
|
+
{
|
|
650
|
+
"internalType": "uint256",
|
|
651
|
+
"name": "amount",
|
|
652
|
+
"type": "uint256"
|
|
653
|
+
}
|
|
654
|
+
],
|
|
655
|
+
"internalType": "struct ETypes.AssetItem",
|
|
656
|
+
"name": "inAsset",
|
|
657
|
+
"type": "tuple"
|
|
658
|
+
},
|
|
659
|
+
{
|
|
660
|
+
"components": [
|
|
661
|
+
{
|
|
662
|
+
"components": [
|
|
663
|
+
{
|
|
664
|
+
"internalType": "enum ETypes.AssetType",
|
|
665
|
+
"name": "assetType",
|
|
666
|
+
"type": "uint8"
|
|
667
|
+
},
|
|
668
|
+
{
|
|
669
|
+
"internalType": "address",
|
|
670
|
+
"name": "contractAddress",
|
|
671
|
+
"type": "address"
|
|
672
|
+
}
|
|
673
|
+
],
|
|
674
|
+
"internalType": "struct ETypes.Asset",
|
|
675
|
+
"name": "asset",
|
|
676
|
+
"type": "tuple"
|
|
677
|
+
},
|
|
678
|
+
{
|
|
679
|
+
"internalType": "uint256",
|
|
680
|
+
"name": "tokenId",
|
|
681
|
+
"type": "uint256"
|
|
682
|
+
},
|
|
683
|
+
{
|
|
684
|
+
"internalType": "uint256",
|
|
685
|
+
"name": "amount",
|
|
686
|
+
"type": "uint256"
|
|
687
|
+
}
|
|
688
|
+
],
|
|
689
|
+
"internalType": "struct ETypes.AssetItem[]",
|
|
690
|
+
"name": "collateral",
|
|
691
|
+
"type": "tuple[]"
|
|
692
|
+
},
|
|
693
|
+
{
|
|
694
|
+
"internalType": "address",
|
|
695
|
+
"name": "unWrapDestination",
|
|
696
|
+
"type": "address"
|
|
697
|
+
},
|
|
698
|
+
{
|
|
699
|
+
"components": [
|
|
700
|
+
{
|
|
701
|
+
"internalType": "bytes1",
|
|
702
|
+
"name": "feeType",
|
|
703
|
+
"type": "bytes1"
|
|
704
|
+
},
|
|
705
|
+
{
|
|
706
|
+
"internalType": "uint256",
|
|
707
|
+
"name": "param",
|
|
708
|
+
"type": "uint256"
|
|
709
|
+
},
|
|
710
|
+
{
|
|
711
|
+
"internalType": "address",
|
|
712
|
+
"name": "token",
|
|
713
|
+
"type": "address"
|
|
714
|
+
}
|
|
715
|
+
],
|
|
716
|
+
"internalType": "struct ETypes.Fee[]",
|
|
717
|
+
"name": "fees",
|
|
718
|
+
"type": "tuple[]"
|
|
719
|
+
},
|
|
720
|
+
{
|
|
721
|
+
"components": [
|
|
722
|
+
{
|
|
723
|
+
"internalType": "bytes1",
|
|
724
|
+
"name": "lockType",
|
|
725
|
+
"type": "bytes1"
|
|
726
|
+
},
|
|
727
|
+
{
|
|
728
|
+
"internalType": "uint256",
|
|
729
|
+
"name": "param",
|
|
730
|
+
"type": "uint256"
|
|
731
|
+
}
|
|
732
|
+
],
|
|
733
|
+
"internalType": "struct ETypes.Lock[]",
|
|
734
|
+
"name": "locks",
|
|
735
|
+
"type": "tuple[]"
|
|
736
|
+
},
|
|
737
|
+
{
|
|
738
|
+
"components": [
|
|
739
|
+
{
|
|
740
|
+
"internalType": "address",
|
|
741
|
+
"name": "beneficiary",
|
|
742
|
+
"type": "address"
|
|
743
|
+
},
|
|
744
|
+
{
|
|
745
|
+
"internalType": "uint16",
|
|
746
|
+
"name": "percent",
|
|
747
|
+
"type": "uint16"
|
|
748
|
+
}
|
|
749
|
+
],
|
|
750
|
+
"internalType": "struct ETypes.Royalty[]",
|
|
751
|
+
"name": "royalties",
|
|
752
|
+
"type": "tuple[]"
|
|
753
|
+
},
|
|
754
|
+
{
|
|
755
|
+
"internalType": "bytes2",
|
|
756
|
+
"name": "rules",
|
|
757
|
+
"type": "bytes2"
|
|
758
|
+
}
|
|
759
|
+
],
|
|
760
|
+
"internalType": "struct ETypes.WNFT",
|
|
761
|
+
"name": "",
|
|
762
|
+
"type": "tuple"
|
|
763
|
+
}
|
|
764
|
+
],
|
|
765
|
+
"stateMutability": "view",
|
|
766
|
+
"type": "function"
|
|
767
|
+
},
|
|
768
|
+
{
|
|
769
|
+
"inputs": [],
|
|
770
|
+
"name": "wrapperMinter",
|
|
771
|
+
"outputs": [
|
|
772
|
+
{
|
|
773
|
+
"internalType": "address",
|
|
774
|
+
"name": "",
|
|
775
|
+
"type": "address"
|
|
776
|
+
}
|
|
777
|
+
],
|
|
778
|
+
"stateMutability": "view",
|
|
779
|
+
"type": "function"
|
|
780
|
+
}
|
|
781
|
+
] as const satisfies Abi;
|
|
782
|
+
|
|
783
|
+
/**
|
|
784
|
+
* Type-safe ABI for EnvelopwNFT721_json
|
|
785
|
+
*/
|
|
786
|
+
export type EnvelopwNFT721_jsonAbi = typeof EnvelopwNFT721_jsonAbi;
|
|
787
|
+
|
|
788
|
+
/**
|
|
789
|
+
* Contract instance type for EnvelopwNFT721_json
|
|
790
|
+
*/
|
|
791
|
+
// Use any for contract type to avoid complex viem type issues
|
|
792
|
+
// The runtime behavior is type-safe through viem's ABI typing
|
|
793
|
+
export type EnvelopwNFT721_jsonContract = any;
|
|
794
|
+
|
|
795
|
+
/**
|
|
796
|
+
* EnvelopwNFT721_json Contract Class
|
|
797
|
+
*
|
|
798
|
+
* Provides a class-based API similar to TypeChain for interacting with the contract.
|
|
799
|
+
*
|
|
800
|
+
* @example
|
|
801
|
+
* ```typescript
|
|
802
|
+
* import { createPublicClient, createWalletClient, http } from 'viem';
|
|
803
|
+
* import { mainnet } from 'viem/chains';
|
|
804
|
+
* import { EnvelopwNFT721_json } from 'EnvelopwNFT721_json';
|
|
805
|
+
*
|
|
806
|
+
* const publicClient = createPublicClient({ chain: mainnet, transport: http() });
|
|
807
|
+
* const walletClient = createWalletClient({ chain: mainnet, transport: http() });
|
|
808
|
+
*
|
|
809
|
+
* const contract = new EnvelopwNFT721_json('0x...', { publicClient, walletClient });
|
|
810
|
+
*
|
|
811
|
+
* // Read functions
|
|
812
|
+
* const result = await contract.balanceOf('0x...');
|
|
813
|
+
*
|
|
814
|
+
* // Write functions
|
|
815
|
+
* const hash = await contract.transfer('0x...', 1000n);
|
|
816
|
+
*
|
|
817
|
+
* // Simulate transactions (dry-run)
|
|
818
|
+
* const simulation = await contract.simulate.transfer('0x...', 1000n);
|
|
819
|
+
* console.log('Gas estimate:', simulation.request.gas);
|
|
820
|
+
*
|
|
821
|
+
* // Watch events
|
|
822
|
+
* const unwatch = contract.watch.Transfer((event) => {
|
|
823
|
+
* console.log('Transfer event:', event);
|
|
824
|
+
* });
|
|
825
|
+
* ```
|
|
826
|
+
*/
|
|
827
|
+
export class EnvelopwNFT721_json {
|
|
828
|
+
private contract: EnvelopwNFT721_jsonContract;
|
|
829
|
+
private contractAddress: Address;
|
|
830
|
+
private publicClient: PublicClient;
|
|
831
|
+
|
|
832
|
+
constructor(
|
|
833
|
+
address: Address,
|
|
834
|
+
clients: {
|
|
835
|
+
publicClient: PublicClient;
|
|
836
|
+
walletClient?: WalletClient;
|
|
837
|
+
}
|
|
838
|
+
) {
|
|
839
|
+
this.contractAddress = address;
|
|
840
|
+
this.publicClient = clients.publicClient;
|
|
841
|
+
this.contract = getContract({
|
|
842
|
+
address,
|
|
843
|
+
abi: EnvelopwNFT721_jsonAbi,
|
|
844
|
+
client: {
|
|
845
|
+
public: clients.publicClient,
|
|
846
|
+
wallet: clients.walletClient,
|
|
847
|
+
},
|
|
848
|
+
});
|
|
849
|
+
}
|
|
850
|
+
|
|
851
|
+
/**
|
|
852
|
+
* Get the contract address
|
|
853
|
+
*/
|
|
854
|
+
get address(): Address {
|
|
855
|
+
return this.contractAddress;
|
|
856
|
+
}
|
|
857
|
+
|
|
858
|
+
/**
|
|
859
|
+
* Get the underlying viem contract instance
|
|
860
|
+
*/
|
|
861
|
+
getContract(): EnvelopwNFT721_jsonContract {
|
|
862
|
+
return this.contract;
|
|
863
|
+
}
|
|
864
|
+
|
|
865
|
+
/**
|
|
866
|
+
* balanceOf
|
|
867
|
+
* view
|
|
868
|
+
*/
|
|
869
|
+
async balanceOf(owner: `0x${string}`): Promise<bigint> {
|
|
870
|
+
return this.contract.read.balanceOf([owner] as const) as Promise<bigint>;
|
|
871
|
+
}
|
|
872
|
+
|
|
873
|
+
/**
|
|
874
|
+
* baseURI
|
|
875
|
+
* view
|
|
876
|
+
*/
|
|
877
|
+
async baseURI(): Promise<string> {
|
|
878
|
+
return this.contract.read.baseURI() as Promise<string>;
|
|
879
|
+
}
|
|
880
|
+
|
|
881
|
+
/**
|
|
882
|
+
* baseurl
|
|
883
|
+
* view
|
|
884
|
+
*/
|
|
885
|
+
async baseurl(): Promise<string> {
|
|
886
|
+
return this.contract.read.baseurl() as Promise<string>;
|
|
887
|
+
}
|
|
888
|
+
|
|
889
|
+
/**
|
|
890
|
+
* exists
|
|
891
|
+
* view
|
|
892
|
+
*/
|
|
893
|
+
async exists(_tokenId: bigint): Promise<boolean> {
|
|
894
|
+
return this.contract.read.exists([_tokenId] as const) as Promise<boolean>;
|
|
895
|
+
}
|
|
896
|
+
|
|
897
|
+
/**
|
|
898
|
+
* getApproved
|
|
899
|
+
* view
|
|
900
|
+
*/
|
|
901
|
+
async getApproved(tokenId: bigint): Promise<`0x${string}`> {
|
|
902
|
+
return this.contract.read.getApproved([tokenId] as const) as Promise<`0x${string}`>;
|
|
903
|
+
}
|
|
904
|
+
|
|
905
|
+
/**
|
|
906
|
+
* isApprovedForAll
|
|
907
|
+
* view
|
|
908
|
+
*/
|
|
909
|
+
async isApprovedForAll(owner: `0x${string}`, operator: `0x${string}`): Promise<boolean> {
|
|
910
|
+
return this.contract.read.isApprovedForAll([owner, operator] as const) as Promise<boolean>;
|
|
911
|
+
}
|
|
912
|
+
|
|
913
|
+
/**
|
|
914
|
+
* name
|
|
915
|
+
* view
|
|
916
|
+
*/
|
|
917
|
+
async name(): Promise<string> {
|
|
918
|
+
return this.contract.read.name() as Promise<string>;
|
|
919
|
+
}
|
|
920
|
+
|
|
921
|
+
/**
|
|
922
|
+
* owner
|
|
923
|
+
* view
|
|
924
|
+
*/
|
|
925
|
+
async owner(): Promise<`0x${string}`> {
|
|
926
|
+
return this.contract.read.owner() as Promise<`0x${string}`>;
|
|
927
|
+
}
|
|
928
|
+
|
|
929
|
+
/**
|
|
930
|
+
* ownerOf
|
|
931
|
+
* view
|
|
932
|
+
*/
|
|
933
|
+
async ownerOf(tokenId: bigint): Promise<`0x${string}`> {
|
|
934
|
+
return this.contract.read.ownerOf([tokenId] as const) as Promise<`0x${string}`>;
|
|
935
|
+
}
|
|
936
|
+
|
|
937
|
+
/**
|
|
938
|
+
* supportsInterface
|
|
939
|
+
* view
|
|
940
|
+
*/
|
|
941
|
+
async supportsInterface(interfaceId: `0x${string}`): Promise<boolean> {
|
|
942
|
+
return this.contract.read.supportsInterface([interfaceId] as const) as Promise<boolean>;
|
|
943
|
+
}
|
|
944
|
+
|
|
945
|
+
/**
|
|
946
|
+
* symbol
|
|
947
|
+
* view
|
|
948
|
+
*/
|
|
949
|
+
async symbol(): Promise<string> {
|
|
950
|
+
return this.contract.read.symbol() as Promise<string>;
|
|
951
|
+
}
|
|
952
|
+
|
|
953
|
+
/**
|
|
954
|
+
* tokenByIndex
|
|
955
|
+
* view
|
|
956
|
+
*/
|
|
957
|
+
async tokenByIndex(index: bigint): Promise<bigint> {
|
|
958
|
+
return this.contract.read.tokenByIndex([index] as const) as Promise<bigint>;
|
|
959
|
+
}
|
|
960
|
+
|
|
961
|
+
/**
|
|
962
|
+
* tokenOfOwnerByIndex
|
|
963
|
+
* view
|
|
964
|
+
*/
|
|
965
|
+
async tokenOfOwnerByIndex(owner: `0x${string}`, index: bigint): Promise<bigint> {
|
|
966
|
+
return this.contract.read.tokenOfOwnerByIndex([owner, index] as const) as Promise<bigint>;
|
|
967
|
+
}
|
|
968
|
+
|
|
969
|
+
/**
|
|
970
|
+
* tokenURI
|
|
971
|
+
* view
|
|
972
|
+
*/
|
|
973
|
+
async tokenURI(_tokenId: bigint): Promise<string> {
|
|
974
|
+
return this.contract.read.tokenURI([_tokenId] as const) as Promise<string>;
|
|
975
|
+
}
|
|
976
|
+
|
|
977
|
+
/**
|
|
978
|
+
* totalSupply
|
|
979
|
+
* view
|
|
980
|
+
*/
|
|
981
|
+
async totalSupply(): Promise<bigint> {
|
|
982
|
+
return this.contract.read.totalSupply() as Promise<bigint>;
|
|
983
|
+
}
|
|
984
|
+
|
|
985
|
+
/**
|
|
986
|
+
* wnftInfo
|
|
987
|
+
* view
|
|
988
|
+
*/
|
|
989
|
+
async wnftInfo(tokenId: bigint): Promise<ETypes_WNFT> {
|
|
990
|
+
return this.contract.read.wnftInfo([tokenId] as const) as Promise<ETypes_WNFT>;
|
|
991
|
+
}
|
|
992
|
+
|
|
993
|
+
/**
|
|
994
|
+
* wrapperMinter
|
|
995
|
+
* view
|
|
996
|
+
*/
|
|
997
|
+
async wrapperMinter(): Promise<`0x${string}`> {
|
|
998
|
+
return this.contract.read.wrapperMinter() as Promise<`0x${string}`>;
|
|
999
|
+
}
|
|
1000
|
+
|
|
1001
|
+
/**
|
|
1002
|
+
* approve
|
|
1003
|
+
* nonpayable
|
|
1004
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1005
|
+
*/
|
|
1006
|
+
async approve(to: `0x${string}`, tokenId: bigint, options?: {
|
|
1007
|
+
accessList?: import('viem').AccessList;
|
|
1008
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1009
|
+
chain?: import('viem').Chain | null;
|
|
1010
|
+
dataSuffix?: `0x${string}`;
|
|
1011
|
+
gas?: bigint;
|
|
1012
|
+
gasPrice?: bigint;
|
|
1013
|
+
maxFeePerGas?: bigint;
|
|
1014
|
+
maxPriorityFeePerGas?: bigint;
|
|
1015
|
+
nonce?: number;
|
|
1016
|
+
value?: bigint;
|
|
1017
|
+
}): Promise<`0x${string}`> {
|
|
1018
|
+
if (!this.contract.write) {
|
|
1019
|
+
throw new Error('Wallet client is required for write operations');
|
|
1020
|
+
}
|
|
1021
|
+
return this.contract.write.approve([to, tokenId] as const, options) as Promise<`0x${string}`>;
|
|
1022
|
+
}
|
|
1023
|
+
|
|
1024
|
+
/**
|
|
1025
|
+
* burn
|
|
1026
|
+
* nonpayable
|
|
1027
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1028
|
+
*/
|
|
1029
|
+
async burn(tokenId: bigint, options?: {
|
|
1030
|
+
accessList?: import('viem').AccessList;
|
|
1031
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1032
|
+
chain?: import('viem').Chain | null;
|
|
1033
|
+
dataSuffix?: `0x${string}`;
|
|
1034
|
+
gas?: bigint;
|
|
1035
|
+
gasPrice?: bigint;
|
|
1036
|
+
maxFeePerGas?: bigint;
|
|
1037
|
+
maxPriorityFeePerGas?: bigint;
|
|
1038
|
+
nonce?: number;
|
|
1039
|
+
value?: bigint;
|
|
1040
|
+
}): Promise<`0x${string}`> {
|
|
1041
|
+
if (!this.contract.write) {
|
|
1042
|
+
throw new Error('Wallet client is required for write operations');
|
|
1043
|
+
}
|
|
1044
|
+
return this.contract.write.burn([tokenId] as const, options) as Promise<`0x${string}`>;
|
|
1045
|
+
}
|
|
1046
|
+
|
|
1047
|
+
/**
|
|
1048
|
+
* mint
|
|
1049
|
+
* nonpayable
|
|
1050
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1051
|
+
*/
|
|
1052
|
+
async mint(_to: `0x${string}`, _tokenId: bigint, options?: {
|
|
1053
|
+
accessList?: import('viem').AccessList;
|
|
1054
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1055
|
+
chain?: import('viem').Chain | null;
|
|
1056
|
+
dataSuffix?: `0x${string}`;
|
|
1057
|
+
gas?: bigint;
|
|
1058
|
+
gasPrice?: bigint;
|
|
1059
|
+
maxFeePerGas?: bigint;
|
|
1060
|
+
maxPriorityFeePerGas?: bigint;
|
|
1061
|
+
nonce?: number;
|
|
1062
|
+
value?: bigint;
|
|
1063
|
+
}): Promise<`0x${string}`> {
|
|
1064
|
+
if (!this.contract.write) {
|
|
1065
|
+
throw new Error('Wallet client is required for write operations');
|
|
1066
|
+
}
|
|
1067
|
+
return this.contract.write.mint([_to, _tokenId] as const, options) as Promise<`0x${string}`>;
|
|
1068
|
+
}
|
|
1069
|
+
|
|
1070
|
+
/**
|
|
1071
|
+
* renounceOwnership
|
|
1072
|
+
* nonpayable
|
|
1073
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1074
|
+
*/
|
|
1075
|
+
async renounceOwnership(options?: {
|
|
1076
|
+
accessList?: import('viem').AccessList;
|
|
1077
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1078
|
+
chain?: import('viem').Chain | null;
|
|
1079
|
+
dataSuffix?: `0x${string}`;
|
|
1080
|
+
gas?: bigint;
|
|
1081
|
+
gasPrice?: bigint;
|
|
1082
|
+
maxFeePerGas?: bigint;
|
|
1083
|
+
maxPriorityFeePerGas?: bigint;
|
|
1084
|
+
nonce?: number;
|
|
1085
|
+
value?: bigint;
|
|
1086
|
+
}): Promise<`0x${string}`> {
|
|
1087
|
+
if (!this.contract.write) {
|
|
1088
|
+
throw new Error('Wallet client is required for write operations');
|
|
1089
|
+
}
|
|
1090
|
+
return this.contract.write.renounceOwnership(options) as Promise<`0x${string}`>;
|
|
1091
|
+
}
|
|
1092
|
+
|
|
1093
|
+
async safeTransferFrom(from: `0x${string}`, to: `0x${string}`, tokenId: bigint, options?: {
|
|
1094
|
+
accessList?: import('viem').AccessList;
|
|
1095
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1096
|
+
chain?: import('viem').Chain | null;
|
|
1097
|
+
dataSuffix?: `0x${string}`;
|
|
1098
|
+
gas?: bigint;
|
|
1099
|
+
gasPrice?: bigint;
|
|
1100
|
+
maxFeePerGas?: bigint;
|
|
1101
|
+
maxPriorityFeePerGas?: bigint;
|
|
1102
|
+
nonce?: number;
|
|
1103
|
+
value?: bigint;
|
|
1104
|
+
}): Promise<`0x${string}`>;
|
|
1105
|
+
async safeTransferFrom(from: `0x${string}`, to: `0x${string}`, tokenId: bigint, _data: `0x${string}`, options?: {
|
|
1106
|
+
accessList?: import('viem').AccessList;
|
|
1107
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1108
|
+
chain?: import('viem').Chain | null;
|
|
1109
|
+
dataSuffix?: `0x${string}`;
|
|
1110
|
+
gas?: bigint;
|
|
1111
|
+
gasPrice?: bigint;
|
|
1112
|
+
maxFeePerGas?: bigint;
|
|
1113
|
+
maxPriorityFeePerGas?: bigint;
|
|
1114
|
+
nonce?: number;
|
|
1115
|
+
value?: bigint;
|
|
1116
|
+
}): Promise<`0x${string}`>;
|
|
1117
|
+
async safeTransferFrom(...args: any[]): Promise<`0x${string}`> {
|
|
1118
|
+
if (!this.contract.write) {
|
|
1119
|
+
throw new Error('Wallet client is required for write operations');
|
|
1120
|
+
}
|
|
1121
|
+
return this.contract.write.safeTransferFrom(args as any) as Promise<`0x${string}`>;
|
|
1122
|
+
}
|
|
1123
|
+
|
|
1124
|
+
/**
|
|
1125
|
+
* setApprovalForAll
|
|
1126
|
+
* nonpayable
|
|
1127
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1128
|
+
*/
|
|
1129
|
+
async setApprovalForAll(operator: `0x${string}`, approved: boolean, options?: {
|
|
1130
|
+
accessList?: import('viem').AccessList;
|
|
1131
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1132
|
+
chain?: import('viem').Chain | null;
|
|
1133
|
+
dataSuffix?: `0x${string}`;
|
|
1134
|
+
gas?: bigint;
|
|
1135
|
+
gasPrice?: bigint;
|
|
1136
|
+
maxFeePerGas?: bigint;
|
|
1137
|
+
maxPriorityFeePerGas?: bigint;
|
|
1138
|
+
nonce?: number;
|
|
1139
|
+
value?: bigint;
|
|
1140
|
+
}): Promise<`0x${string}`> {
|
|
1141
|
+
if (!this.contract.write) {
|
|
1142
|
+
throw new Error('Wallet client is required for write operations');
|
|
1143
|
+
}
|
|
1144
|
+
return this.contract.write.setApprovalForAll([operator, approved] as const, options) as Promise<`0x${string}`>;
|
|
1145
|
+
}
|
|
1146
|
+
|
|
1147
|
+
/**
|
|
1148
|
+
* setMinter
|
|
1149
|
+
* nonpayable
|
|
1150
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1151
|
+
*/
|
|
1152
|
+
async setMinter(_minter: `0x${string}`, options?: {
|
|
1153
|
+
accessList?: import('viem').AccessList;
|
|
1154
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1155
|
+
chain?: import('viem').Chain | null;
|
|
1156
|
+
dataSuffix?: `0x${string}`;
|
|
1157
|
+
gas?: bigint;
|
|
1158
|
+
gasPrice?: bigint;
|
|
1159
|
+
maxFeePerGas?: bigint;
|
|
1160
|
+
maxPriorityFeePerGas?: bigint;
|
|
1161
|
+
nonce?: number;
|
|
1162
|
+
value?: bigint;
|
|
1163
|
+
}): Promise<`0x${string}`> {
|
|
1164
|
+
if (!this.contract.write) {
|
|
1165
|
+
throw new Error('Wallet client is required for write operations');
|
|
1166
|
+
}
|
|
1167
|
+
return this.contract.write.setMinter([_minter] as const, options) as Promise<`0x${string}`>;
|
|
1168
|
+
}
|
|
1169
|
+
|
|
1170
|
+
/**
|
|
1171
|
+
* transferFrom
|
|
1172
|
+
* nonpayable
|
|
1173
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1174
|
+
*/
|
|
1175
|
+
async transferFrom(from: `0x${string}`, to: `0x${string}`, tokenId: bigint, options?: {
|
|
1176
|
+
accessList?: import('viem').AccessList;
|
|
1177
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1178
|
+
chain?: import('viem').Chain | null;
|
|
1179
|
+
dataSuffix?: `0x${string}`;
|
|
1180
|
+
gas?: bigint;
|
|
1181
|
+
gasPrice?: bigint;
|
|
1182
|
+
maxFeePerGas?: bigint;
|
|
1183
|
+
maxPriorityFeePerGas?: bigint;
|
|
1184
|
+
nonce?: number;
|
|
1185
|
+
value?: bigint;
|
|
1186
|
+
}): Promise<`0x${string}`> {
|
|
1187
|
+
if (!this.contract.write) {
|
|
1188
|
+
throw new Error('Wallet client is required for write operations');
|
|
1189
|
+
}
|
|
1190
|
+
return this.contract.write.transferFrom([from, to, tokenId] as const, options) as Promise<`0x${string}`>;
|
|
1191
|
+
}
|
|
1192
|
+
|
|
1193
|
+
/**
|
|
1194
|
+
* transferOwnership
|
|
1195
|
+
* nonpayable
|
|
1196
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1197
|
+
*/
|
|
1198
|
+
async transferOwnership(newOwner: `0x${string}`, options?: {
|
|
1199
|
+
accessList?: import('viem').AccessList;
|
|
1200
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1201
|
+
chain?: import('viem').Chain | null;
|
|
1202
|
+
dataSuffix?: `0x${string}`;
|
|
1203
|
+
gas?: bigint;
|
|
1204
|
+
gasPrice?: bigint;
|
|
1205
|
+
maxFeePerGas?: bigint;
|
|
1206
|
+
maxPriorityFeePerGas?: bigint;
|
|
1207
|
+
nonce?: number;
|
|
1208
|
+
value?: bigint;
|
|
1209
|
+
}): Promise<`0x${string}`> {
|
|
1210
|
+
if (!this.contract.write) {
|
|
1211
|
+
throw new Error('Wallet client is required for write operations');
|
|
1212
|
+
}
|
|
1213
|
+
return this.contract.write.transferOwnership([newOwner] as const, options) as Promise<`0x${string}`>;
|
|
1214
|
+
}
|
|
1215
|
+
|
|
1216
|
+
|
|
1217
|
+
|
|
1218
|
+
/**
|
|
1219
|
+
* Simulate contract write operations (dry-run without sending transaction)
|
|
1220
|
+
*
|
|
1221
|
+
* @example
|
|
1222
|
+
* const result = await contract.simulate.transfer('0x...', 1000n);
|
|
1223
|
+
* console.log('Gas estimate:', result.request.gas);
|
|
1224
|
+
* console.log('Would succeed:', result.result);
|
|
1225
|
+
*/
|
|
1226
|
+
get simulate() {
|
|
1227
|
+
const contract = this.contract;
|
|
1228
|
+
if (!contract.simulate) {
|
|
1229
|
+
throw new Error('Public client is required for simulation');
|
|
1230
|
+
}
|
|
1231
|
+
return {
|
|
1232
|
+
/**
|
|
1233
|
+
* Simulate approve
|
|
1234
|
+
* Returns gas estimate and result without sending transaction
|
|
1235
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1236
|
+
*/
|
|
1237
|
+
async approve(to: `0x${string}`, tokenId: bigint, options?: {
|
|
1238
|
+
accessList?: import('viem').AccessList;
|
|
1239
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1240
|
+
chain?: import('viem').Chain | null;
|
|
1241
|
+
dataSuffix?: `0x${string}`;
|
|
1242
|
+
gas?: bigint;
|
|
1243
|
+
gasPrice?: bigint;
|
|
1244
|
+
maxFeePerGas?: bigint;
|
|
1245
|
+
maxPriorityFeePerGas?: bigint;
|
|
1246
|
+
nonce?: number;
|
|
1247
|
+
value?: bigint;
|
|
1248
|
+
}): Promise<void> {
|
|
1249
|
+
return contract.simulate.approve([to, tokenId] as const, options) as Promise<void>;
|
|
1250
|
+
},
|
|
1251
|
+
/**
|
|
1252
|
+
* Simulate burn
|
|
1253
|
+
* Returns gas estimate and result without sending transaction
|
|
1254
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1255
|
+
*/
|
|
1256
|
+
async burn(tokenId: bigint, options?: {
|
|
1257
|
+
accessList?: import('viem').AccessList;
|
|
1258
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1259
|
+
chain?: import('viem').Chain | null;
|
|
1260
|
+
dataSuffix?: `0x${string}`;
|
|
1261
|
+
gas?: bigint;
|
|
1262
|
+
gasPrice?: bigint;
|
|
1263
|
+
maxFeePerGas?: bigint;
|
|
1264
|
+
maxPriorityFeePerGas?: bigint;
|
|
1265
|
+
nonce?: number;
|
|
1266
|
+
value?: bigint;
|
|
1267
|
+
}): Promise<void> {
|
|
1268
|
+
return contract.simulate.burn([tokenId] as const, options) as Promise<void>;
|
|
1269
|
+
},
|
|
1270
|
+
/**
|
|
1271
|
+
* Simulate mint
|
|
1272
|
+
* Returns gas estimate and result without sending transaction
|
|
1273
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1274
|
+
*/
|
|
1275
|
+
async mint(_to: `0x${string}`, _tokenId: bigint, options?: {
|
|
1276
|
+
accessList?: import('viem').AccessList;
|
|
1277
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1278
|
+
chain?: import('viem').Chain | null;
|
|
1279
|
+
dataSuffix?: `0x${string}`;
|
|
1280
|
+
gas?: bigint;
|
|
1281
|
+
gasPrice?: bigint;
|
|
1282
|
+
maxFeePerGas?: bigint;
|
|
1283
|
+
maxPriorityFeePerGas?: bigint;
|
|
1284
|
+
nonce?: number;
|
|
1285
|
+
value?: bigint;
|
|
1286
|
+
}): Promise<void> {
|
|
1287
|
+
return contract.simulate.mint([_to, _tokenId] as const, options) as Promise<void>;
|
|
1288
|
+
},
|
|
1289
|
+
/**
|
|
1290
|
+
* Simulate renounceOwnership
|
|
1291
|
+
* Returns gas estimate and result without sending transaction
|
|
1292
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1293
|
+
*/
|
|
1294
|
+
async renounceOwnership(options?: {
|
|
1295
|
+
accessList?: import('viem').AccessList;
|
|
1296
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1297
|
+
chain?: import('viem').Chain | null;
|
|
1298
|
+
dataSuffix?: `0x${string}`;
|
|
1299
|
+
gas?: bigint;
|
|
1300
|
+
gasPrice?: bigint;
|
|
1301
|
+
maxFeePerGas?: bigint;
|
|
1302
|
+
maxPriorityFeePerGas?: bigint;
|
|
1303
|
+
nonce?: number;
|
|
1304
|
+
value?: bigint;
|
|
1305
|
+
}): Promise<void> {
|
|
1306
|
+
return contract.simulate.renounceOwnership(options) as Promise<void>;
|
|
1307
|
+
},
|
|
1308
|
+
/**
|
|
1309
|
+
* Simulate safeTransferFrom
|
|
1310
|
+
* Returns gas estimate and result without sending transaction
|
|
1311
|
+
* Supports multiple overloads: (address, address, uint256), (address, address, uint256, bytes)
|
|
1312
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1313
|
+
*/
|
|
1314
|
+
async safeTransferFrom(...args: any[]): Promise<any> {
|
|
1315
|
+
return contract.simulate.safeTransferFrom(args as any) as Promise<any>;
|
|
1316
|
+
},
|
|
1317
|
+
/**
|
|
1318
|
+
* Simulate setApprovalForAll
|
|
1319
|
+
* Returns gas estimate and result without sending transaction
|
|
1320
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1321
|
+
*/
|
|
1322
|
+
async setApprovalForAll(operator: `0x${string}`, approved: boolean, options?: {
|
|
1323
|
+
accessList?: import('viem').AccessList;
|
|
1324
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1325
|
+
chain?: import('viem').Chain | null;
|
|
1326
|
+
dataSuffix?: `0x${string}`;
|
|
1327
|
+
gas?: bigint;
|
|
1328
|
+
gasPrice?: bigint;
|
|
1329
|
+
maxFeePerGas?: bigint;
|
|
1330
|
+
maxPriorityFeePerGas?: bigint;
|
|
1331
|
+
nonce?: number;
|
|
1332
|
+
value?: bigint;
|
|
1333
|
+
}): Promise<void> {
|
|
1334
|
+
return contract.simulate.setApprovalForAll([operator, approved] as const, options) as Promise<void>;
|
|
1335
|
+
},
|
|
1336
|
+
/**
|
|
1337
|
+
* Simulate setMinter
|
|
1338
|
+
* Returns gas estimate and result without sending transaction
|
|
1339
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1340
|
+
*/
|
|
1341
|
+
async setMinter(_minter: `0x${string}`, options?: {
|
|
1342
|
+
accessList?: import('viem').AccessList;
|
|
1343
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1344
|
+
chain?: import('viem').Chain | null;
|
|
1345
|
+
dataSuffix?: `0x${string}`;
|
|
1346
|
+
gas?: bigint;
|
|
1347
|
+
gasPrice?: bigint;
|
|
1348
|
+
maxFeePerGas?: bigint;
|
|
1349
|
+
maxPriorityFeePerGas?: bigint;
|
|
1350
|
+
nonce?: number;
|
|
1351
|
+
value?: bigint;
|
|
1352
|
+
}): Promise<void> {
|
|
1353
|
+
return contract.simulate.setMinter([_minter] as const, options) as Promise<void>;
|
|
1354
|
+
},
|
|
1355
|
+
/**
|
|
1356
|
+
* Simulate transferFrom
|
|
1357
|
+
* Returns gas estimate and result without sending transaction
|
|
1358
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1359
|
+
*/
|
|
1360
|
+
async transferFrom(from: `0x${string}`, to: `0x${string}`, tokenId: bigint, options?: {
|
|
1361
|
+
accessList?: import('viem').AccessList;
|
|
1362
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1363
|
+
chain?: import('viem').Chain | null;
|
|
1364
|
+
dataSuffix?: `0x${string}`;
|
|
1365
|
+
gas?: bigint;
|
|
1366
|
+
gasPrice?: bigint;
|
|
1367
|
+
maxFeePerGas?: bigint;
|
|
1368
|
+
maxPriorityFeePerGas?: bigint;
|
|
1369
|
+
nonce?: number;
|
|
1370
|
+
value?: bigint;
|
|
1371
|
+
}): Promise<void> {
|
|
1372
|
+
return contract.simulate.transferFrom([from, to, tokenId] as const, options) as Promise<void>;
|
|
1373
|
+
},
|
|
1374
|
+
/**
|
|
1375
|
+
* Simulate transferOwnership
|
|
1376
|
+
* Returns gas estimate and result without sending transaction
|
|
1377
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1378
|
+
*/
|
|
1379
|
+
async transferOwnership(newOwner: `0x${string}`, options?: {
|
|
1380
|
+
accessList?: import('viem').AccessList;
|
|
1381
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1382
|
+
chain?: import('viem').Chain | null;
|
|
1383
|
+
dataSuffix?: `0x${string}`;
|
|
1384
|
+
gas?: bigint;
|
|
1385
|
+
gasPrice?: bigint;
|
|
1386
|
+
maxFeePerGas?: bigint;
|
|
1387
|
+
maxPriorityFeePerGas?: bigint;
|
|
1388
|
+
nonce?: number;
|
|
1389
|
+
value?: bigint;
|
|
1390
|
+
}): Promise<void> {
|
|
1391
|
+
return contract.simulate.transferOwnership([newOwner] as const, options) as Promise<void>;
|
|
1392
|
+
}
|
|
1393
|
+
};
|
|
1394
|
+
}
|
|
1395
|
+
|
|
1396
|
+
/**
|
|
1397
|
+
* Watch contract events
|
|
1398
|
+
*
|
|
1399
|
+
* @example
|
|
1400
|
+
* // Watch all Transfer events
|
|
1401
|
+
* const unwatch = contract.watch.Transfer((event) => {
|
|
1402
|
+
* console.log('Transfer:', event);
|
|
1403
|
+
* });
|
|
1404
|
+
*
|
|
1405
|
+
* // Stop watching
|
|
1406
|
+
* unwatch();
|
|
1407
|
+
*/
|
|
1408
|
+
get watch() {
|
|
1409
|
+
return {
|
|
1410
|
+
/**
|
|
1411
|
+
* Watch Approval events
|
|
1412
|
+
* @param callback Function to call when event is emitted
|
|
1413
|
+
* @param filter Optional filter for indexed parameters
|
|
1414
|
+
* @returns Unwatch function to stop listening
|
|
1415
|
+
*/
|
|
1416
|
+
Approval: (callback: (event: { owner: `0x${string}`; approved: `0x${string}`; tokenId: bigint }) => void, filter?: { owner: `0x${string}`; approved: `0x${string}`; tokenId: bigint }) => {
|
|
1417
|
+
return this.publicClient.watchContractEvent({
|
|
1418
|
+
address: this.contractAddress,
|
|
1419
|
+
abi: EnvelopwNFT721_jsonAbi,
|
|
1420
|
+
eventName: 'Approval',
|
|
1421
|
+
args: filter,
|
|
1422
|
+
onLogs: (logs: any[]) => {
|
|
1423
|
+
logs.forEach((log: any) => {
|
|
1424
|
+
callback(log.args as any);
|
|
1425
|
+
});
|
|
1426
|
+
},
|
|
1427
|
+
}) as () => void;
|
|
1428
|
+
},
|
|
1429
|
+
/**
|
|
1430
|
+
* Watch ApprovalForAll events
|
|
1431
|
+
* @param callback Function to call when event is emitted
|
|
1432
|
+
* @param filter Optional filter for indexed parameters
|
|
1433
|
+
* @returns Unwatch function to stop listening
|
|
1434
|
+
*/
|
|
1435
|
+
ApprovalForAll: (callback: (event: { owner: `0x${string}`; operator: `0x${string}`; approved: boolean }) => void, filter?: { owner: `0x${string}`; operator: `0x${string}` }) => {
|
|
1436
|
+
return this.publicClient.watchContractEvent({
|
|
1437
|
+
address: this.contractAddress,
|
|
1438
|
+
abi: EnvelopwNFT721_jsonAbi,
|
|
1439
|
+
eventName: 'ApprovalForAll',
|
|
1440
|
+
args: filter,
|
|
1441
|
+
onLogs: (logs: any[]) => {
|
|
1442
|
+
logs.forEach((log: any) => {
|
|
1443
|
+
callback(log.args as any);
|
|
1444
|
+
});
|
|
1445
|
+
},
|
|
1446
|
+
}) as () => void;
|
|
1447
|
+
},
|
|
1448
|
+
/**
|
|
1449
|
+
* Watch OwnershipTransferred events
|
|
1450
|
+
* @param callback Function to call when event is emitted
|
|
1451
|
+
* @param filter Optional filter for indexed parameters
|
|
1452
|
+
* @returns Unwatch function to stop listening
|
|
1453
|
+
*/
|
|
1454
|
+
OwnershipTransferred: (callback: (event: { previousOwner: `0x${string}`; newOwner: `0x${string}` }) => void, filter?: { previousOwner: `0x${string}`; newOwner: `0x${string}` }) => {
|
|
1455
|
+
return this.publicClient.watchContractEvent({
|
|
1456
|
+
address: this.contractAddress,
|
|
1457
|
+
abi: EnvelopwNFT721_jsonAbi,
|
|
1458
|
+
eventName: 'OwnershipTransferred',
|
|
1459
|
+
args: filter,
|
|
1460
|
+
onLogs: (logs: any[]) => {
|
|
1461
|
+
logs.forEach((log: any) => {
|
|
1462
|
+
callback(log.args as any);
|
|
1463
|
+
});
|
|
1464
|
+
},
|
|
1465
|
+
}) as () => void;
|
|
1466
|
+
},
|
|
1467
|
+
/**
|
|
1468
|
+
* Watch Transfer events
|
|
1469
|
+
* @param callback Function to call when event is emitted
|
|
1470
|
+
* @param filter Optional filter for indexed parameters
|
|
1471
|
+
* @returns Unwatch function to stop listening
|
|
1472
|
+
*/
|
|
1473
|
+
Transfer: (callback: (event: { from: `0x${string}`; to: `0x${string}`; tokenId: bigint }) => void, filter?: { from: `0x${string}`; to: `0x${string}`; tokenId: bigint }) => {
|
|
1474
|
+
return this.publicClient.watchContractEvent({
|
|
1475
|
+
address: this.contractAddress,
|
|
1476
|
+
abi: EnvelopwNFT721_jsonAbi,
|
|
1477
|
+
eventName: 'Transfer',
|
|
1478
|
+
args: filter,
|
|
1479
|
+
onLogs: (logs: any[]) => {
|
|
1480
|
+
logs.forEach((log: any) => {
|
|
1481
|
+
callback(log.args as any);
|
|
1482
|
+
});
|
|
1483
|
+
},
|
|
1484
|
+
}) as () => void;
|
|
1485
|
+
}
|
|
1486
|
+
};
|
|
1487
|
+
}
|
|
1488
|
+
}
|