@t402/wdk 2.3.1 → 2.5.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/README.md +8 -0
- package/dist/cjs/adapters/index.d.ts +5 -0
- package/dist/cjs/adapters/index.js +455 -0
- package/dist/cjs/adapters/index.js.map +1 -0
- package/dist/cjs/adapters/svm-adapter.d.ts +125 -0
- package/dist/cjs/adapters/svm-adapter.js +132 -0
- package/dist/cjs/adapters/svm-adapter.js.map +1 -0
- package/dist/cjs/adapters/ton-adapter.d.ts +139 -0
- package/dist/cjs/adapters/ton-adapter.js +152 -0
- package/dist/cjs/adapters/ton-adapter.js.map +1 -0
- package/dist/cjs/adapters/tron-adapter.d.ts +139 -0
- package/dist/cjs/adapters/tron-adapter.js +221 -0
- package/dist/cjs/adapters/tron-adapter.js.map +1 -0
- package/dist/cjs/index.d.ts +292 -217
- package/dist/cjs/index.js +1042 -23
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types-C1S0k-2w.d.ts +489 -0
- package/dist/esm/adapters/index.d.mts +5 -0
- package/dist/esm/adapters/index.mjs +21 -0
- package/dist/esm/adapters/index.mjs.map +1 -0
- package/dist/esm/adapters/svm-adapter.d.mts +125 -0
- package/dist/esm/adapters/svm-adapter.mjs +9 -0
- package/dist/esm/adapters/svm-adapter.mjs.map +1 -0
- package/dist/esm/adapters/ton-adapter.d.mts +139 -0
- package/dist/esm/adapters/ton-adapter.mjs +9 -0
- package/dist/esm/adapters/ton-adapter.mjs.map +1 -0
- package/dist/esm/adapters/tron-adapter.d.mts +139 -0
- package/dist/esm/adapters/tron-adapter.mjs +9 -0
- package/dist/esm/adapters/tron-adapter.mjs.map +1 -0
- package/dist/esm/chunk-HB2DGKQ3.mjs +196 -0
- package/dist/esm/chunk-HB2DGKQ3.mjs.map +1 -0
- package/dist/esm/chunk-MCFHZSF7.mjs +107 -0
- package/dist/esm/chunk-MCFHZSF7.mjs.map +1 -0
- package/dist/esm/chunk-YWBJJV5M.mjs +117 -0
- package/dist/esm/chunk-YWBJJV5M.mjs.map +1 -0
- package/dist/esm/index.d.mts +292 -217
- package/dist/esm/index.mjs +640 -23
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/types-C1S0k-2w.d.mts +489 -0
- package/package.json +82 -18
|
@@ -0,0 +1,489 @@
|
|
|
1
|
+
import { Address } from 'viem';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Type definitions for T402 WDK integration
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* EVM chain configuration
|
|
9
|
+
*/
|
|
10
|
+
interface EvmChainConfig {
|
|
11
|
+
/** RPC endpoint URL */
|
|
12
|
+
provider: string;
|
|
13
|
+
/** Chain ID */
|
|
14
|
+
chainId: number;
|
|
15
|
+
/** CAIP-2 network identifier */
|
|
16
|
+
network: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* T402 WDK configuration options
|
|
20
|
+
*/
|
|
21
|
+
interface T402WDKConfig {
|
|
22
|
+
/** Ethereum mainnet configuration */
|
|
23
|
+
ethereum?: EvmChainConfig | string;
|
|
24
|
+
/** Arbitrum One configuration */
|
|
25
|
+
arbitrum?: EvmChainConfig | string;
|
|
26
|
+
/** Base mainnet configuration */
|
|
27
|
+
base?: EvmChainConfig | string;
|
|
28
|
+
/** Ink mainnet configuration */
|
|
29
|
+
ink?: EvmChainConfig | string;
|
|
30
|
+
/** Berachain mainnet configuration */
|
|
31
|
+
berachain?: EvmChainConfig | string;
|
|
32
|
+
/** Unichain mainnet configuration */
|
|
33
|
+
unichain?: EvmChainConfig | string;
|
|
34
|
+
/** Polygon mainnet configuration */
|
|
35
|
+
polygon?: EvmChainConfig | string;
|
|
36
|
+
/** Custom chains */
|
|
37
|
+
[key: string]: EvmChainConfig | string | undefined;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Normalized chain configuration
|
|
41
|
+
*/
|
|
42
|
+
interface NormalizedChainConfig {
|
|
43
|
+
provider: string;
|
|
44
|
+
chainId: number;
|
|
45
|
+
network: string;
|
|
46
|
+
name: string;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Token balance information
|
|
50
|
+
*/
|
|
51
|
+
interface TokenBalance {
|
|
52
|
+
/** Token contract address */
|
|
53
|
+
token: Address;
|
|
54
|
+
/** Token symbol */
|
|
55
|
+
symbol: string;
|
|
56
|
+
/** Balance in smallest units */
|
|
57
|
+
balance: bigint;
|
|
58
|
+
/** Formatted balance (human-readable) */
|
|
59
|
+
formatted: string;
|
|
60
|
+
/** Decimals */
|
|
61
|
+
decimals: number;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Chain balance information
|
|
65
|
+
*/
|
|
66
|
+
interface ChainBalance {
|
|
67
|
+
/** Chain name (e.g., "arbitrum") */
|
|
68
|
+
chain: string;
|
|
69
|
+
/** CAIP-2 network identifier */
|
|
70
|
+
network: string;
|
|
71
|
+
/** Native token balance */
|
|
72
|
+
native: bigint;
|
|
73
|
+
/** Token balances */
|
|
74
|
+
tokens: TokenBalance[];
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Aggregated balance across all chains
|
|
78
|
+
*/
|
|
79
|
+
interface AggregatedBalance {
|
|
80
|
+
/** Total USDT0 balance across all chains */
|
|
81
|
+
totalUsdt0: bigint;
|
|
82
|
+
/** Total USDC balance across all chains */
|
|
83
|
+
totalUsdc: bigint;
|
|
84
|
+
/** Per-chain balances */
|
|
85
|
+
chains: ChainBalance[];
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Bridge parameters for cross-chain transfers
|
|
89
|
+
*/
|
|
90
|
+
interface BridgeParams {
|
|
91
|
+
/** Source chain name */
|
|
92
|
+
fromChain: string;
|
|
93
|
+
/** Destination chain name */
|
|
94
|
+
toChain: string;
|
|
95
|
+
/** Amount to bridge in smallest units */
|
|
96
|
+
amount: bigint;
|
|
97
|
+
/** Recipient address (optional, defaults to same wallet on target chain) */
|
|
98
|
+
recipient?: Address;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Bridge result
|
|
102
|
+
*/
|
|
103
|
+
interface BridgeResult {
|
|
104
|
+
/** Transaction hash on source chain */
|
|
105
|
+
txHash: string;
|
|
106
|
+
/** Estimated time for bridge completion in seconds */
|
|
107
|
+
estimatedTime: number;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* EIP-712 typed data domain
|
|
111
|
+
*/
|
|
112
|
+
interface TypedDataDomain {
|
|
113
|
+
name: string;
|
|
114
|
+
version: string;
|
|
115
|
+
chainId: number;
|
|
116
|
+
verifyingContract: Address;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* EIP-712 typed data types
|
|
120
|
+
*/
|
|
121
|
+
type TypedDataTypes = Record<string, Array<{
|
|
122
|
+
name: string;
|
|
123
|
+
type: string;
|
|
124
|
+
}>>;
|
|
125
|
+
/**
|
|
126
|
+
* T402 Signer interface for WDK
|
|
127
|
+
* Compatible with @t402/core signer requirements
|
|
128
|
+
*/
|
|
129
|
+
interface T402WDKSigner {
|
|
130
|
+
/** Get wallet address */
|
|
131
|
+
readonly address: Address;
|
|
132
|
+
/** Sign EIP-712 typed data */
|
|
133
|
+
signTypedData(params: {
|
|
134
|
+
domain: TypedDataDomain;
|
|
135
|
+
types: TypedDataTypes;
|
|
136
|
+
primaryType: string;
|
|
137
|
+
message: Record<string, unknown>;
|
|
138
|
+
}): Promise<`0x${string}`>;
|
|
139
|
+
/** Sign a message */
|
|
140
|
+
signMessage?(message: string | Uint8Array): Promise<`0x${string}`>;
|
|
141
|
+
/** Get token balance */
|
|
142
|
+
getTokenBalance?(tokenAddress: Address): Promise<bigint>;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* WDK Account interface (matches @tetherto/wdk account structure)
|
|
146
|
+
*
|
|
147
|
+
* This is the canonical definition used across all @t402/wdk-* packages.
|
|
148
|
+
* Implementors (Tether WDK) provide these methods; T402 code consumes them.
|
|
149
|
+
*/
|
|
150
|
+
interface WDKAccount {
|
|
151
|
+
/** Get the account's address */
|
|
152
|
+
getAddress(): Promise<string>;
|
|
153
|
+
/** Get the account's native balance */
|
|
154
|
+
getBalance(): Promise<bigint>;
|
|
155
|
+
/** Get the account's token balance */
|
|
156
|
+
getTokenBalance(tokenAddress: string): Promise<bigint>;
|
|
157
|
+
/** Sign a message */
|
|
158
|
+
signMessage(message: string): Promise<string>;
|
|
159
|
+
/** Sign typed data (EIP-712) */
|
|
160
|
+
signTypedData(params: {
|
|
161
|
+
domain: Record<string, unknown>;
|
|
162
|
+
types: Record<string, unknown>;
|
|
163
|
+
primaryType: string;
|
|
164
|
+
message: Record<string, unknown>;
|
|
165
|
+
}): Promise<string>;
|
|
166
|
+
/** Send a transaction */
|
|
167
|
+
sendTransaction(params: {
|
|
168
|
+
to: string;
|
|
169
|
+
value?: bigint;
|
|
170
|
+
data?: string;
|
|
171
|
+
}): Promise<string>;
|
|
172
|
+
/** Estimate gas for a transaction (optional — not all implementations support this) */
|
|
173
|
+
estimateGas?(params: {
|
|
174
|
+
to: string;
|
|
175
|
+
value?: bigint;
|
|
176
|
+
data?: string;
|
|
177
|
+
}): Promise<bigint>;
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Alias for WDKAccount — preferred naming for use in @t402/wdk-* packages.
|
|
181
|
+
*/
|
|
182
|
+
type WdkAccount = WDKAccount;
|
|
183
|
+
/**
|
|
184
|
+
* WDK instance interface (matches @tetherto/wdk structure)
|
|
185
|
+
*/
|
|
186
|
+
interface WDKInstance {
|
|
187
|
+
registerWallet<T>(name: string, manager: T, config: Record<string, unknown>): WDKInstance;
|
|
188
|
+
registerProtocol<T>(name: string, protocol: T): WDKInstance;
|
|
189
|
+
getAccount(chain: string, index: number): Promise<WDKAccount>;
|
|
190
|
+
executeProtocol(name: string, params: Record<string, unknown>): Promise<{
|
|
191
|
+
txHash: string;
|
|
192
|
+
}>;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* WDK constructor type
|
|
196
|
+
*/
|
|
197
|
+
interface WDKConstructor {
|
|
198
|
+
new (seedPhrase: string): WDKInstance;
|
|
199
|
+
getRandomSeedPhrase(): string;
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Balance cache configuration for T402WDK
|
|
203
|
+
*/
|
|
204
|
+
interface T402BalanceCacheConfig {
|
|
205
|
+
/** Whether caching is enabled (default: true) */
|
|
206
|
+
enabled?: boolean;
|
|
207
|
+
/** TTL for native balance in milliseconds (default: 15000 = 15 seconds) */
|
|
208
|
+
nativeBalanceTTL?: number;
|
|
209
|
+
/** TTL for token balance in milliseconds (default: 30000 = 30 seconds) */
|
|
210
|
+
tokenBalanceTTL?: number;
|
|
211
|
+
/** TTL for aggregated balances in milliseconds (default: 60000 = 60 seconds) */
|
|
212
|
+
aggregatedBalanceTTL?: number;
|
|
213
|
+
/** Maximum cache entries (default: 500) */
|
|
214
|
+
maxSize?: number;
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Extended T402 WDK configuration with cache options
|
|
218
|
+
*/
|
|
219
|
+
interface T402WDKOptions {
|
|
220
|
+
/** Balance cache configuration */
|
|
221
|
+
cache?: T402BalanceCacheConfig;
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Supported blockchain families
|
|
225
|
+
*/
|
|
226
|
+
type ChainFamily = 'evm' | 'svm' | 'ton' | 'tron';
|
|
227
|
+
/**
|
|
228
|
+
* Solana chain configuration
|
|
229
|
+
*/
|
|
230
|
+
interface SvmChainConfig {
|
|
231
|
+
/** RPC endpoint URL */
|
|
232
|
+
rpcUrl: string;
|
|
233
|
+
/** Commitment level */
|
|
234
|
+
commitment?: 'processed' | 'confirmed' | 'finalized';
|
|
235
|
+
/** Network type */
|
|
236
|
+
network?: 'mainnet' | 'testnet' | 'devnet';
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* TON chain configuration
|
|
240
|
+
*/
|
|
241
|
+
interface TonChainConfig {
|
|
242
|
+
/** API endpoint URL */
|
|
243
|
+
endpoint: string;
|
|
244
|
+
/** Network type */
|
|
245
|
+
network?: 'mainnet' | 'testnet';
|
|
246
|
+
/** API key for TON Center */
|
|
247
|
+
apiKey?: string;
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* TRON chain configuration
|
|
251
|
+
*/
|
|
252
|
+
interface TronChainConfig {
|
|
253
|
+
/** Full host URL (e.g., https://api.trongrid.io) */
|
|
254
|
+
fullHost: string;
|
|
255
|
+
/** Network type */
|
|
256
|
+
network?: 'mainnet' | 'shasta' | 'nile';
|
|
257
|
+
/** API key for TronGrid */
|
|
258
|
+
apiKey?: string;
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* Multi-chain configuration
|
|
262
|
+
*/
|
|
263
|
+
interface MultiChainConfig {
|
|
264
|
+
/** EVM chains configuration */
|
|
265
|
+
evm?: Record<string, EvmChainConfig | string>;
|
|
266
|
+
/** Solana configuration */
|
|
267
|
+
svm?: SvmChainConfig;
|
|
268
|
+
/** TON configuration */
|
|
269
|
+
ton?: TonChainConfig;
|
|
270
|
+
/** TRON configuration */
|
|
271
|
+
tron?: TronChainConfig;
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* WDK wallet modules registry
|
|
275
|
+
* All modules are optional - only register what you need
|
|
276
|
+
*/
|
|
277
|
+
interface WDKWalletModules {
|
|
278
|
+
/** EVM wallet manager (@tetherto/wdk-wallet-evm) */
|
|
279
|
+
evm?: unknown;
|
|
280
|
+
/** EVM ERC-4337 wallet manager (@tetherto/wdk-wallet-evm-erc4337) */
|
|
281
|
+
evmErc4337?: unknown;
|
|
282
|
+
/** Solana wallet manager (@tetherto/wdk-wallet-solana) */
|
|
283
|
+
solana?: unknown;
|
|
284
|
+
/** TON wallet manager (@tetherto/wdk-wallet-ton) */
|
|
285
|
+
ton?: unknown;
|
|
286
|
+
/** TON gasless wallet manager (@tetherto/wdk-wallet-ton-gasless) */
|
|
287
|
+
tonGasless?: unknown;
|
|
288
|
+
/** TRON wallet manager (@tetherto/wdk-wallet-tron) */
|
|
289
|
+
tron?: unknown;
|
|
290
|
+
/** Bitcoin wallet manager (@tetherto/wdk-wallet-btc) */
|
|
291
|
+
btc?: unknown;
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* WDK protocol modules registry
|
|
295
|
+
* All modules are optional - only register what you need
|
|
296
|
+
*/
|
|
297
|
+
interface WDKProtocolModules {
|
|
298
|
+
/** USDT0 bridge for EVM (@tetherto/wdk-protocol-bridge-usdt0-evm) */
|
|
299
|
+
bridgeUsdt0Evm?: unknown;
|
|
300
|
+
/** USDT0 bridge for TON (@tetherto/wdk-protocol-bridge-usdt0-ton) */
|
|
301
|
+
bridgeUsdt0Ton?: unknown;
|
|
302
|
+
/** Velora swap for EVM (@tetherto/wdk-protocol-swap-velora-evm) */
|
|
303
|
+
swapVeloraEvm?: unknown;
|
|
304
|
+
/** Aave lending for EVM (@tetherto/wdk-protocol-lending-aave-evm) */
|
|
305
|
+
lendingAaveEvm?: unknown;
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* Unified WDK modules registration
|
|
309
|
+
*/
|
|
310
|
+
interface WDKModulesConfig {
|
|
311
|
+
/** Wallet modules */
|
|
312
|
+
wallets?: WDKWalletModules;
|
|
313
|
+
/** Protocol modules */
|
|
314
|
+
protocols?: WDKProtocolModules;
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* WDK TON account interface (compatible with @tetherto/wdk-wallet-ton)
|
|
318
|
+
*/
|
|
319
|
+
interface WDKTonAccount {
|
|
320
|
+
/** Get wallet address */
|
|
321
|
+
getAddress(): Promise<string>;
|
|
322
|
+
/** Get TON balance */
|
|
323
|
+
getBalance(): Promise<bigint>;
|
|
324
|
+
/** Get Jetton balance */
|
|
325
|
+
getJettonBalance(jettonMaster: string): Promise<bigint>;
|
|
326
|
+
/** Sign a message */
|
|
327
|
+
signMessage(message: Uint8Array): Promise<Uint8Array>;
|
|
328
|
+
/** Send TON transaction */
|
|
329
|
+
sendTransaction(params: {
|
|
330
|
+
to: string;
|
|
331
|
+
value: bigint;
|
|
332
|
+
body?: string;
|
|
333
|
+
bounce?: boolean;
|
|
334
|
+
}): Promise<string>;
|
|
335
|
+
/** Get current sequence number */
|
|
336
|
+
getSeqno(): Promise<number>;
|
|
337
|
+
/** Transfer Jettons */
|
|
338
|
+
transferJetton?(params: {
|
|
339
|
+
jettonMaster: string;
|
|
340
|
+
to: string;
|
|
341
|
+
amount: bigint;
|
|
342
|
+
forwardPayload?: string;
|
|
343
|
+
}): Promise<string>;
|
|
344
|
+
}
|
|
345
|
+
/**
|
|
346
|
+
* WDK Solana account interface (compatible with @tetherto/wdk-wallet-solana)
|
|
347
|
+
*/
|
|
348
|
+
interface WDKSolanaAccount {
|
|
349
|
+
/** Get wallet address (base58) */
|
|
350
|
+
getAddress(): Promise<string>;
|
|
351
|
+
/** Get SOL balance */
|
|
352
|
+
getBalance(): Promise<bigint>;
|
|
353
|
+
/** Get SPL token balance */
|
|
354
|
+
getTokenBalance(mint: string): Promise<bigint>;
|
|
355
|
+
/** Sign a message */
|
|
356
|
+
sign(message: Uint8Array): Promise<Uint8Array>;
|
|
357
|
+
/** Sign a transaction */
|
|
358
|
+
signTransaction(transaction: Uint8Array): Promise<Uint8Array>;
|
|
359
|
+
/** Send SOL */
|
|
360
|
+
sendTransaction(params: {
|
|
361
|
+
recipient: string;
|
|
362
|
+
value: bigint;
|
|
363
|
+
}): Promise<string>;
|
|
364
|
+
/** Transfer SPL token */
|
|
365
|
+
transfer(params: {
|
|
366
|
+
token: string;
|
|
367
|
+
recipient: string;
|
|
368
|
+
amount: bigint;
|
|
369
|
+
}): Promise<string>;
|
|
370
|
+
}
|
|
371
|
+
/**
|
|
372
|
+
* WDK TRON account interface (compatible with @tetherto/wdk-wallet-tron)
|
|
373
|
+
*/
|
|
374
|
+
interface WDKTronAccount {
|
|
375
|
+
/** Get wallet address (base58) */
|
|
376
|
+
getAddress(): Promise<string>;
|
|
377
|
+
/** Get TRX balance */
|
|
378
|
+
getBalance(): Promise<bigint>;
|
|
379
|
+
/** Get TRC20 token balance */
|
|
380
|
+
getTrc20Balance(contractAddress: string): Promise<bigint>;
|
|
381
|
+
/** Sign a transaction */
|
|
382
|
+
signTransaction(transaction: unknown): Promise<unknown>;
|
|
383
|
+
/** Send signed transaction */
|
|
384
|
+
sendTransaction(signedTx: unknown): Promise<string>;
|
|
385
|
+
/** Transfer TRC20 token */
|
|
386
|
+
transferTrc20?(params: {
|
|
387
|
+
contractAddress: string;
|
|
388
|
+
to: string;
|
|
389
|
+
amount: bigint;
|
|
390
|
+
}): Promise<string>;
|
|
391
|
+
}
|
|
392
|
+
/**
|
|
393
|
+
* Extended WDK instance interface with multi-chain support
|
|
394
|
+
*/
|
|
395
|
+
interface WDKInstanceMultiChain extends WDKInstance {
|
|
396
|
+
/** Get TON account */
|
|
397
|
+
getTonAccount?(index: number): Promise<WDKTonAccount>;
|
|
398
|
+
/** Get Solana account */
|
|
399
|
+
getSolanaAccount?(index: number): Promise<WDKSolanaAccount>;
|
|
400
|
+
/** Get TRON account */
|
|
401
|
+
getTronAccount?(index: number): Promise<WDKTronAccount>;
|
|
402
|
+
}
|
|
403
|
+
/**
|
|
404
|
+
* Configuration for T402WDK.create() factory method
|
|
405
|
+
*/
|
|
406
|
+
interface T402WDKCreateConfig {
|
|
407
|
+
/** BIP-39 mnemonic seed phrase */
|
|
408
|
+
seedPhrase: string;
|
|
409
|
+
/** Chain name → RPC URL mapping for EVM chains */
|
|
410
|
+
chains: Record<string, string>;
|
|
411
|
+
/** WDK modules to register */
|
|
412
|
+
modules: WDKModulesConfig;
|
|
413
|
+
/** Additional options */
|
|
414
|
+
options?: T402WDKOptions;
|
|
415
|
+
}
|
|
416
|
+
/**
|
|
417
|
+
* A signer entry for use with T402 HTTP clients
|
|
418
|
+
*/
|
|
419
|
+
interface SignerEntry {
|
|
420
|
+
/** Payment scheme (e.g., "exact") */
|
|
421
|
+
scheme: string;
|
|
422
|
+
/** CAIP-2 network identifier (e.g., "eip155:42161") */
|
|
423
|
+
network: string;
|
|
424
|
+
/** The signer instance */
|
|
425
|
+
signer: unknown;
|
|
426
|
+
/** Chain family (evm, ton, svm, tron) */
|
|
427
|
+
family: ChainFamily;
|
|
428
|
+
}
|
|
429
|
+
/**
|
|
430
|
+
* Options for getAllSigners()
|
|
431
|
+
*/
|
|
432
|
+
interface GetAllSignersOptions {
|
|
433
|
+
/** HD wallet account index (default: 0) */
|
|
434
|
+
accountIndex?: number;
|
|
435
|
+
/** Filter by payment schemes (default: ["exact"]) */
|
|
436
|
+
schemes?: string[];
|
|
437
|
+
/** Include non-EVM chain signers (default: true) */
|
|
438
|
+
includeNonEvm?: boolean;
|
|
439
|
+
}
|
|
440
|
+
/**
|
|
441
|
+
* Options for T402WDK.fromWDK()
|
|
442
|
+
*/
|
|
443
|
+
interface FromWDKOptions {
|
|
444
|
+
/** HD wallet account index for auto-discovery (default: 0) */
|
|
445
|
+
defaultAccountIndex?: number;
|
|
446
|
+
}
|
|
447
|
+
/**
|
|
448
|
+
* Swap quote result
|
|
449
|
+
*/
|
|
450
|
+
interface SwapQuote {
|
|
451
|
+
/** Input token address */
|
|
452
|
+
inputToken: string;
|
|
453
|
+
/** Output token address */
|
|
454
|
+
outputToken: string;
|
|
455
|
+
/** Input amount in smallest units */
|
|
456
|
+
inputAmount: bigint;
|
|
457
|
+
/** Expected output amount in smallest units */
|
|
458
|
+
outputAmount: bigint;
|
|
459
|
+
/** Price impact percentage */
|
|
460
|
+
priceImpact: number;
|
|
461
|
+
/** Swap route (token addresses) */
|
|
462
|
+
route: string[];
|
|
463
|
+
}
|
|
464
|
+
/**
|
|
465
|
+
* Swap execution result
|
|
466
|
+
*/
|
|
467
|
+
interface SwapResult {
|
|
468
|
+
/** Transaction hash */
|
|
469
|
+
txHash: string;
|
|
470
|
+
/** Actual input amount */
|
|
471
|
+
inputAmount: bigint;
|
|
472
|
+
/** Actual output amount */
|
|
473
|
+
outputAmount: bigint;
|
|
474
|
+
}
|
|
475
|
+
/**
|
|
476
|
+
* Parameters for swap operations
|
|
477
|
+
*/
|
|
478
|
+
interface SwapParams {
|
|
479
|
+
/** Chain name (e.g., "ethereum", "arbitrum") */
|
|
480
|
+
chain: string;
|
|
481
|
+
/** Input token address */
|
|
482
|
+
fromToken: string;
|
|
483
|
+
/** Amount to swap in smallest units */
|
|
484
|
+
amount: bigint;
|
|
485
|
+
/** Maximum slippage tolerance (0-1, default: 0.005 = 0.5%) */
|
|
486
|
+
maxSlippage?: number;
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
export type { AggregatedBalance as A, BridgeParams as B, ChainFamily as C, EvmChainConfig as E, FromWDKOptions as F, GetAllSignersOptions as G, MultiChainConfig as M, NormalizedChainConfig as N, SignerEntry as S, T402WDKCreateConfig as T, WDKSolanaAccount as W, WDKTonAccount as a, WDKTronAccount as b, WDKInstance as c, WDKConstructor as d, WDKModulesConfig as e, WDKWalletModules as f, WDKProtocolModules as g, T402WDKConfig as h, T402WDKOptions as i, ChainBalance as j, BridgeResult as k, SwapQuote as l, SwapParams as m, SwapResult as n, SvmChainConfig as o, T402BalanceCacheConfig as p, T402WDKSigner as q, TokenBalance as r, TonChainConfig as s, TronChainConfig as t, TypedDataDomain as u, TypedDataTypes as v, WDKAccount as w, WDKInstanceMultiChain as x, WdkAccount as y };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@t402/wdk",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.0",
|
|
4
4
|
"main": "./dist/cjs/index.js",
|
|
5
5
|
"module": "./dist/esm/index.js",
|
|
6
6
|
"types": "./dist/cjs/index.d.ts",
|
|
@@ -19,32 +19,32 @@
|
|
|
19
19
|
"repository": "https://github.com/t402-io/t402",
|
|
20
20
|
"description": "T402 Payment Protocol integration with Tether Wallet Development Kit (WDK)",
|
|
21
21
|
"devDependencies": {
|
|
22
|
-
"@eslint/js": "^9.
|
|
23
|
-
"@ledgerhq/hw-app-eth": "^7.
|
|
24
|
-
"@ledgerhq/hw-transport-web-ble": "^6.
|
|
25
|
-
"@ledgerhq/hw-transport-webhid": "^6.
|
|
26
|
-
"@ledgerhq/hw-transport-webusb": "^6.
|
|
22
|
+
"@eslint/js": "^9.39.2",
|
|
23
|
+
"@ledgerhq/hw-app-eth": "^7.3.2",
|
|
24
|
+
"@ledgerhq/hw-transport-web-ble": "^6.31.0",
|
|
25
|
+
"@ledgerhq/hw-transport-webhid": "^6.31.0",
|
|
26
|
+
"@ledgerhq/hw-transport-webusb": "^6.30.0",
|
|
27
27
|
"@trezor/connect": "^9.7.1",
|
|
28
|
-
"@types/node": "^
|
|
29
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
30
|
-
"@typescript-eslint/parser": "^8.
|
|
28
|
+
"@types/node": "^25.2.2",
|
|
29
|
+
"@typescript-eslint/eslint-plugin": "^8.55.0",
|
|
30
|
+
"@typescript-eslint/parser": "^8.55.0",
|
|
31
31
|
"@vitest/coverage-v8": "^3.2.4",
|
|
32
32
|
"eslint": "^9.24.0",
|
|
33
33
|
"eslint-plugin-import": "^2.31.0",
|
|
34
|
-
"eslint-plugin-jsdoc": "^
|
|
35
|
-
"eslint-plugin-prettier": "^5.
|
|
34
|
+
"eslint-plugin-jsdoc": "^62.5.4",
|
|
35
|
+
"eslint-plugin-prettier": "^5.5.5",
|
|
36
36
|
"glob": "^13.0.0",
|
|
37
|
-
"prettier": "3.
|
|
38
|
-
"tsup": "^8.
|
|
37
|
+
"prettier": "3.8.1",
|
|
38
|
+
"tsup": "^8.5.1",
|
|
39
39
|
"tsx": "^4.21.0",
|
|
40
|
-
"typescript": "^5.
|
|
40
|
+
"typescript": "^5.9.3",
|
|
41
41
|
"vite": "^7.3.1",
|
|
42
|
-
"vite-tsconfig-paths": "^
|
|
42
|
+
"vite-tsconfig-paths": "^6.1.0",
|
|
43
43
|
"vitest": "^3.2.4"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@t402/core": "2.
|
|
47
|
-
"@t402/evm": "2.
|
|
46
|
+
"@t402/core": "2.5.0",
|
|
47
|
+
"@t402/evm": "2.5.0"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
50
|
"viem": "^2.0.0",
|
|
@@ -54,7 +54,13 @@
|
|
|
54
54
|
"@ledgerhq/hw-transport-webusb": ">=6.0.0",
|
|
55
55
|
"@tetherto/wdk": ">=1.0.0-beta.0",
|
|
56
56
|
"@tetherto/wdk-wallet-evm": ">=1.0.0-beta.0",
|
|
57
|
-
"@
|
|
57
|
+
"@tetherto/wdk-wallet-solana": ">=1.0.0-beta.0",
|
|
58
|
+
"@tetherto/wdk-wallet-ton": ">=1.0.0-beta.0",
|
|
59
|
+
"@tetherto/wdk-wallet-tron": ">=1.0.0-beta.0",
|
|
60
|
+
"@tetherto/wdk-protocol-bridge-usdt0-evm": ">=1.0.0-beta.0",
|
|
61
|
+
"@trezor/connect": ">=9.0.0",
|
|
62
|
+
"@ton/core": ">=0.53.0",
|
|
63
|
+
"@solana/kit": ">=2.0.0"
|
|
58
64
|
},
|
|
59
65
|
"peerDependenciesMeta": {
|
|
60
66
|
"@tetherto/wdk": {
|
|
@@ -63,6 +69,18 @@
|
|
|
63
69
|
"@tetherto/wdk-wallet-evm": {
|
|
64
70
|
"optional": true
|
|
65
71
|
},
|
|
72
|
+
"@tetherto/wdk-wallet-solana": {
|
|
73
|
+
"optional": true
|
|
74
|
+
},
|
|
75
|
+
"@tetherto/wdk-wallet-ton": {
|
|
76
|
+
"optional": true
|
|
77
|
+
},
|
|
78
|
+
"@tetherto/wdk-wallet-tron": {
|
|
79
|
+
"optional": true
|
|
80
|
+
},
|
|
81
|
+
"@tetherto/wdk-protocol-bridge-usdt0-evm": {
|
|
82
|
+
"optional": true
|
|
83
|
+
},
|
|
66
84
|
"@ledgerhq/hw-app-eth": {
|
|
67
85
|
"optional": true
|
|
68
86
|
},
|
|
@@ -77,6 +95,12 @@
|
|
|
77
95
|
},
|
|
78
96
|
"@trezor/connect": {
|
|
79
97
|
"optional": true
|
|
98
|
+
},
|
|
99
|
+
"@ton/core": {
|
|
100
|
+
"optional": true
|
|
101
|
+
},
|
|
102
|
+
"@solana/kit": {
|
|
103
|
+
"optional": true
|
|
80
104
|
}
|
|
81
105
|
},
|
|
82
106
|
"exports": {
|
|
@@ -89,6 +113,46 @@
|
|
|
89
113
|
"types": "./dist/cjs/index.d.ts",
|
|
90
114
|
"default": "./dist/cjs/index.js"
|
|
91
115
|
}
|
|
116
|
+
},
|
|
117
|
+
"./adapters": {
|
|
118
|
+
"import": {
|
|
119
|
+
"types": "./dist/esm/adapters/index.d.mts",
|
|
120
|
+
"default": "./dist/esm/adapters/index.mjs"
|
|
121
|
+
},
|
|
122
|
+
"require": {
|
|
123
|
+
"types": "./dist/cjs/adapters/index.d.ts",
|
|
124
|
+
"default": "./dist/cjs/adapters/index.js"
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
"./adapters/ton": {
|
|
128
|
+
"import": {
|
|
129
|
+
"types": "./dist/esm/adapters/ton-adapter.d.mts",
|
|
130
|
+
"default": "./dist/esm/adapters/ton-adapter.mjs"
|
|
131
|
+
},
|
|
132
|
+
"require": {
|
|
133
|
+
"types": "./dist/cjs/adapters/ton-adapter.d.ts",
|
|
134
|
+
"default": "./dist/cjs/adapters/ton-adapter.js"
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
"./adapters/svm": {
|
|
138
|
+
"import": {
|
|
139
|
+
"types": "./dist/esm/adapters/svm-adapter.d.mts",
|
|
140
|
+
"default": "./dist/esm/adapters/svm-adapter.mjs"
|
|
141
|
+
},
|
|
142
|
+
"require": {
|
|
143
|
+
"types": "./dist/cjs/adapters/svm-adapter.d.ts",
|
|
144
|
+
"default": "./dist/cjs/adapters/svm-adapter.js"
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
"./adapters/tron": {
|
|
148
|
+
"import": {
|
|
149
|
+
"types": "./dist/esm/adapters/tron-adapter.d.mts",
|
|
150
|
+
"default": "./dist/esm/adapters/tron-adapter.mjs"
|
|
151
|
+
},
|
|
152
|
+
"require": {
|
|
153
|
+
"types": "./dist/cjs/adapters/tron-adapter.d.ts",
|
|
154
|
+
"default": "./dist/cjs/adapters/tron-adapter.js"
|
|
155
|
+
}
|
|
92
156
|
}
|
|
93
157
|
},
|
|
94
158
|
"files": [
|