@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,44 @@
1
+ import ABI from './abis/FungibleTokenECDSADistributor.json';
2
+ import { ContractBaseClient } from './ContractBaseClient';
3
+ export class AirdropSignatureClient extends ContractBaseClient {
4
+ constructor(options) {
5
+ super({
6
+ ...options,
7
+ abi: ABI
8
+ });
9
+ }
10
+ async getClaimStatus(userClaimId) {
11
+ return this.readContract({ functionName: 'getClaimStatus', args: [userClaimId] });
12
+ }
13
+ async claim(data, value) {
14
+ const [recipients = [], userClaimIds = [], datas = [], signatures = [], extraDatas = []] = [
15
+ 'recipient',
16
+ 'claimId',
17
+ 'data',
18
+ 'signature',
19
+ 'extraData'
20
+ ].map((key) => data.map((item) => item[key] || ''));
21
+ return this.writeContract({
22
+ functionName: 'claim',
23
+ args: [recipients, userClaimIds, datas, signatures, extraDatas],
24
+ value: value || 0n
25
+ });
26
+ }
27
+ async batchFetchClaimed(userClaimIds) {
28
+ // return this.multiCall({
29
+ // chainId: this.chainId as any,
30
+ // contracts: userClaimIds?.map((userClaimId) => {
31
+ // return {
32
+ // address: this.contractAddress,
33
+ // abi: this.abi,
34
+ // functionName: 'getClaimStatus',
35
+ // args: [userClaimId]
36
+ // };
37
+ // })
38
+ // });
39
+ }
40
+ async getDeployer() {
41
+ return this.readContract({ functionName: 'getDeployer' });
42
+ }
43
+ }
44
+ //# sourceMappingURL=AirdropSignatureClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AirdropSignatureClient.js","sourceRoot":"","sources":["../../../../../../src/airdrop/core/evm/contracts/AirdropSignatureClient.ts"],"names":[],"mappings":"AACA,OAAO,GAAG,MAAM,2CAA2C,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,MAAM,OAAO,sBAAuB,SAAQ,kBAAkB;IAC5D,YAAY,OAAgC;QAC1C,KAAK,CAAC;YACJ,GAAG,OAAO;YACV,GAAG,EAAE,GAAG;SACT,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,cAAc,CAAC,WAAmB;QACtC,OAAO,IAAI,CAAC,YAAY,CAAC,EAAE,YAAY,EAAE,gBAAgB,EAAE,IAAI,EAAE,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;IACpF,CAAC;IAED,KAAK,CAAC,KAAK,CACT,IAMG,EACH,KAAc;QAEd,MAAM,CAAC,UAAU,GAAG,EAAE,EAAE,YAAY,GAAG,EAAE,EAAE,KAAK,GAAG,EAAE,EAAE,UAAU,GAAG,EAAE,EAAE,UAAU,GAAG,EAAE,CAAC,GAAG;YACzF,WAAW;YACX,SAAS;YACT,MAAM;YACN,WAAW;YACX,WAAW;SACZ,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,GAA6B,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;QAE9E,OAAO,IAAI,CAAC,aAAa,CAAC;YACxB,YAAY,EAAE,OAAO;YACrB,IAAI,EAAE,CAAC,UAAU,EAAE,YAAY,EAAE,KAAK,EAAE,UAAU,EAAE,UAAU,CAAC;YAC/D,KAAK,EAAE,KAAK,IAAI,EAAE;SACnB,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,iBAAiB,CAAC,YAAsB;QAC5C,0BAA0B;QAC1B,kCAAkC;QAClC,oDAAoD;QACpD,eAAe;QACf,uCAAuC;QACvC,uBAAuB;QACvB,wCAAwC;QACxC,4BAA4B;QAC5B,SAAS;QACT,OAAO;QACP,MAAM;IACR,CAAC;IAED,KAAK,CAAC,WAAW;QACf,OAAO,IAAI,CAAC,YAAY,CAAC,EAAE,YAAY,EAAE,aAAa,EAAE,CAAoB,CAAC;IAC/E,CAAC;CACF"}
@@ -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
+ ]
@@ -116,6 +116,7 @@ export type IWalletClient = TonConnectUI | ViemWalletClient;
116
116
  export type IAirdropService = TonAirdropService | EvmAirdropService;
117
117
  type BaseAirdropOptions = {
118
118
  endpoint?: string;
119
+ project?: IProject;
119
120
  };
120
121
  type ProjectIdOptions = BaseAirdropOptions & {
121
122
  projectId: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sign-global/tokentable",
3
- "version": "0.4.0-beta.1",
3
+ "version": "0.4.0-beta.2",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -34,7 +34,7 @@
34
34
  "dayjs": "^1.11.13",
35
35
  "jest": "^29.7.0",
36
36
  "nanoid": "^5.0.9",
37
- "react": "^19.0.0",
37
+ "react": "^18.2.0",
38
38
  "ton-core": "^0.53.0",
39
39
  "tonapi-sdk-js": "^2.0.3",
40
40
  "tonweb": "^0.0.66",
@@ -43,7 +43,7 @@
43
43
  "wagmi": "^2.13.0"
44
44
  },
45
45
  "devDependencies": {
46
- "@types/react": "^19.0.8",
46
+ "@types/react": "^18.2.0",
47
47
  "bun-types": "latest",
48
48
  "typescript": "^5.6.3"
49
49
  }
@@ -32,7 +32,11 @@ export class AirdropClient {
32
32
  }
33
33
  this.projectId = params.projectId;
34
34
  this.endpoint = params.endpoint;
35
- this.projectPromise = this.initializeProjects();
35
+ if (this.project) {
36
+ this.project = params.project;
37
+ } else {
38
+ this.projectPromise = this.initializeProjects();
39
+ }
36
40
  }
37
41
 
38
42
  setTonClient(tonClient: TonClient) {
@@ -84,7 +88,9 @@ export class AirdropClient {
84
88
  }
85
89
 
86
90
  async getProjectInfo() {
87
- await this.projectPromise;
91
+ if (this.projectPromise) {
92
+ await this.projectPromise;
93
+ }
88
94
  if (!this.project) throw new Error('Project not found');
89
95
  return this.project;
90
96
  }
@@ -13,7 +13,7 @@ export class SignatureAirdropClient {
13
13
  private projectPromise: Promise<void> | undefined;
14
14
  private claimHook: ((v: any) => any) | undefined;
15
15
  // private contractConfig: IContractConfig | null = null;
16
- constructor(params: IAirdropOptions & { project?: IProject }) {
16
+ constructor(params: IAirdropOptions) {
17
17
  if ('slug' in params) {
18
18
  this.slug = params.slug;
19
19
  }