@sign-global/tokentable 0.4.0-beta.9 → 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 -103
  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 -25
  19. package/dist/cjs/airdrop/services/index.js +5 -34
  20. package/dist/cjs/airdrop/services/index.js.map +1 -1
  21. package/dist/cjs/airdrop/types/index.d.ts +0 -27
  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 -104
  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 -25
  47. package/dist/esm/airdrop/services/index.js +4 -31
  48. package/dist/esm/airdrop/services/index.js.map +1 -1
  49. package/dist/esm/airdrop/types/index.d.ts +0 -27
  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 -161
  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 +14 -75
  65. package/src/airdrop/types/index.ts +1 -31
  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
@@ -1,40 +0,0 @@
1
- import ABI from './abis/FungibleTokenECDSADistributor.json';
2
- import { ContractBaseClient } from './ContractBaseClient';
3
- export class AirdropSignatureClient extends ContractBaseClient {
4
- constructor(options) {
5
- super({
6
- ...options,
7
- abi: ABI
8
- });
9
- }
10
- async getClaimStatus(userClaimId) {
11
- return this.readContract({ functionName: 'getClaimStatus', args: [userClaimId] });
12
- }
13
- async claim(data, value) {
14
- const [recipients = [], userClaimIds = [], datas = [], signatures = [], extraDatas = []] = [
15
- 'recipient',
16
- 'claimId',
17
- 'data',
18
- 'signature',
19
- 'extraData'
20
- ].map((key) => data.map((item) => item[key] || ''));
21
- return this.writeContract({
22
- functionName: 'claim',
23
- args: [recipients, userClaimIds, datas, signatures, extraDatas],
24
- value: value || 0n
25
- });
26
- }
27
- async batchFetchClaimed(userClaimIds) {
28
- const res = (await this.readContract({ functionName: 'getClaimStatus', args: [userClaimIds] }));
29
- return res;
30
- }
31
- async getDeployer() {
32
- const res = (await this.readContract({ functionName: 'getStorage' }));
33
- return res?.[3];
34
- }
35
- async getVersion() {
36
- const res = (await this.readContract({ functionName: 'getStorage' }));
37
- return res?.[0];
38
- }
39
- }
40
- //# 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,OAAO,GAAG,MAAM,2CAA2C,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,MAAM,OAAO,sBAAuB,SAAQ,kBAAkB;IAC5D,YAAY,OAAgC;QAC1C,KAAK,CAAC;YACJ,GAAG,OAAO;YACV,GAAG,EAAE,GAAG;SACT,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,cAAc,CAAC,WAAmB;QACtC,OAAO,IAAI,CAAC,YAAY,CAAC,EAAE,YAAY,EAAE,gBAAgB,EAAE,IAAI,EAAE,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;IACpF,CAAC;IAED,KAAK,CAAC,KAAK,CACT,IAMG,EACH,KAAc;QAEd,MAAM,CAAC,UAAU,GAAG,EAAE,EAAE,YAAY,GAAG,EAAE,EAAE,KAAK,GAAG,EAAE,EAAE,UAAU,GAAG,EAAE,EAAE,UAAU,GAAG,EAAE,CAAC,GAAG;YACzF,WAAW;YACX,SAAS;YACT,MAAM;YACN,WAAW;YACX,WAAW;SACZ,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,GAA6B,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;QAE9E,OAAO,IAAI,CAAC,aAAa,CAAC;YACxB,YAAY,EAAE,OAAO;YACrB,IAAI,EAAE,CAAC,UAAU,EAAE,YAAY,EAAE,KAAK,EAAE,UAAU,EAAE,UAAU,CAAC;YAC/D,KAAK,EAAE,KAAK,IAAI,EAAE;SACnB,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,iBAAiB,CAAC,YAAsB;QAC5C,MAAM,GAAG,GAAG,CAAC,MAAM,IAAI,CAAC,YAAY,CAAC,EAAE,YAAY,EAAE,gBAAgB,EAAE,IAAI,EAAE,CAAC,YAAY,CAAC,EAAE,CAAC,CAAc,CAAC;QAC7G,OAAO,GAAG,CAAC;IACb,CAAC;IAED,KAAK,CAAC,WAAW;QACf,MAAM,GAAG,GAAG,CAAC,MAAM,IAAI,CAAC,YAAY,CAAC,EAAE,YAAY,EAAE,YAAY,EAAE,CAAC,CAAU,CAAC;QAC/E,OAAO,GAAG,EAAE,CAAC,CAAC,CAAW,CAAC;IAC5B,CAAC;IAED,KAAK,CAAC,UAAU;QACd,MAAM,GAAG,GAAG,CAAC,MAAM,IAAI,CAAC,YAAY,CAAC,EAAE,YAAY,EAAE,YAAY,EAAE,CAAC,CAAU,CAAC;QAC/E,OAAO,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;CACF"}
@@ -1,564 +0,0 @@
1
- [
2
- {
3
- "inputs": [
4
- {
5
- "internalType": "address",
6
- "name": "target",
7
- "type": "address"
8
- }
9
- ],
10
- "name": "AddressEmptyCode",
11
- "type": "error"
12
- },
13
- {
14
- "inputs": [
15
- {
16
- "internalType": "address",
17
- "name": "implementation",
18
- "type": "address"
19
- }
20
- ],
21
- "name": "ERC1967InvalidImplementation",
22
- "type": "error"
23
- },
24
- {
25
- "inputs": [],
26
- "name": "ERC1967NonPayable",
27
- "type": "error"
28
- },
29
- {
30
- "inputs": [],
31
- "name": "EnforcedPause",
32
- "type": "error"
33
- },
34
- {
35
- "inputs": [],
36
- "name": "ExpectedPause",
37
- "type": "error"
38
- },
39
- {
40
- "inputs": [],
41
- "name": "FailedCall",
42
- "type": "error"
43
- },
44
- {
45
- "inputs": [],
46
- "name": "IncorrectFees",
47
- "type": "error"
48
- },
49
- {
50
- "inputs": [],
51
- "name": "InvalidInitialization",
52
- "type": "error"
53
- },
54
- {
55
- "inputs": [],
56
- "name": "InvalidSignature",
57
- "type": "error"
58
- },
59
- {
60
- "inputs": [],
61
- "name": "NotInitializing",
62
- "type": "error"
63
- },
64
- {
65
- "inputs": [],
66
- "name": "OutsideClaimableTimeRange",
67
- "type": "error"
68
- },
69
- {
70
- "inputs": [
71
- {
72
- "internalType": "address",
73
- "name": "owner",
74
- "type": "address"
75
- }
76
- ],
77
- "name": "OwnableInvalidOwner",
78
- "type": "error"
79
- },
80
- {
81
- "inputs": [
82
- {
83
- "internalType": "address",
84
- "name": "account",
85
- "type": "address"
86
- }
87
- ],
88
- "name": "OwnableUnauthorizedAccount",
89
- "type": "error"
90
- },
91
- {
92
- "inputs": [],
93
- "name": "ReentrancyGuardReentrantCall",
94
- "type": "error"
95
- },
96
- {
97
- "inputs": [
98
- {
99
- "internalType": "address",
100
- "name": "token",
101
- "type": "address"
102
- }
103
- ],
104
- "name": "SafeERC20FailedOperation",
105
- "type": "error"
106
- },
107
- {
108
- "inputs": [],
109
- "name": "TimeInactive",
110
- "type": "error"
111
- },
112
- {
113
- "inputs": [],
114
- "name": "UUPSUnauthorizedCallContext",
115
- "type": "error"
116
- },
117
- {
118
- "inputs": [
119
- {
120
- "internalType": "bytes32",
121
- "name": "slot",
122
- "type": "bytes32"
123
- }
124
- ],
125
- "name": "UUPSUnsupportedProxiableUUID",
126
- "type": "error"
127
- },
128
- {
129
- "inputs": [],
130
- "name": "UnsupportedOperation",
131
- "type": "error"
132
- },
133
- {
134
- "anonymous": false,
135
- "inputs": [
136
- {
137
- "indexed": false,
138
- "internalType": "uint64",
139
- "name": "version",
140
- "type": "uint64"
141
- }
142
- ],
143
- "name": "Initialized",
144
- "type": "event"
145
- },
146
- {
147
- "anonymous": false,
148
- "inputs": [
149
- {
150
- "indexed": true,
151
- "internalType": "address",
152
- "name": "previousOwner",
153
- "type": "address"
154
- },
155
- {
156
- "indexed": true,
157
- "internalType": "address",
158
- "name": "newOwner",
159
- "type": "address"
160
- }
161
- ],
162
- "name": "OwnershipTransferred",
163
- "type": "event"
164
- },
165
- {
166
- "anonymous": false,
167
- "inputs": [
168
- {
169
- "indexed": false,
170
- "internalType": "address",
171
- "name": "account",
172
- "type": "address"
173
- }
174
- ],
175
- "name": "Paused",
176
- "type": "event"
177
- },
178
- {
179
- "anonymous": false,
180
- "inputs": [
181
- {
182
- "indexed": false,
183
- "internalType": "address",
184
- "name": "account",
185
- "type": "address"
186
- }
187
- ],
188
- "name": "Unpaused",
189
- "type": "event"
190
- },
191
- {
192
- "anonymous": false,
193
- "inputs": [
194
- {
195
- "indexed": true,
196
- "internalType": "address",
197
- "name": "implementation",
198
- "type": "address"
199
- }
200
- ],
201
- "name": "Upgraded",
202
- "type": "event"
203
- },
204
- {
205
- "inputs": [],
206
- "name": "UPGRADE_INTERFACE_VERSION",
207
- "outputs": [
208
- {
209
- "internalType": "string",
210
- "name": "",
211
- "type": "string"
212
- }
213
- ],
214
- "stateMutability": "view",
215
- "type": "function"
216
- },
217
- {
218
- "inputs": [
219
- {
220
- "internalType": "address[]",
221
- "name": "recipients",
222
- "type": "address[]"
223
- },
224
- {
225
- "internalType": "bytes32[]",
226
- "name": "userClaimIds",
227
- "type": "bytes32[]"
228
- },
229
- {
230
- "internalType": "bytes[]",
231
- "name": "datas",
232
- "type": "bytes[]"
233
- },
234
- {
235
- "internalType": "bytes[]",
236
- "name": "signatures",
237
- "type": "bytes[]"
238
- },
239
- {
240
- "internalType": "bytes[]",
241
- "name": "extraDatas",
242
- "type": "bytes[]"
243
- }
244
- ],
245
- "name": "claim",
246
- "outputs": [],
247
- "stateMutability": "payable",
248
- "type": "function"
249
- },
250
- {
251
- "inputs": [
252
- {
253
- "internalType": "bytes",
254
- "name": "userClaimData",
255
- "type": "bytes"
256
- }
257
- ],
258
- "name": "decodeUserClaimData",
259
- "outputs": [
260
- {
261
- "components": [
262
- {
263
- "internalType": "uint256",
264
- "name": "claimableTimestamp",
265
- "type": "uint256"
266
- },
267
- {
268
- "internalType": "uint256",
269
- "name": "claimableAmount",
270
- "type": "uint256"
271
- }
272
- ],
273
- "internalType": "struct FungibleTokenECDSADistributorData",
274
- "name": "",
275
- "type": "tuple"
276
- }
277
- ],
278
- "stateMutability": "pure",
279
- "type": "function"
280
- },
281
- {
282
- "inputs": [
283
- {
284
- "internalType": "bytes32",
285
- "name": "userClaimId",
286
- "type": "bytes32"
287
- },
288
- {
289
- "internalType": "bytes",
290
- "name": "userClaimData",
291
- "type": "bytes"
292
- }
293
- ],
294
- "name": "encodeHashToBeSigned",
295
- "outputs": [
296
- {
297
- "internalType": "bytes32",
298
- "name": "",
299
- "type": "bytes32"
300
- }
301
- ],
302
- "stateMutability": "view",
303
- "type": "function"
304
- },
305
- {
306
- "inputs": [
307
- {
308
- "internalType": "bytes32[]",
309
- "name": "userClaimIds",
310
- "type": "bytes32[]"
311
- }
312
- ],
313
- "name": "getClaimStatus",
314
- "outputs": [
315
- {
316
- "internalType": "bool[]",
317
- "name": "",
318
- "type": "bool[]"
319
- }
320
- ],
321
- "stateMutability": "view",
322
- "type": "function"
323
- },
324
- {
325
- "inputs": [],
326
- "name": "getStorage",
327
- "outputs": [
328
- {
329
- "internalType": "string",
330
- "name": "version_",
331
- "type": "string"
332
- },
333
- {
334
- "internalType": "address",
335
- "name": "owner",
336
- "type": "address"
337
- },
338
- {
339
- "internalType": "bool",
340
- "name": "paused",
341
- "type": "bool"
342
- },
343
- {
344
- "internalType": "address",
345
- "name": "deployer",
346
- "type": "address"
347
- },
348
- {
349
- "internalType": "address",
350
- "name": "authorizedSigner",
351
- "type": "address"
352
- },
353
- {
354
- "internalType": "address",
355
- "name": "token",
356
- "type": "address"
357
- },
358
- {
359
- "internalType": "address",
360
- "name": "claimHook",
361
- "type": "address"
362
- },
363
- {
364
- "internalType": "uint256",
365
- "name": "startTime",
366
- "type": "uint256"
367
- },
368
- {
369
- "internalType": "uint256",
370
- "name": "endTime",
371
- "type": "uint256"
372
- }
373
- ],
374
- "stateMutability": "view",
375
- "type": "function"
376
- },
377
- {
378
- "inputs": [
379
- {
380
- "internalType": "address",
381
- "name": "owner_",
382
- "type": "address"
383
- }
384
- ],
385
- "name": "initialize",
386
- "outputs": [],
387
- "stateMutability": "nonpayable",
388
- "type": "function"
389
- },
390
- {
391
- "inputs": [],
392
- "name": "owner",
393
- "outputs": [
394
- {
395
- "internalType": "address",
396
- "name": "",
397
- "type": "address"
398
- }
399
- ],
400
- "stateMutability": "view",
401
- "type": "function"
402
- },
403
- {
404
- "inputs": [],
405
- "name": "paused",
406
- "outputs": [
407
- {
408
- "internalType": "bool",
409
- "name": "",
410
- "type": "bool"
411
- }
412
- ],
413
- "stateMutability": "view",
414
- "type": "function"
415
- },
416
- {
417
- "inputs": [],
418
- "name": "proxiableUUID",
419
- "outputs": [
420
- {
421
- "internalType": "bytes32",
422
- "name": "",
423
- "type": "bytes32"
424
- }
425
- ],
426
- "stateMutability": "view",
427
- "type": "function"
428
- },
429
- {
430
- "inputs": [],
431
- "name": "renounceOwnership",
432
- "outputs": [],
433
- "stateMutability": "nonpayable",
434
- "type": "function"
435
- },
436
- {
437
- "inputs": [
438
- {
439
- "internalType": "address",
440
- "name": "token",
441
- "type": "address"
442
- },
443
- {
444
- "internalType": "uint256",
445
- "name": "startTime",
446
- "type": "uint256"
447
- },
448
- {
449
- "internalType": "uint256",
450
- "name": "endTime",
451
- "type": "uint256"
452
- },
453
- {
454
- "internalType": "address",
455
- "name": "authorizedSigner",
456
- "type": "address"
457
- }
458
- ],
459
- "name": "setBaseParams",
460
- "outputs": [],
461
- "stateMutability": "nonpayable",
462
- "type": "function"
463
- },
464
- {
465
- "inputs": [
466
- {
467
- "internalType": "address",
468
- "name": "hook",
469
- "type": "address"
470
- }
471
- ],
472
- "name": "setClaimHook",
473
- "outputs": [],
474
- "stateMutability": "nonpayable",
475
- "type": "function"
476
- },
477
- {
478
- "inputs": [],
479
- "name": "togglePause",
480
- "outputs": [],
481
- "stateMutability": "nonpayable",
482
- "type": "function"
483
- },
484
- {
485
- "inputs": [
486
- {
487
- "internalType": "address",
488
- "name": "newOwner",
489
- "type": "address"
490
- }
491
- ],
492
- "name": "transferOwnership",
493
- "outputs": [],
494
- "stateMutability": "nonpayable",
495
- "type": "function"
496
- },
497
- {
498
- "inputs": [
499
- {
500
- "internalType": "address",
501
- "name": "newImplementation",
502
- "type": "address"
503
- },
504
- {
505
- "internalType": "bytes",
506
- "name": "data",
507
- "type": "bytes"
508
- }
509
- ],
510
- "name": "upgradeToAndCall",
511
- "outputs": [],
512
- "stateMutability": "payable",
513
- "type": "function"
514
- },
515
- {
516
- "inputs": [
517
- {
518
- "internalType": "address",
519
- "name": "signer",
520
- "type": "address"
521
- },
522
- {
523
- "internalType": "bytes32",
524
- "name": "hash",
525
- "type": "bytes32"
526
- },
527
- {
528
- "internalType": "bytes",
529
- "name": "signature",
530
- "type": "bytes"
531
- }
532
- ],
533
- "name": "verify",
534
- "outputs": [],
535
- "stateMutability": "view",
536
- "type": "function"
537
- },
538
- {
539
- "inputs": [],
540
- "name": "version",
541
- "outputs": [
542
- {
543
- "internalType": "string",
544
- "name": "",
545
- "type": "string"
546
- }
547
- ],
548
- "stateMutability": "pure",
549
- "type": "function"
550
- },
551
- {
552
- "inputs": [
553
- {
554
- "internalType": "bytes",
555
- "name": "",
556
- "type": "bytes"
557
- }
558
- ],
559
- "name": "withdraw",
560
- "outputs": [],
561
- "stateMutability": "nonpayable",
562
- "type": "function"
563
- }
564
- ]
@@ -1,90 +0,0 @@
1
- import { ZERO_ADDRESS } from '../../constants';
2
- import { ChainId, EvmContractClientOption } from '../../types';
3
- import { AirdropSignatureClient } from './contracts/AirdropSignatureClient';
4
- import { DeployerClient } from './contracts/DeployClient';
5
- import { FeeCollectorClient } from './contracts/FeeCollectorClient';
6
-
7
- export class SignatureAirdropService {
8
- options: EvmContractClientOption;
9
- constructor(options: EvmContractClientOption) {
10
- this.options = options;
11
- }
12
-
13
- private get airdropClient(): AirdropSignatureClient {
14
- if (!this.options) {
15
- throw new Error('options is empty');
16
- }
17
-
18
- return new AirdropSignatureClient(this.options);
19
- }
20
-
21
- async getDeployerClient(): Promise<DeployerClient> {
22
- const deployer = await this.getDeployer();
23
- return new DeployerClient({
24
- ...this.options,
25
- contractAddress: deployer
26
- });
27
- }
28
-
29
- private getFeeClient(address: string): FeeCollectorClient {
30
- if (!this.options) {
31
- throw new Error('options is empty');
32
- }
33
-
34
- return new FeeCollectorClient({
35
- ...this.options,
36
- chainId: this.options.chainId as ChainId,
37
- contractAddress: address
38
- });
39
- }
40
-
41
- async getDeployer() {
42
- return this.airdropClient.getDeployer();
43
- }
44
-
45
- async getVersion() {
46
- return this.airdropClient.getVersion();
47
- }
48
-
49
- feeCollectors = async (address: string) => {
50
- const deployerClient = await this.getDeployerClient();
51
- return await deployerClient.feeCollectors(address);
52
- };
53
-
54
- feeTokens = async (address: string) => {
55
- const deployerClient = await this.getDeployerClient();
56
- return await deployerClient.feeTokens(address);
57
- };
58
-
59
- async getFeelessThreshold() {
60
- // return this.airdropClient.getFeelessThreshold();
61
- }
62
-
63
- async getClaimFee(address: string, amount: bigint): Promise<bigint | undefined> {
64
- const feeCollector = await this.feeCollectors(this.options.contractAddress as string);
65
- if (!feeCollector || feeCollector === ZERO_ADDRESS) {
66
- return undefined;
67
- }
68
- const feeClient = this.getFeeClient(feeCollector as string);
69
- const fee = (await feeClient.getFee(address, amount)) as bigint;
70
- return fee;
71
- }
72
-
73
- async batchFetchClaimed(userClaimIds: string[]): Promise<boolean[]> {
74
- const res = await this.airdropClient.batchFetchClaimed(userClaimIds);
75
- return res;
76
- }
77
-
78
- async claim(
79
- data: {
80
- recipient: string;
81
- claimId: string;
82
- data: string;
83
- signature: string;
84
- extraData?: string;
85
- }[],
86
- value?: bigint
87
- ) {
88
- return this.airdropClient.claim(data, value);
89
- }
90
- }