@t402/wdk 2.4.0 → 2.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.
Files changed (61) hide show
  1. package/dist/cjs/adapters/index.d.ts +198 -1
  2. package/dist/cjs/adapters/index.js +255 -0
  3. package/dist/cjs/adapters/index.js.map +1 -1
  4. package/dist/cjs/adapters/svm-adapter.d.ts +146 -2
  5. package/dist/cjs/adapters/svm-adapter.js +255 -2
  6. package/dist/cjs/adapters/svm-adapter.js.map +1 -1
  7. package/dist/cjs/adapters/ton-adapter.d.ts +57 -2
  8. package/dist/cjs/adapters/ton-adapter.js +75 -2
  9. package/dist/cjs/adapters/ton-adapter.js.map +1 -1
  10. package/dist/cjs/adapters/tron-adapter.d.ts +57 -2
  11. package/dist/cjs/adapters/tron-adapter.js +101 -0
  12. package/dist/cjs/adapters/tron-adapter.js.map +1 -1
  13. package/dist/cjs/index-DnEI5M6d.d.ts +1798 -0
  14. package/dist/cjs/index.d.ts +702 -1118
  15. package/dist/cjs/index.js +3905 -246
  16. package/dist/cjs/index.js.map +1 -1
  17. package/dist/cjs/integrations/index.d.ts +9 -0
  18. package/dist/cjs/integrations/index.js +249 -0
  19. package/dist/cjs/integrations/index.js.map +1 -0
  20. package/dist/cjs/testing/index.d.ts +62 -0
  21. package/dist/cjs/testing/index.js +129 -0
  22. package/dist/cjs/testing/index.js.map +1 -0
  23. package/dist/cjs/types-BwK8Xgvg.d.ts +967 -0
  24. package/dist/esm/adapters/index.d.mts +198 -1
  25. package/dist/esm/adapters/index.mjs +14 -3
  26. package/dist/esm/adapters/svm-adapter.d.mts +146 -2
  27. package/dist/esm/adapters/svm-adapter.mjs +18 -3
  28. package/dist/esm/adapters/ton-adapter.d.mts +57 -2
  29. package/dist/esm/adapters/ton-adapter.mjs +8 -3
  30. package/dist/esm/adapters/tron-adapter.d.mts +57 -2
  31. package/dist/esm/adapters/tron-adapter.mjs +2 -1
  32. package/dist/esm/chunk-2KWVW77U.mjs +353 -0
  33. package/dist/esm/chunk-2KWVW77U.mjs.map +1 -0
  34. package/dist/esm/chunk-7CG77QAN.mjs +153 -0
  35. package/dist/esm/chunk-7CG77QAN.mjs.map +1 -0
  36. package/dist/esm/chunk-BJTO5JO5.mjs +11 -0
  37. package/dist/esm/chunk-BJTO5JO5.mjs.map +1 -0
  38. package/dist/esm/{chunk-YWBJJV5M.mjs → chunk-KWX6CJIH.mjs} +72 -1
  39. package/dist/esm/chunk-KWX6CJIH.mjs.map +1 -0
  40. package/dist/esm/{chunk-HB2DGKQ3.mjs → chunk-QZKUU2O6.mjs} +102 -1
  41. package/dist/esm/chunk-QZKUU2O6.mjs.map +1 -0
  42. package/dist/esm/chunk-TVSNUSFZ.mjs +219 -0
  43. package/dist/esm/chunk-TVSNUSFZ.mjs.map +1 -0
  44. package/dist/esm/index-D5kvtDfm.d.mts +1798 -0
  45. package/dist/esm/index.d.mts +702 -1118
  46. package/dist/esm/index.mjs +2934 -70
  47. package/dist/esm/index.mjs.map +1 -1
  48. package/dist/esm/integrations/index.d.mts +9 -0
  49. package/dist/esm/integrations/index.mjs +16 -0
  50. package/dist/esm/integrations/index.mjs.map +1 -0
  51. package/dist/esm/testing/index.d.mts +62 -0
  52. package/dist/esm/testing/index.mjs +101 -0
  53. package/dist/esm/testing/index.mjs.map +1 -0
  54. package/dist/esm/types-BwK8Xgvg.d.mts +967 -0
  55. package/package.json +69 -20
  56. package/dist/cjs/types-V7c-qhn6.d.ts +0 -489
  57. package/dist/esm/chunk-HB2DGKQ3.mjs.map +0 -1
  58. package/dist/esm/chunk-MCFHZSF7.mjs +0 -107
  59. package/dist/esm/chunk-MCFHZSF7.mjs.map +0 -1
  60. package/dist/esm/chunk-YWBJJV5M.mjs.map +0 -1
  61. package/dist/esm/types-V7c-qhn6.d.mts +0 -489
@@ -1,5 +1,202 @@
1
1
  export { WDKTonSignerAdapter, createWDKTonSigner } from './ton-adapter.mjs';
2
2
  export { WDKSvmSignerAdapter, createWDKSvmSigner } from './svm-adapter.mjs';
3
3
  export { WDKTronSignerAdapter, createWDKTronSigner } from './tron-adapter.mjs';
4
- import '../types-V7c-qhn6.mjs';
4
+ import '../types-BwK8Xgvg.mjs';
5
5
  import 'viem';
6
+
7
+ /**
8
+ * Spark (Bitcoin L2) Signer Adapter for WDK
9
+ *
10
+ * Wraps a Spark wallet account to implement T402's payment signing interface.
11
+ * Spark is a Bitcoin L2 built on the Spark SDK (@buildonspark/spark-sdk).
12
+ */
13
+ /**
14
+ * SparkWalletAccount interface (matches @buildonspark/spark-sdk)
15
+ */
16
+ interface SparkWalletAccount {
17
+ getAddress(): Promise<string>;
18
+ getBalance(): Promise<bigint>;
19
+ sendTransaction(params: {
20
+ to: string;
21
+ amount: bigint;
22
+ }): Promise<{
23
+ hash: string;
24
+ }>;
25
+ signMessage(message: string | Uint8Array): Promise<string>;
26
+ }
27
+ /**
28
+ * WDKSparkSignerAdapter - Adapts a Spark wallet account for T402 payments
29
+ *
30
+ * @example
31
+ * ```typescript
32
+ * const adapter = await createWDKSparkSigner(sparkAccount);
33
+ *
34
+ * // Use with T402 client
35
+ * const client = createT402HTTPClient({
36
+ * signers: [{ scheme: 'exact', network: 'spark:mainnet', signer: adapter }]
37
+ * });
38
+ * ```
39
+ */
40
+ declare class WDKSparkSignerAdapter {
41
+ private _account;
42
+ private _address;
43
+ private _initialized;
44
+ constructor(account: SparkWalletAccount);
45
+ /**
46
+ * Get the wallet address
47
+ * @throws Error if not initialized
48
+ */
49
+ get address(): string;
50
+ /**
51
+ * Check if the adapter is initialized
52
+ */
53
+ get isInitialized(): boolean;
54
+ /**
55
+ * Initialize the adapter by fetching the address
56
+ * Must be called before using the signer
57
+ */
58
+ initialize(): Promise<void>;
59
+ /**
60
+ * Sign a message using the Spark wallet
61
+ * @param message - Message to sign (string or bytes)
62
+ * @returns Signature string
63
+ */
64
+ signMessage(message: string | Uint8Array): Promise<string>;
65
+ /**
66
+ * Get the wallet balance in satoshis
67
+ */
68
+ getBalance(): Promise<bigint>;
69
+ /**
70
+ * Send a transaction via the Spark network
71
+ * @param params - Transaction parameters
72
+ * @returns Transaction result with hash
73
+ */
74
+ sendTransaction(params: {
75
+ to: string;
76
+ amount: bigint;
77
+ }): Promise<{
78
+ hash: string;
79
+ }>;
80
+ }
81
+ /**
82
+ * Create an initialized WDK Spark signer
83
+ *
84
+ * @param account - Spark wallet account from @buildonspark/spark-sdk
85
+ * @returns Initialized WDKSparkSignerAdapter
86
+ *
87
+ * @example
88
+ * ```typescript
89
+ * import { T402WDK } from '@t402/wdk';
90
+ *
91
+ * const wallet = new T402WDK(seedPhrase, config);
92
+ * const sparkSigner = await wallet.getSparkSigner();
93
+ *
94
+ * // Use with T402 client
95
+ * const client = createT402HTTPClient({
96
+ * signers: [{ scheme: 'exact', network: 'spark:mainnet', signer: sparkSigner }]
97
+ * });
98
+ * ```
99
+ */
100
+ declare function createWDKSparkSigner(account: SparkWalletAccount): Promise<WDKSparkSignerAdapter>;
101
+
102
+ /**
103
+ * Bitcoin (BTC) On-Chain Signer Adapter for WDK
104
+ *
105
+ * Wraps a Tether WDK Bitcoin account to implement T402's payment signing interface.
106
+ * This allows WDK-managed Bitcoin wallets to be used for T402 payments.
107
+ */
108
+ /**
109
+ * WDKBtcAccount interface (matches @tetherto/wdk-wallet-btc)
110
+ */
111
+ interface WDKBtcAccount {
112
+ getAddress(): Promise<string>;
113
+ getBalance(): Promise<bigint>;
114
+ sendTransaction(params: {
115
+ to: string;
116
+ amount: bigint;
117
+ fee?: bigint;
118
+ }): Promise<string>;
119
+ signMessage(message: string): Promise<string>;
120
+ signPsbt(psbt: Uint8Array): Promise<Uint8Array>;
121
+ }
122
+ /**
123
+ * WDKBtcSignerAdapter - Adapts a WDK Bitcoin account for T402 payments
124
+ *
125
+ * @example
126
+ * ```typescript
127
+ * const adapter = await createWDKBtcSigner(wdkBtcAccount);
128
+ *
129
+ * // Use with T402 client
130
+ * const client = createT402HTTPClient({
131
+ * signers: [{ scheme: 'exact', network: 'bip122:000000000019d6689c085ae165831e93', signer: adapter }]
132
+ * });
133
+ * ```
134
+ */
135
+ declare class WDKBtcSignerAdapter {
136
+ private _account;
137
+ private _address;
138
+ private _initialized;
139
+ constructor(account: WDKBtcAccount);
140
+ /**
141
+ * Get the wallet address
142
+ * @throws Error if not initialized
143
+ */
144
+ get address(): string;
145
+ /**
146
+ * Check if the adapter is initialized
147
+ */
148
+ get isInitialized(): boolean;
149
+ /**
150
+ * Initialize the adapter by fetching the address
151
+ * Must be called before using the signer
152
+ */
153
+ initialize(): Promise<void>;
154
+ /**
155
+ * Sign a message using the Bitcoin wallet
156
+ * @param message - Message string to sign
157
+ * @returns Signature string
158
+ */
159
+ signMessage(message: string): Promise<string>;
160
+ /**
161
+ * Sign a Partially Signed Bitcoin Transaction (PSBT)
162
+ * @param psbt - PSBT bytes to sign
163
+ * @returns Signed PSBT bytes
164
+ */
165
+ signPsbt(psbt: Uint8Array): Promise<Uint8Array>;
166
+ /**
167
+ * Get the wallet balance in satoshis
168
+ */
169
+ getBalance(): Promise<bigint>;
170
+ /**
171
+ * Send a Bitcoin transaction
172
+ * @param params - Transaction parameters
173
+ * @returns Transaction hash
174
+ */
175
+ sendTransaction(params: {
176
+ to: string;
177
+ amount: bigint;
178
+ fee?: bigint;
179
+ }): Promise<string>;
180
+ }
181
+ /**
182
+ * Create an initialized WDK Bitcoin signer
183
+ *
184
+ * @param account - WDK Bitcoin account from @tetherto/wdk-wallet-btc
185
+ * @returns Initialized WDKBtcSignerAdapter
186
+ *
187
+ * @example
188
+ * ```typescript
189
+ * import { T402WDK } from '@t402/wdk';
190
+ *
191
+ * const wallet = new T402WDK(seedPhrase, config);
192
+ * const btcSigner = await wallet.getBtcSigner();
193
+ *
194
+ * // Use with T402 client
195
+ * const client = createT402HTTPClient({
196
+ * signers: [{ scheme: 'exact', network: 'bip122:000000000019d6689c085ae165831e93', signer: btcSigner }]
197
+ * });
198
+ * ```
199
+ */
200
+ declare function createWDKBtcSigner(account: WDKBtcAccount): Promise<WDKBtcSignerAdapter>;
201
+
202
+ export { WDKBtcSignerAdapter, WDKSparkSignerAdapter, createWDKBtcSigner, createWDKSparkSigner };
@@ -1,19 +1,30 @@
1
+ import {
2
+ WDKBtcSignerAdapter,
3
+ WDKSparkSignerAdapter,
4
+ createWDKBtcSigner,
5
+ createWDKSparkSigner
6
+ } from "../chunk-7CG77QAN.mjs";
1
7
  import {
2
8
  WDKSvmSignerAdapter,
3
9
  createWDKSvmSigner
4
- } from "../chunk-MCFHZSF7.mjs";
10
+ } from "../chunk-2KWVW77U.mjs";
5
11
  import {
6
12
  WDKTonSignerAdapter,
7
13
  createWDKTonSigner
8
- } from "../chunk-YWBJJV5M.mjs";
14
+ } from "../chunk-KWX6CJIH.mjs";
9
15
  import {
10
16
  WDKTronSignerAdapter,
11
17
  createWDKTronSigner
12
- } from "../chunk-HB2DGKQ3.mjs";
18
+ } from "../chunk-QZKUU2O6.mjs";
19
+ import "../chunk-BJTO5JO5.mjs";
13
20
  export {
21
+ WDKBtcSignerAdapter,
22
+ WDKSparkSignerAdapter,
14
23
  WDKSvmSignerAdapter,
15
24
  WDKTonSignerAdapter,
16
25
  WDKTronSignerAdapter,
26
+ createWDKBtcSigner,
27
+ createWDKSparkSigner,
17
28
  createWDKSvmSigner,
18
29
  createWDKTonSigner,
19
30
  createWDKTronSigner
@@ -1,4 +1,4 @@
1
- import { W as WDKSolanaAccount } from '../types-V7c-qhn6.mjs';
1
+ import { W as WDKSolanaAccount } from '../types-BwK8Xgvg.mjs';
2
2
  import 'viem';
3
3
 
4
4
  /**
@@ -6,6 +6,12 @@ import 'viem';
6
6
  *
7
7
  * Wraps a Tether WDK Solana account to implement T402's ClientSvmSigner interface.
8
8
  * ClientSvmSigner is just TransactionSigner from @solana/kit.
9
+ *
10
+ * Includes support for:
11
+ * - Versioned transactions (v0) with address lookup tables
12
+ * - Priority fees via ComputeBudget program
13
+ * - Token-2022 program detection and transfer fee queries
14
+ * - Associated Token Account resolution
9
15
  */
10
16
 
11
17
  /**
@@ -101,6 +107,144 @@ declare class WDKSvmSignerAdapter implements TransactionSigner {
101
107
  amount: bigint;
102
108
  }): Promise<string>;
103
109
  }
110
+ /**
111
+ * Serialized instruction for building transactions
112
+ */
113
+ interface SerializedInstruction {
114
+ programId: string;
115
+ keys: Array<{
116
+ pubkey: string;
117
+ isSigner: boolean;
118
+ isWritable: boolean;
119
+ }>;
120
+ data: Uint8Array;
121
+ }
122
+ /**
123
+ * Parameters for building a versioned (v0) transaction
124
+ */
125
+ interface BuildVersionedTransactionParams {
126
+ instructions: SerializedInstruction[];
127
+ addressLookupTableAccounts?: Array<{
128
+ key: string;
129
+ addresses: string[];
130
+ }>;
131
+ priorityFee?: {
132
+ microLamports: number;
133
+ computeUnits?: number;
134
+ };
135
+ }
136
+ /**
137
+ * Parameters for a transfer with priority fee
138
+ */
139
+ interface TransferWithPriorityFeeParams {
140
+ token: string;
141
+ recipient: string;
142
+ amount: bigint;
143
+ priorityFeeMicroLamports?: number;
144
+ createATA?: boolean;
145
+ }
146
+ /**
147
+ * Result of querying recent priority fees
148
+ */
149
+ interface PriorityFeeEstimate {
150
+ low: number;
151
+ medium: number;
152
+ high: number;
153
+ }
154
+ /**
155
+ * ATA resolution result
156
+ */
157
+ interface ATAResolution {
158
+ address: string;
159
+ exists: boolean;
160
+ createInstruction?: SerializedInstruction;
161
+ }
162
+ /**
163
+ * Token program type
164
+ */
165
+ type TokenProgramType = 'Token' | 'Token-2022';
166
+ /**
167
+ * Transfer fee information for Token-2022 tokens
168
+ */
169
+ interface TransferFeeInfo {
170
+ fee: bigint;
171
+ netAmount: bigint;
172
+ transferFeeBasisPoints: number;
173
+ maximumFee: bigint;
174
+ }
175
+ /**
176
+ * Build a versioned (v0) transaction with optional priority fee.
177
+ *
178
+ * This constructs a v0 transaction message that supports address lookup tables
179
+ * for compact encoding and ComputeBudget instructions for priority fees.
180
+ *
181
+ * @param adapter - The initialized SVM signer adapter
182
+ * @param params - Transaction build parameters
183
+ * @returns Serialized v0 transaction message bytes
184
+ */
185
+ declare function buildVersionedTransaction(adapter: WDKSvmSignerAdapter, params: BuildVersionedTransactionParams): Uint8Array;
186
+ /**
187
+ * Transfer SPL tokens with an attached priority fee.
188
+ *
189
+ * Wraps a standard SPL token transfer with ComputeBudget instructions
190
+ * to ensure timely inclusion during congested periods.
191
+ *
192
+ * @param adapter - The initialized SVM signer adapter
193
+ * @param params - Transfer parameters
194
+ * @returns Transaction signature
195
+ */
196
+ declare function transferWithPriorityFee(adapter: WDKSvmSignerAdapter, params: TransferWithPriorityFeeParams): Promise<string>;
197
+ /**
198
+ * Get recommended priority fees from recent blocks.
199
+ *
200
+ * Returns low/medium/high estimates in micro-lamports per compute unit.
201
+ * Caller should use these as hints for `priorityFee.microLamports`.
202
+ *
203
+ * @param rpcUrl - Solana RPC endpoint URL
204
+ * @returns Priority fee estimates
205
+ */
206
+ declare function getRecentPriorityFees(rpcUrl: string): Promise<PriorityFeeEstimate>;
207
+ /**
208
+ * Resolve the Associated Token Account (ATA) for an owner/mint pair.
209
+ *
210
+ * If the ATA does not exist, returns a creation instruction that can be
211
+ * prepended to the transaction.
212
+ *
213
+ * @param rpcUrl - Solana RPC endpoint URL
214
+ * @param owner - Owner public key (base58)
215
+ * @param mint - Token mint address (base58)
216
+ * @returns ATA resolution result
217
+ */
218
+ declare function resolveATA(rpcUrl: string, owner: string, mint: string): Promise<ATAResolution>;
219
+ /**
220
+ * Determine whether a token mint uses the standard Token program or Token-2022.
221
+ *
222
+ * @param rpcUrl - Solana RPC endpoint URL
223
+ * @param mint - Token mint address (base58)
224
+ * @returns Token program type
225
+ */
226
+ declare function getTokenProgram(rpcUrl: string, mint: string): Promise<TokenProgramType>;
227
+ /**
228
+ * Get the transfer fee for a Token-2022 mint.
229
+ *
230
+ * Queries the mint's transfer fee extension data. Returns zero fee
231
+ * if the mint is a standard Token program mint or has no transfer fee extension.
232
+ *
233
+ * @param rpcUrl - Solana RPC endpoint URL
234
+ * @param mint - Token mint address (base58)
235
+ * @param amount - Transfer amount in smallest units
236
+ * @returns Transfer fee info
237
+ */
238
+ declare function getTransferFee(rpcUrl: string, mint: string, amount: bigint): Promise<TransferFeeInfo>;
239
+ /**
240
+ * Derive an Associated Token Account address deterministically.
241
+ * Uses the standard PDA derivation: [owner, TOKEN_PROGRAM_ID, mint] seeded
242
+ * under the Associated Token Program.
243
+ *
244
+ * This is a simplified derivation returning a deterministic string.
245
+ * For production use, integrate with @solana/kit's findProgramAddress.
246
+ */
247
+ declare function deriveATAAddress(owner: string, mint: string): string;
104
248
  /**
105
249
  * Create an initialized WDK Solana signer
106
250
  *
@@ -122,4 +266,4 @@ declare class WDKSvmSignerAdapter implements TransactionSigner {
122
266
  */
123
267
  declare function createWDKSvmSigner(account: WDKSolanaAccount): Promise<WDKSvmSignerAdapter>;
124
268
 
125
- export { type SolanaAddress, type TransactionSigner, WDKSvmSignerAdapter, createWDKSvmSigner };
269
+ export { type ATAResolution, type BuildVersionedTransactionParams, type PriorityFeeEstimate, type SerializedInstruction, type SolanaAddress, type TokenProgramType, type TransactionSigner, type TransferFeeInfo, type TransferWithPriorityFeeParams, WDKSvmSignerAdapter, buildVersionedTransaction, createWDKSvmSigner, deriveATAAddress, getRecentPriorityFees, getTokenProgram, getTransferFee, resolveATA, transferWithPriorityFee };
@@ -1,9 +1,24 @@
1
1
  import {
2
2
  WDKSvmSignerAdapter,
3
- createWDKSvmSigner
4
- } from "../chunk-MCFHZSF7.mjs";
3
+ buildVersionedTransaction,
4
+ createWDKSvmSigner,
5
+ deriveATAAddress,
6
+ getRecentPriorityFees,
7
+ getTokenProgram,
8
+ getTransferFee,
9
+ resolveATA,
10
+ transferWithPriorityFee
11
+ } from "../chunk-2KWVW77U.mjs";
12
+ import "../chunk-BJTO5JO5.mjs";
5
13
  export {
6
14
  WDKSvmSignerAdapter,
7
- createWDKSvmSigner
15
+ buildVersionedTransaction,
16
+ createWDKSvmSigner,
17
+ deriveATAAddress,
18
+ getRecentPriorityFees,
19
+ getTokenProgram,
20
+ getTransferFee,
21
+ resolveATA,
22
+ transferWithPriorityFee
8
23
  };
9
24
  //# sourceMappingURL=svm-adapter.mjs.map
@@ -1,4 +1,4 @@
1
- import { a as WDKTonAccount } from '../types-V7c-qhn6.mjs';
1
+ import { a as WDKTonAccount } from '../types-BwK8Xgvg.mjs';
2
2
  import 'viem';
3
3
 
4
4
  /**
@@ -115,6 +115,61 @@ declare class WDKTonSignerAdapter implements ClientTonSigner {
115
115
  */
116
116
  getWDKAccount(): WDKTonAccount;
117
117
  }
118
+ /**
119
+ * Parameters for waiting on a Jetton transfer completion
120
+ */
121
+ interface WaitForJettonTransferParams {
122
+ /** External message hash (from the sent transaction) */
123
+ externalMessageHash: string;
124
+ /** Jetton master contract address */
125
+ jettonMaster: string;
126
+ /** Expected recipient address */
127
+ expectedRecipient: string;
128
+ /** Expected amount in smallest units */
129
+ expectedAmount: bigint;
130
+ /** Timeout in milliseconds (default: 120000 = 2 min) */
131
+ timeoutMs?: number;
132
+ /** Poll interval in milliseconds (default: 3000 = 3s) */
133
+ pollIntervalMs?: number;
134
+ /** Callback on status change */
135
+ onStatusChange?: (status: JettonTransferStatus) => void;
136
+ }
137
+ /**
138
+ * Jetton transfer status
139
+ */
140
+ type JettonTransferStatus = 'pending' | 'confirming' | 'completed' | 'failed' | 'timeout';
141
+ /**
142
+ * Result of waiting for a Jetton transfer
143
+ */
144
+ interface JettonTransferResult {
145
+ success: boolean;
146
+ status: JettonTransferStatus;
147
+ transactionHash?: string;
148
+ error?: string;
149
+ }
150
+ /**
151
+ * Wait for a Jetton transfer to complete by polling the TON API.
152
+ *
153
+ * Follows the internal message chain from the external message through
154
+ * the Jetton wallet to the recipient.
155
+ *
156
+ * @param apiEndpoint - TON API endpoint (e.g., https://toncenter.com/api/v2)
157
+ * @param params - Transfer parameters to verify
158
+ * @returns Transfer result
159
+ */
160
+ declare function waitForJettonTransfer(apiEndpoint: string, params: WaitForJettonTransferParams): Promise<JettonTransferResult>;
161
+ /**
162
+ * Resolve a Jetton wallet address for a given owner and Jetton master.
163
+ *
164
+ * Calls the Jetton master's `get_wallet_address` GET method to
165
+ * deterministically derive the Jetton wallet address.
166
+ *
167
+ * @param apiEndpoint - TON API endpoint
168
+ * @param ownerAddress - Owner's wallet address
169
+ * @param jettonMaster - Jetton master contract address
170
+ * @returns Jetton wallet address string
171
+ */
172
+ declare function getJettonWalletAddress(apiEndpoint: string, ownerAddress: string, jettonMaster: string): Promise<string>;
118
173
  /**
119
174
  * Create an initialized WDK TON signer
120
175
  *
@@ -136,4 +191,4 @@ declare class WDKTonSignerAdapter implements ClientTonSigner {
136
191
  */
137
192
  declare function createWDKTonSigner(account: WDKTonAccount): Promise<WDKTonSignerAdapter>;
138
193
 
139
- export { type ClientTonSigner, type SignMessageParams, type TonAddress, type TonCell, WDKTonSignerAdapter, createWDKTonSigner };
194
+ export { type ClientTonSigner, type JettonTransferResult, type JettonTransferStatus, type SignMessageParams, type TonAddress, type TonCell, WDKTonSignerAdapter, type WaitForJettonTransferParams, createWDKTonSigner, getJettonWalletAddress, waitForJettonTransfer };
@@ -1,9 +1,14 @@
1
1
  import {
2
2
  WDKTonSignerAdapter,
3
- createWDKTonSigner
4
- } from "../chunk-YWBJJV5M.mjs";
3
+ createWDKTonSigner,
4
+ getJettonWalletAddress,
5
+ waitForJettonTransfer
6
+ } from "../chunk-KWX6CJIH.mjs";
7
+ import "../chunk-BJTO5JO5.mjs";
5
8
  export {
6
9
  WDKTonSignerAdapter,
7
- createWDKTonSigner
10
+ createWDKTonSigner,
11
+ getJettonWalletAddress,
12
+ waitForJettonTransfer
8
13
  };
9
14
  //# sourceMappingURL=ton-adapter.mjs.map
@@ -1,4 +1,4 @@
1
- import { b as WDKTronAccount } from '../types-V7c-qhn6.mjs';
1
+ import { b as WDKTronAccount } from '../types-BwK8Xgvg.mjs';
2
2
  import 'viem';
3
3
 
4
4
  /**
@@ -6,6 +6,11 @@ import 'viem';
6
6
  *
7
7
  * Wraps a Tether WDK TRON account to implement T402's ClientTronSigner interface.
8
8
  * This allows WDK-managed TRON wallets to be used for T402 payments.
9
+ *
10
+ * Includes support for:
11
+ * - Energy estimation for dynamic fee limits
12
+ * - External energy delegation providers
13
+ * - Dynamic fee limit calculation with 20% margin
9
14
  */
10
15
 
11
16
  /**
@@ -42,6 +47,22 @@ interface ClientTronSigner {
42
47
  signTransaction(params: SignTransactionParams): Promise<string>;
43
48
  getBlockInfo(): Promise<BlockInfo>;
44
49
  }
50
+ /**
51
+ * Energy estimation result
52
+ */
53
+ interface EnergyEstimate {
54
+ energyRequired: number;
55
+ energyAvailable: number;
56
+ trxCostIfNoEnergy: bigint;
57
+ bandwidthRequired: number;
58
+ }
59
+ /**
60
+ * Energy provider interface for external delegation services
61
+ */
62
+ interface EnergyProvider {
63
+ delegateEnergy(to: string, amount: number): Promise<string>;
64
+ getPrice(amount: number): Promise<bigint>;
65
+ }
45
66
  /**
46
67
  * WDKTronSignerAdapter - Adapts a WDK TRON account to T402's ClientTronSigner
47
68
  *
@@ -60,6 +81,7 @@ declare class WDKTronSignerAdapter implements ClientTronSigner {
60
81
  private _address;
61
82
  private _initialized;
62
83
  private _rpcUrl;
84
+ private _energyProvider;
63
85
  constructor(account: WDKTronAccount, rpcUrl?: string);
64
86
  /**
65
87
  * Get the wallet address (T-prefix base58check)
@@ -92,6 +114,39 @@ declare class WDKTronSignerAdapter implements ClientTronSigner {
92
114
  * This is required for TRON's replay protection mechanism
93
115
  */
94
116
  getBlockInfo(): Promise<BlockInfo>;
117
+ /**
118
+ * Estimate the energy required for a TRC20 transfer.
119
+ *
120
+ * Uses the `wallet/triggerconstantcontract` API to simulate the transfer
121
+ * and return the energy/bandwidth requirements.
122
+ *
123
+ * @param params - Transaction parameters to simulate
124
+ * @returns Energy estimation result
125
+ */
126
+ estimateEnergy(params: SignTransactionParams): Promise<EnergyEstimate>;
127
+ /**
128
+ * Sign a TRC20 transfer with dynamic fee limit estimation.
129
+ *
130
+ * Instead of using a hardcoded 100 TRX fee limit, estimates the actual
131
+ * energy cost and adds a 20% margin.
132
+ *
133
+ * @param params - Transaction parameters
134
+ * @returns Hex-encoded signed transaction
135
+ */
136
+ signTransactionWithEstimation(params: SignTransactionParams): Promise<string>;
137
+ /**
138
+ * Register an external energy delegation provider.
139
+ *
140
+ * Energy providers can delegate bandwidth and energy to this account
141
+ * to reduce TRX costs for TRC20 transfers.
142
+ *
143
+ * @param provider - Energy delegation provider
144
+ */
145
+ registerEnergyProvider(provider: EnergyProvider): void;
146
+ /**
147
+ * Get the registered energy provider, if any
148
+ */
149
+ getEnergyProvider(): EnergyProvider | null;
95
150
  /**
96
151
  * Build a TRC20 transfer transaction
97
152
  */
@@ -136,4 +191,4 @@ declare class WDKTronSignerAdapter implements ClientTronSigner {
136
191
  */
137
192
  declare function createWDKTronSigner(account: WDKTronAccount, rpcUrl?: string): Promise<WDKTronSignerAdapter>;
138
193
 
139
- export { type BlockInfo, type ClientTronSigner, type SignTransactionParams, WDKTronSignerAdapter, createWDKTronSigner };
194
+ export { type BlockInfo, type ClientTronSigner, type EnergyEstimate, type EnergyProvider, type SignTransactionParams, WDKTronSignerAdapter, createWDKTronSigner };
@@ -1,7 +1,8 @@
1
1
  import {
2
2
  WDKTronSignerAdapter,
3
3
  createWDKTronSigner
4
- } from "../chunk-HB2DGKQ3.mjs";
4
+ } from "../chunk-QZKUU2O6.mjs";
5
+ import "../chunk-BJTO5JO5.mjs";
5
6
  export {
6
7
  WDKTronSignerAdapter,
7
8
  createWDKTronSigner