@sign-global/tokentable 0.4.0-beta.4 → 0.4.0-beta.6
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/SignatureAirdropClient.d.ts +13 -6
- package/dist/cjs/airdrop/SignatureAirdropClient.js +43 -23
- package/dist/cjs/airdrop/SignatureAirdropClient.js.map +1 -1
- package/dist/cjs/airdrop/core/evm/SignatureAirdropService.d.ts +4 -3
- package/dist/cjs/airdrop/core/evm/SignatureAirdropService.js +4 -1
- package/dist/cjs/airdrop/core/evm/SignatureAirdropService.js.map +1 -1
- package/dist/cjs/airdrop/core/evm/contracts/AirdropSignatureClient.d.ts +5 -4
- package/dist/cjs/airdrop/core/evm/contracts/AirdropSignatureClient.js +6 -2
- package/dist/cjs/airdrop/core/evm/contracts/AirdropSignatureClient.js.map +1 -1
- package/dist/cjs/airdrop/services/index.d.ts +19 -12
- package/dist/cjs/airdrop/services/index.js +20 -12
- package/dist/cjs/airdrop/services/index.js.map +1 -1
- package/dist/cjs/airdrop/types/index.d.ts +20 -0
- package/dist/cjs/airdrop/types/index.js.map +1 -1
- package/dist/esm/airdrop/SignatureAirdropClient.d.ts +13 -6
- package/dist/esm/airdrop/SignatureAirdropClient.js +44 -24
- package/dist/esm/airdrop/SignatureAirdropClient.js.map +1 -1
- package/dist/esm/airdrop/core/evm/SignatureAirdropService.d.ts +4 -3
- package/dist/esm/airdrop/core/evm/SignatureAirdropService.js +4 -1
- package/dist/esm/airdrop/core/evm/SignatureAirdropService.js.map +1 -1
- package/dist/esm/airdrop/core/evm/contracts/AirdropSignatureClient.d.ts +5 -4
- package/dist/esm/airdrop/core/evm/contracts/AirdropSignatureClient.js +6 -2
- package/dist/esm/airdrop/core/evm/contracts/AirdropSignatureClient.js.map +1 -1
- package/dist/esm/airdrop/services/index.d.ts +19 -12
- package/dist/esm/airdrop/services/index.js +18 -11
- package/dist/esm/airdrop/services/index.js.map +1 -1
- package/dist/esm/airdrop/types/index.d.ts +20 -0
- package/dist/esm/airdrop/types/index.js.map +1 -1
- package/package.json +1 -1
- package/src/airdrop/SignatureAirdropClient.ts +73 -25
- package/src/airdrop/core/evm/SignatureAirdropService.ts +7 -3
- package/src/airdrop/core/evm/contracts/AirdropSignatureClient.ts +10 -5
- package/src/airdrop/services/index.ts +53 -28
- package/src/airdrop/types/index.ts +23 -1
|
@@ -17,10 +17,10 @@ export class AirdropSignatureClient extends ContractBaseClient {
|
|
|
17
17
|
async claim(
|
|
18
18
|
data: {
|
|
19
19
|
recipient: string;
|
|
20
|
-
group: string;
|
|
21
20
|
data: string;
|
|
21
|
+
claimId: string;
|
|
22
22
|
signature: string;
|
|
23
|
-
extraData
|
|
23
|
+
extraData?: string;
|
|
24
24
|
}[],
|
|
25
25
|
value?: bigint
|
|
26
26
|
) {
|
|
@@ -40,12 +40,17 @@ export class AirdropSignatureClient extends ContractBaseClient {
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
async batchFetchClaimed(userClaimIds: string[]) {
|
|
43
|
-
const res
|
|
43
|
+
const res = (await this.readContract({ functionName: 'getClaimStatus', args: [userClaimIds] })) as boolean[];
|
|
44
44
|
return res;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
async getDeployer() {
|
|
48
|
-
const res
|
|
49
|
-
return res?.[3];
|
|
48
|
+
const res = (await this.readContract({ functionName: 'getStorage' })) as any[];
|
|
49
|
+
return res?.[3] as string;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
async getVersion() {
|
|
53
|
+
const res = (await this.readContract({ functionName: 'getStorage' })) as any[];
|
|
54
|
+
return res?.[0];
|
|
50
55
|
}
|
|
51
56
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { apiClient } from '../../utils/api-client';
|
|
2
2
|
import { safeParseJSON } from '../../utils/utils';
|
|
3
|
-
import { IAirdropData, IContractConfig, IProject } from '../types';
|
|
3
|
+
import { AirdropSigIdentityTypeEnum, IAirdropData, IAirdropSignatureData, IContractConfig, IProject } from '../types';
|
|
4
4
|
|
|
5
5
|
export { TonWalletService } from './wallet-service/ton';
|
|
6
6
|
|
|
@@ -11,7 +11,7 @@ const createApiClient = (baseURL?: string) => {
|
|
|
11
11
|
export const getAirdropProject = async (projectId: string, baseURL?: string): Promise<IProject> => {
|
|
12
12
|
const client = createApiClient(baseURL);
|
|
13
13
|
const res = await client.get<any>(`/airdrop-open/projects/${projectId}`);
|
|
14
|
-
if (!res) return res; // res
|
|
14
|
+
if (!res) return res; // res is null
|
|
15
15
|
const projectConfig = res?.themeConf;
|
|
16
16
|
const blockCountries = safeParseJSON(projectConfig?.blockCountries);
|
|
17
17
|
return {
|
|
@@ -70,42 +70,67 @@ export const getJettonInfo = async (
|
|
|
70
70
|
return client.get(`/airdrop-open/jetton/${data.address}?isTestnet=${data.isTestnet}`);
|
|
71
71
|
};
|
|
72
72
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
73
|
+
interface SidResponse {
|
|
74
|
+
sid: string;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
interface TwitterConnectParams {
|
|
78
|
+
code: string;
|
|
79
|
+
projectId: string;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
interface WalletBindParams {
|
|
83
|
+
projectId: string;
|
|
84
|
+
key: string;
|
|
85
|
+
signature: string;
|
|
86
|
+
message: string;
|
|
87
|
+
timestamp: number;
|
|
88
|
+
recipientType: string;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const getSidHeader = (projectId: string) => ({
|
|
92
|
+
sid: window.localStorage.getItem(`sid_${projectId}`) || ''
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
export const connectTwitter = async (data: TwitterConnectParams, baseURL?: string): Promise<SidResponse> => {
|
|
77
96
|
const client = createApiClient(baseURL);
|
|
78
97
|
return client.post('/airdrop-open/connect-twitter', data, {
|
|
79
|
-
headers:
|
|
80
|
-
sid: window.localStorage.getItem('sid_' + data.projectId) || ''
|
|
81
|
-
}
|
|
98
|
+
headers: getSidHeader(data.projectId)
|
|
82
99
|
});
|
|
83
100
|
};
|
|
84
|
-
|
|
85
|
-
export const checkEligibility = async (
|
|
101
|
+
|
|
102
|
+
export const checkEligibility = async (
|
|
103
|
+
data: { projectId: string },
|
|
104
|
+
baseURL?: string
|
|
105
|
+
): Promise<IAirdropSignatureData> => {
|
|
106
|
+
const headers = getSidHeader(data.projectId);
|
|
107
|
+
if (!headers.sid)
|
|
108
|
+
return {
|
|
109
|
+
claims: []
|
|
110
|
+
};
|
|
86
111
|
const client = createApiClient(baseURL);
|
|
112
|
+
|
|
87
113
|
return client.post('/airdrop-open/check-eligibility', data, {
|
|
88
|
-
headers:
|
|
89
|
-
sid: window.localStorage.getItem('sid_' + data.projectId) || ''
|
|
90
|
-
}
|
|
114
|
+
headers: headers
|
|
91
115
|
});
|
|
92
116
|
};
|
|
93
117
|
|
|
94
|
-
export const bindWallet = async (
|
|
95
|
-
data: {
|
|
96
|
-
projectId: string;
|
|
97
|
-
key: string;
|
|
98
|
-
signature: string;
|
|
99
|
-
message: string;
|
|
100
|
-
timestamp: number;
|
|
101
|
-
recipientType: string;
|
|
102
|
-
},
|
|
103
|
-
baseURL?: string
|
|
104
|
-
): Promise<{ sid: string }> => {
|
|
118
|
+
export const bindWallet = async (data: WalletBindParams, baseURL?: string): Promise<SidResponse> => {
|
|
105
119
|
const client = createApiClient(baseURL);
|
|
106
120
|
return client.post('/airdrop-open/connect-wallet', data, {
|
|
107
|
-
headers:
|
|
108
|
-
|
|
109
|
-
|
|
121
|
+
headers: getSidHeader(data.projectId)
|
|
122
|
+
});
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
interface DisconnectParams {
|
|
126
|
+
projectId: string;
|
|
127
|
+
recipientType: AirdropSigIdentityTypeEnum;
|
|
128
|
+
recipient?: string;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export const disconnectRecipient = async (data: DisconnectParams, baseURL?: string): Promise<void> => {
|
|
132
|
+
const client = createApiClient(baseURL);
|
|
133
|
+
return client.post('/airdrop-open/disconnect', data, {
|
|
134
|
+
headers: getSidHeader(data.projectId)
|
|
110
135
|
});
|
|
111
136
|
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { TonConnectUI } from '@tonconnect/ui-react';
|
|
2
2
|
import { AirdropService as TonAirdropService } from '../core/ton/AirdropService';
|
|
3
3
|
import { AirdropService as EvmAirdropService } from '../core/evm/AirdropService';
|
|
4
|
-
import { TonClient } from '@ton/ton';
|
|
5
4
|
import { ChainConfig } from '../constants';
|
|
6
5
|
import { WalletClient as ViemWalletClient } from 'viem';
|
|
7
6
|
|
|
@@ -114,8 +113,31 @@ export type IAirdropClaim = {
|
|
|
114
113
|
project: IProject;
|
|
115
114
|
};
|
|
116
115
|
|
|
116
|
+
export type IAirdropSignatureClaim = {
|
|
117
|
+
percent: number;
|
|
118
|
+
unlockingAt: number;
|
|
119
|
+
claimDeadline: number;
|
|
120
|
+
value: string;
|
|
121
|
+
recipient: string;
|
|
122
|
+
recipientType: string;
|
|
123
|
+
claimId: string;
|
|
124
|
+
data: string;
|
|
125
|
+
signature: string;
|
|
126
|
+
claimed?: boolean;
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
export interface IAirdropSignatureIdentity {
|
|
130
|
+
type: AirdropSigIdentityTypeEnum;
|
|
131
|
+
value: string;
|
|
132
|
+
}
|
|
133
|
+
|
|
117
134
|
export interface IAirdropData {
|
|
118
135
|
claims: IAirdropClaim[];
|
|
136
|
+
identities: IAirdropSignatureIdentity[];
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export interface IAirdropSignatureData {
|
|
140
|
+
claims: IAirdropSignatureClaim[];
|
|
119
141
|
}
|
|
120
142
|
|
|
121
143
|
export enum TonAirdropVersionEnum {
|