@sign-global/tokentable 0.4.1-beta.9 → 0.4.3-beta.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/dist/cjs/airdrop/SignatureAirdropClient.d.ts +1 -1
- package/dist/cjs/airdrop/SignatureAirdropClient.js +2 -1
- package/dist/cjs/airdrop/SignatureAirdropClient.js.map +1 -1
- package/dist/cjs/airdrop/contracts/evm/SignatureAirdropService.d.ts +2 -0
- package/dist/cjs/airdrop/contracts/evm/SignatureAirdropService.js +12 -0
- package/dist/cjs/airdrop/contracts/evm/SignatureAirdropService.js.map +1 -1
- package/dist/cjs/airdrop/contracts/evm/contracts/AirdropSignatureClient.js +1 -0
- package/dist/cjs/airdrop/contracts/evm/contracts/AirdropSignatureClient.js.map +1 -1
- package/dist/cjs/airdrop/contracts/evm/contracts/AirdropSignatureFeeClient.d.ts +17 -0
- package/dist/cjs/airdrop/contracts/evm/contracts/AirdropSignatureFeeClient.js +51 -0
- package/dist/cjs/airdrop/contracts/evm/contracts/AirdropSignatureFeeClient.js.map +1 -0
- package/dist/cjs/airdrop/contracts/evm/contracts/abis/FungibleTokenWithFeesECDSADistributor.json +260 -0
- package/dist/cjs/airdrop/contracts/solana/AirdropSignatureClient.js +3 -2
- package/dist/cjs/airdrop/contracts/solana/AirdropSignatureClient.js.map +1 -1
- package/dist/cjs/airdrop/contracts/solana/fee_collector.d.ts +1 -0
- package/dist/cjs/airdrop/contracts/solana/fee_collector.json +2 -1
- package/dist/cjs/airdrop/contracts/solana/fungible_token_distributor_solana.d.ts +1 -0
- package/dist/cjs/airdrop/contracts/solana/fungible_token_distributor_solana.json +2 -1
- package/dist/cjs/airdrop/index.d.ts +1 -0
- package/dist/cjs/airdrop/index.js +6 -1
- package/dist/cjs/airdrop/index.js.map +1 -1
- package/dist/cjs/airdrop/services/index.d.ts +1 -0
- package/dist/cjs/airdrop/services/index.js.map +1 -1
- package/dist/esm/airdrop/SignatureAirdropClient.d.ts +1 -1
- package/dist/esm/airdrop/SignatureAirdropClient.js +2 -1
- package/dist/esm/airdrop/SignatureAirdropClient.js.map +1 -1
- package/dist/esm/airdrop/contracts/evm/SignatureAirdropService.d.ts +2 -0
- package/dist/esm/airdrop/contracts/evm/SignatureAirdropService.js +12 -0
- package/dist/esm/airdrop/contracts/evm/SignatureAirdropService.js.map +1 -1
- package/dist/esm/airdrop/contracts/evm/contracts/AirdropSignatureClient.js +1 -0
- package/dist/esm/airdrop/contracts/evm/contracts/AirdropSignatureClient.js.map +1 -1
- package/dist/esm/airdrop/contracts/evm/contracts/AirdropSignatureFeeClient.d.ts +17 -0
- package/dist/esm/airdrop/contracts/evm/contracts/AirdropSignatureFeeClient.js +44 -0
- package/dist/esm/airdrop/contracts/evm/contracts/AirdropSignatureFeeClient.js.map +1 -0
- package/dist/esm/airdrop/contracts/evm/contracts/abis/FungibleTokenWithFeesECDSADistributor.json +260 -0
- package/dist/esm/airdrop/contracts/solana/AirdropSignatureClient.js +4 -3
- package/dist/esm/airdrop/contracts/solana/AirdropSignatureClient.js.map +1 -1
- package/dist/esm/airdrop/contracts/solana/fee_collector.d.ts +1 -0
- package/dist/esm/airdrop/contracts/solana/fee_collector.json +2 -1
- package/dist/esm/airdrop/contracts/solana/fungible_token_distributor_solana.d.ts +1 -0
- package/dist/esm/airdrop/contracts/solana/fungible_token_distributor_solana.json +2 -1
- package/dist/esm/airdrop/index.d.ts +1 -0
- package/dist/esm/airdrop/index.js +1 -0
- package/dist/esm/airdrop/index.js.map +1 -1
- package/dist/esm/airdrop/services/index.d.ts +1 -0
- package/dist/esm/airdrop/services/index.js.map +1 -1
- package/package.json +1 -1
- package/src/airdrop/SignatureAirdropClient.ts +3 -2
- package/src/airdrop/contracts/evm/SignatureAirdropService.ts +15 -0
- package/src/airdrop/contracts/evm/contracts/AirdropSignatureClient.ts +2 -0
- package/src/airdrop/contracts/evm/contracts/AirdropSignatureFeeClient.ts +61 -0
- package/src/airdrop/contracts/evm/contracts/abis/FungibleTokenWithFeesECDSADistributor.json +260 -0
- package/src/airdrop/contracts/solana/AirdropSignatureClient.ts +4 -3
- package/src/airdrop/contracts/solana/fee_collector.json +2 -1
- package/src/airdrop/contracts/solana/fee_collector.ts +2 -1
- package/src/airdrop/contracts/solana/fungible_token_distributor_solana.json +2 -1
- package/src/airdrop/contracts/solana/fungible_token_distributor_solana.ts +2 -1
- package/src/airdrop/index.ts +6 -0
- package/src/airdrop/services/index.ts +1 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/airdrop/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/airdrop/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EACL,0BAA0B,EAC1B,6BAA6B,EAC7B,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -56,6 +56,7 @@ export declare const disconnectRecipient: (data: DisconnectParams, baseURL?: str
|
|
|
56
56
|
export declare const checkGetSignatures: (data: {
|
|
57
57
|
projectId: string;
|
|
58
58
|
claimIds: string[];
|
|
59
|
+
recipient: string;
|
|
59
60
|
}, baseURL?: string) => Promise<{
|
|
60
61
|
signatures: IClaimSignature[];
|
|
61
62
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/airdrop/services/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE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AAM,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC;IAExC,OAAO,MAAM,CAAC,IAAI,CAAC,iCAAiC,EAAE,IAAI,EAAE;QAC1D,OAAO,EAAE,OAAO;KACjB,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAG,KAAK,EAAE,IAAsB,EAAE,OAAgB,EAAwB,EAAE;IACjG,MAAM,MAAM,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC;IACxC,OAAO,MAAM,CAAC,IAAI,CAAC,8BAA8B,EAAE,IAAI,EAAE;QACvD,OAAO,EAAE,YAAY,CAAC,IAAI,CAAC,SAAS,CAAC;KACtC,CAAC,CAAC;AACL,CAAC,CAAC;AAQF,MAAM,CAAC,MAAM,mBAAmB,GAAG,KAAK,EAAE,IAAsB,EAAE,OAAgB,EAAiB,EAAE;IACnG,MAAM,MAAM,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC;IACxC,OAAO,MAAM,CAAC,IAAI,CAAC,0BAA0B,EAAE,IAAI,EAAE;QACnD,OAAO,EAAE,YAAY,CAAC,IAAI,CAAC,SAAS,CAAC;KACtC,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAG,KAAK,EACrC,IAIC,EACD,OAAgB,EAC4B,EAAE;IAC9C,MAAM,MAAM,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC;IACxC,OAAO,MAAM,CAAC,IAAI,CAAC,oCAAoC,EAAE,IAAI,EAAE;QAC7D,OAAO,EAAE,YAAY,CAAC,IAAI,CAAC,SAAS,CAAC;KACtC,CAAC,CAAC;AACL,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -263,7 +263,7 @@ export class SignatureAirdropClient {
|
|
|
263
263
|
}: {
|
|
264
264
|
claimIds: string[];
|
|
265
265
|
walletClient: IWalletClient;
|
|
266
|
-
recipient
|
|
266
|
+
recipient: string;
|
|
267
267
|
}) {
|
|
268
268
|
if (!claimIds.length) {
|
|
269
269
|
throw new Error('Claim IDs cannot be empty');
|
|
@@ -279,7 +279,8 @@ export class SignatureAirdropClient {
|
|
|
279
279
|
const res = await checkGetSignatures(
|
|
280
280
|
{
|
|
281
281
|
claimIds,
|
|
282
|
-
projectId: this.projectId
|
|
282
|
+
projectId: this.projectId!,
|
|
283
|
+
recipient
|
|
283
284
|
},
|
|
284
285
|
this.endpoint
|
|
285
286
|
);
|
|
@@ -4,6 +4,7 @@ import { ChainId, EvmContractClientOption } from '../../types';
|
|
|
4
4
|
import { AirdropSignatureClient } from './contracts/AirdropSignatureClient';
|
|
5
5
|
import { DeployerClient } from './contracts/DeployClient';
|
|
6
6
|
import { FeeCollectorClient } from './contracts/FeeCollectorClient';
|
|
7
|
+
import { AirdropSignatureFeeClient } from './contracts/AirdropSignatureFeeClient';
|
|
7
8
|
|
|
8
9
|
export class SignatureAirdropService {
|
|
9
10
|
options: EvmContractClientOption;
|
|
@@ -18,6 +19,13 @@ export class SignatureAirdropService {
|
|
|
18
19
|
|
|
19
20
|
return new AirdropSignatureClient(this.options);
|
|
20
21
|
}
|
|
22
|
+
private get airdropWithFeeClient(): AirdropSignatureFeeClient {
|
|
23
|
+
if (!this.options) {
|
|
24
|
+
throw new Error('options is empty');
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return new AirdropSignatureFeeClient(this.options);
|
|
28
|
+
}
|
|
21
29
|
|
|
22
30
|
async getDeployerClient(): Promise<DeployerClient> {
|
|
23
31
|
const deployer = await this.getDeployer();
|
|
@@ -86,10 +94,17 @@ export class SignatureAirdropService {
|
|
|
86
94
|
claimId: string;
|
|
87
95
|
data: string;
|
|
88
96
|
signature: string;
|
|
97
|
+
fees?: string;
|
|
89
98
|
extraData?: string;
|
|
90
99
|
}[],
|
|
91
100
|
recipient?: string
|
|
92
101
|
) {
|
|
102
|
+
const version = await this.getVersion();
|
|
103
|
+
|
|
104
|
+
if (version.includes('FungibleTokenWithFeesECDSADistributor')) {
|
|
105
|
+
const totalFees = data.map((item) => BigInt(item.fees || '0')).reduce((sum, fee) => sum + fee, BigInt(0));
|
|
106
|
+
return this.airdropWithFeeClient.claim(data, totalFees);
|
|
107
|
+
}
|
|
93
108
|
const defaultRecipient = this.options.walletClient?.account?.address;
|
|
94
109
|
const delegateMode = recipient ? getAddress(recipient) !== defaultRecipient : false;
|
|
95
110
|
const feeData = (await this.getClaimFee(this.options.contractAddress, 1n)) || 0n;
|
|
@@ -32,6 +32,8 @@ export class AirdropSignatureClient extends ContractBaseClient {
|
|
|
32
32
|
'extraData'
|
|
33
33
|
].map((key) => data.map((item) => item[key as keyof (typeof data)[0]] || ''));
|
|
34
34
|
|
|
35
|
+
console.log('params', [recipients, userClaimIds, datas, signatures, extraDatas], value);
|
|
36
|
+
|
|
35
37
|
return this.writeContract({
|
|
36
38
|
functionName: 'claim',
|
|
37
39
|
args: [recipients, userClaimIds, datas, signatures, extraDatas],
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { EvmContractClientOption } from '../../../types';
|
|
2
|
+
import ABI from './abis/FungibleTokenWithFeesECDSADistributor.json';
|
|
3
|
+
import { ContractBaseClient } from './ContractBaseClient';
|
|
4
|
+
|
|
5
|
+
export class AirdropSignatureFeeClient extends ContractBaseClient {
|
|
6
|
+
constructor(options: EvmContractClientOption) {
|
|
7
|
+
super({
|
|
8
|
+
...options,
|
|
9
|
+
abi: ABI
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
async getClaimStatus(userClaimId: string) {
|
|
14
|
+
return this.readContract({ functionName: 'getClaimStatus', args: [userClaimId] });
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
async claim(
|
|
18
|
+
data: {
|
|
19
|
+
recipient: string;
|
|
20
|
+
data: string;
|
|
21
|
+
claimId: string;
|
|
22
|
+
signature: string;
|
|
23
|
+
extraData?: string;
|
|
24
|
+
}[],
|
|
25
|
+
value?: bigint
|
|
26
|
+
) {
|
|
27
|
+
const [recipients = [], userClaimIds = [], datas = [], signatures = [], extraDatas = []] = [
|
|
28
|
+
'recipient',
|
|
29
|
+
'claimId',
|
|
30
|
+
'data',
|
|
31
|
+
'signature',
|
|
32
|
+
'extraData'
|
|
33
|
+
].map((key) => data.map((item) => item[key as keyof (typeof data)[0]] || ''));
|
|
34
|
+
|
|
35
|
+
return this.writeContract({
|
|
36
|
+
functionName: 'claim',
|
|
37
|
+
args: [recipients, userClaimIds, datas, signatures, extraDatas],
|
|
38
|
+
value: value || 0n
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
async batchFetchClaimed(userClaimIds: string[]) {
|
|
43
|
+
const res = (await this.readContract({ functionName: 'getClaimStatus', args: [userClaimIds] })) as boolean[];
|
|
44
|
+
return res;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
async getDeployer() {
|
|
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];
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
async getPaused() {
|
|
58
|
+
const res = (await this.readContract({ functionName: 'getStorage' })) as any[];
|
|
59
|
+
return res?.[2] as boolean;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"inputs": [{ "internalType": "address", "name": "target", "type": "address" }],
|
|
4
|
+
"name": "AddressEmptyCode",
|
|
5
|
+
"type": "error"
|
|
6
|
+
},
|
|
7
|
+
{ "inputs": [], "name": "ClaimClaimed", "type": "error" },
|
|
8
|
+
{
|
|
9
|
+
"inputs": [{ "internalType": "address", "name": "implementation", "type": "address" }],
|
|
10
|
+
"name": "ERC1967InvalidImplementation",
|
|
11
|
+
"type": "error"
|
|
12
|
+
},
|
|
13
|
+
{ "inputs": [], "name": "ERC1967NonPayable", "type": "error" },
|
|
14
|
+
{ "inputs": [], "name": "EnforcedPause", "type": "error" },
|
|
15
|
+
{ "inputs": [], "name": "ExpectedPause", "type": "error" },
|
|
16
|
+
{ "inputs": [], "name": "FailedCall", "type": "error" },
|
|
17
|
+
{ "inputs": [], "name": "IncorrectFees", "type": "error" },
|
|
18
|
+
{ "inputs": [], "name": "InvalidInitialization", "type": "error" },
|
|
19
|
+
{ "inputs": [], "name": "InvalidSignature", "type": "error" },
|
|
20
|
+
{ "inputs": [], "name": "NotInitializing", "type": "error" },
|
|
21
|
+
{ "inputs": [], "name": "OutsideClaimableTimeRange", "type": "error" },
|
|
22
|
+
{
|
|
23
|
+
"inputs": [{ "internalType": "address", "name": "owner", "type": "address" }],
|
|
24
|
+
"name": "OwnableInvalidOwner",
|
|
25
|
+
"type": "error"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"inputs": [{ "internalType": "address", "name": "account", "type": "address" }],
|
|
29
|
+
"name": "OwnableUnauthorizedAccount",
|
|
30
|
+
"type": "error"
|
|
31
|
+
},
|
|
32
|
+
{ "inputs": [], "name": "ReentrancyGuardReentrantCall", "type": "error" },
|
|
33
|
+
{
|
|
34
|
+
"inputs": [{ "internalType": "address", "name": "token", "type": "address" }],
|
|
35
|
+
"name": "SafeERC20FailedOperation",
|
|
36
|
+
"type": "error"
|
|
37
|
+
},
|
|
38
|
+
{ "inputs": [], "name": "TimeInactive", "type": "error" },
|
|
39
|
+
{ "inputs": [], "name": "UUPSUnauthorizedCallContext", "type": "error" },
|
|
40
|
+
{
|
|
41
|
+
"inputs": [{ "internalType": "bytes32", "name": "slot", "type": "bytes32" }],
|
|
42
|
+
"name": "UUPSUnsupportedProxiableUUID",
|
|
43
|
+
"type": "error"
|
|
44
|
+
},
|
|
45
|
+
{ "inputs": [], "name": "UnsupportedOperation", "type": "error" },
|
|
46
|
+
{
|
|
47
|
+
"anonymous": false,
|
|
48
|
+
"inputs": [{ "indexed": false, "internalType": "uint64", "name": "version", "type": "uint64" }],
|
|
49
|
+
"name": "Initialized",
|
|
50
|
+
"type": "event"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"anonymous": false,
|
|
54
|
+
"inputs": [
|
|
55
|
+
{ "indexed": true, "internalType": "address", "name": "previousOwner", "type": "address" },
|
|
56
|
+
{ "indexed": true, "internalType": "address", "name": "newOwner", "type": "address" }
|
|
57
|
+
],
|
|
58
|
+
"name": "OwnershipTransferred",
|
|
59
|
+
"type": "event"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"anonymous": false,
|
|
63
|
+
"inputs": [{ "indexed": false, "internalType": "address", "name": "account", "type": "address" }],
|
|
64
|
+
"name": "Paused",
|
|
65
|
+
"type": "event"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"anonymous": false,
|
|
69
|
+
"inputs": [{ "indexed": false, "internalType": "address", "name": "account", "type": "address" }],
|
|
70
|
+
"name": "Unpaused",
|
|
71
|
+
"type": "event"
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"anonymous": false,
|
|
75
|
+
"inputs": [{ "indexed": true, "internalType": "address", "name": "implementation", "type": "address" }],
|
|
76
|
+
"name": "Upgraded",
|
|
77
|
+
"type": "event"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"inputs": [],
|
|
81
|
+
"name": "UPGRADE_INTERFACE_VERSION",
|
|
82
|
+
"outputs": [{ "internalType": "string", "name": "", "type": "string" }],
|
|
83
|
+
"stateMutability": "view",
|
|
84
|
+
"type": "function"
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"inputs": [
|
|
88
|
+
{ "internalType": "address[]", "name": "recipients", "type": "address[]" },
|
|
89
|
+
{ "internalType": "bytes32[]", "name": "userClaimIds", "type": "bytes32[]" },
|
|
90
|
+
{ "internalType": "bytes[]", "name": "datas", "type": "bytes[]" },
|
|
91
|
+
{ "internalType": "bytes[]", "name": "signatures", "type": "bytes[]" },
|
|
92
|
+
{ "internalType": "bytes[]", "name": "extraDatas", "type": "bytes[]" }
|
|
93
|
+
],
|
|
94
|
+
"name": "claim",
|
|
95
|
+
"outputs": [],
|
|
96
|
+
"stateMutability": "payable",
|
|
97
|
+
"type": "function"
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"inputs": [{ "internalType": "bytes", "name": "", "type": "bytes" }],
|
|
101
|
+
"name": "decodeUserClaimData",
|
|
102
|
+
"outputs": [
|
|
103
|
+
{
|
|
104
|
+
"components": [
|
|
105
|
+
{ "internalType": "uint256", "name": "claimableTimestamp", "type": "uint256" },
|
|
106
|
+
{ "internalType": "uint256", "name": "claimableAmount", "type": "uint256" }
|
|
107
|
+
],
|
|
108
|
+
"internalType": "struct FungibleTokenECDSADistributorData",
|
|
109
|
+
"name": "",
|
|
110
|
+
"type": "tuple"
|
|
111
|
+
}
|
|
112
|
+
],
|
|
113
|
+
"stateMutability": "pure",
|
|
114
|
+
"type": "function"
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
"inputs": [{ "internalType": "bytes", "name": "userClaimData", "type": "bytes" }],
|
|
118
|
+
"name": "decodeUserClaimDataWithFees",
|
|
119
|
+
"outputs": [
|
|
120
|
+
{
|
|
121
|
+
"components": [
|
|
122
|
+
{ "internalType": "uint256", "name": "claimableTimestamp", "type": "uint256" },
|
|
123
|
+
{ "internalType": "uint256", "name": "claimableAmount", "type": "uint256" },
|
|
124
|
+
{ "internalType": "uint256", "name": "fees", "type": "uint256" }
|
|
125
|
+
],
|
|
126
|
+
"internalType": "struct FungibleTokenWithFeesECDSADistributorData",
|
|
127
|
+
"name": "",
|
|
128
|
+
"type": "tuple"
|
|
129
|
+
}
|
|
130
|
+
],
|
|
131
|
+
"stateMutability": "pure",
|
|
132
|
+
"type": "function"
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
"inputs": [
|
|
136
|
+
{ "internalType": "bytes32", "name": "userClaimId", "type": "bytes32" },
|
|
137
|
+
{ "internalType": "bytes", "name": "userClaimData", "type": "bytes" }
|
|
138
|
+
],
|
|
139
|
+
"name": "encodeHashToBeSigned",
|
|
140
|
+
"outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }],
|
|
141
|
+
"stateMutability": "view",
|
|
142
|
+
"type": "function"
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
"inputs": [{ "internalType": "bytes32[]", "name": "userClaimIds", "type": "bytes32[]" }],
|
|
146
|
+
"name": "getClaimStatus",
|
|
147
|
+
"outputs": [{ "internalType": "bool[]", "name": "", "type": "bool[]" }],
|
|
148
|
+
"stateMutability": "view",
|
|
149
|
+
"type": "function"
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
"inputs": [],
|
|
153
|
+
"name": "getStorage",
|
|
154
|
+
"outputs": [
|
|
155
|
+
{ "internalType": "string", "name": "version_", "type": "string" },
|
|
156
|
+
{ "internalType": "address", "name": "owner", "type": "address" },
|
|
157
|
+
{ "internalType": "bool", "name": "paused", "type": "bool" },
|
|
158
|
+
{ "internalType": "address", "name": "deployer", "type": "address" },
|
|
159
|
+
{ "internalType": "address", "name": "authorizedSigner", "type": "address" },
|
|
160
|
+
{ "internalType": "address", "name": "token", "type": "address" },
|
|
161
|
+
{ "internalType": "address", "name": "claimHook", "type": "address" },
|
|
162
|
+
{ "internalType": "uint256", "name": "startTime", "type": "uint256" },
|
|
163
|
+
{ "internalType": "uint256", "name": "endTime", "type": "uint256" }
|
|
164
|
+
],
|
|
165
|
+
"stateMutability": "view",
|
|
166
|
+
"type": "function"
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
"inputs": [{ "internalType": "address", "name": "owner_", "type": "address" }],
|
|
170
|
+
"name": "initialize",
|
|
171
|
+
"outputs": [],
|
|
172
|
+
"stateMutability": "nonpayable",
|
|
173
|
+
"type": "function"
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
"inputs": [],
|
|
177
|
+
"name": "owner",
|
|
178
|
+
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
|
|
179
|
+
"stateMutability": "view",
|
|
180
|
+
"type": "function"
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
"inputs": [],
|
|
184
|
+
"name": "paused",
|
|
185
|
+
"outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
|
|
186
|
+
"stateMutability": "view",
|
|
187
|
+
"type": "function"
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
"inputs": [],
|
|
191
|
+
"name": "proxiableUUID",
|
|
192
|
+
"outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }],
|
|
193
|
+
"stateMutability": "view",
|
|
194
|
+
"type": "function"
|
|
195
|
+
},
|
|
196
|
+
{ "inputs": [], "name": "renounceOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" },
|
|
197
|
+
{
|
|
198
|
+
"inputs": [
|
|
199
|
+
{ "internalType": "address", "name": "token", "type": "address" },
|
|
200
|
+
{ "internalType": "uint256", "name": "startTime", "type": "uint256" },
|
|
201
|
+
{ "internalType": "uint256", "name": "endTime", "type": "uint256" },
|
|
202
|
+
{ "internalType": "address", "name": "authorizedSigner", "type": "address" }
|
|
203
|
+
],
|
|
204
|
+
"name": "setBaseParams",
|
|
205
|
+
"outputs": [],
|
|
206
|
+
"stateMutability": "nonpayable",
|
|
207
|
+
"type": "function"
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
"inputs": [{ "internalType": "address", "name": "hook", "type": "address" }],
|
|
211
|
+
"name": "setClaimHook",
|
|
212
|
+
"outputs": [],
|
|
213
|
+
"stateMutability": "nonpayable",
|
|
214
|
+
"type": "function"
|
|
215
|
+
},
|
|
216
|
+
{ "inputs": [], "name": "togglePause", "outputs": [], "stateMutability": "nonpayable", "type": "function" },
|
|
217
|
+
{
|
|
218
|
+
"inputs": [{ "internalType": "address", "name": "newOwner", "type": "address" }],
|
|
219
|
+
"name": "transferOwnership",
|
|
220
|
+
"outputs": [],
|
|
221
|
+
"stateMutability": "nonpayable",
|
|
222
|
+
"type": "function"
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
"inputs": [
|
|
226
|
+
{ "internalType": "address", "name": "newImplementation", "type": "address" },
|
|
227
|
+
{ "internalType": "bytes", "name": "data", "type": "bytes" }
|
|
228
|
+
],
|
|
229
|
+
"name": "upgradeToAndCall",
|
|
230
|
+
"outputs": [],
|
|
231
|
+
"stateMutability": "payable",
|
|
232
|
+
"type": "function"
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
"inputs": [
|
|
236
|
+
{ "internalType": "address", "name": "signer", "type": "address" },
|
|
237
|
+
{ "internalType": "bytes32", "name": "hash", "type": "bytes32" },
|
|
238
|
+
{ "internalType": "bytes", "name": "signature", "type": "bytes" }
|
|
239
|
+
],
|
|
240
|
+
"name": "verify",
|
|
241
|
+
"outputs": [],
|
|
242
|
+
"stateMutability": "view",
|
|
243
|
+
"type": "function"
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
"inputs": [],
|
|
247
|
+
"name": "version",
|
|
248
|
+
"outputs": [{ "internalType": "string", "name": "", "type": "string" }],
|
|
249
|
+
"stateMutability": "pure",
|
|
250
|
+
"type": "function"
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
"inputs": [{ "internalType": "bytes", "name": "", "type": "bytes" }],
|
|
254
|
+
"name": "withdraw",
|
|
255
|
+
"outputs": [],
|
|
256
|
+
"stateMutability": "nonpayable",
|
|
257
|
+
"type": "function"
|
|
258
|
+
},
|
|
259
|
+
{ "stateMutability": "payable", "type": "receive" }
|
|
260
|
+
]
|
|
@@ -3,7 +3,7 @@ import { SolanaContractClientBase, SolanaContractInfo } from './SolanaContractCl
|
|
|
3
3
|
import IDL from './fungible_token_distributor_solana.json';
|
|
4
4
|
import * as anchor from '@coral-xyz/anchor';
|
|
5
5
|
import { FungibleTokenDistributorSolana } from './fungible_token_distributor_solana';
|
|
6
|
-
import { TOKEN_2022_PROGRAM_ID
|
|
6
|
+
import { TOKEN_2022_PROGRAM_ID } from '@solana/spl-token';
|
|
7
7
|
import { FeeCollectorClient } from './FeeCollectorClient';
|
|
8
8
|
import { fetchTokenVersion, getOrCreateAssociatedTokenAccount, hexStrToU8Array } from '../../../utils';
|
|
9
9
|
|
|
@@ -80,8 +80,9 @@ export class AirdropSignatureClient extends SolanaContractClientBase<FungibleTok
|
|
|
80
80
|
const airdropPDA = await this.getAirdropPDA();
|
|
81
81
|
const config: any = await this.fetchAccountData('airdrop', airdropPDA);
|
|
82
82
|
|
|
83
|
+
const version = await this.getVersion();
|
|
83
84
|
return {
|
|
84
|
-
version:
|
|
85
|
+
version: version,
|
|
85
86
|
token: config.token.toString() as string,
|
|
86
87
|
startTime: Number(config.startTime),
|
|
87
88
|
endTime: Number(config.endTime),
|
|
@@ -223,7 +224,7 @@ export class AirdropSignatureClient extends SolanaContractClientBase<FungibleTok
|
|
|
223
224
|
fee: feePDA,
|
|
224
225
|
authorityFeeAta: null,
|
|
225
226
|
tokenProgram: tokenVersion?.programId || TOKEN_2022_PROGRAM_ID,
|
|
226
|
-
feeTokenProgram:
|
|
227
|
+
feeTokenProgram: null,
|
|
227
228
|
feeTokenMint: null
|
|
228
229
|
})
|
|
229
230
|
.transaction()
|
package/src/airdrop/index.ts
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
export { AirdropClient } from './AirdropClient';
|
|
2
2
|
export { SignatureAirdropClient } from './SignatureAirdropClient';
|
|
3
|
+
export {
|
|
4
|
+
EvmSignatureAirdropService,
|
|
5
|
+
SolanaSignatureAirdropService,
|
|
6
|
+
EvmAirdropService,
|
|
7
|
+
TonAirdropService
|
|
8
|
+
} from './contracts';
|
|
3
9
|
|
|
4
10
|
export { CONST } from './constants';
|