@gitmyabi/sxc 1.0.0
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/SexCoin_json.d.ts +346 -0
- package/contracts/SexCoin_json.js +370 -0
- package/contracts/SexCoin_json.ts +472 -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/sxc
|
|
2
|
+
|
|
3
|
+
Auto-generated TypeScript type bindings for **SXC**
|
|
4
|
+
|
|
5
|
+
- **Build ID**: `etherscan-sxc-7eb4db01-1791278987151`
|
|
6
|
+
- **Build Number**: 1
|
|
7
|
+
- **Commit**: `78280c3`
|
|
8
|
+
- **Branch**: `etherscan`
|
|
9
|
+
- **Target**: `ethers-v6`
|
|
10
|
+
- **Contracts**: 1
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm install @gitmyabi/sxc@1.0.0
|
|
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/sxc';
|
|
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/sxc';
|
|
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/sxc';
|
|
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
|
+
MIT
|
|
@@ -0,0 +1,346 @@
|
|
|
1
|
+
import type { Address, PublicClient, WalletClient } from 'viem';
|
|
2
|
+
/**
|
|
3
|
+
* SexCoin_json ABI
|
|
4
|
+
*
|
|
5
|
+
* This ABI is typed using viem's type system for full type safety.
|
|
6
|
+
*/
|
|
7
|
+
export declare const SexCoin_jsonAbi: readonly [{
|
|
8
|
+
readonly inputs: readonly [];
|
|
9
|
+
readonly stateMutability: "nonpayable";
|
|
10
|
+
readonly type: "constructor";
|
|
11
|
+
}, {
|
|
12
|
+
readonly inputs: readonly [{
|
|
13
|
+
readonly internalType: "address";
|
|
14
|
+
readonly name: "";
|
|
15
|
+
readonly type: "address";
|
|
16
|
+
}, {
|
|
17
|
+
readonly internalType: "address";
|
|
18
|
+
readonly name: "";
|
|
19
|
+
readonly type: "address";
|
|
20
|
+
}];
|
|
21
|
+
readonly name: "allowance";
|
|
22
|
+
readonly outputs: readonly [{
|
|
23
|
+
readonly internalType: "uint256";
|
|
24
|
+
readonly name: "";
|
|
25
|
+
readonly type: "uint256";
|
|
26
|
+
}];
|
|
27
|
+
readonly stateMutability: "view";
|
|
28
|
+
readonly type: "function";
|
|
29
|
+
}, {
|
|
30
|
+
readonly inputs: readonly [{
|
|
31
|
+
readonly internalType: "address";
|
|
32
|
+
readonly name: "_spender";
|
|
33
|
+
readonly type: "address";
|
|
34
|
+
}, {
|
|
35
|
+
readonly internalType: "uint256";
|
|
36
|
+
readonly name: "_value";
|
|
37
|
+
readonly type: "uint256";
|
|
38
|
+
}];
|
|
39
|
+
readonly name: "approve";
|
|
40
|
+
readonly outputs: readonly [{
|
|
41
|
+
readonly internalType: "bool";
|
|
42
|
+
readonly name: "success";
|
|
43
|
+
readonly type: "bool";
|
|
44
|
+
}];
|
|
45
|
+
readonly stateMutability: "nonpayable";
|
|
46
|
+
readonly type: "function";
|
|
47
|
+
}, {
|
|
48
|
+
readonly inputs: readonly [{
|
|
49
|
+
readonly internalType: "address";
|
|
50
|
+
readonly name: "";
|
|
51
|
+
readonly type: "address";
|
|
52
|
+
}];
|
|
53
|
+
readonly name: "balanceOf";
|
|
54
|
+
readonly outputs: readonly [{
|
|
55
|
+
readonly internalType: "uint256";
|
|
56
|
+
readonly name: "";
|
|
57
|
+
readonly type: "uint256";
|
|
58
|
+
}];
|
|
59
|
+
readonly stateMutability: "view";
|
|
60
|
+
readonly type: "function";
|
|
61
|
+
}, {
|
|
62
|
+
readonly inputs: readonly [];
|
|
63
|
+
readonly name: "decimals";
|
|
64
|
+
readonly outputs: readonly [{
|
|
65
|
+
readonly internalType: "uint8";
|
|
66
|
+
readonly name: "";
|
|
67
|
+
readonly type: "uint8";
|
|
68
|
+
}];
|
|
69
|
+
readonly stateMutability: "view";
|
|
70
|
+
readonly type: "function";
|
|
71
|
+
}, {
|
|
72
|
+
readonly inputs: readonly [];
|
|
73
|
+
readonly name: "name";
|
|
74
|
+
readonly outputs: readonly [{
|
|
75
|
+
readonly internalType: "string";
|
|
76
|
+
readonly name: "";
|
|
77
|
+
readonly type: "string";
|
|
78
|
+
}];
|
|
79
|
+
readonly stateMutability: "view";
|
|
80
|
+
readonly type: "function";
|
|
81
|
+
}, {
|
|
82
|
+
readonly inputs: readonly [];
|
|
83
|
+
readonly name: "symbol";
|
|
84
|
+
readonly outputs: readonly [{
|
|
85
|
+
readonly internalType: "string";
|
|
86
|
+
readonly name: "";
|
|
87
|
+
readonly type: "string";
|
|
88
|
+
}];
|
|
89
|
+
readonly stateMutability: "view";
|
|
90
|
+
readonly type: "function";
|
|
91
|
+
}, {
|
|
92
|
+
readonly inputs: readonly [];
|
|
93
|
+
readonly name: "totalSupply";
|
|
94
|
+
readonly outputs: readonly [{
|
|
95
|
+
readonly internalType: "uint256";
|
|
96
|
+
readonly name: "";
|
|
97
|
+
readonly type: "uint256";
|
|
98
|
+
}];
|
|
99
|
+
readonly stateMutability: "view";
|
|
100
|
+
readonly type: "function";
|
|
101
|
+
}, {
|
|
102
|
+
readonly inputs: readonly [{
|
|
103
|
+
readonly internalType: "address";
|
|
104
|
+
readonly name: "_to";
|
|
105
|
+
readonly type: "address";
|
|
106
|
+
}, {
|
|
107
|
+
readonly internalType: "uint256";
|
|
108
|
+
readonly name: "_value";
|
|
109
|
+
readonly type: "uint256";
|
|
110
|
+
}];
|
|
111
|
+
readonly name: "transfer";
|
|
112
|
+
readonly outputs: readonly [{
|
|
113
|
+
readonly internalType: "bool";
|
|
114
|
+
readonly name: "success";
|
|
115
|
+
readonly type: "bool";
|
|
116
|
+
}];
|
|
117
|
+
readonly stateMutability: "nonpayable";
|
|
118
|
+
readonly type: "function";
|
|
119
|
+
}, {
|
|
120
|
+
readonly inputs: readonly [{
|
|
121
|
+
readonly internalType: "address";
|
|
122
|
+
readonly name: "_from";
|
|
123
|
+
readonly type: "address";
|
|
124
|
+
}, {
|
|
125
|
+
readonly internalType: "address";
|
|
126
|
+
readonly name: "_to";
|
|
127
|
+
readonly type: "address";
|
|
128
|
+
}, {
|
|
129
|
+
readonly internalType: "uint256";
|
|
130
|
+
readonly name: "_value";
|
|
131
|
+
readonly type: "uint256";
|
|
132
|
+
}];
|
|
133
|
+
readonly name: "transferFrom";
|
|
134
|
+
readonly outputs: readonly [{
|
|
135
|
+
readonly internalType: "bool";
|
|
136
|
+
readonly name: "success";
|
|
137
|
+
readonly type: "bool";
|
|
138
|
+
}];
|
|
139
|
+
readonly stateMutability: "nonpayable";
|
|
140
|
+
readonly type: "function";
|
|
141
|
+
}];
|
|
142
|
+
/**
|
|
143
|
+
* Type-safe ABI for SexCoin_json
|
|
144
|
+
*/
|
|
145
|
+
export type SexCoin_jsonAbi = typeof SexCoin_jsonAbi;
|
|
146
|
+
/**
|
|
147
|
+
* Contract instance type for SexCoin_json
|
|
148
|
+
*/
|
|
149
|
+
export type SexCoin_jsonContract = any;
|
|
150
|
+
/**
|
|
151
|
+
* SexCoin_json Contract Class
|
|
152
|
+
*
|
|
153
|
+
* Provides a class-based API similar to TypeChain for interacting with the contract.
|
|
154
|
+
*
|
|
155
|
+
* @example
|
|
156
|
+
* ```typescript
|
|
157
|
+
* import { createPublicClient, createWalletClient, http } from 'viem';
|
|
158
|
+
* import { mainnet } from 'viem/chains';
|
|
159
|
+
* import { SexCoin_json } from 'SexCoin_json';
|
|
160
|
+
*
|
|
161
|
+
* const publicClient = createPublicClient({ chain: mainnet, transport: http() });
|
|
162
|
+
* const walletClient = createWalletClient({ chain: mainnet, transport: http() });
|
|
163
|
+
*
|
|
164
|
+
* const contract = new SexCoin_json('0x...', { publicClient, walletClient });
|
|
165
|
+
*
|
|
166
|
+
* // Read functions
|
|
167
|
+
* const result = await contract.balanceOf('0x...');
|
|
168
|
+
*
|
|
169
|
+
* // Write functions
|
|
170
|
+
* const hash = await contract.transfer('0x...', 1000n);
|
|
171
|
+
*
|
|
172
|
+
* // Simulate transactions (dry-run)
|
|
173
|
+
* const simulation = await contract.simulate.transfer('0x...', 1000n);
|
|
174
|
+
* console.log('Gas estimate:', simulation.request.gas);
|
|
175
|
+
*
|
|
176
|
+
* // Watch events
|
|
177
|
+
* const unwatch = contract.watch.Transfer((event) => {
|
|
178
|
+
* console.log('Transfer event:', event);
|
|
179
|
+
* });
|
|
180
|
+
* ```
|
|
181
|
+
*/
|
|
182
|
+
export declare class SexCoin_json {
|
|
183
|
+
private contract;
|
|
184
|
+
private contractAddress;
|
|
185
|
+
private publicClient;
|
|
186
|
+
constructor(address: Address, clients: {
|
|
187
|
+
publicClient: PublicClient;
|
|
188
|
+
walletClient?: WalletClient;
|
|
189
|
+
});
|
|
190
|
+
/**
|
|
191
|
+
* Get the contract address
|
|
192
|
+
*/
|
|
193
|
+
get address(): Address;
|
|
194
|
+
/**
|
|
195
|
+
* Get the underlying viem contract instance
|
|
196
|
+
*/
|
|
197
|
+
getContract(): SexCoin_jsonContract;
|
|
198
|
+
/**
|
|
199
|
+
* allowance
|
|
200
|
+
* view
|
|
201
|
+
*/
|
|
202
|
+
allowance(arg0: `0x${string}`, arg1: `0x${string}`): Promise<bigint>;
|
|
203
|
+
/**
|
|
204
|
+
* balanceOf
|
|
205
|
+
* view
|
|
206
|
+
*/
|
|
207
|
+
balanceOf(arg0: `0x${string}`): Promise<bigint>;
|
|
208
|
+
/**
|
|
209
|
+
* decimals
|
|
210
|
+
* view
|
|
211
|
+
*/
|
|
212
|
+
decimals(): Promise<bigint>;
|
|
213
|
+
/**
|
|
214
|
+
* name
|
|
215
|
+
* view
|
|
216
|
+
*/
|
|
217
|
+
name(): Promise<string>;
|
|
218
|
+
/**
|
|
219
|
+
* symbol
|
|
220
|
+
* view
|
|
221
|
+
*/
|
|
222
|
+
symbol(): Promise<string>;
|
|
223
|
+
/**
|
|
224
|
+
* totalSupply
|
|
225
|
+
* view
|
|
226
|
+
*/
|
|
227
|
+
totalSupply(): Promise<bigint>;
|
|
228
|
+
/**
|
|
229
|
+
* approve
|
|
230
|
+
* nonpayable
|
|
231
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
232
|
+
*/
|
|
233
|
+
approve(_spender: `0x${string}`, _value: bigint, options?: {
|
|
234
|
+
accessList?: import('viem').AccessList;
|
|
235
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
236
|
+
chain?: import('viem').Chain | null;
|
|
237
|
+
dataSuffix?: `0x${string}`;
|
|
238
|
+
gas?: bigint;
|
|
239
|
+
gasPrice?: bigint;
|
|
240
|
+
maxFeePerGas?: bigint;
|
|
241
|
+
maxPriorityFeePerGas?: bigint;
|
|
242
|
+
nonce?: number;
|
|
243
|
+
value?: bigint;
|
|
244
|
+
}): Promise<`0x${string}`>;
|
|
245
|
+
/**
|
|
246
|
+
* transfer
|
|
247
|
+
* nonpayable
|
|
248
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
249
|
+
*/
|
|
250
|
+
transfer(_to: `0x${string}`, _value: bigint, options?: {
|
|
251
|
+
accessList?: import('viem').AccessList;
|
|
252
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
253
|
+
chain?: import('viem').Chain | null;
|
|
254
|
+
dataSuffix?: `0x${string}`;
|
|
255
|
+
gas?: bigint;
|
|
256
|
+
gasPrice?: bigint;
|
|
257
|
+
maxFeePerGas?: bigint;
|
|
258
|
+
maxPriorityFeePerGas?: bigint;
|
|
259
|
+
nonce?: number;
|
|
260
|
+
value?: bigint;
|
|
261
|
+
}): Promise<`0x${string}`>;
|
|
262
|
+
/**
|
|
263
|
+
* transferFrom
|
|
264
|
+
* nonpayable
|
|
265
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
266
|
+
*/
|
|
267
|
+
transferFrom(_from: `0x${string}`, _to: `0x${string}`, _value: bigint, options?: {
|
|
268
|
+
accessList?: import('viem').AccessList;
|
|
269
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
270
|
+
chain?: import('viem').Chain | null;
|
|
271
|
+
dataSuffix?: `0x${string}`;
|
|
272
|
+
gas?: bigint;
|
|
273
|
+
gasPrice?: bigint;
|
|
274
|
+
maxFeePerGas?: bigint;
|
|
275
|
+
maxPriorityFeePerGas?: bigint;
|
|
276
|
+
nonce?: number;
|
|
277
|
+
value?: bigint;
|
|
278
|
+
}): Promise<`0x${string}`>;
|
|
279
|
+
/**
|
|
280
|
+
* Simulate contract write operations (dry-run without sending transaction)
|
|
281
|
+
*
|
|
282
|
+
* @example
|
|
283
|
+
* const result = await contract.simulate.transfer('0x...', 1000n);
|
|
284
|
+
* console.log('Gas estimate:', result.request.gas);
|
|
285
|
+
* console.log('Would succeed:', result.result);
|
|
286
|
+
*/
|
|
287
|
+
get simulate(): {
|
|
288
|
+
/**
|
|
289
|
+
* Simulate approve
|
|
290
|
+
* Returns gas estimate and result without sending transaction
|
|
291
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
292
|
+
*/
|
|
293
|
+
approve(_spender: `0x${string}`, _value: bigint, options?: {
|
|
294
|
+
accessList?: import("viem").AccessList;
|
|
295
|
+
authorizationList?: import("viem").AuthorizationList;
|
|
296
|
+
chain?: import("viem").Chain | null;
|
|
297
|
+
dataSuffix?: `0x${string}`;
|
|
298
|
+
gas?: bigint;
|
|
299
|
+
gasPrice?: bigint;
|
|
300
|
+
maxFeePerGas?: bigint;
|
|
301
|
+
maxPriorityFeePerGas?: bigint;
|
|
302
|
+
nonce?: number;
|
|
303
|
+
value?: bigint;
|
|
304
|
+
}): Promise<boolean>;
|
|
305
|
+
/**
|
|
306
|
+
* Simulate transfer
|
|
307
|
+
* Returns gas estimate and result without sending transaction
|
|
308
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
309
|
+
*/
|
|
310
|
+
transfer(_to: `0x${string}`, _value: bigint, options?: {
|
|
311
|
+
accessList?: import("viem").AccessList;
|
|
312
|
+
authorizationList?: import("viem").AuthorizationList;
|
|
313
|
+
chain?: import("viem").Chain | null;
|
|
314
|
+
dataSuffix?: `0x${string}`;
|
|
315
|
+
gas?: bigint;
|
|
316
|
+
gasPrice?: bigint;
|
|
317
|
+
maxFeePerGas?: bigint;
|
|
318
|
+
maxPriorityFeePerGas?: bigint;
|
|
319
|
+
nonce?: number;
|
|
320
|
+
value?: bigint;
|
|
321
|
+
}): Promise<boolean>;
|
|
322
|
+
/**
|
|
323
|
+
* Simulate transferFrom
|
|
324
|
+
* Returns gas estimate and result without sending transaction
|
|
325
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
326
|
+
*/
|
|
327
|
+
transferFrom(_from: `0x${string}`, _to: `0x${string}`, _value: bigint, options?: {
|
|
328
|
+
accessList?: import("viem").AccessList;
|
|
329
|
+
authorizationList?: import("viem").AuthorizationList;
|
|
330
|
+
chain?: import("viem").Chain | null;
|
|
331
|
+
dataSuffix?: `0x${string}`;
|
|
332
|
+
gas?: bigint;
|
|
333
|
+
gasPrice?: bigint;
|
|
334
|
+
maxFeePerGas?: bigint;
|
|
335
|
+
maxPriorityFeePerGas?: bigint;
|
|
336
|
+
nonce?: number;
|
|
337
|
+
value?: bigint;
|
|
338
|
+
}): Promise<boolean>;
|
|
339
|
+
};
|
|
340
|
+
/**
|
|
341
|
+
* Watch contract events
|
|
342
|
+
*
|
|
343
|
+
* Note: This contract has no events, so watch returns an empty object.
|
|
344
|
+
*/
|
|
345
|
+
get watch(): {};
|
|
346
|
+
}
|
|
@@ -0,0 +1,370 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SexCoin_json = exports.SexCoin_jsonAbi = void 0;
|
|
4
|
+
const viem_1 = require("viem");
|
|
5
|
+
/**
|
|
6
|
+
* SexCoin_json ABI
|
|
7
|
+
*
|
|
8
|
+
* This ABI is typed using viem's type system for full type safety.
|
|
9
|
+
*/
|
|
10
|
+
exports.SexCoin_jsonAbi = [
|
|
11
|
+
{
|
|
12
|
+
"inputs": [],
|
|
13
|
+
"stateMutability": "nonpayable",
|
|
14
|
+
"type": "constructor"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"inputs": [
|
|
18
|
+
{
|
|
19
|
+
"internalType": "address",
|
|
20
|
+
"name": "",
|
|
21
|
+
"type": "address"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"internalType": "address",
|
|
25
|
+
"name": "",
|
|
26
|
+
"type": "address"
|
|
27
|
+
}
|
|
28
|
+
],
|
|
29
|
+
"name": "allowance",
|
|
30
|
+
"outputs": [
|
|
31
|
+
{
|
|
32
|
+
"internalType": "uint256",
|
|
33
|
+
"name": "",
|
|
34
|
+
"type": "uint256"
|
|
35
|
+
}
|
|
36
|
+
],
|
|
37
|
+
"stateMutability": "view",
|
|
38
|
+
"type": "function"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"inputs": [
|
|
42
|
+
{
|
|
43
|
+
"internalType": "address",
|
|
44
|
+
"name": "_spender",
|
|
45
|
+
"type": "address"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"internalType": "uint256",
|
|
49
|
+
"name": "_value",
|
|
50
|
+
"type": "uint256"
|
|
51
|
+
}
|
|
52
|
+
],
|
|
53
|
+
"name": "approve",
|
|
54
|
+
"outputs": [
|
|
55
|
+
{
|
|
56
|
+
"internalType": "bool",
|
|
57
|
+
"name": "success",
|
|
58
|
+
"type": "bool"
|
|
59
|
+
}
|
|
60
|
+
],
|
|
61
|
+
"stateMutability": "nonpayable",
|
|
62
|
+
"type": "function"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"inputs": [
|
|
66
|
+
{
|
|
67
|
+
"internalType": "address",
|
|
68
|
+
"name": "",
|
|
69
|
+
"type": "address"
|
|
70
|
+
}
|
|
71
|
+
],
|
|
72
|
+
"name": "balanceOf",
|
|
73
|
+
"outputs": [
|
|
74
|
+
{
|
|
75
|
+
"internalType": "uint256",
|
|
76
|
+
"name": "",
|
|
77
|
+
"type": "uint256"
|
|
78
|
+
}
|
|
79
|
+
],
|
|
80
|
+
"stateMutability": "view",
|
|
81
|
+
"type": "function"
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"inputs": [],
|
|
85
|
+
"name": "decimals",
|
|
86
|
+
"outputs": [
|
|
87
|
+
{
|
|
88
|
+
"internalType": "uint8",
|
|
89
|
+
"name": "",
|
|
90
|
+
"type": "uint8"
|
|
91
|
+
}
|
|
92
|
+
],
|
|
93
|
+
"stateMutability": "view",
|
|
94
|
+
"type": "function"
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
"inputs": [],
|
|
98
|
+
"name": "name",
|
|
99
|
+
"outputs": [
|
|
100
|
+
{
|
|
101
|
+
"internalType": "string",
|
|
102
|
+
"name": "",
|
|
103
|
+
"type": "string"
|
|
104
|
+
}
|
|
105
|
+
],
|
|
106
|
+
"stateMutability": "view",
|
|
107
|
+
"type": "function"
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
"inputs": [],
|
|
111
|
+
"name": "symbol",
|
|
112
|
+
"outputs": [
|
|
113
|
+
{
|
|
114
|
+
"internalType": "string",
|
|
115
|
+
"name": "",
|
|
116
|
+
"type": "string"
|
|
117
|
+
}
|
|
118
|
+
],
|
|
119
|
+
"stateMutability": "view",
|
|
120
|
+
"type": "function"
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
"inputs": [],
|
|
124
|
+
"name": "totalSupply",
|
|
125
|
+
"outputs": [
|
|
126
|
+
{
|
|
127
|
+
"internalType": "uint256",
|
|
128
|
+
"name": "",
|
|
129
|
+
"type": "uint256"
|
|
130
|
+
}
|
|
131
|
+
],
|
|
132
|
+
"stateMutability": "view",
|
|
133
|
+
"type": "function"
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
"inputs": [
|
|
137
|
+
{
|
|
138
|
+
"internalType": "address",
|
|
139
|
+
"name": "_to",
|
|
140
|
+
"type": "address"
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
"internalType": "uint256",
|
|
144
|
+
"name": "_value",
|
|
145
|
+
"type": "uint256"
|
|
146
|
+
}
|
|
147
|
+
],
|
|
148
|
+
"name": "transfer",
|
|
149
|
+
"outputs": [
|
|
150
|
+
{
|
|
151
|
+
"internalType": "bool",
|
|
152
|
+
"name": "success",
|
|
153
|
+
"type": "bool"
|
|
154
|
+
}
|
|
155
|
+
],
|
|
156
|
+
"stateMutability": "nonpayable",
|
|
157
|
+
"type": "function"
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
"inputs": [
|
|
161
|
+
{
|
|
162
|
+
"internalType": "address",
|
|
163
|
+
"name": "_from",
|
|
164
|
+
"type": "address"
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
"internalType": "address",
|
|
168
|
+
"name": "_to",
|
|
169
|
+
"type": "address"
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
"internalType": "uint256",
|
|
173
|
+
"name": "_value",
|
|
174
|
+
"type": "uint256"
|
|
175
|
+
}
|
|
176
|
+
],
|
|
177
|
+
"name": "transferFrom",
|
|
178
|
+
"outputs": [
|
|
179
|
+
{
|
|
180
|
+
"internalType": "bool",
|
|
181
|
+
"name": "success",
|
|
182
|
+
"type": "bool"
|
|
183
|
+
}
|
|
184
|
+
],
|
|
185
|
+
"stateMutability": "nonpayable",
|
|
186
|
+
"type": "function"
|
|
187
|
+
}
|
|
188
|
+
];
|
|
189
|
+
/**
|
|
190
|
+
* SexCoin_json Contract Class
|
|
191
|
+
*
|
|
192
|
+
* Provides a class-based API similar to TypeChain for interacting with the contract.
|
|
193
|
+
*
|
|
194
|
+
* @example
|
|
195
|
+
* ```typescript
|
|
196
|
+
* import { createPublicClient, createWalletClient, http } from 'viem';
|
|
197
|
+
* import { mainnet } from 'viem/chains';
|
|
198
|
+
* import { SexCoin_json } from 'SexCoin_json';
|
|
199
|
+
*
|
|
200
|
+
* const publicClient = createPublicClient({ chain: mainnet, transport: http() });
|
|
201
|
+
* const walletClient = createWalletClient({ chain: mainnet, transport: http() });
|
|
202
|
+
*
|
|
203
|
+
* const contract = new SexCoin_json('0x...', { publicClient, walletClient });
|
|
204
|
+
*
|
|
205
|
+
* // Read functions
|
|
206
|
+
* const result = await contract.balanceOf('0x...');
|
|
207
|
+
*
|
|
208
|
+
* // Write functions
|
|
209
|
+
* const hash = await contract.transfer('0x...', 1000n);
|
|
210
|
+
*
|
|
211
|
+
* // Simulate transactions (dry-run)
|
|
212
|
+
* const simulation = await contract.simulate.transfer('0x...', 1000n);
|
|
213
|
+
* console.log('Gas estimate:', simulation.request.gas);
|
|
214
|
+
*
|
|
215
|
+
* // Watch events
|
|
216
|
+
* const unwatch = contract.watch.Transfer((event) => {
|
|
217
|
+
* console.log('Transfer event:', event);
|
|
218
|
+
* });
|
|
219
|
+
* ```
|
|
220
|
+
*/
|
|
221
|
+
class SexCoin_json {
|
|
222
|
+
constructor(address, clients) {
|
|
223
|
+
this.contractAddress = address;
|
|
224
|
+
this.publicClient = clients.publicClient;
|
|
225
|
+
this.contract = (0, viem_1.getContract)({
|
|
226
|
+
address,
|
|
227
|
+
abi: exports.SexCoin_jsonAbi,
|
|
228
|
+
client: {
|
|
229
|
+
public: clients.publicClient,
|
|
230
|
+
wallet: clients.walletClient,
|
|
231
|
+
},
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Get the contract address
|
|
236
|
+
*/
|
|
237
|
+
get address() {
|
|
238
|
+
return this.contractAddress;
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Get the underlying viem contract instance
|
|
242
|
+
*/
|
|
243
|
+
getContract() {
|
|
244
|
+
return this.contract;
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* allowance
|
|
248
|
+
* view
|
|
249
|
+
*/
|
|
250
|
+
async allowance(arg0, arg1) {
|
|
251
|
+
return this.contract.read.allowance([arg0, arg1]);
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* balanceOf
|
|
255
|
+
* view
|
|
256
|
+
*/
|
|
257
|
+
async balanceOf(arg0) {
|
|
258
|
+
return this.contract.read.balanceOf([arg0]);
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* decimals
|
|
262
|
+
* view
|
|
263
|
+
*/
|
|
264
|
+
async decimals() {
|
|
265
|
+
return this.contract.read.decimals();
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* name
|
|
269
|
+
* view
|
|
270
|
+
*/
|
|
271
|
+
async name() {
|
|
272
|
+
return this.contract.read.name();
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* symbol
|
|
276
|
+
* view
|
|
277
|
+
*/
|
|
278
|
+
async symbol() {
|
|
279
|
+
return this.contract.read.symbol();
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* totalSupply
|
|
283
|
+
* view
|
|
284
|
+
*/
|
|
285
|
+
async totalSupply() {
|
|
286
|
+
return this.contract.read.totalSupply();
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* approve
|
|
290
|
+
* nonpayable
|
|
291
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
292
|
+
*/
|
|
293
|
+
async approve(_spender, _value, options) {
|
|
294
|
+
if (!this.contract.write) {
|
|
295
|
+
throw new Error('Wallet client is required for write operations');
|
|
296
|
+
}
|
|
297
|
+
return this.contract.write.approve([_spender, _value], options);
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* transfer
|
|
301
|
+
* nonpayable
|
|
302
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
303
|
+
*/
|
|
304
|
+
async transfer(_to, _value, options) {
|
|
305
|
+
if (!this.contract.write) {
|
|
306
|
+
throw new Error('Wallet client is required for write operations');
|
|
307
|
+
}
|
|
308
|
+
return this.contract.write.transfer([_to, _value], options);
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* transferFrom
|
|
312
|
+
* nonpayable
|
|
313
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
314
|
+
*/
|
|
315
|
+
async transferFrom(_from, _to, _value, options) {
|
|
316
|
+
if (!this.contract.write) {
|
|
317
|
+
throw new Error('Wallet client is required for write operations');
|
|
318
|
+
}
|
|
319
|
+
return this.contract.write.transferFrom([_from, _to, _value], options);
|
|
320
|
+
}
|
|
321
|
+
/**
|
|
322
|
+
* Simulate contract write operations (dry-run without sending transaction)
|
|
323
|
+
*
|
|
324
|
+
* @example
|
|
325
|
+
* const result = await contract.simulate.transfer('0x...', 1000n);
|
|
326
|
+
* console.log('Gas estimate:', result.request.gas);
|
|
327
|
+
* console.log('Would succeed:', result.result);
|
|
328
|
+
*/
|
|
329
|
+
get simulate() {
|
|
330
|
+
const contract = this.contract;
|
|
331
|
+
if (!contract.simulate) {
|
|
332
|
+
throw new Error('Public client is required for simulation');
|
|
333
|
+
}
|
|
334
|
+
return {
|
|
335
|
+
/**
|
|
336
|
+
* Simulate approve
|
|
337
|
+
* Returns gas estimate and result without sending transaction
|
|
338
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
339
|
+
*/
|
|
340
|
+
async approve(_spender, _value, options) {
|
|
341
|
+
return contract.simulate.approve([_spender, _value], options);
|
|
342
|
+
},
|
|
343
|
+
/**
|
|
344
|
+
* Simulate transfer
|
|
345
|
+
* Returns gas estimate and result without sending transaction
|
|
346
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
347
|
+
*/
|
|
348
|
+
async transfer(_to, _value, options) {
|
|
349
|
+
return contract.simulate.transfer([_to, _value], options);
|
|
350
|
+
},
|
|
351
|
+
/**
|
|
352
|
+
* Simulate transferFrom
|
|
353
|
+
* Returns gas estimate and result without sending transaction
|
|
354
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
355
|
+
*/
|
|
356
|
+
async transferFrom(_from, _to, _value, options) {
|
|
357
|
+
return contract.simulate.transferFrom([_from, _to, _value], options);
|
|
358
|
+
}
|
|
359
|
+
};
|
|
360
|
+
}
|
|
361
|
+
/**
|
|
362
|
+
* Watch contract events
|
|
363
|
+
*
|
|
364
|
+
* Note: This contract has no events, so watch returns an empty object.
|
|
365
|
+
*/
|
|
366
|
+
get watch() {
|
|
367
|
+
return {};
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
exports.SexCoin_json = SexCoin_json;
|
|
@@ -0,0 +1,472 @@
|
|
|
1
|
+
import type { Abi, Address, PublicClient, WalletClient, GetContractReturnType } from 'viem';
|
|
2
|
+
import { getContract } from 'viem';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* SexCoin_json ABI
|
|
6
|
+
*
|
|
7
|
+
* This ABI is typed using viem's type system for full type safety.
|
|
8
|
+
*/
|
|
9
|
+
export const SexCoin_jsonAbi = [
|
|
10
|
+
{
|
|
11
|
+
"inputs": [],
|
|
12
|
+
"stateMutability": "nonpayable",
|
|
13
|
+
"type": "constructor"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"inputs": [
|
|
17
|
+
{
|
|
18
|
+
"internalType": "address",
|
|
19
|
+
"name": "",
|
|
20
|
+
"type": "address"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"internalType": "address",
|
|
24
|
+
"name": "",
|
|
25
|
+
"type": "address"
|
|
26
|
+
}
|
|
27
|
+
],
|
|
28
|
+
"name": "allowance",
|
|
29
|
+
"outputs": [
|
|
30
|
+
{
|
|
31
|
+
"internalType": "uint256",
|
|
32
|
+
"name": "",
|
|
33
|
+
"type": "uint256"
|
|
34
|
+
}
|
|
35
|
+
],
|
|
36
|
+
"stateMutability": "view",
|
|
37
|
+
"type": "function"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"inputs": [
|
|
41
|
+
{
|
|
42
|
+
"internalType": "address",
|
|
43
|
+
"name": "_spender",
|
|
44
|
+
"type": "address"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"internalType": "uint256",
|
|
48
|
+
"name": "_value",
|
|
49
|
+
"type": "uint256"
|
|
50
|
+
}
|
|
51
|
+
],
|
|
52
|
+
"name": "approve",
|
|
53
|
+
"outputs": [
|
|
54
|
+
{
|
|
55
|
+
"internalType": "bool",
|
|
56
|
+
"name": "success",
|
|
57
|
+
"type": "bool"
|
|
58
|
+
}
|
|
59
|
+
],
|
|
60
|
+
"stateMutability": "nonpayable",
|
|
61
|
+
"type": "function"
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"inputs": [
|
|
65
|
+
{
|
|
66
|
+
"internalType": "address",
|
|
67
|
+
"name": "",
|
|
68
|
+
"type": "address"
|
|
69
|
+
}
|
|
70
|
+
],
|
|
71
|
+
"name": "balanceOf",
|
|
72
|
+
"outputs": [
|
|
73
|
+
{
|
|
74
|
+
"internalType": "uint256",
|
|
75
|
+
"name": "",
|
|
76
|
+
"type": "uint256"
|
|
77
|
+
}
|
|
78
|
+
],
|
|
79
|
+
"stateMutability": "view",
|
|
80
|
+
"type": "function"
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"inputs": [],
|
|
84
|
+
"name": "decimals",
|
|
85
|
+
"outputs": [
|
|
86
|
+
{
|
|
87
|
+
"internalType": "uint8",
|
|
88
|
+
"name": "",
|
|
89
|
+
"type": "uint8"
|
|
90
|
+
}
|
|
91
|
+
],
|
|
92
|
+
"stateMutability": "view",
|
|
93
|
+
"type": "function"
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"inputs": [],
|
|
97
|
+
"name": "name",
|
|
98
|
+
"outputs": [
|
|
99
|
+
{
|
|
100
|
+
"internalType": "string",
|
|
101
|
+
"name": "",
|
|
102
|
+
"type": "string"
|
|
103
|
+
}
|
|
104
|
+
],
|
|
105
|
+
"stateMutability": "view",
|
|
106
|
+
"type": "function"
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
"inputs": [],
|
|
110
|
+
"name": "symbol",
|
|
111
|
+
"outputs": [
|
|
112
|
+
{
|
|
113
|
+
"internalType": "string",
|
|
114
|
+
"name": "",
|
|
115
|
+
"type": "string"
|
|
116
|
+
}
|
|
117
|
+
],
|
|
118
|
+
"stateMutability": "view",
|
|
119
|
+
"type": "function"
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
"inputs": [],
|
|
123
|
+
"name": "totalSupply",
|
|
124
|
+
"outputs": [
|
|
125
|
+
{
|
|
126
|
+
"internalType": "uint256",
|
|
127
|
+
"name": "",
|
|
128
|
+
"type": "uint256"
|
|
129
|
+
}
|
|
130
|
+
],
|
|
131
|
+
"stateMutability": "view",
|
|
132
|
+
"type": "function"
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
"inputs": [
|
|
136
|
+
{
|
|
137
|
+
"internalType": "address",
|
|
138
|
+
"name": "_to",
|
|
139
|
+
"type": "address"
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
"internalType": "uint256",
|
|
143
|
+
"name": "_value",
|
|
144
|
+
"type": "uint256"
|
|
145
|
+
}
|
|
146
|
+
],
|
|
147
|
+
"name": "transfer",
|
|
148
|
+
"outputs": [
|
|
149
|
+
{
|
|
150
|
+
"internalType": "bool",
|
|
151
|
+
"name": "success",
|
|
152
|
+
"type": "bool"
|
|
153
|
+
}
|
|
154
|
+
],
|
|
155
|
+
"stateMutability": "nonpayable",
|
|
156
|
+
"type": "function"
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
"inputs": [
|
|
160
|
+
{
|
|
161
|
+
"internalType": "address",
|
|
162
|
+
"name": "_from",
|
|
163
|
+
"type": "address"
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
"internalType": "address",
|
|
167
|
+
"name": "_to",
|
|
168
|
+
"type": "address"
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
"internalType": "uint256",
|
|
172
|
+
"name": "_value",
|
|
173
|
+
"type": "uint256"
|
|
174
|
+
}
|
|
175
|
+
],
|
|
176
|
+
"name": "transferFrom",
|
|
177
|
+
"outputs": [
|
|
178
|
+
{
|
|
179
|
+
"internalType": "bool",
|
|
180
|
+
"name": "success",
|
|
181
|
+
"type": "bool"
|
|
182
|
+
}
|
|
183
|
+
],
|
|
184
|
+
"stateMutability": "nonpayable",
|
|
185
|
+
"type": "function"
|
|
186
|
+
}
|
|
187
|
+
] as const satisfies Abi;
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Type-safe ABI for SexCoin_json
|
|
191
|
+
*/
|
|
192
|
+
export type SexCoin_jsonAbi = typeof SexCoin_jsonAbi;
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Contract instance type for SexCoin_json
|
|
196
|
+
*/
|
|
197
|
+
// Use any for contract type to avoid complex viem type issues
|
|
198
|
+
// The runtime behavior is type-safe through viem's ABI typing
|
|
199
|
+
export type SexCoin_jsonContract = any;
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* SexCoin_json Contract Class
|
|
203
|
+
*
|
|
204
|
+
* Provides a class-based API similar to TypeChain for interacting with the contract.
|
|
205
|
+
*
|
|
206
|
+
* @example
|
|
207
|
+
* ```typescript
|
|
208
|
+
* import { createPublicClient, createWalletClient, http } from 'viem';
|
|
209
|
+
* import { mainnet } from 'viem/chains';
|
|
210
|
+
* import { SexCoin_json } from 'SexCoin_json';
|
|
211
|
+
*
|
|
212
|
+
* const publicClient = createPublicClient({ chain: mainnet, transport: http() });
|
|
213
|
+
* const walletClient = createWalletClient({ chain: mainnet, transport: http() });
|
|
214
|
+
*
|
|
215
|
+
* const contract = new SexCoin_json('0x...', { publicClient, walletClient });
|
|
216
|
+
*
|
|
217
|
+
* // Read functions
|
|
218
|
+
* const result = await contract.balanceOf('0x...');
|
|
219
|
+
*
|
|
220
|
+
* // Write functions
|
|
221
|
+
* const hash = await contract.transfer('0x...', 1000n);
|
|
222
|
+
*
|
|
223
|
+
* // Simulate transactions (dry-run)
|
|
224
|
+
* const simulation = await contract.simulate.transfer('0x...', 1000n);
|
|
225
|
+
* console.log('Gas estimate:', simulation.request.gas);
|
|
226
|
+
*
|
|
227
|
+
* // Watch events
|
|
228
|
+
* const unwatch = contract.watch.Transfer((event) => {
|
|
229
|
+
* console.log('Transfer event:', event);
|
|
230
|
+
* });
|
|
231
|
+
* ```
|
|
232
|
+
*/
|
|
233
|
+
export class SexCoin_json {
|
|
234
|
+
private contract: SexCoin_jsonContract;
|
|
235
|
+
private contractAddress: Address;
|
|
236
|
+
private publicClient: PublicClient;
|
|
237
|
+
|
|
238
|
+
constructor(
|
|
239
|
+
address: Address,
|
|
240
|
+
clients: {
|
|
241
|
+
publicClient: PublicClient;
|
|
242
|
+
walletClient?: WalletClient;
|
|
243
|
+
}
|
|
244
|
+
) {
|
|
245
|
+
this.contractAddress = address;
|
|
246
|
+
this.publicClient = clients.publicClient;
|
|
247
|
+
this.contract = getContract({
|
|
248
|
+
address,
|
|
249
|
+
abi: SexCoin_jsonAbi,
|
|
250
|
+
client: {
|
|
251
|
+
public: clients.publicClient,
|
|
252
|
+
wallet: clients.walletClient,
|
|
253
|
+
},
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* Get the contract address
|
|
259
|
+
*/
|
|
260
|
+
get address(): Address {
|
|
261
|
+
return this.contractAddress;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
/**
|
|
265
|
+
* Get the underlying viem contract instance
|
|
266
|
+
*/
|
|
267
|
+
getContract(): SexCoin_jsonContract {
|
|
268
|
+
return this.contract;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* allowance
|
|
273
|
+
* view
|
|
274
|
+
*/
|
|
275
|
+
async allowance(arg0: `0x${string}`, arg1: `0x${string}`): Promise<bigint> {
|
|
276
|
+
return this.contract.read.allowance([arg0, arg1] as const) as Promise<bigint>;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* balanceOf
|
|
281
|
+
* view
|
|
282
|
+
*/
|
|
283
|
+
async balanceOf(arg0: `0x${string}`): Promise<bigint> {
|
|
284
|
+
return this.contract.read.balanceOf([arg0] as const) as Promise<bigint>;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* decimals
|
|
289
|
+
* view
|
|
290
|
+
*/
|
|
291
|
+
async decimals(): Promise<bigint> {
|
|
292
|
+
return this.contract.read.decimals() as Promise<bigint>;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
/**
|
|
296
|
+
* name
|
|
297
|
+
* view
|
|
298
|
+
*/
|
|
299
|
+
async name(): Promise<string> {
|
|
300
|
+
return this.contract.read.name() as Promise<string>;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
/**
|
|
304
|
+
* symbol
|
|
305
|
+
* view
|
|
306
|
+
*/
|
|
307
|
+
async symbol(): Promise<string> {
|
|
308
|
+
return this.contract.read.symbol() as Promise<string>;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* totalSupply
|
|
313
|
+
* view
|
|
314
|
+
*/
|
|
315
|
+
async totalSupply(): Promise<bigint> {
|
|
316
|
+
return this.contract.read.totalSupply() as Promise<bigint>;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
/**
|
|
320
|
+
* approve
|
|
321
|
+
* nonpayable
|
|
322
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
323
|
+
*/
|
|
324
|
+
async approve(_spender: `0x${string}`, _value: bigint, options?: {
|
|
325
|
+
accessList?: import('viem').AccessList;
|
|
326
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
327
|
+
chain?: import('viem').Chain | null;
|
|
328
|
+
dataSuffix?: `0x${string}`;
|
|
329
|
+
gas?: bigint;
|
|
330
|
+
gasPrice?: bigint;
|
|
331
|
+
maxFeePerGas?: bigint;
|
|
332
|
+
maxPriorityFeePerGas?: bigint;
|
|
333
|
+
nonce?: number;
|
|
334
|
+
value?: bigint;
|
|
335
|
+
}): Promise<`0x${string}`> {
|
|
336
|
+
if (!this.contract.write) {
|
|
337
|
+
throw new Error('Wallet client is required for write operations');
|
|
338
|
+
}
|
|
339
|
+
return this.contract.write.approve([_spender, _value] as const, options) as Promise<`0x${string}`>;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
/**
|
|
343
|
+
* transfer
|
|
344
|
+
* nonpayable
|
|
345
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
346
|
+
*/
|
|
347
|
+
async transfer(_to: `0x${string}`, _value: bigint, options?: {
|
|
348
|
+
accessList?: import('viem').AccessList;
|
|
349
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
350
|
+
chain?: import('viem').Chain | null;
|
|
351
|
+
dataSuffix?: `0x${string}`;
|
|
352
|
+
gas?: bigint;
|
|
353
|
+
gasPrice?: bigint;
|
|
354
|
+
maxFeePerGas?: bigint;
|
|
355
|
+
maxPriorityFeePerGas?: bigint;
|
|
356
|
+
nonce?: number;
|
|
357
|
+
value?: bigint;
|
|
358
|
+
}): Promise<`0x${string}`> {
|
|
359
|
+
if (!this.contract.write) {
|
|
360
|
+
throw new Error('Wallet client is required for write operations');
|
|
361
|
+
}
|
|
362
|
+
return this.contract.write.transfer([_to, _value] as const, options) as Promise<`0x${string}`>;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
/**
|
|
366
|
+
* transferFrom
|
|
367
|
+
* nonpayable
|
|
368
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
369
|
+
*/
|
|
370
|
+
async transferFrom(_from: `0x${string}`, _to: `0x${string}`, _value: bigint, options?: {
|
|
371
|
+
accessList?: import('viem').AccessList;
|
|
372
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
373
|
+
chain?: import('viem').Chain | null;
|
|
374
|
+
dataSuffix?: `0x${string}`;
|
|
375
|
+
gas?: bigint;
|
|
376
|
+
gasPrice?: bigint;
|
|
377
|
+
maxFeePerGas?: bigint;
|
|
378
|
+
maxPriorityFeePerGas?: bigint;
|
|
379
|
+
nonce?: number;
|
|
380
|
+
value?: bigint;
|
|
381
|
+
}): Promise<`0x${string}`> {
|
|
382
|
+
if (!this.contract.write) {
|
|
383
|
+
throw new Error('Wallet client is required for write operations');
|
|
384
|
+
}
|
|
385
|
+
return this.contract.write.transferFrom([_from, _to, _value] as const, options) as Promise<`0x${string}`>;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
|
|
389
|
+
|
|
390
|
+
/**
|
|
391
|
+
* Simulate contract write operations (dry-run without sending transaction)
|
|
392
|
+
*
|
|
393
|
+
* @example
|
|
394
|
+
* const result = await contract.simulate.transfer('0x...', 1000n);
|
|
395
|
+
* console.log('Gas estimate:', result.request.gas);
|
|
396
|
+
* console.log('Would succeed:', result.result);
|
|
397
|
+
*/
|
|
398
|
+
get simulate() {
|
|
399
|
+
const contract = this.contract;
|
|
400
|
+
if (!contract.simulate) {
|
|
401
|
+
throw new Error('Public client is required for simulation');
|
|
402
|
+
}
|
|
403
|
+
return {
|
|
404
|
+
/**
|
|
405
|
+
* Simulate approve
|
|
406
|
+
* Returns gas estimate and result without sending transaction
|
|
407
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
408
|
+
*/
|
|
409
|
+
async approve(_spender: `0x${string}`, _value: bigint, options?: {
|
|
410
|
+
accessList?: import('viem').AccessList;
|
|
411
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
412
|
+
chain?: import('viem').Chain | null;
|
|
413
|
+
dataSuffix?: `0x${string}`;
|
|
414
|
+
gas?: bigint;
|
|
415
|
+
gasPrice?: bigint;
|
|
416
|
+
maxFeePerGas?: bigint;
|
|
417
|
+
maxPriorityFeePerGas?: bigint;
|
|
418
|
+
nonce?: number;
|
|
419
|
+
value?: bigint;
|
|
420
|
+
}): Promise<boolean> {
|
|
421
|
+
return contract.simulate.approve([_spender, _value] as const, options) as Promise<boolean>;
|
|
422
|
+
},
|
|
423
|
+
/**
|
|
424
|
+
* Simulate transfer
|
|
425
|
+
* Returns gas estimate and result without sending transaction
|
|
426
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
427
|
+
*/
|
|
428
|
+
async transfer(_to: `0x${string}`, _value: bigint, options?: {
|
|
429
|
+
accessList?: import('viem').AccessList;
|
|
430
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
431
|
+
chain?: import('viem').Chain | null;
|
|
432
|
+
dataSuffix?: `0x${string}`;
|
|
433
|
+
gas?: bigint;
|
|
434
|
+
gasPrice?: bigint;
|
|
435
|
+
maxFeePerGas?: bigint;
|
|
436
|
+
maxPriorityFeePerGas?: bigint;
|
|
437
|
+
nonce?: number;
|
|
438
|
+
value?: bigint;
|
|
439
|
+
}): Promise<boolean> {
|
|
440
|
+
return contract.simulate.transfer([_to, _value] as const, options) as Promise<boolean>;
|
|
441
|
+
},
|
|
442
|
+
/**
|
|
443
|
+
* Simulate transferFrom
|
|
444
|
+
* Returns gas estimate and result without sending transaction
|
|
445
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
446
|
+
*/
|
|
447
|
+
async transferFrom(_from: `0x${string}`, _to: `0x${string}`, _value: bigint, options?: {
|
|
448
|
+
accessList?: import('viem').AccessList;
|
|
449
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
450
|
+
chain?: import('viem').Chain | null;
|
|
451
|
+
dataSuffix?: `0x${string}`;
|
|
452
|
+
gas?: bigint;
|
|
453
|
+
gasPrice?: bigint;
|
|
454
|
+
maxFeePerGas?: bigint;
|
|
455
|
+
maxPriorityFeePerGas?: bigint;
|
|
456
|
+
nonce?: number;
|
|
457
|
+
value?: bigint;
|
|
458
|
+
}): Promise<boolean> {
|
|
459
|
+
return contract.simulate.transferFrom([_from, _to, _value] as const, options) as Promise<boolean>;
|
|
460
|
+
}
|
|
461
|
+
};
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
/**
|
|
465
|
+
* Watch contract events
|
|
466
|
+
*
|
|
467
|
+
* Note: This contract has no events, so watch returns an empty object.
|
|
468
|
+
*/
|
|
469
|
+
get watch() {
|
|
470
|
+
return {};
|
|
471
|
+
}
|
|
472
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SexCoin_json = exports.SexCoin_jsonAbi = void 0;
|
|
4
|
+
// Auto-generated exports for all contracts
|
|
5
|
+
var SexCoin_json_1 = require("./SexCoin_json");
|
|
6
|
+
Object.defineProperty(exports, "SexCoin_jsonAbi", { enumerable: true, get: function () { return SexCoin_json_1.SexCoin_jsonAbi; } });
|
|
7
|
+
Object.defineProperty(exports, "SexCoin_json", { enumerable: true, get: function () { return SexCoin_json_1.SexCoin_json; } });
|
package/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './contracts';
|
package/index.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Auto-generated TypeScript type bindings
|
|
3
|
+
// This file exports all generated contract types
|
|
4
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
5
|
+
if (k2 === undefined) k2 = k;
|
|
6
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
7
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
8
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
9
|
+
}
|
|
10
|
+
Object.defineProperty(o, k2, desc);
|
|
11
|
+
}) : (function(o, m, k, k2) {
|
|
12
|
+
if (k2 === undefined) k2 = k;
|
|
13
|
+
o[k2] = m[k];
|
|
14
|
+
}));
|
|
15
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
16
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
17
|
+
};
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
__exportStar(require("./contracts"), exports);
|
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@gitmyabi/sxc",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Auto-generated TypeScript type bindings for SXC (build etherscan-sxc-7eb4db01-1791278987151, commit 78280c3, branch etherscan)",
|
|
5
|
+
"main": "./index.js",
|
|
6
|
+
"types": "./index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"import": "./index.js",
|
|
10
|
+
"require": "./index.js",
|
|
11
|
+
"types": "./index.d.ts"
|
|
12
|
+
},
|
|
13
|
+
"./contracts": {
|
|
14
|
+
"import": "./contracts/index.js",
|
|
15
|
+
"require": "./contracts/index.js",
|
|
16
|
+
"types": "./contracts/index.d.ts"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"index.js",
|
|
21
|
+
"index.d.ts",
|
|
22
|
+
"contracts"
|
|
23
|
+
],
|
|
24
|
+
"keywords": [
|
|
25
|
+
"ethereum",
|
|
26
|
+
"smart-contracts",
|
|
27
|
+
"viem",
|
|
28
|
+
"wagmi",
|
|
29
|
+
"typescript",
|
|
30
|
+
"abi",
|
|
31
|
+
"ethers-v6"
|
|
32
|
+
],
|
|
33
|
+
"license": "MIT",
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"viem": "^2.0.0"
|
|
36
|
+
},
|
|
37
|
+
"repository": {
|
|
38
|
+
"type": "git",
|
|
39
|
+
"url": "https://github.com/etherscan/sxc"
|
|
40
|
+
},
|
|
41
|
+
"branch": "etherscan",
|
|
42
|
+
"shortHash": "78280c3"
|
|
43
|
+
}
|