@gitmyabi/gogo 1.0.0 → 1.0.1
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 +5 -5
- package/contracts/{MightyMorphinPowerRangers_json.d.ts → GOGOToken.d.ts} +287 -131
- package/contracts/{MightyMorphinPowerRangers_json.js → GOGOToken.js} +324 -138
- package/contracts/{MightyMorphinPowerRangers_json.ts → GOGOToken.ts} +358 -144
- package/contracts/index.d.ts +2 -2
- package/contracts/index.js +4 -4
- package/contracts/index.ts +2 -2
- package/package.json +4 -4
|
@@ -2,254 +2,386 @@ import type { Abi, Address, PublicClient, WalletClient, GetContractReturnType }
|
|
|
2
2
|
import { getContract } from 'viem';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* GOGOToken ABI
|
|
6
6
|
*
|
|
7
7
|
* This ABI is typed using viem's type system for full type safety.
|
|
8
8
|
*/
|
|
9
|
-
export const
|
|
9
|
+
export const GOGOTokenAbi = [
|
|
10
10
|
{
|
|
11
|
+
"constant": true,
|
|
11
12
|
"inputs": [],
|
|
12
|
-
"
|
|
13
|
-
"
|
|
13
|
+
"name": "name",
|
|
14
|
+
"outputs": [
|
|
15
|
+
{
|
|
16
|
+
"name": "",
|
|
17
|
+
"type": "string"
|
|
18
|
+
}
|
|
19
|
+
],
|
|
20
|
+
"payable": false,
|
|
21
|
+
"stateMutability": "view",
|
|
22
|
+
"type": "function"
|
|
14
23
|
},
|
|
15
24
|
{
|
|
16
|
-
"
|
|
25
|
+
"constant": false,
|
|
17
26
|
"inputs": [
|
|
18
27
|
{
|
|
19
|
-
"indexed": true,
|
|
20
|
-
"internalType": "address",
|
|
21
|
-
"name": "owner",
|
|
22
|
-
"type": "address"
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
"indexed": true,
|
|
26
|
-
"internalType": "address",
|
|
27
28
|
"name": "spender",
|
|
28
29
|
"type": "address"
|
|
29
30
|
},
|
|
30
31
|
{
|
|
31
|
-
"
|
|
32
|
-
"internalType": "uint256",
|
|
33
|
-
"name": "value",
|
|
32
|
+
"name": "tokens",
|
|
34
33
|
"type": "uint256"
|
|
35
34
|
}
|
|
36
35
|
],
|
|
37
|
-
"name": "
|
|
38
|
-
"
|
|
36
|
+
"name": "approve",
|
|
37
|
+
"outputs": [
|
|
38
|
+
{
|
|
39
|
+
"name": "success",
|
|
40
|
+
"type": "bool"
|
|
41
|
+
}
|
|
42
|
+
],
|
|
43
|
+
"payable": false,
|
|
44
|
+
"stateMutability": "nonpayable",
|
|
45
|
+
"type": "function"
|
|
39
46
|
},
|
|
40
47
|
{
|
|
41
|
-
"
|
|
48
|
+
"constant": true,
|
|
49
|
+
"inputs": [],
|
|
50
|
+
"name": "totalSupply",
|
|
51
|
+
"outputs": [
|
|
52
|
+
{
|
|
53
|
+
"name": "",
|
|
54
|
+
"type": "uint256"
|
|
55
|
+
}
|
|
56
|
+
],
|
|
57
|
+
"payable": false,
|
|
58
|
+
"stateMutability": "view",
|
|
59
|
+
"type": "function"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"constant": false,
|
|
42
63
|
"inputs": [
|
|
43
64
|
{
|
|
44
|
-
"indexed": true,
|
|
45
|
-
"internalType": "address",
|
|
46
65
|
"name": "from",
|
|
47
66
|
"type": "address"
|
|
48
67
|
},
|
|
49
68
|
{
|
|
50
|
-
"indexed": true,
|
|
51
|
-
"internalType": "address",
|
|
52
69
|
"name": "to",
|
|
53
70
|
"type": "address"
|
|
54
71
|
},
|
|
55
72
|
{
|
|
56
|
-
"
|
|
57
|
-
"internalType": "uint256",
|
|
58
|
-
"name": "value",
|
|
73
|
+
"name": "tokens",
|
|
59
74
|
"type": "uint256"
|
|
60
75
|
}
|
|
61
76
|
],
|
|
62
|
-
"name": "
|
|
63
|
-
"
|
|
77
|
+
"name": "transferFrom",
|
|
78
|
+
"outputs": [
|
|
79
|
+
{
|
|
80
|
+
"name": "success",
|
|
81
|
+
"type": "bool"
|
|
82
|
+
}
|
|
83
|
+
],
|
|
84
|
+
"payable": false,
|
|
85
|
+
"stateMutability": "nonpayable",
|
|
86
|
+
"type": "function"
|
|
64
87
|
},
|
|
65
88
|
{
|
|
66
|
-
"
|
|
89
|
+
"constant": true,
|
|
90
|
+
"inputs": [],
|
|
91
|
+
"name": "decimals",
|
|
92
|
+
"outputs": [
|
|
67
93
|
{
|
|
68
|
-
"internalType": "address",
|
|
69
94
|
"name": "",
|
|
70
|
-
"type": "
|
|
71
|
-
}
|
|
95
|
+
"type": "uint8"
|
|
96
|
+
}
|
|
97
|
+
],
|
|
98
|
+
"payable": false,
|
|
99
|
+
"stateMutability": "view",
|
|
100
|
+
"type": "function"
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"constant": true,
|
|
104
|
+
"inputs": [],
|
|
105
|
+
"name": "_totalSupply",
|
|
106
|
+
"outputs": [
|
|
72
107
|
{
|
|
73
|
-
"internalType": "address",
|
|
74
108
|
"name": "",
|
|
109
|
+
"type": "uint256"
|
|
110
|
+
}
|
|
111
|
+
],
|
|
112
|
+
"payable": false,
|
|
113
|
+
"stateMutability": "view",
|
|
114
|
+
"type": "function"
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
"constant": true,
|
|
118
|
+
"inputs": [
|
|
119
|
+
{
|
|
120
|
+
"name": "tokenOwner",
|
|
75
121
|
"type": "address"
|
|
76
122
|
}
|
|
77
123
|
],
|
|
78
|
-
"name": "
|
|
124
|
+
"name": "balanceOf",
|
|
79
125
|
"outputs": [
|
|
80
126
|
{
|
|
81
|
-
"
|
|
82
|
-
"name": "",
|
|
127
|
+
"name": "balance",
|
|
83
128
|
"type": "uint256"
|
|
84
129
|
}
|
|
85
130
|
],
|
|
131
|
+
"payable": false,
|
|
86
132
|
"stateMutability": "view",
|
|
87
133
|
"type": "function"
|
|
88
134
|
},
|
|
89
135
|
{
|
|
136
|
+
"constant": true,
|
|
137
|
+
"inputs": [],
|
|
138
|
+
"name": "symbol",
|
|
139
|
+
"outputs": [
|
|
140
|
+
{
|
|
141
|
+
"name": "",
|
|
142
|
+
"type": "string"
|
|
143
|
+
}
|
|
144
|
+
],
|
|
145
|
+
"payable": false,
|
|
146
|
+
"stateMutability": "view",
|
|
147
|
+
"type": "function"
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
"constant": true,
|
|
90
151
|
"inputs": [
|
|
91
152
|
{
|
|
92
|
-
"
|
|
93
|
-
"
|
|
94
|
-
"type": "address"
|
|
153
|
+
"name": "a",
|
|
154
|
+
"type": "uint256"
|
|
95
155
|
},
|
|
96
156
|
{
|
|
97
|
-
"
|
|
98
|
-
"name": "value",
|
|
157
|
+
"name": "b",
|
|
99
158
|
"type": "uint256"
|
|
100
159
|
}
|
|
101
160
|
],
|
|
102
|
-
"name": "
|
|
161
|
+
"name": "safeSub",
|
|
103
162
|
"outputs": [
|
|
104
163
|
{
|
|
105
|
-
"
|
|
106
|
-
"
|
|
107
|
-
"type": "bool"
|
|
164
|
+
"name": "c",
|
|
165
|
+
"type": "uint256"
|
|
108
166
|
}
|
|
109
167
|
],
|
|
110
|
-
"
|
|
168
|
+
"payable": false,
|
|
169
|
+
"stateMutability": "pure",
|
|
111
170
|
"type": "function"
|
|
112
171
|
},
|
|
113
172
|
{
|
|
173
|
+
"constant": false,
|
|
114
174
|
"inputs": [
|
|
115
175
|
{
|
|
116
|
-
"
|
|
117
|
-
"name": "",
|
|
176
|
+
"name": "to",
|
|
118
177
|
"type": "address"
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
"name": "tokens",
|
|
181
|
+
"type": "uint256"
|
|
119
182
|
}
|
|
120
183
|
],
|
|
121
|
-
"name": "
|
|
184
|
+
"name": "transfer",
|
|
122
185
|
"outputs": [
|
|
123
186
|
{
|
|
124
|
-
"
|
|
125
|
-
"
|
|
126
|
-
"type": "uint256"
|
|
187
|
+
"name": "success",
|
|
188
|
+
"type": "bool"
|
|
127
189
|
}
|
|
128
190
|
],
|
|
129
|
-
"
|
|
191
|
+
"payable": false,
|
|
192
|
+
"stateMutability": "nonpayable",
|
|
130
193
|
"type": "function"
|
|
131
194
|
},
|
|
132
195
|
{
|
|
133
|
-
"
|
|
134
|
-
"
|
|
196
|
+
"constant": true,
|
|
197
|
+
"inputs": [
|
|
198
|
+
{
|
|
199
|
+
"name": "a",
|
|
200
|
+
"type": "uint256"
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
"name": "b",
|
|
204
|
+
"type": "uint256"
|
|
205
|
+
}
|
|
206
|
+
],
|
|
207
|
+
"name": "safeDiv",
|
|
135
208
|
"outputs": [
|
|
136
209
|
{
|
|
137
|
-
"
|
|
138
|
-
"
|
|
139
|
-
"type": "uint8"
|
|
210
|
+
"name": "c",
|
|
211
|
+
"type": "uint256"
|
|
140
212
|
}
|
|
141
213
|
],
|
|
142
|
-
"
|
|
214
|
+
"payable": false,
|
|
215
|
+
"stateMutability": "pure",
|
|
143
216
|
"type": "function"
|
|
144
217
|
},
|
|
145
218
|
{
|
|
146
|
-
"
|
|
147
|
-
"
|
|
219
|
+
"constant": false,
|
|
220
|
+
"inputs": [
|
|
221
|
+
{
|
|
222
|
+
"name": "spender",
|
|
223
|
+
"type": "address"
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
"name": "tokens",
|
|
227
|
+
"type": "uint256"
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
"name": "data",
|
|
231
|
+
"type": "bytes"
|
|
232
|
+
}
|
|
233
|
+
],
|
|
234
|
+
"name": "approveAndCall",
|
|
148
235
|
"outputs": [
|
|
149
236
|
{
|
|
150
|
-
"
|
|
151
|
-
"
|
|
152
|
-
"type": "string"
|
|
237
|
+
"name": "success",
|
|
238
|
+
"type": "bool"
|
|
153
239
|
}
|
|
154
240
|
],
|
|
155
|
-
"
|
|
241
|
+
"payable": false,
|
|
242
|
+
"stateMutability": "nonpayable",
|
|
156
243
|
"type": "function"
|
|
157
244
|
},
|
|
158
245
|
{
|
|
159
|
-
"
|
|
160
|
-
"
|
|
246
|
+
"constant": true,
|
|
247
|
+
"inputs": [
|
|
248
|
+
{
|
|
249
|
+
"name": "a",
|
|
250
|
+
"type": "uint256"
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
"name": "b",
|
|
254
|
+
"type": "uint256"
|
|
255
|
+
}
|
|
256
|
+
],
|
|
257
|
+
"name": "safeMul",
|
|
161
258
|
"outputs": [
|
|
162
259
|
{
|
|
163
|
-
"
|
|
164
|
-
"
|
|
165
|
-
"type": "string"
|
|
260
|
+
"name": "c",
|
|
261
|
+
"type": "uint256"
|
|
166
262
|
}
|
|
167
263
|
],
|
|
168
|
-
"
|
|
264
|
+
"payable": false,
|
|
265
|
+
"stateMutability": "pure",
|
|
169
266
|
"type": "function"
|
|
170
267
|
},
|
|
171
268
|
{
|
|
172
|
-
"
|
|
173
|
-
"
|
|
269
|
+
"constant": true,
|
|
270
|
+
"inputs": [
|
|
271
|
+
{
|
|
272
|
+
"name": "tokenOwner",
|
|
273
|
+
"type": "address"
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
"name": "spender",
|
|
277
|
+
"type": "address"
|
|
278
|
+
}
|
|
279
|
+
],
|
|
280
|
+
"name": "allowance",
|
|
174
281
|
"outputs": [
|
|
175
282
|
{
|
|
176
|
-
"
|
|
177
|
-
"name": "",
|
|
283
|
+
"name": "remaining",
|
|
178
284
|
"type": "uint256"
|
|
179
285
|
}
|
|
180
286
|
],
|
|
287
|
+
"payable": false,
|
|
181
288
|
"stateMutability": "view",
|
|
182
289
|
"type": "function"
|
|
183
290
|
},
|
|
184
291
|
{
|
|
292
|
+
"constant": true,
|
|
185
293
|
"inputs": [
|
|
186
294
|
{
|
|
187
|
-
"
|
|
188
|
-
"
|
|
189
|
-
"type": "address"
|
|
295
|
+
"name": "a",
|
|
296
|
+
"type": "uint256"
|
|
190
297
|
},
|
|
191
298
|
{
|
|
192
|
-
"
|
|
193
|
-
"name": "value",
|
|
299
|
+
"name": "b",
|
|
194
300
|
"type": "uint256"
|
|
195
301
|
}
|
|
196
302
|
],
|
|
197
|
-
"name": "
|
|
303
|
+
"name": "safeAdd",
|
|
198
304
|
"outputs": [
|
|
199
305
|
{
|
|
200
|
-
"
|
|
201
|
-
"
|
|
202
|
-
"type": "bool"
|
|
306
|
+
"name": "c",
|
|
307
|
+
"type": "uint256"
|
|
203
308
|
}
|
|
204
309
|
],
|
|
205
|
-
"
|
|
310
|
+
"payable": false,
|
|
311
|
+
"stateMutability": "pure",
|
|
206
312
|
"type": "function"
|
|
207
313
|
},
|
|
208
314
|
{
|
|
315
|
+
"inputs": [],
|
|
316
|
+
"payable": false,
|
|
317
|
+
"stateMutability": "nonpayable",
|
|
318
|
+
"type": "constructor"
|
|
319
|
+
},
|
|
320
|
+
{
|
|
321
|
+
"payable": true,
|
|
322
|
+
"stateMutability": "payable",
|
|
323
|
+
"type": "fallback"
|
|
324
|
+
},
|
|
325
|
+
{
|
|
326
|
+
"anonymous": false,
|
|
209
327
|
"inputs": [
|
|
210
328
|
{
|
|
211
|
-
"
|
|
329
|
+
"indexed": true,
|
|
212
330
|
"name": "from",
|
|
213
331
|
"type": "address"
|
|
214
332
|
},
|
|
215
333
|
{
|
|
216
|
-
"
|
|
334
|
+
"indexed": true,
|
|
217
335
|
"name": "to",
|
|
218
336
|
"type": "address"
|
|
219
337
|
},
|
|
220
338
|
{
|
|
221
|
-
"
|
|
222
|
-
"name": "
|
|
339
|
+
"indexed": false,
|
|
340
|
+
"name": "tokens",
|
|
223
341
|
"type": "uint256"
|
|
224
342
|
}
|
|
225
343
|
],
|
|
226
|
-
"name": "
|
|
227
|
-
"
|
|
344
|
+
"name": "Transfer",
|
|
345
|
+
"type": "event"
|
|
346
|
+
},
|
|
347
|
+
{
|
|
348
|
+
"anonymous": false,
|
|
349
|
+
"inputs": [
|
|
228
350
|
{
|
|
229
|
-
"
|
|
230
|
-
"name": "",
|
|
231
|
-
"type": "
|
|
351
|
+
"indexed": true,
|
|
352
|
+
"name": "tokenOwner",
|
|
353
|
+
"type": "address"
|
|
354
|
+
},
|
|
355
|
+
{
|
|
356
|
+
"indexed": true,
|
|
357
|
+
"name": "spender",
|
|
358
|
+
"type": "address"
|
|
359
|
+
},
|
|
360
|
+
{
|
|
361
|
+
"indexed": false,
|
|
362
|
+
"name": "tokens",
|
|
363
|
+
"type": "uint256"
|
|
232
364
|
}
|
|
233
365
|
],
|
|
234
|
-
"
|
|
235
|
-
"type": "
|
|
366
|
+
"name": "Approval",
|
|
367
|
+
"type": "event"
|
|
236
368
|
}
|
|
237
369
|
] as const satisfies Abi;
|
|
238
370
|
|
|
239
371
|
/**
|
|
240
|
-
* Type-safe ABI for
|
|
372
|
+
* Type-safe ABI for GOGOToken
|
|
241
373
|
*/
|
|
242
|
-
export type
|
|
374
|
+
export type GOGOTokenAbi = typeof GOGOTokenAbi;
|
|
243
375
|
|
|
244
376
|
/**
|
|
245
|
-
* Contract instance type for
|
|
377
|
+
* Contract instance type for GOGOToken
|
|
246
378
|
*/
|
|
247
379
|
// Use any for contract type to avoid complex viem type issues
|
|
248
380
|
// The runtime behavior is type-safe through viem's ABI typing
|
|
249
|
-
export type
|
|
381
|
+
export type GOGOTokenContract = any;
|
|
250
382
|
|
|
251
383
|
/**
|
|
252
|
-
*
|
|
384
|
+
* GOGOToken Contract Class
|
|
253
385
|
*
|
|
254
386
|
* Provides a class-based API similar to TypeChain for interacting with the contract.
|
|
255
387
|
*
|
|
@@ -257,12 +389,12 @@ export type MightyMorphinPowerRangers_jsonContract = any;
|
|
|
257
389
|
* ```typescript
|
|
258
390
|
* import { createPublicClient, createWalletClient, http } from 'viem';
|
|
259
391
|
* import { mainnet } from 'viem/chains';
|
|
260
|
-
* import {
|
|
392
|
+
* import { GOGOToken } from 'GOGOToken';
|
|
261
393
|
*
|
|
262
394
|
* const publicClient = createPublicClient({ chain: mainnet, transport: http() });
|
|
263
395
|
* const walletClient = createWalletClient({ chain: mainnet, transport: http() });
|
|
264
396
|
*
|
|
265
|
-
* const contract = new
|
|
397
|
+
* const contract = new GOGOToken('0x...', { publicClient, walletClient });
|
|
266
398
|
*
|
|
267
399
|
* // Read functions
|
|
268
400
|
* const result = await contract.balanceOf('0x...');
|
|
@@ -280,8 +412,8 @@ export type MightyMorphinPowerRangers_jsonContract = any;
|
|
|
280
412
|
* });
|
|
281
413
|
* ```
|
|
282
414
|
*/
|
|
283
|
-
export class
|
|
284
|
-
private contract:
|
|
415
|
+
export class GOGOToken {
|
|
416
|
+
private contract: GOGOTokenContract;
|
|
285
417
|
private contractAddress: Address;
|
|
286
418
|
private publicClient: PublicClient;
|
|
287
419
|
|
|
@@ -296,7 +428,7 @@ export class MightyMorphinPowerRangers_json {
|
|
|
296
428
|
this.publicClient = clients.publicClient;
|
|
297
429
|
this.contract = getContract({
|
|
298
430
|
address,
|
|
299
|
-
abi:
|
|
431
|
+
abi: GOGOTokenAbi,
|
|
300
432
|
client: {
|
|
301
433
|
public: clients.publicClient,
|
|
302
434
|
wallet: clients.walletClient,
|
|
@@ -312,26 +444,26 @@ export class MightyMorphinPowerRangers_json {
|
|
|
312
444
|
}
|
|
313
445
|
|
|
314
446
|
/**
|
|
315
|
-
* Get the underlying viem contract instance
|
|
447
|
+
* Get the underlying viem contract instance.
|
|
316
448
|
*/
|
|
317
|
-
getContract():
|
|
449
|
+
getContract(): GOGOTokenContract {
|
|
318
450
|
return this.contract;
|
|
319
451
|
}
|
|
320
452
|
|
|
321
453
|
/**
|
|
322
|
-
*
|
|
454
|
+
* name
|
|
323
455
|
* view
|
|
324
456
|
*/
|
|
325
|
-
async
|
|
326
|
-
return this.contract.read.
|
|
457
|
+
async name(): Promise<string> {
|
|
458
|
+
return this.contract.read.name() as Promise<string>;
|
|
327
459
|
}
|
|
328
460
|
|
|
329
461
|
/**
|
|
330
|
-
*
|
|
462
|
+
* totalSupply
|
|
331
463
|
* view
|
|
332
464
|
*/
|
|
333
|
-
async
|
|
334
|
-
return this.contract.read.
|
|
465
|
+
async totalSupply(): Promise<bigint> {
|
|
466
|
+
return this.contract.read.totalSupply() as Promise<bigint>;
|
|
335
467
|
}
|
|
336
468
|
|
|
337
469
|
/**
|
|
@@ -343,11 +475,19 @@ export class MightyMorphinPowerRangers_json {
|
|
|
343
475
|
}
|
|
344
476
|
|
|
345
477
|
/**
|
|
346
|
-
*
|
|
478
|
+
* _totalSupply
|
|
347
479
|
* view
|
|
348
480
|
*/
|
|
349
|
-
async
|
|
350
|
-
return this.contract.read.
|
|
481
|
+
async _totalSupply(): Promise<bigint> {
|
|
482
|
+
return this.contract.read._totalSupply() as Promise<bigint>;
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
/**
|
|
486
|
+
* balanceOf
|
|
487
|
+
* view
|
|
488
|
+
*/
|
|
489
|
+
async balanceOf(tokenOwner: `0x${string}`): Promise<bigint> {
|
|
490
|
+
return this.contract.read.balanceOf([tokenOwner] as const) as Promise<bigint>;
|
|
351
491
|
}
|
|
352
492
|
|
|
353
493
|
/**
|
|
@@ -359,11 +499,43 @@ export class MightyMorphinPowerRangers_json {
|
|
|
359
499
|
}
|
|
360
500
|
|
|
361
501
|
/**
|
|
362
|
-
*
|
|
502
|
+
* safeSub
|
|
503
|
+
* pure
|
|
504
|
+
*/
|
|
505
|
+
async safeSub(a: bigint, b: bigint): Promise<bigint> {
|
|
506
|
+
return this.contract.read.safeSub([a, b] as const) as Promise<bigint>;
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
/**
|
|
510
|
+
* safeDiv
|
|
511
|
+
* pure
|
|
512
|
+
*/
|
|
513
|
+
async safeDiv(a: bigint, b: bigint): Promise<bigint> {
|
|
514
|
+
return this.contract.read.safeDiv([a, b] as const) as Promise<bigint>;
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
/**
|
|
518
|
+
* safeMul
|
|
519
|
+
* pure
|
|
520
|
+
*/
|
|
521
|
+
async safeMul(a: bigint, b: bigint): Promise<bigint> {
|
|
522
|
+
return this.contract.read.safeMul([a, b] as const) as Promise<bigint>;
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
/**
|
|
526
|
+
* allowance
|
|
363
527
|
* view
|
|
364
528
|
*/
|
|
365
|
-
async
|
|
366
|
-
return this.contract.read.
|
|
529
|
+
async allowance(tokenOwner: `0x${string}`, spender: `0x${string}`): Promise<bigint> {
|
|
530
|
+
return this.contract.read.allowance([tokenOwner, spender] as const) as Promise<bigint>;
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
/**
|
|
534
|
+
* safeAdd
|
|
535
|
+
* pure
|
|
536
|
+
*/
|
|
537
|
+
async safeAdd(a: bigint, b: bigint): Promise<bigint> {
|
|
538
|
+
return this.contract.read.safeAdd([a, b] as const) as Promise<bigint>;
|
|
367
539
|
}
|
|
368
540
|
|
|
369
541
|
/**
|
|
@@ -371,7 +543,7 @@ export class MightyMorphinPowerRangers_json {
|
|
|
371
543
|
* nonpayable
|
|
372
544
|
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
373
545
|
*/
|
|
374
|
-
async approve(spender: `0x${string}`,
|
|
546
|
+
async approve(spender: `0x${string}`, tokens: bigint, options?: {
|
|
375
547
|
accessList?: import('viem').AccessList;
|
|
376
548
|
authorizationList?: import('viem').AuthorizationList;
|
|
377
549
|
chain?: import('viem').Chain | null;
|
|
@@ -386,7 +558,30 @@ export class MightyMorphinPowerRangers_json {
|
|
|
386
558
|
if (!this.contract.write) {
|
|
387
559
|
throw new Error('Wallet client is required for write operations');
|
|
388
560
|
}
|
|
389
|
-
return this.contract.write.approve([spender,
|
|
561
|
+
return this.contract.write.approve([spender, tokens] as const, options) as Promise<`0x${string}`>;
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
/**
|
|
565
|
+
* transferFrom
|
|
566
|
+
* nonpayable
|
|
567
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
568
|
+
*/
|
|
569
|
+
async transferFrom(from: `0x${string}`, to: `0x${string}`, tokens: bigint, options?: {
|
|
570
|
+
accessList?: import('viem').AccessList;
|
|
571
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
572
|
+
chain?: import('viem').Chain | null;
|
|
573
|
+
dataSuffix?: `0x${string}`;
|
|
574
|
+
gas?: bigint;
|
|
575
|
+
gasPrice?: bigint;
|
|
576
|
+
maxFeePerGas?: bigint;
|
|
577
|
+
maxPriorityFeePerGas?: bigint;
|
|
578
|
+
nonce?: number;
|
|
579
|
+
value?: bigint;
|
|
580
|
+
}): Promise<`0x${string}`> {
|
|
581
|
+
if (!this.contract.write) {
|
|
582
|
+
throw new Error('Wallet client is required for write operations');
|
|
583
|
+
}
|
|
584
|
+
return this.contract.write.transferFrom([from, to, tokens] as const, options) as Promise<`0x${string}`>;
|
|
390
585
|
}
|
|
391
586
|
|
|
392
587
|
/**
|
|
@@ -394,7 +589,7 @@ export class MightyMorphinPowerRangers_json {
|
|
|
394
589
|
* nonpayable
|
|
395
590
|
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
396
591
|
*/
|
|
397
|
-
async transfer(to: `0x${string}`,
|
|
592
|
+
async transfer(to: `0x${string}`, tokens: bigint, options?: {
|
|
398
593
|
accessList?: import('viem').AccessList;
|
|
399
594
|
authorizationList?: import('viem').AuthorizationList;
|
|
400
595
|
chain?: import('viem').Chain | null;
|
|
@@ -409,15 +604,15 @@ export class MightyMorphinPowerRangers_json {
|
|
|
409
604
|
if (!this.contract.write) {
|
|
410
605
|
throw new Error('Wallet client is required for write operations');
|
|
411
606
|
}
|
|
412
|
-
return this.contract.write.transfer([to,
|
|
607
|
+
return this.contract.write.transfer([to, tokens] as const, options) as Promise<`0x${string}`>;
|
|
413
608
|
}
|
|
414
609
|
|
|
415
610
|
/**
|
|
416
|
-
*
|
|
611
|
+
* approveAndCall
|
|
417
612
|
* nonpayable
|
|
418
613
|
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
419
614
|
*/
|
|
420
|
-
async
|
|
615
|
+
async approveAndCall(spender: `0x${string}`, tokens: bigint, data: `0x${string}`, options?: {
|
|
421
616
|
accessList?: import('viem').AccessList;
|
|
422
617
|
authorizationList?: import('viem').AuthorizationList;
|
|
423
618
|
chain?: import('viem').Chain | null;
|
|
@@ -432,7 +627,7 @@ export class MightyMorphinPowerRangers_json {
|
|
|
432
627
|
if (!this.contract.write) {
|
|
433
628
|
throw new Error('Wallet client is required for write operations');
|
|
434
629
|
}
|
|
435
|
-
return this.contract.write.
|
|
630
|
+
return this.contract.write.approveAndCall([spender, tokens, data] as const, options) as Promise<`0x${string}`>;
|
|
436
631
|
}
|
|
437
632
|
|
|
438
633
|
|
|
@@ -456,7 +651,7 @@ export class MightyMorphinPowerRangers_json {
|
|
|
456
651
|
* Returns gas estimate and result without sending transaction
|
|
457
652
|
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
458
653
|
*/
|
|
459
|
-
async approve(spender: `0x${string}`,
|
|
654
|
+
async approve(spender: `0x${string}`, tokens: bigint, options?: {
|
|
460
655
|
accessList?: import('viem').AccessList;
|
|
461
656
|
authorizationList?: import('viem').AuthorizationList;
|
|
462
657
|
chain?: import('viem').Chain | null;
|
|
@@ -468,14 +663,33 @@ export class MightyMorphinPowerRangers_json {
|
|
|
468
663
|
nonce?: number;
|
|
469
664
|
value?: bigint;
|
|
470
665
|
}): Promise<boolean> {
|
|
471
|
-
return contract.simulate.approve([spender,
|
|
666
|
+
return contract.simulate.approve([spender, tokens] as const, options) as Promise<boolean>;
|
|
667
|
+
},
|
|
668
|
+
/**
|
|
669
|
+
* Simulate transferFrom
|
|
670
|
+
* Returns gas estimate and result without sending transaction
|
|
671
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
672
|
+
*/
|
|
673
|
+
async transferFrom(from: `0x${string}`, to: `0x${string}`, tokens: bigint, options?: {
|
|
674
|
+
accessList?: import('viem').AccessList;
|
|
675
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
676
|
+
chain?: import('viem').Chain | null;
|
|
677
|
+
dataSuffix?: `0x${string}`;
|
|
678
|
+
gas?: bigint;
|
|
679
|
+
gasPrice?: bigint;
|
|
680
|
+
maxFeePerGas?: bigint;
|
|
681
|
+
maxPriorityFeePerGas?: bigint;
|
|
682
|
+
nonce?: number;
|
|
683
|
+
value?: bigint;
|
|
684
|
+
}): Promise<boolean> {
|
|
685
|
+
return contract.simulate.transferFrom([from, to, tokens] as const, options) as Promise<boolean>;
|
|
472
686
|
},
|
|
473
687
|
/**
|
|
474
688
|
* Simulate transfer
|
|
475
689
|
* Returns gas estimate and result without sending transaction
|
|
476
690
|
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
477
691
|
*/
|
|
478
|
-
async transfer(to: `0x${string}`,
|
|
692
|
+
async transfer(to: `0x${string}`, tokens: bigint, options?: {
|
|
479
693
|
accessList?: import('viem').AccessList;
|
|
480
694
|
authorizationList?: import('viem').AuthorizationList;
|
|
481
695
|
chain?: import('viem').Chain | null;
|
|
@@ -487,14 +701,14 @@ export class MightyMorphinPowerRangers_json {
|
|
|
487
701
|
nonce?: number;
|
|
488
702
|
value?: bigint;
|
|
489
703
|
}): Promise<boolean> {
|
|
490
|
-
return contract.simulate.transfer([to,
|
|
704
|
+
return contract.simulate.transfer([to, tokens] as const, options) as Promise<boolean>;
|
|
491
705
|
},
|
|
492
706
|
/**
|
|
493
|
-
* Simulate
|
|
707
|
+
* Simulate approveAndCall
|
|
494
708
|
* Returns gas estimate and result without sending transaction
|
|
495
709
|
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
496
710
|
*/
|
|
497
|
-
async
|
|
711
|
+
async approveAndCall(spender: `0x${string}`, tokens: bigint, data: `0x${string}`, options?: {
|
|
498
712
|
accessList?: import('viem').AccessList;
|
|
499
713
|
authorizationList?: import('viem').AuthorizationList;
|
|
500
714
|
chain?: import('viem').Chain | null;
|
|
@@ -506,7 +720,7 @@ export class MightyMorphinPowerRangers_json {
|
|
|
506
720
|
nonce?: number;
|
|
507
721
|
value?: bigint;
|
|
508
722
|
}): Promise<boolean> {
|
|
509
|
-
return contract.simulate.
|
|
723
|
+
return contract.simulate.approveAndCall([spender, tokens, data] as const, options) as Promise<boolean>;
|
|
510
724
|
}
|
|
511
725
|
};
|
|
512
726
|
}
|
|
@@ -526,17 +740,17 @@ export class MightyMorphinPowerRangers_json {
|
|
|
526
740
|
get watch() {
|
|
527
741
|
return {
|
|
528
742
|
/**
|
|
529
|
-
* Watch
|
|
743
|
+
* Watch Transfer events
|
|
530
744
|
* @param callback Function to call when event is emitted
|
|
531
745
|
* @param filter Optional filter for indexed parameters
|
|
532
746
|
* @returns Unwatch function to stop listening
|
|
533
747
|
*/
|
|
534
|
-
|
|
748
|
+
Transfer: (callback: (event: { from: `0x${string}`; to: `0x${string}`; tokens: bigint }) => void, filter?: { from?: `0x${string}` | `0x${string}`[] | null; to?: `0x${string}` | `0x${string}`[] | null }) => {
|
|
535
749
|
return this.publicClient.watchContractEvent({
|
|
536
750
|
address: this.contractAddress,
|
|
537
|
-
abi:
|
|
538
|
-
eventName: '
|
|
539
|
-
args: filter,
|
|
751
|
+
abi: GOGOTokenAbi,
|
|
752
|
+
eventName: 'Transfer',
|
|
753
|
+
args: filter as any,
|
|
540
754
|
onLogs: (logs: any[]) => {
|
|
541
755
|
logs.forEach((log: any) => {
|
|
542
756
|
callback(log.args as any);
|
|
@@ -545,17 +759,17 @@ export class MightyMorphinPowerRangers_json {
|
|
|
545
759
|
}) as () => void;
|
|
546
760
|
},
|
|
547
761
|
/**
|
|
548
|
-
* Watch
|
|
762
|
+
* Watch Approval events
|
|
549
763
|
* @param callback Function to call when event is emitted
|
|
550
764
|
* @param filter Optional filter for indexed parameters
|
|
551
765
|
* @returns Unwatch function to stop listening
|
|
552
766
|
*/
|
|
553
|
-
|
|
767
|
+
Approval: (callback: (event: { tokenOwner: `0x${string}`; spender: `0x${string}`; tokens: bigint }) => void, filter?: { tokenOwner?: `0x${string}` | `0x${string}`[] | null; spender?: `0x${string}` | `0x${string}`[] | null }) => {
|
|
554
768
|
return this.publicClient.watchContractEvent({
|
|
555
769
|
address: this.contractAddress,
|
|
556
|
-
abi:
|
|
557
|
-
eventName: '
|
|
558
|
-
args: filter,
|
|
770
|
+
abi: GOGOTokenAbi,
|
|
771
|
+
eventName: 'Approval',
|
|
772
|
+
args: filter as any,
|
|
559
773
|
onLogs: (logs: any[]) => {
|
|
560
774
|
logs.forEach((log: any) => {
|
|
561
775
|
callback(log.args as any);
|