@sign-global/tokentable 0.4.1-beta.5 → 0.4.1-beta.6

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 (53) hide show
  1. package/dist/cjs/airdrop/SignatureAirdropClient.d.ts +1 -1
  2. package/dist/cjs/airdrop/SignatureAirdropClient.js +3 -2
  3. package/dist/cjs/airdrop/SignatureAirdropClient.js.map +1 -1
  4. package/dist/cjs/airdrop/contracts/solana/AirdropSignatureClient.d.ts +7 -2
  5. package/dist/cjs/airdrop/contracts/solana/AirdropSignatureClient.js +23 -9
  6. package/dist/cjs/airdrop/contracts/solana/AirdropSignatureClient.js.map +1 -1
  7. package/dist/cjs/airdrop/contracts/solana/FeeCollectorClient.d.ts +2 -2
  8. package/dist/cjs/airdrop/contracts/solana/FeeCollectorClient.js +11 -7
  9. package/dist/cjs/airdrop/contracts/solana/FeeCollectorClient.js.map +1 -1
  10. package/dist/cjs/airdrop/contracts/solana/SignatureAirdropService.d.ts +1 -1
  11. package/dist/cjs/airdrop/contracts/solana/SignatureAirdropService.js +1 -1
  12. package/dist/cjs/airdrop/contracts/solana/SignatureAirdropService.js.map +1 -1
  13. package/dist/cjs/airdrop/contracts/solana/SolanaContractClient.d.ts +2 -1
  14. package/dist/cjs/airdrop/contracts/solana/SolanaContractClient.js +10 -4
  15. package/dist/cjs/airdrop/contracts/solana/SolanaContractClient.js.map +1 -1
  16. package/dist/cjs/airdrop/contracts/solana/fee_collector.d.ts +78 -11
  17. package/dist/cjs/airdrop/contracts/solana/fee_collector.json +78 -11
  18. package/dist/cjs/airdrop/contracts/solana/fungible_token_distributor_solana.d.ts +56 -1
  19. package/dist/cjs/airdrop/contracts/solana/fungible_token_distributor_solana.json +56 -1
  20. package/dist/cjs/wallets/providers/evm/EvmWallet.js +27 -17
  21. package/dist/cjs/wallets/providers/evm/EvmWallet.js.map +1 -1
  22. package/dist/esm/airdrop/SignatureAirdropClient.d.ts +1 -1
  23. package/dist/esm/airdrop/SignatureAirdropClient.js +3 -2
  24. package/dist/esm/airdrop/SignatureAirdropClient.js.map +1 -1
  25. package/dist/esm/airdrop/contracts/solana/AirdropSignatureClient.d.ts +7 -2
  26. package/dist/esm/airdrop/contracts/solana/AirdropSignatureClient.js +23 -9
  27. package/dist/esm/airdrop/contracts/solana/AirdropSignatureClient.js.map +1 -1
  28. package/dist/esm/airdrop/contracts/solana/FeeCollectorClient.d.ts +2 -2
  29. package/dist/esm/airdrop/contracts/solana/FeeCollectorClient.js +11 -7
  30. package/dist/esm/airdrop/contracts/solana/FeeCollectorClient.js.map +1 -1
  31. package/dist/esm/airdrop/contracts/solana/SignatureAirdropService.d.ts +1 -1
  32. package/dist/esm/airdrop/contracts/solana/SignatureAirdropService.js +1 -1
  33. package/dist/esm/airdrop/contracts/solana/SignatureAirdropService.js.map +1 -1
  34. package/dist/esm/airdrop/contracts/solana/SolanaContractClient.d.ts +2 -1
  35. package/dist/esm/airdrop/contracts/solana/SolanaContractClient.js +10 -4
  36. package/dist/esm/airdrop/contracts/solana/SolanaContractClient.js.map +1 -1
  37. package/dist/esm/airdrop/contracts/solana/fee_collector.d.ts +78 -11
  38. package/dist/esm/airdrop/contracts/solana/fee_collector.json +78 -11
  39. package/dist/esm/airdrop/contracts/solana/fungible_token_distributor_solana.d.ts +56 -1
  40. package/dist/esm/airdrop/contracts/solana/fungible_token_distributor_solana.json +56 -1
  41. package/dist/esm/wallets/providers/evm/EvmWallet.js +27 -17
  42. package/dist/esm/wallets/providers/evm/EvmWallet.js.map +1 -1
  43. package/package.json +1 -1
  44. package/src/airdrop/SignatureAirdropClient.ts +3 -2
  45. package/src/airdrop/contracts/solana/AirdropSignatureClient.ts +26 -9
  46. package/src/airdrop/contracts/solana/FeeCollectorClient.ts +10 -7
  47. package/src/airdrop/contracts/solana/SignatureAirdropService.ts +2 -2
  48. package/src/airdrop/contracts/solana/SolanaContractClient.ts +19 -11
  49. package/src/airdrop/contracts/solana/fee_collector.json +78 -11
  50. package/src/airdrop/contracts/solana/fee_collector.ts +78 -11
  51. package/src/airdrop/contracts/solana/fungible_token_distributor_solana.json +56 -1
  52. package/src/airdrop/contracts/solana/fungible_token_distributor_solana.ts +56 -1
  53. package/src/wallets/providers/evm/EvmWallet.ts +27 -19
@@ -46,6 +46,11 @@ export type FeeCollector = {
46
46
  ];
47
47
  };
48
48
  },
49
+ {
50
+ "name": "feeTokenMint";
51
+ "writable": true;
52
+ "optional": true;
53
+ },
49
54
  {
50
55
  "name": "vault";
51
56
  "writable": true;
@@ -71,7 +76,6 @@ export type FeeCollector = {
71
76
  },
72
77
  {
73
78
  "name": "fee";
74
- "writable": true;
75
79
  "pda": {
76
80
  "seeds": [
77
81
  {
@@ -247,7 +251,6 @@ export type FeeCollector = {
247
251
  },
248
252
  {
249
253
  "name": "fee";
250
- "writable": true;
251
254
  "pda": {
252
255
  "seeds": [
253
256
  {
@@ -264,15 +267,6 @@ export type FeeCollector = {
264
267
  }
265
268
  ];
266
269
  };
267
- },
268
- {
269
- "name": "authority";
270
- "writable": true;
271
- "signer": true;
272
- },
273
- {
274
- "name": "systemProgram";
275
- "address": "11111111111111111111111111111111";
276
270
  }
277
271
  ];
278
272
  "args": [
@@ -366,6 +360,75 @@ export type FeeCollector = {
366
360
  }
367
361
  ];
368
362
  },
363
+ {
364
+ "name": "initProjectFee";
365
+ "discriminator": [
366
+ 21,
367
+ 68,
368
+ 31,
369
+ 251,
370
+ 143,
371
+ 139,
372
+ 107,
373
+ 64
374
+ ];
375
+ "accounts": [
376
+ {
377
+ "name": "storage";
378
+ "pda": {
379
+ "seeds": [
380
+ {
381
+ "kind": "const";
382
+ "value": [
383
+ 115,
384
+ 116,
385
+ 111,
386
+ 114,
387
+ 97,
388
+ 103,
389
+ 101
390
+ ];
391
+ }
392
+ ];
393
+ };
394
+ },
395
+ {
396
+ "name": "fee";
397
+ "writable": true;
398
+ "pda": {
399
+ "seeds": [
400
+ {
401
+ "kind": "const";
402
+ "value": [
403
+ 102,
404
+ 101,
405
+ 101
406
+ ];
407
+ },
408
+ {
409
+ "kind": "arg";
410
+ "path": "projectId";
411
+ }
412
+ ];
413
+ };
414
+ },
415
+ {
416
+ "name": "authority";
417
+ "writable": true;
418
+ "signer": true;
419
+ },
420
+ {
421
+ "name": "systemProgram";
422
+ "address": "11111111111111111111111111111111";
423
+ }
424
+ ];
425
+ "args": [
426
+ {
427
+ "name": "projectId";
428
+ "type": "string";
429
+ }
430
+ ];
431
+ },
369
432
  {
370
433
  "name": "initialize";
371
434
  "discriminator": [
@@ -1021,6 +1084,10 @@ export type FeeCollector = {
1021
1084
  "type": {
1022
1085
  "kind": "struct";
1023
1086
  "fields": [
1087
+ {
1088
+ "name": "default";
1089
+ "type": "bool";
1090
+ },
1024
1091
  {
1025
1092
  "name": "bips";
1026
1093
  "type": "u64";
@@ -40,6 +40,11 @@
40
40
  ]
41
41
  }
42
42
  },
43
+ {
44
+ "name": "fee_token_mint",
45
+ "writable": true,
46
+ "optional": true
47
+ },
43
48
  {
44
49
  "name": "vault",
45
50
  "writable": true,
@@ -65,7 +70,6 @@
65
70
  },
66
71
  {
67
72
  "name": "fee",
68
- "writable": true,
69
73
  "pda": {
70
74
  "seeds": [
71
75
  {
@@ -241,7 +245,6 @@
241
245
  },
242
246
  {
243
247
  "name": "fee",
244
- "writable": true,
245
248
  "pda": {
246
249
  "seeds": [
247
250
  {
@@ -258,15 +261,6 @@
258
261
  }
259
262
  ]
260
263
  }
261
- },
262
- {
263
- "name": "authority",
264
- "writable": true,
265
- "signer": true
266
- },
267
- {
268
- "name": "system_program",
269
- "address": "11111111111111111111111111111111"
270
264
  }
271
265
  ],
272
266
  "args": [
@@ -360,6 +354,75 @@
360
354
  }
361
355
  ]
362
356
  },
357
+ {
358
+ "name": "init_project_fee",
359
+ "discriminator": [
360
+ 21,
361
+ 68,
362
+ 31,
363
+ 251,
364
+ 143,
365
+ 139,
366
+ 107,
367
+ 64
368
+ ],
369
+ "accounts": [
370
+ {
371
+ "name": "storage",
372
+ "pda": {
373
+ "seeds": [
374
+ {
375
+ "kind": "const",
376
+ "value": [
377
+ 115,
378
+ 116,
379
+ 111,
380
+ 114,
381
+ 97,
382
+ 103,
383
+ 101
384
+ ]
385
+ }
386
+ ]
387
+ }
388
+ },
389
+ {
390
+ "name": "fee",
391
+ "writable": true,
392
+ "pda": {
393
+ "seeds": [
394
+ {
395
+ "kind": "const",
396
+ "value": [
397
+ 102,
398
+ 101,
399
+ 101
400
+ ]
401
+ },
402
+ {
403
+ "kind": "arg",
404
+ "path": "_project_id"
405
+ }
406
+ ]
407
+ }
408
+ },
409
+ {
410
+ "name": "authority",
411
+ "writable": true,
412
+ "signer": true
413
+ },
414
+ {
415
+ "name": "system_program",
416
+ "address": "11111111111111111111111111111111"
417
+ }
418
+ ],
419
+ "args": [
420
+ {
421
+ "name": "project_id",
422
+ "type": "string"
423
+ }
424
+ ]
425
+ },
363
426
  {
364
427
  "name": "initialize",
365
428
  "discriminator": [
@@ -1015,6 +1078,10 @@
1015
1078
  "type": {
1016
1079
  "kind": "struct",
1017
1080
  "fields": [
1081
+ {
1082
+ "name": "default",
1083
+ "type": "bool"
1084
+ },
1018
1085
  {
1019
1086
  "name": "bips",
1020
1087
  "type": "u64"
@@ -216,7 +216,12 @@ export type FungibleTokenDistributorSolana = {
216
216
  "address": "4dfP4CMvznzUuuYLhybXy71zasrhtjrFkChSFjtqS3on";
217
217
  },
218
218
  {
219
- "name": "userFee";
219
+ "name": "feeTokenMint";
220
+ "writable": true;
221
+ "optional": true;
222
+ },
223
+ {
224
+ "name": "fee";
220
225
  "writable": true;
221
226
  },
222
227
  {
@@ -495,6 +500,20 @@ export type FungibleTokenDistributorSolana = {
495
500
  ];
496
501
  };
497
502
  },
503
+ {
504
+ "name": "feeCollector";
505
+ "optional": true;
506
+ "address": "4dfP4CMvznzUuuYLhybXy71zasrhtjrFkChSFjtqS3on";
507
+ },
508
+ {
509
+ "name": "feeCollectorStorage";
510
+ "optional": true;
511
+ },
512
+ {
513
+ "name": "fee";
514
+ "writable": true;
515
+ "optional": true;
516
+ },
498
517
  {
499
518
  "name": "authority";
500
519
  "writable": true;
@@ -510,6 +529,10 @@ export type FungibleTokenDistributorSolana = {
510
529
  "name": "projectId";
511
530
  "type": "string";
512
531
  },
532
+ {
533
+ "name": "projectToken";
534
+ "type": "pubkey";
535
+ },
513
536
  {
514
537
  "name": "owner";
515
538
  "type": "pubkey";
@@ -517,6 +540,10 @@ export type FungibleTokenDistributorSolana = {
517
540
  {
518
541
  "name": "feeCollector";
519
542
  "type": "pubkey";
543
+ },
544
+ {
545
+ "name": "initFeeAccount";
546
+ "type": "bool";
520
547
  }
521
548
  ];
522
549
  },
@@ -650,6 +677,20 @@ export type FungibleTokenDistributorSolana = {
650
677
  ];
651
678
  };
652
679
  },
680
+ {
681
+ "name": "feeCollector";
682
+ "optional": true;
683
+ "address": "4dfP4CMvznzUuuYLhybXy71zasrhtjrFkChSFjtqS3on";
684
+ },
685
+ {
686
+ "name": "feeCollectorStorage";
687
+ "optional": true;
688
+ },
689
+ {
690
+ "name": "fee";
691
+ "writable": true;
692
+ "optional": true;
693
+ },
653
694
  {
654
695
  "name": "systemProgram";
655
696
  "address": "11111111111111111111111111111111";
@@ -663,6 +704,10 @@ export type FungibleTokenDistributorSolana = {
663
704
  {
664
705
  "name": "feeCollector";
665
706
  "type": "pubkey";
707
+ },
708
+ {
709
+ "name": "initFeeAccount";
710
+ "type": "bool";
666
711
  }
667
712
  ];
668
713
  },
@@ -838,6 +883,11 @@ export type FungibleTokenDistributorSolana = {
838
883
  "writable": true;
839
884
  "signer": true;
840
885
  },
886
+ {
887
+ "name": "newOwner";
888
+ "writable": true;
889
+ "signer": true;
890
+ },
841
891
  {
842
892
  "name": "systemProgram";
843
893
  "address": "11111111111111111111111111111111";
@@ -891,6 +941,11 @@ export type FungibleTokenDistributorSolana = {
891
941
  "writable": true;
892
942
  "signer": true;
893
943
  },
944
+ {
945
+ "name": "newAdmin";
946
+ "writable": true;
947
+ "signer": true;
948
+ },
894
949
  {
895
950
  "name": "systemProgram";
896
951
  "address": "11111111111111111111111111111111";
@@ -210,7 +210,12 @@
210
210
  "address": "4dfP4CMvznzUuuYLhybXy71zasrhtjrFkChSFjtqS3on"
211
211
  },
212
212
  {
213
- "name": "user_fee",
213
+ "name": "fee_token_mint",
214
+ "writable": true,
215
+ "optional": true
216
+ },
217
+ {
218
+ "name": "fee",
214
219
  "writable": true
215
220
  },
216
221
  {
@@ -489,6 +494,20 @@
489
494
  ]
490
495
  }
491
496
  },
497
+ {
498
+ "name": "fee_collector",
499
+ "optional": true,
500
+ "address": "4dfP4CMvznzUuuYLhybXy71zasrhtjrFkChSFjtqS3on"
501
+ },
502
+ {
503
+ "name": "fee_collector_storage",
504
+ "optional": true
505
+ },
506
+ {
507
+ "name": "fee",
508
+ "writable": true,
509
+ "optional": true
510
+ },
492
511
  {
493
512
  "name": "authority",
494
513
  "writable": true,
@@ -504,6 +523,10 @@
504
523
  "name": "project_id",
505
524
  "type": "string"
506
525
  },
526
+ {
527
+ "name": "project_token",
528
+ "type": "pubkey"
529
+ },
507
530
  {
508
531
  "name": "owner",
509
532
  "type": "pubkey"
@@ -511,6 +534,10 @@
511
534
  {
512
535
  "name": "fee_collector",
513
536
  "type": "pubkey"
537
+ },
538
+ {
539
+ "name": "init_fee_account",
540
+ "type": "bool"
514
541
  }
515
542
  ]
516
543
  },
@@ -644,6 +671,20 @@
644
671
  ]
645
672
  }
646
673
  },
674
+ {
675
+ "name": "fee_collector",
676
+ "optional": true,
677
+ "address": "4dfP4CMvznzUuuYLhybXy71zasrhtjrFkChSFjtqS3on"
678
+ },
679
+ {
680
+ "name": "fee_collector_storage",
681
+ "optional": true
682
+ },
683
+ {
684
+ "name": "fee",
685
+ "writable": true,
686
+ "optional": true
687
+ },
647
688
  {
648
689
  "name": "system_program",
649
690
  "address": "11111111111111111111111111111111"
@@ -657,6 +698,10 @@
657
698
  {
658
699
  "name": "fee_collector",
659
700
  "type": "pubkey"
701
+ },
702
+ {
703
+ "name": "init_fee_account",
704
+ "type": "bool"
660
705
  }
661
706
  ]
662
707
  },
@@ -832,6 +877,11 @@
832
877
  "writable": true,
833
878
  "signer": true
834
879
  },
880
+ {
881
+ "name": "new_owner",
882
+ "writable": true,
883
+ "signer": true
884
+ },
835
885
  {
836
886
  "name": "system_program",
837
887
  "address": "11111111111111111111111111111111"
@@ -885,6 +935,11 @@
885
935
  "writable": true,
886
936
  "signer": true
887
937
  },
938
+ {
939
+ "name": "new_admin",
940
+ "writable": true,
941
+ "signer": true
942
+ },
888
943
  {
889
944
  "name": "system_program",
890
945
  "address": "11111111111111111111111111111111"
@@ -25,26 +25,36 @@ export class EvmWallet extends WalletBase {
25
25
  await disconnect(evmStore.config);
26
26
  }
27
27
  async sign(_message) {
28
- const sign = await signMessage(evmStore.config, {
29
- message: _message
30
- });
31
- return {
32
- message: _message,
33
- signature: sign
34
- };
28
+ try {
29
+ const sign = await signMessage(evmStore.config, {
30
+ message: _message
31
+ });
32
+ return {
33
+ message: _message,
34
+ signature: sign
35
+ };
36
+ }
37
+ catch (error) {
38
+ throw error;
39
+ }
35
40
  }
36
41
  async signin(statement, prepare = true) {
37
- return new Promise((resolve) => {
38
- const signCallback = (data) => {
39
- this.address = data.address;
40
- this.chainId = data.chainId;
41
- let fullMessage = statement;
42
- if (prepare) {
43
- const msg = prepareSignMessage({ statement, chainId: data.chainId, address: data.address });
44
- fullMessage = get4361Message(msg);
42
+ return new Promise((resolve, reject) => {
43
+ const signCallback = async (data) => {
44
+ try {
45
+ this.address = data.address;
46
+ this.chainId = data.chainId;
47
+ let fullMessage = statement;
48
+ if (prepare) {
49
+ const msg = prepareSignMessage({ statement, chainId: data.chainId, address: data.address });
50
+ fullMessage = get4361Message(msg);
51
+ }
52
+ const res = await this.sign(fullMessage);
53
+ resolve(res);
54
+ }
55
+ catch (error) {
56
+ reject(error);
45
57
  }
46
- const res = this.sign(fullMessage);
47
- resolve(res);
48
58
  };
49
59
  const account = getAccount(evmStore.config);
50
60
  this.provider = evmStore.walletClient;
@@ -1 +1 @@
1
- {"version":3,"file":"EvmWallet.js","sourceRoot":"","sources":["../../../../../src/wallets/providers/evm/EvmWallet.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAEtC,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEjE,MAAM,CAAC,MAAM,QAAQ,GAAG,IAAI,YAAY,EAAE,CAAC;AAE3C,MAAM,aAAa,GAAG,YAAY,CAAC;AAUnC,MAAM,CAAC,MAAM,QAAQ,GAAiB;IACpC,OAAO,EAAE,IAAI;IACb,YAAY,EAAE,SAAS;IACvB,YAAY,EAAE,SAAS;IACvB,MAAM,EAAE,SAAS;IACjB,OAAO,EAAE,CAAC;CACX,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAG,GAAG,EAAE;IAC9B,OAAO,GAAG,aAAa,IAAI,QAAQ,CAAC,OAAO,EAAE,CAAC;AAChD,CAAC,CAAC;AAEF,MAAM,OAAO,SAAU,SAAQ,UAAwB;IACrD,IAAI,WAAW;QACb,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,IAAI,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;IACxE,CAAC;IAED,OAAO;QACL,QAAQ,EAAE,YAAY,EAAE,gBAAgB,EAAE,EAAE,CAAC;IAC/C,CAAC;IAED,KAAK,CAAC,UAAU;QACd,MAAM,UAAU,CAAC,QAAQ,CAAC,MAAO,CAAC,CAAC;IACrC,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,QAAgB;QACzB,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC,QAAQ,CAAC,MAAO,EAAE;YA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,QAAQ,CAAC,MAAO,CAAC,CAAC;YAC7C,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC;YAEtC,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;gBACrB,YAAY,CAAC,OAAO,CAAC,CAAC;gBACtB,OAAO;YACT,CAAC;YAED,QAAQ,CAAC,OAAO,EAAE,CAAC;YACnB,IAAI,CAAC,OAAO,EAAE,CAAC;YACf,MAAM,QAAQ,GAAG,WAAW,EAAE,CAAC;YAC/B,QAAQ,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,EAAE;gBAC/B,OAAO,CAAC,GAAG,CAAC,qDAAqD,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC;gBACnF,YAAY,CAAC,IAAI,CAAC,CAAC;YACrB,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;IAED,QAAQ;QACN,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sign-global/tokentable",
3
- "version": "0.4.1-beta.5",
3
+ "version": "0.4.1-beta.6",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -247,8 +247,9 @@ export class SignatureAirdropClient {
247
247
  return strategy.getVersion();
248
248
  }
249
249
 
250
- async getClaimFee(amount?: bigint): Promise<undefined | bigint | string> {
251
- const strategy = await this.getStrategy();
250
+ // solana prams need to wallet
251
+ async getClaimFee(amount?: bigint, walletClient?: IWalletClient): Promise<undefined | bigint> {
252
+ const strategy = await this.getStrategy(walletClient);
252
253
  if (!strategy.getClaimFee) {
253
254
  throw new Error('getClaimFee is not supported for this chain');
254
255
  }
@@ -17,8 +17,16 @@ export class AirdropSignatureClient extends SolanaContractClientBase<FungibleTok
17
17
  this.projectId = options.projectId;
18
18
  }
19
19
 
20
- getVersion() {
21
- return '1.0.0';
20
+ async getVersionPDA(): Promise<PublicKey> {
21
+ const [versionPDA] = await this.findProgramAddress([anchor.utils.bytes.utf8.encode('version')]);
22
+
23
+ return versionPDA;
24
+ }
25
+
26
+ async getVersion() {
27
+ const versionPDA = await this.getVersionPDA();
28
+ const versionData = await this.fetchAccountData('version', versionPDA);
29
+ return versionData.version;
22
30
  }
23
31
 
24
32
  get FeeCollector() {
@@ -29,8 +37,8 @@ export class AirdropSignatureClient extends SolanaContractClientBase<FungibleTok
29
37
  });
30
38
  }
31
39
 
32
- async getClaimFee() {
33
- return this.FeeCollector.getClaimFee();
40
+ async getClaimFee(amount: bigint) {
41
+ return this.FeeCollector.getClaimFee(amount.toString());
34
42
  }
35
43
 
36
44
  async getStoragePDA(): Promise<PublicKey> {
@@ -137,6 +145,15 @@ export class AirdropSignatureClient extends SolanaContractClientBase<FungibleTok
137
145
  await this.invokeInstruction('togglePause', {}, [this.projectId]);
138
146
  }
139
147
 
148
+ async getFeeInfo() {
149
+ const airdropPDA = await this.getAirdropPDA();
150
+ const config = await this.fetchAccountData('airdrop', airdropPDA);
151
+ return {
152
+ feeToken: config.feeToken.toString(),
153
+ feeCollector: config.feeCollector.toString()
154
+ };
155
+ }
156
+
140
157
  async claim(
141
158
  data: {
142
159
  recipient: string;
@@ -152,7 +169,7 @@ export class AirdropSignatureClient extends SolanaContractClientBase<FungibleTok
152
169
  const config = await this.getContractInfo();
153
170
 
154
171
  const feeCollectorStoragePDA = await this.FeeCollector.getStoragePDA();
155
- const userFeePDA = await this.FeeCollector.getUserFeePDA();
172
+ const feePDA = await this.FeeCollector.getProjectFeePDA();
156
173
  const airdropPDA = await this.getAirdropPDA();
157
174
  const vaultPDA = await this.getVaultPDA();
158
175
 
@@ -196,18 +213,18 @@ export class AirdropSignatureClient extends SolanaContractClientBase<FungibleTok
196
213
  authority: this.wallet.publicKey,
197
214
  airdrop: airdropPDA,
198
215
  claim: claimPDA,
199
- vault: vaultPDA,
216
+ // vault: vaultPDA,
200
217
  authorityAta: authorityATA.address,
201
218
  tokenMint: new PublicKey(config.token),
202
219
  feeCollectorStorage: feeCollectorStoragePDA,
203
220
  feeCollectorVault: null,
204
- userFee: userFeePDA,
221
+ fee: feePDA,
205
222
  authorityFeeAta: null,
206
- tokenProgram: TOKEN_2022_PROGRAM_ID
223
+ tokenProgram: TOKEN_2022_PROGRAM_ID,
224
+ feeTokenMint: null
207
225
  })
208
226
  .transaction()
209
227
  );
210
- console.log(tx);
211
228
  }
212
229
 
213
230
  return await this.program.provider.sendAndConfirm?.(tx);
@@ -20,21 +20,24 @@ export class FeeCollectorClient extends SolanaContractClientBase<FeeCollector> {
20
20
  return storagePDA;
21
21
  }
22
22
 
23
- async getUserFeePDA(): Promise<PublicKey> {
24
- const [userFeePDA] = await this.findProgramAddress([
23
+ async getProjectFeePDA(): Promise<PublicKey> {
24
+ const [projectFeePDA] = await this.findProgramAddress([
25
25
  anchor.utils.bytes.utf8.encode('fee'),
26
26
  anchor.utils.bytes.utf8.encode(this.projectId)
27
27
  ]);
28
- return userFeePDA;
28
+ return projectFeePDA;
29
29
  }
30
30
 
31
31
  async setDefaultFee(fee: string) {
32
32
  return this.invokeInstruction('setDefaultFee', {}, [new anchor.BN(fee)]);
33
33
  }
34
34
 
35
- async getClaimFee(): Promise<string> {
36
- const storagePDA = await this.getStoragePDA();
37
- const storageData = await this.program.account.feeCollectorStorage.fetch(storagePDA);
38
- return storageData.defaultFeesBips.toString();
35
+ async getClaimFee(tokenAmount: string): Promise<bigint> {
36
+ try {
37
+ const fee = await this.invokeView('getFee', [this.projectId, new anchor.BN(tokenAmount)]);
38
+ return BigInt(fee);
39
+ } catch (error) {
40
+ return BigInt(0);
41
+ }
39
42
  }
40
43
  }