@luxfi/bank 1.3.4 → 1.4.0
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/dist/index.d.ts +56 -0
- package/dist/index.js +16 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -176,6 +176,38 @@ export interface CardholderProfile {
|
|
|
176
176
|
country: string;
|
|
177
177
|
};
|
|
178
178
|
}
|
|
179
|
+
export interface Vault {
|
|
180
|
+
id: string;
|
|
181
|
+
name: string;
|
|
182
|
+
collateral: string;
|
|
183
|
+
underlying: string;
|
|
184
|
+
synthetic: string;
|
|
185
|
+
apy: number;
|
|
186
|
+
maxLtv: number;
|
|
187
|
+
tvlUsd: number;
|
|
188
|
+
description: string;
|
|
189
|
+
}
|
|
190
|
+
export interface Position {
|
|
191
|
+
vault: string;
|
|
192
|
+
collateral: number;
|
|
193
|
+
collateralUsd: number;
|
|
194
|
+
debt: number;
|
|
195
|
+
ltv: number;
|
|
196
|
+
borrowable: number;
|
|
197
|
+
yieldUsdYear: number;
|
|
198
|
+
selfRepayDays: number;
|
|
199
|
+
}
|
|
200
|
+
export type VaultView = Vault & {
|
|
201
|
+
position?: Position | null;
|
|
202
|
+
};
|
|
203
|
+
export interface EarnSummary {
|
|
204
|
+
collateralUsd: number;
|
|
205
|
+
debt: number;
|
|
206
|
+
netUsd: number;
|
|
207
|
+
yieldUsdYear: number;
|
|
208
|
+
positions: number;
|
|
209
|
+
netApy: number;
|
|
210
|
+
}
|
|
179
211
|
export interface Overview {
|
|
180
212
|
sandbox: boolean;
|
|
181
213
|
onboarded: boolean;
|
|
@@ -184,6 +216,7 @@ export interface Overview {
|
|
|
184
216
|
wallet?: Wallet | null;
|
|
185
217
|
wallets?: Wallet[];
|
|
186
218
|
cards?: Card[];
|
|
219
|
+
earn?: EarnSummary;
|
|
187
220
|
recentTransactions?: Transaction[];
|
|
188
221
|
}
|
|
189
222
|
export declare class Bank {
|
|
@@ -271,6 +304,29 @@ export declare class Bank {
|
|
|
271
304
|
sendCrypto(asset: string, amount: number, toAddress: string): Promise<CryptoMove>;
|
|
272
305
|
/** Sandbox-only testnet faucet. */
|
|
273
306
|
depositCrypto(asset: string, amount: number): Promise<CryptoMove>;
|
|
307
|
+
vaults(): Promise<Vault[]>;
|
|
308
|
+
earnVaults(): Promise<VaultView[]>;
|
|
309
|
+
private earnMove;
|
|
310
|
+
earnDeposit(vault: string, amount: number): Promise<{
|
|
311
|
+
vault: string;
|
|
312
|
+
position: Position;
|
|
313
|
+
balances: Balance[];
|
|
314
|
+
}>;
|
|
315
|
+
earnBorrow(vault: string, amount: number): Promise<{
|
|
316
|
+
vault: string;
|
|
317
|
+
position: Position;
|
|
318
|
+
balances: Balance[];
|
|
319
|
+
}>;
|
|
320
|
+
earnRepay(vault: string, amount: number): Promise<{
|
|
321
|
+
vault: string;
|
|
322
|
+
position: Position;
|
|
323
|
+
balances: Balance[];
|
|
324
|
+
}>;
|
|
325
|
+
earnWithdraw(vault: string, amount: number): Promise<{
|
|
326
|
+
vault: string;
|
|
327
|
+
position: Position;
|
|
328
|
+
balances: Balance[];
|
|
329
|
+
}>;
|
|
274
330
|
exchangeQuote(fromCurrency: string, toCurrency: string, amount: number): Promise<ExchangeQuote>;
|
|
275
331
|
exchange(fromCurrency: string, toCurrency: string, amount: number): Promise<ExchangeResult>;
|
|
276
332
|
sandboxLogin(email: string, password: string): Promise<{
|
package/dist/index.js
CHANGED
|
@@ -156,6 +156,22 @@ export class Bank {
|
|
|
156
156
|
depositCrypto(asset, amount) {
|
|
157
157
|
return this.request('POST', '/v1/bank/crypto/deposit', { asset, amount });
|
|
158
158
|
}
|
|
159
|
+
// Earn — Liquid Protocol vaults. `vaults()` is the public catalog; the rest
|
|
160
|
+
// are the caller's positions and movements. deposit/withdraw amounts are in
|
|
161
|
+
// the vault's underlying minor units; borrow/repay are in USD cents.
|
|
162
|
+
vaults() {
|
|
163
|
+
return this.request('GET', '/v1/bank/vaults');
|
|
164
|
+
}
|
|
165
|
+
earnVaults() {
|
|
166
|
+
return this.request('GET', '/v1/bank/earn/vaults');
|
|
167
|
+
}
|
|
168
|
+
earnMove(action, vault, amount) {
|
|
169
|
+
return this.request('POST', `/v1/bank/earn/${action}`, { vault, amount });
|
|
170
|
+
}
|
|
171
|
+
earnDeposit(vault, amount) { return this.earnMove('deposit', vault, amount); }
|
|
172
|
+
earnBorrow(vault, amount) { return this.earnMove('borrow', vault, amount); }
|
|
173
|
+
earnRepay(vault, amount) { return this.earnMove('repay', vault, amount); }
|
|
174
|
+
earnWithdraw(vault, amount) { return this.earnMove('withdraw', vault, amount); }
|
|
159
175
|
// Exchange (fiat FX + crypto buy/sell/convert)
|
|
160
176
|
exchangeQuote(fromCurrency, toCurrency, amount) {
|
|
161
177
|
return this.request('POST', '/v1/bank/exchange/quote', { fromCurrency, toCurrency, amount });
|
package/package.json
CHANGED