@sign-global/tokentable 0.4.0-beta.1 → 0.4.0-beta.2

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.
Files changed (24) hide show
  1. package/dist/cjs/airdrop/AirdropClient.js +9 -2
  2. package/dist/cjs/airdrop/AirdropClient.js.map +1 -1
  3. package/dist/cjs/airdrop/SignatureAirdropClient.d.ts +1 -3
  4. package/dist/cjs/airdrop/SignatureAirdropClient.js.map +1 -1
  5. package/dist/cjs/airdrop/core/evm/contracts/AirdropSignatureClient.d.ts +15 -0
  6. package/dist/cjs/airdrop/core/evm/contracts/AirdropSignatureClient.js +51 -0
  7. package/dist/cjs/airdrop/core/evm/contracts/AirdropSignatureClient.js.map +1 -0
  8. package/dist/cjs/airdrop/core/evm/contracts/abis/FungibleTokenECDSADistributor.json +564 -0
  9. package/dist/cjs/airdrop/types/index.d.ts +1 -0
  10. package/dist/esm/airdrop/AirdropClient.js +9 -2
  11. package/dist/esm/airdrop/AirdropClient.js.map +1 -1
  12. package/dist/esm/airdrop/SignatureAirdropClient.d.ts +1 -3
  13. package/dist/esm/airdrop/SignatureAirdropClient.js.map +1 -1
  14. package/dist/esm/airdrop/core/evm/contracts/AirdropSignatureClient.d.ts +15 -0
  15. package/dist/esm/airdrop/core/evm/contracts/AirdropSignatureClient.js +44 -0
  16. package/dist/esm/airdrop/core/evm/contracts/AirdropSignatureClient.js.map +1 -0
  17. package/dist/esm/airdrop/core/evm/contracts/abis/FungibleTokenECDSADistributor.json +564 -0
  18. package/dist/esm/airdrop/types/index.d.ts +1 -0
  19. package/package.json +3 -3
  20. package/src/airdrop/AirdropClient.ts +8 -2
  21. package/src/airdrop/SignatureAirdropClient.ts +1 -1
  22. package/src/airdrop/core/evm/contracts/AirdropSignatureClient.ts +59 -0
  23. package/src/airdrop/core/evm/contracts/abis/FungibleTokenECDSADistributor.json +564 -0
  24. package/src/airdrop/types/index.ts +1 -0
@@ -0,0 +1,59 @@
1
+ import { EvmContractClientOption } from '../../../types';
2
+ import ABI from './abis/FungibleTokenECDSADistributor.json';
3
+ import { ContractBaseClient } from './ContractBaseClient';
4
+
5
+ export class AirdropSignatureClient extends ContractBaseClient {
6
+ constructor(options: EvmContractClientOption) {
7
+ super({
8
+ ...options,
9
+ abi: ABI
10
+ });
11
+ }
12
+
13
+ async getClaimStatus(userClaimId: string) {
14
+ return this.readContract({ functionName: 'getClaimStatus', args: [userClaimId] });
15
+ }
16
+
17
+ async claim(
18
+ data: {
19
+ recipient: string;
20
+ group: string;
21
+ data: string;
22
+ signature: string;
23
+ extraData: string;
24
+ }[],
25
+ value?: bigint
26
+ ) {
27
+ const [recipients = [], userClaimIds = [], datas = [], signatures = [], extraDatas = []] = [
28
+ 'recipient',
29
+ 'claimId',
30
+ 'data',
31
+ 'signature',
32
+ 'extraData'
33
+ ].map((key) => data.map((item) => item[key as keyof (typeof data)[0]] || ''));
34
+
35
+ return this.writeContract({
36
+ functionName: 'claim',
37
+ args: [recipients, userClaimIds, datas, signatures, extraDatas],
38
+ value: value || 0n
39
+ });
40
+ }
41
+
42
+ async batchFetchClaimed(userClaimIds: string[]) {
43
+ // return this.multiCall({
44
+ // chainId: this.chainId as any,
45
+ // contracts: userClaimIds?.map((userClaimId) => {
46
+ // return {
47
+ // address: this.contractAddress,
48
+ // abi: this.abi,
49
+ // functionName: 'getClaimStatus',
50
+ // args: [userClaimId]
51
+ // };
52
+ // })
53
+ // });
54
+ }
55
+
56
+ async getDeployer() {
57
+ return this.readContract({ functionName: 'getDeployer' }) as Promise<string>;
58
+ }
59
+ }
@@ -0,0 +1,564 @@
1
+ [
2
+ {
3
+ "inputs": [
4
+ {
5
+ "internalType": "address",
6
+ "name": "target",
7
+ "type": "address"
8
+ }
9
+ ],
10
+ "name": "AddressEmptyCode",
11
+ "type": "error"
12
+ },
13
+ {
14
+ "inputs": [
15
+ {
16
+ "internalType": "address",
17
+ "name": "implementation",
18
+ "type": "address"
19
+ }
20
+ ],
21
+ "name": "ERC1967InvalidImplementation",
22
+ "type": "error"
23
+ },
24
+ {
25
+ "inputs": [],
26
+ "name": "ERC1967NonPayable",
27
+ "type": "error"
28
+ },
29
+ {
30
+ "inputs": [],
31
+ "name": "EnforcedPause",
32
+ "type": "error"
33
+ },
34
+ {
35
+ "inputs": [],
36
+ "name": "ExpectedPause",
37
+ "type": "error"
38
+ },
39
+ {
40
+ "inputs": [],
41
+ "name": "FailedCall",
42
+ "type": "error"
43
+ },
44
+ {
45
+ "inputs": [],
46
+ "name": "IncorrectFees",
47
+ "type": "error"
48
+ },
49
+ {
50
+ "inputs": [],
51
+ "name": "InvalidInitialization",
52
+ "type": "error"
53
+ },
54
+ {
55
+ "inputs": [],
56
+ "name": "InvalidSignature",
57
+ "type": "error"
58
+ },
59
+ {
60
+ "inputs": [],
61
+ "name": "NotInitializing",
62
+ "type": "error"
63
+ },
64
+ {
65
+ "inputs": [],
66
+ "name": "OutsideClaimableTimeRange",
67
+ "type": "error"
68
+ },
69
+ {
70
+ "inputs": [
71
+ {
72
+ "internalType": "address",
73
+ "name": "owner",
74
+ "type": "address"
75
+ }
76
+ ],
77
+ "name": "OwnableInvalidOwner",
78
+ "type": "error"
79
+ },
80
+ {
81
+ "inputs": [
82
+ {
83
+ "internalType": "address",
84
+ "name": "account",
85
+ "type": "address"
86
+ }
87
+ ],
88
+ "name": "OwnableUnauthorizedAccount",
89
+ "type": "error"
90
+ },
91
+ {
92
+ "inputs": [],
93
+ "name": "ReentrancyGuardReentrantCall",
94
+ "type": "error"
95
+ },
96
+ {
97
+ "inputs": [
98
+ {
99
+ "internalType": "address",
100
+ "name": "token",
101
+ "type": "address"
102
+ }
103
+ ],
104
+ "name": "SafeERC20FailedOperation",
105
+ "type": "error"
106
+ },
107
+ {
108
+ "inputs": [],
109
+ "name": "TimeInactive",
110
+ "type": "error"
111
+ },
112
+ {
113
+ "inputs": [],
114
+ "name": "UUPSUnauthorizedCallContext",
115
+ "type": "error"
116
+ },
117
+ {
118
+ "inputs": [
119
+ {
120
+ "internalType": "bytes32",
121
+ "name": "slot",
122
+ "type": "bytes32"
123
+ }
124
+ ],
125
+ "name": "UUPSUnsupportedProxiableUUID",
126
+ "type": "error"
127
+ },
128
+ {
129
+ "inputs": [],
130
+ "name": "UnsupportedOperation",
131
+ "type": "error"
132
+ },
133
+ {
134
+ "anonymous": false,
135
+ "inputs": [
136
+ {
137
+ "indexed": false,
138
+ "internalType": "uint64",
139
+ "name": "version",
140
+ "type": "uint64"
141
+ }
142
+ ],
143
+ "name": "Initialized",
144
+ "type": "event"
145
+ },
146
+ {
147
+ "anonymous": false,
148
+ "inputs": [
149
+ {
150
+ "indexed": true,
151
+ "internalType": "address",
152
+ "name": "previousOwner",
153
+ "type": "address"
154
+ },
155
+ {
156
+ "indexed": true,
157
+ "internalType": "address",
158
+ "name": "newOwner",
159
+ "type": "address"
160
+ }
161
+ ],
162
+ "name": "OwnershipTransferred",
163
+ "type": "event"
164
+ },
165
+ {
166
+ "anonymous": false,
167
+ "inputs": [
168
+ {
169
+ "indexed": false,
170
+ "internalType": "address",
171
+ "name": "account",
172
+ "type": "address"
173
+ }
174
+ ],
175
+ "name": "Paused",
176
+ "type": "event"
177
+ },
178
+ {
179
+ "anonymous": false,
180
+ "inputs": [
181
+ {
182
+ "indexed": false,
183
+ "internalType": "address",
184
+ "name": "account",
185
+ "type": "address"
186
+ }
187
+ ],
188
+ "name": "Unpaused",
189
+ "type": "event"
190
+ },
191
+ {
192
+ "anonymous": false,
193
+ "inputs": [
194
+ {
195
+ "indexed": true,
196
+ "internalType": "address",
197
+ "name": "implementation",
198
+ "type": "address"
199
+ }
200
+ ],
201
+ "name": "Upgraded",
202
+ "type": "event"
203
+ },
204
+ {
205
+ "inputs": [],
206
+ "name": "UPGRADE_INTERFACE_VERSION",
207
+ "outputs": [
208
+ {
209
+ "internalType": "string",
210
+ "name": "",
211
+ "type": "string"
212
+ }
213
+ ],
214
+ "stateMutability": "view",
215
+ "type": "function"
216
+ },
217
+ {
218
+ "inputs": [
219
+ {
220
+ "internalType": "address[]",
221
+ "name": "recipients",
222
+ "type": "address[]"
223
+ },
224
+ {
225
+ "internalType": "bytes32[]",
226
+ "name": "userClaimIds",
227
+ "type": "bytes32[]"
228
+ },
229
+ {
230
+ "internalType": "bytes[]",
231
+ "name": "datas",
232
+ "type": "bytes[]"
233
+ },
234
+ {
235
+ "internalType": "bytes[]",
236
+ "name": "signatures",
237
+ "type": "bytes[]"
238
+ },
239
+ {
240
+ "internalType": "bytes[]",
241
+ "name": "extraDatas",
242
+ "type": "bytes[]"
243
+ }
244
+ ],
245
+ "name": "claim",
246
+ "outputs": [],
247
+ "stateMutability": "payable",
248
+ "type": "function"
249
+ },
250
+ {
251
+ "inputs": [
252
+ {
253
+ "internalType": "bytes",
254
+ "name": "userClaimData",
255
+ "type": "bytes"
256
+ }
257
+ ],
258
+ "name": "decodeUserClaimData",
259
+ "outputs": [
260
+ {
261
+ "components": [
262
+ {
263
+ "internalType": "uint256",
264
+ "name": "claimableTimestamp",
265
+ "type": "uint256"
266
+ },
267
+ {
268
+ "internalType": "uint256",
269
+ "name": "claimableAmount",
270
+ "type": "uint256"
271
+ }
272
+ ],
273
+ "internalType": "struct FungibleTokenECDSADistributorData",
274
+ "name": "",
275
+ "type": "tuple"
276
+ }
277
+ ],
278
+ "stateMutability": "pure",
279
+ "type": "function"
280
+ },
281
+ {
282
+ "inputs": [
283
+ {
284
+ "internalType": "bytes32",
285
+ "name": "userClaimId",
286
+ "type": "bytes32"
287
+ },
288
+ {
289
+ "internalType": "bytes",
290
+ "name": "userClaimData",
291
+ "type": "bytes"
292
+ }
293
+ ],
294
+ "name": "encodeHashToBeSigned",
295
+ "outputs": [
296
+ {
297
+ "internalType": "bytes32",
298
+ "name": "",
299
+ "type": "bytes32"
300
+ }
301
+ ],
302
+ "stateMutability": "view",
303
+ "type": "function"
304
+ },
305
+ {
306
+ "inputs": [
307
+ {
308
+ "internalType": "bytes32[]",
309
+ "name": "userClaimIds",
310
+ "type": "bytes32[]"
311
+ }
312
+ ],
313
+ "name": "getClaimStatus",
314
+ "outputs": [
315
+ {
316
+ "internalType": "bool[]",
317
+ "name": "",
318
+ "type": "bool[]"
319
+ }
320
+ ],
321
+ "stateMutability": "view",
322
+ "type": "function"
323
+ },
324
+ {
325
+ "inputs": [],
326
+ "name": "getStorage",
327
+ "outputs": [
328
+ {
329
+ "internalType": "string",
330
+ "name": "version_",
331
+ "type": "string"
332
+ },
333
+ {
334
+ "internalType": "address",
335
+ "name": "owner",
336
+ "type": "address"
337
+ },
338
+ {
339
+ "internalType": "bool",
340
+ "name": "paused",
341
+ "type": "bool"
342
+ },
343
+ {
344
+ "internalType": "address",
345
+ "name": "deployer",
346
+ "type": "address"
347
+ },
348
+ {
349
+ "internalType": "address",
350
+ "name": "authorizedSigner",
351
+ "type": "address"
352
+ },
353
+ {
354
+ "internalType": "address",
355
+ "name": "token",
356
+ "type": "address"
357
+ },
358
+ {
359
+ "internalType": "address",
360
+ "name": "claimHook",
361
+ "type": "address"
362
+ },
363
+ {
364
+ "internalType": "uint256",
365
+ "name": "startTime",
366
+ "type": "uint256"
367
+ },
368
+ {
369
+ "internalType": "uint256",
370
+ "name": "endTime",
371
+ "type": "uint256"
372
+ }
373
+ ],
374
+ "stateMutability": "view",
375
+ "type": "function"
376
+ },
377
+ {
378
+ "inputs": [
379
+ {
380
+ "internalType": "address",
381
+ "name": "owner_",
382
+ "type": "address"
383
+ }
384
+ ],
385
+ "name": "initialize",
386
+ "outputs": [],
387
+ "stateMutability": "nonpayable",
388
+ "type": "function"
389
+ },
390
+ {
391
+ "inputs": [],
392
+ "name": "owner",
393
+ "outputs": [
394
+ {
395
+ "internalType": "address",
396
+ "name": "",
397
+ "type": "address"
398
+ }
399
+ ],
400
+ "stateMutability": "view",
401
+ "type": "function"
402
+ },
403
+ {
404
+ "inputs": [],
405
+ "name": "paused",
406
+ "outputs": [
407
+ {
408
+ "internalType": "bool",
409
+ "name": "",
410
+ "type": "bool"
411
+ }
412
+ ],
413
+ "stateMutability": "view",
414
+ "type": "function"
415
+ },
416
+ {
417
+ "inputs": [],
418
+ "name": "proxiableUUID",
419
+ "outputs": [
420
+ {
421
+ "internalType": "bytes32",
422
+ "name": "",
423
+ "type": "bytes32"
424
+ }
425
+ ],
426
+ "stateMutability": "view",
427
+ "type": "function"
428
+ },
429
+ {
430
+ "inputs": [],
431
+ "name": "renounceOwnership",
432
+ "outputs": [],
433
+ "stateMutability": "nonpayable",
434
+ "type": "function"
435
+ },
436
+ {
437
+ "inputs": [
438
+ {
439
+ "internalType": "address",
440
+ "name": "token",
441
+ "type": "address"
442
+ },
443
+ {
444
+ "internalType": "uint256",
445
+ "name": "startTime",
446
+ "type": "uint256"
447
+ },
448
+ {
449
+ "internalType": "uint256",
450
+ "name": "endTime",
451
+ "type": "uint256"
452
+ },
453
+ {
454
+ "internalType": "address",
455
+ "name": "authorizedSigner",
456
+ "type": "address"
457
+ }
458
+ ],
459
+ "name": "setBaseParams",
460
+ "outputs": [],
461
+ "stateMutability": "nonpayable",
462
+ "type": "function"
463
+ },
464
+ {
465
+ "inputs": [
466
+ {
467
+ "internalType": "address",
468
+ "name": "hook",
469
+ "type": "address"
470
+ }
471
+ ],
472
+ "name": "setClaimHook",
473
+ "outputs": [],
474
+ "stateMutability": "nonpayable",
475
+ "type": "function"
476
+ },
477
+ {
478
+ "inputs": [],
479
+ "name": "togglePause",
480
+ "outputs": [],
481
+ "stateMutability": "nonpayable",
482
+ "type": "function"
483
+ },
484
+ {
485
+ "inputs": [
486
+ {
487
+ "internalType": "address",
488
+ "name": "newOwner",
489
+ "type": "address"
490
+ }
491
+ ],
492
+ "name": "transferOwnership",
493
+ "outputs": [],
494
+ "stateMutability": "nonpayable",
495
+ "type": "function"
496
+ },
497
+ {
498
+ "inputs": [
499
+ {
500
+ "internalType": "address",
501
+ "name": "newImplementation",
502
+ "type": "address"
503
+ },
504
+ {
505
+ "internalType": "bytes",
506
+ "name": "data",
507
+ "type": "bytes"
508
+ }
509
+ ],
510
+ "name": "upgradeToAndCall",
511
+ "outputs": [],
512
+ "stateMutability": "payable",
513
+ "type": "function"
514
+ },
515
+ {
516
+ "inputs": [
517
+ {
518
+ "internalType": "address",
519
+ "name": "signer",
520
+ "type": "address"
521
+ },
522
+ {
523
+ "internalType": "bytes32",
524
+ "name": "hash",
525
+ "type": "bytes32"
526
+ },
527
+ {
528
+ "internalType": "bytes",
529
+ "name": "signature",
530
+ "type": "bytes"
531
+ }
532
+ ],
533
+ "name": "verify",
534
+ "outputs": [],
535
+ "stateMutability": "view",
536
+ "type": "function"
537
+ },
538
+ {
539
+ "inputs": [],
540
+ "name": "version",
541
+ "outputs": [
542
+ {
543
+ "internalType": "string",
544
+ "name": "",
545
+ "type": "string"
546
+ }
547
+ ],
548
+ "stateMutability": "pure",
549
+ "type": "function"
550
+ },
551
+ {
552
+ "inputs": [
553
+ {
554
+ "internalType": "bytes",
555
+ "name": "",
556
+ "type": "bytes"
557
+ }
558
+ ],
559
+ "name": "withdraw",
560
+ "outputs": [],
561
+ "stateMutability": "nonpayable",
562
+ "type": "function"
563
+ }
564
+ ]
@@ -136,6 +136,7 @@ export type IAirdropService = TonAirdropService | EvmAirdropService;
136
136
 
137
137
  type BaseAirdropOptions = {
138
138
  endpoint?: string;
139
+ project?: IProject;
139
140
  };
140
141
 
141
142
  type ProjectIdOptions = BaseAirdropOptions & {