@sign-global/tokentable 0.4.3-beta.0 → 0.4.3-beta.1

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 (213) hide show
  1. package/dist/cjs/airdrop/AirdropClient.d.ts +1 -1
  2. package/dist/cjs/airdrop/AirdropClient.js +4 -3
  3. package/dist/cjs/airdrop/AirdropClient.js.map +1 -1
  4. package/dist/cjs/airdrop/SignatureAirdropClient.d.ts +10 -1
  5. package/dist/cjs/airdrop/SignatureAirdropClient.js +48 -11
  6. package/dist/cjs/airdrop/SignatureAirdropClient.js.map +1 -1
  7. package/dist/cjs/airdrop/common/index.d.ts +1 -1
  8. package/dist/cjs/airdrop/constants/chain-config.d.ts +1 -1
  9. package/dist/cjs/airdrop/constants/chain-config.js +1 -1
  10. package/dist/cjs/airdrop/constants/chain-config.js.map +1 -1
  11. package/dist/cjs/airdrop/constants/index.d.ts +1 -0
  12. package/dist/cjs/airdrop/constants/index.js +1 -0
  13. package/dist/cjs/airdrop/constants/index.js.map +1 -1
  14. package/dist/cjs/airdrop/contracts/evm/contracts/AirdropSignatureClient.js +0 -1
  15. package/dist/cjs/airdrop/contracts/evm/contracts/AirdropSignatureClient.js.map +1 -1
  16. package/dist/cjs/airdrop/contracts/index.d.ts +1 -0
  17. package/dist/cjs/airdrop/contracts/index.js +3 -1
  18. package/dist/cjs/airdrop/contracts/index.js.map +1 -1
  19. package/dist/cjs/airdrop/contracts/solana/AirdropService.d.ts +16 -0
  20. package/dist/cjs/airdrop/contracts/solana/AirdropService.js +38 -0
  21. package/dist/cjs/airdrop/contracts/solana/AirdropService.js.map +1 -0
  22. package/dist/cjs/airdrop/contracts/solana/AirdropSignatureClient.js +2 -2
  23. package/dist/cjs/airdrop/contracts/solana/AirdropSignatureClient.js.map +1 -1
  24. package/dist/cjs/airdrop/contracts/solana/FeeCollectorClient.d.ts +3 -2
  25. package/dist/cjs/airdrop/contracts/solana/FeeCollectorClient.js +7 -3
  26. package/dist/cjs/airdrop/contracts/solana/FeeCollectorClient.js.map +1 -1
  27. package/dist/cjs/airdrop/contracts/solana/MerkleDistributorClient.d.ts +49 -0
  28. package/dist/cjs/airdrop/contracts/solana/MerkleDistributorClient.js +242 -0
  29. package/dist/cjs/airdrop/contracts/solana/MerkleDistributorClient.js.map +1 -0
  30. package/dist/cjs/airdrop/contracts/solana/SolanaContractClient.d.ts +1 -0
  31. package/dist/cjs/airdrop/contracts/solana/SolanaContractClient.js +3 -0
  32. package/dist/cjs/airdrop/contracts/solana/SolanaContractClient.js.map +1 -1
  33. package/dist/cjs/airdrop/contracts/solana/fee_collector.d.ts +49 -1
  34. package/dist/cjs/airdrop/contracts/solana/fee_collector.json +51 -3
  35. package/dist/cjs/airdrop/contracts/solana/merkle_token_distributor_solana.d.ts +1695 -0
  36. package/dist/cjs/airdrop/contracts/solana/merkle_token_distributor_solana.js +3 -0
  37. package/dist/cjs/airdrop/contracts/solana/merkle_token_distributor_solana.js.map +1 -0
  38. package/dist/cjs/airdrop/contracts/solana/merkle_token_distributor_solana.json +1689 -0
  39. package/dist/cjs/airdrop/services/index.d.ts +3 -2
  40. package/dist/cjs/airdrop/services/index.js +8 -1
  41. package/dist/cjs/airdrop/services/index.js.map +1 -1
  42. package/dist/cjs/airdrop/strategies/AirdropStrategyFactory.d.ts +1 -0
  43. package/dist/cjs/airdrop/strategies/AirdropStrategyFactory.js +2 -1
  44. package/dist/cjs/airdrop/strategies/AirdropStrategyFactory.js.map +1 -1
  45. package/dist/cjs/airdrop/strategies/IAirdropStrategy.d.ts +1 -0
  46. package/dist/cjs/airdrop/strategies/SolanaAirdropStrategy.d.ts +25 -0
  47. package/dist/cjs/airdrop/strategies/SolanaAirdropStrategy.js +62 -0
  48. package/dist/cjs/airdrop/strategies/SolanaAirdropStrategy.js.map +1 -0
  49. package/dist/cjs/airdrop/types/index.d.ts +6 -1
  50. package/dist/cjs/airdrop/types/index.js +1 -0
  51. package/dist/cjs/airdrop/types/index.js.map +1 -1
  52. package/dist/esm/airdrop/AirdropClient.d.ts +1 -1
  53. package/dist/esm/airdrop/AirdropClient.js +4 -3
  54. package/dist/esm/airdrop/AirdropClient.js.map +1 -1
  55. package/dist/esm/airdrop/SignatureAirdropClient.d.ts +10 -1
  56. package/dist/esm/airdrop/SignatureAirdropClient.js +49 -12
  57. package/dist/esm/airdrop/SignatureAirdropClient.js.map +1 -1
  58. package/dist/esm/airdrop/common/index.d.ts +1 -1
  59. package/dist/esm/airdrop/constants/chain-config.d.ts +1 -1
  60. package/dist/esm/airdrop/constants/chain-config.js +1 -1
  61. package/dist/esm/airdrop/constants/chain-config.js.map +1 -1
  62. package/dist/esm/airdrop/constants/index.d.ts +1 -0
  63. package/dist/esm/airdrop/constants/index.js +1 -0
  64. package/dist/esm/airdrop/constants/index.js.map +1 -1
  65. package/dist/esm/airdrop/contracts/evm/contracts/AirdropSignatureClient.js +0 -1
  66. package/dist/esm/airdrop/contracts/evm/contracts/AirdropSignatureClient.js.map +1 -1
  67. package/dist/esm/airdrop/contracts/index.d.ts +1 -0
  68. package/dist/esm/airdrop/contracts/index.js +1 -0
  69. package/dist/esm/airdrop/contracts/index.js.map +1 -1
  70. package/dist/esm/airdrop/contracts/solana/AirdropService.d.ts +16 -0
  71. package/dist/esm/airdrop/contracts/solana/AirdropService.js +34 -0
  72. package/dist/esm/airdrop/contracts/solana/AirdropService.js.map +1 -0
  73. package/dist/esm/airdrop/contracts/solana/AirdropSignatureClient.js +2 -2
  74. package/dist/esm/airdrop/contracts/solana/AirdropSignatureClient.js.map +1 -1
  75. package/dist/esm/airdrop/contracts/solana/FeeCollectorClient.d.ts +3 -2
  76. package/dist/esm/airdrop/contracts/solana/FeeCollectorClient.js +7 -3
  77. package/dist/esm/airdrop/contracts/solana/FeeCollectorClient.js.map +1 -1
  78. package/dist/esm/airdrop/contracts/solana/MerkleDistributorClient.d.ts +49 -0
  79. package/dist/esm/airdrop/contracts/solana/MerkleDistributorClient.js +212 -0
  80. package/dist/esm/airdrop/contracts/solana/MerkleDistributorClient.js.map +1 -0
  81. package/dist/esm/airdrop/contracts/solana/SolanaContractClient.d.ts +1 -0
  82. package/dist/esm/airdrop/contracts/solana/SolanaContractClient.js +3 -0
  83. package/dist/esm/airdrop/contracts/solana/SolanaContractClient.js.map +1 -1
  84. package/dist/esm/airdrop/contracts/solana/fee_collector.d.ts +49 -1
  85. package/dist/esm/airdrop/contracts/solana/fee_collector.json +51 -3
  86. package/dist/esm/airdrop/contracts/solana/merkle_token_distributor_solana.d.ts +1695 -0
  87. package/dist/esm/airdrop/contracts/solana/merkle_token_distributor_solana.js +2 -0
  88. package/dist/esm/airdrop/contracts/solana/merkle_token_distributor_solana.js.map +1 -0
  89. package/dist/esm/airdrop/contracts/solana/merkle_token_distributor_solana.json +1689 -0
  90. package/dist/esm/airdrop/services/index.d.ts +3 -2
  91. package/dist/esm/airdrop/services/index.js +6 -0
  92. package/dist/esm/airdrop/services/index.js.map +1 -1
  93. package/dist/esm/airdrop/strategies/AirdropStrategyFactory.d.ts +1 -0
  94. package/dist/esm/airdrop/strategies/AirdropStrategyFactory.js +2 -1
  95. package/dist/esm/airdrop/strategies/AirdropStrategyFactory.js.map +1 -1
  96. package/dist/esm/airdrop/strategies/IAirdropStrategy.d.ts +1 -0
  97. package/dist/esm/airdrop/strategies/SolanaAirdropStrategy.d.ts +25 -0
  98. package/dist/esm/airdrop/strategies/SolanaAirdropStrategy.js +58 -0
  99. package/dist/esm/airdrop/strategies/SolanaAirdropStrategy.js.map +1 -0
  100. package/dist/esm/airdrop/types/index.d.ts +6 -1
  101. package/dist/esm/airdrop/types/index.js +1 -0
  102. package/dist/esm/airdrop/types/index.js.map +1 -1
  103. package/package.json +2 -9
  104. package/src/airdrop/AirdropClient.ts +0 -307
  105. package/src/airdrop/SignatureAirdropClient.ts +0 -337
  106. package/src/airdrop/common/index.ts +0 -54
  107. package/src/airdrop/common/projectDataForTon.ts +0 -79
  108. package/src/airdrop/constants/chain-config.ts +0 -107
  109. package/src/airdrop/constants/index.ts +0 -8
  110. package/src/airdrop/constants/network.ts +0 -78
  111. package/src/airdrop/contracts/evm/AirdropService.ts +0 -181
  112. package/src/airdrop/contracts/evm/SignatureAirdropService.ts +0 -114
  113. package/src/airdrop/contracts/evm/contracts/AirdropSignatureClient.ts +0 -63
  114. package/src/airdrop/contracts/evm/contracts/AirdropSignatureFeeClient.ts +0 -61
  115. package/src/airdrop/contracts/evm/contracts/AirdropV2Client.ts +0 -37
  116. package/src/airdrop/contracts/evm/contracts/AirdropV3Client.ts +0 -49
  117. package/src/airdrop/contracts/evm/contracts/AirdropV3FeeClient.ts +0 -16
  118. package/src/airdrop/contracts/evm/contracts/AirdropV4Client.ts +0 -36
  119. package/src/airdrop/contracts/evm/contracts/ContractBaseClient.ts +0 -85
  120. package/src/airdrop/contracts/evm/contracts/DeployClient.ts +0 -35
  121. package/src/airdrop/contracts/evm/contracts/FeeCollectorClient.ts +0 -21
  122. package/src/airdrop/contracts/evm/contracts/KycClient.ts +0 -21
  123. package/src/airdrop/contracts/evm/contracts/abis/Airdrop.json +0 -674
  124. package/src/airdrop/contracts/evm/contracts/abis/AirdropV2.json +0 -676
  125. package/src/airdrop/contracts/evm/contracts/abis/AirdropV3.json +0 -740
  126. package/src/airdrop/contracts/evm/contracts/abis/AirdropV3_Fee.json +0 -678
  127. package/src/airdrop/contracts/evm/contracts/abis/CustomFeeNativeAirdropV4.json +0 -701
  128. package/src/airdrop/contracts/evm/contracts/abis/Deployer.json +0 -271
  129. package/src/airdrop/contracts/evm/contracts/abis/ERC721.json +0 -737
  130. package/src/airdrop/contracts/evm/contracts/abis/FeeCollector.json +0 -322
  131. package/src/airdrop/contracts/evm/contracts/abis/FungibleTokenECDSADistributor.json +0 -564
  132. package/src/airdrop/contracts/evm/contracts/abis/FungibleTokenWithFeesECDSADistributor.json +0 -260
  133. package/src/airdrop/contracts/evm/contracts/abis/KycHook.json +0 -312
  134. package/src/airdrop/contracts/index.ts +0 -4
  135. package/src/airdrop/contracts/solana/AirdropSignatureClient.ts +0 -242
  136. package/src/airdrop/contracts/solana/FeeCollectorClient.ts +0 -43
  137. package/src/airdrop/contracts/solana/SignatureAirdropService.ts +0 -51
  138. package/src/airdrop/contracts/solana/SolanaContractClient.ts +0 -126
  139. package/src/airdrop/contracts/solana/fee_collector.json +0 -1063
  140. package/src/airdrop/contracts/solana/fee_collector.ts +0 -1069
  141. package/src/airdrop/contracts/solana/fungible_token_distributor_solana.json +0 -1573
  142. package/src/airdrop/contracts/solana/fungible_token_distributor_solana.ts +0 -1579
  143. package/src/airdrop/contracts/ton/AirdropClientV1.ts +0 -122
  144. package/src/airdrop/contracts/ton/AirdropClientV2.ts +0 -118
  145. package/src/airdrop/contracts/ton/AirdropClientV21.ts +0 -131
  146. package/src/airdrop/contracts/ton/AirdropClientV3.ts +0 -127
  147. package/src/airdrop/contracts/ton/AirdropService.ts +0 -150
  148. package/src/airdrop/contracts/ton/TonContractBaseClient.ts +0 -236
  149. package/src/airdrop/contracts/ton/v1/build/Leaf.compiled.json +0 -1
  150. package/src/airdrop/contracts/ton/v1/build/MerkleTokenDistributor.compiled.json +0 -1
  151. package/src/airdrop/contracts/ton/v1/utils/constants.ts +0 -42
  152. package/src/airdrop/contracts/ton/v1/utils/date.utils.ts +0 -11
  153. package/src/airdrop/contracts/ton/v1/utils/index.ts +0 -3
  154. package/src/airdrop/contracts/ton/v1/utils/ton.utils.ts +0 -84
  155. package/src/airdrop/contracts/ton/v1/wrappers/JettonMinter.ts +0 -81
  156. package/src/airdrop/contracts/ton/v1/wrappers/JettonWallet.ts +0 -73
  157. package/src/airdrop/contracts/ton/v1/wrappers/Leaf.ts +0 -88
  158. package/src/airdrop/contracts/ton/v1/wrappers/MerkleTokenDistributor.ts +0 -317
  159. package/src/airdrop/contracts/ton/v1/wrappers/index.ts +0 -2
  160. package/src/airdrop/contracts/ton/v2/build/Leaf.compiled.json +0 -1
  161. package/src/airdrop/contracts/ton/v2/build/MerkleTokenDistributor.compiled.json +0 -1
  162. package/src/airdrop/contracts/ton/v2/utils/constants.ts +0 -43
  163. package/src/airdrop/contracts/ton/v2/utils/date.utils.ts +0 -11
  164. package/src/airdrop/contracts/ton/v2/utils/index.ts +0 -3
  165. package/src/airdrop/contracts/ton/v2/utils/ton.utils.ts +0 -102
  166. package/src/airdrop/contracts/ton/v2/wrappers/Leaf.ts +0 -69
  167. package/src/airdrop/contracts/ton/v2/wrappers/MerkleTokenDistributor.ts +0 -340
  168. package/src/airdrop/contracts/ton/v2/wrappers/index.ts +0 -2
  169. package/src/airdrop/contracts/ton/v21/build/Leaf.compiled.json +0 -1
  170. package/src/airdrop/contracts/ton/v21/build/MerkleTokenDistributor.compiled.json +0 -1
  171. package/src/airdrop/contracts/ton/v21/utils/constants.ts +0 -48
  172. package/src/airdrop/contracts/ton/v21/utils/date.utils.ts +0 -11
  173. package/src/airdrop/contracts/ton/v21/utils/index.ts +0 -3
  174. package/src/airdrop/contracts/ton/v21/utils/ton.utils.ts +0 -84
  175. package/src/airdrop/contracts/ton/v21/wrappers/Leaf.ts +0 -69
  176. package/src/airdrop/contracts/ton/v21/wrappers/MerkleTokenDistributor.ts +0 -346
  177. package/src/airdrop/contracts/ton/v21/wrappers/index.ts +0 -2
  178. package/src/airdrop/contracts/ton/v3/build/Leaf.compiled.json +0 -1
  179. package/src/airdrop/contracts/ton/v3/build/MerkleTokenDistributor.compiled.json +0 -1
  180. package/src/airdrop/contracts/ton/v3/utils/constants.ts +0 -43
  181. package/src/airdrop/contracts/ton/v3/utils/date.utils.ts +0 -11
  182. package/src/airdrop/contracts/ton/v3/utils/index.ts +0 -3
  183. package/src/airdrop/contracts/ton/v3/utils/ton.utils.ts +0 -84
  184. package/src/airdrop/contracts/ton/v3/wrappers/Leaf.ts +0 -68
  185. package/src/airdrop/contracts/ton/v3/wrappers/MerkleTokenDistributor.ts +0 -316
  186. package/src/airdrop/contracts/ton/v3/wrappers/index.ts +0 -2
  187. package/src/airdrop/index.ts +0 -10
  188. package/src/airdrop/services/index.ts +0 -159
  189. package/src/airdrop/services/wallet-service/ton/WalletService.ts +0 -226
  190. package/src/airdrop/services/wallet-service/ton/index.ts +0 -1
  191. package/src/airdrop/strategies/AirdropStrategyFactory.ts +0 -31
  192. package/src/airdrop/strategies/EvmAirdropStrategy.ts +0 -81
  193. package/src/airdrop/strategies/IAirdropStrategy.ts +0 -26
  194. package/src/airdrop/strategies/StrategyCache.ts +0 -34
  195. package/src/airdrop/strategies/TonAirdropStrategy.ts +0 -77
  196. package/src/airdrop/tests/index.test.ts +0 -387
  197. package/src/airdrop/types/index.ts +0 -199
  198. package/src/index.ts +0 -3
  199. package/src/utils/api-client.ts +0 -69
  200. package/src/utils/index.ts +0 -3
  201. package/src/utils/utils.ts +0 -45
  202. package/src/utils/web3.ts +0 -172
  203. package/src/wallets/WalletBase.ts +0 -92
  204. package/src/wallets/WalletFactory.tsx +0 -35
  205. package/src/wallets/index.ts +0 -3
  206. package/src/wallets/providers/evm/EvmWallet.ts +0 -101
  207. package/src/wallets/providers/evm/index.tsx +0 -56
  208. package/src/wallets/providers/index.ts +0 -4
  209. package/src/wallets/providers/solana/index.tsx +0 -133
  210. package/src/wallets/providers/ton/TonWallet.ts +0 -153
  211. package/src/wallets/providers/ton/index.tsx +0 -41
  212. package/src/wallets/types.ts +0 -45
  213. package/src/wallets/utils/index.ts +0 -61
@@ -29,7 +29,7 @@ export declare const getJettonInfo: (data: {
29
29
  interface SidResponse {
30
30
  sid: string;
31
31
  }
32
- interface TwitterConnectParams {
32
+ interface SocialConnectParams {
33
33
  code: string;
34
34
  projectId: string;
35
35
  }
@@ -42,7 +42,8 @@ interface WalletBindParams {
42
42
  recipientType: string;
43
43
  address: string;
44
44
  }
45
- export declare const connectTwitter: (data: TwitterConnectParams, baseURL?: string) => Promise<SidResponse>;
45
+ export declare const connectTwitter: (data: SocialConnectParams, baseURL?: string) => Promise<SidResponse>;
46
+ export declare const connectGoogleApi: (data: SocialConnectParams, baseURL?: string) => Promise<SidResponse>;
46
47
  export declare const checkEligibility: (data: {
47
48
  projectId: string;
48
49
  }, baseURL?: string) => Promise<IAirdropSignatureData>;
@@ -45,6 +45,12 @@ export const connectTwitter = async (data, baseURL) => {
45
45
  headers: getSidHeader(data.projectId)
46
46
  });
47
47
  };
48
+ export const connectGoogleApi = async (data, baseURL) => {
49
+ const client = createApiClient(baseURL);
50
+ return client.post('/airdrop-open/connect-google', data, {
51
+ headers: getSidHeader(data.projectId)
52
+ });
53
+ };
48
54
  export const checkEligibility = async (data, baseURL) => {
49
55
  const headers = getSidHeader(data.projectId);
50
56
  if (!headers.sid)
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/airdrop/services/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAUlD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExD,MAAM,eAAe,GAAG,CAAC,OAAgB,EAAE,EAAE;IAC3C,OAAO,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AAC7D,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAG,KAAK,EAAE,SAAiB,EAAE,OAAgB,EAAqB,EAAE;IAChG,MAAM,MAAM,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC;IACxC,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,GAAG,CAAM,0BAA0B,SAAS,EAAE,CAAC,CAAC;IACzE,IAAI,CAAC,GAAG;QAAE,OAAO,GAAG,CAAC,CAAC,cAAc;IACpC,MAAM,aAAa,GAAG,GAAG,EAAE,SAAS,CAAC;IACrC,MAAM,cAAc,GAAG,aAAa,CAAC,aAAa,EAAE,cAAc,CAAC,CAAC;IACpE,OAAO;QACL,GAAG,GAA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M,CAAC,MAAM,UAAU,GAAG,KAAK,EAAE,IAAsB,EAAE,OAAgB,EAAwB,EAAE;IACjG,MAAM,MAAM,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC;IACxC,OAAO,MAAM,CAAC,IAAI,CAAC,8BAA8B,EAAE,IAAI,EAAE;QACvD,OAAO,EAAE,YAAY,CAAC,IAAI,CAAC,SAAS,CAAC;KACtC,CAAC,CAAC;AACL,CAAC,CAAC;AAQF,MAAM,CAAC,MAAM,mBAAmB,GAAG,KAAK,EAAE,IAAsB,EAAE,OAAgB,EAAiB,EAAE;IACnG,MAAM,MAAM,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC;IACxC,OAAO,MAAM,CAAC,IAAI,CAAC,0BAA0B,EAAE,IAAI,EAAE;QACnD,OAAO,EAAE,YAAY,CAAC,IAAI,CAAC,SAAS,CAAC;KACtC,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAG,KAAK,EACrC,IAIC,EACD,OAAgB,EAC4B,EAAE;IAC9C,MAAM,MAAM,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC;IACxC,OAAO,MAAM,CAAC,IAAI,CAAC,oCAAoC,EAAE,IAAI,EAAE;QAC7D,OAAO,EAAE,YAAY,CAAC,IAAI,CAAC,SAAS,CAAC;KACtC,CAAC,CAAC;AACL,CAAC,CAAC"}
@@ -10,5 +10,6 @@ export declare class AirdropStrategyFactory {
10
10
  walletClient?: IWalletClient;
11
11
  tonClient?: TonClient;
12
12
  version?: string;
13
+ projectId: string;
13
14
  }): IAirdropStrategy;
14
15
  }
@@ -1,11 +1,12 @@
1
1
  import { ChainType } from '../types';
2
2
  import { EvmAirdropStrategy } from './EvmAirdropStrategy';
3
+ import { SolanaAirdropStrategy } from './SolanaAirdropStrategy';
3
4
  import { TonAirdropStrategy } from './TonAirdropStrategy';
4
5
  export class AirdropStrategyFactory {
5
6
  static strategyMap = {
6
7
  [ChainType.Evm]: EvmAirdropStrategy,
7
8
  [ChainType.Ton]: TonAirdropStrategy,
8
- [ChainType.Solana]: null
9
+ [ChainType.Solana]: SolanaAirdropStrategy
9
10
  };
10
11
  static createStrategy(params) {
11
12
  const { chainType, ...strategyParams } = params;
@@ -1 +1 @@
1
- {"version":3,"file":"AirdropStrategyFactory.js","sourceRoot":"","sources":["../../../../src/airdrop/strategies/AirdropStrategyFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAiB,MAAM,UAAU,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAG1D,MAAM,OAAO,sBAAsB;IACzB,MAAM,CAAC,WAAW,GAA0D;QAClF,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,kBAAkB;QACnC,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,kBAAkB;QACnC,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,IAAI;KACzB,CAAC;IAEF,MAAM,CAAC,cAAc,CAAC,MAOrB;QACC,MAAM,EAAE,SAAS,EAAE,GAAG,cAAc,EAAE,GAAG,MAAM,CAAC;QAChD,MAAM,aAAa,GAAG,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;QAElD,IAAI,CAAC,aAAa,EAAE,CAAC;YACnB,MAAM,IAAI,KAAK,CAAC,2BAA2B,SAAS,EAAE,CAAC,CAAC;QAC1D,CAAC;QAED,OAAO,IAAI,aAAa,CAAC,cAAc,CAAC,CAAC;IAC3C,CAAC"}
1
+ {"version":3,"file":"AirdropStrategyFactory.js","sourceRoot":"","sources":["../../../../src/airdrop/strategies/AirdropStrategyFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAiB,MAAM,UAAU,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAG1D,MAAM,OAAO,sBAAsB;IACzB,MAAM,CAAC,WAAW,GAA0D;QAClF,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,kBAAkB;QACnC,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,kBAAkB;QACnC,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,qBAAqB;KAC1C,CAAC;IAEF,MAAM,CAAC,cAAc,CAAC,MAQrB;QACC,MAAM,EAAE,SAAS,EAAE,GAAG,cAAc,EAAE,GAAG,MAAM,CAAC;QAChD,MAAM,aAAa,GAAG,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;QAElD,IAAI,CAAC,aAAa,EAAE,CAAC;YACnB,MAAM,IAAI,KAAK,CAAC,2BAA2B,SAAS,EAAE,CAAC,CAAC;QAC1D,CAAC;QAED,OAAO,IAAI,aAAa,CAAC,cAAc,CAAC,CAAC;IAC3C,CAAC"}
@@ -24,5 +24,6 @@ export interface IAirdropStrategyConstructor {
24
24
  walletClient?: IWalletClient;
25
25
  tonClient?: TonClient;
26
26
  version?: string;
27
+ projectId: string;
27
28
  }): IAirdropStrategy;
28
29
  }
@@ -0,0 +1,25 @@
1
+ import { IWalletClient } from '../types';
2
+ import { IAirdropStrategy } from './IAirdropStrategy';
3
+ export declare class SolanaAirdropStrategy implements IAirdropStrategy {
4
+ private service;
5
+ private readonly chainId;
6
+ private walletClient?;
7
+ private cachedVersion;
8
+ private projectId;
9
+ constructor(params: {
10
+ contractAddress: string;
11
+ chainId: string | number;
12
+ walletClient?: IWalletClient;
13
+ projectId: string;
14
+ });
15
+ initialize(walletClient?: IWalletClient): Promise<void>;
16
+ isInitialized(): boolean;
17
+ getVersion(): Promise<string>;
18
+ claim(claimData: any): Promise<any>;
19
+ checkClaimed(claimData: any): Promise<boolean>;
20
+ batchCheckClaimed(leafs: string[]): Promise<{
21
+ result: boolean;
22
+ status: string;
23
+ }[]>;
24
+ getClaimFee(contractAddress: string, amount: bigint): Promise<bigint>;
25
+ }
@@ -0,0 +1,58 @@
1
+ import { SolanaAirdropService } from '../contracts';
2
+ export class SolanaAirdropStrategy {
3
+ service;
4
+ chainId;
5
+ walletClient;
6
+ cachedVersion = null;
7
+ projectId;
8
+ constructor(params) {
9
+ this.chainId = params.chainId;
10
+ this.projectId = params.projectId;
11
+ if (params.walletClient) {
12
+ this.walletClient = params.walletClient;
13
+ }
14
+ }
15
+ async initialize(walletClient) {
16
+ if (walletClient) {
17
+ this.walletClient = walletClient;
18
+ }
19
+ this.service = new SolanaAirdropService({
20
+ projectId: this.projectId,
21
+ chainId: this.chainId,
22
+ walletClient: this.walletClient
23
+ });
24
+ }
25
+ isInitialized() {
26
+ return !!this.service;
27
+ }
28
+ async getVersion() {
29
+ if (this.cachedVersion) {
30
+ return this.cachedVersion;
31
+ }
32
+ if (!this.service)
33
+ throw new Error('Strategy not initialized');
34
+ this.cachedVersion = await this.service.getVersion();
35
+ return this.cachedVersion;
36
+ }
37
+ async claim(claimData) {
38
+ if (!this.service)
39
+ throw new Error('Strategy not initialized');
40
+ return this.service.claim(claimData);
41
+ }
42
+ async checkClaimed(claimData) {
43
+ if (!this.service)
44
+ throw new Error('Strategy not initialized');
45
+ return this.service.isLeafUsed(claimData.leaf);
46
+ }
47
+ async batchCheckClaimed(leafs) {
48
+ if (!this.service)
49
+ throw new Error('Strategy not initialized');
50
+ return this.service.batchFetchClaimed(leafs);
51
+ }
52
+ async getClaimFee(contractAddress, amount) {
53
+ if (!this.service)
54
+ throw new Error('Strategy not initialized');
55
+ return this.service.getClaimFee(contractAddress, amount);
56
+ }
57
+ }
58
+ //# sourceMappingURL=SolanaAirdropStrategy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SolanaAirdropStrategy.js","sourceRoot":"","sources":["../../../../src/airdrop/strategies/SolanaAirdropStrategy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MA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AC/D,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;IACvC,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,SAAc;QAC/B,IAAI,CAAC,IAAI,CAAC,OAAO;YAAE,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;QAC/D,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IACjD,CAAC;IAED,KAAK,CAAC,iBAAiB,CAAC,KAAe;QACrC,IAAI,CAAC,IAAI,CAAC,OAAO;YAAE,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;QAC/D,OAAO,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;IAC/C,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,eAAuB,EAAE,MAAc;QACvD,IAAI,CAAC,IAAI,CAAC,OAAO;YAAE,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;QAC/D,OAAO,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,eAAe,EAAE,MAAM,CAAsB,CAAC;IAChF,CAAC;CACF"}
@@ -69,7 +69,8 @@ export declare enum AirdropSigIdentityTypeEnum {
69
69
  Twitter = "X Account",
70
70
  SolanaWallet = "Solana Wallet",
71
71
  EVMWallet = "EVM Wallet",
72
- TONWallet = "TON Wallet"
72
+ TONWallet = "TON Wallet",
73
+ Google = "Google Account"
73
74
  }
74
75
  export interface IProjectExtra {
75
76
  kyc: boolean;
@@ -102,6 +103,10 @@ export type IAirdropClaim = {
102
103
  expired?: boolean;
103
104
  project: IProject;
104
105
  };
106
+ export interface IAirdropClaimData extends IAirdropClaim {
107
+ extraData: any;
108
+ value: bigint;
109
+ }
105
110
  export type IAirdropSignatureClaim = {
106
111
  percent: number;
107
112
  unlockingAt: number;
@@ -10,6 +10,7 @@ export var AirdropSigIdentityTypeEnum;
10
10
  AirdropSigIdentityTypeEnum["SolanaWallet"] = "Solana Wallet";
11
11
  AirdropSigIdentityTypeEnum["EVMWallet"] = "EVM Wallet";
12
12
  AirdropSigIdentityTypeEnum["TONWallet"] = "TON Wallet";
13
+ AirdropSigIdentityTypeEnum["Google"] = "Google Account";
13
14
  })(AirdropSigIdentityTypeEnum || (AirdropSigIdentityTypeEnum = {}));
14
15
  export var ETokenType;
15
16
  (function (ETokenType) {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/airdrop/types/index.ts"],"names":[],"mappings":"AAgBA,MAAM,CAAN,IAAY,SAIX;AAJD,WAAY,SAAS;IACnB,wBAAW,CAAA;IACX,wBAAW,CAAA;IACX,8BAAiB,CAAA;AACnB,CAAC,EAJW,SAAS,KAAT,SAAS,QAIpB;AAsDD,MAAM,CAAN,IAAY,0BAKX;AALD,WAAY,0BAA0B;IACpC,mDAAqB,CAAA;IACrB,4DAA8B,CAAA;IAC9B,sDAAwB,CAAA;IACxB,sDAAwB,CAAA;AAC1B,CAAC,EALW,0BAA0B,KAA1B,0BAA0B,QAKrC;AAUD,MAAM,CAAN,IAAY,UAIX;AAJD,WAAY,UAAU;IACpB,6BAAe,CAAA;IACf,qCAAuB,CAAA;IACvB,4BAAc,CAAA;AAChB,CAAC,EAJW,UAAU,KAAV,UAAU,QAIrB;AA6DD,MAAM,CAAN,IAAY,qBAKX;AALD,WAAY,qBAAqB;IAC/B,qCAAY,CAAA;IACZ,qCAAY,CAAA;IACZ,0CAAiB,CAAA;IACjB,4CAAmB,CAAA;AACrB,CAAC,EALW,qBAAqB,KAArB,qBAAqB,QAKhC;AAED,MAAM,CAAN,IAAY,qBAIX;AAJD,WAAY,qBAAqB;IAC/B,qCAAY,CAAA;IACZ,qCAAY,CAAA;IACZ,qCAAY,CAAA,CAAC,yBAAyB;AACxC,CAAC,EAJW,qBAAqB,KAArB,qBAAqB,QAIhC;AA8BD,MAAM,CAAN,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,6BAA6B;IAC7B,kEAAqD,CAAA;AACvD,CAAC,EAHW,SAAS,KAAT,SAAS,QAGpB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/airdrop/types/index.ts"],"names":[],"mappings":"AAgBA,MAAM,CAAN,IAAY,SAIX;AAJD,WAAY,SAAS;IACnB,wBAAW,CAAA;IACX,wBAAW,CAAA;IACX,8BAAiB,CAAA;AACnB,CAAC,EAJW,SAAS,KAAT,SAAS,QAIpB;AAsDD,MAAM,CAAN,IAAY,0BAMX;AAND,WAAY,0BAA0B;IACpC,mDAAqB,CAAA;IACrB,4DAA8B,CAAA;IAC9B,sDAAwB,CAAA;IACxB,sDAAwB,CAAA;IACxB,uDAAyB,CAAA;AAC3B,CAAC,EANW,0BAA0B,KAA1B,0BAA0B,QAMrC;AAUD,MAAM,CAAN,IAAY,UAIX;AAJD,WAAY,UAAU;IACpB,6BAAe,CAAA;IACf,qCAAuB,CAAA;IACvB,4BAAc,CAAA;AAChB,CAAC,EAJW,UAAU,KAAV,UAAU,QAIrB;AAkED,MAAM,CAAN,IAAY,qBAKX;AALD,WAAY,qBAAqB;IAC/B,qCAAY,CAAA;IACZ,qCAAY,CAAA;IACZ,0CAAiB,CAAA;IACjB,4CAAmB,CAAA;AACrB,CAAC,EALW,qBAAqB,KAArB,qBAAqB,QAKhC;AAED,MAAM,CAAN,IAAY,qBAIX;AAJD,WAAY,qBAAqB;IAC/B,qCAAY,CAAA;IACZ,qCAAY,CAAA;IACZ,qCAAY,CAAA,CAAC,yBAAyB;AACxC,CAAC,EAJW,qBAAqB,KAArB,qBAAqB,QAIhC;AA8BD,MAAM,CAAN,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,6BAA6B;IAC7B,kEAAqD,CAAA;AACvD,CAAC,EAHW,SAAS,KAAT,SAAS,QAGpB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sign-global/tokentable",
3
- "version": "0.4.3-beta.0",
3
+ "version": "0.4.3-beta.1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -21,28 +21,21 @@
21
21
  "@solana/spl-token": "^0.4.12",
22
22
  "@ethsign/utils-web": "^0.8.9",
23
23
  "@orbs-network/ton-access": "^2.3.3",
24
- "@rainbow-me/rainbowkit": "^2.2.3",
25
- "@solana/wallet-adapter-react": "^0.15.35",
26
- "@solana/wallet-adapter-react-ui": "^0.9.35",
27
24
  "@solana/wallet-adapter-wallets": "^0.19.32",
28
25
  "@solana/web3.js": "^1.98.0",
29
26
  "@ton/core": "^0.59.0",
30
27
  "@ton/ton": "^15.1.0",
31
28
  "@tonconnect/ui": "^2.0.11",
32
- "@tonconnect/ui-react": "^2.0.11",
33
29
  "@types/jest": "^29.5.14",
34
30
  "bignumber.js": "^9.1.2",
35
31
  "bs58": "^6.0.0",
36
32
  "dayjs": "^1.11.13",
37
33
  "jest": "^29.7.0",
38
34
  "nanoid": "^5.0.9",
39
- "react": "^18.2.0",
40
35
  "ton-core": "^0.53.0",
41
36
  "tonapi-sdk-js": "^2.0.3",
42
37
  "tonweb": "^0.0.66",
43
- "ts-jest": "^29.2.5",
44
- "viem": "^2.21.49",
45
- "wagmi": "^2.13.0"
38
+ "ts-jest": "^29.2.5"
46
39
  },
47
40
  "peerDependencies": {
48
41
  "react": "^18.2.0",
@@ -1,307 +0,0 @@
1
- import { TonClient } from '@ton/ton';
2
- import { getAirdropPro, getAirdropProject, getAirdropQuery, getAirdropContractConfig } from './services';
3
- import {
4
- ChainType,
5
- ETokenType,
6
- EvmAirdropVersionEnum,
7
- IAirdropClaim,
8
- IAirdropOptions,
9
- IContractConfig,
10
- IProject,
11
- IWalletClient
12
- } from './types';
13
- import { getTonProjectIdByAddress } from './common';
14
- import { AirdropStrategyFactory } from './strategies/AirdropStrategyFactory';
15
- import { IAirdropStrategy } from './strategies/IAirdropStrategy';
16
- import { strategyCache } from './strategies/StrategyCache';
17
-
18
- export class AirdropClient {
19
- private tonClient?: TonClient;
20
- private slug?: string;
21
- private projectId?: string;
22
- private endpoint?: string;
23
- private project: IProject | undefined;
24
- protected claims?: IAirdropClaim[];
25
- private projectPromise: Promise<void> | undefined;
26
- private claimHook: ((v: any) => any) | undefined;
27
- private contractConfig: IContractConfig | null = null;
28
-
29
- constructor(params: IAirdropOptions) {
30
- if ('slug' in params) {
31
- this.slug = params.slug;
32
- }
33
- this.projectId = params.projectId;
34
- this.endpoint = params.endpoint;
35
- if (this.project) {
36
- this.project = params.project;
37
- } else {
38
- this.projectPromise = this.initializeProjects();
39
- }
40
- }
41
-
42
- setTonClient(tonClient: TonClient) {
43
- this.tonClient = tonClient;
44
- }
45
-
46
- private getTonClient(): TonClient | undefined {
47
- if (!this.tonClient) {
48
- return undefined;
49
- }
50
- return this.tonClient;
51
- }
52
-
53
- private async fetchProjectFromSlug(address?: string): Promise<string | undefined> {
54
- if (!this.slug) return undefined;
55
-
56
- const res = await getAirdropPro(this.slug, this.endpoint);
57
- const projectMap = res?.childProjectMapping || {};
58
-
59
- return getTonProjectIdByAddress({
60
- address,
61
- slug: this.slug,
62
- data: projectMap
63
- });
64
- }
65
-
66
- private async fetchProjectDetails(projectId: string): Promise<void> {
67
- this.project = await getAirdropProject(projectId, this.endpoint);
68
- }
69
-
70
- protected async initializeProjects(address?: string) {
71
- try {
72
- let projectId = this.projectId;
73
-
74
- // If slug is provided, try to fetch project ID from slug
75
- if (!projectId) {
76
- projectId = await this.fetchProjectFromSlug(address);
77
- }
78
-
79
- if (!projectId) {
80
- return;
81
- }
82
-
83
- // Fetch project details
84
- await this.fetchProjectDetails(projectId);
85
- } catch (error: any) {
86
- throw new Error(`Failed to initialize project: ${error.message}`);
87
- }
88
- }
89
-
90
- async getProjectInfo() {
91
- if (this.projectPromise) {
92
- await this.projectPromise;
93
- }
94
- if (!this.project) throw new Error('Project not found');
95
- return this.project;
96
- }
97
-
98
- async getAirdropClaims(data: { address: string }) {
99
- if (this.slug) {
100
- await this.initializeProjects(data.address); // Fetch project details by address & slug
101
- }
102
- const project = await this.getProjectInfo();
103
-
104
- const res = await getAirdropQuery(
105
- {
106
- recipient: data.address,
107
- projectId: project!.id,
108
- recipientType: project!.recipientType
109
- },
110
- this.endpoint
111
- );
112
- const claimsRes = res.claims?.map((it) => ({
113
- ...it,
114
- project: project!,
115
- claimId: project!.chainType === ChainType.Evm ? `${project!.id}:${it.leaf}` : `${project!.id}:${it.index}`
116
- }));
117
- this.claims = claimsRes;
118
- return this.claims;
119
- }
120
-
121
- public async getStrategy(walletClient?: IWalletClient): Promise<IAirdropStrategy> {
122
- const project = await this.getProjectInfo();
123
- const version = this.contractConfig?.version || undefined;
124
-
125
- const hasWallet = !!walletClient;
126
-
127
- // Try to get cached strategy
128
- let strategy = strategyCache.getStrategy(project.contractAddress, project.chainId, project.chainType, hasWallet);
129
-
130
- if (!strategy) {
131
- // Create new strategy if not cached
132
- strategy = AirdropStrategyFactory.createStrategy({
133
- chainType: project.chainType,
134
- contractAddress: project.contractAddress,
135
- chainId: project.chainId,
136
- walletClient,
137
- tonClient: this.getTonClient(),
138
- version
139
- });
140
-
141
- // Initialize the strategy
142
- await strategy.initialize(walletClient);
143
-
144
- // Cache the initialized strategy
145
- strategyCache.setStrategy(project.contractAddress, project.chainId, project.chainType, strategy, hasWallet);
146
- } else if (hasWallet) {
147
- // If we have a wallet and the strategy exists, just initialize with the new wallet
148
- await strategy.initialize(walletClient);
149
- }
150
-
151
- return strategy;
152
- }
153
-
154
- private getClaimDataById(claimId: string) {
155
- const claimData = this.claims?.find((it) => it.claimId === claimId);
156
- if (!claimData) throw new Error('Claim data not found');
157
- return claimData;
158
- }
159
-
160
- setClaimHook(fn: (v: any) => any) {
161
- this.claimHook = fn;
162
- }
163
-
164
- private getDefaultExtraData() {
165
- return {
166
- isLegacy: true,
167
- attestationId: BigInt(1)
168
- };
169
- }
170
-
171
- private async calculateClaimFee(project: IProject, claimAmount: string): Promise<string | bigint | undefined> {
172
- if (project.chainType === ChainType.Evm) {
173
- const version = await this.getVersion();
174
- const isNativeFreeVersion =
175
- project.tokenType === ETokenType.Native &&
176
- [EvmAirdropVersionEnum.V3, EvmAirdropVersionEnum.V4].includes(version as EvmAirdropVersionEnum);
177
- return isNativeFreeVersion ? undefined : await this.getClaimFee(BigInt(claimAmount));
178
- }
179
-
180
- if (project.chainType === ChainType.Ton) {
181
- return await this.getClaimFee(BigInt(claimAmount));
182
- }
183
-
184
- return undefined;
185
- }
186
-
187
- async claimAirdrop(
188
- { claimId, walletClient }: { claimId: string; walletClient: IWalletClient },
189
- options?: { onLoading?: () => void }
190
- ) {
191
- // Get claim data and initialize strategy
192
- const claimData = this.getClaimDataById(claimId);
193
- const strategy = await this.getStrategy(walletClient);
194
- const project = await this.getProjectInfo();
195
-
196
- // Process extra data
197
- const extraData =
198
- project.chainType === ChainType.Ton
199
- ? undefined
200
- : this.claimHook
201
- ? this.claimHook(claimData)
202
- : this.getDefaultExtraData();
203
-
204
- // Calculate claim value based on project type
205
- const value = await this.calculateClaimFee(project, claimData.amount);
206
-
207
- // Execute claim with processed data
208
- return strategy.claim(
209
- {
210
- ...claimData,
211
- extraData,
212
- value
213
- },
214
- options
215
- );
216
- }
217
-
218
- async checkClaimed(claimId: string): Promise<boolean> {
219
- const claimData = this.getClaimDataById(claimId);
220
- const strategy = await this.getStrategy();
221
- return strategy.checkClaimed(claimData);
222
- }
223
-
224
- private async getContractConfig(): Promise<IContractConfig | null> {
225
- try {
226
- const project = await this.getProjectInfo();
227
-
228
- if (!this.contractConfig) {
229
- this.contractConfig = await getAirdropContractConfig(
230
- {
231
- chainId: project.chainId,
232
- chainType: project.chainType,
233
- contractAddress: project.contractAddress
234
- },
235
- this.endpoint
236
- );
237
- }
238
- return this.contractConfig;
239
- } catch (error) {
240
- console.error('Error fetching contract config:', error);
241
- return null;
242
- }
243
- }
244
-
245
- async getVersion(): Promise<string> {
246
- const config = await this.getContractConfig();
247
- if (config?.version) {
248
- return config.version;
249
- }
250
-
251
- const strategy = await this.getStrategy();
252
- return strategy.getVersion();
253
- }
254
-
255
- async getPaused(): Promise<boolean> {
256
- const config = await this.getContractConfig();
257
- if (config && config?.paused !== null) {
258
- return config.paused;
259
- }
260
-
261
- const strategy = await this.getStrategy();
262
- if (!strategy.getPaused) {
263
- throw new Error('getPaused is not supported for this chain');
264
- }
265
- return strategy.getPaused();
266
- }
267
-
268
- async getClaimFee(amount?: bigint): Promise<string | bigint> {
269
- const config = await this.getContractConfig();
270
- if (config?.claimFee) {
271
- return config.claimFee;
272
- }
273
-
274
- const strategy = await this.getStrategy();
275
- if (!strategy.getClaimFee) {
276
- throw new Error('getClaimFee is not supported for this chain');
277
- }
278
- return strategy.getClaimFee(this.project?.contractAddress || '', amount || BigInt(0));
279
- }
280
-
281
- // params claimId[]
282
- async batchCheckClaimed(): Promise<{ result: boolean; status: string }[]> {
283
- const strategy = await this.getStrategy();
284
- if (!strategy.batchCheckClaimed) {
285
- throw new Error('batchCheckClaimed is not supported for this chain');
286
- }
287
- const leafs = this.claims?.map((it) => it.leaf);
288
- if (!leafs) return [];
289
- return strategy.batchCheckClaimed(leafs);
290
- }
291
-
292
- async getNFT(): Promise<string> {
293
- const strategy = await this.getStrategy();
294
- if (!strategy.getNFT) {
295
- throw new Error('getNFT is not supported for this chain');
296
- }
297
- return strategy.getNFT();
298
- }
299
-
300
- async getKycThreshold(): Promise<bigint> {
301
- const strategy = await this.getStrategy();
302
- if (!strategy.getKycThreshold) {
303
- throw new Error('getKycThreshold is not supported for this chain');
304
- }
305
- return strategy.getKycThreshold();
306
- }
307
- }