@sign-global/tokentable 0.0.2 → 0.0.3

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 (37) hide show
  1. package/README.md +12 -34
  2. package/dist/cjs/airdrop/common/index.d.ts +1 -1
  3. package/dist/cjs/airdrop/common/index.js +4 -0
  4. package/dist/cjs/airdrop/common/index.js.map +1 -1
  5. package/dist/cjs/airdrop/core/evm/AirdropService.js +0 -1
  6. package/dist/cjs/airdrop/core/evm/AirdropService.js.map +1 -1
  7. package/dist/cjs/airdrop/index.d.ts +9 -6
  8. package/dist/cjs/airdrop/index.js +85 -37
  9. package/dist/cjs/airdrop/index.js.map +1 -1
  10. package/dist/cjs/airdrop/types/index.d.ts +31 -1
  11. package/dist/cjs/airdrop/types/index.js +7 -1
  12. package/dist/cjs/airdrop/types/index.js.map +1 -1
  13. package/dist/cjs/index.d.ts +1 -0
  14. package/dist/cjs/index.js +15 -0
  15. package/dist/cjs/index.js.map +1 -1
  16. package/dist/esm/airdrop/common/index.d.ts +1 -1
  17. package/dist/esm/airdrop/common/index.js +4 -0
  18. package/dist/esm/airdrop/common/index.js.map +1 -1
  19. package/dist/esm/airdrop/core/evm/AirdropService.js +0 -1
  20. package/dist/esm/airdrop/core/evm/AirdropService.js.map +1 -1
  21. package/dist/esm/airdrop/index.d.ts +9 -6
  22. package/dist/esm/airdrop/index.js +86 -38
  23. package/dist/esm/airdrop/index.js.map +1 -1
  24. package/dist/esm/airdrop/types/index.d.ts +31 -1
  25. package/dist/esm/airdrop/types/index.js +6 -0
  26. package/dist/esm/airdrop/types/index.js.map +1 -1
  27. package/dist/esm/index.d.ts +1 -0
  28. package/dist/esm/index.js +1 -0
  29. package/dist/esm/index.js.map +1 -1
  30. package/jest.config.cjs +5 -0
  31. package/package.json +6 -2
  32. package/src/airdrop/common/index.ts +6 -1
  33. package/src/airdrop/core/evm/AirdropService.ts +0 -1
  34. package/src/airdrop/index.ts +111 -43
  35. package/src/airdrop/tests/index.test.ts +95 -0
  36. package/src/airdrop/types/index.ts +33 -1
  37. package/src/index.ts +1 -0
@@ -0,0 +1,95 @@
1
+ import { AirdropClient } from '../index';
2
+ import { TonClient } from '@ton/ton';
3
+
4
+ describe('AirdropClient', () => {
5
+ let client: AirdropClient;
6
+ const mockTonClient = new TonClient({
7
+ endpoint: 'https://testnet.toncenter.com/api/v2/jsonRPC'
8
+ });
9
+ const mockEndpoint = 'http://ec2-3-89-178-45.compute-1.amazonaws.com:3030/api';
10
+
11
+ beforeEach(() => {
12
+ jest.clearAllMocks();
13
+ });
14
+
15
+ describe('initialize', () => {
16
+ it('should use projectId correctly', async () => {
17
+ client = new AirdropClient({
18
+ projectId: 'AD_TEV94wvkxkvn',
19
+ endpoint: mockEndpoint
20
+ });
21
+
22
+ const projectInfo = await client.getProjectInfo();
23
+ expect(projectInfo).toBeDefined();
24
+ });
25
+
26
+ it('should use slug correctly', async () => {
27
+ client = new AirdropClient({
28
+ slug: 'wat',
29
+ tonClient: mockTonClient
30
+ });
31
+
32
+ const projectInfo = await client.getProjectInfo();
33
+ expect(projectInfo).toBeTruthy();
34
+ });
35
+ });
36
+
37
+ describe('test main features', () => {
38
+ beforeEach(async () => {
39
+ client = new AirdropClient({
40
+ projectId: 'AD_TEV94wvkxkvn',
41
+ endpoint: mockEndpoint
42
+ });
43
+ });
44
+
45
+ it('should get version', async () => {
46
+ const version = await client.getVersion();
47
+ console.log(version);
48
+ expect(version).toBeDefined();
49
+ });
50
+
51
+ it('should get claim fee', async () => {
52
+ const client = new AirdropClient({
53
+ projectId: 'AD_50lczFu9Yhvq',
54
+ endpoint: mockEndpoint
55
+ });
56
+ const fee = await client.getClaimFee();
57
+ console.log(fee);
58
+ expect(fee).toBeDefined();
59
+ });
60
+
61
+ it('should get airdrop claims', async () => {
62
+ const claims = await client.getAirdropClaims({ address: '0xDfc4FbbDd9C47c7976fEBb14B1D37C7f85FE299D' });
63
+ expect(claims).toBeTruthy();
64
+ expect(claims?.length).toBe(1);
65
+ });
66
+
67
+ it('should check claimed', async () => {
68
+ const claims = await client.getAirdropClaims({ address: '0xDfc4FbbDd9C47c7976fEBb14B1D37C7f85FE299D' });
69
+
70
+ const claimed = await client.checkClaimed(claims?.[0].claimId as string);
71
+ expect(claimed).toBeDefined();
72
+ });
73
+ });
74
+
75
+ // describe('catch error', () => {
76
+ // it('throw error when projectId is not provided', async () => {
77
+ // client = new AirdropClient({
78
+ // tonClient: mockTonClient,
79
+ // endpoint: mockEndpoint
80
+ // });
81
+
82
+ // await expect(client.getProjectInfo()).rejects.toThrow('Project ID is required');
83
+ // });
84
+
85
+ // it('throw error when claim data not found', async () => {
86
+ // client = new AirdropClient({
87
+ // projectId: 'project-1',
88
+ // tonClient: mockTonClient,
89
+ // endpoint: mockEndpoint
90
+ // });
91
+
92
+ // await expect(client.checkClaimed('invalid-claim-id')).rejects.toThrow('Claim data not found');
93
+ // });
94
+ // });
95
+ });
@@ -19,6 +19,32 @@ export enum ChainType {
19
19
  Ton = 'ton'
20
20
  }
21
21
 
22
+ export type ThemeConfig = {
23
+ logo: string;
24
+ title: string;
25
+ description: string;
26
+ coverImage: string;
27
+ subTitle: string;
28
+ primaryColor: string;
29
+ secondaryColor: string;
30
+ buttonPrimaryHover: string;
31
+ buttonSecondaryHover: string;
32
+ buttonPrimaryForeground: string;
33
+ buttonSecondaryForeground: string;
34
+ welcomeModalText: string;
35
+ welcomeModalTitle: string;
36
+ isShowWelcomeModal: boolean;
37
+ blockCountries: string;
38
+ termsOfUse: string;
39
+ successModalPrimaryBtnText: string;
40
+ successModalUrl: string;
41
+ successModalTitle: string;
42
+ successModalDesc: string;
43
+ successModalShareTexts: string;
44
+ isUnAvailable: boolean;
45
+ privacyPolicy: string;
46
+ };
47
+
22
48
  export interface IProject {
23
49
  id: string;
24
50
  name: string;
@@ -33,7 +59,7 @@ export interface IProject {
33
59
  merkleRoot: string;
34
60
  ownerAddress: string;
35
61
  blockCountries: Record<string, string>;
36
- themeConf: Record<string, any>;
62
+ themeConf: ThemeConfig | null;
37
63
  version: string;
38
64
  extra?: {
39
65
  kyc: boolean;
@@ -41,6 +67,12 @@ export interface IProject {
41
67
  };
42
68
  }
43
69
 
70
+ export enum ETokenType {
71
+ Erc20 = 'ERC20',
72
+ Native = 'NATIVE_TOKEN',
73
+ NFT = 'ERC721'
74
+ }
75
+
44
76
  export type IAirdropClaim = {
45
77
  index: number;
46
78
  recipient: string;
package/src/index.ts CHANGED
@@ -1 +1,2 @@
1
1
  export { AirdropClient } from './airdrop';
2
+ export * from './airdrop/types';