@tetherto/wdk-wallet 1.0.0-beta.10 → 1.0.0-beta.12

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/index.js CHANGED
@@ -25,8 +25,13 @@
25
25
 
26
26
  export { default } from './src/wallet-manager.js'
27
27
 
28
- export { default as WalletAccountReadOnly, IWalletAccountReadOnly } from './src/wallet-account-read-only.js'
28
+ export {
29
+ default as WalletAccountReadOnly,
30
+ IWalletAccountReadOnly
31
+ } from './src/wallet-account-read-only.js'
29
32
 
30
33
  export { IWalletAccount } from './src/wallet-account.js'
31
34
 
32
- export { NotImplementedError } from './src/errors.js'
35
+ export { NotImplementedError, SignerError } from './src/errors.js'
36
+
37
+ export { ISigner } from './src/signer.js'
package/package.json CHANGED
@@ -1,8 +1,12 @@
1
1
  {
2
2
  "name": "@tetherto/wdk-wallet",
3
- "version": "1.0.0-beta.10",
3
+ "version": "1.0.0-beta.12",
4
4
  "description": "A simple package to manage BIP-32 wallets.",
5
- "keywords": ["wdk", "wallet", "bip-32"],
5
+ "keywords": [
6
+ "wdk",
7
+ "wallet",
8
+ "bip-32"
9
+ ],
6
10
  "author": "Tether",
7
11
  "license": "Apache-2.0",
8
12
  "repository": {
package/src/errors.js CHANGED
@@ -25,3 +25,16 @@ export class NotImplementedError extends Error {
25
25
  this.name = 'NotImplementedError'
26
26
  }
27
27
  }
28
+
29
+ export class SignerError extends Error {
30
+ /**
31
+ * Create a new signer error.
32
+ *
33
+ * @param {string} message - The error's message.
34
+ */
35
+ constructor (message) {
36
+ super(message)
37
+
38
+ this.name = 'SignerError'
39
+ }
40
+ }
package/src/signer.js ADDED
@@ -0,0 +1,50 @@
1
+ // Copyright 2024 Tether Operations Limited
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+ 'use strict'
15
+
16
+ import { NotImplementedError } from './errors.js'
17
+
18
+ /**
19
+ * A minimal, cross-chain signer interface.
20
+ *
21
+ * @interface
22
+ */
23
+ export class ISigner {
24
+ /**
25
+ * Derive a child signer using a relative path (e.g., "0'/0/0").
26
+ *
27
+ * @param {string} relPath - The relative derivation path.
28
+ * @returns {Promise<ISigner>} The derived signer.
29
+ * @throws {SignerError} If the signer does not support derivation.
30
+ */
31
+ async derive (relPath) {
32
+ throw new NotImplementedError('derive(relPath)')
33
+ }
34
+
35
+ /**
36
+ * Returns the signer's address.
37
+ *
38
+ * @returns {Promise<string>} The address.
39
+ */
40
+ async getAddress () {
41
+ throw new NotImplementedError('getAddress()')
42
+ }
43
+
44
+ /**
45
+ * Disposes the signer and clears any secret material from memory.
46
+ */
47
+ dispose () {
48
+ throw new NotImplementedError('dispose()')
49
+ }
50
+ }
@@ -29,7 +29,10 @@ import { NotImplementedError } from './errors.js'
29
29
  * @property {Uint8Array | null} privateKey - The private key (null if the account has been disposed).
30
30
  */
31
31
 
32
- /** @interface */
32
+ /**
33
+ * @interface
34
+ * @template TSignedTransaction
35
+ */
33
36
  export class IWalletAccount extends IWalletAccountReadOnly {
34
37
  /**
35
38
  * The derivation path's index of this account.
@@ -72,7 +75,7 @@ export class IWalletAccount extends IWalletAccountReadOnly {
72
75
  * Signs a transaction
73
76
  *
74
77
  * @param {Transaction} tx - The transaction to sign.
75
- * @returns {Promise<unknown>} The signed transaction.
78
+ * @returns {Promise<TSignedTransaction>} The signed transaction.
76
79
  */
77
80
  async signTransaction (tx) {
78
81
  throw new NotImplementedError('signTransaction(tx)')
@@ -92,13 +95,23 @@ export class IWalletAccount extends IWalletAccountReadOnly {
92
95
  /**
93
96
  * Sends a transaction.
94
97
  *
95
- * @param {Transaction} tx - The transaction.
98
+ * @param {Transaction | TSignedTransaction} tx - The transaction.
96
99
  * @returns {Promise<TransactionResult>} The transaction's result.
97
100
  */
98
101
  async sendTransaction (tx) {
99
102
  throw new NotImplementedError('sendTransaction(tx)')
100
103
  }
101
104
 
105
+ /**
106
+ * Quotes the costs of a send transaction operation.
107
+ *
108
+ * @param {Transaction | TSignedTransaction} tx - The transaction.
109
+ * @returns {Promise<Omit<TransactionResult, 'hash'>>} The transaction's quotes.
110
+ */
111
+ async quoteSendTransaction (tx) {
112
+ throw new NotImplementedError('quoteSendTransaction(tx)')
113
+ }
114
+
102
115
  /**
103
116
  * Transfers a token to another address.
104
117
  *
@@ -18,6 +18,7 @@ import * as bip39 from 'bip39'
18
18
  import { NotImplementedError } from './errors.js'
19
19
 
20
20
  /** @typedef {import('./wallet-account.js').IWalletAccount} IWalletAccount */
21
+ /** @typedef {import('./signer.js').ISigner} ISigner */
21
22
 
22
23
  /**
23
24
  * @typedef {Object} WalletConfig
@@ -34,30 +35,49 @@ import { NotImplementedError } from './errors.js'
34
35
  /** @abstract */
35
36
  export default class WalletManager {
36
37
  /**
37
- * Creates a new wallet manager.
38
+ * Creates a new wallet manager from a BIP-39 seed.
38
39
  *
39
- * @param {string | Uint8Array} seed - The wallet's [BIP-39](https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki) seed phrase.
40
+ * @overload
41
+ * @param {string | Uint8Array} seed - The BIP-39 seed phrase or raw seed bytes.
40
42
  * @param {WalletConfig} [config] - The wallet configuration.
41
43
  */
42
- constructor (seed, config = { }) {
43
- if (typeof seed === 'string') {
44
- if (!WalletManager.isValidSeedPhrase(seed)) {
44
+
45
+ /**
46
+ * Creates a new wallet manager from a default signer.
47
+ *
48
+ * @overload
49
+ * @param {ISigner} signer - The default signer.
50
+ * @param {WalletConfig} [config] - The wallet configuration.
51
+ */
52
+ constructor (seedOrSigner, config = {}) {
53
+ if (typeof seedOrSigner === 'string') {
54
+ if (!WalletManager.isValidSeedPhrase(seedOrSigner)) {
45
55
  throw new Error('The seed phrase is invalid.')
46
56
  }
47
57
 
48
- seed = bip39.mnemonicToSeedSync(seed)
58
+ seedOrSigner = bip39.mnemonicToSeedSync(seedOrSigner)
49
59
  }
50
60
 
61
+ const isSeed = seedOrSigner instanceof Uint8Array
62
+
51
63
  /** @private */
52
- this._seed = seed
64
+ this._seed = isSeed ? seedOrSigner : undefined
53
65
 
54
66
  /**
55
- * The wallet configuration.
67
+ * The default signer.
56
68
  *
57
69
  * @protected
58
- * @type {WalletConfig}
70
+ * @type {ISigner | undefined}
59
71
  */
60
- this._config = config
72
+ this._defaultSigner = isSeed ? undefined : seedOrSigner
73
+
74
+ /**
75
+ * A map between signer names and signers added via {@link addSigner}.
76
+ *
77
+ * @protected
78
+ * @type {Record<string, ISigner>}
79
+ */
80
+ this._signers = {}
61
81
 
62
82
  /**
63
83
  * A map between derivation paths and wallet accounts. The {@link dispose} method will automatically dispose
@@ -65,9 +85,17 @@ export default class WalletManager {
65
85
  * {@link getAccount} and {@link getAccountByPath} methods.
66
86
  *
67
87
  * @protected
68
- * @type {{ [path: string]: IWalletAccount }}
88
+ * @type {Record<string, IWalletAccount>}
69
89
  */
70
90
  this._accounts = {}
91
+
92
+ /**
93
+ * The wallet configuration.
94
+ *
95
+ * @protected
96
+ * @type {WalletConfig}
97
+ */
98
+ this._config = config
71
99
  }
72
100
 
73
101
  /**
@@ -92,23 +120,93 @@ export default class WalletManager {
92
120
  }
93
121
 
94
122
  /**
95
- * The seed phrase of the wallet.
123
+ * The seed of the wallet.
96
124
  *
97
- * @type {Uint8Array}
125
+ * @type {Uint8Array | undefined}
98
126
  */
99
127
  get seed () {
100
128
  return this._seed
101
129
  }
102
130
 
131
+ /**
132
+ * Registers a signer under the given name.
133
+ *
134
+ * @param {string} signerName - The signer name.
135
+ * @param {ISigner} signer - The signer.
136
+ * @returns {WalletManager} The wallet manager.
137
+ * @throws {Error} If `signerName` is an empty or blank string.
138
+ */
139
+ addSigner (signerName, signer) {
140
+ if (!signerName.trim()) {
141
+ throw new Error('The signer name cannot be an empty or blank string.')
142
+ }
143
+
144
+ this._signers[signerName] = signer
145
+ return this
146
+ }
147
+
148
+ /**
149
+ * Returns a signer. With no arguments, returns the default signer provided
150
+ * at construction. With a name, returns the signer registered under that
151
+ * name via {@link addSigner}.
152
+ *
153
+ * @param {string} [signerName] - The signer name. Omit to get the default.
154
+ * @returns {ISigner} The signer.
155
+ * @throws {Error} If called with no arguments and no default signer was
156
+ * provided at construction, or if called with a name that is not registered.
157
+ */
158
+ getSigner (signerName) {
159
+ if (signerName === undefined) {
160
+ if (this._defaultSigner === undefined) {
161
+ throw new Error('No default signer registered.')
162
+ }
163
+ return this._defaultSigner
164
+ }
165
+ const signer = this._signers[signerName]
166
+ if (signer === undefined) {
167
+ throw new Error(`No signer registered with name "${signerName}".`)
168
+ }
169
+ return signer
170
+ }
171
+
172
+ /**
173
+ * Returns a shallow copy of the map of signers registered via {@link addSigner}.
174
+ * The default signer is not included; use {@link getSigner} with no arguments
175
+ * to retrieve it.
176
+ *
177
+ * @returns {Record<string, ISigner>} A map of signer names to signers. Empty if no signers have been registered.
178
+ */
179
+ getSigners () {
180
+ return { ...this._signers }
181
+ }
182
+
103
183
  /**
104
184
  * Returns the wallet account at a specific index (see [BIP-44](https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki)).
105
185
  *
106
- * @abstract
186
+ * @overload
107
187
  * @param {number} [index] - The index of the account to get (default: 0).
188
+ * @param {Object} [options] - Account options.
189
+ * @param {string} [options.signerName] - The signer name. Omit to use the default signer.
108
190
  * @returns {Promise<IWalletAccount>} The account.
191
+ * @throws {Error} If a signer name is given but no signer exists with that name.
192
+ * @throws {SignerError} If the signer doesn't support account derivation.
109
193
  */
110
- async getAccount (index = 0) {
111
- throw new NotImplementedError('getAccount(index)')
194
+
195
+ /**
196
+ * Returns the wallet account associated with a registered signer. For
197
+ * non-derivable signers (e.g., private-key signers), returns the signer's
198
+ * single account. For derivable signers, returns the wallet account at the
199
+ * signer's root, with no further derivation.
200
+ *
201
+ * @overload
202
+ * @param {string} signerName - The signer name registered via {@link addSigner}.
203
+ * @returns {Promise<IWalletAccount>} The account.
204
+ * @throws {Error} If no signer exists with the given name.
205
+ */
206
+
207
+ /** @abstract */
208
+ async getAccount (indexOrSignerName = 0, options = {}) {
209
+ throw new NotImplementedError('getAccount(indexOrSignerName, options?)')
112
210
  }
113
211
 
114
212
  /**
@@ -116,10 +214,14 @@ export default class WalletManager {
116
214
  *
117
215
  * @abstract
118
216
  * @param {string} path - The derivation path (e.g. "0'/0/0").
217
+ * @param {Object} [options] - Account options.
218
+ * @param {string} [options.signerName] - The signer name. Omit to use the default signer.
119
219
  * @returns {Promise<IWalletAccount>} The account.
220
+ * @throws {Error} If a signer name is given but no signer exists with that name.
221
+ * @throws {SignerError} If the signer doesn't support account derivation.
120
222
  */
121
- async getAccountByPath (path) {
122
- throw new NotImplementedError('getAccountByPath(path)')
223
+ async getAccountByPath (path, options = {}) {
224
+ throw new NotImplementedError('getAccountByPath(path, options?)')
123
225
  }
124
226
 
125
227
  /**
@@ -133,15 +235,23 @@ export default class WalletManager {
133
235
  }
134
236
 
135
237
  /**
136
- * Disposes all the wallet accounts, erasing their private keys from the memory.
238
+ * Disposes all wallet accounts and signers, clearing secret material from memory.
137
239
  */
138
240
  dispose () {
139
241
  for (const account of Object.values(this._accounts)) {
140
- if (account.keyPair.privateKey) {
242
+ if (account.keyPair?.privateKey) {
141
243
  account.dispose()
142
244
  }
143
245
  }
144
246
 
247
+ this._defaultSigner?.dispose()
248
+
249
+ for (const signer of Object.values(this._signers)) {
250
+ signer.dispose()
251
+ }
252
+
145
253
  this._accounts = {}
254
+ this._defaultSigner = undefined
255
+ this._signers = {}
146
256
  }
147
257
  }
package/types/index.d.ts CHANGED
@@ -8,4 +8,5 @@ export type KeyPair = import("./src/wallet-account.js").KeyPair;
8
8
  export { default } from "./src/wallet-manager.js";
9
9
  export { default as WalletAccountReadOnly, IWalletAccountReadOnly } from "./src/wallet-account-read-only.js";
10
10
  export { IWalletAccount } from "./src/wallet-account.js";
11
- export { NotImplementedError } from "./src/errors.js";
11
+ export { NotImplementedError, SignerError } from "./src/errors.js";
12
+ export { ISigner } from "./src/signer.js";
@@ -6,3 +6,11 @@ export class NotImplementedError extends Error {
6
6
  */
7
7
  constructor(methodName: string);
8
8
  }
9
+ export class SignerError extends Error {
10
+ /**
11
+ * Create a new signer error.
12
+ *
13
+ * @param {string} message - The error's message.
14
+ */
15
+ constructor(message: string);
16
+ }
@@ -0,0 +1,26 @@
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
+ * Returns the signer's address.
17
+ *
18
+ * @returns {Promise<string>} The address.
19
+ */
20
+ getAddress(): Promise<string>;
21
+ /**
22
+ * Disposes the signer and clears any secret material from memory.
23
+ */
24
+ dispose(): void;
25
+ }
26
+ export type SignerError = import("./errors.js").SignerError;
@@ -1,5 +1,5 @@
1
1
  /** @interface */
2
- export interface IWalletAccount extends IWalletAccountReadOnly {
2
+ export interface IWalletAccount<TSignedTransaction> extends IWalletAccountReadOnly {
3
3
  /**
4
4
  * The derivation path's index of this account.
5
5
  *
@@ -29,9 +29,9 @@ export interface IWalletAccount extends IWalletAccountReadOnly {
29
29
  * Signs a transaction.
30
30
  *
31
31
  * @param {Transaction} tx - The transaction to sign.
32
- * @returns {Promise<unknown>} The signed transaction.
32
+ * @returns {Promise<TSignedTransaction>} The signed transaction.
33
33
  */
34
- signTransaction(tx: Transaction): Promise<unknown>;
34
+ signTransaction(tx: Transaction): Promise<TSignedTransaction>;
35
35
  /**
36
36
  * Verifies a message's signature.
37
37
  *
@@ -43,10 +43,19 @@ export interface IWalletAccount extends IWalletAccountReadOnly {
43
43
  /**
44
44
  * Sends a transaction.
45
45
  *
46
- * @param {Transaction} tx - The transaction.
46
+ * @overload
47
+ * @param {Transaction | TSignedTransaction} tx - The transaction.
47
48
  * @returns {Promise<TransactionResult>} The transaction's result.
48
49
  */
49
- sendTransaction(tx: Transaction): Promise<TransactionResult>;
50
+ sendTransaction(tx: Transaction | TSignedTransaction): Promise<TransactionResult>;
51
+ /**
52
+ * Quotes the costs of a send transaction operation.
53
+ *
54
+ * @overload
55
+ * @param {Transaction | TSignedTransaction} tx - The transaction.
56
+ * @returns {Promise<Omit<TransactionResult, 'hash'>>} The transaction's quotes.
57
+ */
58
+ quoteSendTransaction(tx: Transaction | TSignedTransaction): Promise<Omit<TransactionResult, "hash">>;
50
59
  /**
51
60
  * Transfers a token to another address.
52
61
  *
@@ -15,52 +15,130 @@ export default abstract class WalletManager {
15
15
  */
16
16
  static isValidSeedPhrase(seedPhrase: string): boolean;
17
17
  /**
18
- * Creates a new wallet manager.
18
+ * Creates a new wallet manager from a BIP-39 seed.
19
19
  *
20
- * @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.
21
21
  * @param {WalletConfig} [config] - The wallet configuration.
22
22
  */
23
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);
24
31
  /** @private */
25
- private _seed;
32
+ private _seed: Uint8Array | undefined;
26
33
  /**
27
- * The wallet configuration.
34
+ * The default signer provided at construction. Accessed via {@link getSigner}
35
+ * with no arguments.
28
36
  *
29
37
  * @protected
30
- * @type {WalletConfig}
38
+ * @type {ISigner | undefined}
31
39
  */
32
- 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>;
33
48
  /**
34
49
  * A map between derivation paths and wallet accounts. The {@link dispose} method will automatically dispose
35
50
  * all the accounts in this map, so developers are encouraged to map all accounts accessed through the
36
51
  * {@link getAccount} and {@link getAccountByPath} methods.
37
52
  *
38
53
  * @protected
39
- * @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}
62
+ */
63
+ protected _config: WalletConfig;
64
+ /**
65
+ * The seed of the wallet.
66
+ *
67
+ * @type {Uint8Array | undefined}
68
+ */
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.
40
77
  */
41
- protected _accounts: { [path: string]: IWalletAccount };
78
+ addSigner(signerName: string, signer: ISigner): WalletManager;
42
79
  /**
43
- * The seed phrase of the wallet.
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}.
44
83
  *
45
- * @type {Uint8Array}
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.
46
88
  */
47
- get seed(): Uint8Array;
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>;
48
98
  /**
49
99
  * Returns the wallet account at a specific index (see [BIP-44](https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki)).
50
100
  *
51
- * @abstract
52
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}.
53
121
  * @returns {Promise<IWalletAccount>} The account.
122
+ * @throws {Error} If no signer exists with the given name.
54
123
  */
55
- abstract getAccount(index?: number): Promise<IWalletAccount>;
124
+ abstract getAccount(signerName: string): Promise<IWalletAccount>;
56
125
  /**
57
126
  * Returns the wallet account at a specific [BIP-44](https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki) derivation path.
58
127
  *
59
128
  * @abstract
60
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.
61
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.
62
135
  */
63
- abstract getAccountByPath(path: string): Promise<IWalletAccount>;
136
+ abstract getAccountByPath(
137
+ path: string,
138
+ options?: {
139
+ signerName?: string;
140
+ },
141
+ ): Promise<IWalletAccount>;
64
142
  /**
65
143
  * Returns the current fee rates.
66
144
  *
@@ -69,11 +147,13 @@ export default abstract class WalletManager {
69
147
  */
70
148
  abstract getFeeRates(): Promise<FeeRates>;
71
149
  /**
72
- * Disposes all the wallet accounts, erasing their private keys from the memory.
150
+ * Disposes all wallet accounts and signers, clearing secret material from memory.
73
151
  */
74
152
  dispose(): void;
75
153
  }
76
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;
77
157
  export type WalletConfig = {
78
158
  /**
79
159
  * - The maximum fee amount for transfer operations.