@gitmyabi/usdc 1.0.4 → 1.0.5
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 +4 -4
- package/contracts/{USDCoin_json.d.ts → StandardERC20.d.ts} +120 -32
- package/contracts/{USDCoin_json.js → StandardERC20.js} +153 -36
- package/contracts/{USDCoin_json.ts → StandardERC20.ts} +161 -44
- package/contracts/index.d.ts +2 -2
- package/contracts/index.js +4 -4
- package/contracts/index.ts +2 -2
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Auto-generated TypeScript type bindings for **USDC**
|
|
4
4
|
|
|
5
|
-
- **Build ID**: `etherscan-usdc-
|
|
5
|
+
- **Build ID**: `etherscan-usdc-6881f254-1794254763226`
|
|
6
6
|
- **Build Number**: 1
|
|
7
|
-
- **Commit**: `
|
|
7
|
+
- **Commit**: `89dd576`
|
|
8
8
|
- **Branch**: `etherscan`
|
|
9
9
|
- **Target**: `ethers-v6`
|
|
10
10
|
- **Contracts**: 1
|
|
@@ -12,7 +12,7 @@ Auto-generated TypeScript type bindings for **USDC**
|
|
|
12
12
|
## Installation
|
|
13
13
|
|
|
14
14
|
```bash
|
|
15
|
-
npm install @gitmyabi/usdc@1.0.
|
|
15
|
+
npm install @gitmyabi/usdc@1.0.5
|
|
16
16
|
```
|
|
17
17
|
|
|
18
18
|
## Usage
|
|
@@ -105,4 +105,4 @@ This package includes type bindings for 1 contract(s) generated from ABI artifac
|
|
|
105
105
|
|
|
106
106
|
## License
|
|
107
107
|
|
|
108
|
-
|
|
108
|
+
Apache License 2.0
|
|
@@ -1,13 +1,101 @@
|
|
|
1
1
|
import type { Address, PublicClient, WalletClient } from 'viem';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* StandardERC20 ABI
|
|
4
4
|
*
|
|
5
5
|
* This ABI is typed using viem's type system for full type safety.
|
|
6
6
|
*/
|
|
7
|
-
export declare const
|
|
8
|
-
readonly inputs: readonly [
|
|
9
|
-
|
|
7
|
+
export declare const StandardERC20Abi: readonly [{
|
|
8
|
+
readonly inputs: readonly [{
|
|
9
|
+
readonly internalType: "string";
|
|
10
|
+
readonly name: "name_";
|
|
11
|
+
readonly type: "string";
|
|
12
|
+
}, {
|
|
13
|
+
readonly internalType: "string";
|
|
14
|
+
readonly name: "symbol_";
|
|
15
|
+
readonly type: "string";
|
|
16
|
+
}, {
|
|
17
|
+
readonly internalType: "uint8";
|
|
18
|
+
readonly name: "decimals_";
|
|
19
|
+
readonly type: "uint8";
|
|
20
|
+
}, {
|
|
21
|
+
readonly internalType: "uint256";
|
|
22
|
+
readonly name: "initialBalance_";
|
|
23
|
+
readonly type: "uint256";
|
|
24
|
+
}, {
|
|
25
|
+
readonly internalType: "bytes";
|
|
26
|
+
readonly name: "signature_";
|
|
27
|
+
readonly type: "bytes";
|
|
28
|
+
}, {
|
|
29
|
+
readonly internalType: "address payable";
|
|
30
|
+
readonly name: "feeReceiver_";
|
|
31
|
+
readonly type: "address";
|
|
32
|
+
}];
|
|
33
|
+
readonly stateMutability: "payable";
|
|
10
34
|
readonly type: "constructor";
|
|
35
|
+
}, {
|
|
36
|
+
readonly inputs: readonly [{
|
|
37
|
+
readonly internalType: "address";
|
|
38
|
+
readonly name: "spender";
|
|
39
|
+
readonly type: "address";
|
|
40
|
+
}, {
|
|
41
|
+
readonly internalType: "uint256";
|
|
42
|
+
readonly name: "allowance";
|
|
43
|
+
readonly type: "uint256";
|
|
44
|
+
}, {
|
|
45
|
+
readonly internalType: "uint256";
|
|
46
|
+
readonly name: "needed";
|
|
47
|
+
readonly type: "uint256";
|
|
48
|
+
}];
|
|
49
|
+
readonly name: "ERC20InsufficientAllowance";
|
|
50
|
+
readonly type: "error";
|
|
51
|
+
}, {
|
|
52
|
+
readonly inputs: readonly [{
|
|
53
|
+
readonly internalType: "address";
|
|
54
|
+
readonly name: "sender";
|
|
55
|
+
readonly type: "address";
|
|
56
|
+
}, {
|
|
57
|
+
readonly internalType: "uint256";
|
|
58
|
+
readonly name: "balance";
|
|
59
|
+
readonly type: "uint256";
|
|
60
|
+
}, {
|
|
61
|
+
readonly internalType: "uint256";
|
|
62
|
+
readonly name: "needed";
|
|
63
|
+
readonly type: "uint256";
|
|
64
|
+
}];
|
|
65
|
+
readonly name: "ERC20InsufficientBalance";
|
|
66
|
+
readonly type: "error";
|
|
67
|
+
}, {
|
|
68
|
+
readonly inputs: readonly [{
|
|
69
|
+
readonly internalType: "address";
|
|
70
|
+
readonly name: "approver";
|
|
71
|
+
readonly type: "address";
|
|
72
|
+
}];
|
|
73
|
+
readonly name: "ERC20InvalidApprover";
|
|
74
|
+
readonly type: "error";
|
|
75
|
+
}, {
|
|
76
|
+
readonly inputs: readonly [{
|
|
77
|
+
readonly internalType: "address";
|
|
78
|
+
readonly name: "receiver";
|
|
79
|
+
readonly type: "address";
|
|
80
|
+
}];
|
|
81
|
+
readonly name: "ERC20InvalidReceiver";
|
|
82
|
+
readonly type: "error";
|
|
83
|
+
}, {
|
|
84
|
+
readonly inputs: readonly [{
|
|
85
|
+
readonly internalType: "address";
|
|
86
|
+
readonly name: "sender";
|
|
87
|
+
readonly type: "address";
|
|
88
|
+
}];
|
|
89
|
+
readonly name: "ERC20InvalidSender";
|
|
90
|
+
readonly type: "error";
|
|
91
|
+
}, {
|
|
92
|
+
readonly inputs: readonly [{
|
|
93
|
+
readonly internalType: "address";
|
|
94
|
+
readonly name: "spender";
|
|
95
|
+
readonly type: "address";
|
|
96
|
+
}];
|
|
97
|
+
readonly name: "ERC20InvalidSpender";
|
|
98
|
+
readonly type: "error";
|
|
11
99
|
}, {
|
|
12
100
|
readonly anonymous: false;
|
|
13
101
|
readonly inputs: readonly [{
|
|
@@ -51,11 +139,11 @@ export declare const USDCoin_jsonAbi: readonly [{
|
|
|
51
139
|
}, {
|
|
52
140
|
readonly inputs: readonly [{
|
|
53
141
|
readonly internalType: "address";
|
|
54
|
-
readonly name: "";
|
|
142
|
+
readonly name: "owner";
|
|
55
143
|
readonly type: "address";
|
|
56
144
|
}, {
|
|
57
145
|
readonly internalType: "address";
|
|
58
|
-
readonly name: "";
|
|
146
|
+
readonly name: "spender";
|
|
59
147
|
readonly type: "address";
|
|
60
148
|
}];
|
|
61
149
|
readonly name: "allowance";
|
|
@@ -73,7 +161,7 @@ export declare const USDCoin_jsonAbi: readonly [{
|
|
|
73
161
|
readonly type: "address";
|
|
74
162
|
}, {
|
|
75
163
|
readonly internalType: "uint256";
|
|
76
|
-
readonly name: "
|
|
164
|
+
readonly name: "value";
|
|
77
165
|
readonly type: "uint256";
|
|
78
166
|
}];
|
|
79
167
|
readonly name: "approve";
|
|
@@ -87,7 +175,7 @@ export declare const USDCoin_jsonAbi: readonly [{
|
|
|
87
175
|
}, {
|
|
88
176
|
readonly inputs: readonly [{
|
|
89
177
|
readonly internalType: "address";
|
|
90
|
-
readonly name: "";
|
|
178
|
+
readonly name: "account";
|
|
91
179
|
readonly type: "address";
|
|
92
180
|
}];
|
|
93
181
|
readonly name: "balanceOf";
|
|
@@ -145,7 +233,7 @@ export declare const USDCoin_jsonAbi: readonly [{
|
|
|
145
233
|
readonly type: "address";
|
|
146
234
|
}, {
|
|
147
235
|
readonly internalType: "uint256";
|
|
148
|
-
readonly name: "
|
|
236
|
+
readonly name: "value";
|
|
149
237
|
readonly type: "uint256";
|
|
150
238
|
}];
|
|
151
239
|
readonly name: "transfer";
|
|
@@ -167,7 +255,7 @@ export declare const USDCoin_jsonAbi: readonly [{
|
|
|
167
255
|
readonly type: "address";
|
|
168
256
|
}, {
|
|
169
257
|
readonly internalType: "uint256";
|
|
170
|
-
readonly name: "
|
|
258
|
+
readonly name: "value";
|
|
171
259
|
readonly type: "uint256";
|
|
172
260
|
}];
|
|
173
261
|
readonly name: "transferFrom";
|
|
@@ -180,15 +268,15 @@ export declare const USDCoin_jsonAbi: readonly [{
|
|
|
180
268
|
readonly type: "function";
|
|
181
269
|
}];
|
|
182
270
|
/**
|
|
183
|
-
* Type-safe ABI for
|
|
271
|
+
* Type-safe ABI for StandardERC20
|
|
184
272
|
*/
|
|
185
|
-
export type
|
|
273
|
+
export type StandardERC20Abi = typeof StandardERC20Abi;
|
|
186
274
|
/**
|
|
187
|
-
* Contract instance type for
|
|
275
|
+
* Contract instance type for StandardERC20
|
|
188
276
|
*/
|
|
189
|
-
export type
|
|
277
|
+
export type StandardERC20Contract = any;
|
|
190
278
|
/**
|
|
191
|
-
*
|
|
279
|
+
* StandardERC20 Contract Class
|
|
192
280
|
*
|
|
193
281
|
* Provides a class-based API similar to TypeChain for interacting with the contract.
|
|
194
282
|
*
|
|
@@ -196,12 +284,12 @@ export type USDCoin_jsonContract = any;
|
|
|
196
284
|
* ```typescript
|
|
197
285
|
* import { createPublicClient, createWalletClient, http } from 'viem';
|
|
198
286
|
* import { mainnet } from 'viem/chains';
|
|
199
|
-
* import {
|
|
287
|
+
* import { StandardERC20 } from 'StandardERC20';
|
|
200
288
|
*
|
|
201
289
|
* const publicClient = createPublicClient({ chain: mainnet, transport: http() });
|
|
202
290
|
* const walletClient = createWalletClient({ chain: mainnet, transport: http() });
|
|
203
291
|
*
|
|
204
|
-
* const contract = new
|
|
292
|
+
* const contract = new StandardERC20('0x...', { publicClient, walletClient });
|
|
205
293
|
*
|
|
206
294
|
* // Read functions
|
|
207
295
|
* const result = await contract.balanceOf('0x...');
|
|
@@ -219,7 +307,7 @@ export type USDCoin_jsonContract = any;
|
|
|
219
307
|
* });
|
|
220
308
|
* ```
|
|
221
309
|
*/
|
|
222
|
-
export declare class
|
|
310
|
+
export declare class StandardERC20 {
|
|
223
311
|
private contract;
|
|
224
312
|
private contractAddress;
|
|
225
313
|
private publicClient;
|
|
@@ -232,19 +320,19 @@ export declare class USDCoin_json {
|
|
|
232
320
|
*/
|
|
233
321
|
get address(): Address;
|
|
234
322
|
/**
|
|
235
|
-
* Get the underlying viem contract instance
|
|
323
|
+
* Get the underlying viem contract instance.
|
|
236
324
|
*/
|
|
237
|
-
getContract():
|
|
325
|
+
getContract(): StandardERC20Contract;
|
|
238
326
|
/**
|
|
239
327
|
* allowance
|
|
240
328
|
* view
|
|
241
329
|
*/
|
|
242
|
-
allowance(
|
|
330
|
+
allowance(owner: `0x${string}`, spender: `0x${string}`): Promise<bigint>;
|
|
243
331
|
/**
|
|
244
332
|
* balanceOf
|
|
245
333
|
* view
|
|
246
334
|
*/
|
|
247
|
-
balanceOf(
|
|
335
|
+
balanceOf(account: `0x${string}`): Promise<bigint>;
|
|
248
336
|
/**
|
|
249
337
|
* decimals
|
|
250
338
|
* view
|
|
@@ -270,7 +358,7 @@ export declare class USDCoin_json {
|
|
|
270
358
|
* nonpayable
|
|
271
359
|
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
272
360
|
*/
|
|
273
|
-
approve(spender: `0x${string}`,
|
|
361
|
+
approve(spender: `0x${string}`, value: bigint, options?: {
|
|
274
362
|
accessList?: import('viem').AccessList;
|
|
275
363
|
authorizationList?: import('viem').AuthorizationList;
|
|
276
364
|
chain?: import('viem').Chain | null;
|
|
@@ -287,7 +375,7 @@ export declare class USDCoin_json {
|
|
|
287
375
|
* nonpayable
|
|
288
376
|
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
289
377
|
*/
|
|
290
|
-
transfer(to: `0x${string}`,
|
|
378
|
+
transfer(to: `0x${string}`, value: bigint, options?: {
|
|
291
379
|
accessList?: import('viem').AccessList;
|
|
292
380
|
authorizationList?: import('viem').AuthorizationList;
|
|
293
381
|
chain?: import('viem').Chain | null;
|
|
@@ -304,7 +392,7 @@ export declare class USDCoin_json {
|
|
|
304
392
|
* nonpayable
|
|
305
393
|
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
306
394
|
*/
|
|
307
|
-
transferFrom(from: `0x${string}`, to: `0x${string}`,
|
|
395
|
+
transferFrom(from: `0x${string}`, to: `0x${string}`, value: bigint, options?: {
|
|
308
396
|
accessList?: import('viem').AccessList;
|
|
309
397
|
authorizationList?: import('viem').AuthorizationList;
|
|
310
398
|
chain?: import('viem').Chain | null;
|
|
@@ -330,7 +418,7 @@ export declare class USDCoin_json {
|
|
|
330
418
|
* Returns gas estimate and result without sending transaction
|
|
331
419
|
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
332
420
|
*/
|
|
333
|
-
approve(spender: `0x${string}`,
|
|
421
|
+
approve(spender: `0x${string}`, value: bigint, options?: {
|
|
334
422
|
accessList?: import("viem").AccessList;
|
|
335
423
|
authorizationList?: import("viem").AuthorizationList;
|
|
336
424
|
chain?: import("viem").Chain | null;
|
|
@@ -347,7 +435,7 @@ export declare class USDCoin_json {
|
|
|
347
435
|
* Returns gas estimate and result without sending transaction
|
|
348
436
|
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
349
437
|
*/
|
|
350
|
-
transfer(to: `0x${string}`,
|
|
438
|
+
transfer(to: `0x${string}`, value: bigint, options?: {
|
|
351
439
|
accessList?: import("viem").AccessList;
|
|
352
440
|
authorizationList?: import("viem").AuthorizationList;
|
|
353
441
|
chain?: import("viem").Chain | null;
|
|
@@ -364,7 +452,7 @@ export declare class USDCoin_json {
|
|
|
364
452
|
* Returns gas estimate and result without sending transaction
|
|
365
453
|
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
366
454
|
*/
|
|
367
|
-
transferFrom(from: `0x${string}`, to: `0x${string}`,
|
|
455
|
+
transferFrom(from: `0x${string}`, to: `0x${string}`, value: bigint, options?: {
|
|
368
456
|
accessList?: import("viem").AccessList;
|
|
369
457
|
authorizationList?: import("viem").AuthorizationList;
|
|
370
458
|
chain?: import("viem").Chain | null;
|
|
@@ -401,8 +489,8 @@ export declare class USDCoin_json {
|
|
|
401
489
|
spender: `0x${string}`;
|
|
402
490
|
value: bigint;
|
|
403
491
|
}) => void, filter?: {
|
|
404
|
-
owner
|
|
405
|
-
spender
|
|
492
|
+
owner?: `0x${string}` | `0x${string}`[] | null;
|
|
493
|
+
spender?: `0x${string}` | `0x${string}`[] | null;
|
|
406
494
|
}) => () => void;
|
|
407
495
|
/**
|
|
408
496
|
* Watch Transfer events
|
|
@@ -415,8 +503,8 @@ export declare class USDCoin_json {
|
|
|
415
503
|
to: `0x${string}`;
|
|
416
504
|
value: bigint;
|
|
417
505
|
}) => void, filter?: {
|
|
418
|
-
from
|
|
419
|
-
to
|
|
506
|
+
from?: `0x${string}` | `0x${string}`[] | null;
|
|
507
|
+
to?: `0x${string}` | `0x${string}`[] | null;
|
|
420
508
|
}) => () => void;
|
|
421
509
|
};
|
|
422
510
|
}
|
|
@@ -1,18 +1,135 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.StandardERC20 = exports.StandardERC20Abi = void 0;
|
|
4
4
|
const viem_1 = require("viem");
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* StandardERC20 ABI
|
|
7
7
|
*
|
|
8
8
|
* This ABI is typed using viem's type system for full type safety.
|
|
9
9
|
*/
|
|
10
|
-
exports.
|
|
10
|
+
exports.StandardERC20Abi = [
|
|
11
11
|
{
|
|
12
|
-
"inputs": [
|
|
13
|
-
|
|
12
|
+
"inputs": [
|
|
13
|
+
{
|
|
14
|
+
"internalType": "string",
|
|
15
|
+
"name": "name_",
|
|
16
|
+
"type": "string"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"internalType": "string",
|
|
20
|
+
"name": "symbol_",
|
|
21
|
+
"type": "string"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"internalType": "uint8",
|
|
25
|
+
"name": "decimals_",
|
|
26
|
+
"type": "uint8"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"internalType": "uint256",
|
|
30
|
+
"name": "initialBalance_",
|
|
31
|
+
"type": "uint256"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"internalType": "bytes",
|
|
35
|
+
"name": "signature_",
|
|
36
|
+
"type": "bytes"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"internalType": "address payable",
|
|
40
|
+
"name": "feeReceiver_",
|
|
41
|
+
"type": "address"
|
|
42
|
+
}
|
|
43
|
+
],
|
|
44
|
+
"stateMutability": "payable",
|
|
14
45
|
"type": "constructor"
|
|
15
46
|
},
|
|
47
|
+
{
|
|
48
|
+
"inputs": [
|
|
49
|
+
{
|
|
50
|
+
"internalType": "address",
|
|
51
|
+
"name": "spender",
|
|
52
|
+
"type": "address"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"internalType": "uint256",
|
|
56
|
+
"name": "allowance",
|
|
57
|
+
"type": "uint256"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"internalType": "uint256",
|
|
61
|
+
"name": "needed",
|
|
62
|
+
"type": "uint256"
|
|
63
|
+
}
|
|
64
|
+
],
|
|
65
|
+
"name": "ERC20InsufficientAllowance",
|
|
66
|
+
"type": "error"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"inputs": [
|
|
70
|
+
{
|
|
71
|
+
"internalType": "address",
|
|
72
|
+
"name": "sender",
|
|
73
|
+
"type": "address"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"internalType": "uint256",
|
|
77
|
+
"name": "balance",
|
|
78
|
+
"type": "uint256"
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"internalType": "uint256",
|
|
82
|
+
"name": "needed",
|
|
83
|
+
"type": "uint256"
|
|
84
|
+
}
|
|
85
|
+
],
|
|
86
|
+
"name": "ERC20InsufficientBalance",
|
|
87
|
+
"type": "error"
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"inputs": [
|
|
91
|
+
{
|
|
92
|
+
"internalType": "address",
|
|
93
|
+
"name": "approver",
|
|
94
|
+
"type": "address"
|
|
95
|
+
}
|
|
96
|
+
],
|
|
97
|
+
"name": "ERC20InvalidApprover",
|
|
98
|
+
"type": "error"
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"inputs": [
|
|
102
|
+
{
|
|
103
|
+
"internalType": "address",
|
|
104
|
+
"name": "receiver",
|
|
105
|
+
"type": "address"
|
|
106
|
+
}
|
|
107
|
+
],
|
|
108
|
+
"name": "ERC20InvalidReceiver",
|
|
109
|
+
"type": "error"
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
"inputs": [
|
|
113
|
+
{
|
|
114
|
+
"internalType": "address",
|
|
115
|
+
"name": "sender",
|
|
116
|
+
"type": "address"
|
|
117
|
+
}
|
|
118
|
+
],
|
|
119
|
+
"name": "ERC20InvalidSender",
|
|
120
|
+
"type": "error"
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
"inputs": [
|
|
124
|
+
{
|
|
125
|
+
"internalType": "address",
|
|
126
|
+
"name": "spender",
|
|
127
|
+
"type": "address"
|
|
128
|
+
}
|
|
129
|
+
],
|
|
130
|
+
"name": "ERC20InvalidSpender",
|
|
131
|
+
"type": "error"
|
|
132
|
+
},
|
|
16
133
|
{
|
|
17
134
|
"anonymous": false,
|
|
18
135
|
"inputs": [
|
|
@@ -67,12 +184,12 @@ exports.USDCoin_jsonAbi = [
|
|
|
67
184
|
"inputs": [
|
|
68
185
|
{
|
|
69
186
|
"internalType": "address",
|
|
70
|
-
"name": "",
|
|
187
|
+
"name": "owner",
|
|
71
188
|
"type": "address"
|
|
72
189
|
},
|
|
73
190
|
{
|
|
74
191
|
"internalType": "address",
|
|
75
|
-
"name": "",
|
|
192
|
+
"name": "spender",
|
|
76
193
|
"type": "address"
|
|
77
194
|
}
|
|
78
195
|
],
|
|
@@ -96,7 +213,7 @@ exports.USDCoin_jsonAbi = [
|
|
|
96
213
|
},
|
|
97
214
|
{
|
|
98
215
|
"internalType": "uint256",
|
|
99
|
-
"name": "
|
|
216
|
+
"name": "value",
|
|
100
217
|
"type": "uint256"
|
|
101
218
|
}
|
|
102
219
|
],
|
|
@@ -115,7 +232,7 @@ exports.USDCoin_jsonAbi = [
|
|
|
115
232
|
"inputs": [
|
|
116
233
|
{
|
|
117
234
|
"internalType": "address",
|
|
118
|
-
"name": "",
|
|
235
|
+
"name": "account",
|
|
119
236
|
"type": "address"
|
|
120
237
|
}
|
|
121
238
|
],
|
|
@@ -191,7 +308,7 @@ exports.USDCoin_jsonAbi = [
|
|
|
191
308
|
},
|
|
192
309
|
{
|
|
193
310
|
"internalType": "uint256",
|
|
194
|
-
"name": "
|
|
311
|
+
"name": "value",
|
|
195
312
|
"type": "uint256"
|
|
196
313
|
}
|
|
197
314
|
],
|
|
@@ -220,7 +337,7 @@ exports.USDCoin_jsonAbi = [
|
|
|
220
337
|
},
|
|
221
338
|
{
|
|
222
339
|
"internalType": "uint256",
|
|
223
|
-
"name": "
|
|
340
|
+
"name": "value",
|
|
224
341
|
"type": "uint256"
|
|
225
342
|
}
|
|
226
343
|
],
|
|
@@ -237,7 +354,7 @@ exports.USDCoin_jsonAbi = [
|
|
|
237
354
|
}
|
|
238
355
|
];
|
|
239
356
|
/**
|
|
240
|
-
*
|
|
357
|
+
* StandardERC20 Contract Class
|
|
241
358
|
*
|
|
242
359
|
* Provides a class-based API similar to TypeChain for interacting with the contract.
|
|
243
360
|
*
|
|
@@ -245,12 +362,12 @@ exports.USDCoin_jsonAbi = [
|
|
|
245
362
|
* ```typescript
|
|
246
363
|
* import { createPublicClient, createWalletClient, http } from 'viem';
|
|
247
364
|
* import { mainnet } from 'viem/chains';
|
|
248
|
-
* import {
|
|
365
|
+
* import { StandardERC20 } from 'StandardERC20';
|
|
249
366
|
*
|
|
250
367
|
* const publicClient = createPublicClient({ chain: mainnet, transport: http() });
|
|
251
368
|
* const walletClient = createWalletClient({ chain: mainnet, transport: http() });
|
|
252
369
|
*
|
|
253
|
-
* const contract = new
|
|
370
|
+
* const contract = new StandardERC20('0x...', { publicClient, walletClient });
|
|
254
371
|
*
|
|
255
372
|
* // Read functions
|
|
256
373
|
* const result = await contract.balanceOf('0x...');
|
|
@@ -268,13 +385,13 @@ exports.USDCoin_jsonAbi = [
|
|
|
268
385
|
* });
|
|
269
386
|
* ```
|
|
270
387
|
*/
|
|
271
|
-
class
|
|
388
|
+
class StandardERC20 {
|
|
272
389
|
constructor(address, clients) {
|
|
273
390
|
this.contractAddress = address;
|
|
274
391
|
this.publicClient = clients.publicClient;
|
|
275
392
|
this.contract = (0, viem_1.getContract)({
|
|
276
393
|
address,
|
|
277
|
-
abi: exports.
|
|
394
|
+
abi: exports.StandardERC20Abi,
|
|
278
395
|
client: {
|
|
279
396
|
public: clients.publicClient,
|
|
280
397
|
wallet: clients.walletClient,
|
|
@@ -288,7 +405,7 @@ class USDCoin_json {
|
|
|
288
405
|
return this.contractAddress;
|
|
289
406
|
}
|
|
290
407
|
/**
|
|
291
|
-
* Get the underlying viem contract instance
|
|
408
|
+
* Get the underlying viem contract instance.
|
|
292
409
|
*/
|
|
293
410
|
getContract() {
|
|
294
411
|
return this.contract;
|
|
@@ -297,15 +414,15 @@ class USDCoin_json {
|
|
|
297
414
|
* allowance
|
|
298
415
|
* view
|
|
299
416
|
*/
|
|
300
|
-
async allowance(
|
|
301
|
-
return this.contract.read.allowance([
|
|
417
|
+
async allowance(owner, spender) {
|
|
418
|
+
return this.contract.read.allowance([owner, spender]);
|
|
302
419
|
}
|
|
303
420
|
/**
|
|
304
421
|
* balanceOf
|
|
305
422
|
* view
|
|
306
423
|
*/
|
|
307
|
-
async balanceOf(
|
|
308
|
-
return this.contract.read.balanceOf([
|
|
424
|
+
async balanceOf(account) {
|
|
425
|
+
return this.contract.read.balanceOf([account]);
|
|
309
426
|
}
|
|
310
427
|
/**
|
|
311
428
|
* decimals
|
|
@@ -340,33 +457,33 @@ class USDCoin_json {
|
|
|
340
457
|
* nonpayable
|
|
341
458
|
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
342
459
|
*/
|
|
343
|
-
async approve(spender,
|
|
460
|
+
async approve(spender, value, options) {
|
|
344
461
|
if (!this.contract.write) {
|
|
345
462
|
throw new Error('Wallet client is required for write operations');
|
|
346
463
|
}
|
|
347
|
-
return this.contract.write.approve([spender,
|
|
464
|
+
return this.contract.write.approve([spender, value], options);
|
|
348
465
|
}
|
|
349
466
|
/**
|
|
350
467
|
* transfer
|
|
351
468
|
* nonpayable
|
|
352
469
|
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
353
470
|
*/
|
|
354
|
-
async transfer(to,
|
|
471
|
+
async transfer(to, value, options) {
|
|
355
472
|
if (!this.contract.write) {
|
|
356
473
|
throw new Error('Wallet client is required for write operations');
|
|
357
474
|
}
|
|
358
|
-
return this.contract.write.transfer([to,
|
|
475
|
+
return this.contract.write.transfer([to, value], options);
|
|
359
476
|
}
|
|
360
477
|
/**
|
|
361
478
|
* transferFrom
|
|
362
479
|
* nonpayable
|
|
363
480
|
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
364
481
|
*/
|
|
365
|
-
async transferFrom(from, to,
|
|
482
|
+
async transferFrom(from, to, value, options) {
|
|
366
483
|
if (!this.contract.write) {
|
|
367
484
|
throw new Error('Wallet client is required for write operations');
|
|
368
485
|
}
|
|
369
|
-
return this.contract.write.transferFrom([from, to,
|
|
486
|
+
return this.contract.write.transferFrom([from, to, value], options);
|
|
370
487
|
}
|
|
371
488
|
/**
|
|
372
489
|
* Simulate contract write operations (dry-run without sending transaction)
|
|
@@ -387,24 +504,24 @@ class USDCoin_json {
|
|
|
387
504
|
* Returns gas estimate and result without sending transaction
|
|
388
505
|
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
389
506
|
*/
|
|
390
|
-
async approve(spender,
|
|
391
|
-
return contract.simulate.approve([spender,
|
|
507
|
+
async approve(spender, value, options) {
|
|
508
|
+
return contract.simulate.approve([spender, value], options);
|
|
392
509
|
},
|
|
393
510
|
/**
|
|
394
511
|
* Simulate transfer
|
|
395
512
|
* Returns gas estimate and result without sending transaction
|
|
396
513
|
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
397
514
|
*/
|
|
398
|
-
async transfer(to,
|
|
399
|
-
return contract.simulate.transfer([to,
|
|
515
|
+
async transfer(to, value, options) {
|
|
516
|
+
return contract.simulate.transfer([to, value], options);
|
|
400
517
|
},
|
|
401
518
|
/**
|
|
402
519
|
* Simulate transferFrom
|
|
403
520
|
* Returns gas estimate and result without sending transaction
|
|
404
521
|
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
405
522
|
*/
|
|
406
|
-
async transferFrom(from, to,
|
|
407
|
-
return contract.simulate.transferFrom([from, to,
|
|
523
|
+
async transferFrom(from, to, value, options) {
|
|
524
|
+
return contract.simulate.transferFrom([from, to, value], options);
|
|
408
525
|
}
|
|
409
526
|
};
|
|
410
527
|
}
|
|
@@ -431,7 +548,7 @@ class USDCoin_json {
|
|
|
431
548
|
Approval: (callback, filter) => {
|
|
432
549
|
return this.publicClient.watchContractEvent({
|
|
433
550
|
address: this.contractAddress,
|
|
434
|
-
abi: exports.
|
|
551
|
+
abi: exports.StandardERC20Abi,
|
|
435
552
|
eventName: 'Approval',
|
|
436
553
|
args: filter,
|
|
437
554
|
onLogs: (logs) => {
|
|
@@ -450,7 +567,7 @@ class USDCoin_json {
|
|
|
450
567
|
Transfer: (callback, filter) => {
|
|
451
568
|
return this.publicClient.watchContractEvent({
|
|
452
569
|
address: this.contractAddress,
|
|
453
|
-
abi: exports.
|
|
570
|
+
abi: exports.StandardERC20Abi,
|
|
454
571
|
eventName: 'Transfer',
|
|
455
572
|
args: filter,
|
|
456
573
|
onLogs: (logs) => {
|
|
@@ -463,4 +580,4 @@ class USDCoin_json {
|
|
|
463
580
|
};
|
|
464
581
|
}
|
|
465
582
|
}
|
|
466
|
-
exports.
|
|
583
|
+
exports.StandardERC20 = StandardERC20;
|
|
@@ -2,16 +2,133 @@ import type { Abi, Address, PublicClient, WalletClient, GetContractReturnType }
|
|
|
2
2
|
import { getContract } from 'viem';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* StandardERC20 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 StandardERC20Abi = [
|
|
10
10
|
{
|
|
11
|
-
"inputs": [
|
|
12
|
-
|
|
11
|
+
"inputs": [
|
|
12
|
+
{
|
|
13
|
+
"internalType": "string",
|
|
14
|
+
"name": "name_",
|
|
15
|
+
"type": "string"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"internalType": "string",
|
|
19
|
+
"name": "symbol_",
|
|
20
|
+
"type": "string"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"internalType": "uint8",
|
|
24
|
+
"name": "decimals_",
|
|
25
|
+
"type": "uint8"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"internalType": "uint256",
|
|
29
|
+
"name": "initialBalance_",
|
|
30
|
+
"type": "uint256"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"internalType": "bytes",
|
|
34
|
+
"name": "signature_",
|
|
35
|
+
"type": "bytes"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"internalType": "address payable",
|
|
39
|
+
"name": "feeReceiver_",
|
|
40
|
+
"type": "address"
|
|
41
|
+
}
|
|
42
|
+
],
|
|
43
|
+
"stateMutability": "payable",
|
|
13
44
|
"type": "constructor"
|
|
14
45
|
},
|
|
46
|
+
{
|
|
47
|
+
"inputs": [
|
|
48
|
+
{
|
|
49
|
+
"internalType": "address",
|
|
50
|
+
"name": "spender",
|
|
51
|
+
"type": "address"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"internalType": "uint256",
|
|
55
|
+
"name": "allowance",
|
|
56
|
+
"type": "uint256"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"internalType": "uint256",
|
|
60
|
+
"name": "needed",
|
|
61
|
+
"type": "uint256"
|
|
62
|
+
}
|
|
63
|
+
],
|
|
64
|
+
"name": "ERC20InsufficientAllowance",
|
|
65
|
+
"type": "error"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"inputs": [
|
|
69
|
+
{
|
|
70
|
+
"internalType": "address",
|
|
71
|
+
"name": "sender",
|
|
72
|
+
"type": "address"
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"internalType": "uint256",
|
|
76
|
+
"name": "balance",
|
|
77
|
+
"type": "uint256"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"internalType": "uint256",
|
|
81
|
+
"name": "needed",
|
|
82
|
+
"type": "uint256"
|
|
83
|
+
}
|
|
84
|
+
],
|
|
85
|
+
"name": "ERC20InsufficientBalance",
|
|
86
|
+
"type": "error"
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"inputs": [
|
|
90
|
+
{
|
|
91
|
+
"internalType": "address",
|
|
92
|
+
"name": "approver",
|
|
93
|
+
"type": "address"
|
|
94
|
+
}
|
|
95
|
+
],
|
|
96
|
+
"name": "ERC20InvalidApprover",
|
|
97
|
+
"type": "error"
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"inputs": [
|
|
101
|
+
{
|
|
102
|
+
"internalType": "address",
|
|
103
|
+
"name": "receiver",
|
|
104
|
+
"type": "address"
|
|
105
|
+
}
|
|
106
|
+
],
|
|
107
|
+
"name": "ERC20InvalidReceiver",
|
|
108
|
+
"type": "error"
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
"inputs": [
|
|
112
|
+
{
|
|
113
|
+
"internalType": "address",
|
|
114
|
+
"name": "sender",
|
|
115
|
+
"type": "address"
|
|
116
|
+
}
|
|
117
|
+
],
|
|
118
|
+
"name": "ERC20InvalidSender",
|
|
119
|
+
"type": "error"
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
"inputs": [
|
|
123
|
+
{
|
|
124
|
+
"internalType": "address",
|
|
125
|
+
"name": "spender",
|
|
126
|
+
"type": "address"
|
|
127
|
+
}
|
|
128
|
+
],
|
|
129
|
+
"name": "ERC20InvalidSpender",
|
|
130
|
+
"type": "error"
|
|
131
|
+
},
|
|
15
132
|
{
|
|
16
133
|
"anonymous": false,
|
|
17
134
|
"inputs": [
|
|
@@ -66,12 +183,12 @@ export const USDCoin_jsonAbi = [
|
|
|
66
183
|
"inputs": [
|
|
67
184
|
{
|
|
68
185
|
"internalType": "address",
|
|
69
|
-
"name": "",
|
|
186
|
+
"name": "owner",
|
|
70
187
|
"type": "address"
|
|
71
188
|
},
|
|
72
189
|
{
|
|
73
190
|
"internalType": "address",
|
|
74
|
-
"name": "",
|
|
191
|
+
"name": "spender",
|
|
75
192
|
"type": "address"
|
|
76
193
|
}
|
|
77
194
|
],
|
|
@@ -95,7 +212,7 @@ export const USDCoin_jsonAbi = [
|
|
|
95
212
|
},
|
|
96
213
|
{
|
|
97
214
|
"internalType": "uint256",
|
|
98
|
-
"name": "
|
|
215
|
+
"name": "value",
|
|
99
216
|
"type": "uint256"
|
|
100
217
|
}
|
|
101
218
|
],
|
|
@@ -114,7 +231,7 @@ export const USDCoin_jsonAbi = [
|
|
|
114
231
|
"inputs": [
|
|
115
232
|
{
|
|
116
233
|
"internalType": "address",
|
|
117
|
-
"name": "",
|
|
234
|
+
"name": "account",
|
|
118
235
|
"type": "address"
|
|
119
236
|
}
|
|
120
237
|
],
|
|
@@ -190,7 +307,7 @@ export const USDCoin_jsonAbi = [
|
|
|
190
307
|
},
|
|
191
308
|
{
|
|
192
309
|
"internalType": "uint256",
|
|
193
|
-
"name": "
|
|
310
|
+
"name": "value",
|
|
194
311
|
"type": "uint256"
|
|
195
312
|
}
|
|
196
313
|
],
|
|
@@ -219,7 +336,7 @@ export const USDCoin_jsonAbi = [
|
|
|
219
336
|
},
|
|
220
337
|
{
|
|
221
338
|
"internalType": "uint256",
|
|
222
|
-
"name": "
|
|
339
|
+
"name": "value",
|
|
223
340
|
"type": "uint256"
|
|
224
341
|
}
|
|
225
342
|
],
|
|
@@ -237,19 +354,19 @@ export const USDCoin_jsonAbi = [
|
|
|
237
354
|
] as const satisfies Abi;
|
|
238
355
|
|
|
239
356
|
/**
|
|
240
|
-
* Type-safe ABI for
|
|
357
|
+
* Type-safe ABI for StandardERC20
|
|
241
358
|
*/
|
|
242
|
-
export type
|
|
359
|
+
export type StandardERC20Abi = typeof StandardERC20Abi;
|
|
243
360
|
|
|
244
361
|
/**
|
|
245
|
-
* Contract instance type for
|
|
362
|
+
* Contract instance type for StandardERC20
|
|
246
363
|
*/
|
|
247
364
|
// Use any for contract type to avoid complex viem type issues
|
|
248
365
|
// The runtime behavior is type-safe through viem's ABI typing
|
|
249
|
-
export type
|
|
366
|
+
export type StandardERC20Contract = any;
|
|
250
367
|
|
|
251
368
|
/**
|
|
252
|
-
*
|
|
369
|
+
* StandardERC20 Contract Class
|
|
253
370
|
*
|
|
254
371
|
* Provides a class-based API similar to TypeChain for interacting with the contract.
|
|
255
372
|
*
|
|
@@ -257,12 +374,12 @@ export type USDCoin_jsonContract = any;
|
|
|
257
374
|
* ```typescript
|
|
258
375
|
* import { createPublicClient, createWalletClient, http } from 'viem';
|
|
259
376
|
* import { mainnet } from 'viem/chains';
|
|
260
|
-
* import {
|
|
377
|
+
* import { StandardERC20 } from 'StandardERC20';
|
|
261
378
|
*
|
|
262
379
|
* const publicClient = createPublicClient({ chain: mainnet, transport: http() });
|
|
263
380
|
* const walletClient = createWalletClient({ chain: mainnet, transport: http() });
|
|
264
381
|
*
|
|
265
|
-
* const contract = new
|
|
382
|
+
* const contract = new StandardERC20('0x...', { publicClient, walletClient });
|
|
266
383
|
*
|
|
267
384
|
* // Read functions
|
|
268
385
|
* const result = await contract.balanceOf('0x...');
|
|
@@ -280,8 +397,8 @@ export type USDCoin_jsonContract = any;
|
|
|
280
397
|
* });
|
|
281
398
|
* ```
|
|
282
399
|
*/
|
|
283
|
-
export class
|
|
284
|
-
private contract:
|
|
400
|
+
export class StandardERC20 {
|
|
401
|
+
private contract: StandardERC20Contract;
|
|
285
402
|
private contractAddress: Address;
|
|
286
403
|
private publicClient: PublicClient;
|
|
287
404
|
|
|
@@ -296,7 +413,7 @@ export class USDCoin_json {
|
|
|
296
413
|
this.publicClient = clients.publicClient;
|
|
297
414
|
this.contract = getContract({
|
|
298
415
|
address,
|
|
299
|
-
abi:
|
|
416
|
+
abi: StandardERC20Abi,
|
|
300
417
|
client: {
|
|
301
418
|
public: clients.publicClient,
|
|
302
419
|
wallet: clients.walletClient,
|
|
@@ -312,9 +429,9 @@ export class USDCoin_json {
|
|
|
312
429
|
}
|
|
313
430
|
|
|
314
431
|
/**
|
|
315
|
-
* Get the underlying viem contract instance
|
|
432
|
+
* Get the underlying viem contract instance.
|
|
316
433
|
*/
|
|
317
|
-
getContract():
|
|
434
|
+
getContract(): StandardERC20Contract {
|
|
318
435
|
return this.contract;
|
|
319
436
|
}
|
|
320
437
|
|
|
@@ -322,16 +439,16 @@ export class USDCoin_json {
|
|
|
322
439
|
* allowance
|
|
323
440
|
* view
|
|
324
441
|
*/
|
|
325
|
-
async allowance(
|
|
326
|
-
return this.contract.read.allowance([
|
|
442
|
+
async allowance(owner: `0x${string}`, spender: `0x${string}`): Promise<bigint> {
|
|
443
|
+
return this.contract.read.allowance([owner, spender] as const) as Promise<bigint>;
|
|
327
444
|
}
|
|
328
445
|
|
|
329
446
|
/**
|
|
330
447
|
* balanceOf
|
|
331
448
|
* view
|
|
332
449
|
*/
|
|
333
|
-
async balanceOf(
|
|
334
|
-
return this.contract.read.balanceOf([
|
|
450
|
+
async balanceOf(account: `0x${string}`): Promise<bigint> {
|
|
451
|
+
return this.contract.read.balanceOf([account] as const) as Promise<bigint>;
|
|
335
452
|
}
|
|
336
453
|
|
|
337
454
|
/**
|
|
@@ -371,7 +488,7 @@ export class USDCoin_json {
|
|
|
371
488
|
* nonpayable
|
|
372
489
|
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
373
490
|
*/
|
|
374
|
-
async approve(spender: `0x${string}`,
|
|
491
|
+
async approve(spender: `0x${string}`, value: bigint, options?: {
|
|
375
492
|
accessList?: import('viem').AccessList;
|
|
376
493
|
authorizationList?: import('viem').AuthorizationList;
|
|
377
494
|
chain?: import('viem').Chain | null;
|
|
@@ -386,7 +503,7 @@ export class USDCoin_json {
|
|
|
386
503
|
if (!this.contract.write) {
|
|
387
504
|
throw new Error('Wallet client is required for write operations');
|
|
388
505
|
}
|
|
389
|
-
return this.contract.write.approve([spender,
|
|
506
|
+
return this.contract.write.approve([spender, value] as const, options) as Promise<`0x${string}`>;
|
|
390
507
|
}
|
|
391
508
|
|
|
392
509
|
/**
|
|
@@ -394,7 +511,7 @@ export class USDCoin_json {
|
|
|
394
511
|
* nonpayable
|
|
395
512
|
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
396
513
|
*/
|
|
397
|
-
async transfer(to: `0x${string}`,
|
|
514
|
+
async transfer(to: `0x${string}`, value: bigint, options?: {
|
|
398
515
|
accessList?: import('viem').AccessList;
|
|
399
516
|
authorizationList?: import('viem').AuthorizationList;
|
|
400
517
|
chain?: import('viem').Chain | null;
|
|
@@ -409,7 +526,7 @@ export class USDCoin_json {
|
|
|
409
526
|
if (!this.contract.write) {
|
|
410
527
|
throw new Error('Wallet client is required for write operations');
|
|
411
528
|
}
|
|
412
|
-
return this.contract.write.transfer([to,
|
|
529
|
+
return this.contract.write.transfer([to, value] as const, options) as Promise<`0x${string}`>;
|
|
413
530
|
}
|
|
414
531
|
|
|
415
532
|
/**
|
|
@@ -417,7 +534,7 @@ export class USDCoin_json {
|
|
|
417
534
|
* nonpayable
|
|
418
535
|
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
419
536
|
*/
|
|
420
|
-
async transferFrom(from: `0x${string}`, to: `0x${string}`,
|
|
537
|
+
async transferFrom(from: `0x${string}`, to: `0x${string}`, value: bigint, options?: {
|
|
421
538
|
accessList?: import('viem').AccessList;
|
|
422
539
|
authorizationList?: import('viem').AuthorizationList;
|
|
423
540
|
chain?: import('viem').Chain | null;
|
|
@@ -432,7 +549,7 @@ export class USDCoin_json {
|
|
|
432
549
|
if (!this.contract.write) {
|
|
433
550
|
throw new Error('Wallet client is required for write operations');
|
|
434
551
|
}
|
|
435
|
-
return this.contract.write.transferFrom([from, to,
|
|
552
|
+
return this.contract.write.transferFrom([from, to, value] as const, options) as Promise<`0x${string}`>;
|
|
436
553
|
}
|
|
437
554
|
|
|
438
555
|
|
|
@@ -456,7 +573,7 @@ export class USDCoin_json {
|
|
|
456
573
|
* Returns gas estimate and result without sending transaction
|
|
457
574
|
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
458
575
|
*/
|
|
459
|
-
async approve(spender: `0x${string}`,
|
|
576
|
+
async approve(spender: `0x${string}`, value: bigint, options?: {
|
|
460
577
|
accessList?: import('viem').AccessList;
|
|
461
578
|
authorizationList?: import('viem').AuthorizationList;
|
|
462
579
|
chain?: import('viem').Chain | null;
|
|
@@ -468,14 +585,14 @@ export class USDCoin_json {
|
|
|
468
585
|
nonce?: number;
|
|
469
586
|
value?: bigint;
|
|
470
587
|
}): Promise<boolean> {
|
|
471
|
-
return contract.simulate.approve([spender,
|
|
588
|
+
return contract.simulate.approve([spender, value] as const, options) as Promise<boolean>;
|
|
472
589
|
},
|
|
473
590
|
/**
|
|
474
591
|
* Simulate transfer
|
|
475
592
|
* Returns gas estimate and result without sending transaction
|
|
476
593
|
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
477
594
|
*/
|
|
478
|
-
async transfer(to: `0x${string}`,
|
|
595
|
+
async transfer(to: `0x${string}`, value: bigint, options?: {
|
|
479
596
|
accessList?: import('viem').AccessList;
|
|
480
597
|
authorizationList?: import('viem').AuthorizationList;
|
|
481
598
|
chain?: import('viem').Chain | null;
|
|
@@ -487,14 +604,14 @@ export class USDCoin_json {
|
|
|
487
604
|
nonce?: number;
|
|
488
605
|
value?: bigint;
|
|
489
606
|
}): Promise<boolean> {
|
|
490
|
-
return contract.simulate.transfer([to,
|
|
607
|
+
return contract.simulate.transfer([to, value] as const, options) as Promise<boolean>;
|
|
491
608
|
},
|
|
492
609
|
/**
|
|
493
610
|
* Simulate transferFrom
|
|
494
611
|
* Returns gas estimate and result without sending transaction
|
|
495
612
|
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
496
613
|
*/
|
|
497
|
-
async transferFrom(from: `0x${string}`, to: `0x${string}`,
|
|
614
|
+
async transferFrom(from: `0x${string}`, to: `0x${string}`, value: bigint, options?: {
|
|
498
615
|
accessList?: import('viem').AccessList;
|
|
499
616
|
authorizationList?: import('viem').AuthorizationList;
|
|
500
617
|
chain?: import('viem').Chain | null;
|
|
@@ -506,7 +623,7 @@ export class USDCoin_json {
|
|
|
506
623
|
nonce?: number;
|
|
507
624
|
value?: bigint;
|
|
508
625
|
}): Promise<boolean> {
|
|
509
|
-
return contract.simulate.transferFrom([from, to,
|
|
626
|
+
return contract.simulate.transferFrom([from, to, value] as const, options) as Promise<boolean>;
|
|
510
627
|
}
|
|
511
628
|
};
|
|
512
629
|
}
|
|
@@ -531,12 +648,12 @@ export class USDCoin_json {
|
|
|
531
648
|
* @param filter Optional filter for indexed parameters
|
|
532
649
|
* @returns Unwatch function to stop listening
|
|
533
650
|
*/
|
|
534
|
-
Approval: (callback: (event: { owner: `0x${string}`; spender: `0x${string}`; value: bigint }) => void, filter?: { owner
|
|
651
|
+
Approval: (callback: (event: { owner: `0x${string}`; spender: `0x${string}`; value: bigint }) => void, filter?: { owner?: `0x${string}` | `0x${string}`[] | null; spender?: `0x${string}` | `0x${string}`[] | null }) => {
|
|
535
652
|
return this.publicClient.watchContractEvent({
|
|
536
653
|
address: this.contractAddress,
|
|
537
|
-
abi:
|
|
654
|
+
abi: StandardERC20Abi,
|
|
538
655
|
eventName: 'Approval',
|
|
539
|
-
args: filter,
|
|
656
|
+
args: filter as any,
|
|
540
657
|
onLogs: (logs: any[]) => {
|
|
541
658
|
logs.forEach((log: any) => {
|
|
542
659
|
callback(log.args as any);
|
|
@@ -550,12 +667,12 @@ export class USDCoin_json {
|
|
|
550
667
|
* @param filter Optional filter for indexed parameters
|
|
551
668
|
* @returns Unwatch function to stop listening
|
|
552
669
|
*/
|
|
553
|
-
Transfer: (callback: (event: { from: `0x${string}`; to: `0x${string}`; value: bigint }) => void, filter?: { from
|
|
670
|
+
Transfer: (callback: (event: { from: `0x${string}`; to: `0x${string}`; value: bigint }) => void, filter?: { from?: `0x${string}` | `0x${string}`[] | null; to?: `0x${string}` | `0x${string}`[] | null }) => {
|
|
554
671
|
return this.publicClient.watchContractEvent({
|
|
555
672
|
address: this.contractAddress,
|
|
556
|
-
abi:
|
|
673
|
+
abi: StandardERC20Abi,
|
|
557
674
|
eventName: 'Transfer',
|
|
558
|
-
args: filter,
|
|
675
|
+
args: filter as any,
|
|
559
676
|
onLogs: (logs: any[]) => {
|
|
560
677
|
logs.forEach((log: any) => {
|
|
561
678
|
callback(log.args as any);
|
package/contracts/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export type {
|
|
1
|
+
export { StandardERC20Abi, StandardERC20 } from './StandardERC20';
|
|
2
|
+
export type { StandardERC20Abi as StandardERC20AbiType, StandardERC20Contract } from './StandardERC20';
|
package/contracts/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.StandardERC20 = exports.StandardERC20Abi = void 0;
|
|
4
4
|
// Auto-generated exports for all contracts
|
|
5
|
-
var
|
|
6
|
-
Object.defineProperty(exports, "
|
|
7
|
-
Object.defineProperty(exports, "
|
|
5
|
+
var StandardERC20_1 = require("./StandardERC20");
|
|
6
|
+
Object.defineProperty(exports, "StandardERC20Abi", { enumerable: true, get: function () { return StandardERC20_1.StandardERC20Abi; } });
|
|
7
|
+
Object.defineProperty(exports, "StandardERC20", { enumerable: true, get: function () { return StandardERC20_1.StandardERC20; } });
|
package/contracts/index.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// Auto-generated exports for all contracts
|
|
2
|
-
export {
|
|
3
|
-
export type {
|
|
2
|
+
export { StandardERC20Abi, StandardERC20 } from './StandardERC20';
|
|
3
|
+
export type { StandardERC20Abi as StandardERC20AbiType, StandardERC20Contract } from './StandardERC20';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gitmyabi/usdc",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "Auto-generated TypeScript type bindings for USDC (build etherscan-usdc-
|
|
3
|
+
"version": "1.0.5",
|
|
4
|
+
"description": "Auto-generated TypeScript type bindings for USDC (build etherscan-usdc-6881f254-1794254763226, commit 89dd576, branch etherscan)",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"types": "./index.d.ts",
|
|
7
7
|
"exports": {
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"abi",
|
|
31
31
|
"ethers-v6"
|
|
32
32
|
],
|
|
33
|
-
"license": "
|
|
33
|
+
"license": "Apache-2.0",
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"viem": "^2.0.0"
|
|
36
36
|
},
|
|
@@ -39,5 +39,5 @@
|
|
|
39
39
|
"url": "https://github.com/etherscan/usdc"
|
|
40
40
|
},
|
|
41
41
|
"branch": "etherscan",
|
|
42
|
-
"shortHash": "
|
|
42
|
+
"shortHash": "89dd576"
|
|
43
43
|
}
|