@sign-global/tokentable 0.0.0-beta-20250624084326
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 +25 -0
- package/dist/index.d.mts +125 -0
- package/dist/index.d.ts +125 -0
- package/dist/index.js +836 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +832 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +44 -0
- package/src/AirdropClient.ts +328 -0
- package/src/SignatureAirdropClient.ts +390 -0
- package/src/index.ts +4 -0
- package/src/strategies/AirdropStrategyFactory.ts +34 -0
- package/src/strategies/EvmAirdropStrategy.ts +88 -0
- package/src/strategies/IAirdropStrategy.ts +28 -0
- package/src/strategies/SolanaAirdropStrategy.ts +76 -0
- package/src/strategies/StrategyCache.ts +34 -0
- package/src/strategies/TonAirdropStrategy.ts +76 -0
- package/src/tests/index.test.ts +387 -0
- package/tsup.config.ts +28 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# @sign-global/tokentable
|
|
2
|
+
|
|
3
|
+
## 0.0.0-beta-20250624084326
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- ✨ feat: add fee handling for TokenTableMerkleDistributorWithFees
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
- @sign-global/tokentable-wallets@0.0.0-beta-20250624084326
|
|
13
|
+
- @sign-global/tokentable-core@0.0.0-beta-20250624084326
|
|
14
|
+
|
|
15
|
+
## 1.0.0
|
|
16
|
+
|
|
17
|
+
### Major Changes
|
|
18
|
+
|
|
19
|
+
- ✨ feat: restructure project into monorepo with multiple packages
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- Updated dependencies
|
|
24
|
+
- @sign-global/tokentable-wallets@1.0.0
|
|
25
|
+
- @sign-global/tokentable-core@1.0.0
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { TonClient } from '@ton/ton';
|
|
2
|
+
import * as _sign_global_tokentable_core from '@sign-global/tokentable-core';
|
|
3
|
+
import { IWalletClient, IAirdropClaim, IAirdropOptions, IProject, IAirdropSignatureClaim, IAirdropSignatureIdentity, AirdropSigIdentityTypeEnum, ChainType, EvmSignatureAirdropService, SolanaSignatureAirdropService } from '@sign-global/tokentable-core';
|
|
4
|
+
export * from '@sign-global/tokentable-core';
|
|
5
|
+
export * from '@sign-global/tokentable-wallets';
|
|
6
|
+
|
|
7
|
+
interface IAirdropStrategy {
|
|
8
|
+
getVersion(): Promise<string>;
|
|
9
|
+
claim(claimData: any, options?: {
|
|
10
|
+
onLoading?: () => void;
|
|
11
|
+
}): Promise<any>;
|
|
12
|
+
checkClaimed(claimData: any): Promise<boolean>;
|
|
13
|
+
isInitialized(): boolean;
|
|
14
|
+
initialize(walletClient?: IWalletClient): Promise<void>;
|
|
15
|
+
getPaused?(): Promise<boolean>;
|
|
16
|
+
batchCheckClaimed?(leafs: string[]): Promise<Array<{
|
|
17
|
+
result: boolean;
|
|
18
|
+
status: string;
|
|
19
|
+
}>>;
|
|
20
|
+
getNFT?(): Promise<string>;
|
|
21
|
+
getKycThreshold?(): Promise<bigint>;
|
|
22
|
+
getClaimFee?(contractAddress: string, amount: bigint): Promise<string | bigint>;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
declare class AirdropClient {
|
|
26
|
+
private tonClient?;
|
|
27
|
+
private slug?;
|
|
28
|
+
private projectId?;
|
|
29
|
+
private endpoint?;
|
|
30
|
+
private project;
|
|
31
|
+
protected chainRpc?: string;
|
|
32
|
+
protected claims?: IAirdropClaim[];
|
|
33
|
+
private projectPromise;
|
|
34
|
+
private claimHook;
|
|
35
|
+
private contractConfig;
|
|
36
|
+
constructor(params: IAirdropOptions);
|
|
37
|
+
setTonClient(tonClient: TonClient): void;
|
|
38
|
+
private getTonClient;
|
|
39
|
+
private fetchProjectFromSlug;
|
|
40
|
+
private fetchProjectDetails;
|
|
41
|
+
protected initializeProjects(address?: string): Promise<void>;
|
|
42
|
+
getProjectInfo(): Promise<IProject>;
|
|
43
|
+
getAirdropClaims(data: {
|
|
44
|
+
address: string;
|
|
45
|
+
}): Promise<IAirdropClaim[]>;
|
|
46
|
+
getStrategy(walletClient?: IWalletClient): Promise<IAirdropStrategy>;
|
|
47
|
+
private getClaimDataById;
|
|
48
|
+
setClaimHook(fn: (claimData: IAirdropClaim) => {
|
|
49
|
+
isLegacy: boolean;
|
|
50
|
+
attestationId: bigint;
|
|
51
|
+
}): void;
|
|
52
|
+
private getDefaultExtraData;
|
|
53
|
+
private calculateClaimFee;
|
|
54
|
+
claimAirdrop({ claimId, walletClient }: {
|
|
55
|
+
claimId: string;
|
|
56
|
+
walletClient: IWalletClient;
|
|
57
|
+
}, options?: {
|
|
58
|
+
onLoading?: () => void;
|
|
59
|
+
}): Promise<any>;
|
|
60
|
+
checkClaimed(claimId: string): Promise<boolean>;
|
|
61
|
+
private getContractConfig;
|
|
62
|
+
getVersion(): Promise<string>;
|
|
63
|
+
getPaused(): Promise<boolean>;
|
|
64
|
+
getClaimFee(amount?: bigint, walletClient?: IWalletClient): Promise<string | bigint>;
|
|
65
|
+
batchCheckClaimed(): Promise<{
|
|
66
|
+
result: boolean;
|
|
67
|
+
status: string;
|
|
68
|
+
}[]>;
|
|
69
|
+
getNFT(): Promise<string>;
|
|
70
|
+
getKycThreshold(): Promise<bigint>;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
declare class SignatureAirdropClient {
|
|
74
|
+
private projectId?;
|
|
75
|
+
private endpoint?;
|
|
76
|
+
private project;
|
|
77
|
+
private chainRpc?;
|
|
78
|
+
protected claims?: IAirdropSignatureClaim[];
|
|
79
|
+
protected identities?: IAirdropSignatureIdentity[];
|
|
80
|
+
private projectPromise;
|
|
81
|
+
private authPromise;
|
|
82
|
+
private strategyCache;
|
|
83
|
+
constructor(params: IAirdropOptions);
|
|
84
|
+
private readonly LOCAL_STORAGE_SID_PREFIX;
|
|
85
|
+
private checkAndHandleTwitterCode;
|
|
86
|
+
private setSid;
|
|
87
|
+
private fetchProjectDetails;
|
|
88
|
+
protected initializeProjects(): Promise<void>;
|
|
89
|
+
getProjectInfo(): Promise<IProject>;
|
|
90
|
+
connectOAuth({ onSuccess, onError, type }: {
|
|
91
|
+
onSuccess: () => void;
|
|
92
|
+
onError: (error: Error) => void;
|
|
93
|
+
type: AirdropSigIdentityTypeEnum;
|
|
94
|
+
}): Promise<void>;
|
|
95
|
+
connectX({ onSuccess, onError }: {
|
|
96
|
+
onSuccess: () => void;
|
|
97
|
+
onError: (error: Error) => void;
|
|
98
|
+
}): Promise<void>;
|
|
99
|
+
connectGoogle({ onSuccess, onError }: {
|
|
100
|
+
onSuccess: () => void;
|
|
101
|
+
onError: (error: Error) => void;
|
|
102
|
+
}): Promise<void>;
|
|
103
|
+
connectWallet({ chainType, onSuccess, onError }: {
|
|
104
|
+
chainType: ChainType;
|
|
105
|
+
onSuccess?: (address: string) => void;
|
|
106
|
+
onError?: (error: any) => void;
|
|
107
|
+
}): Promise<void>;
|
|
108
|
+
getClaims(): Promise<_sign_global_tokentable_core.IAirdropSignatureData>;
|
|
109
|
+
disconnectIdentity({ recipientType, recipient }: {
|
|
110
|
+
recipientType: AirdropSigIdentityTypeEnum;
|
|
111
|
+
recipient?: string;
|
|
112
|
+
}): Promise<void>;
|
|
113
|
+
getStrategy(walletClient?: IWalletClient): Promise<EvmSignatureAirdropService | SolanaSignatureAirdropService>;
|
|
114
|
+
getVersion(): Promise<string>;
|
|
115
|
+
getClaimFee(amount?: bigint, walletClient?: IWalletClient): Promise<undefined | bigint>;
|
|
116
|
+
claimAirdrop({ claimIds, walletClient, recipient }: {
|
|
117
|
+
claimIds: string[];
|
|
118
|
+
walletClient: IWalletClient;
|
|
119
|
+
recipient: string;
|
|
120
|
+
}): Promise<`0x${string}`>;
|
|
121
|
+
batchCheckClaimed(): Promise<boolean[]>;
|
|
122
|
+
getPaused(): Promise<boolean>;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export { AirdropClient, SignatureAirdropClient };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { TonClient } from '@ton/ton';
|
|
2
|
+
import * as _sign_global_tokentable_core from '@sign-global/tokentable-core';
|
|
3
|
+
import { IWalletClient, IAirdropClaim, IAirdropOptions, IProject, IAirdropSignatureClaim, IAirdropSignatureIdentity, AirdropSigIdentityTypeEnum, ChainType, EvmSignatureAirdropService, SolanaSignatureAirdropService } from '@sign-global/tokentable-core';
|
|
4
|
+
export * from '@sign-global/tokentable-core';
|
|
5
|
+
export * from '@sign-global/tokentable-wallets';
|
|
6
|
+
|
|
7
|
+
interface IAirdropStrategy {
|
|
8
|
+
getVersion(): Promise<string>;
|
|
9
|
+
claim(claimData: any, options?: {
|
|
10
|
+
onLoading?: () => void;
|
|
11
|
+
}): Promise<any>;
|
|
12
|
+
checkClaimed(claimData: any): Promise<boolean>;
|
|
13
|
+
isInitialized(): boolean;
|
|
14
|
+
initialize(walletClient?: IWalletClient): Promise<void>;
|
|
15
|
+
getPaused?(): Promise<boolean>;
|
|
16
|
+
batchCheckClaimed?(leafs: string[]): Promise<Array<{
|
|
17
|
+
result: boolean;
|
|
18
|
+
status: string;
|
|
19
|
+
}>>;
|
|
20
|
+
getNFT?(): Promise<string>;
|
|
21
|
+
getKycThreshold?(): Promise<bigint>;
|
|
22
|
+
getClaimFee?(contractAddress: string, amount: bigint): Promise<string | bigint>;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
declare class AirdropClient {
|
|
26
|
+
private tonClient?;
|
|
27
|
+
private slug?;
|
|
28
|
+
private projectId?;
|
|
29
|
+
private endpoint?;
|
|
30
|
+
private project;
|
|
31
|
+
protected chainRpc?: string;
|
|
32
|
+
protected claims?: IAirdropClaim[];
|
|
33
|
+
private projectPromise;
|
|
34
|
+
private claimHook;
|
|
35
|
+
private contractConfig;
|
|
36
|
+
constructor(params: IAirdropOptions);
|
|
37
|
+
setTonClient(tonClient: TonClient): void;
|
|
38
|
+
private getTonClient;
|
|
39
|
+
private fetchProjectFromSlug;
|
|
40
|
+
private fetchProjectDetails;
|
|
41
|
+
protected initializeProjects(address?: string): Promise<void>;
|
|
42
|
+
getProjectInfo(): Promise<IProject>;
|
|
43
|
+
getAirdropClaims(data: {
|
|
44
|
+
address: string;
|
|
45
|
+
}): Promise<IAirdropClaim[]>;
|
|
46
|
+
getStrategy(walletClient?: IWalletClient): Promise<IAirdropStrategy>;
|
|
47
|
+
private getClaimDataById;
|
|
48
|
+
setClaimHook(fn: (claimData: IAirdropClaim) => {
|
|
49
|
+
isLegacy: boolean;
|
|
50
|
+
attestationId: bigint;
|
|
51
|
+
}): void;
|
|
52
|
+
private getDefaultExtraData;
|
|
53
|
+
private calculateClaimFee;
|
|
54
|
+
claimAirdrop({ claimId, walletClient }: {
|
|
55
|
+
claimId: string;
|
|
56
|
+
walletClient: IWalletClient;
|
|
57
|
+
}, options?: {
|
|
58
|
+
onLoading?: () => void;
|
|
59
|
+
}): Promise<any>;
|
|
60
|
+
checkClaimed(claimId: string): Promise<boolean>;
|
|
61
|
+
private getContractConfig;
|
|
62
|
+
getVersion(): Promise<string>;
|
|
63
|
+
getPaused(): Promise<boolean>;
|
|
64
|
+
getClaimFee(amount?: bigint, walletClient?: IWalletClient): Promise<string | bigint>;
|
|
65
|
+
batchCheckClaimed(): Promise<{
|
|
66
|
+
result: boolean;
|
|
67
|
+
status: string;
|
|
68
|
+
}[]>;
|
|
69
|
+
getNFT(): Promise<string>;
|
|
70
|
+
getKycThreshold(): Promise<bigint>;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
declare class SignatureAirdropClient {
|
|
74
|
+
private projectId?;
|
|
75
|
+
private endpoint?;
|
|
76
|
+
private project;
|
|
77
|
+
private chainRpc?;
|
|
78
|
+
protected claims?: IAirdropSignatureClaim[];
|
|
79
|
+
protected identities?: IAirdropSignatureIdentity[];
|
|
80
|
+
private projectPromise;
|
|
81
|
+
private authPromise;
|
|
82
|
+
private strategyCache;
|
|
83
|
+
constructor(params: IAirdropOptions);
|
|
84
|
+
private readonly LOCAL_STORAGE_SID_PREFIX;
|
|
85
|
+
private checkAndHandleTwitterCode;
|
|
86
|
+
private setSid;
|
|
87
|
+
private fetchProjectDetails;
|
|
88
|
+
protected initializeProjects(): Promise<void>;
|
|
89
|
+
getProjectInfo(): Promise<IProject>;
|
|
90
|
+
connectOAuth({ onSuccess, onError, type }: {
|
|
91
|
+
onSuccess: () => void;
|
|
92
|
+
onError: (error: Error) => void;
|
|
93
|
+
type: AirdropSigIdentityTypeEnum;
|
|
94
|
+
}): Promise<void>;
|
|
95
|
+
connectX({ onSuccess, onError }: {
|
|
96
|
+
onSuccess: () => void;
|
|
97
|
+
onError: (error: Error) => void;
|
|
98
|
+
}): Promise<void>;
|
|
99
|
+
connectGoogle({ onSuccess, onError }: {
|
|
100
|
+
onSuccess: () => void;
|
|
101
|
+
onError: (error: Error) => void;
|
|
102
|
+
}): Promise<void>;
|
|
103
|
+
connectWallet({ chainType, onSuccess, onError }: {
|
|
104
|
+
chainType: ChainType;
|
|
105
|
+
onSuccess?: (address: string) => void;
|
|
106
|
+
onError?: (error: any) => void;
|
|
107
|
+
}): Promise<void>;
|
|
108
|
+
getClaims(): Promise<_sign_global_tokentable_core.IAirdropSignatureData>;
|
|
109
|
+
disconnectIdentity({ recipientType, recipient }: {
|
|
110
|
+
recipientType: AirdropSigIdentityTypeEnum;
|
|
111
|
+
recipient?: string;
|
|
112
|
+
}): Promise<void>;
|
|
113
|
+
getStrategy(walletClient?: IWalletClient): Promise<EvmSignatureAirdropService | SolanaSignatureAirdropService>;
|
|
114
|
+
getVersion(): Promise<string>;
|
|
115
|
+
getClaimFee(amount?: bigint, walletClient?: IWalletClient): Promise<undefined | bigint>;
|
|
116
|
+
claimAirdrop({ claimIds, walletClient, recipient }: {
|
|
117
|
+
claimIds: string[];
|
|
118
|
+
walletClient: IWalletClient;
|
|
119
|
+
recipient: string;
|
|
120
|
+
}): Promise<`0x${string}`>;
|
|
121
|
+
batchCheckClaimed(): Promise<boolean[]>;
|
|
122
|
+
getPaused(): Promise<boolean>;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export { AirdropClient, SignatureAirdropClient };
|