@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.
@@ -11,3 +11,6 @@ export { AirdropService as TonAirdropService } from './ton/AirdropService';
11
11
 
12
12
  // SUI Contracts
13
13
  export { SignatureAirdropService as SuiSignatureAirdropService } from './sui/SignatureAirdropService';
14
+
15
+ // Aptos Contracts
16
+ export { AirdropService as AptosAirdropService } from './aptos/AirdropService';
@@ -72,6 +72,16 @@ export class SuiDistributorWithFeeClient extends SuiContractClientBase {
72
72
 
73
73
  const feeTokenType = '0x2::sui::SUI'; // 或其他费用代币类型
74
74
 
75
+ // 在splitCoins之前添加余额检查
76
+ const gasBalance = await this.client.getBalance({
77
+ owner: this.wallet.accounts[0].address,
78
+ coinType: feeTokenType
79
+ });
80
+
81
+ if (BigInt(gasBalance.totalBalance) < totalFees) {
82
+ throw new Error(`Insufficient SUI balance. Required: ${totalFees}, Available: ${gasBalance.totalBalance}`);
83
+ }
84
+
75
85
  const [feeCoin] = tx.splitCoins(
76
86
  tx.gas, // 用 gas 对象作为源
77
87
  [tx.pure(bcs.u64().serialize(totalFees))]
@@ -4,6 +4,7 @@ import { ChainConfig } from '../constants';
4
4
  import { Chain, WalletClient as ViemWalletClient } from 'viem';
5
5
  import { WalletContextState as SolanaWalletState } from '@solana/wallet-adapter-react';
6
6
  import { Wallet as SuiWalletClient } from '@mysten/wallet-standard';
7
+ import { useWallet } from '@aptos-labs/wallet-adapter-react';
7
8
 
8
9
  export type ChainId = keyof typeof ChainConfig;
9
10
 
@@ -20,7 +21,8 @@ export enum ChainType {
20
21
  Evm = 'evm',
21
22
  Ton = 'ton',
22
23
  Solana = 'solana',
23
- Sui = 'sui'
24
+ Sui = 'sui',
25
+ Aptos = 'aptos'
24
26
  }
25
27
 
26
28
  export type ThemeConfig = {
@@ -203,9 +205,16 @@ export enum EvmAirdropVersionEnum {
203
205
  V4 = '0.4.0' // zeta kyc、kyc threshold
204
206
  }
205
207
 
206
- export type IWalletClient = TonWalletClient | ViemWalletClient | SolanaWalletState | SuiWalletClient;
208
+ type AptosWalletClient = ReturnType<typeof useWallet>;
207
209
 
208
- export type { TonWalletClient, ViemWalletClient, SolanaWalletState, SuiWalletClient };
210
+ export type IWalletClient =
211
+ | TonWalletClient
212
+ | ViemWalletClient
213
+ | SolanaWalletState
214
+ | SuiWalletClient
215
+ | AptosWalletClient;
216
+
217
+ export type { TonWalletClient, ViemWalletClient, SolanaWalletState, SuiWalletClient, AptosWalletClient };
209
218
  export type IAirdropService = TonAirdropService | EvmAirdropService;
210
219
 
211
220
  type BaseAirdropOptions = {