@luxfi/bank 1.0.0 → 1.1.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 CHANGED
@@ -89,14 +89,24 @@ export interface Transaction {
89
89
  decimals: number;
90
90
  status: string;
91
91
  reference: string;
92
+ txHash?: string;
93
+ network?: string;
92
94
  created: string;
93
95
  }
94
96
  export interface Beneficiary {
95
97
  id: string;
96
98
  name: string;
99
+ bankAccountHolder: string;
97
100
  currency: string;
98
101
  country: string;
99
- [k: string]: unknown;
102
+ paymentType: string;
103
+ bankDetails: {
104
+ iban?: string;
105
+ bic?: string;
106
+ accountNumber?: string;
107
+ sortCode?: string;
108
+ };
109
+ verified: boolean;
100
110
  }
101
111
  export interface CryptoPrice {
102
112
  asset: string;
@@ -129,15 +139,6 @@ export interface ExchangeResult {
129
139
  rate: number;
130
140
  balances: Balance[];
131
141
  }
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
142
  /** The issuer's normalized card-lifecycle state; branch on this pair only. */
142
143
  export interface IssuerState {
143
144
  status: 'not_started' | 'pending' | 'approved' | 'rejected' | 'error' | string;
@@ -165,12 +166,13 @@ export interface CardholderProfile {
165
166
  };
166
167
  }
167
168
  export interface Overview {
168
- account: Account;
169
- balances: Balance[];
170
- wallet: Wallet | null;
171
- cards: Card[];
172
- transactions: Transaction[];
173
- [k: string]: unknown;
169
+ sandbox: boolean;
170
+ onboarded: boolean;
171
+ account?: Account;
172
+ balances?: Balance[];
173
+ wallet?: Wallet | null;
174
+ cards?: Card[];
175
+ recentTransactions?: Transaction[];
174
176
  }
175
177
  export declare class Bank {
176
178
  private baseUrl;
@@ -252,8 +254,6 @@ export declare class Bank {
252
254
  depositCrypto(asset: string, amount: number): Promise<CryptoMove>;
253
255
  exchangeQuote(fromCurrency: string, toCurrency: string, amount: number): Promise<ExchangeQuote>;
254
256
  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
257
  sandboxLogin(email: string, password: string): Promise<{
258
258
  token: string;
259
259
  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, FX, membership plans.
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luxfi/bank",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "Typed client for the Lux banking API (/v1/bank) — accounts, payments, cards, crypto, FX, and membership plans.",
5
5
  "license": "MIT",
6
6
  "repository": {