mirror of
https://github.com/luxfi/bank.git
synced 2026-10-30 17:02:07 +00:00
One class over the whole /v1/bank surface: accounts, transfers, payments, beneficiaries, the issuer card lifecycle, crypto send + faucet, exchange, FX, plans. Zero dependencies, minor-unit integers, BankError with status and body. Verified live against a running bankd (login -> plans -> wallet -> faucet -> send -> quote -> typed 400) and published as @luxfi/[email protected]. Co-authored-by: Hanzo Dev <[email protected]>
1.1 KiB
1.1 KiB
@luxfi/bank
Typed client for the Lux banking API (/v1/bank) — accounts, transfers,
payments, beneficiaries, cards, crypto, exchange, FX, and membership plans.
Sandbox and production serve the identical contract (LP-3040); point the
client at either.
import { Bank } from '@luxfi/bank'
const bank = new Bank({
baseUrl: 'https://api.sandbox.lux.financial',
token: () => sessionStorage.getItem('token'),
})
const plans = await bank.plans()
const { holdings } = await bank.wallet()
await bank.sendCrypto('ETH', 400_000, '0x1234…5678') // minor units, 6 dp
// Card issuance — branch only on the issuer's status/nextAction pair:
const { data } = await bank.cardAccount()
if (data.virtualAccount?.nextAction === 'complete_kyc') {
const { url } = await bank.cardKYCURL() // sensitive — straight to the browser
window.open(url)
}
Amounts are integers in minor units; every balance carries decimals
(2 for most fiat, 0 for JPY, 6 for crypto). Errors throw BankError
with status and the parsed body.
Docs: docs.lux.financial · Spec: LP-3040.