@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.
@@ -1,243 +1,375 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MightyMorphinPowerRangers_json = exports.MightyMorphinPowerRangers_jsonAbi = void 0;
3
+ exports.GOGOToken = exports.GOGOTokenAbi = void 0;
4
4
  const viem_1 = require("viem");
5
5
  /**
6
- * MightyMorphinPowerRangers_json ABI
6
+ * GOGOToken ABI
7
7
  *
8
8
  * This ABI is typed using viem's type system for full type safety.
9
9
  */
10
- exports.MightyMorphinPowerRangers_jsonAbi = [
10
+ exports.GOGOTokenAbi = [
11
11
  {
12
+ "constant": true,
12
13
  "inputs": [],
13
- "stateMutability": "nonpayable",
14
- "type": "constructor"
14
+ "name": "name",
15
+ "outputs": [
16
+ {
17
+ "name": "",
18
+ "type": "string"
19
+ }
20
+ ],
21
+ "payable": false,
22
+ "stateMutability": "view",
23
+ "type": "function"
15
24
  },
16
25
  {
17
- "anonymous": false,
26
+ "constant": false,
18
27
  "inputs": [
19
28
  {
20
- "indexed": true,
21
- "internalType": "address",
22
- "name": "owner",
23
- "type": "address"
24
- },
25
- {
26
- "indexed": true,
27
- "internalType": "address",
28
29
  "name": "spender",
29
30
  "type": "address"
30
31
  },
31
32
  {
32
- "indexed": false,
33
- "internalType": "uint256",
34
- "name": "value",
33
+ "name": "tokens",
35
34
  "type": "uint256"
36
35
  }
37
36
  ],
38
- "name": "Approval",
39
- "type": "event"
37
+ "name": "approve",
38
+ "outputs": [
39
+ {
40
+ "name": "success",
41
+ "type": "bool"
42
+ }
43
+ ],
44
+ "payable": false,
45
+ "stateMutability": "nonpayable",
46
+ "type": "function"
40
47
  },
41
48
  {
42
- "anonymous": false,
49
+ "constant": true,
50
+ "inputs": [],
51
+ "name": "totalSupply",
52
+ "outputs": [
53
+ {
54
+ "name": "",
55
+ "type": "uint256"
56
+ }
57
+ ],
58
+ "payable": false,
59
+ "stateMutability": "view",
60
+ "type": "function"
61
+ },
62
+ {
63
+ "constant": false,
43
64
  "inputs": [
44
65
  {
45
- "indexed": true,
46
- "internalType": "address",
47
66
  "name": "from",
48
67
  "type": "address"
49
68
  },
50
69
  {
51
- "indexed": true,
52
- "internalType": "address",
53
70
  "name": "to",
54
71
  "type": "address"
55
72
  },
56
73
  {
57
- "indexed": false,
58
- "internalType": "uint256",
59
- "name": "value",
74
+ "name": "tokens",
60
75
  "type": "uint256"
61
76
  }
62
77
  ],
63
- "name": "Transfer",
64
- "type": "event"
78
+ "name": "transferFrom",
79
+ "outputs": [
80
+ {
81
+ "name": "success",
82
+ "type": "bool"
83
+ }
84
+ ],
85
+ "payable": false,
86
+ "stateMutability": "nonpayable",
87
+ "type": "function"
65
88
  },
66
89
  {
67
- "inputs": [
90
+ "constant": true,
91
+ "inputs": [],
92
+ "name": "decimals",
93
+ "outputs": [
68
94
  {
69
- "internalType": "address",
70
95
  "name": "",
71
- "type": "address"
72
- },
96
+ "type": "uint8"
97
+ }
98
+ ],
99
+ "payable": false,
100
+ "stateMutability": "view",
101
+ "type": "function"
102
+ },
103
+ {
104
+ "constant": true,
105
+ "inputs": [],
106
+ "name": "_totalSupply",
107
+ "outputs": [
73
108
  {
74
- "internalType": "address",
75
109
  "name": "",
110
+ "type": "uint256"
111
+ }
112
+ ],
113
+ "payable": false,
114
+ "stateMutability": "view",
115
+ "type": "function"
116
+ },
117
+ {
118
+ "constant": true,
119
+ "inputs": [
120
+ {
121
+ "name": "tokenOwner",
76
122
  "type": "address"
77
123
  }
78
124
  ],
79
- "name": "allowance",
125
+ "name": "balanceOf",
80
126
  "outputs": [
81
127
  {
82
- "internalType": "uint256",
83
- "name": "",
128
+ "name": "balance",
84
129
  "type": "uint256"
85
130
  }
86
131
  ],
132
+ "payable": false,
87
133
  "stateMutability": "view",
88
134
  "type": "function"
89
135
  },
90
136
  {
137
+ "constant": true,
138
+ "inputs": [],
139
+ "name": "symbol",
140
+ "outputs": [
141
+ {
142
+ "name": "",
143
+ "type": "string"
144
+ }
145
+ ],
146
+ "payable": false,
147
+ "stateMutability": "view",
148
+ "type": "function"
149
+ },
150
+ {
151
+ "constant": true,
91
152
  "inputs": [
92
153
  {
93
- "internalType": "address",
94
- "name": "spender",
95
- "type": "address"
154
+ "name": "a",
155
+ "type": "uint256"
96
156
  },
97
157
  {
98
- "internalType": "uint256",
99
- "name": "value",
158
+ "name": "b",
100
159
  "type": "uint256"
101
160
  }
102
161
  ],
103
- "name": "approve",
162
+ "name": "safeSub",
104
163
  "outputs": [
105
164
  {
106
- "internalType": "bool",
107
- "name": "",
108
- "type": "bool"
165
+ "name": "c",
166
+ "type": "uint256"
109
167
  }
110
168
  ],
111
- "stateMutability": "nonpayable",
169
+ "payable": false,
170
+ "stateMutability": "pure",
112
171
  "type": "function"
113
172
  },
114
173
  {
174
+ "constant": false,
115
175
  "inputs": [
116
176
  {
117
- "internalType": "address",
118
- "name": "",
177
+ "name": "to",
119
178
  "type": "address"
179
+ },
180
+ {
181
+ "name": "tokens",
182
+ "type": "uint256"
120
183
  }
121
184
  ],
122
- "name": "balanceOf",
185
+ "name": "transfer",
123
186
  "outputs": [
124
187
  {
125
- "internalType": "uint256",
126
- "name": "",
127
- "type": "uint256"
188
+ "name": "success",
189
+ "type": "bool"
128
190
  }
129
191
  ],
130
- "stateMutability": "view",
192
+ "payable": false,
193
+ "stateMutability": "nonpayable",
131
194
  "type": "function"
132
195
  },
133
196
  {
134
- "inputs": [],
135
- "name": "decimals",
197
+ "constant": true,
198
+ "inputs": [
199
+ {
200
+ "name": "a",
201
+ "type": "uint256"
202
+ },
203
+ {
204
+ "name": "b",
205
+ "type": "uint256"
206
+ }
207
+ ],
208
+ "name": "safeDiv",
136
209
  "outputs": [
137
210
  {
138
- "internalType": "uint8",
139
- "name": "",
140
- "type": "uint8"
211
+ "name": "c",
212
+ "type": "uint256"
141
213
  }
142
214
  ],
143
- "stateMutability": "view",
215
+ "payable": false,
216
+ "stateMutability": "pure",
144
217
  "type": "function"
145
218
  },
146
219
  {
147
- "inputs": [],
148
- "name": "name",
220
+ "constant": false,
221
+ "inputs": [
222
+ {
223
+ "name": "spender",
224
+ "type": "address"
225
+ },
226
+ {
227
+ "name": "tokens",
228
+ "type": "uint256"
229
+ },
230
+ {
231
+ "name": "data",
232
+ "type": "bytes"
233
+ }
234
+ ],
235
+ "name": "approveAndCall",
149
236
  "outputs": [
150
237
  {
151
- "internalType": "string",
152
- "name": "",
153
- "type": "string"
238
+ "name": "success",
239
+ "type": "bool"
154
240
  }
155
241
  ],
156
- "stateMutability": "view",
242
+ "payable": false,
243
+ "stateMutability": "nonpayable",
157
244
  "type": "function"
158
245
  },
159
246
  {
160
- "inputs": [],
161
- "name": "symbol",
247
+ "constant": true,
248
+ "inputs": [
249
+ {
250
+ "name": "a",
251
+ "type": "uint256"
252
+ },
253
+ {
254
+ "name": "b",
255
+ "type": "uint256"
256
+ }
257
+ ],
258
+ "name": "safeMul",
162
259
  "outputs": [
163
260
  {
164
- "internalType": "string",
165
- "name": "",
166
- "type": "string"
261
+ "name": "c",
262
+ "type": "uint256"
167
263
  }
168
264
  ],
169
- "stateMutability": "view",
265
+ "payable": false,
266
+ "stateMutability": "pure",
170
267
  "type": "function"
171
268
  },
172
269
  {
173
- "inputs": [],
174
- "name": "totalSupply",
270
+ "constant": true,
271
+ "inputs": [
272
+ {
273
+ "name": "tokenOwner",
274
+ "type": "address"
275
+ },
276
+ {
277
+ "name": "spender",
278
+ "type": "address"
279
+ }
280
+ ],
281
+ "name": "allowance",
175
282
  "outputs": [
176
283
  {
177
- "internalType": "uint256",
178
- "name": "",
284
+ "name": "remaining",
179
285
  "type": "uint256"
180
286
  }
181
287
  ],
288
+ "payable": false,
182
289
  "stateMutability": "view",
183
290
  "type": "function"
184
291
  },
185
292
  {
293
+ "constant": true,
186
294
  "inputs": [
187
295
  {
188
- "internalType": "address",
189
- "name": "to",
190
- "type": "address"
296
+ "name": "a",
297
+ "type": "uint256"
191
298
  },
192
299
  {
193
- "internalType": "uint256",
194
- "name": "value",
300
+ "name": "b",
195
301
  "type": "uint256"
196
302
  }
197
303
  ],
198
- "name": "transfer",
304
+ "name": "safeAdd",
199
305
  "outputs": [
200
306
  {
201
- "internalType": "bool",
202
- "name": "",
203
- "type": "bool"
307
+ "name": "c",
308
+ "type": "uint256"
204
309
  }
205
310
  ],
206
- "stateMutability": "nonpayable",
311
+ "payable": false,
312
+ "stateMutability": "pure",
207
313
  "type": "function"
208
314
  },
209
315
  {
316
+ "inputs": [],
317
+ "payable": false,
318
+ "stateMutability": "nonpayable",
319
+ "type": "constructor"
320
+ },
321
+ {
322
+ "payable": true,
323
+ "stateMutability": "payable",
324
+ "type": "fallback"
325
+ },
326
+ {
327
+ "anonymous": false,
210
328
  "inputs": [
211
329
  {
212
- "internalType": "address",
330
+ "indexed": true,
213
331
  "name": "from",
214
332
  "type": "address"
215
333
  },
216
334
  {
217
- "internalType": "address",
335
+ "indexed": true,
218
336
  "name": "to",
219
337
  "type": "address"
220
338
  },
221
339
  {
222
- "internalType": "uint256",
223
- "name": "value",
340
+ "indexed": false,
341
+ "name": "tokens",
224
342
  "type": "uint256"
225
343
  }
226
344
  ],
227
- "name": "transferFrom",
228
- "outputs": [
345
+ "name": "Transfer",
346
+ "type": "event"
347
+ },
348
+ {
349
+ "anonymous": false,
350
+ "inputs": [
229
351
  {
230
- "internalType": "bool",
231
- "name": "",
232
- "type": "bool"
352
+ "indexed": true,
353
+ "name": "tokenOwner",
354
+ "type": "address"
355
+ },
356
+ {
357
+ "indexed": true,
358
+ "name": "spender",
359
+ "type": "address"
360
+ },
361
+ {
362
+ "indexed": false,
363
+ "name": "tokens",
364
+ "type": "uint256"
233
365
  }
234
366
  ],
235
- "stateMutability": "nonpayable",
236
- "type": "function"
367
+ "name": "Approval",
368
+ "type": "event"
237
369
  }
238
370
  ];
239
371
  /**
240
- * MightyMorphinPowerRangers_json Contract Class
372
+ * GOGOToken Contract Class
241
373
  *
242
374
  * Provides a class-based API similar to TypeChain for interacting with the contract.
243
375
  *
@@ -245,12 +377,12 @@ exports.MightyMorphinPowerRangers_jsonAbi = [
245
377
  * ```typescript
246
378
  * import { createPublicClient, createWalletClient, http } from 'viem';
247
379
  * import { mainnet } from 'viem/chains';
248
- * import { MightyMorphinPowerRangers_json } from 'MightyMorphinPowerRangers_json';
380
+ * import { GOGOToken } from 'GOGOToken';
249
381
  *
250
382
  * const publicClient = createPublicClient({ chain: mainnet, transport: http() });
251
383
  * const walletClient = createWalletClient({ chain: mainnet, transport: http() });
252
384
  *
253
- * const contract = new MightyMorphinPowerRangers_json('0x...', { publicClient, walletClient });
385
+ * const contract = new GOGOToken('0x...', { publicClient, walletClient });
254
386
  *
255
387
  * // Read functions
256
388
  * const result = await contract.balanceOf('0x...');
@@ -268,13 +400,13 @@ exports.MightyMorphinPowerRangers_jsonAbi = [
268
400
  * });
269
401
  * ```
270
402
  */
271
- class MightyMorphinPowerRangers_json {
403
+ class GOGOToken {
272
404
  constructor(address, clients) {
273
405
  this.contractAddress = address;
274
406
  this.publicClient = clients.publicClient;
275
407
  this.contract = (0, viem_1.getContract)({
276
408
  address,
277
- abi: exports.MightyMorphinPowerRangers_jsonAbi,
409
+ abi: exports.GOGOTokenAbi,
278
410
  client: {
279
411
  public: clients.publicClient,
280
412
  wallet: clients.walletClient,
@@ -288,24 +420,24 @@ class MightyMorphinPowerRangers_json {
288
420
  return this.contractAddress;
289
421
  }
290
422
  /**
291
- * Get the underlying viem contract instance
423
+ * Get the underlying viem contract instance.
292
424
  */
293
425
  getContract() {
294
426
  return this.contract;
295
427
  }
296
428
  /**
297
- * allowance
429
+ * name
298
430
  * view
299
431
  */
300
- async allowance(arg0, arg1) {
301
- return this.contract.read.allowance([arg0, arg1]);
432
+ async name() {
433
+ return this.contract.read.name();
302
434
  }
303
435
  /**
304
- * balanceOf
436
+ * totalSupply
305
437
  * view
306
438
  */
307
- async balanceOf(arg0) {
308
- return this.contract.read.balanceOf([arg0]);
439
+ async totalSupply() {
440
+ return this.contract.read.totalSupply();
309
441
  }
310
442
  /**
311
443
  * decimals
@@ -315,11 +447,18 @@ class MightyMorphinPowerRangers_json {
315
447
  return this.contract.read.decimals();
316
448
  }
317
449
  /**
318
- * name
450
+ * _totalSupply
319
451
  * view
320
452
  */
321
- async name() {
322
- return this.contract.read.name();
453
+ async _totalSupply() {
454
+ return this.contract.read._totalSupply();
455
+ }
456
+ /**
457
+ * balanceOf
458
+ * view
459
+ */
460
+ async balanceOf(tokenOwner) {
461
+ return this.contract.read.balanceOf([tokenOwner]);
323
462
  }
324
463
  /**
325
464
  * symbol
@@ -329,44 +468,83 @@ class MightyMorphinPowerRangers_json {
329
468
  return this.contract.read.symbol();
330
469
  }
331
470
  /**
332
- * totalSupply
471
+ * safeSub
472
+ * pure
473
+ */
474
+ async safeSub(a, b) {
475
+ return this.contract.read.safeSub([a, b]);
476
+ }
477
+ /**
478
+ * safeDiv
479
+ * pure
480
+ */
481
+ async safeDiv(a, b) {
482
+ return this.contract.read.safeDiv([a, b]);
483
+ }
484
+ /**
485
+ * safeMul
486
+ * pure
487
+ */
488
+ async safeMul(a, b) {
489
+ return this.contract.read.safeMul([a, b]);
490
+ }
491
+ /**
492
+ * allowance
333
493
  * view
334
494
  */
335
- async totalSupply() {
336
- return this.contract.read.totalSupply();
495
+ async allowance(tokenOwner, spender) {
496
+ return this.contract.read.allowance([tokenOwner, spender]);
497
+ }
498
+ /**
499
+ * safeAdd
500
+ * pure
501
+ */
502
+ async safeAdd(a, b) {
503
+ return this.contract.read.safeAdd([a, b]);
337
504
  }
338
505
  /**
339
506
  * approve
340
507
  * nonpayable
341
508
  * @param options Optional transaction parameters (value, gas, nonce, etc.)
342
509
  */
343
- async approve(spender, value, options) {
510
+ async approve(spender, tokens, options) {
344
511
  if (!this.contract.write) {
345
512
  throw new Error('Wallet client is required for write operations');
346
513
  }
347
- return this.contract.write.approve([spender, value], options);
514
+ return this.contract.write.approve([spender, tokens], options);
515
+ }
516
+ /**
517
+ * transferFrom
518
+ * nonpayable
519
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
520
+ */
521
+ async transferFrom(from, to, tokens, options) {
522
+ if (!this.contract.write) {
523
+ throw new Error('Wallet client is required for write operations');
524
+ }
525
+ return this.contract.write.transferFrom([from, to, tokens], options);
348
526
  }
349
527
  /**
350
528
  * transfer
351
529
  * nonpayable
352
530
  * @param options Optional transaction parameters (value, gas, nonce, etc.)
353
531
  */
354
- async transfer(to, value, options) {
532
+ async transfer(to, tokens, options) {
355
533
  if (!this.contract.write) {
356
534
  throw new Error('Wallet client is required for write operations');
357
535
  }
358
- return this.contract.write.transfer([to, value], options);
536
+ return this.contract.write.transfer([to, tokens], options);
359
537
  }
360
538
  /**
361
- * transferFrom
539
+ * approveAndCall
362
540
  * nonpayable
363
541
  * @param options Optional transaction parameters (value, gas, nonce, etc.)
364
542
  */
365
- async transferFrom(from, to, value, options) {
543
+ async approveAndCall(spender, tokens, data, options) {
366
544
  if (!this.contract.write) {
367
545
  throw new Error('Wallet client is required for write operations');
368
546
  }
369
- return this.contract.write.transferFrom([from, to, value], options);
547
+ return this.contract.write.approveAndCall([spender, tokens, data], options);
370
548
  }
371
549
  /**
372
550
  * Simulate contract write operations (dry-run without sending transaction)
@@ -387,24 +565,32 @@ class MightyMorphinPowerRangers_json {
387
565
  * Returns gas estimate and result without sending transaction
388
566
  * @param options Optional transaction parameters (value, gas, nonce, etc.)
389
567
  */
390
- async approve(spender, value, options) {
391
- return contract.simulate.approve([spender, value], options);
568
+ async approve(spender, tokens, options) {
569
+ return contract.simulate.approve([spender, tokens], options);
570
+ },
571
+ /**
572
+ * Simulate transferFrom
573
+ * Returns gas estimate and result without sending transaction
574
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
575
+ */
576
+ async transferFrom(from, to, tokens, options) {
577
+ return contract.simulate.transferFrom([from, to, tokens], options);
392
578
  },
393
579
  /**
394
580
  * Simulate transfer
395
581
  * Returns gas estimate and result without sending transaction
396
582
  * @param options Optional transaction parameters (value, gas, nonce, etc.)
397
583
  */
398
- async transfer(to, value, options) {
399
- return contract.simulate.transfer([to, value], options);
584
+ async transfer(to, tokens, options) {
585
+ return contract.simulate.transfer([to, tokens], options);
400
586
  },
401
587
  /**
402
- * Simulate transferFrom
588
+ * Simulate approveAndCall
403
589
  * Returns gas estimate and result without sending transaction
404
590
  * @param options Optional transaction parameters (value, gas, nonce, etc.)
405
591
  */
406
- async transferFrom(from, to, value, options) {
407
- return contract.simulate.transferFrom([from, to, value], options);
592
+ async approveAndCall(spender, tokens, data, options) {
593
+ return contract.simulate.approveAndCall([spender, tokens, data], options);
408
594
  }
409
595
  };
410
596
  }
@@ -423,16 +609,16 @@ class MightyMorphinPowerRangers_json {
423
609
  get watch() {
424
610
  return {
425
611
  /**
426
- * Watch Approval events
612
+ * Watch Transfer events
427
613
  * @param callback Function to call when event is emitted
428
614
  * @param filter Optional filter for indexed parameters
429
615
  * @returns Unwatch function to stop listening
430
616
  */
431
- Approval: (callback, filter) => {
617
+ Transfer: (callback, filter) => {
432
618
  return this.publicClient.watchContractEvent({
433
619
  address: this.contractAddress,
434
- abi: exports.MightyMorphinPowerRangers_jsonAbi,
435
- eventName: 'Approval',
620
+ abi: exports.GOGOTokenAbi,
621
+ eventName: 'Transfer',
436
622
  args: filter,
437
623
  onLogs: (logs) => {
438
624
  logs.forEach((log) => {
@@ -442,16 +628,16 @@ class MightyMorphinPowerRangers_json {
442
628
  });
443
629
  },
444
630
  /**
445
- * Watch Transfer events
631
+ * Watch Approval events
446
632
  * @param callback Function to call when event is emitted
447
633
  * @param filter Optional filter for indexed parameters
448
634
  * @returns Unwatch function to stop listening
449
635
  */
450
- Transfer: (callback, filter) => {
636
+ Approval: (callback, filter) => {
451
637
  return this.publicClient.watchContractEvent({
452
638
  address: this.contractAddress,
453
- abi: exports.MightyMorphinPowerRangers_jsonAbi,
454
- eventName: 'Transfer',
639
+ abi: exports.GOGOTokenAbi,
640
+ eventName: 'Approval',
455
641
  args: filter,
456
642
  onLogs: (logs) => {
457
643
  logs.forEach((log) => {
@@ -463,4 +649,4 @@ class MightyMorphinPowerRangers_json {
463
649
  };
464
650
  }
465
651
  }
466
- exports.MightyMorphinPowerRangers_json = MightyMorphinPowerRangers_json;
652
+ exports.GOGOToken = GOGOToken;