@sign-global/tokentable 1.4.1 → 1.6.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/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
  # @sign-global/tokentable
2
2
 
3
+ ## 1.6.0
4
+
5
+ ### Minor Changes
6
+
7
+ - feat: add Cosmos wallet support
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies
12
+ - @sign-global/tokentable-wallets@1.4.0
13
+ - @sign-global/tokentable-core@1.6.0
14
+
15
+ ## 1.5.0
16
+
17
+ ### Minor Changes
18
+
19
+ - feat: add Aptos blockchain support for airdrop functionality
20
+
21
+ ### Patch Changes
22
+
23
+ - Updated dependencies
24
+ - @sign-global/tokentable-wallets@1.3.0
25
+ - @sign-global/tokentable-core@1.5.0
26
+
3
27
  ## 1.4.1
4
28
 
5
29
  ### Patch Changes
package/README.md ADDED
@@ -0,0 +1,286 @@
1
+
2
+
3
+ # @sign-global/tokentable
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install @sign-global/tokentable
9
+ ```
10
+
11
+ ## Based MerkleTree Airdrop
12
+
13
+ ## Initialization
14
+
15
+ ### Initialization AirdropClient
16
+
17
+ AirdropClient supports initialization for two chain types:
18
+
19
+
20
+ The baseURL parameter determines which environment the SDK will interact with. The default is the production environment. You can pass the test environment address for testing.
21
+
22
+ ```typescript
23
+ import { AirdropClient } from '@sign-global/tokentable';
24
+
25
+ // Initialize with projectId
26
+ const client = new AirdropClient({
27
+ projectId: "your_project_id",
28
+ endpoint: "http://ec2-3-89-178-45.compute-1.amazonaws.com:3030/api" // optional
29
+ })
30
+
31
+ // Or initialize with slug
32
+ const client = new AirdropClient({
33
+ slug: "your_slug",
34
+ endpoint: "optional_api_base_url" // optional
35
+ })
36
+ ```
37
+
38
+
39
+
40
+ ## Main Features
41
+
42
+
43
+ ### Get Airdrop Claims
44
+
45
+ ```typescript
46
+ const claims = await client.getAirdropClaims({
47
+ address: "user_address"
48
+ })
49
+ ```
50
+
51
+
52
+ ### Get Airdrop Projects Info
53
+
54
+ ```typescript
55
+ // Get project list
56
+ const projects = client.getProjectInfo()
57
+ ```
58
+
59
+
60
+ ### Claim Airdrop
61
+
62
+
63
+ #### TON Chain Claiming
64
+
65
+ ```typescript
66
+ const result = await tonClient.claimAirdrop({
67
+ claimId: "claim_id",
68
+ walletClient: TonConnectUI
69
+ }, {
70
+ onLoading: () => {
71
+ // Handle loading state
72
+ }
73
+ })
74
+ ```
75
+
76
+
77
+ #### EVM Chain Claiming
78
+
79
+ ```typescript
80
+ import { useWalletClient } from 'wagmi';
81
+ const { data: walletClient } = useWalletClient();
82
+ // or const walletClient = await getWalletClient(wagmiConfig); //wagmi
83
+ const result = await evmClient.claimAirdrop({
84
+ claimId: "claim_id",
85
+ // wallet client
86
+ walletClient: walletClient
87
+ })
88
+ ```
89
+
90
+
91
+ ### Check Claim Status
92
+
93
+ ```typescript
94
+ const isClaimed = await client.checkClaimed("claim_id")
95
+ ```
96
+
97
+ ### Batch Check Claimed (EVM Chain Only)
98
+
99
+ ```typescript
100
+ const isClaimedArr = await client.batchCheckClaimed()
101
+ ```
102
+
103
+
104
+ ### TON Chain Specific Features
105
+
106
+ Check if contract is paused:
107
+
108
+ ```typescript
109
+ const isPaused = await tonClient.getPaused()
110
+ ```
111
+
112
+ ## Important Notes
113
+
114
+
115
+
116
+ 1. Before calling claim-related methods, you need to call `getAirdropClaims` to get claim information
117
+
118
+
119
+ 2. TON chain and EVM chain use different claiming methods
120
+
121
+
122
+ 3. All asynchronous operations need proper error handling
123
+
124
+
125
+
126
+ ## Error Handling
127
+
128
+
129
+ The SDK will throw errors in the following cases:
130
+
131
+
132
+ - Claim data not found
133
+
134
+ - Contract wrapper not found
135
+
136
+ - Unsupported chain type
137
+
138
+ - API call failures
139
+
140
+
141
+ It's recommended to use try-catch for error handling:
142
+
143
+ ```typescript
144
+ try {
145
+ const claims = await client.getAirdropClaims({
146
+ address: "user_address"
147
+ })
148
+ } catch (error) {
149
+ console.error("Failed to fetch claims:", error)
150
+ }
151
+ ```
152
+
153
+
154
+ ## Based Identity Airdrop
155
+
156
+ ### AddProvider
157
+
158
+ ```typescript
159
+ import { EvmProvider,SolanaProvider } from '@sign-global/tokentable';
160
+
161
+
162
+ const App = ({children}) => {
163
+ return (
164
+ <EvmProvider>
165
+ <SolanaProvider>
166
+ {children}
167
+ </SolanaProvider>
168
+ </EvmProvider>
169
+ )
170
+ }
171
+
172
+ ```
173
+
174
+ ### Initialization
175
+
176
+ ```typescript
177
+ import { SignatureAirdropClient } from '@sign-global/tokentable';
178
+
179
+ const client = new SignatureAirdropClient({
180
+ projectId: 'your_project_id', // Project ID
181
+ });
182
+ ```
183
+
184
+ ### Main Features
185
+
186
+ #### Get Airdrop Claims
187
+
188
+ ```typescript
189
+ const res = await client.getClaims();
190
+
191
+ console.log(res);
192
+ ```
193
+
194
+ #### Connect Identity
195
+
196
+ ```typescript
197
+ const checkEligibility = () => {
198
+ const res = await client.getClaims();
199
+
200
+ console.log(res);
201
+ }
202
+ // Connect Twitter account
203
+ await client.connectX({
204
+ onSuccess: () => {
205
+ checkEligibility();
206
+ console.log('Twitter connection successful');
207
+ },
208
+ onError: () => {
209
+ console.log('Twitter connection failed');
210
+ }
211
+ });
212
+
213
+ // Connect wallet
214
+ await client.connectWallet({
215
+ chainType: ChainType.Evm, // Supports Evm, Solana
216
+ onSuccess: () => {
217
+ checkEligibility();
218
+ console.log('Wallet connection successful');
219
+ },
220
+ onError: (error) => {
221
+ console.log('Wallet connection failed:', error);
222
+ }
223
+ });
224
+
225
+ // Disconnect identity
226
+ await client.disconnectIdentity({
227
+ recipientType: AirdropSigIdentityTypeEnum.Twitter,
228
+ recipient?: 'optional_recipient'
229
+ });
230
+
231
+ ```
232
+
233
+ ### Claim Airdrop
234
+
235
+ #### EVM
236
+
237
+ ``` typescript
238
+ import { useWalletClient } from 'wagmi';
239
+
240
+ const { data: walletClient } = useWalletClient();
241
+ // Check airdrop eligibility
242
+ const eligibility = await client.getClaims();
243
+
244
+ // Batch check claim status
245
+ const claimedStatus = await client.batchCheckClaimed();
246
+
247
+ const claimIds = eligibility.claims.map((claim) => claim.claimId);
248
+ // Claim airdrop
249
+ const txHash = await client.claimAirdrop({
250
+ claimIds: claimIds, // List of claim IDs
251
+ walletClient: walletClient, // Wallet client
252
+ recipient: 'optional_recipient' // Optional: recipient address
253
+ });
254
+
255
+ ```
256
+ #### Solana
257
+ ``` typescript
258
+ import { useWallet } from '@solana/wallet-adapter-react';
259
+
260
+ const walletClient = useWallet();
261
+ // Check airdrop eligibility
262
+ const eligibility = await client.getClaims();
263
+
264
+ // Batch check claim status
265
+ const claimedStatus = await client.batchCheckClaimed();
266
+
267
+ const claimIds = eligibility.claims.map((claim) => claim.claimId);
268
+ // Claim airdrop
269
+ await client.claimAirdrop({
270
+ claimIds: claimIds, // List of claim IDs
271
+ walletClient: walletClient, // Wallet client
272
+ });
273
+
274
+ ```
275
+
276
+ ### Error Handling
277
+
278
+ All SDK methods throw appropriate errors. It's recommended to use try-catch for error handling:
279
+
280
+ ``` typescript
281
+ try {
282
+ await client.claimAirdrop({...});
283
+ } catch (error) {
284
+ console.error('Claim failed:', error);
285
+ }
286
+ ```