@sign-global/tokentable 0.4.0-beta.8 → 0.4.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.
Files changed (84) hide show
  1. package/dist/cjs/airdrop/AirdropClient.js +2 -9
  2. package/dist/cjs/airdrop/AirdropClient.js.map +1 -1
  3. package/dist/cjs/airdrop/SignatureAirdropClient.d.ts +6 -21
  4. package/dist/cjs/airdrop/SignatureAirdropClient.js +22 -94
  5. package/dist/cjs/airdrop/SignatureAirdropClient.js.map +1 -1
  6. package/dist/cjs/airdrop/core/useWeb3ConnectWallet/providers/evm/EvmWallet.d.ts +1 -1
  7. package/dist/cjs/airdrop/core/useWeb3ConnectWallet/providers/evm/EvmWallet.js +3 -6
  8. package/dist/cjs/airdrop/core/useWeb3ConnectWallet/providers/evm/EvmWallet.js.map +1 -1
  9. package/dist/cjs/airdrop/core/useWeb3ConnectWallet/providers/evm/index.d.ts +1 -2
  10. package/dist/cjs/airdrop/core/useWeb3ConnectWallet/providers/evm/index.js +4 -6
  11. package/dist/cjs/airdrop/core/useWeb3ConnectWallet/providers/evm/index.js.map +1 -1
  12. package/dist/cjs/airdrop/core/useWeb3ConnectWallet/providers/solana/index.d.ts +1 -1
  13. package/dist/cjs/airdrop/core/useWeb3ConnectWallet/providers/solana/index.js +3 -6
  14. package/dist/cjs/airdrop/core/useWeb3ConnectWallet/providers/solana/index.js.map +1 -1
  15. package/dist/cjs/airdrop/core/useWeb3ConnectWallet/providers/ton/TonWallet.d.ts +1 -1
  16. package/dist/cjs/airdrop/core/useWeb3ConnectWallet/providers/ton/TonWallet.js +9 -10
  17. package/dist/cjs/airdrop/core/useWeb3ConnectWallet/providers/ton/TonWallet.js.map +1 -1
  18. package/dist/cjs/airdrop/services/index.d.ts +8 -19
  19. package/dist/cjs/airdrop/services/index.js +5 -27
  20. package/dist/cjs/airdrop/services/index.js.map +1 -1
  21. package/dist/cjs/airdrop/types/index.d.ts +0 -22
  22. package/dist/cjs/airdrop/types/index.js.map +1 -1
  23. package/dist/cjs/index.d.ts +1 -1
  24. package/dist/cjs/index.js +1 -7
  25. package/dist/cjs/index.js.map +1 -1
  26. package/dist/cjs/utils/api-client.d.ts +0 -1
  27. package/dist/cjs/utils/api-client.js +2 -2
  28. package/dist/cjs/utils/api-client.js.map +1 -1
  29. package/dist/esm/airdrop/AirdropClient.js +2 -9
  30. package/dist/esm/airdrop/AirdropClient.js.map +1 -1
  31. package/dist/esm/airdrop/SignatureAirdropClient.d.ts +6 -21
  32. package/dist/esm/airdrop/SignatureAirdropClient.js +23 -95
  33. package/dist/esm/airdrop/SignatureAirdropClient.js.map +1 -1
  34. package/dist/esm/airdrop/core/useWeb3ConnectWallet/providers/evm/EvmWallet.d.ts +1 -1
  35. package/dist/esm/airdrop/core/useWeb3ConnectWallet/providers/evm/EvmWallet.js +3 -6
  36. package/dist/esm/airdrop/core/useWeb3ConnectWallet/providers/evm/EvmWallet.js.map +1 -1
  37. package/dist/esm/airdrop/core/useWeb3ConnectWallet/providers/evm/index.d.ts +1 -2
  38. package/dist/esm/airdrop/core/useWeb3ConnectWallet/providers/evm/index.js +5 -7
  39. package/dist/esm/airdrop/core/useWeb3ConnectWallet/providers/evm/index.js.map +1 -1
  40. package/dist/esm/airdrop/core/useWeb3ConnectWallet/providers/solana/index.d.ts +1 -1
  41. package/dist/esm/airdrop/core/useWeb3ConnectWallet/providers/solana/index.js +3 -6
  42. package/dist/esm/airdrop/core/useWeb3ConnectWallet/providers/solana/index.js.map +1 -1
  43. package/dist/esm/airdrop/core/useWeb3ConnectWallet/providers/ton/TonWallet.d.ts +1 -1
  44. package/dist/esm/airdrop/core/useWeb3ConnectWallet/providers/ton/TonWallet.js +9 -10
  45. package/dist/esm/airdrop/core/useWeb3ConnectWallet/providers/ton/TonWallet.js.map +1 -1
  46. package/dist/esm/airdrop/services/index.d.ts +8 -19
  47. package/dist/esm/airdrop/services/index.js +4 -25
  48. package/dist/esm/airdrop/services/index.js.map +1 -1
  49. package/dist/esm/airdrop/types/index.d.ts +0 -22
  50. package/dist/esm/airdrop/types/index.js.map +1 -1
  51. package/dist/esm/index.d.ts +1 -1
  52. package/dist/esm/index.js +1 -1
  53. package/dist/esm/index.js.map +1 -1
  54. package/dist/esm/utils/api-client.d.ts +0 -1
  55. package/dist/esm/utils/api-client.js +2 -2
  56. package/dist/esm/utils/api-client.js.map +1 -1
  57. package/package.json +3 -3
  58. package/src/airdrop/AirdropClient.ts +2 -8
  59. package/src/airdrop/SignatureAirdropClient.ts +29 -141
  60. package/src/airdrop/core/useWeb3ConnectWallet/providers/evm/EvmWallet.ts +3 -6
  61. package/src/airdrop/core/useWeb3ConnectWallet/providers/evm/index.tsx +5 -18
  62. package/src/airdrop/core/useWeb3ConnectWallet/providers/solana/index.tsx +3 -6
  63. package/src/airdrop/core/useWeb3ConnectWallet/providers/ton/TonWallet.ts +12 -16
  64. package/src/airdrop/services/index.ts +18 -59
  65. package/src/airdrop/types/index.ts +1 -25
  66. package/src/index.ts +1 -9
  67. package/src/utils/api-client.ts +2 -3
  68. package/dist/cjs/airdrop/core/evm/SignatureAirdropService.d.ts +0 -23
  69. package/dist/cjs/airdrop/core/evm/SignatureAirdropService.js +0 -71
  70. package/dist/cjs/airdrop/core/evm/SignatureAirdropService.js.map +0 -1
  71. package/dist/cjs/airdrop/core/evm/contracts/AirdropSignatureClient.d.ts +0 -16
  72. package/dist/cjs/airdrop/core/evm/contracts/AirdropSignatureClient.js +0 -47
  73. package/dist/cjs/airdrop/core/evm/contracts/AirdropSignatureClient.js.map +0 -1
  74. package/dist/cjs/airdrop/core/evm/contracts/abis/FungibleTokenECDSADistributor.json +0 -564
  75. package/dist/esm/airdrop/core/evm/SignatureAirdropService.d.ts +0 -23
  76. package/dist/esm/airdrop/core/evm/SignatureAirdropService.js +0 -67
  77. package/dist/esm/airdrop/core/evm/SignatureAirdropService.js.map +0 -1
  78. package/dist/esm/airdrop/core/evm/contracts/AirdropSignatureClient.d.ts +0 -16
  79. package/dist/esm/airdrop/core/evm/contracts/AirdropSignatureClient.js +0 -40
  80. package/dist/esm/airdrop/core/evm/contracts/AirdropSignatureClient.js.map +0 -1
  81. package/dist/esm/airdrop/core/evm/contracts/abis/FungibleTokenECDSADistributor.json +0 -564
  82. package/src/airdrop/core/evm/SignatureAirdropService.ts +0 -90
  83. package/src/airdrop/core/evm/contracts/AirdropSignatureClient.ts +0 -56
  84. package/src/airdrop/core/evm/contracts/abis/FungibleTokenECDSADistributor.json +0 -564
@@ -57,11 +57,11 @@ export class TonWallet extends WalletBase<TonStoreType> {
57
57
 
58
58
  async sign(originMsg: string): Promise<ISignResult> {
59
59
  const message = await hashSha256(originMsg);
60
- const tonConnectUI = tonStore.walletClient as any;
60
+ const tonConnectUI = tonStore.walletClient as TonConnectUI;
61
61
  // const walletInfo = tonConnectUI?.wallet;
62
62
  const authType = '';
63
63
  // if (walletInfo?.jsBridgeKey && walletInfo?.openMethod !== 'qrcode') {
64
- // authType = walletInfo.jsBridgeKey;
64
+ // authType = walletInfo.jsBridgeKey;
65
65
  // }
66
66
 
67
67
  console.log(this.isConnected, tonConnectUI, 'connected');
@@ -72,10 +72,12 @@ export class TonWallet extends WalletBase<TonStoreType> {
72
72
  if (authType) {
73
73
  const wallets = await tonConnectUI.getWallets();
74
74
 
75
- const currentWallet = wallets.find((wallet: any) =>
75
+ const currentWallet = wallets.find((wallet) =>
76
76
  [wallet.name, wallet.appName].includes(authType)
77
77
  ) as WalletInfoRemote;
78
78
 
79
+ console.log(wallets, currentWallet, 'ww');
80
+
79
81
  const link = tonConnectUI.connector.connect(
80
82
  {
81
83
  bridgeUrl: currentWallet.bridgeUrl,
@@ -131,19 +133,13 @@ export class TonWallet extends WalletBase<TonStoreType> {
131
133
  };
132
134
  }
133
135
 
134
- override async signin(statement: string, prepare = true): Promise<ISignResult> {
135
- const fullMessage = prepare
136
- ? JSON.stringify(
137
- {
138
- statement: statement || 'Welcome to EthSign',
139
- issuedAt: new Date().toISOString(),
140
- nonce: getCustomNaNoId()
141
- },
142
- null,
143
- ' '
144
- )
145
- : statement;
146
- const signRes = await this.sign(fullMessage);
136
+ override async signin(statement?: string): Promise<ISignResult> {
137
+ const fullMessage = {
138
+ statement: statement || 'Welcome to EthSign',
139
+ issuedAt: new Date().toISOString(),
140
+ nonce: getCustomNaNoId()
141
+ };
142
+ const signRes = await this.sign(JSON.stringify(fullMessage, null, ' '));
147
143
  return signRes;
148
144
  }
149
145
 
@@ -1,6 +1,6 @@
1
1
  import { apiClient } from '../../utils/api-client';
2
2
  import { safeParseJSON } from '../../utils/utils';
3
- import { AirdropSigIdentityTypeEnum, IAirdropData, IAirdropSignatureData, IContractConfig, IProject } from '../types';
3
+ import { IAirdropData, 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 is null
14
+ if (!res) return res; // resnull
15
15
  const projectConfig = res?.themeConf;
16
16
  const blockCountries = safeParseJSON(projectConfig?.blockCountries);
17
17
  return {
@@ -70,68 +70,27 @@ export const getJettonInfo = async (
70
70
  return client.get(`/airdrop-open/jetton/${data.address}?isTestnet=${data.isTestnet}`);
71
71
  };
72
72
 
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> => {
73
+ export const connectTwitter = async (data: { code: string; redirectUri: string }, baseURL?: string) => {
96
74
  const client = createApiClient(baseURL);
97
- return client.post('/airdrop-open/connect-twitter', data, {
98
- headers: getSidHeader(data.projectId)
99
- });
75
+ return client.post('/airdrop-open/connect-twitter', data);
100
76
  };
101
77
 
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
- identities: []
111
- };
78
+ export const checkEligibility = async (data: { projectId: string }, baseURL?: string) => {
112
79
  const client = createApiClient(baseURL);
113
-
114
- return client.post('/airdrop-open/check-eligibility', data, {
115
- headers: headers
116
- });
80
+ return client.post('/airdrop-open/check-eligibility', data);
117
81
  };
118
82
 
119
- export const bindWallet = async (data: WalletBindParams, baseURL?: string): Promise<SidResponse> => {
120
- const client = createApiClient(baseURL);
121
- return client.post('/airdrop-open/connect-wallet', data, {
122
- headers: getSidHeader(data.projectId)
123
- });
124
- };
125
-
126
- interface DisconnectParams {
127
- projectId: string;
128
- recipientType: AirdropSigIdentityTypeEnum;
129
- recipient?: string;
130
- }
131
-
132
- export const disconnectRecipient = async (data: DisconnectParams, baseURL?: string): Promise<void> => {
83
+ export const bindWallet = async (
84
+ data: {
85
+ projectId: string;
86
+ key: string;
87
+ signature: string;
88
+ message: string;
89
+ timestamp: number;
90
+ recipientType: string;
91
+ },
92
+ baseURL?: string
93
+ ) => {
133
94
  const client = createApiClient(baseURL);
134
- return client.post('/airdrop-open/disconnect', data, {
135
- headers: getSidHeader(data.projectId)
136
- });
95
+ return client.post('/airdrop-open/connect-wallet', data);
137
96
  };
@@ -1,6 +1,7 @@
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';
4
5
  import { ChainConfig } from '../constants';
5
6
  import { WalletClient as ViemWalletClient } from 'viem';
6
7
 
@@ -62,7 +63,6 @@ export interface IProject {
62
63
  version: string;
63
64
  extra?: IProjectExtra;
64
65
  identities: Identity[];
65
- projectTag: string;
66
66
  }
67
67
 
68
68
  export interface Identity {
@@ -113,33 +113,10 @@ export type IAirdropClaim = {
113
113
  project: IProject;
114
114
  };
115
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
-
134
116
  export interface IAirdropData {
135
117
  claims: IAirdropClaim[];
136
118
  }
137
119
 
138
- export interface IAirdropSignatureData {
139
- claims: IAirdropSignatureClaim[];
140
- identities: IAirdropSignatureIdentity[];
141
- }
142
-
143
120
  export enum TonAirdropVersionEnum {
144
121
  V1 = '1.0.0',
145
122
  V2 = '2.0.0',
@@ -159,7 +136,6 @@ export type IAirdropService = TonAirdropService | EvmAirdropService;
159
136
 
160
137
  type BaseAirdropOptions = {
161
138
  endpoint?: string;
162
- project?: IProject;
163
139
  };
164
140
 
165
141
  type ProjectIdOptions = BaseAirdropOptions & {
package/src/index.ts CHANGED
@@ -1,10 +1,2 @@
1
- export {
2
- AirdropClient,
3
- SignatureAirdropClient,
4
- CONST,
5
- WalletFactory,
6
- EvmProvider,
7
- SolanaProvider,
8
- TonProvider
9
- } from './airdrop';
1
+ export { AirdropClient } from './airdrop';
10
2
  export * from './airdrop/types';
@@ -5,7 +5,6 @@ export type ApiClientOptions = {
5
5
  export type ApiRequestOptions = {
6
6
  params?: Record<string, string | number>;
7
7
  skipHandleError?: boolean;
8
- headers?: Record<string, string>;
9
8
  };
10
9
 
11
10
  type ApiResponse = {
@@ -49,11 +48,11 @@ export class ApiClient {
49
48
  ): Promise<unknown> {
50
49
  const finalUrl = (this.options?.baseURL || '') + url;
51
50
 
52
- const init: RequestInit = { method, headers: options?.headers || {} };
51
+ const init: RequestInit = { method };
53
52
  if (data instanceof FormData) {
54
53
  init.body = data;
55
54
  } else {
56
- init.headers = { 'content-type': 'application/json', ...init.headers };
55
+ init.headers = { 'content-type': 'application/json' };
57
56
  init.body = data ? JSON.stringify(data) : void 0;
58
57
  }
59
58
 
@@ -1,23 +0,0 @@
1
- import { EvmContractClientOption } from '../../types';
2
- import { DeployerClient } from './contracts/DeployClient';
3
- export declare class SignatureAirdropService {
4
- options: EvmContractClientOption;
5
- constructor(options: EvmContractClientOption);
6
- private get airdropClient();
7
- getDeployerClient(): Promise<DeployerClient>;
8
- private getFeeClient;
9
- getDeployer(): Promise<string>;
10
- getVersion(): Promise<any>;
11
- feeCollectors: (address: string) => Promise<unknown>;
12
- feeTokens: (address: string) => Promise<unknown>;
13
- getFeelessThreshold(): Promise<void>;
14
- getClaimFee(address: string, amount: bigint): Promise<bigint | undefined>;
15
- batchFetchClaimed(userClaimIds: string[]): Promise<boolean[]>;
16
- claim(data: {
17
- recipient: string;
18
- claimId: string;
19
- data: string;
20
- signature: string;
21
- extraData?: string;
22
- }[], value?: bigint): Promise<`0x${string}`>;
23
- }
@@ -1,71 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SignatureAirdropService = void 0;
4
- const constants_1 = require("../../constants");
5
- const AirdropSignatureClient_1 = require("./contracts/AirdropSignatureClient");
6
- const DeployClient_1 = require("./contracts/DeployClient");
7
- const FeeCollectorClient_1 = require("./contracts/FeeCollectorClient");
8
- class SignatureAirdropService {
9
- options;
10
- constructor(options) {
11
- this.options = options;
12
- }
13
- get airdropClient() {
14
- if (!this.options) {
15
- throw new Error('options is empty');
16
- }
17
- return new AirdropSignatureClient_1.AirdropSignatureClient(this.options);
18
- }
19
- async getDeployerClient() {
20
- const deployer = await this.getDeployer();
21
- return new DeployClient_1.DeployerClient({
22
- ...this.options,
23
- contractAddress: deployer
24
- });
25
- }
26
- getFeeClient(address) {
27
- if (!this.options) {
28
- throw new Error('options is empty');
29
- }
30
- return new FeeCollectorClient_1.FeeCollectorClient({
31
- ...this.options,
32
- chainId: this.options.chainId,
33
- contractAddress: address
34
- });
35
- }
36
- async getDeployer() {
37
- return this.airdropClient.getDeployer();
38
- }
39
- async getVersion() {
40
- return this.airdropClient.getVersion();
41
- }
42
- feeCollectors = async (address) => {
43
- const deployerClient = await this.getDeployerClient();
44
- return await deployerClient.feeCollectors(address);
45
- };
46
- feeTokens = async (address) => {
47
- const deployerClient = await this.getDeployerClient();
48
- return await deployerClient.feeTokens(address);
49
- };
50
- async getFeelessThreshold() {
51
- // return this.airdropClient.getFeelessThreshold();
52
- }
53
- async getClaimFee(address, amount) {
54
- const feeCollector = await this.feeCollectors(this.options.contractAddress);
55
- if (!feeCollector || feeCollector === constants_1.ZERO_ADDRESS) {
56
- return undefined;
57
- }
58
- const feeClient = this.getFeeClient(feeCollector);
59
- const fee = (await feeClient.getFee(address, amount));
60
- return fee;
61
- }
62
- async batchFetchClaimed(userClaimIds) {
63
- const res = await this.airdropClient.batchFetchClaimed(userClaimIds);
64
- return res;
65
- }
66
- async claim(data, value) {
67
- return this.airdropClient.claim(data, value);
68
- }
69
- }
70
- exports.SignatureAirdropService = SignatureAirdropService;
71
- //# sourceMappingURL=SignatureAirdropService.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SignatureAirdropService.js","sourceRoot":"","sources":["../../../../../src/airdrop/core/evm/SignatureAirdropService.ts"],"names":[],"mappings":";;;AAAA,+CAA+C;AAE/C,+EAA4E;AAC5E,2DAA0D;AAC1D,uEAAoE;AAEpE,MAAa,uBAAuB;IAClC,OAAO,CAA0B;IACjC,YAAY,OAAgC;QAC1C,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED,IAAY,aAAa;QACvB,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;YAClB,MA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AC;IAED,KAAK,CAAC,WAAW,CAAC,OAAe,EAAE,MAAc;QAC/C,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,eAAyB,CAAC,CAAC;QACtF,IAAI,CAAC,YAAY,IAAI,YAAY,KAAK,wBAAY,EAAE,CAAC;YACnD,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,MAAM,SAAS,GAAG,IAAI,CAAC,YAAY,CAAC,YAAsB,CAAC,CAAC;QAC5D,MAAM,GAAG,GAAG,CAAC,MAAM,SAAS,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,CAAW,CAAC;QAChE,OAAO,GAAG,CAAC;IACb,CAAC;IAED,KAAK,CAAC,iBAAiB,CAAC,YAAsB;QAC5C,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,iBAAiB,CAAC,YAAY,CAAC,CAAC;QACrE,OAAO,GAAG,CAAC;IACb,CAAC;IAED,KAAK,CAAC,KAAK,CACT,IAMG,EACH,KAAc;QAEd,OAAO,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC/C,CAAC;CACF;AAnFD,0DAmFC"}
@@ -1,16 +0,0 @@
1
- import { EvmContractClientOption } from '../../../types';
2
- import { ContractBaseClient } from './ContractBaseClient';
3
- export declare class AirdropSignatureClient extends ContractBaseClient {
4
- constructor(options: EvmContractClientOption);
5
- getClaimStatus(userClaimId: string): Promise<unknown>;
6
- claim(data: {
7
- recipient: string;
8
- data: string;
9
- claimId: string;
10
- signature: string;
11
- extraData?: string;
12
- }[], value?: bigint): Promise<`0x${string}`>;
13
- batchFetchClaimed(userClaimIds: string[]): Promise<boolean[]>;
14
- getDeployer(): Promise<string>;
15
- getVersion(): Promise<any>;
16
- }
@@ -1,47 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.AirdropSignatureClient = void 0;
7
- const FungibleTokenECDSADistributor_json_1 = __importDefault(require("./abis/FungibleTokenECDSADistributor.json"));
8
- const ContractBaseClient_1 = require("./ContractBaseClient");
9
- class AirdropSignatureClient extends ContractBaseClient_1.ContractBaseClient {
10
- constructor(options) {
11
- super({
12
- ...options,
13
- abi: FungibleTokenECDSADistributor_json_1.default
14
- });
15
- }
16
- async getClaimStatus(userClaimId) {
17
- return this.readContract({ functionName: 'getClaimStatus', args: [userClaimId] });
18
- }
19
- async claim(data, value) {
20
- const [recipients = [], userClaimIds = [], datas = [], signatures = [], extraDatas = []] = [
21
- 'recipient',
22
- 'claimId',
23
- 'data',
24
- 'signature',
25
- 'extraData'
26
- ].map((key) => data.map((item) => item[key] || ''));
27
- return this.writeContract({
28
- functionName: 'claim',
29
- args: [recipients, userClaimIds, datas, signatures, extraDatas],
30
- value: value || 0n
31
- });
32
- }
33
- async batchFetchClaimed(userClaimIds) {
34
- const res = (await this.readContract({ functionName: 'getClaimStatus', args: [userClaimIds] }));
35
- return res;
36
- }
37
- async getDeployer() {
38
- const res = (await this.readContract({ functionName: 'getStorage' }));
39
- return res?.[3];
40
- }
41
- async getVersion() {
42
- const res = (await this.readContract({ functionName: 'getStorage' }));
43
- return res?.[0];
44
- }
45
- }
46
- exports.AirdropSignatureClient = AirdropSignatureClient;
47
- //# sourceMappingURL=AirdropSignatureClient.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AirdropSignatureClient.js","sourceRoot":"","sources":["../../../../../../src/airdrop/core/evm/contracts/AirdropSignatureClient.ts"],"names":[],"mappings":";;;;;;AACA,mHAA4D;AAC5D,6DAA0D;AAE1D,MAAa,sBAAuB,SAAQ,uCAAkB;IAC5D,YAAY,OAAgC;QAC1C,KAAK,CAAC;YACJ,GAAG,OAAO;YACV,GAAG,EAAE,4CAAG;SACT,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,cAA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