@tetherto/wdk-wallet 1.0.0-beta.1

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,117 @@
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 { IWalletAccountReadOnly } from './wallet-account-read-only.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-read-only.js').TransferOptions} TransferOptions */
24
+ /** @typedef {import('./wallet-account-read-only.js').TransferResult} TransferResult */
25
+
26
+ /**
27
+ * @typedef {Object} KeyPair
28
+ * @property {Uint8Array} publicKey - The public key.
29
+ * @property {Uint8Array | null} privateKey - The private key (null if the account has been disposed).
30
+ */
31
+
32
+ /** @interface */
33
+ export class IWalletAccount extends IWalletAccountReadOnly {
34
+ /**
35
+ * The derivation path's index of this account.
36
+ *
37
+ * @type {number}
38
+ */
39
+ get index () {
40
+ throw new NotImplementedError('index')
41
+ }
42
+
43
+ /**
44
+ * The derivation path of this account (see [BIP-44](https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki)).
45
+ *
46
+ * @type {string}
47
+ */
48
+ get path () {
49
+ throw new NotImplementedError('path')
50
+ }
51
+
52
+ /**
53
+ * The account's key pair.
54
+ *
55
+ * @type {KeyPair}
56
+ */
57
+ get keyPair () {
58
+ throw new NotImplementedError('keyPair')
59
+ }
60
+
61
+ /**
62
+ * Signs a message.
63
+ *
64
+ * @param {string} message - The message to sign.
65
+ * @returns {Promise<string>} The message's signature.
66
+ */
67
+ async sign (message) {
68
+ throw new NotImplementedError('sign(message)')
69
+ }
70
+
71
+ /**
72
+ * Verifies a message's signature.
73
+ *
74
+ * @param {string} message - The original message.
75
+ * @param {string} signature - The signature to verify.
76
+ * @returns {Promise<boolean>} True if the signature is valid.
77
+ */
78
+ async verify (message, signature) {
79
+ throw new NotImplementedError('verify(message, signature)')
80
+ }
81
+
82
+ /**
83
+ * Sends a transaction.
84
+ *
85
+ * @param {Transaction} tx - The transaction.
86
+ * @returns {Promise<TransactionResult>} The transaction's result.
87
+ */
88
+ async sendTransaction (tx) {
89
+ throw new NotImplementedError('sendTransaction(tx)')
90
+ }
91
+
92
+ /**
93
+ * Transfers a token to another address.
94
+ *
95
+ * @param {TransferOptions} options - The transfer's options.
96
+ * @returns {Promise<TransferResult>} The transfer's result.
97
+ */
98
+ async transfer (options) {
99
+ throw new NotImplementedError('transfer(options)')
100
+ }
101
+
102
+ /**
103
+ * Returns a read-only copy of the account.
104
+ *
105
+ * @returns {Promise<IWalletAccountReadOnly>} The read-only account.
106
+ */
107
+ async toReadOnlyAccount () {
108
+ throw new NotImplementedError('toReadOnlyAccount()')
109
+ }
110
+
111
+ /**
112
+ * Disposes the wallet account, erasing the private key from the memory.
113
+ */
114
+ dispose () {
115
+ throw new NotImplementedError('dispose()')
116
+ }
117
+ }
@@ -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 * as bip39 from 'bip39'
17
+
18
+ import { NotImplementedError } from './errors.js'
19
+
20
+ /** @typedef {import('./wallet-account.js').IWalletAccount} IWalletAccount */
21
+
22
+ /**
23
+ * @typedef {Object} WalletConfig
24
+ * @property {number | bigint} [transferMaxFee] - The maximum fee amount for transfer operations.
25
+ */
26
+
27
+ /**
28
+ * @typedef {Object} FeeRates
29
+ * @property {bigint} normal - The fee rate for transaction sent with normal priority.
30
+ * @property {bigint} fast - The fee rate for transaction sent with fast priority.
31
+ */
32
+
33
+ /** @abstract */
34
+ export default class WalletManager {
35
+ /**
36
+ * Creates a new wallet manager.
37
+ *
38
+ * @param {string | Uint8Array} seed - The wallet's [BIP-39](https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki) seed phrase.
39
+ * @param {WalletConfig} [config] - The wallet configuration.
40
+ */
41
+ constructor (seed, config = { }) {
42
+ if (typeof seed === 'string') {
43
+ if (!WalletManager.isValidSeedPhrase(seed)) {
44
+ throw new Error('The seed phrase is invalid.')
45
+ }
46
+
47
+ seed = bip39.mnemonicToSeedSync(seed)
48
+ }
49
+
50
+ /** @private */
51
+ this._seed = seed
52
+
53
+ /**
54
+ * The wallet configuration.
55
+ *
56
+ * @protected
57
+ * @type {WalletConfig}
58
+ */
59
+ this._config = config
60
+
61
+ /**
62
+ * A map between derivation paths and wallet accounts. The {@link dispose} method will automatically dispose
63
+ * all the accounts in this map, so developers are encouraged to map all accounts accessed through the
64
+ * {@link getAccount} and {@link getAccountByPath} methods.
65
+ *
66
+ * @protected
67
+ * @type {{ [path: string]: IWalletAccount }}
68
+ */
69
+ this._accounts = {}
70
+ }
71
+
72
+ /**
73
+ * Returns a random [BIP-39](https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki) seed phrase.
74
+ *
75
+ * @returns {string} The seed phrase.
76
+ */
77
+ static getRandomSeedPhrase () {
78
+ return bip39.generateMnemonic()
79
+ }
80
+
81
+ /**
82
+ * Checks if a seed phrase is valid.
83
+ *
84
+ * @param {string} seedPhrase - The seed phrase.
85
+ * @returns {boolean} True if the seed phrase is valid.
86
+ */
87
+ static isValidSeedPhrase (seedPhrase) {
88
+ return bip39.validateMnemonic(seedPhrase)
89
+ }
90
+
91
+ /**
92
+ * The seed phrase of the wallet.
93
+ *
94
+ * @type {Uint8Array}
95
+ */
96
+ get seed () {
97
+ return this._seed
98
+ }
99
+
100
+ /**
101
+ * Returns the wallet account at a specific index (see [BIP-44](https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki)).
102
+ *
103
+ * @abstract
104
+ * @param {number} [index] - The index of the account to get (default: 0).
105
+ * @returns {Promise<IWalletAccount>} The account.
106
+ */
107
+ async getAccount (index = 0) {
108
+ throw new NotImplementedError('getAccount(index)')
109
+ }
110
+
111
+ /**
112
+ * Returns the wallet account at a specific [BIP-44](https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki) derivation path.
113
+ *
114
+ * @abstract
115
+ * @param {string} path - The derivation path (e.g. "0'/0/0").
116
+ * @returns {Promise<IWalletAccount>} The account.
117
+ */
118
+ async getAccountByPath (path) {
119
+ throw new NotImplementedError('getAccountByPath(path)')
120
+ }
121
+
122
+ /**
123
+ * Returns the current fee rates.
124
+ *
125
+ * @abstract
126
+ * @returns {Promise<FeeRates>} The fee rates (in base unit).
127
+ */
128
+ async getFeeRates () {
129
+ throw new NotImplementedError('getFeeRates()')
130
+ }
131
+
132
+ /**
133
+ * Disposes all the wallet accounts, erasing their private keys from the memory.
134
+ */
135
+ dispose () {
136
+ for (const account of Object.values(this._accounts)) {
137
+ if (account.keyPair.privateKey) {
138
+ account.dispose()
139
+ }
140
+ }
141
+
142
+ this._accounts = {}
143
+ }
144
+ }
@@ -0,0 +1,11 @@
1
+ export type FeeRates = import("./src/wallet-manager.js").FeeRates;
2
+ export type WalletConfig = import("./src/wallet-manager.js").WalletConfig;
3
+ export type Transaction = import("./src/wallet-account-read-only.js").Transaction;
4
+ export type TransactionResult = import("./src/wallet-account-read-only.js").TransactionResult;
5
+ export type TransferOptions = import("./src/wallet-account-read-only.js").TransferOptions;
6
+ export type TransferResult = import("./src/wallet-account-read-only.js").TransferResult;
7
+ export type KeyPair = import("./src/wallet-account.js").KeyPair;
8
+ export { default } from "./src/wallet-manager.js";
9
+ export { default as WalletAccountReadOnly, IWalletAccountReadOnly } from "./src/wallet-account-read-only.js";
10
+ export { IWalletAccount } from "./src/wallet-account.js";
11
+ export { NotImplementedError } from "./src/errors.js";
@@ -0,0 +1,8 @@
1
+ export class NotImplementedError extends Error {
2
+ /**
3
+ * Create a new not implemented error.
4
+ *
5
+ * @param {string} methodName - The method's name.
6
+ */
7
+ constructor(methodName: string);
8
+ }
@@ -0,0 +1,106 @@
1
+ /** @interface */
2
+ export interface IBridgeProtocol {
3
+ /**
4
+ * Bridges a token to a different blockchain.
5
+ *
6
+ * @param {BridgeOptions} options - The bridge's options.
7
+ * @returns {Promise<BridgeResult>} The bridge's result.
8
+ */
9
+ bridge(options: BridgeOptions): Promise<BridgeResult>;
10
+ /**
11
+ * Quotes the costs of a bridge operation.
12
+ *
13
+ * @param {BridgeOptions} options - The bridge's options.
14
+ * @returns {Promise<Omit<BridgeResult, 'hash'>>} The bridge's quotes.
15
+ */
16
+ quoteBridge(options: BridgeOptions): Promise<Omit<BridgeResult, "hash">>;
17
+ }
18
+ /** @abstract */
19
+ export default abstract class BridgeProtocol implements IBridgeProtocol {
20
+ /**
21
+ * Creates a new read-only bridge protocol.
22
+ *
23
+ * @overload
24
+ * @param {IWalletAccountReadOnly} account - The wallet account to use to interact with the protocol.
25
+ * @param {BridgeProtocolConfig} [config] - The bridge protocol configuration.
26
+ */
27
+ constructor(account: IWalletAccountReadOnly, config?: BridgeProtocolConfig);
28
+ /**
29
+ * Creates a new bridge protocol.
30
+ *
31
+ * @overload
32
+ * @param {IWalletAccount} account - The wallet account to use to interact with the protocol.
33
+ * @param {BridgeProtocolConfig} [config] - The bridge protocol configuration.
34
+ */
35
+ constructor(account: IWalletAccount, config?: BridgeProtocolConfig);
36
+ /**
37
+ * The wallet account to use to interact with the protocol.
38
+ *
39
+ * @protected
40
+ * @type {IWalletAccount}
41
+ */
42
+ protected _account: IWalletAccount;
43
+ /**
44
+ * The bridge protocol configuration.
45
+ *
46
+ * @protected
47
+ * @type {BridgeProtocolConfig}
48
+ */
49
+ protected _config: BridgeProtocolConfig;
50
+ /**
51
+ * Bridges a token to a different blockchain.
52
+ *
53
+ * @abstract
54
+ * @param {BridgeOptions} options - The bridge's options.
55
+ * @returns {Promise<BridgeResult>} The bridge's result.
56
+ */
57
+ abstract bridge(options: BridgeOptions): Promise<BridgeResult>;
58
+ /**
59
+ * Quotes the costs of a bridge operation.
60
+ *
61
+ * @abstract
62
+ * @param {BridgeOptions} options - The bridge's options.
63
+ * @returns {Promise<Omit<BridgeResult, 'hash'>>} The bridge's quotes.
64
+ */
65
+ abstract quoteBridge(options: BridgeOptions): Promise<Omit<BridgeResult, "hash">>;
66
+ }
67
+ export type IWalletAccountReadOnly = import("../wallet-account-read-only.js").IWalletAccountReadOnly;
68
+ export type IWalletAccount = import("../wallet-account.js").IWalletAccount;
69
+ export type BridgeProtocolConfig = {
70
+ /**
71
+ * - The maximum fee amount for bridge operations.
72
+ */
73
+ bridgeMaxFee?: number | bigint;
74
+ };
75
+ export type BridgeOptions = {
76
+ /**
77
+ * - The identifier of the destination blockchain (e.g., "arbitrum").
78
+ */
79
+ targetChain: string;
80
+ /**
81
+ * - The address of the recipient.
82
+ */
83
+ recipient: string;
84
+ /**
85
+ * - The address of the token to bridge.
86
+ */
87
+ token: string;
88
+ /**
89
+ * - The amount of tokenss to bridge to the destination chain (in base unit).
90
+ */
91
+ amount: number | bigint;
92
+ };
93
+ export type BridgeResult = {
94
+ /**
95
+ * - The hash of the bridge operation.
96
+ */
97
+ hash: string;
98
+ /**
99
+ * - The gas cost.
100
+ */
101
+ fee: bigint;
102
+ /**
103
+ * - The amount of native tokens paid to the bridge protocol.
104
+ */
105
+ bridgeFee: bigint;
106
+ };
@@ -0,0 +1,17 @@
1
+ export type SwapProtocolConfig = import("./swap-protocol.js").SwapProtocolConfig;
2
+ export type SwapOptions = import("./swap-protocol.js").SwapOptions;
3
+ export type SwapResult = import("./swap-protocol.js").SwapResult;
4
+ export type BridgeProtocolConfig = import("./bridge-protocol.js").BridgeProtocolConfig;
5
+ export type BridgeOptions = import("./bridge-protocol.js").BridgeOptions;
6
+ export type BridgeResult = import("./bridge-protocol.js").BridgeResult;
7
+ export type SupplyOptions = import("./lending-protocol.js").SupplyOptions;
8
+ export type SupplyResult = import("./lending-protocol.js").SupplyResult;
9
+ export type WithdrawOptions = import("./lending-protocol.js").WithdrawOptions;
10
+ export type WithdrawResult = import("./lending-protocol.js").WithdrawResult;
11
+ export type BorrowOptions = import("./lending-protocol.js").BorrowOptions;
12
+ export type BorrowResult = import("./lending-protocol.js").BorrowResult;
13
+ export type RepayOptions = import("./lending-protocol.js").RepayOptions;
14
+ export type RepayResult = import("./lending-protocol.js").RepayResult;
15
+ export { default as SwapProtocol, ISwapProtocol } from "./swap-protocol.js";
16
+ export { default as BridgeProtocol, IBridgeProtocol } from "./bridge-protocol.js";
17
+ export { default as LendingProtocol, ILendingProtocol } from "./lending-protocol.js";
@@ -0,0 +1,245 @@
1
+ /** @interface */
2
+ export interface ILendingProtocol {
3
+ /**
4
+ * Supplies a specific token amount to the lending pool.
5
+ *
6
+ * @param {SupplyOptions} options - The supply's options.
7
+ * @returns {Promise<SupplyResult>} The supply's result.
8
+ */
9
+ supply(options: SupplyOptions): Promise<SupplyResult>;
10
+ /**
11
+ * Quotes the costs of a supply operation.
12
+ *
13
+ * @param {SupplyOptions} options - The supply's options.
14
+ * @returns {Promise<Omit<SupplyResult, 'hash'>>} The supply's costs.
15
+ */
16
+ quoteSupply(options: SupplyOptions): Promise<Omit<SupplyResult, "hash">>;
17
+ /**
18
+ * Withdraws a specific token amount from the pool.
19
+ *
20
+ * @param {WithdrawOptions} options - The withdraw's options.
21
+ * @returns {Promise<WithdrawResult>} The withdraw's result.
22
+ */
23
+ withdraw(options: WithdrawOptions): Promise<WithdrawResult>;
24
+ /**
25
+ * Quotes the costs of a withdraw operation.
26
+ *
27
+ * @param {WithdrawOptions} options - The withdraw's options.
28
+ * @returns {Promise<Omit<WithdrawResult, 'hash'>>} The withdraw's costs.
29
+ */
30
+ quoteWithdraw(options: WithdrawOptions): Promise<Omit<WithdrawResult, "hash">>;
31
+ /**
32
+ * Borrows a specific token amount.
33
+ *
34
+ * @param {BorrowOptions} options - The borrow's options.
35
+ * @returns {Promise<BorrowResult>} The borrow's result.
36
+ */
37
+ borrow(options: BorrowOptions): Promise<BorrowResult>;
38
+ /**
39
+ * Quotes the costs of a borrow operation.
40
+ *
41
+ * @param {BorrowOptions} options - The borrow's options.
42
+ * @returns {Promise<Omit<BorrowResult, 'hash'>>} The borrow's costs.
43
+ */
44
+ quoteBorrow(options: BorrowOptions): Promise<Omit<BorrowResult, "hash">>;
45
+ /**
46
+ * Repays a specific token amount.
47
+ *
48
+ * @param {RepayOptions} options - The borrow's options.
49
+ * @returns {Promise<RepayResult>} The repay's result.
50
+ */
51
+ repay(options: RepayOptions): Promise<RepayResult>;
52
+ /**
53
+ * Quotes the costs of a repay operation.
54
+ *
55
+ * @param {RepayOptions} options - The repay's options.
56
+ * @returns {Promise<Omit<RepayResult, 'hash'>>} The repay's costs.
57
+ */
58
+ quoteRepay(options: RepayOptions): Promise<Omit<RepayResult, "hash">>;
59
+ }
60
+ /** @abstract */
61
+ export default abstract class LendingProtocol implements ILendingProtocol {
62
+ /**
63
+ * Creates a new read-only lending protocol.
64
+ *
65
+ * @overload
66
+ * @param {IWalletAccountReadOnly} account - The wallet account to use to interact with the protocol.
67
+ */
68
+ constructor(account: IWalletAccountReadOnly);
69
+ /**
70
+ * Creates a new lending protocol.
71
+ *
72
+ * @overload
73
+ * @param {IWalletAccount} account - The wallet account to use to interact with the protocol.
74
+ */
75
+ constructor(account: IWalletAccount);
76
+ /**
77
+ * The wallet account to use to interact with the protocol.
78
+ *
79
+ * @protected
80
+ * @type {IWalletAccount}
81
+ */
82
+ protected _account: IWalletAccount;
83
+ /**
84
+ * Supplies a specific token amount to the lending pool.
85
+ *
86
+ * @abstract
87
+ * @param {SupplyOptions} options - The supply's options.
88
+ * @returns {Promise<SupplyResult>} The supply's result.
89
+ */
90
+ abstract supply(options: SupplyOptions): Promise<SupplyResult>;
91
+ /**
92
+ * Quotes the costs of a supply operation.
93
+ *
94
+ * @abstract
95
+ * @param {SupplyOptions} options - The supply's options.
96
+ * @returns {Promise<Omit<SupplyResult, 'hash'>>} The supply's costs.
97
+ */
98
+ abstract quoteSupply(options: SupplyOptions): Promise<Omit<SupplyResult, "hash">>;
99
+ /**
100
+ * Withdraws a specific token amount from the pool.
101
+ *
102
+ * @abstract
103
+ * @param {WithdrawOptions} options - The withdraw's options.
104
+ * @returns {Promise<WithdrawResult>} The withdraw's result.
105
+ */
106
+ abstract withdraw(options: WithdrawOptions): Promise<WithdrawResult>;
107
+ /**
108
+ * Quotes the costs of a withdraw operation.
109
+ *
110
+ * @abstract
111
+ * @param {WithdrawOptions} options - The withdraw's options.
112
+ * @returns {Promise<Omit<WithdrawResult, 'hash'>>} The withdraw's costs.
113
+ */
114
+ abstract quoteWithdraw(options: WithdrawOptions): Promise<Omit<WithdrawResult, "hash">>;
115
+ /**
116
+ * Borrows a specific token amount.
117
+ *
118
+ * @abstract
119
+ * @param {BorrowOptions} options - The borrow's options.
120
+ * @returns {Promise<BorrowResult>} The borrow's result.
121
+ */
122
+ abstract borrow(options: BorrowOptions): Promise<BorrowResult>;
123
+ /**
124
+ * Quotes the costs of a borrow operation.
125
+ *
126
+ * @abstract
127
+ * @param {BorrowOptions} options - The borrow's options.
128
+ * @returns {Promise<Omit<BorrowResult, 'hash'>>} The borrow's costs.
129
+ */
130
+ abstract quoteBorrow(options: BorrowOptions): Promise<Omit<BorrowResult, "hash">>;
131
+ /**
132
+ * Repays a specific token amount.
133
+ *
134
+ * @abstract
135
+ * @param {RepayOptions} options - The borrow's options.
136
+ * @returns {Promise<RepayResult>} The repay's result.
137
+ */
138
+ abstract repay(options: RepayOptions): Promise<RepayResult>;
139
+ /**
140
+ * Quotes the costs of a repay operation.
141
+ *
142
+ * @abstract
143
+ * @param {RepayOptions} options - The repay's options.
144
+ * @returns {Promise<Omit<RepayResult, 'hash'>>} The repay's costs.
145
+ */
146
+ abstract quoteRepay(options: RepayOptions): Promise<Omit<RepayResult, "hash">>;
147
+ }
148
+ export type IWalletAccountReadOnly = import("../wallet-account-read-only.js").IWalletAccountReadOnly;
149
+ export type IWalletAccount = import("../wallet-account.js").IWalletAccount;
150
+ export type SupplyOptions = {
151
+ /**
152
+ * - The address of the token to supply.
153
+ */
154
+ token: string;
155
+ /**
156
+ * - The amount of tokens to supply (in base unit).
157
+ */
158
+ amount: number | bigint;
159
+ /**
160
+ * - The address on behalf of which the supply operation should be performed. If not set, the supply operation will be performed on behalf of the account itself.
161
+ */
162
+ onBehalfOf?: string;
163
+ };
164
+ export type SupplyResult = {
165
+ /**
166
+ * - The hash of the supply operation.
167
+ */
168
+ hash: string;
169
+ /**
170
+ * - The gas cost.
171
+ */
172
+ fee: bigint;
173
+ };
174
+ export type WithdrawOptions = {
175
+ /**
176
+ * - The address of the token to withdraw.
177
+ */
178
+ token: string;
179
+ /**
180
+ * - The amount of tokens to withdraw (in base unit).
181
+ */
182
+ amount: number | bigint;
183
+ /**
184
+ * - The address that should receive the tokens. If not set, the account itself will receive the funds.
185
+ */
186
+ to?: string;
187
+ };
188
+ export type WithdrawResult = {
189
+ /**
190
+ * - The hash of the withdraw operation.
191
+ */
192
+ hash: string;
193
+ /**
194
+ * - The gas cost.
195
+ */
196
+ fee: bigint;
197
+ };
198
+ export type BorrowOptions = {
199
+ /**
200
+ * - The address of the token to borrow.
201
+ */
202
+ token: string;
203
+ /**
204
+ * - The amount of tokens to borrow (in base unit).
205
+ */
206
+ amount: number | bigint;
207
+ /**
208
+ * - The address on behalf of which the borrow operation should be performed. If not set, the borrow operation will be performed on behalf of the account itself.
209
+ */
210
+ onBehalfOf?: string;
211
+ };
212
+ export type BorrowResult = {
213
+ /**
214
+ * - The hash of the borrow operation.
215
+ */
216
+ hash: string;
217
+ /**
218
+ * - The gas cost.
219
+ */
220
+ fee: bigint;
221
+ };
222
+ export type RepayOptions = {
223
+ /**
224
+ * - The address of the token to repay.
225
+ */
226
+ token: string;
227
+ /**
228
+ * - The amount of tokens to repay (in base unit).
229
+ */
230
+ amount: number | bigint;
231
+ /**
232
+ * - The address on behalf of which the repay operation should be performed. If not set, the repay operation will be performed on behalf of the account itself.
233
+ */
234
+ onBehalfOf?: string;
235
+ };
236
+ export type RepayResult = {
237
+ /**
238
+ * - The hash of the repay operation.
239
+ */
240
+ hash: string;
241
+ /**
242
+ * - The gas cost.
243
+ */
244
+ fee: bigint;
245
+ };