@gitmyabi-stg/stpt 0.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 +108 -0
- package/contracts/STPTToken.d.ts +474 -0
- package/contracts/STPTToken.js +511 -0
- package/contracts/STPTToken.ts +636 -0
- package/contracts/index.d.ts +2 -0
- package/contracts/index.js +7 -0
- package/contracts/index.ts +3 -0
- package/index.d.ts +1 -0
- package/index.js +19 -0
- package/package.json +43 -0
package/README.md
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# @gitmyabi-stg/stpt
|
|
2
|
+
|
|
3
|
+
Auto-generated TypeScript type bindings for **STPT**
|
|
4
|
+
|
|
5
|
+
- **Build ID**: `etherscan-stpt-de7d8515-1780061902405`
|
|
6
|
+
- **Build Number**: 1
|
|
7
|
+
- **Commit**: `733135f`
|
|
8
|
+
- **Branch**: `etherscan`
|
|
9
|
+
- **Target**: `ethers-v6`
|
|
10
|
+
- **Contracts**: 1
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm install @gitmyabi-stg/stpt@0.0.1
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Usage
|
|
19
|
+
|
|
20
|
+
### Class-based API (TypeChain-like)
|
|
21
|
+
|
|
22
|
+
```typescript
|
|
23
|
+
import { createPublicClient, createWalletClient, http } from 'viem';
|
|
24
|
+
import { mainnet } from 'viem/chains';
|
|
25
|
+
import { YourContract } from '@gitmyabi-stg/stpt';
|
|
26
|
+
|
|
27
|
+
const publicClient = createPublicClient({ chain: mainnet, transport: http() });
|
|
28
|
+
const walletClient = createWalletClient({ chain: mainnet, transport: http() });
|
|
29
|
+
|
|
30
|
+
// Create contract instance
|
|
31
|
+
const contract = new YourContract('0x...', { publicClient, walletClient });
|
|
32
|
+
|
|
33
|
+
// Read functions - call directly like TypeChain!
|
|
34
|
+
const result = await contract.yourMethod(param1, param2);
|
|
35
|
+
|
|
36
|
+
// Write functions - also call directly!
|
|
37
|
+
const hash = await contract.transfer('0x...', 1000n);
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### With viem directly
|
|
41
|
+
|
|
42
|
+
```typescript
|
|
43
|
+
import { createPublicClient, http } from 'viem';
|
|
44
|
+
import { mainnet } from 'viem/chains';
|
|
45
|
+
import { YourContractAbi } from '@gitmyabi-stg/stpt';
|
|
46
|
+
|
|
47
|
+
const client = createPublicClient({
|
|
48
|
+
chain: mainnet,
|
|
49
|
+
transport: http(),
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
// Fully typed contract read
|
|
53
|
+
const result = await client.readContract({
|
|
54
|
+
address: '0x...',
|
|
55
|
+
abi: YourContractAbi,
|
|
56
|
+
functionName: 'yourMethod',
|
|
57
|
+
args: [param1, param2],
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
// Fully typed contract write
|
|
61
|
+
const hash = await client.writeContract({
|
|
62
|
+
address: '0x...',
|
|
63
|
+
abi: YourContractAbi,
|
|
64
|
+
functionName: 'yourMethod',
|
|
65
|
+
args: [param1, param2],
|
|
66
|
+
});
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### With wagmi
|
|
70
|
+
|
|
71
|
+
```typescript
|
|
72
|
+
import { useReadContract, useWriteContract } from 'wagmi';
|
|
73
|
+
import { YourContractAbi } from '@gitmyabi-stg/stpt';
|
|
74
|
+
|
|
75
|
+
function MyComponent() {
|
|
76
|
+
const { data } = useReadContract({
|
|
77
|
+
address: '0x...',
|
|
78
|
+
abi: YourContractAbi,
|
|
79
|
+
functionName: 'yourMethod',
|
|
80
|
+
args: [param1, param2],
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
const { writeContract } = useWriteContract();
|
|
84
|
+
|
|
85
|
+
const handleWrite = () => {
|
|
86
|
+
writeContract({
|
|
87
|
+
address: '0x...',
|
|
88
|
+
abi: YourContractAbi,
|
|
89
|
+
functionName: 'yourMethod',
|
|
90
|
+
args: [param1, param2],
|
|
91
|
+
});
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
return <button onClick={handleWrite}>Call Contract</button>;
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Type Safety
|
|
99
|
+
|
|
100
|
+
This package provides full TypeScript type safety for all contract methods, events, and parameters using viem's type system. All ABIs are exported as `const` assertions for maximum type inference.
|
|
101
|
+
|
|
102
|
+
## Generated Contracts
|
|
103
|
+
|
|
104
|
+
This package includes type bindings for 1 contract(s) generated from ABI artifacts.
|
|
105
|
+
|
|
106
|
+
## License
|
|
107
|
+
|
|
108
|
+
Apache License 2.0
|
|
@@ -0,0 +1,474 @@
|
|
|
1
|
+
import type { Address, PublicClient, WalletClient } from 'viem';
|
|
2
|
+
/**
|
|
3
|
+
* STPTToken ABI
|
|
4
|
+
*
|
|
5
|
+
* This ABI is typed using viem's type system for full type safety.
|
|
6
|
+
*/
|
|
7
|
+
export declare const STPTTokenAbi: readonly [{
|
|
8
|
+
readonly constant: true;
|
|
9
|
+
readonly inputs: readonly [];
|
|
10
|
+
readonly name: "name";
|
|
11
|
+
readonly outputs: readonly [{
|
|
12
|
+
readonly name: "";
|
|
13
|
+
readonly type: "string";
|
|
14
|
+
}];
|
|
15
|
+
readonly payable: false;
|
|
16
|
+
readonly stateMutability: "view";
|
|
17
|
+
readonly type: "function";
|
|
18
|
+
}, {
|
|
19
|
+
readonly constant: false;
|
|
20
|
+
readonly inputs: readonly [{
|
|
21
|
+
readonly name: "spender";
|
|
22
|
+
readonly type: "address";
|
|
23
|
+
}, {
|
|
24
|
+
readonly name: "tokens";
|
|
25
|
+
readonly type: "uint256";
|
|
26
|
+
}];
|
|
27
|
+
readonly name: "approve";
|
|
28
|
+
readonly outputs: readonly [{
|
|
29
|
+
readonly name: "success";
|
|
30
|
+
readonly type: "bool";
|
|
31
|
+
}];
|
|
32
|
+
readonly payable: false;
|
|
33
|
+
readonly stateMutability: "nonpayable";
|
|
34
|
+
readonly type: "function";
|
|
35
|
+
}, {
|
|
36
|
+
readonly constant: true;
|
|
37
|
+
readonly inputs: readonly [];
|
|
38
|
+
readonly name: "totalSupply";
|
|
39
|
+
readonly outputs: readonly [{
|
|
40
|
+
readonly name: "";
|
|
41
|
+
readonly type: "uint256";
|
|
42
|
+
}];
|
|
43
|
+
readonly payable: false;
|
|
44
|
+
readonly stateMutability: "view";
|
|
45
|
+
readonly type: "function";
|
|
46
|
+
}, {
|
|
47
|
+
readonly constant: false;
|
|
48
|
+
readonly inputs: readonly [{
|
|
49
|
+
readonly name: "from";
|
|
50
|
+
readonly type: "address";
|
|
51
|
+
}, {
|
|
52
|
+
readonly name: "to";
|
|
53
|
+
readonly type: "address";
|
|
54
|
+
}, {
|
|
55
|
+
readonly name: "tokens";
|
|
56
|
+
readonly type: "uint256";
|
|
57
|
+
}];
|
|
58
|
+
readonly name: "transferFrom";
|
|
59
|
+
readonly outputs: readonly [{
|
|
60
|
+
readonly name: "success";
|
|
61
|
+
readonly type: "bool";
|
|
62
|
+
}];
|
|
63
|
+
readonly payable: false;
|
|
64
|
+
readonly stateMutability: "nonpayable";
|
|
65
|
+
readonly type: "function";
|
|
66
|
+
}, {
|
|
67
|
+
readonly constant: true;
|
|
68
|
+
readonly inputs: readonly [];
|
|
69
|
+
readonly name: "decimals";
|
|
70
|
+
readonly outputs: readonly [{
|
|
71
|
+
readonly name: "";
|
|
72
|
+
readonly type: "uint8";
|
|
73
|
+
}];
|
|
74
|
+
readonly payable: false;
|
|
75
|
+
readonly stateMutability: "view";
|
|
76
|
+
readonly type: "function";
|
|
77
|
+
}, {
|
|
78
|
+
readonly constant: true;
|
|
79
|
+
readonly inputs: readonly [{
|
|
80
|
+
readonly name: "tokenOwner";
|
|
81
|
+
readonly type: "address";
|
|
82
|
+
}];
|
|
83
|
+
readonly name: "balanceOf";
|
|
84
|
+
readonly outputs: readonly [{
|
|
85
|
+
readonly name: "balance";
|
|
86
|
+
readonly type: "uint256";
|
|
87
|
+
}];
|
|
88
|
+
readonly payable: false;
|
|
89
|
+
readonly stateMutability: "view";
|
|
90
|
+
readonly type: "function";
|
|
91
|
+
}, {
|
|
92
|
+
readonly constant: true;
|
|
93
|
+
readonly inputs: readonly [];
|
|
94
|
+
readonly name: "symbol";
|
|
95
|
+
readonly outputs: readonly [{
|
|
96
|
+
readonly name: "";
|
|
97
|
+
readonly type: "string";
|
|
98
|
+
}];
|
|
99
|
+
readonly payable: false;
|
|
100
|
+
readonly stateMutability: "view";
|
|
101
|
+
readonly type: "function";
|
|
102
|
+
}, {
|
|
103
|
+
readonly constant: false;
|
|
104
|
+
readonly inputs: readonly [{
|
|
105
|
+
readonly name: "to";
|
|
106
|
+
readonly type: "address";
|
|
107
|
+
}, {
|
|
108
|
+
readonly name: "tokens";
|
|
109
|
+
readonly type: "uint256";
|
|
110
|
+
}];
|
|
111
|
+
readonly name: "transfer";
|
|
112
|
+
readonly outputs: readonly [{
|
|
113
|
+
readonly name: "success";
|
|
114
|
+
readonly type: "bool";
|
|
115
|
+
}];
|
|
116
|
+
readonly payable: false;
|
|
117
|
+
readonly stateMutability: "nonpayable";
|
|
118
|
+
readonly type: "function";
|
|
119
|
+
}, {
|
|
120
|
+
readonly constant: false;
|
|
121
|
+
readonly inputs: readonly [{
|
|
122
|
+
readonly name: "spender";
|
|
123
|
+
readonly type: "address";
|
|
124
|
+
}, {
|
|
125
|
+
readonly name: "tokens";
|
|
126
|
+
readonly type: "uint256";
|
|
127
|
+
}, {
|
|
128
|
+
readonly name: "data";
|
|
129
|
+
readonly type: "bytes";
|
|
130
|
+
}];
|
|
131
|
+
readonly name: "approveAndCall";
|
|
132
|
+
readonly outputs: readonly [{
|
|
133
|
+
readonly name: "success";
|
|
134
|
+
readonly type: "bool";
|
|
135
|
+
}];
|
|
136
|
+
readonly payable: false;
|
|
137
|
+
readonly stateMutability: "nonpayable";
|
|
138
|
+
readonly type: "function";
|
|
139
|
+
}, {
|
|
140
|
+
readonly constant: true;
|
|
141
|
+
readonly inputs: readonly [{
|
|
142
|
+
readonly name: "tokenOwner";
|
|
143
|
+
readonly type: "address";
|
|
144
|
+
}, {
|
|
145
|
+
readonly name: "spender";
|
|
146
|
+
readonly type: "address";
|
|
147
|
+
}];
|
|
148
|
+
readonly name: "allowance";
|
|
149
|
+
readonly outputs: readonly [{
|
|
150
|
+
readonly name: "remaining";
|
|
151
|
+
readonly type: "uint256";
|
|
152
|
+
}];
|
|
153
|
+
readonly payable: false;
|
|
154
|
+
readonly stateMutability: "view";
|
|
155
|
+
readonly type: "function";
|
|
156
|
+
}, {
|
|
157
|
+
readonly inputs: readonly [];
|
|
158
|
+
readonly payable: false;
|
|
159
|
+
readonly stateMutability: "nonpayable";
|
|
160
|
+
readonly type: "constructor";
|
|
161
|
+
}, {
|
|
162
|
+
readonly payable: true;
|
|
163
|
+
readonly stateMutability: "payable";
|
|
164
|
+
readonly type: "fallback";
|
|
165
|
+
}, {
|
|
166
|
+
readonly anonymous: false;
|
|
167
|
+
readonly inputs: readonly [{
|
|
168
|
+
readonly indexed: true;
|
|
169
|
+
readonly name: "from";
|
|
170
|
+
readonly type: "address";
|
|
171
|
+
}, {
|
|
172
|
+
readonly indexed: true;
|
|
173
|
+
readonly name: "to";
|
|
174
|
+
readonly type: "address";
|
|
175
|
+
}, {
|
|
176
|
+
readonly indexed: false;
|
|
177
|
+
readonly name: "tokens";
|
|
178
|
+
readonly type: "uint256";
|
|
179
|
+
}];
|
|
180
|
+
readonly name: "Transfer";
|
|
181
|
+
readonly type: "event";
|
|
182
|
+
}, {
|
|
183
|
+
readonly anonymous: false;
|
|
184
|
+
readonly inputs: readonly [{
|
|
185
|
+
readonly indexed: true;
|
|
186
|
+
readonly name: "tokenOwner";
|
|
187
|
+
readonly type: "address";
|
|
188
|
+
}, {
|
|
189
|
+
readonly indexed: true;
|
|
190
|
+
readonly name: "spender";
|
|
191
|
+
readonly type: "address";
|
|
192
|
+
}, {
|
|
193
|
+
readonly indexed: false;
|
|
194
|
+
readonly name: "tokens";
|
|
195
|
+
readonly type: "uint256";
|
|
196
|
+
}];
|
|
197
|
+
readonly name: "Approval";
|
|
198
|
+
readonly type: "event";
|
|
199
|
+
}];
|
|
200
|
+
/**
|
|
201
|
+
* Type-safe ABI for STPTToken
|
|
202
|
+
*/
|
|
203
|
+
export type STPTTokenAbi = typeof STPTTokenAbi;
|
|
204
|
+
/**
|
|
205
|
+
* Contract instance type for STPTToken
|
|
206
|
+
*/
|
|
207
|
+
export type STPTTokenContract = any;
|
|
208
|
+
/**
|
|
209
|
+
* STPTToken Contract Class
|
|
210
|
+
*
|
|
211
|
+
* Provides a class-based API similar to TypeChain for interacting with the contract.
|
|
212
|
+
*
|
|
213
|
+
* @example
|
|
214
|
+
* ```typescript
|
|
215
|
+
* import { createPublicClient, createWalletClient, http } from 'viem';
|
|
216
|
+
* import { mainnet } from 'viem/chains';
|
|
217
|
+
* import { STPTToken } from 'STPTToken';
|
|
218
|
+
*
|
|
219
|
+
* const publicClient = createPublicClient({ chain: mainnet, transport: http() });
|
|
220
|
+
* const walletClient = createWalletClient({ chain: mainnet, transport: http() });
|
|
221
|
+
*
|
|
222
|
+
* const contract = new STPTToken('0x...', { publicClient, walletClient });
|
|
223
|
+
*
|
|
224
|
+
* // Read functions
|
|
225
|
+
* const result = await contract.balanceOf('0x...');
|
|
226
|
+
*
|
|
227
|
+
* // Write functions
|
|
228
|
+
* const hash = await contract.transfer('0x...', 1000n);
|
|
229
|
+
*
|
|
230
|
+
* // Simulate transactions (dry-run)
|
|
231
|
+
* const simulation = await contract.simulate.transfer('0x...', 1000n);
|
|
232
|
+
* console.log('Gas estimate:', simulation.request.gas);
|
|
233
|
+
*
|
|
234
|
+
* // Watch events
|
|
235
|
+
* const unwatch = contract.watch.Transfer((event) => {
|
|
236
|
+
* console.log('Transfer event:', event);
|
|
237
|
+
* });
|
|
238
|
+
* ```
|
|
239
|
+
*/
|
|
240
|
+
export declare class STPTToken {
|
|
241
|
+
private contract;
|
|
242
|
+
private contractAddress;
|
|
243
|
+
private publicClient;
|
|
244
|
+
constructor(address: Address, clients: {
|
|
245
|
+
publicClient: PublicClient;
|
|
246
|
+
walletClient?: WalletClient;
|
|
247
|
+
});
|
|
248
|
+
/**
|
|
249
|
+
* Get the contract address
|
|
250
|
+
*/
|
|
251
|
+
get address(): Address;
|
|
252
|
+
/**
|
|
253
|
+
* Get the underlying viem contract instance.
|
|
254
|
+
*/
|
|
255
|
+
getContract(): STPTTokenContract;
|
|
256
|
+
/**
|
|
257
|
+
* name
|
|
258
|
+
* view
|
|
259
|
+
*/
|
|
260
|
+
name(): Promise<string>;
|
|
261
|
+
/**
|
|
262
|
+
* totalSupply
|
|
263
|
+
* view
|
|
264
|
+
*/
|
|
265
|
+
totalSupply(): Promise<bigint>;
|
|
266
|
+
/**
|
|
267
|
+
* decimals
|
|
268
|
+
* view
|
|
269
|
+
*/
|
|
270
|
+
decimals(): Promise<bigint>;
|
|
271
|
+
/**
|
|
272
|
+
* balanceOf
|
|
273
|
+
* view
|
|
274
|
+
*/
|
|
275
|
+
balanceOf(tokenOwner: `0x${string}`): Promise<bigint>;
|
|
276
|
+
/**
|
|
277
|
+
* symbol
|
|
278
|
+
* view
|
|
279
|
+
*/
|
|
280
|
+
symbol(): Promise<string>;
|
|
281
|
+
/**
|
|
282
|
+
* allowance
|
|
283
|
+
* view
|
|
284
|
+
*/
|
|
285
|
+
allowance(tokenOwner: `0x${string}`, spender: `0x${string}`): Promise<bigint>;
|
|
286
|
+
/**
|
|
287
|
+
* approve
|
|
288
|
+
* nonpayable
|
|
289
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
290
|
+
*/
|
|
291
|
+
approve(spender: `0x${string}`, tokens: bigint, options?: {
|
|
292
|
+
accessList?: import('viem').AccessList;
|
|
293
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
294
|
+
chain?: import('viem').Chain | null;
|
|
295
|
+
dataSuffix?: `0x${string}`;
|
|
296
|
+
gas?: bigint;
|
|
297
|
+
gasPrice?: bigint;
|
|
298
|
+
maxFeePerGas?: bigint;
|
|
299
|
+
maxPriorityFeePerGas?: bigint;
|
|
300
|
+
nonce?: number;
|
|
301
|
+
value?: bigint;
|
|
302
|
+
}): Promise<`0x${string}`>;
|
|
303
|
+
/**
|
|
304
|
+
* transferFrom
|
|
305
|
+
* nonpayable
|
|
306
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
307
|
+
*/
|
|
308
|
+
transferFrom(from: `0x${string}`, to: `0x${string}`, tokens: bigint, options?: {
|
|
309
|
+
accessList?: import('viem').AccessList;
|
|
310
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
311
|
+
chain?: import('viem').Chain | null;
|
|
312
|
+
dataSuffix?: `0x${string}`;
|
|
313
|
+
gas?: bigint;
|
|
314
|
+
gasPrice?: bigint;
|
|
315
|
+
maxFeePerGas?: bigint;
|
|
316
|
+
maxPriorityFeePerGas?: bigint;
|
|
317
|
+
nonce?: number;
|
|
318
|
+
value?: bigint;
|
|
319
|
+
}): Promise<`0x${string}`>;
|
|
320
|
+
/**
|
|
321
|
+
* transfer
|
|
322
|
+
* nonpayable
|
|
323
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
324
|
+
*/
|
|
325
|
+
transfer(to: `0x${string}`, tokens: bigint, options?: {
|
|
326
|
+
accessList?: import('viem').AccessList;
|
|
327
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
328
|
+
chain?: import('viem').Chain | null;
|
|
329
|
+
dataSuffix?: `0x${string}`;
|
|
330
|
+
gas?: bigint;
|
|
331
|
+
gasPrice?: bigint;
|
|
332
|
+
maxFeePerGas?: bigint;
|
|
333
|
+
maxPriorityFeePerGas?: bigint;
|
|
334
|
+
nonce?: number;
|
|
335
|
+
value?: bigint;
|
|
336
|
+
}): Promise<`0x${string}`>;
|
|
337
|
+
/**
|
|
338
|
+
* approveAndCall
|
|
339
|
+
* nonpayable
|
|
340
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
341
|
+
*/
|
|
342
|
+
approveAndCall(spender: `0x${string}`, tokens: bigint, data: `0x${string}`, options?: {
|
|
343
|
+
accessList?: import('viem').AccessList;
|
|
344
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
345
|
+
chain?: import('viem').Chain | null;
|
|
346
|
+
dataSuffix?: `0x${string}`;
|
|
347
|
+
gas?: bigint;
|
|
348
|
+
gasPrice?: bigint;
|
|
349
|
+
maxFeePerGas?: bigint;
|
|
350
|
+
maxPriorityFeePerGas?: bigint;
|
|
351
|
+
nonce?: number;
|
|
352
|
+
value?: bigint;
|
|
353
|
+
}): Promise<`0x${string}`>;
|
|
354
|
+
/**
|
|
355
|
+
* Simulate contract write operations (dry-run without sending transaction)
|
|
356
|
+
*
|
|
357
|
+
* @example
|
|
358
|
+
* const result = await contract.simulate.transfer('0x...', 1000n);
|
|
359
|
+
* console.log('Gas estimate:', result.request.gas);
|
|
360
|
+
* console.log('Would succeed:', result.result);
|
|
361
|
+
*/
|
|
362
|
+
get simulate(): {
|
|
363
|
+
/**
|
|
364
|
+
* Simulate approve
|
|
365
|
+
* Returns gas estimate and result without sending transaction
|
|
366
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
367
|
+
*/
|
|
368
|
+
approve(spender: `0x${string}`, tokens: bigint, options?: {
|
|
369
|
+
accessList?: import("viem").AccessList;
|
|
370
|
+
authorizationList?: import("viem").AuthorizationList;
|
|
371
|
+
chain?: import("viem").Chain | null;
|
|
372
|
+
dataSuffix?: `0x${string}`;
|
|
373
|
+
gas?: bigint;
|
|
374
|
+
gasPrice?: bigint;
|
|
375
|
+
maxFeePerGas?: bigint;
|
|
376
|
+
maxPriorityFeePerGas?: bigint;
|
|
377
|
+
nonce?: number;
|
|
378
|
+
value?: bigint;
|
|
379
|
+
}): Promise<boolean>;
|
|
380
|
+
/**
|
|
381
|
+
* Simulate transferFrom
|
|
382
|
+
* Returns gas estimate and result without sending transaction
|
|
383
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
384
|
+
*/
|
|
385
|
+
transferFrom(from: `0x${string}`, to: `0x${string}`, tokens: bigint, options?: {
|
|
386
|
+
accessList?: import("viem").AccessList;
|
|
387
|
+
authorizationList?: import("viem").AuthorizationList;
|
|
388
|
+
chain?: import("viem").Chain | null;
|
|
389
|
+
dataSuffix?: `0x${string}`;
|
|
390
|
+
gas?: bigint;
|
|
391
|
+
gasPrice?: bigint;
|
|
392
|
+
maxFeePerGas?: bigint;
|
|
393
|
+
maxPriorityFeePerGas?: bigint;
|
|
394
|
+
nonce?: number;
|
|
395
|
+
value?: bigint;
|
|
396
|
+
}): Promise<boolean>;
|
|
397
|
+
/**
|
|
398
|
+
* Simulate transfer
|
|
399
|
+
* Returns gas estimate and result without sending transaction
|
|
400
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
401
|
+
*/
|
|
402
|
+
transfer(to: `0x${string}`, tokens: bigint, options?: {
|
|
403
|
+
accessList?: import("viem").AccessList;
|
|
404
|
+
authorizationList?: import("viem").AuthorizationList;
|
|
405
|
+
chain?: import("viem").Chain | null;
|
|
406
|
+
dataSuffix?: `0x${string}`;
|
|
407
|
+
gas?: bigint;
|
|
408
|
+
gasPrice?: bigint;
|
|
409
|
+
maxFeePerGas?: bigint;
|
|
410
|
+
maxPriorityFeePerGas?: bigint;
|
|
411
|
+
nonce?: number;
|
|
412
|
+
value?: bigint;
|
|
413
|
+
}): Promise<boolean>;
|
|
414
|
+
/**
|
|
415
|
+
* Simulate approveAndCall
|
|
416
|
+
* Returns gas estimate and result without sending transaction
|
|
417
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
418
|
+
*/
|
|
419
|
+
approveAndCall(spender: `0x${string}`, tokens: bigint, data: `0x${string}`, options?: {
|
|
420
|
+
accessList?: import("viem").AccessList;
|
|
421
|
+
authorizationList?: import("viem").AuthorizationList;
|
|
422
|
+
chain?: import("viem").Chain | null;
|
|
423
|
+
dataSuffix?: `0x${string}`;
|
|
424
|
+
gas?: bigint;
|
|
425
|
+
gasPrice?: bigint;
|
|
426
|
+
maxFeePerGas?: bigint;
|
|
427
|
+
maxPriorityFeePerGas?: bigint;
|
|
428
|
+
nonce?: number;
|
|
429
|
+
value?: bigint;
|
|
430
|
+
}): Promise<boolean>;
|
|
431
|
+
};
|
|
432
|
+
/**
|
|
433
|
+
* Watch contract events
|
|
434
|
+
*
|
|
435
|
+
* @example
|
|
436
|
+
* // Watch all Transfer events
|
|
437
|
+
* const unwatch = contract.watch.Transfer((event) => {
|
|
438
|
+
* console.log('Transfer:', event);
|
|
439
|
+
* });
|
|
440
|
+
*
|
|
441
|
+
* // Stop watching
|
|
442
|
+
* unwatch();
|
|
443
|
+
*/
|
|
444
|
+
get watch(): {
|
|
445
|
+
/**
|
|
446
|
+
* Watch Transfer events
|
|
447
|
+
* @param callback Function to call when event is emitted
|
|
448
|
+
* @param filter Optional filter for indexed parameters
|
|
449
|
+
* @returns Unwatch function to stop listening
|
|
450
|
+
*/
|
|
451
|
+
Transfer: (callback: (event: {
|
|
452
|
+
from: `0x${string}`;
|
|
453
|
+
to: `0x${string}`;
|
|
454
|
+
tokens: bigint;
|
|
455
|
+
}) => void, filter?: {
|
|
456
|
+
from?: `0x${string}` | `0x${string}`[] | null;
|
|
457
|
+
to?: `0x${string}` | `0x${string}`[] | null;
|
|
458
|
+
}) => () => void;
|
|
459
|
+
/**
|
|
460
|
+
* Watch Approval events
|
|
461
|
+
* @param callback Function to call when event is emitted
|
|
462
|
+
* @param filter Optional filter for indexed parameters
|
|
463
|
+
* @returns Unwatch function to stop listening
|
|
464
|
+
*/
|
|
465
|
+
Approval: (callback: (event: {
|
|
466
|
+
tokenOwner: `0x${string}`;
|
|
467
|
+
spender: `0x${string}`;
|
|
468
|
+
tokens: bigint;
|
|
469
|
+
}) => void, filter?: {
|
|
470
|
+
tokenOwner?: `0x${string}` | `0x${string}`[] | null;
|
|
471
|
+
spender?: `0x${string}` | `0x${string}`[] | null;
|
|
472
|
+
}) => () => void;
|
|
473
|
+
};
|
|
474
|
+
}
|