@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 +12 -0
- package/dist/index.d.mts +74 -7
- package/dist/index.d.ts +74 -7
- package/dist/index.js +265 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +263 -0
- 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 +26 -0
- 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 +14 -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,9 @@ export enum ChainType {
|
|
|
20
21
|
Evm = 'evm',
|
|
21
22
|
Ton = 'ton',
|
|
22
23
|
Solana = 'solana',
|
|
23
|
-
Sui = 'sui'
|
|
24
|
+
Sui = 'sui',
|
|
25
|
+
Aptos = 'aptos',
|
|
26
|
+
Cosmos = 'cosmos'
|
|
24
27
|
}
|
|
25
28
|
|
|
26
29
|
export type ThemeConfig = {
|
|
@@ -80,6 +83,7 @@ export enum AirdropSigIdentityTypeEnum {
|
|
|
80
83
|
SolanaWallet = 'Solana Wallet',
|
|
81
84
|
EVMWallet = 'EVM Wallet',
|
|
82
85
|
TONWallet = 'TON Wallet',
|
|
86
|
+
CosmosWallet = 'Cosmos Wallet',
|
|
83
87
|
Google = 'Google Account',
|
|
84
88
|
Discord = 'Discord Account'
|
|
85
89
|
}
|
|
@@ -203,9 +207,16 @@ export enum EvmAirdropVersionEnum {
|
|
|
203
207
|
V4 = '0.4.0' // zeta kyc、kyc threshold
|
|
204
208
|
}
|
|
205
209
|
|
|
206
|
-
|
|
210
|
+
type AptosWalletClient = ReturnType<typeof useWallet>;
|
|
207
211
|
|
|
208
|
-
export type
|
|
212
|
+
export type IWalletClient =
|
|
213
|
+
| TonWalletClient
|
|
214
|
+
| ViemWalletClient
|
|
215
|
+
| SolanaWalletState
|
|
216
|
+
| SuiWalletClient
|
|
217
|
+
| AptosWalletClient;
|
|
218
|
+
|
|
219
|
+
export type { TonWalletClient, ViemWalletClient, SolanaWalletState, SuiWalletClient, AptosWalletClient };
|
|
209
220
|
export type IAirdropService = TonAirdropService | EvmAirdropService;
|
|
210
221
|
|
|
211
222
|
type BaseAirdropOptions = {
|