@gitmyabi/var 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 +3 -3
- package/contracts/Token.d.ts +87 -35
- package/contracts/Token.js +113 -43
- package/contracts/Token.ts +113 -43
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Auto-generated TypeScript type bindings for **VAR**
|
|
4
4
|
|
|
5
|
-
- **Build ID**: `etherscan-var-
|
|
5
|
+
- **Build ID**: `etherscan-var-3a050fd9-1796130525605`
|
|
6
6
|
- **Build Number**: 1
|
|
7
|
-
- **Commit**: `
|
|
7
|
+
- **Commit**: `872b98d`
|
|
8
8
|
- **Branch**: `etherscan`
|
|
9
9
|
- **Target**: `ethers-v6`
|
|
10
10
|
- **Contracts**: 1
|
|
@@ -12,7 +12,7 @@ Auto-generated TypeScript type bindings for **VAR**
|
|
|
12
12
|
## Installation
|
|
13
13
|
|
|
14
14
|
```bash
|
|
15
|
-
npm install @gitmyabi/var@1.0.
|
|
15
|
+
npm install @gitmyabi/var@1.0.1
|
|
16
16
|
```
|
|
17
17
|
|
|
18
18
|
## Usage
|
package/contracts/Token.d.ts
CHANGED
|
@@ -5,21 +5,73 @@ import type { Address, PublicClient, WalletClient } from 'viem';
|
|
|
5
5
|
* This ABI is typed using viem's type system for full type safety.
|
|
6
6
|
*/
|
|
7
7
|
export declare const TokenAbi: readonly [{
|
|
8
|
+
readonly inputs: readonly [];
|
|
9
|
+
readonly stateMutability: "nonpayable";
|
|
10
|
+
readonly type: "constructor";
|
|
11
|
+
}, {
|
|
8
12
|
readonly inputs: readonly [{
|
|
9
|
-
readonly internalType: "
|
|
10
|
-
readonly name: "
|
|
11
|
-
readonly type: "
|
|
13
|
+
readonly internalType: "address";
|
|
14
|
+
readonly name: "spender";
|
|
15
|
+
readonly type: "address";
|
|
12
16
|
}, {
|
|
13
|
-
readonly internalType: "
|
|
14
|
-
readonly name: "
|
|
15
|
-
readonly type: "
|
|
17
|
+
readonly internalType: "uint256";
|
|
18
|
+
readonly name: "allowance";
|
|
19
|
+
readonly type: "uint256";
|
|
16
20
|
}, {
|
|
17
|
-
readonly internalType: "uint256
|
|
18
|
-
readonly name: "
|
|
19
|
-
readonly type: "uint256
|
|
21
|
+
readonly internalType: "uint256";
|
|
22
|
+
readonly name: "needed";
|
|
23
|
+
readonly type: "uint256";
|
|
20
24
|
}];
|
|
21
|
-
readonly
|
|
22
|
-
readonly type: "
|
|
25
|
+
readonly name: "ERC20InsufficientAllowance";
|
|
26
|
+
readonly type: "error";
|
|
27
|
+
}, {
|
|
28
|
+
readonly inputs: readonly [{
|
|
29
|
+
readonly internalType: "address";
|
|
30
|
+
readonly name: "sender";
|
|
31
|
+
readonly type: "address";
|
|
32
|
+
}, {
|
|
33
|
+
readonly internalType: "uint256";
|
|
34
|
+
readonly name: "balance";
|
|
35
|
+
readonly type: "uint256";
|
|
36
|
+
}, {
|
|
37
|
+
readonly internalType: "uint256";
|
|
38
|
+
readonly name: "needed";
|
|
39
|
+
readonly type: "uint256";
|
|
40
|
+
}];
|
|
41
|
+
readonly name: "ERC20InsufficientBalance";
|
|
42
|
+
readonly type: "error";
|
|
43
|
+
}, {
|
|
44
|
+
readonly inputs: readonly [{
|
|
45
|
+
readonly internalType: "address";
|
|
46
|
+
readonly name: "approver";
|
|
47
|
+
readonly type: "address";
|
|
48
|
+
}];
|
|
49
|
+
readonly name: "ERC20InvalidApprover";
|
|
50
|
+
readonly type: "error";
|
|
51
|
+
}, {
|
|
52
|
+
readonly inputs: readonly [{
|
|
53
|
+
readonly internalType: "address";
|
|
54
|
+
readonly name: "receiver";
|
|
55
|
+
readonly type: "address";
|
|
56
|
+
}];
|
|
57
|
+
readonly name: "ERC20InvalidReceiver";
|
|
58
|
+
readonly type: "error";
|
|
59
|
+
}, {
|
|
60
|
+
readonly inputs: readonly [{
|
|
61
|
+
readonly internalType: "address";
|
|
62
|
+
readonly name: "sender";
|
|
63
|
+
readonly type: "address";
|
|
64
|
+
}];
|
|
65
|
+
readonly name: "ERC20InvalidSender";
|
|
66
|
+
readonly type: "error";
|
|
67
|
+
}, {
|
|
68
|
+
readonly inputs: readonly [{
|
|
69
|
+
readonly internalType: "address";
|
|
70
|
+
readonly name: "spender";
|
|
71
|
+
readonly type: "address";
|
|
72
|
+
}];
|
|
73
|
+
readonly name: "ERC20InvalidSpender";
|
|
74
|
+
readonly type: "error";
|
|
23
75
|
}, {
|
|
24
76
|
readonly anonymous: false;
|
|
25
77
|
readonly inputs: readonly [{
|
|
@@ -63,11 +115,11 @@ export declare const TokenAbi: readonly [{
|
|
|
63
115
|
}, {
|
|
64
116
|
readonly inputs: readonly [{
|
|
65
117
|
readonly internalType: "address";
|
|
66
|
-
readonly name: "
|
|
118
|
+
readonly name: "owner";
|
|
67
119
|
readonly type: "address";
|
|
68
120
|
}, {
|
|
69
121
|
readonly internalType: "address";
|
|
70
|
-
readonly name: "
|
|
122
|
+
readonly name: "spender";
|
|
71
123
|
readonly type: "address";
|
|
72
124
|
}];
|
|
73
125
|
readonly name: "allowance";
|
|
@@ -81,11 +133,11 @@ export declare const TokenAbi: readonly [{
|
|
|
81
133
|
}, {
|
|
82
134
|
readonly inputs: readonly [{
|
|
83
135
|
readonly internalType: "address";
|
|
84
|
-
readonly name: "
|
|
136
|
+
readonly name: "spender";
|
|
85
137
|
readonly type: "address";
|
|
86
138
|
}, {
|
|
87
139
|
readonly internalType: "uint256";
|
|
88
|
-
readonly name: "
|
|
140
|
+
readonly name: "value";
|
|
89
141
|
readonly type: "uint256";
|
|
90
142
|
}];
|
|
91
143
|
readonly name: "approve";
|
|
@@ -99,7 +151,7 @@ export declare const TokenAbi: readonly [{
|
|
|
99
151
|
}, {
|
|
100
152
|
readonly inputs: readonly [{
|
|
101
153
|
readonly internalType: "address";
|
|
102
|
-
readonly name: "
|
|
154
|
+
readonly name: "account";
|
|
103
155
|
readonly type: "address";
|
|
104
156
|
}];
|
|
105
157
|
readonly name: "balanceOf";
|
|
@@ -114,9 +166,9 @@ export declare const TokenAbi: readonly [{
|
|
|
114
166
|
readonly inputs: readonly [];
|
|
115
167
|
readonly name: "decimals";
|
|
116
168
|
readonly outputs: readonly [{
|
|
117
|
-
readonly internalType: "
|
|
169
|
+
readonly internalType: "uint8";
|
|
118
170
|
readonly name: "";
|
|
119
|
-
readonly type: "
|
|
171
|
+
readonly type: "uint8";
|
|
120
172
|
}];
|
|
121
173
|
readonly stateMutability: "view";
|
|
122
174
|
readonly type: "function";
|
|
@@ -128,7 +180,7 @@ export declare const TokenAbi: readonly [{
|
|
|
128
180
|
readonly name: "";
|
|
129
181
|
readonly type: "string";
|
|
130
182
|
}];
|
|
131
|
-
readonly stateMutability: "
|
|
183
|
+
readonly stateMutability: "pure";
|
|
132
184
|
readonly type: "function";
|
|
133
185
|
}, {
|
|
134
186
|
readonly inputs: readonly [];
|
|
@@ -138,7 +190,7 @@ export declare const TokenAbi: readonly [{
|
|
|
138
190
|
readonly name: "";
|
|
139
191
|
readonly type: "string";
|
|
140
192
|
}];
|
|
141
|
-
readonly stateMutability: "
|
|
193
|
+
readonly stateMutability: "pure";
|
|
142
194
|
readonly type: "function";
|
|
143
195
|
}, {
|
|
144
196
|
readonly inputs: readonly [];
|
|
@@ -153,11 +205,11 @@ export declare const TokenAbi: readonly [{
|
|
|
153
205
|
}, {
|
|
154
206
|
readonly inputs: readonly [{
|
|
155
207
|
readonly internalType: "address";
|
|
156
|
-
readonly name: "
|
|
208
|
+
readonly name: "to";
|
|
157
209
|
readonly type: "address";
|
|
158
210
|
}, {
|
|
159
211
|
readonly internalType: "uint256";
|
|
160
|
-
readonly name: "
|
|
212
|
+
readonly name: "value";
|
|
161
213
|
readonly type: "uint256";
|
|
162
214
|
}];
|
|
163
215
|
readonly name: "transfer";
|
|
@@ -171,15 +223,15 @@ export declare const TokenAbi: readonly [{
|
|
|
171
223
|
}, {
|
|
172
224
|
readonly inputs: readonly [{
|
|
173
225
|
readonly internalType: "address";
|
|
174
|
-
readonly name: "
|
|
226
|
+
readonly name: "from";
|
|
175
227
|
readonly type: "address";
|
|
176
228
|
}, {
|
|
177
229
|
readonly internalType: "address";
|
|
178
|
-
readonly name: "
|
|
230
|
+
readonly name: "to";
|
|
179
231
|
readonly type: "address";
|
|
180
232
|
}, {
|
|
181
233
|
readonly internalType: "uint256";
|
|
182
|
-
readonly name: "
|
|
234
|
+
readonly name: "value";
|
|
183
235
|
readonly type: "uint256";
|
|
184
236
|
}];
|
|
185
237
|
readonly name: "transferFrom";
|
|
@@ -251,12 +303,12 @@ export declare class Token {
|
|
|
251
303
|
* allowance
|
|
252
304
|
* view
|
|
253
305
|
*/
|
|
254
|
-
allowance(
|
|
306
|
+
allowance(owner: `0x${string}`, spender: `0x${string}`): Promise<bigint>;
|
|
255
307
|
/**
|
|
256
308
|
* balanceOf
|
|
257
309
|
* view
|
|
258
310
|
*/
|
|
259
|
-
balanceOf(
|
|
311
|
+
balanceOf(account: `0x${string}`): Promise<bigint>;
|
|
260
312
|
/**
|
|
261
313
|
* decimals
|
|
262
314
|
* view
|
|
@@ -264,12 +316,12 @@ export declare class Token {
|
|
|
264
316
|
decimals(): Promise<bigint>;
|
|
265
317
|
/**
|
|
266
318
|
* name
|
|
267
|
-
*
|
|
319
|
+
* pure
|
|
268
320
|
*/
|
|
269
321
|
name(): Promise<string>;
|
|
270
322
|
/**
|
|
271
323
|
* symbol
|
|
272
|
-
*
|
|
324
|
+
* pure
|
|
273
325
|
*/
|
|
274
326
|
symbol(): Promise<string>;
|
|
275
327
|
/**
|
|
@@ -282,7 +334,7 @@ export declare class Token {
|
|
|
282
334
|
* nonpayable
|
|
283
335
|
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
284
336
|
*/
|
|
285
|
-
approve(
|
|
337
|
+
approve(spender: `0x${string}`, value: bigint, options?: {
|
|
286
338
|
accessList?: import('viem').AccessList;
|
|
287
339
|
authorizationList?: import('viem').AuthorizationList;
|
|
288
340
|
chain?: import('viem').Chain | null;
|
|
@@ -299,7 +351,7 @@ export declare class Token {
|
|
|
299
351
|
* nonpayable
|
|
300
352
|
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
301
353
|
*/
|
|
302
|
-
transfer(
|
|
354
|
+
transfer(to: `0x${string}`, value: bigint, options?: {
|
|
303
355
|
accessList?: import('viem').AccessList;
|
|
304
356
|
authorizationList?: import('viem').AuthorizationList;
|
|
305
357
|
chain?: import('viem').Chain | null;
|
|
@@ -316,7 +368,7 @@ export declare class Token {
|
|
|
316
368
|
* nonpayable
|
|
317
369
|
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
318
370
|
*/
|
|
319
|
-
transferFrom(
|
|
371
|
+
transferFrom(from: `0x${string}`, to: `0x${string}`, value: bigint, options?: {
|
|
320
372
|
accessList?: import('viem').AccessList;
|
|
321
373
|
authorizationList?: import('viem').AuthorizationList;
|
|
322
374
|
chain?: import('viem').Chain | null;
|
|
@@ -342,7 +394,7 @@ export declare class Token {
|
|
|
342
394
|
* Returns gas estimate and result without sending transaction
|
|
343
395
|
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
344
396
|
*/
|
|
345
|
-
approve(
|
|
397
|
+
approve(spender: `0x${string}`, value: bigint, options?: {
|
|
346
398
|
accessList?: import("viem").AccessList;
|
|
347
399
|
authorizationList?: import("viem").AuthorizationList;
|
|
348
400
|
chain?: import("viem").Chain | null;
|
|
@@ -359,7 +411,7 @@ export declare class Token {
|
|
|
359
411
|
* Returns gas estimate and result without sending transaction
|
|
360
412
|
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
361
413
|
*/
|
|
362
|
-
transfer(
|
|
414
|
+
transfer(to: `0x${string}`, value: bigint, options?: {
|
|
363
415
|
accessList?: import("viem").AccessList;
|
|
364
416
|
authorizationList?: import("viem").AuthorizationList;
|
|
365
417
|
chain?: import("viem").Chain | null;
|
|
@@ -376,7 +428,7 @@ export declare class Token {
|
|
|
376
428
|
* Returns gas estimate and result without sending transaction
|
|
377
429
|
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
378
430
|
*/
|
|
379
|
-
transferFrom(
|
|
431
|
+
transferFrom(from: `0x${string}`, to: `0x${string}`, value: bigint, options?: {
|
|
380
432
|
accessList?: import("viem").AccessList;
|
|
381
433
|
authorizationList?: import("viem").AuthorizationList;
|
|
382
434
|
chain?: import("viem").Chain | null;
|
package/contracts/Token.js
CHANGED
|
@@ -8,26 +8,96 @@ const viem_1 = require("viem");
|
|
|
8
8
|
* This ABI is typed using viem's type system for full type safety.
|
|
9
9
|
*/
|
|
10
10
|
exports.TokenAbi = [
|
|
11
|
+
{
|
|
12
|
+
"inputs": [],
|
|
13
|
+
"stateMutability": "nonpayable",
|
|
14
|
+
"type": "constructor"
|
|
15
|
+
},
|
|
11
16
|
{
|
|
12
17
|
"inputs": [
|
|
13
18
|
{
|
|
14
|
-
"internalType": "
|
|
15
|
-
"name": "
|
|
16
|
-
"type": "
|
|
19
|
+
"internalType": "address",
|
|
20
|
+
"name": "spender",
|
|
21
|
+
"type": "address"
|
|
17
22
|
},
|
|
18
23
|
{
|
|
19
|
-
"internalType": "
|
|
20
|
-
"name": "
|
|
21
|
-
"type": "
|
|
24
|
+
"internalType": "uint256",
|
|
25
|
+
"name": "allowance",
|
|
26
|
+
"type": "uint256"
|
|
22
27
|
},
|
|
23
28
|
{
|
|
24
|
-
"internalType": "uint256
|
|
25
|
-
"name": "
|
|
26
|
-
"type": "uint256
|
|
29
|
+
"internalType": "uint256",
|
|
30
|
+
"name": "needed",
|
|
31
|
+
"type": "uint256"
|
|
27
32
|
}
|
|
28
33
|
],
|
|
29
|
-
"
|
|
30
|
-
"type": "
|
|
34
|
+
"name": "ERC20InsufficientAllowance",
|
|
35
|
+
"type": "error"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"inputs": [
|
|
39
|
+
{
|
|
40
|
+
"internalType": "address",
|
|
41
|
+
"name": "sender",
|
|
42
|
+
"type": "address"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"internalType": "uint256",
|
|
46
|
+
"name": "balance",
|
|
47
|
+
"type": "uint256"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"internalType": "uint256",
|
|
51
|
+
"name": "needed",
|
|
52
|
+
"type": "uint256"
|
|
53
|
+
}
|
|
54
|
+
],
|
|
55
|
+
"name": "ERC20InsufficientBalance",
|
|
56
|
+
"type": "error"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"inputs": [
|
|
60
|
+
{
|
|
61
|
+
"internalType": "address",
|
|
62
|
+
"name": "approver",
|
|
63
|
+
"type": "address"
|
|
64
|
+
}
|
|
65
|
+
],
|
|
66
|
+
"name": "ERC20InvalidApprover",
|
|
67
|
+
"type": "error"
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"inputs": [
|
|
71
|
+
{
|
|
72
|
+
"internalType": "address",
|
|
73
|
+
"name": "receiver",
|
|
74
|
+
"type": "address"
|
|
75
|
+
}
|
|
76
|
+
],
|
|
77
|
+
"name": "ERC20InvalidReceiver",
|
|
78
|
+
"type": "error"
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"inputs": [
|
|
82
|
+
{
|
|
83
|
+
"internalType": "address",
|
|
84
|
+
"name": "sender",
|
|
85
|
+
"type": "address"
|
|
86
|
+
}
|
|
87
|
+
],
|
|
88
|
+
"name": "ERC20InvalidSender",
|
|
89
|
+
"type": "error"
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"inputs": [
|
|
93
|
+
{
|
|
94
|
+
"internalType": "address",
|
|
95
|
+
"name": "spender",
|
|
96
|
+
"type": "address"
|
|
97
|
+
}
|
|
98
|
+
],
|
|
99
|
+
"name": "ERC20InvalidSpender",
|
|
100
|
+
"type": "error"
|
|
31
101
|
},
|
|
32
102
|
{
|
|
33
103
|
"anonymous": false,
|
|
@@ -83,12 +153,12 @@ exports.TokenAbi = [
|
|
|
83
153
|
"inputs": [
|
|
84
154
|
{
|
|
85
155
|
"internalType": "address",
|
|
86
|
-
"name": "
|
|
156
|
+
"name": "owner",
|
|
87
157
|
"type": "address"
|
|
88
158
|
},
|
|
89
159
|
{
|
|
90
160
|
"internalType": "address",
|
|
91
|
-
"name": "
|
|
161
|
+
"name": "spender",
|
|
92
162
|
"type": "address"
|
|
93
163
|
}
|
|
94
164
|
],
|
|
@@ -107,12 +177,12 @@ exports.TokenAbi = [
|
|
|
107
177
|
"inputs": [
|
|
108
178
|
{
|
|
109
179
|
"internalType": "address",
|
|
110
|
-
"name": "
|
|
180
|
+
"name": "spender",
|
|
111
181
|
"type": "address"
|
|
112
182
|
},
|
|
113
183
|
{
|
|
114
184
|
"internalType": "uint256",
|
|
115
|
-
"name": "
|
|
185
|
+
"name": "value",
|
|
116
186
|
"type": "uint256"
|
|
117
187
|
}
|
|
118
188
|
],
|
|
@@ -131,7 +201,7 @@ exports.TokenAbi = [
|
|
|
131
201
|
"inputs": [
|
|
132
202
|
{
|
|
133
203
|
"internalType": "address",
|
|
134
|
-
"name": "
|
|
204
|
+
"name": "account",
|
|
135
205
|
"type": "address"
|
|
136
206
|
}
|
|
137
207
|
],
|
|
@@ -151,9 +221,9 @@ exports.TokenAbi = [
|
|
|
151
221
|
"name": "decimals",
|
|
152
222
|
"outputs": [
|
|
153
223
|
{
|
|
154
|
-
"internalType": "
|
|
224
|
+
"internalType": "uint8",
|
|
155
225
|
"name": "",
|
|
156
|
-
"type": "
|
|
226
|
+
"type": "uint8"
|
|
157
227
|
}
|
|
158
228
|
],
|
|
159
229
|
"stateMutability": "view",
|
|
@@ -169,7 +239,7 @@ exports.TokenAbi = [
|
|
|
169
239
|
"type": "string"
|
|
170
240
|
}
|
|
171
241
|
],
|
|
172
|
-
"stateMutability": "
|
|
242
|
+
"stateMutability": "pure",
|
|
173
243
|
"type": "function"
|
|
174
244
|
},
|
|
175
245
|
{
|
|
@@ -182,7 +252,7 @@ exports.TokenAbi = [
|
|
|
182
252
|
"type": "string"
|
|
183
253
|
}
|
|
184
254
|
],
|
|
185
|
-
"stateMutability": "
|
|
255
|
+
"stateMutability": "pure",
|
|
186
256
|
"type": "function"
|
|
187
257
|
},
|
|
188
258
|
{
|
|
@@ -202,12 +272,12 @@ exports.TokenAbi = [
|
|
|
202
272
|
"inputs": [
|
|
203
273
|
{
|
|
204
274
|
"internalType": "address",
|
|
205
|
-
"name": "
|
|
275
|
+
"name": "to",
|
|
206
276
|
"type": "address"
|
|
207
277
|
},
|
|
208
278
|
{
|
|
209
279
|
"internalType": "uint256",
|
|
210
|
-
"name": "
|
|
280
|
+
"name": "value",
|
|
211
281
|
"type": "uint256"
|
|
212
282
|
}
|
|
213
283
|
],
|
|
@@ -226,17 +296,17 @@ exports.TokenAbi = [
|
|
|
226
296
|
"inputs": [
|
|
227
297
|
{
|
|
228
298
|
"internalType": "address",
|
|
229
|
-
"name": "
|
|
299
|
+
"name": "from",
|
|
230
300
|
"type": "address"
|
|
231
301
|
},
|
|
232
302
|
{
|
|
233
303
|
"internalType": "address",
|
|
234
|
-
"name": "
|
|
304
|
+
"name": "to",
|
|
235
305
|
"type": "address"
|
|
236
306
|
},
|
|
237
307
|
{
|
|
238
308
|
"internalType": "uint256",
|
|
239
|
-
"name": "
|
|
309
|
+
"name": "value",
|
|
240
310
|
"type": "uint256"
|
|
241
311
|
}
|
|
242
312
|
],
|
|
@@ -313,15 +383,15 @@ class Token {
|
|
|
313
383
|
* allowance
|
|
314
384
|
* view
|
|
315
385
|
*/
|
|
316
|
-
async allowance(
|
|
317
|
-
return this.contract.read.allowance([
|
|
386
|
+
async allowance(owner, spender) {
|
|
387
|
+
return this.contract.read.allowance([owner, spender]);
|
|
318
388
|
}
|
|
319
389
|
/**
|
|
320
390
|
* balanceOf
|
|
321
391
|
* view
|
|
322
392
|
*/
|
|
323
|
-
async balanceOf(
|
|
324
|
-
return this.contract.read.balanceOf([
|
|
393
|
+
async balanceOf(account) {
|
|
394
|
+
return this.contract.read.balanceOf([account]);
|
|
325
395
|
}
|
|
326
396
|
/**
|
|
327
397
|
* decimals
|
|
@@ -332,14 +402,14 @@ class Token {
|
|
|
332
402
|
}
|
|
333
403
|
/**
|
|
334
404
|
* name
|
|
335
|
-
*
|
|
405
|
+
* pure
|
|
336
406
|
*/
|
|
337
407
|
async name() {
|
|
338
408
|
return this.contract.read.name();
|
|
339
409
|
}
|
|
340
410
|
/**
|
|
341
411
|
* symbol
|
|
342
|
-
*
|
|
412
|
+
* pure
|
|
343
413
|
*/
|
|
344
414
|
async symbol() {
|
|
345
415
|
return this.contract.read.symbol();
|
|
@@ -356,33 +426,33 @@ class Token {
|
|
|
356
426
|
* nonpayable
|
|
357
427
|
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
358
428
|
*/
|
|
359
|
-
async approve(
|
|
429
|
+
async approve(spender, value, options) {
|
|
360
430
|
if (!this.contract.write) {
|
|
361
431
|
throw new Error('Wallet client is required for write operations');
|
|
362
432
|
}
|
|
363
|
-
return this.contract.write.approve([
|
|
433
|
+
return this.contract.write.approve([spender, value], options);
|
|
364
434
|
}
|
|
365
435
|
/**
|
|
366
436
|
* transfer
|
|
367
437
|
* nonpayable
|
|
368
438
|
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
369
439
|
*/
|
|
370
|
-
async transfer(
|
|
440
|
+
async transfer(to, value, options) {
|
|
371
441
|
if (!this.contract.write) {
|
|
372
442
|
throw new Error('Wallet client is required for write operations');
|
|
373
443
|
}
|
|
374
|
-
return this.contract.write.transfer([
|
|
444
|
+
return this.contract.write.transfer([to, value], options);
|
|
375
445
|
}
|
|
376
446
|
/**
|
|
377
447
|
* transferFrom
|
|
378
448
|
* nonpayable
|
|
379
449
|
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
380
450
|
*/
|
|
381
|
-
async transferFrom(
|
|
451
|
+
async transferFrom(from, to, value, options) {
|
|
382
452
|
if (!this.contract.write) {
|
|
383
453
|
throw new Error('Wallet client is required for write operations');
|
|
384
454
|
}
|
|
385
|
-
return this.contract.write.transferFrom([
|
|
455
|
+
return this.contract.write.transferFrom([from, to, value], options);
|
|
386
456
|
}
|
|
387
457
|
/**
|
|
388
458
|
* Simulate contract write operations (dry-run without sending transaction)
|
|
@@ -403,24 +473,24 @@ class Token {
|
|
|
403
473
|
* Returns gas estimate and result without sending transaction
|
|
404
474
|
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
405
475
|
*/
|
|
406
|
-
async approve(
|
|
407
|
-
return contract.simulate.approve([
|
|
476
|
+
async approve(spender, value, options) {
|
|
477
|
+
return contract.simulate.approve([spender, value], options);
|
|
408
478
|
},
|
|
409
479
|
/**
|
|
410
480
|
* Simulate transfer
|
|
411
481
|
* Returns gas estimate and result without sending transaction
|
|
412
482
|
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
413
483
|
*/
|
|
414
|
-
async transfer(
|
|
415
|
-
return contract.simulate.transfer([
|
|
484
|
+
async transfer(to, value, options) {
|
|
485
|
+
return contract.simulate.transfer([to, value], options);
|
|
416
486
|
},
|
|
417
487
|
/**
|
|
418
488
|
* Simulate transferFrom
|
|
419
489
|
* Returns gas estimate and result without sending transaction
|
|
420
490
|
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
421
491
|
*/
|
|
422
|
-
async transferFrom(
|
|
423
|
-
return contract.simulate.transferFrom([
|
|
492
|
+
async transferFrom(from, to, value, options) {
|
|
493
|
+
return contract.simulate.transferFrom([from, to, value], options);
|
|
424
494
|
}
|
|
425
495
|
};
|
|
426
496
|
}
|
package/contracts/Token.ts
CHANGED
|
@@ -7,26 +7,96 @@ import { getContract } from 'viem';
|
|
|
7
7
|
* This ABI is typed using viem's type system for full type safety.
|
|
8
8
|
*/
|
|
9
9
|
export const TokenAbi = [
|
|
10
|
+
{
|
|
11
|
+
"inputs": [],
|
|
12
|
+
"stateMutability": "nonpayable",
|
|
13
|
+
"type": "constructor"
|
|
14
|
+
},
|
|
10
15
|
{
|
|
11
16
|
"inputs": [
|
|
12
17
|
{
|
|
13
|
-
"internalType": "
|
|
14
|
-
"name": "
|
|
15
|
-
"type": "
|
|
18
|
+
"internalType": "address",
|
|
19
|
+
"name": "spender",
|
|
20
|
+
"type": "address"
|
|
16
21
|
},
|
|
17
22
|
{
|
|
18
|
-
"internalType": "
|
|
19
|
-
"name": "
|
|
20
|
-
"type": "
|
|
23
|
+
"internalType": "uint256",
|
|
24
|
+
"name": "allowance",
|
|
25
|
+
"type": "uint256"
|
|
21
26
|
},
|
|
22
27
|
{
|
|
23
|
-
"internalType": "uint256
|
|
24
|
-
"name": "
|
|
25
|
-
"type": "uint256
|
|
28
|
+
"internalType": "uint256",
|
|
29
|
+
"name": "needed",
|
|
30
|
+
"type": "uint256"
|
|
26
31
|
}
|
|
27
32
|
],
|
|
28
|
-
"
|
|
29
|
-
"type": "
|
|
33
|
+
"name": "ERC20InsufficientAllowance",
|
|
34
|
+
"type": "error"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"inputs": [
|
|
38
|
+
{
|
|
39
|
+
"internalType": "address",
|
|
40
|
+
"name": "sender",
|
|
41
|
+
"type": "address"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"internalType": "uint256",
|
|
45
|
+
"name": "balance",
|
|
46
|
+
"type": "uint256"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"internalType": "uint256",
|
|
50
|
+
"name": "needed",
|
|
51
|
+
"type": "uint256"
|
|
52
|
+
}
|
|
53
|
+
],
|
|
54
|
+
"name": "ERC20InsufficientBalance",
|
|
55
|
+
"type": "error"
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"inputs": [
|
|
59
|
+
{
|
|
60
|
+
"internalType": "address",
|
|
61
|
+
"name": "approver",
|
|
62
|
+
"type": "address"
|
|
63
|
+
}
|
|
64
|
+
],
|
|
65
|
+
"name": "ERC20InvalidApprover",
|
|
66
|
+
"type": "error"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"inputs": [
|
|
70
|
+
{
|
|
71
|
+
"internalType": "address",
|
|
72
|
+
"name": "receiver",
|
|
73
|
+
"type": "address"
|
|
74
|
+
}
|
|
75
|
+
],
|
|
76
|
+
"name": "ERC20InvalidReceiver",
|
|
77
|
+
"type": "error"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"inputs": [
|
|
81
|
+
{
|
|
82
|
+
"internalType": "address",
|
|
83
|
+
"name": "sender",
|
|
84
|
+
"type": "address"
|
|
85
|
+
}
|
|
86
|
+
],
|
|
87
|
+
"name": "ERC20InvalidSender",
|
|
88
|
+
"type": "error"
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
"inputs": [
|
|
92
|
+
{
|
|
93
|
+
"internalType": "address",
|
|
94
|
+
"name": "spender",
|
|
95
|
+
"type": "address"
|
|
96
|
+
}
|
|
97
|
+
],
|
|
98
|
+
"name": "ERC20InvalidSpender",
|
|
99
|
+
"type": "error"
|
|
30
100
|
},
|
|
31
101
|
{
|
|
32
102
|
"anonymous": false,
|
|
@@ -82,12 +152,12 @@ export const TokenAbi = [
|
|
|
82
152
|
"inputs": [
|
|
83
153
|
{
|
|
84
154
|
"internalType": "address",
|
|
85
|
-
"name": "
|
|
155
|
+
"name": "owner",
|
|
86
156
|
"type": "address"
|
|
87
157
|
},
|
|
88
158
|
{
|
|
89
159
|
"internalType": "address",
|
|
90
|
-
"name": "
|
|
160
|
+
"name": "spender",
|
|
91
161
|
"type": "address"
|
|
92
162
|
}
|
|
93
163
|
],
|
|
@@ -106,12 +176,12 @@ export const TokenAbi = [
|
|
|
106
176
|
"inputs": [
|
|
107
177
|
{
|
|
108
178
|
"internalType": "address",
|
|
109
|
-
"name": "
|
|
179
|
+
"name": "spender",
|
|
110
180
|
"type": "address"
|
|
111
181
|
},
|
|
112
182
|
{
|
|
113
183
|
"internalType": "uint256",
|
|
114
|
-
"name": "
|
|
184
|
+
"name": "value",
|
|
115
185
|
"type": "uint256"
|
|
116
186
|
}
|
|
117
187
|
],
|
|
@@ -130,7 +200,7 @@ export const TokenAbi = [
|
|
|
130
200
|
"inputs": [
|
|
131
201
|
{
|
|
132
202
|
"internalType": "address",
|
|
133
|
-
"name": "
|
|
203
|
+
"name": "account",
|
|
134
204
|
"type": "address"
|
|
135
205
|
}
|
|
136
206
|
],
|
|
@@ -150,9 +220,9 @@ export const TokenAbi = [
|
|
|
150
220
|
"name": "decimals",
|
|
151
221
|
"outputs": [
|
|
152
222
|
{
|
|
153
|
-
"internalType": "
|
|
223
|
+
"internalType": "uint8",
|
|
154
224
|
"name": "",
|
|
155
|
-
"type": "
|
|
225
|
+
"type": "uint8"
|
|
156
226
|
}
|
|
157
227
|
],
|
|
158
228
|
"stateMutability": "view",
|
|
@@ -168,7 +238,7 @@ export const TokenAbi = [
|
|
|
168
238
|
"type": "string"
|
|
169
239
|
}
|
|
170
240
|
],
|
|
171
|
-
"stateMutability": "
|
|
241
|
+
"stateMutability": "pure",
|
|
172
242
|
"type": "function"
|
|
173
243
|
},
|
|
174
244
|
{
|
|
@@ -181,7 +251,7 @@ export const TokenAbi = [
|
|
|
181
251
|
"type": "string"
|
|
182
252
|
}
|
|
183
253
|
],
|
|
184
|
-
"stateMutability": "
|
|
254
|
+
"stateMutability": "pure",
|
|
185
255
|
"type": "function"
|
|
186
256
|
},
|
|
187
257
|
{
|
|
@@ -201,12 +271,12 @@ export const TokenAbi = [
|
|
|
201
271
|
"inputs": [
|
|
202
272
|
{
|
|
203
273
|
"internalType": "address",
|
|
204
|
-
"name": "
|
|
274
|
+
"name": "to",
|
|
205
275
|
"type": "address"
|
|
206
276
|
},
|
|
207
277
|
{
|
|
208
278
|
"internalType": "uint256",
|
|
209
|
-
"name": "
|
|
279
|
+
"name": "value",
|
|
210
280
|
"type": "uint256"
|
|
211
281
|
}
|
|
212
282
|
],
|
|
@@ -225,17 +295,17 @@ export const TokenAbi = [
|
|
|
225
295
|
"inputs": [
|
|
226
296
|
{
|
|
227
297
|
"internalType": "address",
|
|
228
|
-
"name": "
|
|
298
|
+
"name": "from",
|
|
229
299
|
"type": "address"
|
|
230
300
|
},
|
|
231
301
|
{
|
|
232
302
|
"internalType": "address",
|
|
233
|
-
"name": "
|
|
303
|
+
"name": "to",
|
|
234
304
|
"type": "address"
|
|
235
305
|
},
|
|
236
306
|
{
|
|
237
307
|
"internalType": "uint256",
|
|
238
|
-
"name": "
|
|
308
|
+
"name": "value",
|
|
239
309
|
"type": "uint256"
|
|
240
310
|
}
|
|
241
311
|
],
|
|
@@ -338,16 +408,16 @@ export class Token {
|
|
|
338
408
|
* allowance
|
|
339
409
|
* view
|
|
340
410
|
*/
|
|
341
|
-
async allowance(
|
|
342
|
-
return this.contract.read.allowance([
|
|
411
|
+
async allowance(owner: `0x${string}`, spender: `0x${string}`): Promise<bigint> {
|
|
412
|
+
return this.contract.read.allowance([owner, spender] as const) as Promise<bigint>;
|
|
343
413
|
}
|
|
344
414
|
|
|
345
415
|
/**
|
|
346
416
|
* balanceOf
|
|
347
417
|
* view
|
|
348
418
|
*/
|
|
349
|
-
async balanceOf(
|
|
350
|
-
return this.contract.read.balanceOf([
|
|
419
|
+
async balanceOf(account: `0x${string}`): Promise<bigint> {
|
|
420
|
+
return this.contract.read.balanceOf([account] as const) as Promise<bigint>;
|
|
351
421
|
}
|
|
352
422
|
|
|
353
423
|
/**
|
|
@@ -360,7 +430,7 @@ export class Token {
|
|
|
360
430
|
|
|
361
431
|
/**
|
|
362
432
|
* name
|
|
363
|
-
*
|
|
433
|
+
* pure
|
|
364
434
|
*/
|
|
365
435
|
async name(): Promise<string> {
|
|
366
436
|
return this.contract.read.name() as Promise<string>;
|
|
@@ -368,7 +438,7 @@ export class Token {
|
|
|
368
438
|
|
|
369
439
|
/**
|
|
370
440
|
* symbol
|
|
371
|
-
*
|
|
441
|
+
* pure
|
|
372
442
|
*/
|
|
373
443
|
async symbol(): Promise<string> {
|
|
374
444
|
return this.contract.read.symbol() as Promise<string>;
|
|
@@ -387,7 +457,7 @@ export class Token {
|
|
|
387
457
|
* nonpayable
|
|
388
458
|
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
389
459
|
*/
|
|
390
|
-
async approve(
|
|
460
|
+
async approve(spender: `0x${string}`, value: bigint, options?: {
|
|
391
461
|
accessList?: import('viem').AccessList;
|
|
392
462
|
authorizationList?: import('viem').AuthorizationList;
|
|
393
463
|
chain?: import('viem').Chain | null;
|
|
@@ -402,7 +472,7 @@ export class Token {
|
|
|
402
472
|
if (!this.contract.write) {
|
|
403
473
|
throw new Error('Wallet client is required for write operations');
|
|
404
474
|
}
|
|
405
|
-
return this.contract.write.approve([
|
|
475
|
+
return this.contract.write.approve([spender, value] as const, options) as Promise<`0x${string}`>;
|
|
406
476
|
}
|
|
407
477
|
|
|
408
478
|
/**
|
|
@@ -410,7 +480,7 @@ export class Token {
|
|
|
410
480
|
* nonpayable
|
|
411
481
|
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
412
482
|
*/
|
|
413
|
-
async transfer(
|
|
483
|
+
async transfer(to: `0x${string}`, value: bigint, options?: {
|
|
414
484
|
accessList?: import('viem').AccessList;
|
|
415
485
|
authorizationList?: import('viem').AuthorizationList;
|
|
416
486
|
chain?: import('viem').Chain | null;
|
|
@@ -425,7 +495,7 @@ export class Token {
|
|
|
425
495
|
if (!this.contract.write) {
|
|
426
496
|
throw new Error('Wallet client is required for write operations');
|
|
427
497
|
}
|
|
428
|
-
return this.contract.write.transfer([
|
|
498
|
+
return this.contract.write.transfer([to, value] as const, options) as Promise<`0x${string}`>;
|
|
429
499
|
}
|
|
430
500
|
|
|
431
501
|
/**
|
|
@@ -433,7 +503,7 @@ export class Token {
|
|
|
433
503
|
* nonpayable
|
|
434
504
|
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
435
505
|
*/
|
|
436
|
-
async transferFrom(
|
|
506
|
+
async transferFrom(from: `0x${string}`, to: `0x${string}`, value: bigint, options?: {
|
|
437
507
|
accessList?: import('viem').AccessList;
|
|
438
508
|
authorizationList?: import('viem').AuthorizationList;
|
|
439
509
|
chain?: import('viem').Chain | null;
|
|
@@ -448,7 +518,7 @@ export class Token {
|
|
|
448
518
|
if (!this.contract.write) {
|
|
449
519
|
throw new Error('Wallet client is required for write operations');
|
|
450
520
|
}
|
|
451
|
-
return this.contract.write.transferFrom([
|
|
521
|
+
return this.contract.write.transferFrom([from, to, value] as const, options) as Promise<`0x${string}`>;
|
|
452
522
|
}
|
|
453
523
|
|
|
454
524
|
|
|
@@ -472,7 +542,7 @@ export class Token {
|
|
|
472
542
|
* Returns gas estimate and result without sending transaction
|
|
473
543
|
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
474
544
|
*/
|
|
475
|
-
async approve(
|
|
545
|
+
async approve(spender: `0x${string}`, value: bigint, options?: {
|
|
476
546
|
accessList?: import('viem').AccessList;
|
|
477
547
|
authorizationList?: import('viem').AuthorizationList;
|
|
478
548
|
chain?: import('viem').Chain | null;
|
|
@@ -484,14 +554,14 @@ export class Token {
|
|
|
484
554
|
nonce?: number;
|
|
485
555
|
value?: bigint;
|
|
486
556
|
}): Promise<boolean> {
|
|
487
|
-
return contract.simulate.approve([
|
|
557
|
+
return contract.simulate.approve([spender, value] as const, options) as Promise<boolean>;
|
|
488
558
|
},
|
|
489
559
|
/**
|
|
490
560
|
* Simulate transfer
|
|
491
561
|
* Returns gas estimate and result without sending transaction
|
|
492
562
|
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
493
563
|
*/
|
|
494
|
-
async transfer(
|
|
564
|
+
async transfer(to: `0x${string}`, value: bigint, options?: {
|
|
495
565
|
accessList?: import('viem').AccessList;
|
|
496
566
|
authorizationList?: import('viem').AuthorizationList;
|
|
497
567
|
chain?: import('viem').Chain | null;
|
|
@@ -503,14 +573,14 @@ export class Token {
|
|
|
503
573
|
nonce?: number;
|
|
504
574
|
value?: bigint;
|
|
505
575
|
}): Promise<boolean> {
|
|
506
|
-
return contract.simulate.transfer([
|
|
576
|
+
return contract.simulate.transfer([to, value] as const, options) as Promise<boolean>;
|
|
507
577
|
},
|
|
508
578
|
/**
|
|
509
579
|
* Simulate transferFrom
|
|
510
580
|
* Returns gas estimate and result without sending transaction
|
|
511
581
|
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
512
582
|
*/
|
|
513
|
-
async transferFrom(
|
|
583
|
+
async transferFrom(from: `0x${string}`, to: `0x${string}`, value: bigint, options?: {
|
|
514
584
|
accessList?: import('viem').AccessList;
|
|
515
585
|
authorizationList?: import('viem').AuthorizationList;
|
|
516
586
|
chain?: import('viem').Chain | null;
|
|
@@ -522,7 +592,7 @@ export class Token {
|
|
|
522
592
|
nonce?: number;
|
|
523
593
|
value?: bigint;
|
|
524
594
|
}): Promise<boolean> {
|
|
525
|
-
return contract.simulate.transferFrom([
|
|
595
|
+
return contract.simulate.transferFrom([from, to, value] as const, options) as Promise<boolean>;
|
|
526
596
|
}
|
|
527
597
|
};
|
|
528
598
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gitmyabi/var",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "Auto-generated TypeScript type bindings for VAR (build etherscan-var-
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "Auto-generated TypeScript type bindings for VAR (build etherscan-var-3a050fd9-1796130525605, commit 872b98d, branch etherscan)",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"types": "./index.d.ts",
|
|
7
7
|
"exports": {
|
|
@@ -39,5 +39,5 @@
|
|
|
39
39
|
"url": "https://github.com/etherscan/var"
|
|
40
40
|
},
|
|
41
41
|
"branch": "etherscan",
|
|
42
|
-
"shortHash": "
|
|
42
|
+
"shortHash": "872b98d"
|
|
43
43
|
}
|