@sign-global/tokentable-core 1.4.1 → 1.6.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.6.0
4
+
5
+ ### Minor Changes
6
+
7
+ - feat: add Cosmos wallet support
8
+
9
+ ## 1.5.0
10
+
11
+ ### Minor Changes
12
+
13
+ - feat: add Aptos blockchain support for airdrop functionality
14
+
3
15
  ## 1.4.1
4
16
 
5
17
  ### Patch 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,9 @@ declare enum ChainType {
1791
1854
  Evm = "evm",
1792
1855
  Ton = "ton",
1793
1856
  Solana = "solana",
1794
- Sui = "sui"
1857
+ Sui = "sui",
1858
+ Aptos = "aptos",
1859
+ Cosmos = "cosmos"
1795
1860
  }
1796
1861
  type ThemeConfig = {
1797
1862
  logo?: string;
@@ -1847,6 +1912,7 @@ declare enum AirdropSigIdentityTypeEnum {
1847
1912
  SolanaWallet = "Solana Wallet",
1848
1913
  EVMWallet = "EVM Wallet",
1849
1914
  TONWallet = "TON Wallet",
1915
+ CosmosWallet = "Cosmos Wallet",
1850
1916
  Google = "Google Account",
1851
1917
  Discord = "Discord Account"
1852
1918
  }
@@ -1951,9 +2017,10 @@ declare enum EvmAirdropVersionEnum {
1951
2017
  V3 = "0.3.0",// zeta 收费
1952
2018
  V4 = "0.4.0"
1953
2019
  }
1954
- type IWalletClient = TonConnectUI | WalletClient | WalletContextState | Wallet$1;
2020
+ type AptosWalletClient = ReturnType<typeof useWallet>;
2021
+ type IWalletClient = TonConnectUI | WalletClient | WalletContextState | Wallet$1 | AptosWalletClient;
1955
2022
 
1956
- type IAirdropService = AirdropService | AirdropService$2;
2023
+ type IAirdropService = AirdropService$1 | AirdropService$3;
1957
2024
  type BaseAirdropOptions = {
1958
2025
  endpoint?: string;
1959
2026
  project?: IProject;
@@ -2195,4 +2262,4 @@ declare const getAvailableClaimAmountForSignature: ({ contractAddress, chainId,
2195
2262
  }[];
2196
2263
  }) => Promise<string | 0>;
2197
2264
 
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 };
2265
+ 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,9 @@ declare enum ChainType {
1791
1854
  Evm = "evm",
1792
1855
  Ton = "ton",
1793
1856
  Solana = "solana",
1794
- Sui = "sui"
1857
+ Sui = "sui",
1858
+ Aptos = "aptos",
1859
+ Cosmos = "cosmos"
1795
1860
  }
1796
1861
  type ThemeConfig = {
1797
1862
  logo?: string;
@@ -1847,6 +1912,7 @@ declare enum AirdropSigIdentityTypeEnum {
1847
1912
  SolanaWallet = "Solana Wallet",
1848
1913
  EVMWallet = "EVM Wallet",
1849
1914
  TONWallet = "TON Wallet",
1915
+ CosmosWallet = "Cosmos Wallet",
1850
1916
  Google = "Google Account",
1851
1917
  Discord = "Discord Account"
1852
1918
  }
@@ -1951,9 +2017,10 @@ declare enum EvmAirdropVersionEnum {
1951
2017
  V3 = "0.3.0",// zeta 收费
1952
2018
  V4 = "0.4.0"
1953
2019
  }
1954
- type IWalletClient = TonConnectUI | WalletClient | WalletContextState | Wallet$1;
2020
+ type AptosWalletClient = ReturnType<typeof useWallet>;
2021
+ type IWalletClient = TonConnectUI | WalletClient | WalletContextState | Wallet$1 | AptosWalletClient;
1955
2022
 
1956
- type IAirdropService = AirdropService | AirdropService$2;
2023
+ type IAirdropService = AirdropService$1 | AirdropService$3;
1957
2024
  type BaseAirdropOptions = {
1958
2025
  endpoint?: string;
1959
2026
  project?: IProject;
@@ -2195,4 +2262,4 @@ declare const getAvailableClaimAmountForSignature: ({ contractAddress, chainId,
2195
2262
  }[];
2196
2263
  }) => Promise<string | 0>;
2197
2264
 
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 };
2265
+ 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,
@@ -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,8 @@ var ChainType = /* @__PURE__ */ ((ChainType2) => {
3800
3831
  ChainType2["Ton"] = "ton";
3801
3832
  ChainType2["Solana"] = "solana";
3802
3833
  ChainType2["Sui"] = "sui";
3834
+ ChainType2["Aptos"] = "aptos";
3835
+ ChainType2["Cosmos"] = "cosmos";
3803
3836
  return ChainType2;
3804
3837
  })(ChainType || {});
3805
3838
  var AirdropSigIdentityTypeEnum = /* @__PURE__ */ ((AirdropSigIdentityTypeEnum2) => {
@@ -3807,6 +3840,7 @@ var AirdropSigIdentityTypeEnum = /* @__PURE__ */ ((AirdropSigIdentityTypeEnum2)
3807
3840
  AirdropSigIdentityTypeEnum2["SolanaWallet"] = "Solana Wallet";
3808
3841
  AirdropSigIdentityTypeEnum2["EVMWallet"] = "EVM Wallet";
3809
3842
  AirdropSigIdentityTypeEnum2["TONWallet"] = "TON Wallet";
3843
+ AirdropSigIdentityTypeEnum2["CosmosWallet"] = "Cosmos Wallet";
3810
3844
  AirdropSigIdentityTypeEnum2["Google"] = "Google Account";
3811
3845
  AirdropSigIdentityTypeEnum2["Discord"] = "Discord Account";
3812
3846
  return AirdropSigIdentityTypeEnum2;
@@ -12638,6 +12672,13 @@ var SuiDistributorWithFeeClient = class extends SuiContractClientBase {
12638
12672
  const clock = await this.getSharedObjectRef(tx, "0x6", false);
12639
12673
  const hexToBytes = (hex) => Array.from(Buffer.from(hex.replace(/^0x/, ""), "hex"));
12640
12674
  const feeTokenType = "0x2::sui::SUI";
12675
+ const gasBalance = await this.client.getBalance({
12676
+ owner: this.wallet.accounts[0].address,
12677
+ coinType: feeTokenType
12678
+ });
12679
+ if (BigInt(gasBalance.totalBalance) < totalFees) {
12680
+ throw new Error(`Insufficient SUI balance. Required: ${totalFees}, Available: ${gasBalance.totalBalance}`);
12681
+ }
12641
12682
  const [feeCoin] = tx.splitCoins(
12642
12683
  tx.gas,
12643
12684
  // 用 gas 对象作为源
@@ -12713,10 +12754,233 @@ var SignatureAirdropService3 = class {
12713
12754
  return this.feeDistributorClient.claimWithFee(this.options.coinType, feeCollector, data);
12714
12755
  }
12715
12756
  };
12757
+
12758
+ // src/contracts/aptos/AptosContractClient.ts
12759
+ var import_ts_sdk = require("@aptos-labs/ts-sdk");
12760
+ var AptosContractClientBase = class {
12761
+ address;
12762
+ chainId;
12763
+ wallet;
12764
+ client;
12765
+ module;
12766
+ constructor(contractInfo) {
12767
+ this.address = contractInfo.address;
12768
+ this.chainId = contractInfo.chainId;
12769
+ this.wallet = contractInfo.account;
12770
+ this.module = contractInfo.module;
12771
+ this.client = this.initClient(contractInfo.chainRpc);
12772
+ }
12773
+ initClient(chainRpc) {
12774
+ const chainIdMap = {
12775
+ "2": import_ts_sdk.Network.TESTNET,
12776
+ "1": import_ts_sdk.Network.MAINNET
12777
+ };
12778
+ const config = new import_ts_sdk.AptosConfig({
12779
+ network: chainIdMap[this.chainId],
12780
+ fullnode: chainRpc
12781
+ });
12782
+ return new import_ts_sdk.Aptos(config);
12783
+ }
12784
+ async invokeContractRead(method, args) {
12785
+ try {
12786
+ const viewPayload = {
12787
+ function: `${this.address}::${this.module}::${method}`,
12788
+ functionArguments: args
12789
+ };
12790
+ return await this.client.view({ payload: viewPayload });
12791
+ } catch (error) {
12792
+ console.error(`Error invoking read method ${method}:`, error);
12793
+ throw error;
12794
+ }
12795
+ }
12796
+ async invokeContractWrite(method, args) {
12797
+ if (!this.wallet) {
12798
+ throw new Error("Account not connected");
12799
+ }
12800
+ try {
12801
+ const response = await this.wallet.signAndSubmitTransaction({
12802
+ sender: this.wallet.account?.address,
12803
+ data: {
12804
+ function: `${this.address}::${this.module}::${method}`,
12805
+ functionArguments: args
12806
+ }
12807
+ });
12808
+ await this.client.waitForTransaction({
12809
+ transactionHash: response.hash
12810
+ });
12811
+ return response.hash;
12812
+ } catch (error) {
12813
+ console.error(`Error invoking write method ${method}:`, error);
12814
+ throw error;
12815
+ }
12816
+ }
12817
+ async signTransaction({
12818
+ functionName,
12819
+ functionArguments,
12820
+ typeArguments
12821
+ }) {
12822
+ if (!this.wallet) {
12823
+ throw new Error("Account not connected");
12824
+ }
12825
+ try {
12826
+ const response = await this.wallet.signAndSubmitTransaction({
12827
+ sender: this.wallet.account?.address,
12828
+ data: {
12829
+ function: functionName,
12830
+ functionArguments,
12831
+ typeArguments: typeArguments || []
12832
+ }
12833
+ });
12834
+ const res = await this.client.waitForTransaction({
12835
+ transactionHash: response.hash
12836
+ });
12837
+ return response.hash;
12838
+ } catch (error) {
12839
+ throw error;
12840
+ }
12841
+ }
12842
+ };
12843
+
12844
+ // src/contracts/aptos/AptosAirdropClient.ts
12845
+ var AptosAirdropContractClient = class extends AptosContractClientBase {
12846
+ airdropAddress;
12847
+ constructor(options) {
12848
+ const chainConfig = getChainConfig(options.chainId);
12849
+ super({
12850
+ ...options,
12851
+ address: chainConfig.contractAddress,
12852
+ module: "merkle_distributor_with_fees"
12853
+ });
12854
+ this.airdropAddress = options.address;
12855
+ }
12856
+ hexToBytes(hexStr) {
12857
+ const hex = hexStr.startsWith("0x") ? hexStr.slice(2) : hexStr;
12858
+ return Array.from(Buffer.from(hex, "hex"));
12859
+ }
12860
+ async claim({ proof, group, data, value }) {
12861
+ const dataBytes = this.hexToBytes(data);
12862
+ const proofBytes = proof.map((p) => this.hexToBytes(p));
12863
+ return await this.invokeContractWrite("claim", [this.airdropAddress, proofBytes, dataBytes]);
12864
+ }
12865
+ };
12866
+
12867
+ // src/contracts/aptos/AptosBaseDistributorClient.ts
12868
+ var AptosBaseDistributorContractClient = class extends AptosContractClientBase {
12869
+ airdropAddress;
12870
+ constructor(options) {
12871
+ const chainConfig = getChainConfig(options.chainId);
12872
+ super({
12873
+ ...options,
12874
+ address: chainConfig.contractAddress,
12875
+ module: "base_distributor"
12876
+ });
12877
+ this.airdropAddress = options.address;
12878
+ }
12879
+ async getContractInfo() {
12880
+ const data = await this.invokeContractRead("get_distribution_info", [this.airdropAddress]);
12881
+ console.log("data", data);
12882
+ const [root, token, startTime, endTime, owner, version, paused] = data;
12883
+ return {
12884
+ root,
12885
+ token,
12886
+ startTime: Number(startTime),
12887
+ endTime: Number(endTime),
12888
+ owner,
12889
+ version,
12890
+ paused
12891
+ };
12892
+ }
12893
+ async deposit({ amount, token }) {
12894
+ return await this.signTransaction({
12895
+ functionName: `0x1::primary_fungible_store::transfer`,
12896
+ functionArguments: [token, this.airdropAddress, amount],
12897
+ typeArguments: ["0x1::fungible_asset::Metadata"]
12898
+ });
12899
+ }
12900
+ async isLeafUsed(leaf) {
12901
+ const leafBytes = leaf.startsWith("0x") ? Array.from(Buffer.from(leaf.slice(2), "hex")) : Array.from(Buffer.from(leaf, "hex"));
12902
+ const res = await this.invokeContractRead("is_leaf_used", [this.airdropAddress, leafBytes]);
12903
+ console.log("res", res);
12904
+ return res[0];
12905
+ }
12906
+ async batchFetchClaimed(leafs) {
12907
+ const res = await Promise.all(
12908
+ leafs.map(async (leaf) => {
12909
+ return this.isLeafUsed(leaf);
12910
+ })
12911
+ );
12912
+ return res.map((info) => ({
12913
+ result: info || false,
12914
+ status: "success"
12915
+ }));
12916
+ }
12917
+ hexToBytes(hexStr) {
12918
+ const hex = hexStr.startsWith("0x") ? hexStr.slice(2) : hexStr;
12919
+ return Array.from(Buffer.from(hex, "hex"));
12920
+ }
12921
+ async claim({ proof, data }) {
12922
+ const groupBytes = this.hexToBytes("");
12923
+ const dataBytes = this.hexToBytes(data);
12924
+ const proofBytes = proof.map((p) => this.hexToBytes(p));
12925
+ return await this.invokeContractWrite("claim", [this.airdropAddress, proofBytes, groupBytes, dataBytes]);
12926
+ }
12927
+ async getPaused() {
12928
+ const res = await this.getContractInfo();
12929
+ return res.paused;
12930
+ }
12931
+ async getClaimFee(contractAddress13, amount) {
12932
+ return 0;
12933
+ }
12934
+ };
12935
+
12936
+ // src/contracts/aptos/AirdropService.ts
12937
+ var AirdropService4 = class {
12938
+ options;
12939
+ constructor(options) {
12940
+ this.options = options;
12941
+ }
12942
+ get airdropClient() {
12943
+ if (!this.options) {
12944
+ throw new Error("options is empty");
12945
+ }
12946
+ return new AptosAirdropContractClient(this.options);
12947
+ }
12948
+ get baseClient() {
12949
+ if (!this.options) {
12950
+ throw new Error("options is empty");
12951
+ }
12952
+ return new AptosBaseDistributorContractClient(this.options);
12953
+ }
12954
+ async isLeafUsed(leaf) {
12955
+ return this.baseClient.isLeafUsed(leaf);
12956
+ }
12957
+ async batchFetchClaimed(leafs) {
12958
+ return this.baseClient.batchFetchClaimed(leafs);
12959
+ }
12960
+ async claim({ proof, group, data, value }) {
12961
+ return this.airdropClient.claim({
12962
+ proof,
12963
+ group,
12964
+ data,
12965
+ value
12966
+ });
12967
+ }
12968
+ async getVersion() {
12969
+ const res = await this.baseClient.getContractInfo();
12970
+ return res.version;
12971
+ }
12972
+ async getClaimFee(contractAddress13, amount) {
12973
+ return this.baseClient.getClaimFee(contractAddress13, amount);
12974
+ }
12975
+ async getPaused() {
12976
+ return this.baseClient.getPaused();
12977
+ }
12978
+ };
12716
12979
  // Annotate the CommonJS export names for ESM import in node:
12717
12980
  0 && (module.exports = {
12718
12981
  AirdropSigIdentityTypeEnum,
12719
12982
  ApiClient,
12983
+ AptosAirdropService,
12720
12984
  CONST,
12721
12985
  ChainConfig,
12722
12986
  ChainType,
@@ -12735,6 +12999,7 @@ var SignatureAirdropService3 = class {
12735
12999
  TonWalletService,
12736
13000
  ZERO_ADDRESS,
12737
13001
  apiClient,
13002
+ aptosTestNet,
12738
13003
  batchCheckClaimedForSignature,
12739
13004
  bindWallet,
12740
13005
  checkEligibility,