@tetherto/wdk-wallet 1.0.0-beta.1 → 1.0.0-beta.11

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.
@@ -0,0 +1,400 @@
1
+ /** @interface */
2
+ export interface ISwidgeProtocol extends ISwapProtocol, IBridgeProtocol {
3
+ /**
4
+ * Quotes the estimated costs and output of a cross-chain swap/bridge operation.
5
+ * Returns a non-binding quote; the actual execution is performed
6
+ * by {@link swidge}.
7
+ *
8
+ * @param {SwidgeOptions} options - The swidge options.
9
+ * @returns {Promise<SwidgeQuote>} The quoted swidge details.
10
+ */
11
+ quoteSwidge(options: SwidgeOptions): Promise<SwidgeQuote>;
12
+ /**
13
+ * Executes a swidge operation.
14
+ *
15
+ * @param {SwidgeOptions} options - The swidge options.
16
+ * @param {SwidgeProtocolConfig} [config] - Optional provider-specific execution configuration.
17
+ * @returns {Promise<SwidgeResult>} The swidge execution result.
18
+ */
19
+ swidge(options: SwidgeOptions, config?: SwidgeProtocolConfig): Promise<SwidgeResult>;
20
+ /**
21
+ * Retrieves the current status of an in-flight swidge.
22
+ *
23
+ * @param {string} id - The swidge execution identifier returned by swidge.
24
+ * @param {SwidgeStatusOptions} [options] - Optional hints to assist provider lookups.
25
+ * @returns {Promise<SwidgeStatusResult>} The current swidge status.
26
+ * @throws {Error} If the id is invalid, or no swidge exists with the given identifier.
27
+ */
28
+ getSwidgeStatus(id: string, options?: SwidgeStatusOptions): Promise<SwidgeStatusResult>;
29
+ /**
30
+ * Retrieves the chains supported by the provider for swidge operations.
31
+ *
32
+ * @returns {Promise<SwidgeSupportedChain[]>} The supported chains.
33
+ */
34
+ getSupportedChains(): Promise<SwidgeSupportedChain[]>;
35
+ /**
36
+ * Retrieves the tokens supported by the provider for swidge operations.
37
+ *
38
+ * @param {SwidgeSupportedTokensOptions} [options] - Optional filters for chain- or route-scoped token discovery.
39
+ * @returns {Promise<SwidgeSupportedToken[]>} The supported tokens.
40
+ */
41
+ getSupportedTokens(options?: SwidgeSupportedTokensOptions): Promise<SwidgeSupportedToken[]>;
42
+ }
43
+ /** @abstract */
44
+ export default abstract class SwidgeProtocol implements ISwidgeProtocol, ISwapProtocol, IBridgeProtocol {
45
+ /**
46
+ * Creates a new swidge protocol without binding it to a wallet account.
47
+ *
48
+ * @overload
49
+ * @param {undefined} [account] - The wallet account to use to interact with the protocol.
50
+ * @param {SwidgeProtocolConfig} [config] - The swidge protocol configuration.
51
+ */
52
+ constructor(account?: undefined, config?: SwidgeProtocolConfig | undefined);
53
+ /**
54
+ * Creates a new read-only swidge protocol.
55
+ *
56
+ * @overload
57
+ * @param {IWalletAccountReadOnly} account - The wallet account to use to interact with the protocol.
58
+ * @param {SwidgeProtocolConfig} [config] - The swidge protocol configuration.
59
+ */
60
+ constructor(account: IWalletAccountReadOnly, config?: SwidgeProtocolConfig | undefined);
61
+ /**
62
+ * Creates a new swidge protocol.
63
+ *
64
+ * @overload
65
+ * @param {IWalletAccount} account - The wallet account to use to interact with the protocol.
66
+ * @param {SwidgeProtocolConfig} [config] - The swidge protocol configuration.
67
+ */
68
+ constructor(account: IWalletAccount, config?: SwidgeProtocolConfig | undefined);
69
+ /**
70
+ * The wallet account to use to interact with the protocol.
71
+ *
72
+ * @protected
73
+ * @type {IWalletAccountReadOnly | IWalletAccount | undefined}
74
+ */
75
+ protected _account: IWalletAccountReadOnly | IWalletAccount | undefined;
76
+ /**
77
+ * The swidge protocol configuration.
78
+ *
79
+ * @protected
80
+ * @type {SwidgeProtocolConfig}
81
+ */
82
+ protected _config: SwidgeProtocolConfig;
83
+ /**
84
+ * Swaps a pair of tokens by delegating to {@link swidge}.
85
+ *
86
+ * @param {SwapOptions} options - The swap's options.
87
+ * @returns {Promise<SwapResult>} The swap's result.
88
+ */
89
+ swap(options: SwapOptions): Promise<SwapResult>;
90
+ /**
91
+ * Quotes the costs of a swap operation by delegating to {@link quoteSwidge}.
92
+ *
93
+ * @param {SwapOptions} options - The swap's options.
94
+ * @returns {Promise<Omit<SwapResult, 'hash'>>} The swap's quotes.
95
+ */
96
+ quoteSwap(options: SwapOptions): Promise<Omit<SwapResult, "hash">>;
97
+ /**
98
+ * Bridges a token to a different blockchain by delegating to {@link swidge}.
99
+ *
100
+ * @param {BridgeOptions} options - The bridge's options.
101
+ * @returns {Promise<BridgeResult>} The bridge's result.
102
+ */
103
+ bridge(options: BridgeOptions): Promise<BridgeResult>;
104
+ /**
105
+ * Quotes the costs of a bridge operation by delegating to {@link quoteSwidge}.
106
+ *
107
+ * @param {BridgeOptions} options - The bridge's options.
108
+ * @returns {Promise<Omit<BridgeResult, 'hash'>>} The bridge's quotes.
109
+ */
110
+ quoteBridge(options: BridgeOptions): Promise<Omit<BridgeResult, "hash">>;
111
+ /**
112
+ * Quotes the estimated costs and output of a swidge operation.
113
+ * Returns a non-binding quote; the actual execution is performed
114
+ * by {@link swidge}.
115
+ *
116
+ * @abstract
117
+ * @param {SwidgeOptions} options - The swidge options.
118
+ * @returns {Promise<SwidgeQuote>} The quoted swidge details.
119
+ */
120
+ abstract quoteSwidge(options: SwidgeOptions): Promise<SwidgeQuote>;
121
+ /**
122
+ * Executes a swidge operation.
123
+ *
124
+ * @abstract
125
+ * @param {SwidgeOptions} options - The swidge options.
126
+ * @param {SwidgeProtocolConfig} [config] - Optional provider-specific execution configuration.
127
+ * @returns {Promise<SwidgeResult>} The swidge execution result.
128
+ */
129
+ abstract swidge(options: SwidgeOptions, config?: SwidgeProtocolConfig): Promise<SwidgeResult>;
130
+ /**
131
+ * Retrieves the current status of an in-flight swidge.
132
+ *
133
+ * @abstract
134
+ * @param {string} id - The swidge execution identifier returned by swidge.
135
+ * @param {SwidgeStatusOptions} [options] - Optional hints to assist provider lookups.
136
+ * @returns {Promise<SwidgeStatusResult>} The current swidge status.
137
+ * @throws {Error} If the id is invalid, or no swidge exists with the given identifier.
138
+ */
139
+ abstract getSwidgeStatus(id: string, options?: SwidgeStatusOptions): Promise<SwidgeStatusResult>;
140
+ /**
141
+ * Retrieves the chains supported by the provider for swidge operations.
142
+ *
143
+ * @abstract
144
+ * @returns {Promise<SwidgeSupportedChain[]>} The supported chains.
145
+ */
146
+ abstract getSupportedChains(): Promise<SwidgeSupportedChain[]>;
147
+ /**
148
+ * Retrieves the tokens supported by the provider for swidge operations.
149
+ *
150
+ * @abstract
151
+ * @param {SwidgeSupportedTokensOptions} [options] - Optional filters for chain- or route-scoped token discovery.
152
+ * @returns {Promise<SwidgeSupportedToken[]>} The supported tokens.
153
+ */
154
+ abstract getSupportedTokens(options?: SwidgeSupportedTokensOptions): Promise<SwidgeSupportedToken[]>;
155
+ }
156
+ export type IWalletAccountReadOnly = import("../wallet-account-read-only.js").IWalletAccountReadOnly;
157
+ export type IWalletAccount = import("../wallet-account.js").IWalletAccount;
158
+ export type ISwapProtocol = import("./swap-protocol.js").ISwapProtocol;
159
+ export type SwapOptions = import("./swap-protocol.js").SwapOptions;
160
+ export type SwapResult = import("./swap-protocol.js").SwapResult;
161
+ export type IBridgeProtocol = import("./bridge-protocol.js").IBridgeProtocol;
162
+ export type BridgeOptions = import("./bridge-protocol.js").BridgeOptions;
163
+ export type BridgeResult = import("./bridge-protocol.js").BridgeResult;
164
+ export type SwidgeStatus = "pending" | "action-required" | "completed" | "failed" | "refund-pending" | "refunded" | "cancelled" | "expired" | "partial";
165
+ export type SwidgeFeeType = "network" | "protocol" | "affiliate" | "other";
166
+ export type SwidgeProtocolConfig = {
167
+ /**
168
+ * - Maximum acceptable network fee in basis points of the input amount.
169
+ */
170
+ maxNetworkFeeBps?: number | bigint | undefined;
171
+ /**
172
+ * - Maximum acceptable protocol fee in basis points of the input amount.
173
+ */
174
+ maxProtocolFeeBps?: number | bigint | undefined;
175
+ };
176
+ export type SwidgeOptions = SwidgeCommonOptions & (SwidgeExactInOptions | SwidgeExactOutOptions);
177
+ export type SwidgeCommonOptions = {
178
+ /**
179
+ * - The provider-specific identifier or address of the source token.
180
+ */
181
+ fromToken: string;
182
+ /**
183
+ * - The provider-specific identifier or address of the destination token.
184
+ */
185
+ toToken: string;
186
+ /**
187
+ * - The identifier of the destination chain. If omitted, defaults to the source chain (same-chain swap).
188
+ */
189
+ toChain?: string | number | undefined;
190
+ /**
191
+ * - The address that will receive the output tokens.
192
+ */
193
+ recipient?: string | undefined;
194
+ /**
195
+ * - The address that will receive refunds if the tx cannot complete.
196
+ */
197
+ refundAddress?: string | undefined;
198
+ /**
199
+ * - The maximum acceptable slippage as a decimal (e.g., 0.01 for 1%).
200
+ */
201
+ slippage?: number | undefined;
202
+ };
203
+ export type SwidgeExactInOptions = {
204
+ /**
205
+ * - The exact amount of source tokens to spend (in base unit).
206
+ */
207
+ fromTokenAmount: number | bigint;
208
+ /**
209
+ * - Not applicable for exact-in operations.
210
+ */
211
+ toTokenAmount?: undefined;
212
+ };
213
+ export type SwidgeExactOutOptions = {
214
+ /**
215
+ * - Not applicable for exact-out operations.
216
+ */
217
+ fromTokenAmount?: undefined;
218
+ /**
219
+ * - The exact amount of destination tokens to receive (in base unit).
220
+ */
221
+ toTokenAmount: number | bigint;
222
+ };
223
+ export type SwidgeFee = {
224
+ /**
225
+ * - The category of the fee.
226
+ */
227
+ type: SwidgeFeeType;
228
+ /**
229
+ * - The fee amount in base units.
230
+ */
231
+ amount: bigint;
232
+ /**
233
+ * - The token in which the fee is denominated.
234
+ */
235
+ token: string;
236
+ /**
237
+ * - The chain on which the fee is charged.
238
+ */
239
+ chain?: string | number | undefined;
240
+ /**
241
+ * - Whether the fee is already included in the quoted amounts.
242
+ */
243
+ included?: boolean | undefined;
244
+ /**
245
+ * - A human-readable description of the fee.
246
+ */
247
+ description?: string | undefined;
248
+ };
249
+ export type SwidgeTransaction = {
250
+ /**
251
+ * - The transaction hash.
252
+ */
253
+ hash: string;
254
+ /**
255
+ * - The chain on which the transaction occurred.
256
+ */
257
+ chain?: string | number | undefined;
258
+ /**
259
+ * - The role of the transaction within the swidge.
260
+ */
261
+ type?: "other" | "source" | "destination" | "approval" | "refund" | undefined;
262
+ };
263
+ export type SwidgeQuote = {
264
+ /**
265
+ * - The amount of source tokens to spend.
266
+ */
267
+ fromTokenAmount: bigint;
268
+ /**
269
+ * - The estimated amount of destination tokens to receive.
270
+ */
271
+ toTokenAmount: bigint;
272
+ /**
273
+ * - The minimum guaranteed amount after slippage.
274
+ */
275
+ toTokenAmountMin: bigint;
276
+ /**
277
+ * - Itemised fee breakdown.
278
+ */
279
+ fees: SwidgeFee[];
280
+ /**
281
+ * - Estimated duration in seconds.
282
+ */
283
+ estimatedDuration?: number | undefined;
284
+ /**
285
+ * - Unix timestamp (seconds) at which the quote expires.
286
+ */
287
+ expiry?: number | undefined;
288
+ /**
289
+ * - Provider-reported estimated price impact as a decimal (e.g., 0.01 for 1%).
290
+ */
291
+ priceImpact?: number | undefined;
292
+ };
293
+ export type SwidgeResult = {
294
+ /**
295
+ * - The unique swidge execution identifier.
296
+ */
297
+ id: string;
298
+ /**
299
+ * - The primary transaction hash (if available immediately).
300
+ */
301
+ hash?: string | undefined;
302
+ /**
303
+ * - Itemised fee breakdown.
304
+ */
305
+ fees: SwidgeFee[];
306
+ /**
307
+ * - Transactions produced by the swidge execution.
308
+ */
309
+ transactions?: SwidgeTransaction[] | undefined;
310
+ /**
311
+ * - The actual amount of source tokens spent.
312
+ */
313
+ fromTokenAmount: bigint;
314
+ /**
315
+ * - The actual or expected amount of destination tokens.
316
+ */
317
+ toTokenAmount: bigint;
318
+ /**
319
+ * - The minimum guaranteed amount after slippage.
320
+ */
321
+ toTokenAmountMin?: bigint | undefined;
322
+ };
323
+ export type SwidgeStatusOptions = {
324
+ /**
325
+ * - The source chain identifier.
326
+ */
327
+ fromChain?: string | number | undefined;
328
+ /**
329
+ * - The destination chain identifier.
330
+ */
331
+ toChain?: string | number | undefined;
332
+ };
333
+ export type SwidgeStatusResult = {
334
+ /**
335
+ * - The current status of the swidge.
336
+ */
337
+ status: SwidgeStatus;
338
+ /**
339
+ * - Transactions associated with the swidge.
340
+ */
341
+ transactions?: SwidgeTransaction[] | undefined;
342
+ };
343
+ export type SwidgeSupportedChain = {
344
+ /**
345
+ * - The provider-specific chain identifier.
346
+ */
347
+ id: string | number;
348
+ /**
349
+ * - The human-readable chain name.
350
+ */
351
+ name: string;
352
+ /**
353
+ * - The chain or virtual machine type (e.g., 'evm', 'svm', 'utxo').
354
+ */
355
+ type: string;
356
+ /**
357
+ * - The symbol of the chain's native token.
358
+ */
359
+ nativeToken: string;
360
+ };
361
+ export type SwidgeSupportedToken = {
362
+ /**
363
+ * - The provider-specific token identifier to use in swidge operations.
364
+ */
365
+ token: string;
366
+ /**
367
+ * - The chain on which the token is available.
368
+ */
369
+ chain: string | number;
370
+ /**
371
+ * - The token symbol.
372
+ */
373
+ symbol: string;
374
+ /**
375
+ * - The number of decimal places for the token's base unit.
376
+ */
377
+ decimals: number;
378
+ /**
379
+ * - The token contract address, if applicable.
380
+ */
381
+ address?: string | undefined;
382
+ /**
383
+ * - The token's full name.
384
+ */
385
+ name?: string | undefined;
386
+ };
387
+ export type SwidgeSupportedTokensOptions = {
388
+ /**
389
+ * - The optional source chain for route-scoped discovery.
390
+ */
391
+ fromChain?: string | number | undefined;
392
+ /**
393
+ * - The optional source token for route-scoped discovery.
394
+ */
395
+ fromToken?: string | undefined;
396
+ /**
397
+ * - The optional destination chain for route-scoped discovery.
398
+ */
399
+ toChain?: string | number | undefined;
400
+ };
@@ -0,0 +1,34 @@
1
+ /**
2
+ * A minimal, cross-chain signer interface.
3
+ *
4
+ * @interface
5
+ */
6
+ export class ISigner {
7
+ /**
8
+ * Derive a child signer using a relative path (e.g., "0'/0/0").
9
+ *
10
+ * @param {string} relPath - The relative derivation path.
11
+ * @returns {Promise<ISigner>} The derived signer.
12
+ * @throws {SignerError} If the signer does not support derivation.
13
+ */
14
+ derive(relPath: string): Promise<ISigner>;
15
+ /**
16
+ * Signs a transaction.
17
+ *
18
+ * @param {Transaction} tx - The transaction to sign.
19
+ * @returns {Promise<unknown>} The signed transaction.
20
+ */
21
+ signTransaction(tx: Transaction): Promise<unknown>;
22
+ /**
23
+ * Returns the signer's address.
24
+ *
25
+ * @returns {Promise<string>} The address.
26
+ */
27
+ getAddress(): Promise<string>;
28
+ /**
29
+ * Disposes the signer and clears any secret material from memory.
30
+ */
31
+ dispose(): void;
32
+ }
33
+ export type Transaction = import("./wallet-account-read-only.js").Transaction;
34
+ export type SignerError = import("./errors.js").SignerError;
@@ -6,6 +6,15 @@ export interface IWalletAccountReadOnly {
6
6
  * @returns {Promise<string>} The account's address.
7
7
  */
8
8
  getAddress(): Promise<string>;
9
+ /**
10
+ * Verifies a message's signature.
11
+ *
12
+ * @param {string} message - The original message.
13
+ * @param {string} signature - The signature to verify.
14
+ * @returns {Promise<boolean>} True if the signature is valid.
15
+ * @throws {Error} If the read-only wallet account class is not able to provide an implementation for the method.
16
+ */
17
+ verify(message: string, signature: string): Promise<boolean>;
9
18
  /**
10
19
  * Returns the account's native token balance.
11
20
  *
@@ -67,6 +76,16 @@ export default abstract class WalletAccountReadOnly implements IWalletAccountRea
67
76
  * @returns {Promise<string>} The account's address.
68
77
  */
69
78
  getAddress(): Promise<string>;
79
+ /**
80
+ * Verifies a message's signature.
81
+ *
82
+ * @abstract
83
+ * @param {string} message - The original message.
84
+ * @param {string} signature - The signature to verify.
85
+ * @returns {Promise<boolean>} True if the signature is valid.
86
+ * @throws {Error} If the read-only wallet account class is not able to provide an implementation for the method.
87
+ */
88
+ abstract verify(message: string, signature: string): Promise<boolean>;
70
89
  /**
71
90
  * Returns the account's native token balance.
72
91
  *
@@ -25,6 +25,13 @@ export interface IWalletAccount extends IWalletAccountReadOnly {
25
25
  * @returns {Promise<string>} The message's signature.
26
26
  */
27
27
  sign(message: string): Promise<string>;
28
+ /**
29
+ * Signs a transaction.
30
+ *
31
+ * @param {Transaction} tx - The transaction to sign.
32
+ * @returns {Promise<unknown>} The signed transaction.
33
+ */
34
+ signTransaction(tx: Transaction): Promise<unknown>;
28
35
  /**
29
36
  * Verifies a message's signature.
30
37
  *
@@ -3,9 +3,10 @@ export default abstract class WalletManager {
3
3
  /**
4
4
  * Returns a random [BIP-39](https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki) seed phrase.
5
5
  *
6
+ * @param {12 | 24} [wordCount=12] - The number of words in the seed phrase.
6
7
  * @returns {string} The seed phrase.
7
8
  */
8
- static getRandomSeedPhrase(): string;
9
+ static getRandomSeedPhrase(wordCount?: 12 | 24): string;
9
10
  /**
10
11
  * Checks if a seed phrase is valid.
11
12
  *
@@ -14,52 +15,130 @@ export default abstract class WalletManager {
14
15
  */
15
16
  static isValidSeedPhrase(seedPhrase: string): boolean;
16
17
  /**
17
- * Creates a new wallet manager.
18
+ * Creates a new wallet manager from a BIP-39 seed.
18
19
  *
19
- * @param {string | Uint8Array} seed - The wallet's [BIP-39](https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki) seed phrase.
20
+ * @param {string | Uint8Array} seed - The BIP-39 seed phrase or raw seed bytes.
20
21
  * @param {WalletConfig} [config] - The wallet configuration.
21
22
  */
22
23
  constructor(seed: string | Uint8Array, config?: WalletConfig);
24
+ /**
25
+ * Creates a new wallet manager from a default signer.
26
+ *
27
+ * @param {ISigner} signer - The default signer.
28
+ * @param {WalletConfig} [config] - The wallet configuration.
29
+ */
30
+ constructor(signer: ISigner, config?: WalletConfig);
23
31
  /** @private */
24
- private _seed;
32
+ private _seed: Uint8Array | undefined;
25
33
  /**
26
- * The wallet configuration.
34
+ * The default signer provided at construction. Accessed via {@link getSigner}
35
+ * with no arguments.
27
36
  *
28
37
  * @protected
29
- * @type {WalletConfig}
38
+ * @type {ISigner | undefined}
30
39
  */
31
- protected _config: WalletConfig;
40
+ protected _defaultSigner: ISigner | undefined;
41
+ /**
42
+ * A map between signer names and signers added via {@link addSigner}.
43
+ *
44
+ * @protected
45
+ * @type {Record<string, ISigner>}
46
+ */
47
+ protected _signers: Record<string, ISigner>;
32
48
  /**
33
49
  * A map between derivation paths and wallet accounts. The {@link dispose} method will automatically dispose
34
50
  * all the accounts in this map, so developers are encouraged to map all accounts accessed through the
35
51
  * {@link getAccount} and {@link getAccountByPath} methods.
36
52
  *
37
53
  * @protected
38
- * @type {{ [path: string]: IWalletAccount }}
54
+ * @type {Record<string, IWalletAccount>}
55
+ */
56
+ protected _accounts: Record<string, IWalletAccount>;
57
+ /**
58
+ * The wallet configuration.
59
+ *
60
+ * @protected
61
+ * @type {WalletConfig}
39
62
  */
40
- protected _accounts: { [path: string]: IWalletAccount };
63
+ protected _config: WalletConfig;
41
64
  /**
42
- * The seed phrase of the wallet.
65
+ * The seed of the wallet.
43
66
  *
44
- * @type {Uint8Array}
67
+ * @type {Uint8Array | undefined}
45
68
  */
46
- get seed(): Uint8Array;
69
+ get seed(): Uint8Array | undefined;
70
+ /**
71
+ * Registers a signer under the given name.
72
+ *
73
+ * @param {string} signerName - The signer name.
74
+ * @param {ISigner} signer - The signer.
75
+ * @returns {WalletManager} The wallet manager.
76
+ * @throws {Error} If `signerName` is an empty or blank string.
77
+ */
78
+ addSigner(signerName: string, signer: ISigner): WalletManager;
79
+ /**
80
+ * Returns a signer. With no arguments, returns the default signer provided
81
+ * at construction. With a name, returns the signer registered under that
82
+ * name via {@link addSigner}.
83
+ *
84
+ * @param {string} [signerName] - The signer name. Omit to get the default.
85
+ * @returns {ISigner} The signer.
86
+ * @throws {Error} If called with no arguments and no default signer was
87
+ * provided at construction, or if called with a name that is not registered.
88
+ */
89
+ getSigner(signerName?: string): ISigner;
90
+ /**
91
+ * Returns a shallow copy of the map of signers registered via {@link addSigner}.
92
+ * The default signer is not included; use {@link getSigner} with no arguments
93
+ * to retrieve it.
94
+ *
95
+ * @returns {Record<string, ISigner>} A map of signer names to signers. Empty if no signers have been registered.
96
+ */
97
+ getSigners(): Record<string, ISigner>;
47
98
  /**
48
99
  * Returns the wallet account at a specific index (see [BIP-44](https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki)).
49
100
  *
50
- * @abstract
51
101
  * @param {number} [index] - The index of the account to get (default: 0).
102
+ * @param {Object} [options] - Account options.
103
+ * @param {string} [options.signerName] - The signer name. Omit to use the default signer.
104
+ * @returns {Promise<IWalletAccount>} The account.
105
+ * @throws {Error} If a signer name is given but no signer exists with that name.
106
+ * @throws {SignerError} If the signer doesn't support account derivation.
107
+ */
108
+ abstract getAccount(
109
+ index?: number,
110
+ options?: {
111
+ signerName?: string;
112
+ },
113
+ ): Promise<IWalletAccount>;
114
+ /**
115
+ * Returns the wallet account associated with a registered signer. For
116
+ * non-derivable signers (e.g., private-key signers), returns the signer's
117
+ * single account. For derivable signers, returns the wallet account at the
118
+ * signer's root, with no further derivation.
119
+ *
120
+ * @param {string} signerName - The signer name registered via {@link addSigner}.
52
121
  * @returns {Promise<IWalletAccount>} The account.
122
+ * @throws {Error} If no signer exists with the given name.
53
123
  */
54
- abstract getAccount(index?: number): Promise<IWalletAccount>;
124
+ abstract getAccount(signerName: string): Promise<IWalletAccount>;
55
125
  /**
56
126
  * Returns the wallet account at a specific [BIP-44](https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki) derivation path.
57
127
  *
58
128
  * @abstract
59
129
  * @param {string} path - The derivation path (e.g. "0'/0/0").
130
+ * @param {Object} [options] - Account options.
131
+ * @param {string} [options.signerName] - The signer name. Omit to use the default signer.
60
132
  * @returns {Promise<IWalletAccount>} The account.
133
+ * @throws {Error} If a signer name is given but no signer exists with that name.
134
+ * @throws {SignerError} If the signer doesn't support account derivation.
61
135
  */
62
- abstract getAccountByPath(path: string): Promise<IWalletAccount>;
136
+ abstract getAccountByPath(
137
+ path: string,
138
+ options?: {
139
+ signerName?: string;
140
+ },
141
+ ): Promise<IWalletAccount>;
63
142
  /**
64
143
  * Returns the current fee rates.
65
144
  *
@@ -68,16 +147,22 @@ export default abstract class WalletManager {
68
147
  */
69
148
  abstract getFeeRates(): Promise<FeeRates>;
70
149
  /**
71
- * Disposes all the wallet accounts, erasing their private keys from the memory.
150
+ * Disposes all wallet accounts and signers, clearing secret material from memory.
72
151
  */
73
152
  dispose(): void;
74
153
  }
75
154
  export type IWalletAccount = import("./wallet-account.js").IWalletAccount;
155
+ export type ISigner = import("./signer.js").ISigner;
156
+ export type SignerError = import("./errors.js").SignerError;
76
157
  export type WalletConfig = {
77
158
  /**
78
159
  * - The maximum fee amount for transfer operations.
79
160
  */
80
161
  transferMaxFee?: number | bigint;
162
+ /**
163
+ * - The maximum fee amount for sendTransaction and signTransaction operations.
164
+ */
165
+ transactionMaxFee?: number | bigint;
81
166
  };
82
167
  export type FeeRates = {
83
168
  /**