@gitmyabi-stg/iost 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 ADDED
@@ -0,0 +1,108 @@
1
+ # @gitmyabi-stg/iost
2
+
3
+ Auto-generated TypeScript type bindings for **IOST**
4
+
5
+ - **Build ID**: `etherscan-iost-fa1a856c-1780492299192`
6
+ - **Build Number**: 1
7
+ - **Commit**: `33239e3`
8
+ - **Branch**: `etherscan`
9
+ - **Target**: `ethers-v6`
10
+ - **Contracts**: 1
11
+
12
+ ## Installation
13
+
14
+ ```bash
15
+ npm install @gitmyabi-stg/iost@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-stg/iost';
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/iost';
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/iost';
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,416 @@
1
+ import type { Address, PublicClient, WalletClient } from 'viem';
2
+ /**
3
+ * IOSToken ABI
4
+ *
5
+ * This ABI is typed using viem's type system for full type safety.
6
+ */
7
+ export declare const IOSTokenAbi: 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: "_value";
25
+ readonly type: "uint256";
26
+ }];
27
+ readonly name: "approve";
28
+ readonly outputs: readonly [{
29
+ readonly name: "";
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: "_value";
56
+ readonly type: "uint256";
57
+ }];
58
+ readonly name: "transferFrom";
59
+ readonly outputs: readonly [{
60
+ readonly name: "";
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: "_owner";
81
+ readonly type: "address";
82
+ }];
83
+ readonly name: "balanceOf";
84
+ readonly outputs: readonly [{
85
+ readonly name: "";
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: "_value";
109
+ readonly type: "uint256";
110
+ }];
111
+ readonly name: "transfer";
112
+ readonly outputs: readonly [{
113
+ readonly name: "";
114
+ readonly type: "bool";
115
+ }];
116
+ readonly payable: false;
117
+ readonly stateMutability: "nonpayable";
118
+ readonly type: "function";
119
+ }, {
120
+ readonly constant: true;
121
+ readonly inputs: readonly [{
122
+ readonly name: "_owner";
123
+ readonly type: "address";
124
+ }, {
125
+ readonly name: "_spender";
126
+ readonly type: "address";
127
+ }];
128
+ readonly name: "allowance";
129
+ readonly outputs: readonly [{
130
+ readonly name: "";
131
+ readonly type: "uint256";
132
+ }];
133
+ readonly payable: false;
134
+ readonly stateMutability: "view";
135
+ readonly type: "function";
136
+ }, {
137
+ readonly inputs: readonly [];
138
+ readonly payable: false;
139
+ readonly stateMutability: "nonpayable";
140
+ readonly type: "constructor";
141
+ }, {
142
+ readonly anonymous: false;
143
+ readonly inputs: readonly [{
144
+ readonly indexed: true;
145
+ readonly name: "_from";
146
+ readonly type: "address";
147
+ }, {
148
+ readonly indexed: true;
149
+ readonly name: "_to";
150
+ readonly type: "address";
151
+ }, {
152
+ readonly indexed: false;
153
+ readonly name: "_value";
154
+ readonly type: "uint256";
155
+ }];
156
+ readonly name: "Transfer";
157
+ readonly type: "event";
158
+ }, {
159
+ readonly anonymous: false;
160
+ readonly inputs: readonly [{
161
+ readonly indexed: true;
162
+ readonly name: "_owner";
163
+ readonly type: "address";
164
+ }, {
165
+ readonly indexed: true;
166
+ readonly name: "_spender";
167
+ readonly type: "address";
168
+ }, {
169
+ readonly indexed: false;
170
+ readonly name: "_value";
171
+ readonly type: "uint256";
172
+ }];
173
+ readonly name: "Approval";
174
+ readonly type: "event";
175
+ }];
176
+ /**
177
+ * Type-safe ABI for IOSToken
178
+ */
179
+ export type IOSTokenAbi = typeof IOSTokenAbi;
180
+ /**
181
+ * Contract instance type for IOSToken
182
+ */
183
+ export type IOSTokenContract = any;
184
+ /**
185
+ * IOSToken Contract Class
186
+ *
187
+ * Provides a class-based API similar to TypeChain for interacting with the contract.
188
+ *
189
+ * @example
190
+ * ```typescript
191
+ * import { createPublicClient, createWalletClient, http } from 'viem';
192
+ * import { mainnet } from 'viem/chains';
193
+ * import { IOSToken } from 'IOSToken';
194
+ *
195
+ * const publicClient = createPublicClient({ chain: mainnet, transport: http() });
196
+ * const walletClient = createWalletClient({ chain: mainnet, transport: http() });
197
+ *
198
+ * const contract = new IOSToken('0x...', { publicClient, walletClient });
199
+ *
200
+ * // Read functions
201
+ * const result = await contract.balanceOf('0x...');
202
+ *
203
+ * // Write functions
204
+ * const hash = await contract.transfer('0x...', 1000n);
205
+ *
206
+ * // Simulate transactions (dry-run)
207
+ * const simulation = await contract.simulate.transfer('0x...', 1000n);
208
+ * console.log('Gas estimate:', simulation.request.gas);
209
+ *
210
+ * // Watch events
211
+ * const unwatch = contract.watch.Transfer((event) => {
212
+ * console.log('Transfer event:', event);
213
+ * });
214
+ * ```
215
+ */
216
+ export declare class IOSToken {
217
+ private contract;
218
+ private contractAddress;
219
+ private publicClient;
220
+ constructor(address: Address, clients: {
221
+ publicClient: PublicClient;
222
+ walletClient?: WalletClient;
223
+ });
224
+ /**
225
+ * Get the contract address
226
+ */
227
+ get address(): Address;
228
+ /**
229
+ * Get the underlying viem contract instance.
230
+ */
231
+ getContract(): IOSTokenContract;
232
+ /**
233
+ * name
234
+ * view
235
+ */
236
+ name(): Promise<string>;
237
+ /**
238
+ * totalSupply
239
+ * view
240
+ */
241
+ totalSupply(): Promise<bigint>;
242
+ /**
243
+ * decimals
244
+ * view
245
+ */
246
+ decimals(): Promise<bigint>;
247
+ /**
248
+ * balanceOf
249
+ * view
250
+ */
251
+ balanceOf(_owner: `0x${string}`): Promise<bigint>;
252
+ /**
253
+ * symbol
254
+ * view
255
+ */
256
+ symbol(): Promise<string>;
257
+ /**
258
+ * allowance
259
+ * view
260
+ */
261
+ allowance(_owner: `0x${string}`, _spender: `0x${string}`): Promise<bigint>;
262
+ /**
263
+ * approve
264
+ * nonpayable
265
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
266
+ */
267
+ approve(_spender: `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
+ * transferFrom
281
+ * nonpayable
282
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
283
+ */
284
+ transferFrom(_from: `0x${string}`, _to: `0x${string}`, _value: bigint, options?: {
285
+ accessList?: import('viem').AccessList;
286
+ authorizationList?: import('viem').AuthorizationList;
287
+ chain?: import('viem').Chain | null;
288
+ dataSuffix?: `0x${string}`;
289
+ gas?: bigint;
290
+ gasPrice?: bigint;
291
+ maxFeePerGas?: bigint;
292
+ maxPriorityFeePerGas?: bigint;
293
+ nonce?: number;
294
+ value?: bigint;
295
+ }): Promise<`0x${string}`>;
296
+ /**
297
+ * transfer
298
+ * nonpayable
299
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
300
+ */
301
+ transfer(_to: `0x${string}`, _value: bigint, options?: {
302
+ accessList?: import('viem').AccessList;
303
+ authorizationList?: import('viem').AuthorizationList;
304
+ chain?: import('viem').Chain | null;
305
+ dataSuffix?: `0x${string}`;
306
+ gas?: bigint;
307
+ gasPrice?: bigint;
308
+ maxFeePerGas?: bigint;
309
+ maxPriorityFeePerGas?: bigint;
310
+ nonce?: number;
311
+ value?: bigint;
312
+ }): Promise<`0x${string}`>;
313
+ /**
314
+ * Simulate contract write operations (dry-run without sending transaction)
315
+ *
316
+ * @example
317
+ * const result = await contract.simulate.transfer('0x...', 1000n);
318
+ * console.log('Gas estimate:', result.request.gas);
319
+ * console.log('Would succeed:', result.result);
320
+ */
321
+ get simulate(): {
322
+ /**
323
+ * Simulate approve
324
+ * Returns gas estimate and result without sending transaction
325
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
326
+ */
327
+ approve(_spender: `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
+ * Simulate transferFrom
341
+ * Returns gas estimate and result without sending transaction
342
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
343
+ */
344
+ transferFrom(_from: `0x${string}`, _to: `0x${string}`, _value: bigint, options?: {
345
+ accessList?: import("viem").AccessList;
346
+ authorizationList?: import("viem").AuthorizationList;
347
+ chain?: import("viem").Chain | null;
348
+ dataSuffix?: `0x${string}`;
349
+ gas?: bigint;
350
+ gasPrice?: bigint;
351
+ maxFeePerGas?: bigint;
352
+ maxPriorityFeePerGas?: bigint;
353
+ nonce?: number;
354
+ value?: bigint;
355
+ }): Promise<boolean>;
356
+ /**
357
+ * Simulate transfer
358
+ * Returns gas estimate and result without sending transaction
359
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
360
+ */
361
+ transfer(_to: `0x${string}`, _value: bigint, options?: {
362
+ accessList?: import("viem").AccessList;
363
+ authorizationList?: import("viem").AuthorizationList;
364
+ chain?: import("viem").Chain | null;
365
+ dataSuffix?: `0x${string}`;
366
+ gas?: bigint;
367
+ gasPrice?: bigint;
368
+ maxFeePerGas?: bigint;
369
+ maxPriorityFeePerGas?: bigint;
370
+ nonce?: number;
371
+ value?: bigint;
372
+ }): Promise<boolean>;
373
+ };
374
+ /**
375
+ * Watch contract events
376
+ *
377
+ * @example
378
+ * // Watch all Transfer events
379
+ * const unwatch = contract.watch.Transfer((event) => {
380
+ * console.log('Transfer:', event);
381
+ * });
382
+ *
383
+ * // Stop watching
384
+ * unwatch();
385
+ */
386
+ get watch(): {
387
+ /**
388
+ * Watch Transfer events
389
+ * @param callback Function to call when event is emitted
390
+ * @param filter Optional filter for indexed parameters
391
+ * @returns Unwatch function to stop listening
392
+ */
393
+ Transfer: (callback: (event: {
394
+ _from: `0x${string}`;
395
+ _to: `0x${string}`;
396
+ _value: bigint;
397
+ }) => void, filter?: {
398
+ _from?: `0x${string}` | `0x${string}`[] | null;
399
+ _to?: `0x${string}` | `0x${string}`[] | null;
400
+ }) => () => void;
401
+ /**
402
+ * Watch Approval events
403
+ * @param callback Function to call when event is emitted
404
+ * @param filter Optional filter for indexed parameters
405
+ * @returns Unwatch function to stop listening
406
+ */
407
+ Approval: (callback: (event: {
408
+ _owner: `0x${string}`;
409
+ _spender: `0x${string}`;
410
+ _value: bigint;
411
+ }) => void, filter?: {
412
+ _owner?: `0x${string}` | `0x${string}`[] | null;
413
+ _spender?: `0x${string}` | `0x${string}`[] | null;
414
+ }) => () => void;
415
+ };
416
+ }