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

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 (37) hide show
  1. package/dist/cjs/airdrop/contracts/solana/AirdropSignatureClient.d.ts +1 -1
  2. package/dist/cjs/airdrop/contracts/solana/AirdropSignatureClient.js +11 -6
  3. package/dist/cjs/airdrop/contracts/solana/AirdropSignatureClient.js.map +1 -1
  4. package/dist/cjs/airdrop/contracts/solana/SignatureAirdropService.d.ts +1 -5
  5. package/dist/cjs/airdrop/contracts/solana/SignatureAirdropService.js +0 -16
  6. package/dist/cjs/airdrop/contracts/solana/SignatureAirdropService.js.map +1 -1
  7. package/dist/cjs/airdrop/contracts/solana/SolanaContractClient.js +1 -1
  8. package/dist/cjs/airdrop/contracts/solana/fee_collector.d.ts +20 -71
  9. package/dist/cjs/airdrop/contracts/solana/fee_collector.json +20 -71
  10. package/dist/cjs/airdrop/contracts/solana/fungible_token_distributor_solana.d.ts +64 -77
  11. package/dist/cjs/airdrop/contracts/solana/fungible_token_distributor_solana.json +65 -78
  12. package/dist/cjs/utils/web3.d.ts +15 -1
  13. package/dist/cjs/utils/web3.js +43 -0
  14. package/dist/cjs/utils/web3.js.map +1 -1
  15. package/dist/esm/airdrop/contracts/solana/AirdropSignatureClient.d.ts +1 -1
  16. package/dist/esm/airdrop/contracts/solana/AirdropSignatureClient.js +12 -7
  17. package/dist/esm/airdrop/contracts/solana/AirdropSignatureClient.js.map +1 -1
  18. package/dist/esm/airdrop/contracts/solana/SignatureAirdropService.d.ts +1 -5
  19. package/dist/esm/airdrop/contracts/solana/SignatureAirdropService.js +0 -16
  20. package/dist/esm/airdrop/contracts/solana/SignatureAirdropService.js.map +1 -1
  21. package/dist/esm/airdrop/contracts/solana/SolanaContractClient.js +1 -1
  22. package/dist/esm/airdrop/contracts/solana/fee_collector.d.ts +20 -71
  23. package/dist/esm/airdrop/contracts/solana/fee_collector.json +20 -71
  24. package/dist/esm/airdrop/contracts/solana/fungible_token_distributor_solana.d.ts +64 -77
  25. package/dist/esm/airdrop/contracts/solana/fungible_token_distributor_solana.json +65 -78
  26. package/dist/esm/utils/web3.d.ts +15 -1
  27. package/dist/esm/utils/web3.js +43 -2
  28. package/dist/esm/utils/web3.js.map +1 -1
  29. package/package.json +1 -1
  30. package/src/airdrop/contracts/solana/AirdropSignatureClient.ts +14 -8
  31. package/src/airdrop/contracts/solana/SignatureAirdropService.ts +0 -20
  32. package/src/airdrop/contracts/solana/SolanaContractClient.ts +1 -1
  33. package/src/airdrop/contracts/solana/fee_collector.json +20 -71
  34. package/src/airdrop/contracts/solana/fee_collector.ts +20 -71
  35. package/src/airdrop/contracts/solana/fungible_token_distributor_solana.json +65 -78
  36. package/src/airdrop/contracts/solana/fungible_token_distributor_solana.ts +65 -78
  37. package/src/utils/web3.ts +62 -2
@@ -5,7 +5,7 @@ import * as anchor from '@coral-xyz/anchor';
5
5
  import { FungibleTokenDistributorSolana } from './fungible_token_distributor_solana';
6
6
  import { TOKEN_2022_PROGRAM_ID } from '@solana/spl-token';
7
7
  import { FeeCollectorClient } from './FeeCollectorClient';
8
- import { getOrCreateAssociatedTokenAccount, hexStrToU8Array } from '../../../utils';
8
+ import { fetchTokenVersion, getOrCreateAssociatedTokenAccount, hexStrToU8Array } from '../../../utils';
9
9
 
10
10
  export class AirdropSignatureClient extends SolanaContractClientBase<FungibleTokenDistributorSolana> {
11
11
  projectId: string;
@@ -171,7 +171,9 @@ export class AirdropSignatureClient extends SolanaContractClientBase<FungibleTok
171
171
  const feeCollectorStoragePDA = await this.FeeCollector.getStoragePDA();
172
172
  const feePDA = await this.FeeCollector.getProjectFeePDA();
173
173
  const airdropPDA = await this.getAirdropPDA();
174
- const vaultPDA = await this.getVaultPDA();
174
+ const tokenVersion = await fetchTokenVersion(config.token, {
175
+ clusterOrEndpoint: this.chainId
176
+ });
175
177
 
176
178
  const authorityATA = await getOrCreateAssociatedTokenAccount({
177
179
  connection: this.connection,
@@ -179,12 +181,13 @@ export class AirdropSignatureClient extends SolanaContractClientBase<FungibleTok
179
181
  mint: new PublicKey(config.token),
180
182
  owner: new PublicKey(this.wallet.publicKey),
181
183
  signTransaction: (this.wallet as any).signTransaction,
182
- programId: TOKEN_2022_PROGRAM_ID
184
+ programId: tokenVersion?.programId || TOKEN_2022_PROGRAM_ID
183
185
  });
184
186
 
185
- const tx = new anchor.web3.Transaction();
186
-
187
+ let lastHash = '';
188
+ // solana max transaction size of 1232
187
189
  for (const claim of data) {
190
+ const tx = new anchor.web3.Transaction();
188
191
  tx.add(
189
192
  anchor.web3.Ed25519Program.createInstructionWithPublicKey({
190
193
  publicKey: new PublicKey(config.signer).toBytes(),
@@ -213,20 +216,23 @@ export class AirdropSignatureClient extends SolanaContractClientBase<FungibleTok
213
216
  authority: this.wallet.publicKey,
214
217
  airdrop: airdropPDA,
215
218
  claim: claimPDA,
216
- // vault: vaultPDA,
217
219
  authorityAta: authorityATA.address,
218
220
  tokenMint: new PublicKey(config.token),
219
221
  feeCollectorStorage: feeCollectorStoragePDA,
220
222
  feeCollectorVault: null,
221
223
  fee: feePDA,
222
224
  authorityFeeAta: null,
223
- tokenProgram: TOKEN_2022_PROGRAM_ID,
225
+ tokenProgram: tokenVersion?.programId || TOKEN_2022_PROGRAM_ID,
224
226
  feeTokenMint: null
225
227
  })
226
228
  .transaction()
227
229
  );
230
+
231
+ const hash = await this.program.provider.sendAndConfirm?.(tx);
232
+
233
+ lastHash = hash!;
228
234
  }
229
235
 
230
- return await this.program.provider.sendAndConfirm?.(tx);
236
+ return lastHash;
231
237
  }
232
238
  }
@@ -19,26 +19,6 @@ export class SignatureAirdropService {
19
19
  return this.airdropClient.getVersion();
20
20
  }
21
21
 
22
- feeCollectors = async (address: string) => {
23
- // const deployerClient = await this.getDeployerClient();
24
- // return await deployerClient.feeCollectors(address);
25
- return '';
26
- };
27
-
28
- feeTokens = async (address: string) => {
29
- // const deployerClient = await this.getDeployerClient();
30
- // return await deployerClient.feeTokens(address);
31
- return '';
32
- };
33
-
34
- async getFeelessThreshold() {
35
- // return this.airdropClient.getFeelessThreshold();
36
- }
37
-
38
- async getDeployer() {
39
- return '';
40
- }
41
-
42
22
  async getClaimFee(address: string, amount: bigint): Promise<bigint> {
43
23
  const fee = await this.airdropClient.getClaimFee(amount);
44
24
  return fee;
@@ -116,7 +116,7 @@ export abstract class SolanaContractClientBase<T extends Idl = Idl> {
116
116
  blockhash: latestBlockhash.blockhash,
117
117
  lastValidBlockHeight: latestBlockhash.lastValidBlockHeight
118
118
  },
119
- 'confirmed'
119
+ 'finalized'
120
120
  );
121
121
  return tx;
122
122
  }
@@ -98,41 +98,8 @@
98
98
  "path": "authority"
99
99
  },
100
100
  {
101
- "kind": "const",
102
- "value": [
103
- 6,
104
- 221,
105
- 246,
106
- 225,
107
- 215,
108
- 101,
109
- 161,
110
- 147,
111
- 217,
112
- 203,
113
- 225,
114
- 70,
115
- 206,
116
- 235,
117
- 121,
118
- 172,
119
- 28,
120
- 180,
121
- 133,
122
- 237,
123
- 95,
124
- 91,
125
- 55,
126
- 145,
127
- 58,
128
- 140,
129
- 245,
130
- 133,
131
- 126,
132
- 255,
133
- 0,
134
- 169
135
- ]
101
+ "kind": "account",
102
+ "path": "token_program"
136
103
  },
137
104
  {
138
105
  "kind": "arg",
@@ -749,6 +716,12 @@
749
716
  "writable": true,
750
717
  "signer": true
751
718
  },
719
+ {
720
+ "name": "new_owner",
721
+ "writable": true,
722
+ "signer": true,
723
+ "optional": true
724
+ },
752
725
  {
753
726
  "name": "system_program",
754
727
  "address": "11111111111111111111111111111111"
@@ -833,41 +806,8 @@
833
806
  "path": "authority"
834
807
  },
835
808
  {
836
- "kind": "const",
837
- "value": [
838
- 6,
839
- 221,
840
- 246,
841
- 225,
842
- 215,
843
- 101,
844
- 161,
845
- 147,
846
- 217,
847
- 203,
848
- 225,
849
- 70,
850
- 206,
851
- 235,
852
- 121,
853
- 172,
854
- 28,
855
- 180,
856
- 133,
857
- 237,
858
- 95,
859
- 91,
860
- 55,
861
- 145,
862
- 58,
863
- 140,
864
- 245,
865
- 133,
866
- 126,
867
- 255,
868
- 0,
869
- 169
870
- ]
809
+ "kind": "account",
810
+ "path": "token_program"
871
811
  },
872
812
  {
873
813
  "kind": "account",
@@ -1019,11 +959,16 @@
1019
959
  },
1020
960
  {
1021
961
  "code": 6002,
962
+ "name": "NotPermissioned",
963
+ "msg": "NotPermissioned"
964
+ },
965
+ {
966
+ "code": 6003,
1022
967
  "name": "FeesTooHigh",
1023
968
  "msg": "FeesTooHigh"
1024
969
  },
1025
970
  {
1026
- "code": 6003,
971
+ "code": 6004,
1027
972
  "name": "InvalidCallData",
1028
973
  "msg": "InvalidCallData"
1029
974
  }
@@ -1102,6 +1047,10 @@
1102
1047
  "name": "owner",
1103
1048
  "type": "pubkey"
1104
1049
  },
1050
+ {
1051
+ "name": "new_owner",
1052
+ "type": "pubkey"
1053
+ },
1105
1054
  {
1106
1055
  "name": "default_fees_bips",
1107
1056
  "type": "u64"
@@ -104,41 +104,8 @@ export type FeeCollector = {
104
104
  "path": "authority"
105
105
  },
106
106
  {
107
- "kind": "const",
108
- "value": [
109
- 6,
110
- 221,
111
- 246,
112
- 225,
113
- 215,
114
- 101,
115
- 161,
116
- 147,
117
- 217,
118
- 203,
119
- 225,
120
- 70,
121
- 206,
122
- 235,
123
- 121,
124
- 172,
125
- 28,
126
- 180,
127
- 133,
128
- 237,
129
- 95,
130
- 91,
131
- 55,
132
- 145,
133
- 58,
134
- 140,
135
- 245,
136
- 133,
137
- 126,
138
- 255,
139
- 0,
140
- 169
141
- ]
107
+ "kind": "account",
108
+ "path": "tokenProgram"
142
109
  },
143
110
  {
144
111
  "kind": "arg",
@@ -755,6 +722,12 @@ export type FeeCollector = {
755
722
  "writable": true,
756
723
  "signer": true
757
724
  },
725
+ {
726
+ "name": "newOwner",
727
+ "writable": true,
728
+ "signer": true,
729
+ "optional": true
730
+ },
758
731
  {
759
732
  "name": "systemProgram",
760
733
  "address": "11111111111111111111111111111111"
@@ -839,41 +812,8 @@ export type FeeCollector = {
839
812
  "path": "authority"
840
813
  },
841
814
  {
842
- "kind": "const",
843
- "value": [
844
- 6,
845
- 221,
846
- 246,
847
- 225,
848
- 215,
849
- 101,
850
- 161,
851
- 147,
852
- 217,
853
- 203,
854
- 225,
855
- 70,
856
- 206,
857
- 235,
858
- 121,
859
- 172,
860
- 28,
861
- 180,
862
- 133,
863
- 237,
864
- 95,
865
- 91,
866
- 55,
867
- 145,
868
- 58,
869
- 140,
870
- 245,
871
- 133,
872
- 126,
873
- 255,
874
- 0,
875
- 169
876
- ]
815
+ "kind": "account",
816
+ "path": "tokenProgram"
877
817
  },
878
818
  {
879
819
  "kind": "account",
@@ -1025,11 +965,16 @@ export type FeeCollector = {
1025
965
  },
1026
966
  {
1027
967
  "code": 6002,
968
+ "name": "notPermissioned",
969
+ "msg": "notPermissioned"
970
+ },
971
+ {
972
+ "code": 6003,
1028
973
  "name": "feesTooHigh",
1029
974
  "msg": "feesTooHigh"
1030
975
  },
1031
976
  {
1032
- "code": 6003,
977
+ "code": 6004,
1033
978
  "name": "invalidCallData",
1034
979
  "msg": "invalidCallData"
1035
980
  }
@@ -1108,6 +1053,10 @@ export type FeeCollector = {
1108
1053
  "name": "owner",
1109
1054
  "type": "pubkey"
1110
1055
  },
1056
+ {
1057
+ "name": "newOwner",
1058
+ "type": "pubkey"
1059
+ },
1111
1060
  {
1112
1061
  "name": "defaultFeesBips",
1113
1062
  "type": "u64"
@@ -80,41 +80,8 @@
80
80
  "path": "authority"
81
81
  },
82
82
  {
83
- "kind": "const",
84
- "value": [
85
- 6,
86
- 221,
87
- 246,
88
- 225,
89
- 215,
90
- 101,
91
- 161,
92
- 147,
93
- 217,
94
- 203,
95
- 225,
96
- 70,
97
- 206,
98
- 235,
99
- 121,
100
- 172,
101
- 28,
102
- 180,
103
- 133,
104
- 237,
105
- 95,
106
- 91,
107
- 55,
108
- 145,
109
- 58,
110
- 140,
111
- 245,
112
- 133,
113
- 126,
114
- 255,
115
- 0,
116
- 169
117
- ]
83
+ "kind": "account",
84
+ "path": "token_program"
118
85
  },
119
86
  {
120
87
  "kind": "account",
@@ -541,6 +508,50 @@
541
508
  }
542
509
  ]
543
510
  },
511
+ {
512
+ "name": "receive_program_admin",
513
+ "discriminator": [
514
+ 238,
515
+ 172,
516
+ 61,
517
+ 197,
518
+ 23,
519
+ 72,
520
+ 249,
521
+ 87
522
+ ],
523
+ "accounts": [
524
+ {
525
+ "name": "config",
526
+ "writable": true,
527
+ "pda": {
528
+ "seeds": [
529
+ {
530
+ "kind": "const",
531
+ "value": [
532
+ 99,
533
+ 111,
534
+ 110,
535
+ 102,
536
+ 105,
537
+ 103
538
+ ]
539
+ }
540
+ ]
541
+ }
542
+ },
543
+ {
544
+ "name": "authority",
545
+ "writable": true,
546
+ "signer": true
547
+ },
548
+ {
549
+ "name": "system_program",
550
+ "address": "11111111111111111111111111111111"
551
+ }
552
+ ],
553
+ "args": []
554
+ },
544
555
  {
545
556
  "name": "set_base_params",
546
557
  "discriminator": [
@@ -877,11 +888,6 @@
877
888
  "writable": true,
878
889
  "signer": true
879
890
  },
880
- {
881
- "name": "new_owner",
882
- "writable": true,
883
- "signer": true
884
- },
885
891
  {
886
892
  "name": "system_program",
887
893
  "address": "11111111111111111111111111111111"
@@ -938,7 +944,8 @@
938
944
  {
939
945
  "name": "new_admin",
940
946
  "writable": true,
941
- "signer": true
947
+ "signer": true,
948
+ "optional": true
942
949
  },
943
950
  {
944
951
  "name": "system_program",
@@ -1123,41 +1130,8 @@
1123
1130
  "path": "authority"
1124
1131
  },
1125
1132
  {
1126
- "kind": "const",
1127
- "value": [
1128
- 6,
1129
- 221,
1130
- 246,
1131
- 225,
1132
- 215,
1133
- 101,
1134
- 161,
1135
- 147,
1136
- 217,
1137
- 203,
1138
- 225,
1139
- 70,
1140
- 206,
1141
- 235,
1142
- 121,
1143
- 172,
1144
- 28,
1145
- 180,
1146
- 133,
1147
- 237,
1148
- 95,
1149
- 91,
1150
- 55,
1151
- 145,
1152
- 58,
1153
- 140,
1154
- 245,
1155
- 133,
1156
- 126,
1157
- 255,
1158
- 0,
1159
- 169
1160
- ]
1133
+ "kind": "account",
1134
+ "path": "token_program"
1161
1135
  },
1162
1136
  {
1163
1137
  "kind": "account",
@@ -1395,16 +1369,21 @@
1395
1369
  },
1396
1370
  {
1397
1371
  "code": 6009,
1372
+ "name": "NotPermissioned",
1373
+ "msg": "NotPermissioned"
1374
+ },
1375
+ {
1376
+ "code": 6010,
1398
1377
  "name": "OwnableUnauthorizedAccount",
1399
1378
  "msg": "OwnableUnauthorizedAccount"
1400
1379
  },
1401
1380
  {
1402
- "code": 6010,
1381
+ "code": 6011,
1403
1382
  "name": "InvalidFeeCollector",
1404
1383
  "msg": "InvalidFeeCollector"
1405
1384
  },
1406
1385
  {
1407
- "code": 6011,
1386
+ "code": 6012,
1408
1387
  "name": "Paused",
1409
1388
  "msg": "Paused"
1410
1389
  }
@@ -1511,6 +1490,10 @@
1511
1490
  {
1512
1491
  "name": "admin",
1513
1492
  "type": "pubkey"
1493
+ },
1494
+ {
1495
+ "name": "new_admin",
1496
+ "type": "pubkey"
1514
1497
  }
1515
1498
  ]
1516
1499
  }
@@ -1531,6 +1514,10 @@
1531
1514
  "name": "owner",
1532
1515
  "type": "pubkey"
1533
1516
  },
1517
+ {
1518
+ "name": "new_owner",
1519
+ "type": "pubkey"
1520
+ },
1534
1521
  {
1535
1522
  "name": "default_fees_bips",
1536
1523
  "type": "u64"