@luxfi/bank 1.0.0 → 1.0.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.
- package/dist/index.d.ts +0 -11
- package/dist/index.js +9 -14
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -129,15 +129,6 @@ export interface ExchangeResult {
|
|
|
129
129
|
rate: number;
|
|
130
130
|
balances: Balance[];
|
|
131
131
|
}
|
|
132
|
-
export interface FXQuote {
|
|
133
|
-
sellCurrency: string;
|
|
134
|
-
buyCurrency: string;
|
|
135
|
-
sellAmount: number;
|
|
136
|
-
buyAmount: number;
|
|
137
|
-
rate: number;
|
|
138
|
-
quoteId: string;
|
|
139
|
-
expiresAt: string;
|
|
140
|
-
}
|
|
141
132
|
/** The issuer's normalized card-lifecycle state; branch on this pair only. */
|
|
142
133
|
export interface IssuerState {
|
|
143
134
|
status: 'not_started' | 'pending' | 'approved' | 'rejected' | 'error' | string;
|
|
@@ -252,8 +243,6 @@ export declare class Bank {
|
|
|
252
243
|
depositCrypto(asset: string, amount: number): Promise<CryptoMove>;
|
|
253
244
|
exchangeQuote(fromCurrency: string, toCurrency: string, amount: number): Promise<ExchangeQuote>;
|
|
254
245
|
exchange(fromCurrency: string, toCurrency: string, amount: number): Promise<ExchangeResult>;
|
|
255
|
-
fxQuote(sellCurrency: string, buyCurrency: string, amount: number): Promise<FXQuote>;
|
|
256
|
-
fxExecute(accountId: string, quoteId: string): Promise<Record<string, unknown>>;
|
|
257
246
|
sandboxLogin(email: string, password: string): Promise<{
|
|
258
247
|
token: string;
|
|
259
248
|
user: {
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @luxfi/bank — typed client for the Lux banking API (/v1/bank).
|
|
2
2
|
// One surface: accounts, transfers, payments, beneficiaries, cards (with the
|
|
3
|
-
// provider-neutral issuer lifecycle), crypto, exchange,
|
|
3
|
+
// provider-neutral issuer lifecycle), crypto, exchange, and membership plans.
|
|
4
4
|
// Sandbox and production serve the identical contract (LP-3040).
|
|
5
5
|
export class BankError extends Error {
|
|
6
6
|
status;
|
|
@@ -12,6 +12,8 @@ export class BankError extends Error {
|
|
|
12
12
|
this.name = 'BankError';
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
|
+
// enc encodes a path segment so an id can never traverse or inject into the URL.
|
|
16
|
+
const enc = encodeURIComponent;
|
|
15
17
|
// -- Client --
|
|
16
18
|
export class Bank {
|
|
17
19
|
baseUrl;
|
|
@@ -82,13 +84,13 @@ export class Bank {
|
|
|
82
84
|
}
|
|
83
85
|
// Per-account reads
|
|
84
86
|
balances(accountId) {
|
|
85
|
-
return this.request('GET', `/v1/bank/accounts/${accountId}/balances`);
|
|
87
|
+
return this.request('GET', `/v1/bank/accounts/${enc(accountId)}/balances`);
|
|
86
88
|
}
|
|
87
89
|
wallets(accountId) {
|
|
88
|
-
return this.request('GET', `/v1/bank/accounts/${accountId}/wallets`);
|
|
90
|
+
return this.request('GET', `/v1/bank/accounts/${enc(accountId)}/wallets`);
|
|
89
91
|
}
|
|
90
92
|
accountTransactions(accountId) {
|
|
91
|
-
return this.request('GET', `/v1/bank/accounts/${accountId}/transactions`);
|
|
93
|
+
return this.request('GET', `/v1/bank/accounts/${enc(accountId)}/transactions`);
|
|
92
94
|
}
|
|
93
95
|
// Beneficiaries
|
|
94
96
|
beneficiaries() {
|
|
@@ -98,7 +100,7 @@ export class Bank {
|
|
|
98
100
|
return this.request('POST', '/v1/bank/beneficiaries', beneficiary);
|
|
99
101
|
}
|
|
100
102
|
deleteBeneficiary(id) {
|
|
101
|
-
return this.request('DELETE', `/v1/bank/beneficiaries/${id}`);
|
|
103
|
+
return this.request('DELETE', `/v1/bank/beneficiaries/${enc(id)}`);
|
|
102
104
|
}
|
|
103
105
|
// Cards — ledger
|
|
104
106
|
cards() {
|
|
@@ -108,10 +110,10 @@ export class Bank {
|
|
|
108
110
|
return this.request('POST', '/v1/bank/cards', card);
|
|
109
111
|
}
|
|
110
112
|
freezeCard(id) {
|
|
111
|
-
return this.request('POST', `/v1/bank/cards/${id}/freeze`);
|
|
113
|
+
return this.request('POST', `/v1/bank/cards/${enc(id)}/freeze`);
|
|
112
114
|
}
|
|
113
115
|
unfreezeCard(id) {
|
|
114
|
-
return this.request('POST', `/v1/bank/cards/${id}/unfreeze`);
|
|
116
|
+
return this.request('POST', `/v1/bank/cards/${enc(id)}/unfreeze`);
|
|
115
117
|
}
|
|
116
118
|
// Cards — issuer lifecycle (provider-neutral; branch on status/nextAction)
|
|
117
119
|
createCardAccount(profile) {
|
|
@@ -158,13 +160,6 @@ export class Bank {
|
|
|
158
160
|
exchange(fromCurrency, toCurrency, amount) {
|
|
159
161
|
return this.request('POST', '/v1/bank/exchange/execute', { fromCurrency, toCurrency, amount });
|
|
160
162
|
}
|
|
161
|
-
// Dealt FX
|
|
162
|
-
fxQuote(sellCurrency, buyCurrency, amount) {
|
|
163
|
-
return this.request('POST', '/v1/bank/fx/quote', { sellCurrency, buyCurrency, amount });
|
|
164
|
-
}
|
|
165
|
-
fxExecute(accountId, quoteId) {
|
|
166
|
-
return this.request('POST', '/v1/bank/fx/execute', { accountId, quoteId });
|
|
167
|
-
}
|
|
168
163
|
// Sandbox demo login (sandbox deployments only)
|
|
169
164
|
sandboxLogin(email, password) {
|
|
170
165
|
return this.request('POST', '/v1/bank/login', {
|
package/package.json
CHANGED