@tetherto/wdk-wallet 1.0.0-beta.22 → 1.0.0-beta.24

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tetherto/wdk-wallet",
3
- "version": "1.0.0-beta.22",
3
+ "version": "1.0.0-beta.24",
4
4
  "description": "Base wallet and protocol classes for WDK (Wallet Development Kit) by Tether. For internal use only.",
5
5
  "homepage": "https://docs.wdk.tether.io/",
6
6
  "keywords": [
@@ -21,6 +21,7 @@ import { NotImplementedError } from './errors.js'
21
21
  /** @typedef {import('../wallet-account-read-only.js').TransactionResult} TransactionResult */
22
22
 
23
23
  /** @typedef {import('../wallet-account.js').KeyPair} KeyPair */
24
+ /** @typedef {import('../disposable.js').IDisposable} IDisposable */
24
25
 
25
26
  /** @typedef {import('./wallet-account-read-only-multisig.js').MultisigProposal} MultisigProposal */
26
27
 
@@ -43,30 +44,26 @@ import { NotImplementedError } from './errors.js'
43
44
  * @property {TransactionResult} [transaction] - The on-chain transaction produced by this call, when the call itself settles on-chain — the execution transaction when a call triggers execution, or, on backends where every proposal/approval is its own on-chain transaction, that call's transaction. Undefined when the call only updates off-chain state. Its presence does not imply the proposal executed; execution is determined solely by `status`.
44
45
  */
45
46
 
46
- /** @interface */
47
+ /**
48
+ * @interface
49
+ * @extends {IDisposable}
50
+ */
47
51
  export class IWalletAccountMultisig extends IWalletAccountReadOnlyMultisig {
48
52
  /**
49
- * The derivation path's index of this account.
50
- *
51
- * @type {number}
52
- */
53
- get index () {
54
- throw new NotImplementedError('index')
55
- }
56
-
57
- /**
58
- * The derivation path of this account (see [BIP-44](https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki)).
53
+ * The derivation path of this account (see [BIP-44](https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki)),
54
+ * or null if the account's signer is not bound to a BIP-44 position (e.g. private-key signers).
59
55
  *
60
- * @type {string}
56
+ * @type {string | null}
61
57
  */
62
58
  get path () {
63
59
  throw new NotImplementedError('path')
64
60
  }
65
61
 
66
62
  /**
67
- * The key pair of this account.
63
+ * The account's key pair, or null if the account's signer does not allow
64
+ * retrieving key material (e.g. hardware signers).
68
65
  *
69
- * @type {KeyPair}
66
+ * @type {KeyPair | null}
70
67
  */
71
68
  get keyPair () {
72
69
  throw new NotImplementedError('keyPair')
@@ -15,14 +15,13 @@
15
15
 
16
16
  import * as bip39 from 'bip39'
17
17
 
18
- import { InvalidSignerError, NoSuchElementError, NotImplementedError, ValueError } from './errors.js'
18
+ import { DisposalError, InvalidSignerError, NoSuchElementError, NotImplementedError, ValueError } from './errors.js'
19
19
 
20
20
  /** @typedef {import('./wallet-account.js').IWalletAccount} IWalletAccount */
21
21
 
22
22
  /** @typedef {import('./signer.js').ISigner} ISigner */
23
23
  /** @typedef {import('./disposable.js').IDisposable} IDisposable */
24
24
 
25
- /** @typedef {import('./errors.js').DisposalError} DisposalError */
26
25
  /** @typedef {import('./errors.js').ProviderError} ProviderError */
27
26
  /** @typedef {import('./errors.js').ProviderRequiredError} ProviderRequiredError */
28
27
 
@@ -167,6 +166,10 @@ export default class WalletManager {
167
166
  * @throws {DisposalError} If the wallet manager has been disposed.
168
167
  */
169
168
  addSigner (signerName, signer) {
169
+ if (this.disposed) {
170
+ throw new DisposalError('The wallet manager has been disposed.')
171
+ }
172
+
170
173
  if (!signerName.trim()) {
171
174
  throw new ValueError('The signer name cannot be an empty or blank string.')
172
175
  }
@@ -1,23 +1,22 @@
1
- /** @interface */
2
- export interface IWalletAccountMultisig extends IWalletAccountReadOnlyMultisig {
1
+ /**
2
+ * @interface
3
+ * @extends {IDisposable}
4
+ */
5
+ export interface IWalletAccountMultisig extends IWalletAccountReadOnlyMultisig, IDisposable {
3
6
  /**
4
- * The derivation path's index of this account.
7
+ * The derivation path of this account (see [BIP-44](https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki)),
8
+ * or null if the account's signer is not bound to a BIP-44 position (e.g. private-key signers).
5
9
  *
6
- * @type {number}
10
+ * @type {string | null}
7
11
  */
8
- get index(): number;
12
+ get path(): string | null;
9
13
  /**
10
- * The derivation path of this account (see [BIP-44](https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki)).
14
+ * The account's key pair, or null if the account's signer does not allow
15
+ * retrieving key material (e.g. hardware signers).
11
16
  *
12
- * @type {string}
17
+ * @type {KeyPair | null}
13
18
  */
14
- get path(): string;
15
- /**
16
- * The key pair of this account.
17
- *
18
- * @type {KeyPair}
19
- */
20
- get keyPair(): KeyPair;
19
+ get keyPair(): KeyPair | null;
21
20
  /**
22
21
  * Returns the signer's address.
23
22
  *
@@ -77,6 +76,7 @@ export interface IWalletAccountMultisig extends IWalletAccountReadOnlyMultisig {
77
76
  export type Transaction = import("../wallet-account-read-only.js").Transaction;
78
77
  export type TransactionResult = import("../wallet-account-read-only.js").TransactionResult;
79
78
  export type KeyPair = import("../wallet-account.js").KeyPair;
79
+ export type IDisposable = import("../disposable.js").IDisposable;
80
80
  export type MultisigProposal = import("./wallet-account-read-only-multisig.js").MultisigProposal;
81
81
  export type AccountNotOwnerError = import("./errors.js").AccountNotOwnerError;
82
82
  export type MaximumFeeExceededError = import("./errors.js").MaximumFeeExceededError;