@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 +12 -0
- package/dist/index.d.mts +72 -7
- package/dist/index.d.ts +72 -7
- package/dist/index.js +267 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +265 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -2
- package/src/constants/chain-config.ts +5 -0
- package/src/constants/network.ts +30 -4
- package/src/contracts/aptos/AirdropService.ts +55 -0
- package/src/contracts/aptos/AptosAirdropClient.ts +27 -0
- package/src/contracts/aptos/AptosBaseDistributorClient.ts +81 -0
- package/src/contracts/aptos/AptosContractClient.ts +109 -0
- package/src/contracts/aptos/abis/fee_collector.ts +223 -0
- package/src/contracts/aptos/abis/index.ts +18 -0
- package/src/contracts/aptos/abis/md_create2.ts +252 -0
- package/src/contracts/aptos/abis/merkle_distributor.ts +330 -0
- package/src/contracts/aptos/abis/merkle_verifier.ts +34 -0
- package/src/contracts/aptos/abis/ownable.ts +106 -0
- package/src/contracts/index.ts +3 -0
- package/src/contracts/sui/DistributorWithFeeClient.ts +10 -0
- package/src/types/index.ts +12 -3
package/src/contracts/index.ts
CHANGED
|
@@ -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))]
|
package/src/types/index.ts
CHANGED
|
@@ -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
|
-
|
|
208
|
+
type AptosWalletClient = ReturnType<typeof useWallet>;
|
|
207
209
|
|
|
208
|
-
export type
|
|
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 = {
|