@gitmyabi/feesplitterv2 0.0.0-stage → 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 +107 -2
- package/contracts/FeeSplitterV2_json.d.ts +365 -0
- package/contracts/FeeSplitterV2_json.js +366 -0
- package/contracts/FeeSplitterV2_json.ts +490 -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 +40 -3
|
@@ -0,0 +1,366 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FeeSplitterV2_json = exports.FeeSplitterV2_jsonAbi = void 0;
|
|
4
|
+
const viem_1 = require("viem");
|
|
5
|
+
/**
|
|
6
|
+
* FeeSplitterV2_json ABI
|
|
7
|
+
*
|
|
8
|
+
* This ABI is typed using viem's type system for full type safety.
|
|
9
|
+
*/
|
|
10
|
+
exports.FeeSplitterV2_jsonAbi = [
|
|
11
|
+
{
|
|
12
|
+
"inputs": [
|
|
13
|
+
{
|
|
14
|
+
"internalType": "address payable",
|
|
15
|
+
"name": "_addr1",
|
|
16
|
+
"type": "address"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"internalType": "uint256",
|
|
20
|
+
"name": "_split1",
|
|
21
|
+
"type": "uint256"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"internalType": "address payable",
|
|
25
|
+
"name": "_addr2",
|
|
26
|
+
"type": "address"
|
|
27
|
+
}
|
|
28
|
+
],
|
|
29
|
+
"stateMutability": "nonpayable",
|
|
30
|
+
"type": "constructor"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"stateMutability": "payable",
|
|
34
|
+
"type": "fallback"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"inputs": [
|
|
38
|
+
{
|
|
39
|
+
"internalType": "address payable",
|
|
40
|
+
"name": "_addr1",
|
|
41
|
+
"type": "address"
|
|
42
|
+
}
|
|
43
|
+
],
|
|
44
|
+
"name": "ChangeAddress1",
|
|
45
|
+
"outputs": [],
|
|
46
|
+
"stateMutability": "nonpayable",
|
|
47
|
+
"type": "function"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"inputs": [
|
|
51
|
+
{
|
|
52
|
+
"internalType": "address payable",
|
|
53
|
+
"name": "_addr2",
|
|
54
|
+
"type": "address"
|
|
55
|
+
}
|
|
56
|
+
],
|
|
57
|
+
"name": "ChangeAddress2",
|
|
58
|
+
"outputs": [],
|
|
59
|
+
"stateMutability": "nonpayable",
|
|
60
|
+
"type": "function"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"inputs": [],
|
|
64
|
+
"name": "GetSplitPct",
|
|
65
|
+
"outputs": [
|
|
66
|
+
{
|
|
67
|
+
"internalType": "uint256",
|
|
68
|
+
"name": "",
|
|
69
|
+
"type": "uint256"
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"internalType": "uint256",
|
|
73
|
+
"name": "",
|
|
74
|
+
"type": "uint256"
|
|
75
|
+
}
|
|
76
|
+
],
|
|
77
|
+
"stateMutability": "view",
|
|
78
|
+
"type": "function"
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"inputs": [
|
|
82
|
+
{
|
|
83
|
+
"internalType": "address",
|
|
84
|
+
"name": "_ERC20Addr",
|
|
85
|
+
"type": "address"
|
|
86
|
+
}
|
|
87
|
+
],
|
|
88
|
+
"name": "GetWithdrawableERC20",
|
|
89
|
+
"outputs": [
|
|
90
|
+
{
|
|
91
|
+
"internalType": "uint256",
|
|
92
|
+
"name": "v1",
|
|
93
|
+
"type": "uint256"
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"internalType": "uint256",
|
|
97
|
+
"name": "v2",
|
|
98
|
+
"type": "uint256"
|
|
99
|
+
}
|
|
100
|
+
],
|
|
101
|
+
"stateMutability": "view",
|
|
102
|
+
"type": "function"
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
"inputs": [],
|
|
106
|
+
"name": "GetWithdrawableETH",
|
|
107
|
+
"outputs": [
|
|
108
|
+
{
|
|
109
|
+
"internalType": "uint256",
|
|
110
|
+
"name": "v1",
|
|
111
|
+
"type": "uint256"
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
"internalType": "uint256",
|
|
115
|
+
"name": "v2",
|
|
116
|
+
"type": "uint256"
|
|
117
|
+
}
|
|
118
|
+
],
|
|
119
|
+
"stateMutability": "view",
|
|
120
|
+
"type": "function"
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
"inputs": [
|
|
124
|
+
{
|
|
125
|
+
"internalType": "address",
|
|
126
|
+
"name": "_ERC20Addr",
|
|
127
|
+
"type": "address"
|
|
128
|
+
}
|
|
129
|
+
],
|
|
130
|
+
"name": "WithdrawERC20",
|
|
131
|
+
"outputs": [],
|
|
132
|
+
"stateMutability": "nonpayable",
|
|
133
|
+
"type": "function"
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
"inputs": [],
|
|
137
|
+
"name": "WithdrawETH",
|
|
138
|
+
"outputs": [],
|
|
139
|
+
"stateMutability": "nonpayable",
|
|
140
|
+
"type": "function"
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
"inputs": [],
|
|
144
|
+
"name": "addr1",
|
|
145
|
+
"outputs": [
|
|
146
|
+
{
|
|
147
|
+
"internalType": "address payable",
|
|
148
|
+
"name": "",
|
|
149
|
+
"type": "address"
|
|
150
|
+
}
|
|
151
|
+
],
|
|
152
|
+
"stateMutability": "view",
|
|
153
|
+
"type": "function"
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
"inputs": [],
|
|
157
|
+
"name": "addr2",
|
|
158
|
+
"outputs": [
|
|
159
|
+
{
|
|
160
|
+
"internalType": "address payable",
|
|
161
|
+
"name": "",
|
|
162
|
+
"type": "address"
|
|
163
|
+
}
|
|
164
|
+
],
|
|
165
|
+
"stateMutability": "view",
|
|
166
|
+
"type": "function"
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
"stateMutability": "payable",
|
|
170
|
+
"type": "receive"
|
|
171
|
+
}
|
|
172
|
+
];
|
|
173
|
+
/**
|
|
174
|
+
* FeeSplitterV2_json Contract Class
|
|
175
|
+
*
|
|
176
|
+
* Provides a class-based API similar to TypeChain for interacting with the contract.
|
|
177
|
+
*
|
|
178
|
+
* @example
|
|
179
|
+
* ```typescript
|
|
180
|
+
* import { createPublicClient, createWalletClient, http } from 'viem';
|
|
181
|
+
* import { mainnet } from 'viem/chains';
|
|
182
|
+
* import { FeeSplitterV2_json } from 'FeeSplitterV2_json';
|
|
183
|
+
*
|
|
184
|
+
* const publicClient = createPublicClient({ chain: mainnet, transport: http() });
|
|
185
|
+
* const walletClient = createWalletClient({ chain: mainnet, transport: http() });
|
|
186
|
+
*
|
|
187
|
+
* const contract = new FeeSplitterV2_json('0x...', { publicClient, walletClient });
|
|
188
|
+
*
|
|
189
|
+
* // Read functions
|
|
190
|
+
* const result = await contract.balanceOf('0x...');
|
|
191
|
+
*
|
|
192
|
+
* // Write functions
|
|
193
|
+
* const hash = await contract.transfer('0x...', 1000n);
|
|
194
|
+
*
|
|
195
|
+
* // Simulate transactions (dry-run)
|
|
196
|
+
* const simulation = await contract.simulate.transfer('0x...', 1000n);
|
|
197
|
+
* console.log('Gas estimate:', simulation.request.gas);
|
|
198
|
+
*
|
|
199
|
+
* // Watch events
|
|
200
|
+
* const unwatch = contract.watch.Transfer((event) => {
|
|
201
|
+
* console.log('Transfer event:', event);
|
|
202
|
+
* });
|
|
203
|
+
* ```
|
|
204
|
+
*/
|
|
205
|
+
class FeeSplitterV2_json {
|
|
206
|
+
constructor(address, clients) {
|
|
207
|
+
this.contractAddress = address;
|
|
208
|
+
this.publicClient = clients.publicClient;
|
|
209
|
+
this.contract = (0, viem_1.getContract)({
|
|
210
|
+
address,
|
|
211
|
+
abi: exports.FeeSplitterV2_jsonAbi,
|
|
212
|
+
client: {
|
|
213
|
+
public: clients.publicClient,
|
|
214
|
+
wallet: clients.walletClient,
|
|
215
|
+
},
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Get the contract address
|
|
220
|
+
*/
|
|
221
|
+
get address() {
|
|
222
|
+
return this.contractAddress;
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Get the underlying viem contract instance
|
|
226
|
+
*/
|
|
227
|
+
getContract() {
|
|
228
|
+
return this.contract;
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* GetSplitPct
|
|
232
|
+
* view
|
|
233
|
+
*/
|
|
234
|
+
async GetSplitPct() {
|
|
235
|
+
return this.contract.read.GetSplitPct();
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* GetWithdrawableERC20
|
|
239
|
+
* view
|
|
240
|
+
*/
|
|
241
|
+
async GetWithdrawableERC20(_ERC20Addr) {
|
|
242
|
+
return this.contract.read.GetWithdrawableERC20([_ERC20Addr]);
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* GetWithdrawableETH
|
|
246
|
+
* view
|
|
247
|
+
*/
|
|
248
|
+
async GetWithdrawableETH() {
|
|
249
|
+
return this.contract.read.GetWithdrawableETH();
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* addr1
|
|
253
|
+
* view
|
|
254
|
+
*/
|
|
255
|
+
async addr1() {
|
|
256
|
+
return this.contract.read.addr1();
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* addr2
|
|
260
|
+
* view
|
|
261
|
+
*/
|
|
262
|
+
async addr2() {
|
|
263
|
+
return this.contract.read.addr2();
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* ChangeAddress1
|
|
267
|
+
* nonpayable
|
|
268
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
269
|
+
*/
|
|
270
|
+
async ChangeAddress1(_addr1, options) {
|
|
271
|
+
if (!this.contract.write) {
|
|
272
|
+
throw new Error('Wallet client is required for write operations');
|
|
273
|
+
}
|
|
274
|
+
return this.contract.write.ChangeAddress1([_addr1], options);
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* ChangeAddress2
|
|
278
|
+
* nonpayable
|
|
279
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
280
|
+
*/
|
|
281
|
+
async ChangeAddress2(_addr2, options) {
|
|
282
|
+
if (!this.contract.write) {
|
|
283
|
+
throw new Error('Wallet client is required for write operations');
|
|
284
|
+
}
|
|
285
|
+
return this.contract.write.ChangeAddress2([_addr2], options);
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* WithdrawERC20
|
|
289
|
+
* nonpayable
|
|
290
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
291
|
+
*/
|
|
292
|
+
async WithdrawERC20(_ERC20Addr, options) {
|
|
293
|
+
if (!this.contract.write) {
|
|
294
|
+
throw new Error('Wallet client is required for write operations');
|
|
295
|
+
}
|
|
296
|
+
return this.contract.write.WithdrawERC20([_ERC20Addr], options);
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* WithdrawETH
|
|
300
|
+
* nonpayable
|
|
301
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
302
|
+
*/
|
|
303
|
+
async WithdrawETH(options) {
|
|
304
|
+
if (!this.contract.write) {
|
|
305
|
+
throw new Error('Wallet client is required for write operations');
|
|
306
|
+
}
|
|
307
|
+
return this.contract.write.WithdrawETH(options);
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* Simulate contract write operations (dry-run without sending transaction)
|
|
311
|
+
*
|
|
312
|
+
* @example
|
|
313
|
+
* const result = await contract.simulate.transfer('0x...', 1000n);
|
|
314
|
+
* console.log('Gas estimate:', result.request.gas);
|
|
315
|
+
* console.log('Would succeed:', result.result);
|
|
316
|
+
*/
|
|
317
|
+
get simulate() {
|
|
318
|
+
const contract = this.contract;
|
|
319
|
+
if (!contract.simulate) {
|
|
320
|
+
throw new Error('Public client is required for simulation');
|
|
321
|
+
}
|
|
322
|
+
return {
|
|
323
|
+
/**
|
|
324
|
+
* Simulate ChangeAddress1
|
|
325
|
+
* Returns gas estimate and result without sending transaction
|
|
326
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
327
|
+
*/
|
|
328
|
+
async ChangeAddress1(_addr1, options) {
|
|
329
|
+
return contract.simulate.ChangeAddress1([_addr1], options);
|
|
330
|
+
},
|
|
331
|
+
/**
|
|
332
|
+
* Simulate ChangeAddress2
|
|
333
|
+
* Returns gas estimate and result without sending transaction
|
|
334
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
335
|
+
*/
|
|
336
|
+
async ChangeAddress2(_addr2, options) {
|
|
337
|
+
return contract.simulate.ChangeAddress2([_addr2], options);
|
|
338
|
+
},
|
|
339
|
+
/**
|
|
340
|
+
* Simulate WithdrawERC20
|
|
341
|
+
* Returns gas estimate and result without sending transaction
|
|
342
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
343
|
+
*/
|
|
344
|
+
async WithdrawERC20(_ERC20Addr, options) {
|
|
345
|
+
return contract.simulate.WithdrawERC20([_ERC20Addr], options);
|
|
346
|
+
},
|
|
347
|
+
/**
|
|
348
|
+
* Simulate WithdrawETH
|
|
349
|
+
* Returns gas estimate and result without sending transaction
|
|
350
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
351
|
+
*/
|
|
352
|
+
async WithdrawETH(options) {
|
|
353
|
+
return contract.simulate.WithdrawETH(options);
|
|
354
|
+
}
|
|
355
|
+
};
|
|
356
|
+
}
|
|
357
|
+
/**
|
|
358
|
+
* Watch contract events
|
|
359
|
+
*
|
|
360
|
+
* Note: This contract has no events, so watch returns an empty object.
|
|
361
|
+
*/
|
|
362
|
+
get watch() {
|
|
363
|
+
return {};
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
exports.FeeSplitterV2_json = FeeSplitterV2_json;
|