@tetherto/wdk-wallet 1.0.0-beta.2 → 1.0.0-beta.21

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 (50) hide show
  1. package/AGENTS.md +49 -0
  2. package/README.md +2 -2
  3. package/bare.js +3 -3
  4. package/index.js +14 -2
  5. package/package.json +18 -4
  6. package/src/disposable.js +26 -0
  7. package/src/errors.js +318 -3
  8. package/src/multisig/errors.js +54 -0
  9. package/src/multisig/index.js +42 -0
  10. package/src/multisig/multisig-message-signing-read-only.js +63 -0
  11. package/src/multisig/multisig-message-signing.js +64 -0
  12. package/src/multisig/multisig-owner-management.js +94 -0
  13. package/src/multisig/wallet-account-multisig.js +144 -0
  14. package/src/multisig/wallet-account-read-only-multisig.js +98 -0
  15. package/src/protocols/bridge-protocol.js +35 -1
  16. package/src/protocols/errors.js +510 -0
  17. package/src/protocols/fiat-protocol.js +401 -0
  18. package/src/protocols/index.js +76 -0
  19. package/src/protocols/lending-protocol.js +114 -2
  20. package/src/protocols/sda-protocol.js +643 -0
  21. package/src/protocols/swap-protocol.js +36 -1
  22. package/src/protocols/swidge-protocol.js +516 -0
  23. package/src/signer.js +89 -0
  24. package/src/wallet-account-read-only-simple.js +162 -0
  25. package/src/wallet-account-read-only.js +186 -40
  26. package/src/wallet-account.js +59 -22
  27. package/src/wallet-manager.js +152 -25
  28. package/types/index.d.ts +13 -4
  29. package/types/src/disposable.d.ts +7 -0
  30. package/types/src/errors.d.ts +220 -2
  31. package/types/src/multisig/errors.d.ts +33 -0
  32. package/types/src/multisig/index.d.ts +15 -0
  33. package/types/src/multisig/multisig-message-signing-read-only.d.ts +53 -0
  34. package/types/src/multisig/multisig-message-signing.d.ts +40 -0
  35. package/types/src/multisig/multisig-owner-management.d.ts +65 -0
  36. package/types/src/multisig/wallet-account-multisig.d.ts +101 -0
  37. package/types/src/multisig/wallet-account-read-only-multisig.d.ts +83 -0
  38. package/types/src/protocols/bridge-protocol.d.ts +39 -3
  39. package/types/src/protocols/errors.d.ts +366 -0
  40. package/types/src/protocols/fiat-protocol.d.ts +409 -0
  41. package/types/src/protocols/index.d.ts +64 -0
  42. package/types/src/protocols/lending-protocol.d.ts +118 -4
  43. package/types/src/protocols/sda-protocol.d.ts +737 -0
  44. package/types/src/protocols/swap-protocol.d.ts +44 -4
  45. package/types/src/protocols/swidge-protocol.d.ts +483 -0
  46. package/types/src/signer.d.ts +53 -0
  47. package/types/src/wallet-account-read-only-simple.d.ts +144 -0
  48. package/types/src/wallet-account-read-only.d.ts +104 -27
  49. package/types/src/wallet-account.d.ts +55 -20
  50. package/types/src/wallet-manager.d.ts +109 -17
@@ -0,0 +1,64 @@
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 { IMultisigMessageSigningReadOnly } from './multisig-message-signing-read-only.js'
17
+
18
+ import { NotImplementedError } from './errors.js'
19
+
20
+ /** @typedef {import('./multisig-message-signing-read-only.js').MultisigMessageProposal} MultisigMessageProposal */
21
+
22
+ /** @typedef {import('./errors.js').AccountNotOwnerError} AccountNotOwnerError */
23
+ /** @typedef {import('./errors.js').NoSuchElementError} NoSuchElementError */
24
+ /** @typedef {import('./errors.js').ProviderError} ProviderError */
25
+ /** @typedef {import('./errors.js').ProviderRequiredError} ProviderRequiredError */
26
+ /** @typedef {import('./errors.js').ValueError} ValueError */
27
+
28
+ /**
29
+ * @typedef {Object} MultisigSignature
30
+ * @property {string} signature - The caller's signature.
31
+ */
32
+
33
+ /**
34
+ * Adds message-signing features to a multisig wallet.
35
+ *
36
+ * @interface
37
+ */
38
+ export class IMultisigMessageSigning extends IMultisigMessageSigningReadOnly {
39
+ /**
40
+ * Proposes signing a message.
41
+ *
42
+ * @param {string} message - The message to sign.
43
+ * @returns {Promise<MultisigMessageProposal & MultisigSignature>} The multisig message proposal.
44
+ * @throws {ProviderRequiredError} If the method requires a provider.
45
+ * @throws {ProviderError} If the provider fails to propose the message.
46
+ * @throws {AccountNotOwnerError} If the account is not an owner of the multisig wallet.
47
+ */
48
+ async proposeMessage (message) {
49
+ throw new NotImplementedError('proposeMessage(message)')
50
+ }
51
+
52
+ /**
53
+ * Approves an existing message proposal.
54
+ *
55
+ * @param {string} messageId - The message's hash.
56
+ * @returns {Promise<MultisigMessageProposal & MultisigSignature>} The multisig message proposal.
57
+ * @throws {ValueError} If the message's identifier is not a valid id.
58
+ * @throws {NoSuchElementError} If no message exists for the given id.
59
+ * @throws {AccountNotOwnerError} If the account is not an owner of the multisig wallet.
60
+ */
61
+ async approveMessageProposal (messageId) {
62
+ throw new NotImplementedError('approveMessageProposal(messageId)')
63
+ }
64
+ }
@@ -0,0 +1,94 @@
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
+ /** @typedef {import('./wallet-account-read-only-multisig.js').MultisigProposal} MultisigProposal */
19
+
20
+ /** @typedef {import('./errors.js').AccountNotOwnerError} AccountNotOwnerError */
21
+ /** @typedef {import('./errors.js').ProviderError} ProviderError */
22
+ /** @typedef {import('./errors.js').ProviderRequiredError} ProviderRequiredError */
23
+ /** @typedef {import('./errors.js').ValueError} ValueError */
24
+
25
+ /**
26
+ * @typedef {Object} MultisigOptions
27
+ * @property {number} threshold - The new amount of approvals required to execute a transaction.
28
+ */
29
+
30
+ /**
31
+ * Adds owner management features to a multisig wallet.
32
+ *
33
+ * @interface
34
+ */
35
+ export class IMultisigOwnerManagement {
36
+ /**
37
+ * Proposes adding a new owner to the multisig wallet account.
38
+ *
39
+ * @param {string} owner - The owner's address.
40
+ * @param {MultisigOptions} [options] - The multisig options.
41
+ * @returns {Promise<MultisigProposal>} The multisig proposal.
42
+ * @throws {ValueError} If the address or options are not valid.
43
+ * @throws {ProviderRequiredError} If the method requires a provider.
44
+ * @throws {ProviderError} If the provider fails to add the owner.
45
+ * @throws {AccountNotOwnerError} If the account is not an owner of the multisig wallet.
46
+ */
47
+ async addOwner (owner, options) {
48
+ throw new NotImplementedError('addOwner(owner, options)')
49
+ }
50
+
51
+ /**
52
+ * Proposes removing an owner from the multisig wallet account.
53
+ *
54
+ * @param {string} owner - The owner's address.
55
+ * @param {MultisigOptions} [options] - The multisig options.
56
+ * @returns {Promise<MultisigProposal>} The multisig proposal.
57
+ * @throws {ValueError} If the address or options are not valid.
58
+ * @throws {ProviderRequiredError} If the method requires a provider.
59
+ * @throws {ProviderError} If the provider fails to remove the owner.
60
+ * @throws {AccountNotOwnerError} If the account is not an owner of the multisig wallet.
61
+ */
62
+ async removeOwner (owner, options) {
63
+ throw new NotImplementedError('removeOwner(owner, options)')
64
+ }
65
+
66
+ /**
67
+ * Proposes replacing an owner with a different one.
68
+ *
69
+ * @param {string} oldOwner - The old owner.
70
+ * @param {string} newOwner - The new owner.
71
+ * @returns {Promise<MultisigProposal>} The multisig proposal.
72
+ * @throws {ValueError} If the addresses are not valid.
73
+ * @throws {ProviderRequiredError} If the method requires a provider.
74
+ * @throws {ProviderError} If the provider fails to swap the two owners.
75
+ * @throws {AccountNotOwnerError} If the account is not an owner of the multisig wallet.
76
+ */
77
+ async swapOwner (oldOwner, newOwner) {
78
+ throw new NotImplementedError('swapOwner(oldOwner, newOwner)')
79
+ }
80
+
81
+ /**
82
+ * Proposes changing the signature threshold.
83
+ *
84
+ * @param {number} newThreshold - The new threshold.
85
+ * @returns {Promise<MultisigProposal>} The multisig proposal.
86
+ * @throws {ValueError} If the threshold is not valid.
87
+ * @throws {ProviderRequiredError} If the method requires a provider.
88
+ * @throws {ProviderError} If the provider fails to change the threshold.
89
+ * @throws {AccountNotOwnerError} If the account is not an owner of the multisig wallet.
90
+ */
91
+ async changeThreshold (newThreshold) {
92
+ throw new NotImplementedError('changeThreshold(newThreshold)')
93
+ }
94
+ }
@@ -0,0 +1,144 @@
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 { IWalletAccountReadOnlyMultisig } from './wallet-account-read-only-multisig.js'
17
+
18
+ import { NotImplementedError } from './errors.js'
19
+
20
+ /** @typedef {import('../wallet-account-read-only.js').Transaction} Transaction */
21
+ /** @typedef {import('../wallet-account-read-only.js').TransactionResult} TransactionResult */
22
+
23
+ /** @typedef {import('../wallet-account.js').KeyPair} KeyPair */
24
+
25
+ /** @typedef {import('./wallet-account-read-only-multisig.js').MultisigProposal} MultisigProposal */
26
+
27
+ /** @typedef {import('./errors.js').AccountNotOwnerError} AccountNotOwnerError */
28
+ /** @typedef {import('./errors.js').MaximumFeeExceededError} MaximumFeeExceededError */
29
+ /** @typedef {import('./errors.js').NoSuchElementError} NoSuchElementError */
30
+ /** @typedef {import('./errors.js').ProviderError} ProviderError */
31
+ /** @typedef {import('./errors.js').ProviderRequiredError} ProviderRequiredError */
32
+ /** @typedef {import('./errors.js').TransactionError} TransactionError */
33
+ /** @typedef {import('./errors.js').ThresholdNotMetError} ThresholdNotMetError */
34
+ /** @typedef {import('./errors.js').ValueError} ValueError */
35
+
36
+ /**
37
+ * @typedef {Object} MultisigTransactionOptions
38
+ * @property {boolean} [autoExecute] - If true, automatically executes the transaction when the approval threshold is met (only takes effect if this signer's approval is the last one required).
39
+ */
40
+
41
+ /**
42
+ * @typedef {Object} MultisigInteractionResult
43
+ * @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
+
46
+ /** @interface */
47
+ export class IWalletAccountMultisig extends IWalletAccountReadOnlyMultisig {
48
+ /**
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)).
59
+ *
60
+ * @type {string}
61
+ */
62
+ get path () {
63
+ throw new NotImplementedError('path')
64
+ }
65
+
66
+ /**
67
+ * The key pair of this account.
68
+ *
69
+ * @type {KeyPair}
70
+ */
71
+ get keyPair () {
72
+ throw new NotImplementedError('keyPair')
73
+ }
74
+
75
+ /**
76
+ * Returns the signer's address.
77
+ *
78
+ * @returns {Promise<string>} The signer's address.
79
+ */
80
+ async getSignerAddress () {
81
+ throw new NotImplementedError('getSignerAddress()')
82
+ }
83
+
84
+ /**
85
+ * Proposes sending a transaction for the other owners to approve. Does not execute on-chain:
86
+ * the returned proposal must be approved up to the threshold and then executed via
87
+ * {@link executeProposal}.
88
+ *
89
+ * @param {Transaction} tx - The transaction.
90
+ * @param {MultisigTransactionOptions} [transactionOptions] - The multisig transaction's options.
91
+ * @returns {Promise<MultisigProposal & MultisigInteractionResult>} The created proposal; its `status` is `'executed'` when `autoExecute` ran to completion, otherwise `'pending'`.
92
+ * @throws {ValueError} If the transaction is not valid.
93
+ * @throws {ProviderRequiredError} If the method requires a provider.
94
+ * @throws {ProviderError} If the provider fails to propose the transaction.
95
+ * @throws {AccountNotOwnerError} If the account is not an owner of the multisig wallet.
96
+ */
97
+ async propose (tx, transactionOptions) {
98
+ throw new NotImplementedError('propose(tx, transactionOptions)')
99
+ }
100
+
101
+ /**
102
+ * Approves a pending proposal.
103
+ *
104
+ * @param {string} proposalId - The proposal's id.
105
+ * @returns {Promise<MultisigProposal & MultisigInteractionResult>} The multisig proposal.
106
+ * @throws {ValueError} If the proposal's identifier is not a valid id.
107
+ * @throws {NoSuchElementError} If no message exists for the given id.
108
+ * @throws {AccountNotOwnerError} If the account is not an owner of the multisig wallet.
109
+ */
110
+ async approveProposal (proposalId) {
111
+ throw new NotImplementedError('approveProposal(proposalId)')
112
+ }
113
+
114
+ /**
115
+ * Rejects a pending proposal.
116
+ *
117
+ * @param {string} proposalId - The proposal's id.
118
+ * @returns {Promise<MultisigProposal>} The multisig proposal.
119
+ * @throws {ValueError} If the proposal's identifier is not a valid id.
120
+ * @throws {NoSuchElementError} If no message exists for the given id.
121
+ * @throws {AccountNotOwnerError} If the account is not an owner of the multisig wallet.
122
+ */
123
+ async rejectProposal (proposalId) {
124
+ throw new NotImplementedError('rejectProposal(proposalId)')
125
+ }
126
+
127
+ /**
128
+ * Submits an approved proposal for on-chain execution.
129
+ *
130
+ * @param {string} proposalId - The proposal's id.
131
+ * @returns {Promise<TransactionResult>} The on-chain transaction's result.
132
+ * @throws {ValueError} If the proposal's identifier is not a valid id.
133
+ * @throws {NoSuchElementError} If no proposal exists for the given id.
134
+ * @throws {ProviderRequiredError} If the method requires a provider.
135
+ * @throws {ProviderError} If the provider fails to execute the proposal.
136
+ * @throws {TransactionError} If the transaction fails with an error.
137
+ * @throws {AccountNotOwnerError} If the account is not an owner of the multisig wallet.
138
+ * @throws {ThresholdNotMetError} If the proposal's threshold has not been met yet.
139
+ * @throws {MaximumFeeExceededError} If the the costs of the transaction exceeds the transaction max. fee option.
140
+ */
141
+ async executeProposal (proposalId) {
142
+ throw new NotImplementedError('executeProposal(proposalId)')
143
+ }
144
+ }
@@ -0,0 +1,98 @@
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 { IWalletAccountReadOnlySimple } from '../wallet-account-read-only-simple.js'
17
+
18
+ import { NotImplementedError } from './errors.js'
19
+
20
+ /** @typedef {import('../wallet-account-read-only.js').TransactionResult} TransactionResult */
21
+
22
+ /** @typedef {import('./errors.js').NoSuchElementError} NoSuchElementError */
23
+ /** @typedef {import('./errors.js').ProviderError} ProviderError */
24
+ /** @typedef {import('./errors.js').ProviderRequiredError} ProviderRequiredError */
25
+ /** @typedef {import('./errors.js').TransactionError} TransactionError */
26
+ /** @typedef {import('./errors.js').ValueError} ValueError */
27
+
28
+ /**
29
+ * @typedef {Object} MultisigInfo
30
+ * @property {string} address - The multisig wallet account address.
31
+ * @property {string[]} owners - The owners of the multisig wallet account.
32
+ * @property {number} threshold - The minimum amount of signatures to execute a transaction.
33
+ */
34
+
35
+ /**
36
+ *
37
+ * @typedef {Object} MultisigProposal
38
+ * @property {string} proposalId - The proposal's id.
39
+ * @property {number} confirmations - The current number of confirmations.
40
+ * @property {number} threshold - The minimum amount of confirmations to execute the transaction.
41
+ * @property {'pending' | 'executed'} status - The proposal's lifecycle state: `'pending'` while it still awaits confirmations or on-chain execution, `'executed'` once it has been executed on-chain.
42
+ */
43
+
44
+ /** @interface */
45
+ export class IWalletAccountReadOnlyMultisig extends IWalletAccountReadOnlySimple {
46
+ /**
47
+ * Returns the multisig wallet account info.
48
+ *
49
+ * @returns {Promise<MultisigInfo>} The info.
50
+ * @throws {ProviderRequiredError} If the method requires a provider.
51
+ * @throws {ProviderError} If the provider fails to fetch the multisig wallet's info.
52
+ */
53
+ async getMultisigInfo () {
54
+ throw new NotImplementedError('getMultisigInfo()')
55
+ }
56
+
57
+ /**
58
+ * Returns a list of proposals by their identifiers.
59
+ *
60
+ * @param {string[]} proposalIds - The list of proposal's identifiers.
61
+ * @returns {Promise<Record<string, MultisigProposal | null>>} For each proposal id, the proposal details or
62
+ * null if the proposal has not been found.
63
+ * @throws {ValueError} If the list of proposal's identifiers contains an invalid id.
64
+ * @throws {ProviderRequiredError} If the method requires a provider.
65
+ * @throws {ProviderError} If the provider fails to fetch the proposals.
66
+ */
67
+ async getProposals (proposalIds) {
68
+ throw new NotImplementedError('getProposals(proposalIds)')
69
+ }
70
+
71
+ /**
72
+ * Returns a proposal by its identifier.
73
+ *
74
+ * @param {string} proposalId - The proposal's identifier.
75
+ * @returns {Promise<MultisigProposal | null>} The proposal details, or null if it has not been found.
76
+ * @throws {ValueError} If the proposal's identifier is not a valid id.
77
+ * @throws {ProviderRequiredError} If the method requires a provider.
78
+ * @throws {ProviderError} If the provider fails to fetch the proposal.
79
+ */
80
+ async getProposal (proposalId) {
81
+ throw new NotImplementedError('getProposal(proposalId)')
82
+ }
83
+
84
+ /**
85
+ * Quotes the on-chain cost of executing a pending proposal.
86
+ *
87
+ * @param {string} proposalId - The proposal's id.
88
+ * @returns {Promise<Omit<TransactionResult, 'hash'>>} The execution cost estimate.
89
+ * @throws {ValueError} If the proposal's identifier is not a valid id.
90
+ * @throws {NoSuchElementError} If no proposal exists for the given id.
91
+ * @throws {ProviderRequiredError} If the method requires a provider.
92
+ * @throws {ProviderError} If the provider fails to estimate the costs of the transaction.
93
+ * @throws {TransactionError} If the transaction fails with an error.
94
+ */
95
+ async quoteExecuteProposal (proposalId) {
96
+ throw new NotImplementedError('quoteExecuteProposal(proposalId)')
97
+ }
98
+ }
@@ -13,12 +13,21 @@
13
13
  // limitations under the License.
14
14
  'use strict'
15
15
 
16
- import { NotImplementedError } from '../errors.js'
16
+ import { NotImplementedError } from './errors.js'
17
17
 
18
18
  /** @typedef {import('../wallet-account-read-only.js').IWalletAccountReadOnly} IWalletAccountReadOnly */
19
19
 
20
20
  /** @typedef {import('../wallet-account.js').IWalletAccount} IWalletAccount */
21
21
 
22
+ /** @typedef {import('./errors.js').AccountRequiredError} AccountRequiredError */
23
+ /** @typedef {import('./errors.js').BridgeError} BridgeError */
24
+ /** @typedef {import('./errors.js').InvalidTokenError} InvalidTokenError */
25
+ /** @typedef {import('./errors.js').MaximumFeeExceededError} MaximumFeeExceededError */
26
+ /** @typedef {import('./errors.js').ReadOnlyAccountRequiredError} ReadOnlyAccountRequiredError */
27
+ /** @typedef {import('./errors.js').ProviderError} ProviderError */
28
+ /** @typedef {import('./errors.js').ProviderRequiredError} ProviderRequiredError */
29
+ /** @typedef {import('./errors.js').ValueError} ValueError */
30
+
22
31
  /**
23
32
  * @typedef {Object} BridgeProtocolConfig
24
33
  * @property {number | bigint} [bridgeMaxFee] - The maximum fee amount for bridge operations.
@@ -46,6 +55,13 @@ export class IBridgeProtocol {
46
55
  *
47
56
  * @param {BridgeOptions} options - The bridge's options.
48
57
  * @returns {Promise<BridgeResult>} The bridge's result.
58
+ * @throws {AccountRequiredError} If the protocol requires a full account to perform a bridge.
59
+ * @throws {ValueError} If the bridge options are not valid.
60
+ * @throws {InvalidTokenError} If the token is not a valid ERC 20 token's address.
61
+ * @throws {ProviderRequiredError} If the method requires a provider.
62
+ * @throws {ProviderError} If the provider fails to perform the bridge.
63
+ * @throws {BridgeError} If the bridge fails with an error.
64
+ * @throws {MaximumFeeExceededError} If the the costs of the transaction exceeds the bridge max. fee option.
49
65
  */
50
66
  async bridge (options) {
51
67
  throw new NotImplementedError('bridge(options)')
@@ -56,6 +72,12 @@ export class IBridgeProtocol {
56
72
  *
57
73
  * @param {BridgeOptions} options - The bridge's options.
58
74
  * @returns {Promise<Omit<BridgeResult, 'hash'>>} The bridge's quotes.
75
+ * @throws {ReadOnlyAccountRequiredError} If the protocol requires a read-only or full account to quote the costs of a swap.
76
+ * @throws {ValueError} If the bridge options are not valid.
77
+ * @throws {InvalidTokenError} If the token is not a valid ERC 20 token's address.
78
+ * @throws {ProviderRequiredError} If the method requires a provider.
79
+ * @throws {ProviderError} If the provider fails to perform the bridge.
80
+ * @throws {BridgeError} If the bridge fails with an error.
59
81
  */
60
82
  async quoteBridge (options) {
61
83
  throw new NotImplementedError('quoteBridge(options)')
@@ -106,6 +128,13 @@ export default class BridgeProtocol {
106
128
  * @abstract
107
129
  * @param {BridgeOptions} options - The bridge's options.
108
130
  * @returns {Promise<BridgeResult>} The bridge's result.
131
+ * @throws {AccountRequiredError} If the protocol requires a full account to perform a bridge.
132
+ * @throws {ValueError} If the bridge options are not valid.
133
+ * @throws {InvalidTokenError} If the token is not a valid ERC 20 token's address.
134
+ * @throws {ProviderRequiredError} If the method requires a provider.
135
+ * @throws {ProviderError} If the provider fails to perform the bridge.
136
+ * @throws {BridgeError} If the bridge fails with an error.
137
+ * @throws {MaximumFeeExceededError} If the the costs of the transaction exceeds the bridge max. fee option.
109
138
  */
110
139
  async bridge (options) {
111
140
  throw new NotImplementedError('bridge(options)')
@@ -117,6 +146,11 @@ export default class BridgeProtocol {
117
146
  * @abstract
118
147
  * @param {BridgeOptions} options - The bridge's options.
119
148
  * @returns {Promise<Omit<BridgeResult, 'hash'>>} The bridge's quotes.
149
+ * @throws {ValueError} If the bridge options are not valid.
150
+ * @throws {InvalidTokenError} If the token is not a valid ERC 20 token's address.
151
+ * @throws {ProviderRequiredError} If the method requires a provider.
152
+ * @throws {ProviderError} If the provider fails to perform the bridge.
153
+ * @throws {BridgeError} If the bridge fails with an error.
120
154
  */
121
155
  async quoteBridge (options) {
122
156
  throw new NotImplementedError('quoteBridge(options)')