@sign-global/tokentable-core 1.4.0 → 1.5.0

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @sign-global/tokentable-core
2
2
 
3
+ ## 1.5.0
4
+
5
+ ### Minor Changes
6
+
7
+ - feat: add Aptos blockchain support for airdrop functionality
8
+
9
+ ## 1.4.1
10
+
11
+ ### Patch Changes
12
+
13
+ - chore: update Solana devnet and mainnet RPC endpoints
14
+
3
15
  ## 1.4.0
4
16
 
5
17
  ### Minor Changes
package/dist/index.d.mts CHANGED
@@ -10,6 +10,7 @@ import { WalletContextState } from '@solana/wallet-adapter-react';
10
10
  export { WalletContextState as SolanaWalletState } from '@solana/wallet-adapter-react';
11
11
  import { Wallet as Wallet$1 } from '@mysten/wallet-standard';
12
12
  export { Wallet as SuiWalletClient } from '@mysten/wallet-standard';
13
+ import { useWallet } from '@aptos-labs/wallet-adapter-react';
13
14
  import * as tonapi_sdk_js from 'tonapi-sdk-js';
14
15
  import { Api, Event } from 'tonapi-sdk-js';
15
16
  import * as _ton_core from '@ton/core';
@@ -247,6 +248,31 @@ declare const suiMainNet: {
247
248
  };
248
249
  testnet: boolean;
249
250
  };
251
+ declare const aptosTestNet: {
252
+ id: number;
253
+ name: string;
254
+ network: string;
255
+ nativeCurrency: {
256
+ decimals: number;
257
+ name: string;
258
+ symbol: string;
259
+ };
260
+ rpcUrls: {
261
+ public: {
262
+ http: string[];
263
+ };
264
+ default: {
265
+ http: string[];
266
+ };
267
+ };
268
+ blockExplorers: {
269
+ default: {
270
+ name: string;
271
+ url: string;
272
+ };
273
+ };
274
+ testnet: boolean;
275
+ };
250
276
 
251
277
  declare const ChainConfig: {
252
278
  [solanaDevNet.id]: {
@@ -265,6 +291,14 @@ declare const ChainConfig: {
265
291
  contractAddress: string;
266
292
  rpcUrl: "https://fullnode.mainnet.sui.io:443" | "https://fullnode.testnet.sui.io:443" | "https://fullnode.devnet.sui.io:443" | "http://127.0.0.1:9000";
267
293
  };
294
+ [aptosTestNet.id]: {
295
+ contractAddress: string;
296
+ rpcUrl: string;
297
+ };
298
+ [aptosTestNet.id]: {
299
+ contractAddress: string;
300
+ rpcUrl: string;
301
+ };
268
302
  1: {
269
303
  contractAddress: string;
270
304
  rpcUrl: string;
@@ -1435,7 +1469,7 @@ declare class KycClientClient extends ContractBaseClient {
1435
1469
  kycThreshold(): Promise<bigint>;
1436
1470
  }
1437
1471
 
1438
- declare class AirdropService$2 {
1472
+ declare class AirdropService$3 {
1439
1473
  options: EvmContractClientOption;
1440
1474
  constructor(options: Omit<EvmContractClientOption, 'chain'>);
1441
1475
  private get airdropV3Client();
@@ -1503,7 +1537,7 @@ interface SolanaContractInfo {
1503
1537
  chainRpc: string;
1504
1538
  }
1505
1539
 
1506
- declare class AirdropService$1 {
1540
+ declare class AirdropService$2 {
1507
1541
  options: SolanaContractInfo;
1508
1542
  constructor(options: SolanaContractInfo);
1509
1543
  private get airdropClient();
@@ -1695,7 +1729,7 @@ interface IAirdropOption {
1695
1729
  version?: string;
1696
1730
  }
1697
1731
 
1698
- declare class AirdropService {
1732
+ declare class AirdropService$1 {
1699
1733
  private address;
1700
1734
  private walletClient?;
1701
1735
  private chainId;
@@ -1778,6 +1812,35 @@ declare class SignatureAirdropService {
1778
1812
  claim(data: ISignatureClaimData[], recipient?: string): Promise<string>;
1779
1813
  }
1780
1814
 
1815
+ type AptosContractInfo = {
1816
+ address: string;
1817
+ chainId: string;
1818
+ account?: ReturnType<typeof useWallet>;
1819
+ module: string;
1820
+ chainRpc: string;
1821
+ };
1822
+
1823
+ declare class AirdropService {
1824
+ options: Omit<AptosContractInfo, 'module'>;
1825
+ constructor(options: Omit<AptosContractInfo, 'module'>);
1826
+ private get airdropClient();
1827
+ private get baseClient();
1828
+ isLeafUsed(leaf: string): Promise<boolean>;
1829
+ batchFetchClaimed(leafs: string[]): Promise<{
1830
+ result: boolean;
1831
+ status: string;
1832
+ }[]>;
1833
+ claim({ proof, group, data, value }: {
1834
+ proof: string[];
1835
+ group: string;
1836
+ data: string;
1837
+ value?: bigint;
1838
+ }): Promise<string>;
1839
+ getVersion(): Promise<any>;
1840
+ getClaimFee(contractAddress: string, amount: bigint): Promise<number>;
1841
+ getPaused(): Promise<any>;
1842
+ }
1843
+
1781
1844
  type ChainId = keyof typeof ChainConfig;
1782
1845
  interface EvmContractClientOption {
1783
1846
  chainId: ChainId;
@@ -1791,7 +1854,8 @@ declare enum ChainType {
1791
1854
  Evm = "evm",
1792
1855
  Ton = "ton",
1793
1856
  Solana = "solana",
1794
- Sui = "sui"
1857
+ Sui = "sui",
1858
+ Aptos = "aptos"
1795
1859
  }
1796
1860
  type ThemeConfig = {
1797
1861
  logo?: string;
@@ -1951,9 +2015,10 @@ declare enum EvmAirdropVersionEnum {
1951
2015
  V3 = "0.3.0",// zeta 收费
1952
2016
  V4 = "0.4.0"
1953
2017
  }
1954
- type IWalletClient = TonConnectUI | WalletClient | WalletContextState | Wallet$1;
2018
+ type AptosWalletClient = ReturnType<typeof useWallet>;
2019
+ type IWalletClient = TonConnectUI | WalletClient | WalletContextState | Wallet$1 | AptosWalletClient;
1955
2020
 
1956
- type IAirdropService = AirdropService | AirdropService$2;
2021
+ type IAirdropService = AirdropService$1 | AirdropService$3;
1957
2022
  type BaseAirdropOptions = {
1958
2023
  endpoint?: string;
1959
2024
  project?: IProject;
@@ -2195,4 +2260,4 @@ declare const getAvailableClaimAmountForSignature: ({ contractAddress, chainId,
2195
2260
  }[];
2196
2261
  }) => Promise<string | 0>;
2197
2262
 
2198
- export { AirdropSigIdentityTypeEnum, ApiClient, type ApiClientOptions, type ApiRequestOptions, CONST, ChainConfig, type ChainId, ChainType, ETokenType, ErrorCode, AirdropService$2 as EvmAirdropService, EvmAirdropVersionEnum, type EvmContractClientOption, SignatureAirdropService$2 as EvmSignatureAirdropService, type FetchTokenMetadataOptions, type FetchTokenVersionOptions, type IAirdropClaim, type IAirdropClaimData, type IAirdropData, type IAirdropOptions, type IAirdropService, type IAirdropSignatureClaim, type IAirdropSignatureData, type IAirdropSignatureIdentity, type IClaimSignature, type IContractConfig, type IExtraData, type IProject, type IProjectExtra, type ISignatureClaimData, type IWalletClient, type Identity, AirdropService$1 as SolanaAirdropService, SignatureAirdropService$1 as SolanaSignatureAirdropService, SplTokenVersion, SignatureAirdropService as SuiSignatureAirdropService, type SupportedChainType, SupportedChains, type ThemeConfig, AirdropService as TonAirdropService, TonAirdropVersionEnum, TonWalletService, ZERO_ADDRESS, apiClient, batchCheckClaimedForSignature, bindWallet, checkEligibility, checkGetSignatures, cleanUrlParams, clusterApiUrl, connectDiscordApi, connectGoogleApi, connectTwitter, delay, disconnectRecipient, fetchTokenVersion, flipAddressType, getAirdropContractConfig, getAirdropPro, getAirdropProject, getAirdropProjectId, getAirdropQuery, getAvailableClaimAmountForSignature, getChainById, getChainConfig, getChainRpc, getCustomNaNoId, getJettonInfo, getOrCreateAssociatedTokenAccount, getTonProjectIdByAddress, hexStrToU8Array, isBeforeByUnix, isGreaterThan, isMobile, mevmDevNet, retry, safeParseJSON, safePlus, signBrBTestnet, solanaDevNet, solanaMainNet, suiMainNet, suiTestNet, tonMainNet, tonTestNet };
2263
+ export { AirdropSigIdentityTypeEnum, ApiClient, type ApiClientOptions, type ApiRequestOptions, AirdropService as AptosAirdropService, type AptosWalletClient, CONST, ChainConfig, type ChainId, ChainType, ETokenType, ErrorCode, AirdropService$3 as EvmAirdropService, EvmAirdropVersionEnum, type EvmContractClientOption, SignatureAirdropService$2 as EvmSignatureAirdropService, type FetchTokenMetadataOptions, type FetchTokenVersionOptions, type IAirdropClaim, type IAirdropClaimData, type IAirdropData, type IAirdropOptions, type IAirdropService, type IAirdropSignatureClaim, type IAirdropSignatureData, type IAirdropSignatureIdentity, type IClaimSignature, type IContractConfig, type IExtraData, type IProject, type IProjectExtra, type ISignatureClaimData, type IWalletClient, type Identity, AirdropService$2 as SolanaAirdropService, SignatureAirdropService$1 as SolanaSignatureAirdropService, SplTokenVersion, SignatureAirdropService as SuiSignatureAirdropService, type SupportedChainType, SupportedChains, type ThemeConfig, AirdropService$1 as TonAirdropService, TonAirdropVersionEnum, TonWalletService, ZERO_ADDRESS, apiClient, aptosTestNet, batchCheckClaimedForSignature, bindWallet, checkEligibility, checkGetSignatures, cleanUrlParams, clusterApiUrl, connectDiscordApi, connectGoogleApi, connectTwitter, delay, disconnectRecipient, fetchTokenVersion, flipAddressType, getAirdropContractConfig, getAirdropPro, getAirdropProject, getAirdropProjectId, getAirdropQuery, getAvailableClaimAmountForSignature, getChainById, getChainConfig, getChainRpc, getCustomNaNoId, getJettonInfo, getOrCreateAssociatedTokenAccount, getTonProjectIdByAddress, hexStrToU8Array, isBeforeByUnix, isGreaterThan, isMobile, mevmDevNet, retry, safeParseJSON, safePlus, signBrBTestnet, solanaDevNet, solanaMainNet, suiMainNet, suiTestNet, tonMainNet, tonTestNet };
package/dist/index.d.ts CHANGED
@@ -10,6 +10,7 @@ import { WalletContextState } from '@solana/wallet-adapter-react';
10
10
  export { WalletContextState as SolanaWalletState } from '@solana/wallet-adapter-react';
11
11
  import { Wallet as Wallet$1 } from '@mysten/wallet-standard';
12
12
  export { Wallet as SuiWalletClient } from '@mysten/wallet-standard';
13
+ import { useWallet } from '@aptos-labs/wallet-adapter-react';
13
14
  import * as tonapi_sdk_js from 'tonapi-sdk-js';
14
15
  import { Api, Event } from 'tonapi-sdk-js';
15
16
  import * as _ton_core from '@ton/core';
@@ -247,6 +248,31 @@ declare const suiMainNet: {
247
248
  };
248
249
  testnet: boolean;
249
250
  };
251
+ declare const aptosTestNet: {
252
+ id: number;
253
+ name: string;
254
+ network: string;
255
+ nativeCurrency: {
256
+ decimals: number;
257
+ name: string;
258
+ symbol: string;
259
+ };
260
+ rpcUrls: {
261
+ public: {
262
+ http: string[];
263
+ };
264
+ default: {
265
+ http: string[];
266
+ };
267
+ };
268
+ blockExplorers: {
269
+ default: {
270
+ name: string;
271
+ url: string;
272
+ };
273
+ };
274
+ testnet: boolean;
275
+ };
250
276
 
251
277
  declare const ChainConfig: {
252
278
  [solanaDevNet.id]: {
@@ -265,6 +291,14 @@ declare const ChainConfig: {
265
291
  contractAddress: string;
266
292
  rpcUrl: "https://fullnode.mainnet.sui.io:443" | "https://fullnode.testnet.sui.io:443" | "https://fullnode.devnet.sui.io:443" | "http://127.0.0.1:9000";
267
293
  };
294
+ [aptosTestNet.id]: {
295
+ contractAddress: string;
296
+ rpcUrl: string;
297
+ };
298
+ [aptosTestNet.id]: {
299
+ contractAddress: string;
300
+ rpcUrl: string;
301
+ };
268
302
  1: {
269
303
  contractAddress: string;
270
304
  rpcUrl: string;
@@ -1435,7 +1469,7 @@ declare class KycClientClient extends ContractBaseClient {
1435
1469
  kycThreshold(): Promise<bigint>;
1436
1470
  }
1437
1471
 
1438
- declare class AirdropService$2 {
1472
+ declare class AirdropService$3 {
1439
1473
  options: EvmContractClientOption;
1440
1474
  constructor(options: Omit<EvmContractClientOption, 'chain'>);
1441
1475
  private get airdropV3Client();
@@ -1503,7 +1537,7 @@ interface SolanaContractInfo {
1503
1537
  chainRpc: string;
1504
1538
  }
1505
1539
 
1506
- declare class AirdropService$1 {
1540
+ declare class AirdropService$2 {
1507
1541
  options: SolanaContractInfo;
1508
1542
  constructor(options: SolanaContractInfo);
1509
1543
  private get airdropClient();
@@ -1695,7 +1729,7 @@ interface IAirdropOption {
1695
1729
  version?: string;
1696
1730
  }
1697
1731
 
1698
- declare class AirdropService {
1732
+ declare class AirdropService$1 {
1699
1733
  private address;
1700
1734
  private walletClient?;
1701
1735
  private chainId;
@@ -1778,6 +1812,35 @@ declare class SignatureAirdropService {
1778
1812
  claim(data: ISignatureClaimData[], recipient?: string): Promise<string>;
1779
1813
  }
1780
1814
 
1815
+ type AptosContractInfo = {
1816
+ address: string;
1817
+ chainId: string;
1818
+ account?: ReturnType<typeof useWallet>;
1819
+ module: string;
1820
+ chainRpc: string;
1821
+ };
1822
+
1823
+ declare class AirdropService {
1824
+ options: Omit<AptosContractInfo, 'module'>;
1825
+ constructor(options: Omit<AptosContractInfo, 'module'>);
1826
+ private get airdropClient();
1827
+ private get baseClient();
1828
+ isLeafUsed(leaf: string): Promise<boolean>;
1829
+ batchFetchClaimed(leafs: string[]): Promise<{
1830
+ result: boolean;
1831
+ status: string;
1832
+ }[]>;
1833
+ claim({ proof, group, data, value }: {
1834
+ proof: string[];
1835
+ group: string;
1836
+ data: string;
1837
+ value?: bigint;
1838
+ }): Promise<string>;
1839
+ getVersion(): Promise<any>;
1840
+ getClaimFee(contractAddress: string, amount: bigint): Promise<number>;
1841
+ getPaused(): Promise<any>;
1842
+ }
1843
+
1781
1844
  type ChainId = keyof typeof ChainConfig;
1782
1845
  interface EvmContractClientOption {
1783
1846
  chainId: ChainId;
@@ -1791,7 +1854,8 @@ declare enum ChainType {
1791
1854
  Evm = "evm",
1792
1855
  Ton = "ton",
1793
1856
  Solana = "solana",
1794
- Sui = "sui"
1857
+ Sui = "sui",
1858
+ Aptos = "aptos"
1795
1859
  }
1796
1860
  type ThemeConfig = {
1797
1861
  logo?: string;
@@ -1951,9 +2015,10 @@ declare enum EvmAirdropVersionEnum {
1951
2015
  V3 = "0.3.0",// zeta 收费
1952
2016
  V4 = "0.4.0"
1953
2017
  }
1954
- type IWalletClient = TonConnectUI | WalletClient | WalletContextState | Wallet$1;
2018
+ type AptosWalletClient = ReturnType<typeof useWallet>;
2019
+ type IWalletClient = TonConnectUI | WalletClient | WalletContextState | Wallet$1 | AptosWalletClient;
1955
2020
 
1956
- type IAirdropService = AirdropService | AirdropService$2;
2021
+ type IAirdropService = AirdropService$1 | AirdropService$3;
1957
2022
  type BaseAirdropOptions = {
1958
2023
  endpoint?: string;
1959
2024
  project?: IProject;
@@ -2195,4 +2260,4 @@ declare const getAvailableClaimAmountForSignature: ({ contractAddress, chainId,
2195
2260
  }[];
2196
2261
  }) => Promise<string | 0>;
2197
2262
 
2198
- export { AirdropSigIdentityTypeEnum, ApiClient, type ApiClientOptions, type ApiRequestOptions, CONST, ChainConfig, type ChainId, ChainType, ETokenType, ErrorCode, AirdropService$2 as EvmAirdropService, EvmAirdropVersionEnum, type EvmContractClientOption, SignatureAirdropService$2 as EvmSignatureAirdropService, type FetchTokenMetadataOptions, type FetchTokenVersionOptions, type IAirdropClaim, type IAirdropClaimData, type IAirdropData, type IAirdropOptions, type IAirdropService, type IAirdropSignatureClaim, type IAirdropSignatureData, type IAirdropSignatureIdentity, type IClaimSignature, type IContractConfig, type IExtraData, type IProject, type IProjectExtra, type ISignatureClaimData, type IWalletClient, type Identity, AirdropService$1 as SolanaAirdropService, SignatureAirdropService$1 as SolanaSignatureAirdropService, SplTokenVersion, SignatureAirdropService as SuiSignatureAirdropService, type SupportedChainType, SupportedChains, type ThemeConfig, AirdropService as TonAirdropService, TonAirdropVersionEnum, TonWalletService, ZERO_ADDRESS, apiClient, batchCheckClaimedForSignature, bindWallet, checkEligibility, checkGetSignatures, cleanUrlParams, clusterApiUrl, connectDiscordApi, connectGoogleApi, connectTwitter, delay, disconnectRecipient, fetchTokenVersion, flipAddressType, getAirdropContractConfig, getAirdropPro, getAirdropProject, getAirdropProjectId, getAirdropQuery, getAvailableClaimAmountForSignature, getChainById, getChainConfig, getChainRpc, getCustomNaNoId, getJettonInfo, getOrCreateAssociatedTokenAccount, getTonProjectIdByAddress, hexStrToU8Array, isBeforeByUnix, isGreaterThan, isMobile, mevmDevNet, retry, safeParseJSON, safePlus, signBrBTestnet, solanaDevNet, solanaMainNet, suiMainNet, suiTestNet, tonMainNet, tonTestNet };
2263
+ export { AirdropSigIdentityTypeEnum, ApiClient, type ApiClientOptions, type ApiRequestOptions, AirdropService as AptosAirdropService, type AptosWalletClient, CONST, ChainConfig, type ChainId, ChainType, ETokenType, ErrorCode, AirdropService$3 as EvmAirdropService, EvmAirdropVersionEnum, type EvmContractClientOption, SignatureAirdropService$2 as EvmSignatureAirdropService, type FetchTokenMetadataOptions, type FetchTokenVersionOptions, type IAirdropClaim, type IAirdropClaimData, type IAirdropData, type IAirdropOptions, type IAirdropService, type IAirdropSignatureClaim, type IAirdropSignatureData, type IAirdropSignatureIdentity, type IClaimSignature, type IContractConfig, type IExtraData, type IProject, type IProjectExtra, type ISignatureClaimData, type IWalletClient, type Identity, AirdropService$2 as SolanaAirdropService, SignatureAirdropService$1 as SolanaSignatureAirdropService, SplTokenVersion, SignatureAirdropService as SuiSignatureAirdropService, type SupportedChainType, SupportedChains, type ThemeConfig, AirdropService$1 as TonAirdropService, TonAirdropVersionEnum, TonWalletService, ZERO_ADDRESS, apiClient, aptosTestNet, batchCheckClaimedForSignature, bindWallet, checkEligibility, checkGetSignatures, cleanUrlParams, clusterApiUrl, connectDiscordApi, connectGoogleApi, connectTwitter, delay, disconnectRecipient, fetchTokenVersion, flipAddressType, getAirdropContractConfig, getAirdropPro, getAirdropProject, getAirdropProjectId, getAirdropQuery, getAvailableClaimAmountForSignature, getChainById, getChainConfig, getChainRpc, getCustomNaNoId, getJettonInfo, getOrCreateAssociatedTokenAccount, getTonProjectIdByAddress, hexStrToU8Array, isBeforeByUnix, isGreaterThan, isMobile, mevmDevNet, retry, safeParseJSON, safePlus, signBrBTestnet, solanaDevNet, solanaMainNet, suiMainNet, suiTestNet, tonMainNet, tonTestNet };
package/dist/index.js CHANGED
@@ -32,6 +32,7 @@ var index_exports = {};
32
32
  __export(index_exports, {
33
33
  AirdropSigIdentityTypeEnum: () => AirdropSigIdentityTypeEnum,
34
34
  ApiClient: () => ApiClient,
35
+ AptosAirdropService: () => AirdropService4,
35
36
  CONST: () => CONST,
36
37
  ChainConfig: () => ChainConfig,
37
38
  ChainType: () => ChainType,
@@ -50,6 +51,7 @@ __export(index_exports, {
50
51
  TonWalletService: () => TonWalletService,
51
52
  ZERO_ADDRESS: () => ZERO_ADDRESS,
52
53
  apiClient: () => apiClient,
54
+ aptosTestNet: () => aptosTestNet,
53
55
  batchCheckClaimedForSignature: () => batchCheckClaimedForSignature,
54
56
  bindWallet: () => bindWallet,
55
57
  checkEligibility: () => checkEligibility,
@@ -185,10 +187,10 @@ var solanaDevNet = {
185
187
  },
186
188
  rpcUrls: {
187
189
  public: {
188
- http: ["https://devnet.helius-rpc.com/?api-key=92a10901-e587-4f65-a180-4a63b7305966"]
190
+ http: ["https://serene-empty-film.solana-devnet.quiknode.pro/7fcc62232b14dc8a6a154597ee028ebf00e0c195"]
189
191
  },
190
192
  default: {
191
- http: ["https://devnet.helius-rpc.com/?api-key=92a10901-e587-4f65-a180-4a63b7305966"]
193
+ http: ["https://serene-empty-film.solana-devnet.quiknode.pro/7fcc62232b14dc8a6a154597ee028ebf00e0c195"]
192
194
  }
193
195
  },
194
196
  blockExplorers: {
@@ -210,10 +212,10 @@ var solanaMainNet = {
210
212
  },
211
213
  rpcUrls: {
212
214
  public: {
213
- http: ["https://neat-falling-dream.solana-mainnet.quiknode.pro/55dbcc2244d010e047c4ab1e3b7964cc6204505d"]
215
+ http: ["https://serene-empty-film.solana-mainnet.quiknode.pro/7fcc62232b14dc8a6a154597ee028ebf00e0c195"]
214
216
  },
215
217
  default: {
216
- http: ["https://neat-falling-dream.solana-mainnet.quiknode.pro/55dbcc2244d010e047c4ab1e3b7964cc6204505d"]
218
+ http: ["https://serene-empty-film.solana-mainnet.quiknode.pro/7fcc62232b14dc8a6a154597ee028ebf00e0c195"]
217
219
  }
218
220
  },
219
221
  blockExplorers: {
@@ -295,6 +297,31 @@ var suiMainNet = {
295
297
  },
296
298
  testnet: false
297
299
  };
300
+ var aptosTestNet = {
301
+ id: 2,
302
+ name: "Aptos Testnet",
303
+ network: "Aptos Testnet",
304
+ nativeCurrency: {
305
+ decimals: 8,
306
+ name: "Aptos",
307
+ symbol: "APT"
308
+ },
309
+ rpcUrls: {
310
+ public: {
311
+ http: ["https://api.testnet.aptoslabs.com/v1"]
312
+ },
313
+ default: {
314
+ http: ["https://api.testnet.aptoslabs.com/v1"]
315
+ }
316
+ },
317
+ blockExplorers: {
318
+ default: {
319
+ name: "aptos scan",
320
+ url: "hhttps://explorer.aptoslabs.com/"
321
+ }
322
+ },
323
+ testnet: true
324
+ };
298
325
 
299
326
  // src/constants/chain-config.ts
300
327
  var import_sdk2 = require("@tonconnect/sdk");
@@ -389,6 +416,10 @@ var ChainConfig = {
389
416
  [suiMainNet.id]: {
390
417
  contractAddress: "0x3f73ec78d3e8a99277496edb6183d6075490983c2a29542a1c3f709aa31169b5",
391
418
  rpcUrl: suiMainNet.rpcUrls.default.http[0]
419
+ },
420
+ [aptosTestNet.id]: {
421
+ contractAddress: "0x0ee860c2c1dc9e6d7c013cfc78cecfc226dfffa403b0ca212b38d958bc1048c9",
422
+ rpcUrl: aptosTestNet.rpcUrls.default.http[0]
392
423
  }
393
424
  };
394
425
  var SupportedChains = [
@@ -3800,6 +3831,7 @@ var ChainType = /* @__PURE__ */ ((ChainType2) => {
3800
3831
  ChainType2["Ton"] = "ton";
3801
3832
  ChainType2["Solana"] = "solana";
3802
3833
  ChainType2["Sui"] = "sui";
3834
+ ChainType2["Aptos"] = "aptos";
3803
3835
  return ChainType2;
3804
3836
  })(ChainType || {});
3805
3837
  var AirdropSigIdentityTypeEnum = /* @__PURE__ */ ((AirdropSigIdentityTypeEnum2) => {
@@ -12638,6 +12670,13 @@ var SuiDistributorWithFeeClient = class extends SuiContractClientBase {
12638
12670
  const clock = await this.getSharedObjectRef(tx, "0x6", false);
12639
12671
  const hexToBytes = (hex) => Array.from(Buffer.from(hex.replace(/^0x/, ""), "hex"));
12640
12672
  const feeTokenType = "0x2::sui::SUI";
12673
+ const gasBalance = await this.client.getBalance({
12674
+ owner: this.wallet.accounts[0].address,
12675
+ coinType: feeTokenType
12676
+ });
12677
+ if (BigInt(gasBalance.totalBalance) < totalFees) {
12678
+ throw new Error(`Insufficient SUI balance. Required: ${totalFees}, Available: ${gasBalance.totalBalance}`);
12679
+ }
12641
12680
  const [feeCoin] = tx.splitCoins(
12642
12681
  tx.gas,
12643
12682
  // 用 gas 对象作为源
@@ -12713,10 +12752,233 @@ var SignatureAirdropService3 = class {
12713
12752
  return this.feeDistributorClient.claimWithFee(this.options.coinType, feeCollector, data);
12714
12753
  }
12715
12754
  };
12755
+
12756
+ // src/contracts/aptos/AptosContractClient.ts
12757
+ var import_ts_sdk = require("@aptos-labs/ts-sdk");
12758
+ var AptosContractClientBase = class {
12759
+ address;
12760
+ chainId;
12761
+ wallet;
12762
+ client;
12763
+ module;
12764
+ constructor(contractInfo) {
12765
+ this.address = contractInfo.address;
12766
+ this.chainId = contractInfo.chainId;
12767
+ this.wallet = contractInfo.account;
12768
+ this.module = contractInfo.module;
12769
+ this.client = this.initClient(contractInfo.chainRpc);
12770
+ }
12771
+ initClient(chainRpc) {
12772
+ const chainIdMap = {
12773
+ "2": import_ts_sdk.Network.TESTNET,
12774
+ "1": import_ts_sdk.Network.MAINNET
12775
+ };
12776
+ const config = new import_ts_sdk.AptosConfig({
12777
+ network: chainIdMap[this.chainId],
12778
+ fullnode: chainRpc
12779
+ });
12780
+ return new import_ts_sdk.Aptos(config);
12781
+ }
12782
+ async invokeContractRead(method, args) {
12783
+ try {
12784
+ const viewPayload = {
12785
+ function: `${this.address}::${this.module}::${method}`,
12786
+ functionArguments: args
12787
+ };
12788
+ return await this.client.view({ payload: viewPayload });
12789
+ } catch (error) {
12790
+ console.error(`Error invoking read method ${method}:`, error);
12791
+ throw error;
12792
+ }
12793
+ }
12794
+ async invokeContractWrite(method, args) {
12795
+ if (!this.wallet) {
12796
+ throw new Error("Account not connected");
12797
+ }
12798
+ try {
12799
+ const response = await this.wallet.signAndSubmitTransaction({
12800
+ sender: this.wallet.account?.address,
12801
+ data: {
12802
+ function: `${this.address}::${this.module}::${method}`,
12803
+ functionArguments: args
12804
+ }
12805
+ });
12806
+ await this.client.waitForTransaction({
12807
+ transactionHash: response.hash
12808
+ });
12809
+ return response.hash;
12810
+ } catch (error) {
12811
+ console.error(`Error invoking write method ${method}:`, error);
12812
+ throw error;
12813
+ }
12814
+ }
12815
+ async signTransaction({
12816
+ functionName,
12817
+ functionArguments,
12818
+ typeArguments
12819
+ }) {
12820
+ if (!this.wallet) {
12821
+ throw new Error("Account not connected");
12822
+ }
12823
+ try {
12824
+ const response = await this.wallet.signAndSubmitTransaction({
12825
+ sender: this.wallet.account?.address,
12826
+ data: {
12827
+ function: functionName,
12828
+ functionArguments,
12829
+ typeArguments: typeArguments || []
12830
+ }
12831
+ });
12832
+ const res = await this.client.waitForTransaction({
12833
+ transactionHash: response.hash
12834
+ });
12835
+ return response.hash;
12836
+ } catch (error) {
12837
+ throw error;
12838
+ }
12839
+ }
12840
+ };
12841
+
12842
+ // src/contracts/aptos/AptosAirdropClient.ts
12843
+ var AptosAirdropContractClient = class extends AptosContractClientBase {
12844
+ airdropAddress;
12845
+ constructor(options) {
12846
+ const chainConfig = getChainConfig(options.chainId);
12847
+ super({
12848
+ ...options,
12849
+ address: chainConfig.contractAddress,
12850
+ module: "merkle_distributor_with_fees"
12851
+ });
12852
+ this.airdropAddress = options.address;
12853
+ }
12854
+ hexToBytes(hexStr) {
12855
+ const hex = hexStr.startsWith("0x") ? hexStr.slice(2) : hexStr;
12856
+ return Array.from(Buffer.from(hex, "hex"));
12857
+ }
12858
+ async claim({ proof, group, data, value }) {
12859
+ const dataBytes = this.hexToBytes(data);
12860
+ const proofBytes = proof.map((p) => this.hexToBytes(p));
12861
+ return await this.invokeContractWrite("claim", [this.airdropAddress, proofBytes, dataBytes]);
12862
+ }
12863
+ };
12864
+
12865
+ // src/contracts/aptos/AptosBaseDistributorClient.ts
12866
+ var AptosBaseDistributorContractClient = class extends AptosContractClientBase {
12867
+ airdropAddress;
12868
+ constructor(options) {
12869
+ const chainConfig = getChainConfig(options.chainId);
12870
+ super({
12871
+ ...options,
12872
+ address: chainConfig.contractAddress,
12873
+ module: "base_distributor"
12874
+ });
12875
+ this.airdropAddress = options.address;
12876
+ }
12877
+ async getContractInfo() {
12878
+ const data = await this.invokeContractRead("get_distribution_info", [this.airdropAddress]);
12879
+ console.log("data", data);
12880
+ const [root, token, startTime, endTime, owner, version, paused] = data;
12881
+ return {
12882
+ root,
12883
+ token,
12884
+ startTime: Number(startTime),
12885
+ endTime: Number(endTime),
12886
+ owner,
12887
+ version,
12888
+ paused
12889
+ };
12890
+ }
12891
+ async deposit({ amount, token }) {
12892
+ return await this.signTransaction({
12893
+ functionName: `0x1::primary_fungible_store::transfer`,
12894
+ functionArguments: [token, this.airdropAddress, amount],
12895
+ typeArguments: ["0x1::fungible_asset::Metadata"]
12896
+ });
12897
+ }
12898
+ async isLeafUsed(leaf) {
12899
+ const leafBytes = leaf.startsWith("0x") ? Array.from(Buffer.from(leaf.slice(2), "hex")) : Array.from(Buffer.from(leaf, "hex"));
12900
+ const res = await this.invokeContractRead("is_leaf_used", [this.airdropAddress, leafBytes]);
12901
+ console.log("res", res);
12902
+ return res[0];
12903
+ }
12904
+ async batchFetchClaimed(leafs) {
12905
+ const res = await Promise.all(
12906
+ leafs.map(async (leaf) => {
12907
+ return this.isLeafUsed(leaf);
12908
+ })
12909
+ );
12910
+ return res.map((info) => ({
12911
+ result: info || false,
12912
+ status: "success"
12913
+ }));
12914
+ }
12915
+ hexToBytes(hexStr) {
12916
+ const hex = hexStr.startsWith("0x") ? hexStr.slice(2) : hexStr;
12917
+ return Array.from(Buffer.from(hex, "hex"));
12918
+ }
12919
+ async claim({ proof, data }) {
12920
+ const groupBytes = this.hexToBytes("");
12921
+ const dataBytes = this.hexToBytes(data);
12922
+ const proofBytes = proof.map((p) => this.hexToBytes(p));
12923
+ return await this.invokeContractWrite("claim", [this.airdropAddress, proofBytes, groupBytes, dataBytes]);
12924
+ }
12925
+ async getPaused() {
12926
+ const res = await this.getContractInfo();
12927
+ return res.paused;
12928
+ }
12929
+ async getClaimFee(contractAddress13, amount) {
12930
+ return 0;
12931
+ }
12932
+ };
12933
+
12934
+ // src/contracts/aptos/AirdropService.ts
12935
+ var AirdropService4 = class {
12936
+ options;
12937
+ constructor(options) {
12938
+ this.options = options;
12939
+ }
12940
+ get airdropClient() {
12941
+ if (!this.options) {
12942
+ throw new Error("options is empty");
12943
+ }
12944
+ return new AptosAirdropContractClient(this.options);
12945
+ }
12946
+ get baseClient() {
12947
+ if (!this.options) {
12948
+ throw new Error("options is empty");
12949
+ }
12950
+ return new AptosBaseDistributorContractClient(this.options);
12951
+ }
12952
+ async isLeafUsed(leaf) {
12953
+ return this.baseClient.isLeafUsed(leaf);
12954
+ }
12955
+ async batchFetchClaimed(leafs) {
12956
+ return this.baseClient.batchFetchClaimed(leafs);
12957
+ }
12958
+ async claim({ proof, group, data, value }) {
12959
+ return this.airdropClient.claim({
12960
+ proof,
12961
+ group,
12962
+ data,
12963
+ value
12964
+ });
12965
+ }
12966
+ async getVersion() {
12967
+ const res = await this.baseClient.getContractInfo();
12968
+ return res.version;
12969
+ }
12970
+ async getClaimFee(contractAddress13, amount) {
12971
+ return this.baseClient.getClaimFee(contractAddress13, amount);
12972
+ }
12973
+ async getPaused() {
12974
+ return this.baseClient.getPaused();
12975
+ }
12976
+ };
12716
12977
  // Annotate the CommonJS export names for ESM import in node:
12717
12978
  0 && (module.exports = {
12718
12979
  AirdropSigIdentityTypeEnum,
12719
12980
  ApiClient,
12981
+ AptosAirdropService,
12720
12982
  CONST,
12721
12983
  ChainConfig,
12722
12984
  ChainType,
@@ -12735,6 +12997,7 @@ var SignatureAirdropService3 = class {
12735
12997
  TonWalletService,
12736
12998
  ZERO_ADDRESS,
12737
12999
  apiClient,
13000
+ aptosTestNet,
12738
13001
  batchCheckClaimedForSignature,
12739
13002
  bindWallet,
12740
13003
  checkEligibility,