@sign-global/tokentable 0.4.2-beta.3 → 0.4.2-beta.4
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/dist/cjs/airdrop/common/index.d.ts +1 -1
- package/dist/cjs/airdrop/constants/chain-config.d.ts +1 -1
- package/dist/cjs/airdrop/constants/chain-config.js +1 -1
- package/dist/cjs/airdrop/constants/chain-config.js.map +1 -1
- package/dist/esm/airdrop/common/index.d.ts +1 -1
- package/dist/esm/airdrop/constants/chain-config.d.ts +1 -1
- package/dist/esm/airdrop/constants/chain-config.js +1 -1
- package/dist/esm/airdrop/constants/chain-config.js.map +1 -1
- package/package.json +1 -1
- package/src/airdrop/AirdropClient.ts +0 -307
- package/src/airdrop/SignatureAirdropClient.ts +0 -378
- package/src/airdrop/common/index.ts +0 -54
- package/src/airdrop/common/projectDataForTon.ts +0 -79
- package/src/airdrop/constants/chain-config.ts +0 -107
- package/src/airdrop/constants/index.ts +0 -9
- package/src/airdrop/constants/network.ts +0 -78
- package/src/airdrop/contracts/evm/AirdropService.ts +0 -181
- package/src/airdrop/contracts/evm/SignatureAirdropService.ts +0 -114
- package/src/airdrop/contracts/evm/contracts/AirdropSignatureClient.ts +0 -63
- package/src/airdrop/contracts/evm/contracts/AirdropSignatureFeeClient.ts +0 -61
- package/src/airdrop/contracts/evm/contracts/AirdropV2Client.ts +0 -37
- package/src/airdrop/contracts/evm/contracts/AirdropV3Client.ts +0 -49
- package/src/airdrop/contracts/evm/contracts/AirdropV3FeeClient.ts +0 -16
- package/src/airdrop/contracts/evm/contracts/AirdropV4Client.ts +0 -36
- package/src/airdrop/contracts/evm/contracts/ContractBaseClient.ts +0 -85
- package/src/airdrop/contracts/evm/contracts/DeployClient.ts +0 -35
- package/src/airdrop/contracts/evm/contracts/FeeCollectorClient.ts +0 -21
- package/src/airdrop/contracts/evm/contracts/KycClient.ts +0 -21
- package/src/airdrop/contracts/evm/contracts/abis/Airdrop.json +0 -674
- package/src/airdrop/contracts/evm/contracts/abis/AirdropV2.json +0 -676
- package/src/airdrop/contracts/evm/contracts/abis/AirdropV3.json +0 -740
- package/src/airdrop/contracts/evm/contracts/abis/AirdropV3_Fee.json +0 -678
- package/src/airdrop/contracts/evm/contracts/abis/CustomFeeNativeAirdropV4.json +0 -701
- package/src/airdrop/contracts/evm/contracts/abis/Deployer.json +0 -271
- package/src/airdrop/contracts/evm/contracts/abis/ERC721.json +0 -737
- package/src/airdrop/contracts/evm/contracts/abis/FeeCollector.json +0 -322
- package/src/airdrop/contracts/evm/contracts/abis/FungibleTokenECDSADistributor.json +0 -564
- package/src/airdrop/contracts/evm/contracts/abis/FungibleTokenWithFeesECDSADistributor.json +0 -260
- package/src/airdrop/contracts/evm/contracts/abis/KycHook.json +0 -312
- package/src/airdrop/contracts/index.ts +0 -4
- package/src/airdrop/contracts/solana/AirdropSignatureClient.ts +0 -242
- package/src/airdrop/contracts/solana/FeeCollectorClient.ts +0 -43
- package/src/airdrop/contracts/solana/SignatureAirdropService.ts +0 -51
- package/src/airdrop/contracts/solana/SolanaContractClient.ts +0 -126
- package/src/airdrop/contracts/solana/fee_collector.json +0 -1063
- package/src/airdrop/contracts/solana/fee_collector.ts +0 -1069
- package/src/airdrop/contracts/solana/fungible_token_distributor_solana.json +0 -1573
- package/src/airdrop/contracts/solana/fungible_token_distributor_solana.ts +0 -1579
- package/src/airdrop/contracts/ton/AirdropClientV1.ts +0 -122
- package/src/airdrop/contracts/ton/AirdropClientV2.ts +0 -118
- package/src/airdrop/contracts/ton/AirdropClientV21.ts +0 -131
- package/src/airdrop/contracts/ton/AirdropClientV3.ts +0 -127
- package/src/airdrop/contracts/ton/AirdropService.ts +0 -150
- package/src/airdrop/contracts/ton/TonContractBaseClient.ts +0 -236
- package/src/airdrop/contracts/ton/v1/build/Leaf.compiled.json +0 -1
- package/src/airdrop/contracts/ton/v1/build/MerkleTokenDistributor.compiled.json +0 -1
- package/src/airdrop/contracts/ton/v1/utils/constants.ts +0 -42
- package/src/airdrop/contracts/ton/v1/utils/date.utils.ts +0 -11
- package/src/airdrop/contracts/ton/v1/utils/index.ts +0 -3
- package/src/airdrop/contracts/ton/v1/utils/ton.utils.ts +0 -84
- package/src/airdrop/contracts/ton/v1/wrappers/JettonMinter.ts +0 -81
- package/src/airdrop/contracts/ton/v1/wrappers/JettonWallet.ts +0 -73
- package/src/airdrop/contracts/ton/v1/wrappers/Leaf.ts +0 -88
- package/src/airdrop/contracts/ton/v1/wrappers/MerkleTokenDistributor.ts +0 -317
- package/src/airdrop/contracts/ton/v1/wrappers/index.ts +0 -2
- package/src/airdrop/contracts/ton/v2/build/Leaf.compiled.json +0 -1
- package/src/airdrop/contracts/ton/v2/build/MerkleTokenDistributor.compiled.json +0 -1
- package/src/airdrop/contracts/ton/v2/utils/constants.ts +0 -43
- package/src/airdrop/contracts/ton/v2/utils/date.utils.ts +0 -11
- package/src/airdrop/contracts/ton/v2/utils/index.ts +0 -3
- package/src/airdrop/contracts/ton/v2/utils/ton.utils.ts +0 -102
- package/src/airdrop/contracts/ton/v2/wrappers/Leaf.ts +0 -69
- package/src/airdrop/contracts/ton/v2/wrappers/MerkleTokenDistributor.ts +0 -340
- package/src/airdrop/contracts/ton/v2/wrappers/index.ts +0 -2
- package/src/airdrop/contracts/ton/v21/build/Leaf.compiled.json +0 -1
- package/src/airdrop/contracts/ton/v21/build/MerkleTokenDistributor.compiled.json +0 -1
- package/src/airdrop/contracts/ton/v21/utils/constants.ts +0 -48
- package/src/airdrop/contracts/ton/v21/utils/date.utils.ts +0 -11
- package/src/airdrop/contracts/ton/v21/utils/index.ts +0 -3
- package/src/airdrop/contracts/ton/v21/utils/ton.utils.ts +0 -84
- package/src/airdrop/contracts/ton/v21/wrappers/Leaf.ts +0 -69
- package/src/airdrop/contracts/ton/v21/wrappers/MerkleTokenDistributor.ts +0 -346
- package/src/airdrop/contracts/ton/v21/wrappers/index.ts +0 -2
- package/src/airdrop/contracts/ton/v3/build/Leaf.compiled.json +0 -1
- package/src/airdrop/contracts/ton/v3/build/MerkleTokenDistributor.compiled.json +0 -1
- package/src/airdrop/contracts/ton/v3/utils/constants.ts +0 -43
- package/src/airdrop/contracts/ton/v3/utils/date.utils.ts +0 -11
- package/src/airdrop/contracts/ton/v3/utils/index.ts +0 -3
- package/src/airdrop/contracts/ton/v3/utils/ton.utils.ts +0 -84
- package/src/airdrop/contracts/ton/v3/wrappers/Leaf.ts +0 -68
- package/src/airdrop/contracts/ton/v3/wrappers/MerkleTokenDistributor.ts +0 -316
- package/src/airdrop/contracts/ton/v3/wrappers/index.ts +0 -2
- package/src/airdrop/index.ts +0 -10
- package/src/airdrop/services/index.ts +0 -166
- package/src/airdrop/services/wallet-service/ton/WalletService.ts +0 -226
- package/src/airdrop/services/wallet-service/ton/index.ts +0 -1
- package/src/airdrop/strategies/AirdropStrategyFactory.ts +0 -31
- package/src/airdrop/strategies/EvmAirdropStrategy.ts +0 -81
- package/src/airdrop/strategies/IAirdropStrategy.ts +0 -26
- package/src/airdrop/strategies/StrategyCache.ts +0 -34
- package/src/airdrop/strategies/TonAirdropStrategy.ts +0 -77
- package/src/airdrop/tests/index.test.ts +0 -387
- package/src/airdrop/types/index.ts +0 -200
- package/src/index.ts +0 -3
- package/src/utils/api-client.ts +0 -69
- package/src/utils/index.ts +0 -3
- package/src/utils/utils.ts +0 -45
- package/src/utils/web3.ts +0 -172
- package/src/wallets/WalletBase.ts +0 -92
- package/src/wallets/WalletFactory.tsx +0 -35
- package/src/wallets/index.ts +0 -3
- package/src/wallets/providers/evm/EvmWallet.ts +0 -101
- package/src/wallets/providers/evm/index.tsx +0 -56
- package/src/wallets/providers/index.ts +0 -4
- package/src/wallets/providers/solana/index.tsx +0 -133
- package/src/wallets/providers/ton/TonWallet.ts +0 -153
- package/src/wallets/providers/ton/index.tsx +0 -41
- package/src/wallets/types.ts +0 -45
- package/src/wallets/utils/index.ts +0 -61
|
@@ -1014,7 +1014,7 @@ export declare function getChainConfig(chainId: ChainId): {
|
|
|
1014
1014
|
rpcUrl: string;
|
|
1015
1015
|
} | {
|
|
1016
1016
|
contractAddress: string;
|
|
1017
|
-
rpcUrl:
|
|
1017
|
+
rpcUrl: string;
|
|
1018
1018
|
} | {
|
|
1019
1019
|
contractAddress: string;
|
|
1020
1020
|
rpcUrl: "https://cyber.alt.technology";
|
|
@@ -15,7 +15,7 @@ exports.ChainConfig = {
|
|
|
15
15
|
},
|
|
16
16
|
[chains_1.base.id]: {
|
|
17
17
|
contractAddress: '0x3d1abcD56d53f7C8b04A753C6AF397903DC0f0F2',
|
|
18
|
-
rpcUrl:
|
|
18
|
+
rpcUrl: 'https://base-mainnet.g.alchemy.com/v2/udrqNPSB6i5n5L6QSM31Ng72h_hFOrVT'
|
|
19
19
|
},
|
|
20
20
|
[chains_1.cyber.id]: {
|
|
21
21
|
contractAddress: '0x7915dA247674E430b2a4Dcf01e4471f709428Bc0',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chain-config.js","sourceRoot":"","sources":["../../../../src/airdrop/constants/chain-config.ts"],"names":[],"mappings":";;;AAAA,mDAA6C;AAC7C,wCAcqB;AACrB,uCAA+D;AAElD,QAAA,WAAW,GAAG;IACzB,CAAC,gBAAO,CAAC,EAAE,CAAC,EAAE;QACZ,eAAe,EAAE,4CAA4C;QAC7D,MAAM,EAAE,uEAAuE;KAChF;IACD,CAAC,YAAG,CAAC,EAAE,CAAC,EAAE;QACR,eAAe,EAAE,4CAA4C;QAC7D,MAAM,EAAE,uEAAuE;KAChF;IACD,CAAC,aAAI,CAAC,EAAE,CAAC,EAAE;QACT,eAAe,EAAE,4CAA4C;QAC7D,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"chain-config.js","sourceRoot":"","sources":["../../../../src/airdrop/constants/chain-config.ts"],"names":[],"mappings":";;;AAAA,mDAA6C;AAC7C,wCAcqB;AACrB,uCAA+D;AAElD,QAAA,WAAW,GAAG;IACzB,CAAC,gBAAO,CAAC,EAAE,CAAC,E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CAAC,EAAE,CAAC,EAAE;QAClB,eAAe,EAAE,EAAE;QACnB,MAAM,EAAE,EAAE;QACV,kBAAkB,EAAE,EAAE;KACvB;IACD,CAAC,oBAAW,CAAC,EAAE,CAAC,EAAE;QAChB,eAAe,EAAE,EAAE;QACnB,MAAM,EAAE,EAAE;QACV,kBAAkB,EAAE,EAAE;KACvB;IACD,CAAC,oBAAU,CAAC,EAAE,CAAC,EAAE;QACf,eAAe,EAAE,4CAA4C;QAC7D,MAAM,EAAE,oBAAU,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;KAC3C;IACD,CAAC,gBAAK,CAAC,OAAO,CAAC,EAAE;QACf,IAAI,EAAE,SAAS;QACf,eAAe,EAAE,EAAE;QACnB,MAAM,EAAE,8CAA8C,EAAE,sCAAsC;QAC9F,YAAY,EAAE,2BAA2B;QACzC,aAAa,EAAE,+BAA+B;KAC/C;IACD,CAAC,gBAAK,CAAC,OAAO,CAAC,EAAE;QACf,IAAI,EAAE,SAAS;QACf,eAAe,EAAE,EAAE;QACnB,MAAM,EAAE,sCAAsC;QAC9C,YAAY,EAAE,mBAAmB;QACjC,aAAa,EAAE,uBAAuB;KACvC;CACF,CAAC;AAEW,QAAA,eAAe,GAAG;IAC7B,gBAAO;IACP,YAAG;IACH,aAAI;IACJ,cAAK;IACL,gBAAO;IACP,oBAAW;IACX,kBAAS;IACT,+BAAsB;IACtB,yBAAgB;IAChB,sBAAa;IACb,oBAAW;IACX,oBAAU;IACV,iBAAQ;IACR,oBAAU;IACV,oBAAU;CACX,CAAC"}
|
|
@@ -1014,7 +1014,7 @@ export declare function getChainConfig(chainId: ChainId): {
|
|
|
1014
1014
|
rpcUrl: string;
|
|
1015
1015
|
} | {
|
|
1016
1016
|
contractAddress: string;
|
|
1017
|
-
rpcUrl:
|
|
1017
|
+
rpcUrl: string;
|
|
1018
1018
|
} | {
|
|
1019
1019
|
contractAddress: string;
|
|
1020
1020
|
rpcUrl: "https://cyber.alt.technology";
|
|
@@ -12,7 +12,7 @@ export const ChainConfig = {
|
|
|
12
12
|
},
|
|
13
13
|
[base.id]: {
|
|
14
14
|
contractAddress: '0x3d1abcD56d53f7C8b04A753C6AF397903DC0f0F2',
|
|
15
|
-
rpcUrl: base.
|
|
15
|
+
rpcUrl: 'https://base-mainnet.g.alchemy.com/v2/udrqNPSB6i5n5L6QSM31Ng72h_hFOrVT'
|
|
16
16
|
},
|
|
17
17
|
[cyber.id]: {
|
|
18
18
|
contractAddress: '0x7915dA247674E430b2a4Dcf01e4471f709428Bc0',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chain-config.js","sourceRoot":"","sources":["../../../../src/airdrop/constants/chain-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC7C,OAAO,EACL,IAAI,EACJ,WAAW,EACX,KAAK,EACL,OAAO,EACP,aAAa,EACb,WAAW,EACX,OAAO,EACP,SAAS,EACT,sBAAsB,EAEtB,GAAG,EACH,gBAAgB,EAChB,QAAQ,EACT,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAE/D,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE;QACZ,eAAe,EAAE,4CAA4C;QAC7D,MAAM,EAAE,uEAAuE;KAChF;IACD,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE;QACR,eAAe,EAAE,4CAA4C;QAC7D,MAAM,EAAE,uEAAuE;KAChF;IACD,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE;QACT,eAAe,EAAE,4CAA4C;QAC7D,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"chain-config.js","sourceRoot":"","sources":["../../../../src/airdrop/constants/chain-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC7C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AU;IACV,QAAQ;IACR,UAAU;IACV,UAAU;CACX,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,307 +0,0 @@
|
|
|
1
|
-
import { TonClient } from '@ton/ton';
|
|
2
|
-
import { getAirdropPro, getAirdropProject, getAirdropQuery, getAirdropContractConfig } from './services';
|
|
3
|
-
import {
|
|
4
|
-
ChainType,
|
|
5
|
-
ETokenType,
|
|
6
|
-
EvmAirdropVersionEnum,
|
|
7
|
-
IAirdropClaim,
|
|
8
|
-
IAirdropOptions,
|
|
9
|
-
IContractConfig,
|
|
10
|
-
IProject,
|
|
11
|
-
IWalletClient
|
|
12
|
-
} from './types';
|
|
13
|
-
import { getTonProjectIdByAddress } from './common';
|
|
14
|
-
import { AirdropStrategyFactory } from './strategies/AirdropStrategyFactory';
|
|
15
|
-
import { IAirdropStrategy } from './strategies/IAirdropStrategy';
|
|
16
|
-
import { strategyCache } from './strategies/StrategyCache';
|
|
17
|
-
|
|
18
|
-
export class AirdropClient {
|
|
19
|
-
private tonClient?: TonClient;
|
|
20
|
-
private slug?: string;
|
|
21
|
-
private projectId?: string;
|
|
22
|
-
private endpoint?: string;
|
|
23
|
-
private project: IProject | undefined;
|
|
24
|
-
protected claims?: IAirdropClaim[];
|
|
25
|
-
private projectPromise: Promise<void> | undefined;
|
|
26
|
-
private claimHook: ((v: any) => any) | undefined;
|
|
27
|
-
private contractConfig: IContractConfig | null = null;
|
|
28
|
-
|
|
29
|
-
constructor(params: IAirdropOptions) {
|
|
30
|
-
if ('slug' in params) {
|
|
31
|
-
this.slug = params.slug;
|
|
32
|
-
}
|
|
33
|
-
this.projectId = params.projectId;
|
|
34
|
-
this.endpoint = params.endpoint;
|
|
35
|
-
if (this.project) {
|
|
36
|
-
this.project = params.project;
|
|
37
|
-
} else {
|
|
38
|
-
this.projectPromise = this.initializeProjects();
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
setTonClient(tonClient: TonClient) {
|
|
43
|
-
this.tonClient = tonClient;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
private getTonClient(): TonClient | undefined {
|
|
47
|
-
if (!this.tonClient) {
|
|
48
|
-
return undefined;
|
|
49
|
-
}
|
|
50
|
-
return this.tonClient;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
private async fetchProjectFromSlug(address?: string): Promise<string | undefined> {
|
|
54
|
-
if (!this.slug) return undefined;
|
|
55
|
-
|
|
56
|
-
const res = await getAirdropPro(this.slug, this.endpoint);
|
|
57
|
-
const projectMap = res?.childProjectMapping || {};
|
|
58
|
-
|
|
59
|
-
return getTonProjectIdByAddress({
|
|
60
|
-
address,
|
|
61
|
-
slug: this.slug,
|
|
62
|
-
data: projectMap
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
private async fetchProjectDetails(projectId: string): Promise<void> {
|
|
67
|
-
this.project = await getAirdropProject(projectId, this.endpoint);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
protected async initializeProjects(address?: string) {
|
|
71
|
-
try {
|
|
72
|
-
let projectId = this.projectId;
|
|
73
|
-
|
|
74
|
-
// If slug is provided, try to fetch project ID from slug
|
|
75
|
-
if (!projectId) {
|
|
76
|
-
projectId = await this.fetchProjectFromSlug(address);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
if (!projectId) {
|
|
80
|
-
return;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
// Fetch project details
|
|
84
|
-
await this.fetchProjectDetails(projectId);
|
|
85
|
-
} catch (error: any) {
|
|
86
|
-
throw new Error(`Failed to initialize project: ${error.message}`);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
async getProjectInfo() {
|
|
91
|
-
if (this.projectPromise) {
|
|
92
|
-
await this.projectPromise;
|
|
93
|
-
}
|
|
94
|
-
if (!this.project) throw new Error('Project not found');
|
|
95
|
-
return this.project;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
async getAirdropClaims(data: { address: string }) {
|
|
99
|
-
if (this.slug) {
|
|
100
|
-
await this.initializeProjects(data.address); // Fetch project details by address & slug
|
|
101
|
-
}
|
|
102
|
-
const project = await this.getProjectInfo();
|
|
103
|
-
|
|
104
|
-
const res = await getAirdropQuery(
|
|
105
|
-
{
|
|
106
|
-
recipient: data.address,
|
|
107
|
-
projectId: project!.id,
|
|
108
|
-
recipientType: project!.recipientType
|
|
109
|
-
},
|
|
110
|
-
this.endpoint
|
|
111
|
-
);
|
|
112
|
-
const claimsRes = res.claims?.map((it) => ({
|
|
113
|
-
...it,
|
|
114
|
-
project: project!,
|
|
115
|
-
claimId: project!.chainType === ChainType.Evm ? `${project!.id}:${it.leaf}` : `${project!.id}:${it.index}`
|
|
116
|
-
}));
|
|
117
|
-
this.claims = claimsRes;
|
|
118
|
-
return this.claims;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
public async getStrategy(walletClient?: IWalletClient): Promise<IAirdropStrategy> {
|
|
122
|
-
const project = await this.getProjectInfo();
|
|
123
|
-
const version = this.contractConfig?.version || undefined;
|
|
124
|
-
|
|
125
|
-
const hasWallet = !!walletClient;
|
|
126
|
-
|
|
127
|
-
// Try to get cached strategy
|
|
128
|
-
let strategy = strategyCache.getStrategy(project.contractAddress, project.chainId, project.chainType, hasWallet);
|
|
129
|
-
|
|
130
|
-
if (!strategy) {
|
|
131
|
-
// Create new strategy if not cached
|
|
132
|
-
strategy = AirdropStrategyFactory.createStrategy({
|
|
133
|
-
chainType: project.chainType,
|
|
134
|
-
contractAddress: project.contractAddress,
|
|
135
|
-
chainId: project.chainId,
|
|
136
|
-
walletClient,
|
|
137
|
-
tonClient: this.getTonClient(),
|
|
138
|
-
version
|
|
139
|
-
});
|
|
140
|
-
|
|
141
|
-
// Initialize the strategy
|
|
142
|
-
await strategy.initialize(walletClient);
|
|
143
|
-
|
|
144
|
-
// Cache the initialized strategy
|
|
145
|
-
strategyCache.setStrategy(project.contractAddress, project.chainId, project.chainType, strategy, hasWallet);
|
|
146
|
-
} else if (hasWallet) {
|
|
147
|
-
// If we have a wallet and the strategy exists, just initialize with the new wallet
|
|
148
|
-
await strategy.initialize(walletClient);
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
return strategy;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
private getClaimDataById(claimId: string) {
|
|
155
|
-
const claimData = this.claims?.find((it) => it.claimId === claimId);
|
|
156
|
-
if (!claimData) throw new Error('Claim data not found');
|
|
157
|
-
return claimData;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
setClaimHook(fn: (v: any) => any) {
|
|
161
|
-
this.claimHook = fn;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
private getDefaultExtraData() {
|
|
165
|
-
return {
|
|
166
|
-
isLegacy: true,
|
|
167
|
-
attestationId: BigInt(1)
|
|
168
|
-
};
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
private async calculateClaimFee(project: IProject, claimAmount: string): Promise<string | bigint | undefined> {
|
|
172
|
-
if (project.chainType === ChainType.Evm) {
|
|
173
|
-
const version = await this.getVersion();
|
|
174
|
-
const isNativeFreeVersion =
|
|
175
|
-
project.tokenType === ETokenType.Native &&
|
|
176
|
-
[EvmAirdropVersionEnum.V3, EvmAirdropVersionEnum.V4].includes(version as EvmAirdropVersionEnum);
|
|
177
|
-
return isNativeFreeVersion ? undefined : await this.getClaimFee(BigInt(claimAmount));
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
if (project.chainType === ChainType.Ton) {
|
|
181
|
-
return await this.getClaimFee(BigInt(claimAmount));
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
return undefined;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
async claimAirdrop(
|
|
188
|
-
{ claimId, walletClient }: { claimId: string; walletClient: IWalletClient },
|
|
189
|
-
options?: { onLoading?: () => void }
|
|
190
|
-
) {
|
|
191
|
-
// Get claim data and initialize strategy
|
|
192
|
-
const claimData = this.getClaimDataById(claimId);
|
|
193
|
-
const strategy = await this.getStrategy(walletClient);
|
|
194
|
-
const project = await this.getProjectInfo();
|
|
195
|
-
|
|
196
|
-
// Process extra data
|
|
197
|
-
const extraData =
|
|
198
|
-
project.chainType === ChainType.Ton
|
|
199
|
-
? undefined
|
|
200
|
-
: this.claimHook
|
|
201
|
-
? this.claimHook(claimData)
|
|
202
|
-
: this.getDefaultExtraData();
|
|
203
|
-
|
|
204
|
-
// Calculate claim value based on project type
|
|
205
|
-
const value = await this.calculateClaimFee(project, claimData.amount);
|
|
206
|
-
|
|
207
|
-
// Execute claim with processed data
|
|
208
|
-
return strategy.claim(
|
|
209
|
-
{
|
|
210
|
-
...claimData,
|
|
211
|
-
extraData,
|
|
212
|
-
value
|
|
213
|
-
},
|
|
214
|
-
options
|
|
215
|
-
);
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
async checkClaimed(claimId: string): Promise<boolean> {
|
|
219
|
-
const claimData = this.getClaimDataById(claimId);
|
|
220
|
-
const strategy = await this.getStrategy();
|
|
221
|
-
return strategy.checkClaimed(claimData);
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
private async getContractConfig(): Promise<IContractConfig | null> {
|
|
225
|
-
try {
|
|
226
|
-
const project = await this.getProjectInfo();
|
|
227
|
-
|
|
228
|
-
if (!this.contractConfig) {
|
|
229
|
-
this.contractConfig = await getAirdropContractConfig(
|
|
230
|
-
{
|
|
231
|
-
chainId: project.chainId,
|
|
232
|
-
chainType: project.chainType,
|
|
233
|
-
contractAddress: project.contractAddress
|
|
234
|
-
},
|
|
235
|
-
this.endpoint
|
|
236
|
-
);
|
|
237
|
-
}
|
|
238
|
-
return this.contractConfig;
|
|
239
|
-
} catch (error) {
|
|
240
|
-
console.error('Error fetching contract config:', error);
|
|
241
|
-
return null;
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
async getVersion(): Promise<string> {
|
|
246
|
-
const config = await this.getContractConfig();
|
|
247
|
-
if (config?.version) {
|
|
248
|
-
return config.version;
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
const strategy = await this.getStrategy();
|
|
252
|
-
return strategy.getVersion();
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
async getPaused(): Promise<boolean> {
|
|
256
|
-
const config = await this.getContractConfig();
|
|
257
|
-
if (config && config?.paused !== null) {
|
|
258
|
-
return config.paused;
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
const strategy = await this.getStrategy();
|
|
262
|
-
if (!strategy.getPaused) {
|
|
263
|
-
throw new Error('getPaused is not supported for this chain');
|
|
264
|
-
}
|
|
265
|
-
return strategy.getPaused();
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
async getClaimFee(amount?: bigint): Promise<string | bigint> {
|
|
269
|
-
const config = await this.getContractConfig();
|
|
270
|
-
if (config?.claimFee) {
|
|
271
|
-
return config.claimFee;
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
const strategy = await this.getStrategy();
|
|
275
|
-
if (!strategy.getClaimFee) {
|
|
276
|
-
throw new Error('getClaimFee is not supported for this chain');
|
|
277
|
-
}
|
|
278
|
-
return strategy.getClaimFee(this.project?.contractAddress || '', amount || BigInt(0));
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
// params claimId[]
|
|
282
|
-
async batchCheckClaimed(): Promise<{ result: boolean; status: string }[]> {
|
|
283
|
-
const strategy = await this.getStrategy();
|
|
284
|
-
if (!strategy.batchCheckClaimed) {
|
|
285
|
-
throw new Error('batchCheckClaimed is not supported for this chain');
|
|
286
|
-
}
|
|
287
|
-
const leafs = this.claims?.map((it) => it.leaf);
|
|
288
|
-
if (!leafs) return [];
|
|
289
|
-
return strategy.batchCheckClaimed(leafs);
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
async getNFT(): Promise<string> {
|
|
293
|
-
const strategy = await this.getStrategy();
|
|
294
|
-
if (!strategy.getNFT) {
|
|
295
|
-
throw new Error('getNFT is not supported for this chain');
|
|
296
|
-
}
|
|
297
|
-
return strategy.getNFT();
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
async getKycThreshold(): Promise<bigint> {
|
|
301
|
-
const strategy = await this.getStrategy();
|
|
302
|
-
if (!strategy.getKycThreshold) {
|
|
303
|
-
throw new Error('getKycThreshold is not supported for this chain');
|
|
304
|
-
}
|
|
305
|
-
return strategy.getKycThreshold();
|
|
306
|
-
}
|
|
307
|
-
}
|