@gitmyabi/distributorfactory 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/distributorfactory
2
+
3
+ Auto-generated TypeScript type bindings for **DistributorFactory**
4
+
5
+ - **Build ID**: `etherscan-distributorfactory-00306cef-1788943931551`
6
+ - **Build Number**: 1
7
+ - **Commit**: `5169d2f`
8
+ - **Branch**: `etherscan`
9
+ - **Target**: `ethers-v6`
10
+ - **Contracts**: 1
11
+
12
+ ## Installation
13
+
14
+ ```bash
15
+ npm install @gitmyabi/distributorfactory@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/distributorfactory';
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/distributorfactory';
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/distributorfactory';
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,237 @@
1
+ import type { Address, PublicClient, WalletClient } from 'viem';
2
+ /**
3
+ * DistributorFactory_json ABI
4
+ *
5
+ * This ABI is typed using viem's type system for full type safety.
6
+ */
7
+ export declare const DistributorFactory_jsonAbi: readonly [{
8
+ readonly inputs: readonly [];
9
+ readonly stateMutability: "nonpayable";
10
+ readonly type: "constructor";
11
+ }, {
12
+ readonly inputs: readonly [];
13
+ readonly name: "AmountMismatch";
14
+ readonly type: "error";
15
+ }, {
16
+ readonly inputs: readonly [];
17
+ readonly name: "InvalidOperator";
18
+ readonly type: "error";
19
+ }, {
20
+ readonly inputs: readonly [];
21
+ readonly name: "InvalidToken";
22
+ readonly type: "error";
23
+ }, {
24
+ readonly inputs: readonly [];
25
+ readonly name: "InvalidTotalAmount";
26
+ readonly type: "error";
27
+ }, {
28
+ readonly inputs: readonly [];
29
+ readonly name: "NativeSendFailed";
30
+ readonly type: "error";
31
+ }, {
32
+ readonly inputs: readonly [];
33
+ readonly name: "UnexpectedNative";
34
+ readonly type: "error";
35
+ }, {
36
+ readonly anonymous: false;
37
+ readonly inputs: readonly [{
38
+ readonly indexed: true;
39
+ readonly internalType: "address";
40
+ readonly name: "owner";
41
+ readonly type: "address";
42
+ }, {
43
+ readonly indexed: true;
44
+ readonly internalType: "address";
45
+ readonly name: "operator";
46
+ readonly type: "address";
47
+ }, {
48
+ readonly indexed: false;
49
+ readonly internalType: "address";
50
+ readonly name: "token";
51
+ readonly type: "address";
52
+ }, {
53
+ readonly indexed: false;
54
+ readonly internalType: "address";
55
+ readonly name: "distributorAddress";
56
+ readonly type: "address";
57
+ }, {
58
+ readonly indexed: false;
59
+ readonly internalType: "uint256";
60
+ readonly name: "initialTotalAmount";
61
+ readonly type: "uint256";
62
+ }];
63
+ readonly name: "DistributorCreated";
64
+ readonly type: "event";
65
+ }, {
66
+ readonly inputs: readonly [{
67
+ readonly internalType: "address";
68
+ readonly name: "token";
69
+ readonly type: "address";
70
+ }, {
71
+ readonly internalType: "address";
72
+ readonly name: "operator";
73
+ readonly type: "address";
74
+ }, {
75
+ readonly internalType: "uint256";
76
+ readonly name: "initialTotalAmount";
77
+ readonly type: "uint256";
78
+ }];
79
+ readonly name: "createDistributor";
80
+ readonly outputs: readonly [{
81
+ readonly internalType: "address";
82
+ readonly name: "distributorAddress";
83
+ readonly type: "address";
84
+ }];
85
+ readonly stateMutability: "payable";
86
+ readonly type: "function";
87
+ }, {
88
+ readonly inputs: readonly [{
89
+ readonly internalType: "address";
90
+ readonly name: "";
91
+ readonly type: "address";
92
+ }];
93
+ readonly name: "isDistributor";
94
+ readonly outputs: readonly [{
95
+ readonly internalType: "bool";
96
+ readonly name: "";
97
+ readonly type: "bool";
98
+ }];
99
+ readonly stateMutability: "view";
100
+ readonly type: "function";
101
+ }];
102
+ /**
103
+ * Type-safe ABI for DistributorFactory_json
104
+ */
105
+ export type DistributorFactory_jsonAbi = typeof DistributorFactory_jsonAbi;
106
+ /**
107
+ * Contract instance type for DistributorFactory_json
108
+ */
109
+ export type DistributorFactory_jsonContract = any;
110
+ /**
111
+ * DistributorFactory_json Contract Class
112
+ *
113
+ * Provides a class-based API similar to TypeChain for interacting with the contract.
114
+ *
115
+ * @example
116
+ * ```typescript
117
+ * import { createPublicClient, createWalletClient, http } from 'viem';
118
+ * import { mainnet } from 'viem/chains';
119
+ * import { DistributorFactory_json } from 'DistributorFactory_json';
120
+ *
121
+ * const publicClient = createPublicClient({ chain: mainnet, transport: http() });
122
+ * const walletClient = createWalletClient({ chain: mainnet, transport: http() });
123
+ *
124
+ * const contract = new DistributorFactory_json('0x...', { publicClient, walletClient });
125
+ *
126
+ * // Read functions
127
+ * const result = await contract.balanceOf('0x...');
128
+ *
129
+ * // Write functions
130
+ * const hash = await contract.transfer('0x...', 1000n);
131
+ *
132
+ * // Simulate transactions (dry-run)
133
+ * const simulation = await contract.simulate.transfer('0x...', 1000n);
134
+ * console.log('Gas estimate:', simulation.request.gas);
135
+ *
136
+ * // Watch events
137
+ * const unwatch = contract.watch.Transfer((event) => {
138
+ * console.log('Transfer event:', event);
139
+ * });
140
+ * ```
141
+ */
142
+ export declare class DistributorFactory_json {
143
+ private contract;
144
+ private contractAddress;
145
+ private publicClient;
146
+ constructor(address: Address, clients: {
147
+ publicClient: PublicClient;
148
+ walletClient?: WalletClient;
149
+ });
150
+ /**
151
+ * Get the contract address
152
+ */
153
+ get address(): Address;
154
+ /**
155
+ * Get the underlying viem contract instance
156
+ */
157
+ getContract(): DistributorFactory_jsonContract;
158
+ /**
159
+ * isDistributor
160
+ * view
161
+ */
162
+ isDistributor(arg0: `0x${string}`): Promise<boolean>;
163
+ /**
164
+ * createDistributor
165
+ * payable
166
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
167
+ */
168
+ createDistributor(token: `0x${string}`, operator: `0x${string}`, initialTotalAmount: bigint, options?: {
169
+ accessList?: import('viem').AccessList;
170
+ authorizationList?: import('viem').AuthorizationList;
171
+ chain?: import('viem').Chain | null;
172
+ dataSuffix?: `0x${string}`;
173
+ gas?: bigint;
174
+ gasPrice?: bigint;
175
+ maxFeePerGas?: bigint;
176
+ maxPriorityFeePerGas?: bigint;
177
+ nonce?: number;
178
+ value?: bigint;
179
+ }): Promise<`0x${string}`>;
180
+ /**
181
+ * Simulate contract write operations (dry-run without sending transaction)
182
+ *
183
+ * @example
184
+ * const result = await contract.simulate.transfer('0x...', 1000n);
185
+ * console.log('Gas estimate:', result.request.gas);
186
+ * console.log('Would succeed:', result.result);
187
+ */
188
+ get simulate(): {
189
+ /**
190
+ * Simulate createDistributor
191
+ * Returns gas estimate and result without sending transaction
192
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
193
+ */
194
+ createDistributor(token: `0x${string}`, operator: `0x${string}`, initialTotalAmount: bigint, options?: {
195
+ accessList?: import("viem").AccessList;
196
+ authorizationList?: import("viem").AuthorizationList;
197
+ chain?: import("viem").Chain | null;
198
+ dataSuffix?: `0x${string}`;
199
+ gas?: bigint;
200
+ gasPrice?: bigint;
201
+ maxFeePerGas?: bigint;
202
+ maxPriorityFeePerGas?: bigint;
203
+ nonce?: number;
204
+ value?: bigint;
205
+ }): Promise<`0x${string}`>;
206
+ };
207
+ /**
208
+ * Watch contract events
209
+ *
210
+ * @example
211
+ * // Watch all Transfer events
212
+ * const unwatch = contract.watch.Transfer((event) => {
213
+ * console.log('Transfer:', event);
214
+ * });
215
+ *
216
+ * // Stop watching
217
+ * unwatch();
218
+ */
219
+ get watch(): {
220
+ /**
221
+ * Watch DistributorCreated events
222
+ * @param callback Function to call when event is emitted
223
+ * @param filter Optional filter for indexed parameters
224
+ * @returns Unwatch function to stop listening
225
+ */
226
+ DistributorCreated: (callback: (event: {
227
+ owner: `0x${string}`;
228
+ operator: `0x${string}`;
229
+ token: `0x${string}`;
230
+ distributorAddress: `0x${string}`;
231
+ initialTotalAmount: bigint;
232
+ }) => void, filter?: {
233
+ owner: `0x${string}`;
234
+ operator: `0x${string}`;
235
+ }) => () => void;
236
+ };
237
+ }
@@ -0,0 +1,267 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DistributorFactory_json = exports.DistributorFactory_jsonAbi = void 0;
4
+ const viem_1 = require("viem");
5
+ /**
6
+ * DistributorFactory_json ABI
7
+ *
8
+ * This ABI is typed using viem's type system for full type safety.
9
+ */
10
+ exports.DistributorFactory_jsonAbi = [
11
+ {
12
+ "inputs": [],
13
+ "stateMutability": "nonpayable",
14
+ "type": "constructor"
15
+ },
16
+ {
17
+ "inputs": [],
18
+ "name": "AmountMismatch",
19
+ "type": "error"
20
+ },
21
+ {
22
+ "inputs": [],
23
+ "name": "InvalidOperator",
24
+ "type": "error"
25
+ },
26
+ {
27
+ "inputs": [],
28
+ "name": "InvalidToken",
29
+ "type": "error"
30
+ },
31
+ {
32
+ "inputs": [],
33
+ "name": "InvalidTotalAmount",
34
+ "type": "error"
35
+ },
36
+ {
37
+ "inputs": [],
38
+ "name": "NativeSendFailed",
39
+ "type": "error"
40
+ },
41
+ {
42
+ "inputs": [],
43
+ "name": "UnexpectedNative",
44
+ "type": "error"
45
+ },
46
+ {
47
+ "anonymous": false,
48
+ "inputs": [
49
+ {
50
+ "indexed": true,
51
+ "internalType": "address",
52
+ "name": "owner",
53
+ "type": "address"
54
+ },
55
+ {
56
+ "indexed": true,
57
+ "internalType": "address",
58
+ "name": "operator",
59
+ "type": "address"
60
+ },
61
+ {
62
+ "indexed": false,
63
+ "internalType": "address",
64
+ "name": "token",
65
+ "type": "address"
66
+ },
67
+ {
68
+ "indexed": false,
69
+ "internalType": "address",
70
+ "name": "distributorAddress",
71
+ "type": "address"
72
+ },
73
+ {
74
+ "indexed": false,
75
+ "internalType": "uint256",
76
+ "name": "initialTotalAmount",
77
+ "type": "uint256"
78
+ }
79
+ ],
80
+ "name": "DistributorCreated",
81
+ "type": "event"
82
+ },
83
+ {
84
+ "inputs": [
85
+ {
86
+ "internalType": "address",
87
+ "name": "token",
88
+ "type": "address"
89
+ },
90
+ {
91
+ "internalType": "address",
92
+ "name": "operator",
93
+ "type": "address"
94
+ },
95
+ {
96
+ "internalType": "uint256",
97
+ "name": "initialTotalAmount",
98
+ "type": "uint256"
99
+ }
100
+ ],
101
+ "name": "createDistributor",
102
+ "outputs": [
103
+ {
104
+ "internalType": "address",
105
+ "name": "distributorAddress",
106
+ "type": "address"
107
+ }
108
+ ],
109
+ "stateMutability": "payable",
110
+ "type": "function"
111
+ },
112
+ {
113
+ "inputs": [
114
+ {
115
+ "internalType": "address",
116
+ "name": "",
117
+ "type": "address"
118
+ }
119
+ ],
120
+ "name": "isDistributor",
121
+ "outputs": [
122
+ {
123
+ "internalType": "bool",
124
+ "name": "",
125
+ "type": "bool"
126
+ }
127
+ ],
128
+ "stateMutability": "view",
129
+ "type": "function"
130
+ }
131
+ ];
132
+ /**
133
+ * DistributorFactory_json Contract Class
134
+ *
135
+ * Provides a class-based API similar to TypeChain for interacting with the contract.
136
+ *
137
+ * @example
138
+ * ```typescript
139
+ * import { createPublicClient, createWalletClient, http } from 'viem';
140
+ * import { mainnet } from 'viem/chains';
141
+ * import { DistributorFactory_json } from 'DistributorFactory_json';
142
+ *
143
+ * const publicClient = createPublicClient({ chain: mainnet, transport: http() });
144
+ * const walletClient = createWalletClient({ chain: mainnet, transport: http() });
145
+ *
146
+ * const contract = new DistributorFactory_json('0x...', { publicClient, walletClient });
147
+ *
148
+ * // Read functions
149
+ * const result = await contract.balanceOf('0x...');
150
+ *
151
+ * // Write functions
152
+ * const hash = await contract.transfer('0x...', 1000n);
153
+ *
154
+ * // Simulate transactions (dry-run)
155
+ * const simulation = await contract.simulate.transfer('0x...', 1000n);
156
+ * console.log('Gas estimate:', simulation.request.gas);
157
+ *
158
+ * // Watch events
159
+ * const unwatch = contract.watch.Transfer((event) => {
160
+ * console.log('Transfer event:', event);
161
+ * });
162
+ * ```
163
+ */
164
+ class DistributorFactory_json {
165
+ constructor(address, clients) {
166
+ this.contractAddress = address;
167
+ this.publicClient = clients.publicClient;
168
+ this.contract = (0, viem_1.getContract)({
169
+ address,
170
+ abi: exports.DistributorFactory_jsonAbi,
171
+ client: {
172
+ public: clients.publicClient,
173
+ wallet: clients.walletClient,
174
+ },
175
+ });
176
+ }
177
+ /**
178
+ * Get the contract address
179
+ */
180
+ get address() {
181
+ return this.contractAddress;
182
+ }
183
+ /**
184
+ * Get the underlying viem contract instance
185
+ */
186
+ getContract() {
187
+ return this.contract;
188
+ }
189
+ /**
190
+ * isDistributor
191
+ * view
192
+ */
193
+ async isDistributor(arg0) {
194
+ return this.contract.read.isDistributor([arg0]);
195
+ }
196
+ /**
197
+ * createDistributor
198
+ * payable
199
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
200
+ */
201
+ async createDistributor(token, operator, initialTotalAmount, options) {
202
+ if (!this.contract.write) {
203
+ throw new Error('Wallet client is required for write operations');
204
+ }
205
+ return this.contract.write.createDistributor([token, operator, initialTotalAmount], options);
206
+ }
207
+ /**
208
+ * Simulate contract write operations (dry-run without sending transaction)
209
+ *
210
+ * @example
211
+ * const result = await contract.simulate.transfer('0x...', 1000n);
212
+ * console.log('Gas estimate:', result.request.gas);
213
+ * console.log('Would succeed:', result.result);
214
+ */
215
+ get simulate() {
216
+ const contract = this.contract;
217
+ if (!contract.simulate) {
218
+ throw new Error('Public client is required for simulation');
219
+ }
220
+ return {
221
+ /**
222
+ * Simulate createDistributor
223
+ * Returns gas estimate and result without sending transaction
224
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
225
+ */
226
+ async createDistributor(token, operator, initialTotalAmount, options) {
227
+ return contract.simulate.createDistributor([token, operator, initialTotalAmount], options);
228
+ }
229
+ };
230
+ }
231
+ /**
232
+ * Watch contract events
233
+ *
234
+ * @example
235
+ * // Watch all Transfer events
236
+ * const unwatch = contract.watch.Transfer((event) => {
237
+ * console.log('Transfer:', event);
238
+ * });
239
+ *
240
+ * // Stop watching
241
+ * unwatch();
242
+ */
243
+ get watch() {
244
+ return {
245
+ /**
246
+ * Watch DistributorCreated events
247
+ * @param callback Function to call when event is emitted
248
+ * @param filter Optional filter for indexed parameters
249
+ * @returns Unwatch function to stop listening
250
+ */
251
+ DistributorCreated: (callback, filter) => {
252
+ return this.publicClient.watchContractEvent({
253
+ address: this.contractAddress,
254
+ abi: exports.DistributorFactory_jsonAbi,
255
+ eventName: 'DistributorCreated',
256
+ args: filter,
257
+ onLogs: (logs) => {
258
+ logs.forEach((log) => {
259
+ callback(log.args);
260
+ });
261
+ },
262
+ });
263
+ }
264
+ };
265
+ }
266
+ }
267
+ exports.DistributorFactory_json = DistributorFactory_json;
@@ -0,0 +1,318 @@
1
+ import type { Abi, Address, PublicClient, WalletClient, GetContractReturnType } from 'viem';
2
+ import { getContract } from 'viem';
3
+
4
+ /**
5
+ * DistributorFactory_json ABI
6
+ *
7
+ * This ABI is typed using viem's type system for full type safety.
8
+ */
9
+ export const DistributorFactory_jsonAbi = [
10
+ {
11
+ "inputs": [],
12
+ "stateMutability": "nonpayable",
13
+ "type": "constructor"
14
+ },
15
+ {
16
+ "inputs": [],
17
+ "name": "AmountMismatch",
18
+ "type": "error"
19
+ },
20
+ {
21
+ "inputs": [],
22
+ "name": "InvalidOperator",
23
+ "type": "error"
24
+ },
25
+ {
26
+ "inputs": [],
27
+ "name": "InvalidToken",
28
+ "type": "error"
29
+ },
30
+ {
31
+ "inputs": [],
32
+ "name": "InvalidTotalAmount",
33
+ "type": "error"
34
+ },
35
+ {
36
+ "inputs": [],
37
+ "name": "NativeSendFailed",
38
+ "type": "error"
39
+ },
40
+ {
41
+ "inputs": [],
42
+ "name": "UnexpectedNative",
43
+ "type": "error"
44
+ },
45
+ {
46
+ "anonymous": false,
47
+ "inputs": [
48
+ {
49
+ "indexed": true,
50
+ "internalType": "address",
51
+ "name": "owner",
52
+ "type": "address"
53
+ },
54
+ {
55
+ "indexed": true,
56
+ "internalType": "address",
57
+ "name": "operator",
58
+ "type": "address"
59
+ },
60
+ {
61
+ "indexed": false,
62
+ "internalType": "address",
63
+ "name": "token",
64
+ "type": "address"
65
+ },
66
+ {
67
+ "indexed": false,
68
+ "internalType": "address",
69
+ "name": "distributorAddress",
70
+ "type": "address"
71
+ },
72
+ {
73
+ "indexed": false,
74
+ "internalType": "uint256",
75
+ "name": "initialTotalAmount",
76
+ "type": "uint256"
77
+ }
78
+ ],
79
+ "name": "DistributorCreated",
80
+ "type": "event"
81
+ },
82
+ {
83
+ "inputs": [
84
+ {
85
+ "internalType": "address",
86
+ "name": "token",
87
+ "type": "address"
88
+ },
89
+ {
90
+ "internalType": "address",
91
+ "name": "operator",
92
+ "type": "address"
93
+ },
94
+ {
95
+ "internalType": "uint256",
96
+ "name": "initialTotalAmount",
97
+ "type": "uint256"
98
+ }
99
+ ],
100
+ "name": "createDistributor",
101
+ "outputs": [
102
+ {
103
+ "internalType": "address",
104
+ "name": "distributorAddress",
105
+ "type": "address"
106
+ }
107
+ ],
108
+ "stateMutability": "payable",
109
+ "type": "function"
110
+ },
111
+ {
112
+ "inputs": [
113
+ {
114
+ "internalType": "address",
115
+ "name": "",
116
+ "type": "address"
117
+ }
118
+ ],
119
+ "name": "isDistributor",
120
+ "outputs": [
121
+ {
122
+ "internalType": "bool",
123
+ "name": "",
124
+ "type": "bool"
125
+ }
126
+ ],
127
+ "stateMutability": "view",
128
+ "type": "function"
129
+ }
130
+ ] as const satisfies Abi;
131
+
132
+ /**
133
+ * Type-safe ABI for DistributorFactory_json
134
+ */
135
+ export type DistributorFactory_jsonAbi = typeof DistributorFactory_jsonAbi;
136
+
137
+ /**
138
+ * Contract instance type for DistributorFactory_json
139
+ */
140
+ // Use any for contract type to avoid complex viem type issues
141
+ // The runtime behavior is type-safe through viem's ABI typing
142
+ export type DistributorFactory_jsonContract = any;
143
+
144
+ /**
145
+ * DistributorFactory_json Contract Class
146
+ *
147
+ * Provides a class-based API similar to TypeChain for interacting with the contract.
148
+ *
149
+ * @example
150
+ * ```typescript
151
+ * import { createPublicClient, createWalletClient, http } from 'viem';
152
+ * import { mainnet } from 'viem/chains';
153
+ * import { DistributorFactory_json } from 'DistributorFactory_json';
154
+ *
155
+ * const publicClient = createPublicClient({ chain: mainnet, transport: http() });
156
+ * const walletClient = createWalletClient({ chain: mainnet, transport: http() });
157
+ *
158
+ * const contract = new DistributorFactory_json('0x...', { publicClient, walletClient });
159
+ *
160
+ * // Read functions
161
+ * const result = await contract.balanceOf('0x...');
162
+ *
163
+ * // Write functions
164
+ * const hash = await contract.transfer('0x...', 1000n);
165
+ *
166
+ * // Simulate transactions (dry-run)
167
+ * const simulation = await contract.simulate.transfer('0x...', 1000n);
168
+ * console.log('Gas estimate:', simulation.request.gas);
169
+ *
170
+ * // Watch events
171
+ * const unwatch = contract.watch.Transfer((event) => {
172
+ * console.log('Transfer event:', event);
173
+ * });
174
+ * ```
175
+ */
176
+ export class DistributorFactory_json {
177
+ private contract: DistributorFactory_jsonContract;
178
+ private contractAddress: Address;
179
+ private publicClient: PublicClient;
180
+
181
+ constructor(
182
+ address: Address,
183
+ clients: {
184
+ publicClient: PublicClient;
185
+ walletClient?: WalletClient;
186
+ }
187
+ ) {
188
+ this.contractAddress = address;
189
+ this.publicClient = clients.publicClient;
190
+ this.contract = getContract({
191
+ address,
192
+ abi: DistributorFactory_jsonAbi,
193
+ client: {
194
+ public: clients.publicClient,
195
+ wallet: clients.walletClient,
196
+ },
197
+ });
198
+ }
199
+
200
+ /**
201
+ * Get the contract address
202
+ */
203
+ get address(): Address {
204
+ return this.contractAddress;
205
+ }
206
+
207
+ /**
208
+ * Get the underlying viem contract instance
209
+ */
210
+ getContract(): DistributorFactory_jsonContract {
211
+ return this.contract;
212
+ }
213
+
214
+ /**
215
+ * isDistributor
216
+ * view
217
+ */
218
+ async isDistributor(arg0: `0x${string}`): Promise<boolean> {
219
+ return this.contract.read.isDistributor([arg0] as const) as Promise<boolean>;
220
+ }
221
+
222
+ /**
223
+ * createDistributor
224
+ * payable
225
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
226
+ */
227
+ async createDistributor(token: `0x${string}`, operator: `0x${string}`, initialTotalAmount: bigint, options?: {
228
+ accessList?: import('viem').AccessList;
229
+ authorizationList?: import('viem').AuthorizationList;
230
+ chain?: import('viem').Chain | null;
231
+ dataSuffix?: `0x${string}`;
232
+ gas?: bigint;
233
+ gasPrice?: bigint;
234
+ maxFeePerGas?: bigint;
235
+ maxPriorityFeePerGas?: bigint;
236
+ nonce?: number;
237
+ value?: bigint;
238
+ }): Promise<`0x${string}`> {
239
+ if (!this.contract.write) {
240
+ throw new Error('Wallet client is required for write operations');
241
+ }
242
+ return this.contract.write.createDistributor([token, operator, initialTotalAmount] as const, options) as Promise<`0x${string}`>;
243
+ }
244
+
245
+
246
+
247
+ /**
248
+ * Simulate contract write operations (dry-run without sending transaction)
249
+ *
250
+ * @example
251
+ * const result = await contract.simulate.transfer('0x...', 1000n);
252
+ * console.log('Gas estimate:', result.request.gas);
253
+ * console.log('Would succeed:', result.result);
254
+ */
255
+ get simulate() {
256
+ const contract = this.contract;
257
+ if (!contract.simulate) {
258
+ throw new Error('Public client is required for simulation');
259
+ }
260
+ return {
261
+ /**
262
+ * Simulate createDistributor
263
+ * Returns gas estimate and result without sending transaction
264
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
265
+ */
266
+ async createDistributor(token: `0x${string}`, operator: `0x${string}`, initialTotalAmount: bigint, options?: {
267
+ accessList?: import('viem').AccessList;
268
+ authorizationList?: import('viem').AuthorizationList;
269
+ chain?: import('viem').Chain | null;
270
+ dataSuffix?: `0x${string}`;
271
+ gas?: bigint;
272
+ gasPrice?: bigint;
273
+ maxFeePerGas?: bigint;
274
+ maxPriorityFeePerGas?: bigint;
275
+ nonce?: number;
276
+ value?: bigint;
277
+ }): Promise<`0x${string}`> {
278
+ return contract.simulate.createDistributor([token, operator, initialTotalAmount] as const, options) as Promise<`0x${string}`>;
279
+ }
280
+ };
281
+ }
282
+
283
+ /**
284
+ * Watch contract events
285
+ *
286
+ * @example
287
+ * // Watch all Transfer events
288
+ * const unwatch = contract.watch.Transfer((event) => {
289
+ * console.log('Transfer:', event);
290
+ * });
291
+ *
292
+ * // Stop watching
293
+ * unwatch();
294
+ */
295
+ get watch() {
296
+ return {
297
+ /**
298
+ * Watch DistributorCreated events
299
+ * @param callback Function to call when event is emitted
300
+ * @param filter Optional filter for indexed parameters
301
+ * @returns Unwatch function to stop listening
302
+ */
303
+ DistributorCreated: (callback: (event: { owner: `0x${string}`; operator: `0x${string}`; token: `0x${string}`; distributorAddress: `0x${string}`; initialTotalAmount: bigint }) => void, filter?: { owner: `0x${string}`; operator: `0x${string}` }) => {
304
+ return this.publicClient.watchContractEvent({
305
+ address: this.contractAddress,
306
+ abi: DistributorFactory_jsonAbi,
307
+ eventName: 'DistributorCreated',
308
+ args: filter,
309
+ onLogs: (logs: any[]) => {
310
+ logs.forEach((log: any) => {
311
+ callback(log.args as any);
312
+ });
313
+ },
314
+ }) as () => void;
315
+ }
316
+ };
317
+ }
318
+ }
@@ -0,0 +1,2 @@
1
+ export { DistributorFactory_jsonAbi, DistributorFactory_json } from './DistributorFactory_json';
2
+ export type { DistributorFactory_jsonAbi as DistributorFactory_jsonAbiType, DistributorFactory_jsonContract } from './DistributorFactory_json';
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DistributorFactory_json = exports.DistributorFactory_jsonAbi = void 0;
4
+ // Auto-generated exports for all contracts
5
+ var DistributorFactory_json_1 = require("./DistributorFactory_json");
6
+ Object.defineProperty(exports, "DistributorFactory_jsonAbi", { enumerable: true, get: function () { return DistributorFactory_json_1.DistributorFactory_jsonAbi; } });
7
+ Object.defineProperty(exports, "DistributorFactory_json", { enumerable: true, get: function () { return DistributorFactory_json_1.DistributorFactory_json; } });
@@ -0,0 +1,3 @@
1
+ // Auto-generated exports for all contracts
2
+ export { DistributorFactory_jsonAbi, DistributorFactory_json } from './DistributorFactory_json';
3
+ export type { DistributorFactory_jsonAbi as DistributorFactory_jsonAbiType, DistributorFactory_jsonContract } from './DistributorFactory_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/distributorfactory",
3
+ "version": "1.0.0",
4
+ "description": "Auto-generated TypeScript type bindings for DistributorFactory (build etherscan-distributorfactory-00306cef-1788943931551, commit 5169d2f, 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/distributorfactory"
40
+ },
41
+ "branch": "etherscan",
42
+ "shortHash": "5169d2f"
43
+ }