@bitgen/sdk 0.1.6 → 1.0.4
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/CHANGELOG.md +63 -2
- package/README.md +27 -106
- package/dist/cjs/client.d.ts +20 -8
- package/dist/cjs/client.d.ts.map +1 -1
- package/dist/cjs/client.js +33 -12
- package/dist/cjs/client.js.map +1 -1
- package/dist/cjs/constants.d.ts +256 -0
- package/dist/cjs/constants.d.ts.map +1 -0
- package/dist/cjs/constants.js +214 -0
- package/dist/cjs/constants.js.map +1 -0
- package/dist/cjs/error.d.ts +17 -10
- package/dist/cjs/error.d.ts.map +1 -1
- package/dist/cjs/error.js +25 -7
- package/dist/cjs/error.js.map +1 -1
- package/dist/cjs/http.d.ts +13 -8
- package/dist/cjs/http.d.ts.map +1 -1
- package/dist/cjs/http.js +135 -44
- package/dist/cjs/http.js.map +1 -1
- package/dist/cjs/index.d.ts +14 -1
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +30 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/resources/apikeys.d.ts +18 -0
- package/dist/cjs/resources/apikeys.d.ts.map +1 -0
- package/dist/cjs/resources/apikeys.js +31 -0
- package/dist/cjs/resources/apikeys.js.map +1 -0
- package/dist/cjs/resources/asset.d.ts +17 -5
- package/dist/cjs/resources/asset.d.ts.map +1 -1
- package/dist/cjs/resources/asset.js +17 -6
- package/dist/cjs/resources/asset.js.map +1 -1
- package/dist/cjs/resources/bank.d.ts +11 -6
- package/dist/cjs/resources/bank.d.ts.map +1 -1
- package/dist/cjs/resources/bank.js +17 -9
- package/dist/cjs/resources/bank.js.map +1 -1
- package/dist/cjs/resources/core.d.ts +12 -0
- package/dist/cjs/resources/core.d.ts.map +1 -0
- package/dist/cjs/resources/core.js +22 -0
- package/dist/cjs/resources/core.js.map +1 -0
- package/dist/cjs/resources/custody.d.ts +27 -0
- package/dist/cjs/resources/custody.d.ts.map +1 -0
- package/dist/cjs/resources/custody.js +38 -0
- package/dist/cjs/resources/custody.js.map +1 -0
- package/dist/cjs/resources/customer.d.ts +20 -0
- package/dist/cjs/resources/customer.d.ts.map +1 -0
- package/dist/cjs/resources/customer.js +38 -0
- package/dist/cjs/resources/customer.js.map +1 -0
- package/dist/cjs/resources/staking.d.ts +32 -0
- package/dist/cjs/resources/staking.d.ts.map +1 -0
- package/dist/cjs/resources/staking.js +69 -0
- package/dist/cjs/resources/staking.js.map +1 -0
- package/dist/cjs/resources/trading.d.ts +24 -0
- package/dist/cjs/resources/trading.d.ts.map +1 -0
- package/dist/cjs/resources/trading.js +41 -0
- package/dist/cjs/resources/trading.js.map +1 -0
- package/dist/cjs/resources/transaction.d.ts +6 -9
- package/dist/cjs/resources/transaction.d.ts.map +1 -1
- package/dist/cjs/resources/transaction.js +10 -15
- package/dist/cjs/resources/transaction.js.map +1 -1
- package/dist/cjs/resources/webhooks.d.ts +46 -0
- package/dist/cjs/resources/webhooks.d.ts.map +1 -0
- package/dist/cjs/resources/webhooks.js +142 -0
- package/dist/cjs/resources/webhooks.js.map +1 -0
- package/dist/cjs/types/apikeys.d.ts +43 -0
- package/dist/cjs/types/apikeys.d.ts.map +1 -0
- package/dist/cjs/types/apikeys.js +3 -0
- package/dist/cjs/types/apikeys.js.map +1 -0
- package/dist/cjs/types/asset.d.ts +57 -0
- package/dist/cjs/types/asset.d.ts.map +1 -0
- package/dist/cjs/types/asset.js +3 -0
- package/dist/cjs/types/asset.js.map +1 -0
- package/dist/cjs/types/bank.d.ts +58 -0
- package/dist/cjs/types/bank.d.ts.map +1 -0
- package/dist/cjs/types/bank.js +3 -0
- package/dist/cjs/types/bank.js.map +1 -0
- package/dist/cjs/types/core.d.ts +32 -0
- package/dist/cjs/types/core.d.ts.map +1 -0
- package/dist/cjs/types/core.js +3 -0
- package/dist/cjs/types/core.js.map +1 -0
- package/dist/cjs/types/custody.d.ts +50 -0
- package/dist/cjs/types/custody.d.ts.map +1 -0
- package/dist/cjs/types/custody.js +3 -0
- package/dist/cjs/types/custody.js.map +1 -0
- package/dist/cjs/types/customer.d.ts +190 -0
- package/dist/cjs/types/customer.d.ts.map +1 -0
- package/dist/cjs/types/customer.js +3 -0
- package/dist/cjs/types/customer.js.map +1 -0
- package/dist/cjs/types/index.d.ts +78 -194
- package/dist/cjs/types/index.d.ts.map +1 -1
- package/dist/cjs/types/index.js +0 -1
- package/dist/cjs/types/index.js.map +1 -1
- package/dist/cjs/types/staking.d.ts +88 -0
- package/dist/cjs/types/staking.d.ts.map +1 -0
- package/dist/cjs/types/staking.js +3 -0
- package/dist/cjs/types/staking.js.map +1 -0
- package/dist/cjs/types/trading.d.ts +51 -0
- package/dist/cjs/types/trading.d.ts.map +1 -0
- package/dist/cjs/types/trading.js +3 -0
- package/dist/cjs/types/trading.js.map +1 -0
- package/dist/cjs/types/transaction.d.ts +61 -0
- package/dist/cjs/types/transaction.d.ts.map +1 -0
- package/dist/cjs/types/transaction.js +3 -0
- package/dist/cjs/types/transaction.js.map +1 -0
- package/dist/cjs/types/webhooks.d.ts +55 -0
- package/dist/cjs/types/webhooks.d.ts.map +1 -0
- package/dist/cjs/types/webhooks.js +3 -0
- package/dist/cjs/types/webhooks.js.map +1 -0
- package/dist/cjs/utils.d.ts +21 -2
- package/dist/cjs/utils.d.ts.map +1 -1
- package/dist/cjs/utils.js +67 -4
- package/dist/cjs/utils.js.map +1 -1
- package/dist/cjs/version.d.ts +2 -0
- package/dist/cjs/version.d.ts.map +1 -0
- package/dist/cjs/version.js +6 -0
- package/dist/cjs/version.js.map +1 -0
- package/dist/esm/client.d.ts +20 -8
- package/dist/esm/client.d.ts.map +1 -1
- package/dist/esm/client.js +33 -12
- package/dist/esm/client.js.map +1 -1
- package/dist/esm/constants.d.ts +256 -0
- package/dist/esm/constants.d.ts.map +1 -0
- package/dist/esm/constants.js +211 -0
- package/dist/esm/constants.js.map +1 -0
- package/dist/esm/error.d.ts +17 -10
- package/dist/esm/error.d.ts.map +1 -1
- package/dist/esm/error.js +24 -6
- package/dist/esm/error.js.map +1 -1
- package/dist/esm/http.d.ts +13 -8
- package/dist/esm/http.d.ts.map +1 -1
- package/dist/esm/http.js +136 -45
- package/dist/esm/http.js.map +1 -1
- package/dist/esm/index.d.ts +14 -1
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +6 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/resources/apikeys.d.ts +18 -0
- package/dist/esm/resources/apikeys.d.ts.map +1 -0
- package/dist/esm/resources/apikeys.js +27 -0
- package/dist/esm/resources/apikeys.js.map +1 -0
- package/dist/esm/resources/asset.d.ts +17 -5
- package/dist/esm/resources/asset.d.ts.map +1 -1
- package/dist/esm/resources/asset.js +17 -6
- package/dist/esm/resources/asset.js.map +1 -1
- package/dist/esm/resources/bank.d.ts +11 -6
- package/dist/esm/resources/bank.d.ts.map +1 -1
- package/dist/esm/resources/bank.js +18 -10
- package/dist/esm/resources/bank.js.map +1 -1
- package/dist/esm/resources/core.d.ts +12 -0
- package/dist/esm/resources/core.d.ts.map +1 -0
- package/dist/esm/resources/core.js +18 -0
- package/dist/esm/resources/core.js.map +1 -0
- package/dist/esm/resources/custody.d.ts +27 -0
- package/dist/esm/resources/custody.d.ts.map +1 -0
- package/dist/esm/resources/custody.js +34 -0
- package/dist/esm/resources/custody.js.map +1 -0
- package/dist/esm/resources/customer.d.ts +20 -0
- package/dist/esm/resources/customer.d.ts.map +1 -0
- package/dist/esm/resources/customer.js +34 -0
- package/dist/esm/resources/customer.js.map +1 -0
- package/dist/esm/resources/staking.d.ts +32 -0
- package/dist/esm/resources/staking.d.ts.map +1 -0
- package/dist/esm/resources/staking.js +65 -0
- package/dist/esm/resources/staking.js.map +1 -0
- package/dist/esm/resources/trading.d.ts +24 -0
- package/dist/esm/resources/trading.d.ts.map +1 -0
- package/dist/esm/resources/trading.js +37 -0
- package/dist/esm/resources/trading.js.map +1 -0
- package/dist/esm/resources/transaction.d.ts +6 -9
- package/dist/esm/resources/transaction.d.ts.map +1 -1
- package/dist/esm/resources/transaction.js +11 -16
- package/dist/esm/resources/transaction.js.map +1 -1
- package/dist/esm/resources/webhooks.d.ts +46 -0
- package/dist/esm/resources/webhooks.d.ts.map +1 -0
- package/dist/esm/resources/webhooks.js +138 -0
- package/dist/esm/resources/webhooks.js.map +1 -0
- package/dist/esm/types/apikeys.d.ts +43 -0
- package/dist/esm/types/apikeys.d.ts.map +1 -0
- package/dist/esm/types/apikeys.js +2 -0
- package/dist/esm/types/apikeys.js.map +1 -0
- package/dist/esm/types/asset.d.ts +57 -0
- package/dist/esm/types/asset.d.ts.map +1 -0
- package/dist/esm/types/asset.js +2 -0
- package/dist/esm/types/asset.js.map +1 -0
- package/dist/esm/types/bank.d.ts +58 -0
- package/dist/esm/types/bank.d.ts.map +1 -0
- package/dist/esm/types/bank.js +2 -0
- package/dist/esm/types/bank.js.map +1 -0
- package/dist/esm/types/core.d.ts +32 -0
- package/dist/esm/types/core.d.ts.map +1 -0
- package/dist/esm/types/core.js +2 -0
- package/dist/esm/types/core.js.map +1 -0
- package/dist/esm/types/custody.d.ts +50 -0
- package/dist/esm/types/custody.d.ts.map +1 -0
- package/dist/esm/types/custody.js +2 -0
- package/dist/esm/types/custody.js.map +1 -0
- package/dist/esm/types/customer.d.ts +190 -0
- package/dist/esm/types/customer.d.ts.map +1 -0
- package/dist/esm/types/customer.js +2 -0
- package/dist/esm/types/customer.js.map +1 -0
- package/dist/esm/types/index.d.ts +78 -194
- package/dist/esm/types/index.d.ts.map +1 -1
- package/dist/esm/types/index.js +0 -1
- package/dist/esm/types/index.js.map +1 -1
- package/dist/esm/types/staking.d.ts +88 -0
- package/dist/esm/types/staking.d.ts.map +1 -0
- package/dist/esm/types/staking.js +2 -0
- package/dist/esm/types/staking.js.map +1 -0
- package/dist/esm/types/trading.d.ts +51 -0
- package/dist/esm/types/trading.d.ts.map +1 -0
- package/dist/esm/types/trading.js +2 -0
- package/dist/esm/types/trading.js.map +1 -0
- package/dist/esm/types/transaction.d.ts +61 -0
- package/dist/esm/types/transaction.d.ts.map +1 -0
- package/dist/esm/types/transaction.js +2 -0
- package/dist/esm/types/transaction.js.map +1 -0
- package/dist/esm/types/webhooks.d.ts +55 -0
- package/dist/esm/types/webhooks.d.ts.map +1 -0
- package/dist/esm/types/webhooks.js +2 -0
- package/dist/esm/types/webhooks.js.map +1 -0
- package/dist/esm/utils.d.ts +21 -2
- package/dist/esm/utils.d.ts.map +1 -1
- package/dist/esm/utils.js +62 -4
- package/dist/esm/utils.js.map +1 -1
- package/dist/esm/version.d.ts +2 -0
- package/dist/esm/version.d.ts.map +1 -0
- package/dist/esm/version.js +3 -0
- package/dist/esm/version.js.map +1 -0
- package/package.json +29 -12
- package/readme/concepts.md +128 -0
- package/readme/configuration.md +72 -0
- package/readme/errors.md +67 -0
- package/readme/installation.md +43 -0
- package/readme/media/activation.svg +58 -0
- package/readme/media/deposit-flow.svg +70 -0
- package/readme/media/order-buy.svg +43 -0
- package/readme/media/order-sell.svg +47 -0
- package/readme/media/purchase-flow.svg +61 -0
- package/readme/media/sale-flow.svg +61 -0
- package/readme/media/staking-position.svg +75 -0
- package/readme/media/transaction-lifecycle.svg +61 -0
- package/readme/media/webhook-delivery.svg +53 -0
- package/readme/media/withdrawal-flow.svg +64 -0
- package/readme/quick-start.md +87 -0
- package/readme/resource/apikeys.md +103 -0
- package/readme/resource/asset.md +121 -0
- package/readme/resource/bank.md +161 -0
- package/readme/resource/core.md +91 -0
- package/readme/resource/custody.md +166 -0
- package/readme/resource/customer.md +210 -0
- package/readme/resource/staking.md +281 -0
- package/readme/resource/trading.md +171 -0
- package/readme/resource/transaction.md +110 -0
- package/readme/resource/webhooks.md +309 -0
- package/src/client.ts +46 -0
- package/src/constants.ts +281 -0
- package/src/error.ts +36 -0
- package/src/http.ts +201 -0
- package/src/index.ts +111 -0
- package/src/resources/apikeys.ts +30 -0
- package/src/resources/asset.ts +28 -0
- package/src/resources/bank.ts +39 -0
- package/src/resources/core.ts +19 -0
- package/src/resources/custody.ts +37 -0
- package/src/resources/customer.ts +46 -0
- package/src/resources/staking.ts +88 -0
- package/src/resources/trading.ts +41 -0
- package/src/resources/transaction.ts +20 -0
- package/src/resources/webhooks.ts +169 -0
- package/src/types/apikeys.ts +35 -0
- package/src/types/asset.ts +59 -0
- package/src/types/bank.ts +60 -0
- package/src/types/core.ts +32 -0
- package/src/types/custody.ts +40 -0
- package/src/types/customer.ts +189 -0
- package/src/types/index.ts +215 -0
- package/src/types/staking.ts +87 -0
- package/src/types/trading.ts +56 -0
- package/src/types/transaction.ts +62 -0
- package/src/types/webhooks.ts +60 -0
- package/src/utils.ts +74 -0
- package/src/version.ts +2 -0
- package/dist/cjs/resources/order.d.ts +0 -17
- package/dist/cjs/resources/order.d.ts.map +0 -1
- package/dist/cjs/resources/order.js +0 -30
- package/dist/cjs/resources/order.js.map +0 -1
- package/dist/cjs/resources/stats.d.ts +0 -11
- package/dist/cjs/resources/stats.d.ts.map +0 -1
- package/dist/cjs/resources/stats.js +0 -18
- package/dist/cjs/resources/stats.js.map +0 -1
- package/dist/cjs/resources/user.d.ts +0 -22
- package/dist/cjs/resources/user.d.ts.map +0 -1
- package/dist/cjs/resources/user.js +0 -37
- package/dist/cjs/resources/user.js.map +0 -1
- package/dist/cjs/resources/wallet.d.ts +0 -11
- package/dist/cjs/resources/wallet.d.ts.map +0 -1
- package/dist/cjs/resources/wallet.js +0 -19
- package/dist/cjs/resources/wallet.js.map +0 -1
- package/dist/esm/resources/order.d.ts +0 -17
- package/dist/esm/resources/order.d.ts.map +0 -1
- package/dist/esm/resources/order.js +0 -26
- package/dist/esm/resources/order.js.map +0 -1
- package/dist/esm/resources/stats.d.ts +0 -11
- package/dist/esm/resources/stats.d.ts.map +0 -1
- package/dist/esm/resources/stats.js +0 -14
- package/dist/esm/resources/stats.js.map +0 -1
- package/dist/esm/resources/user.d.ts +0 -22
- package/dist/esm/resources/user.d.ts.map +0 -1
- package/dist/esm/resources/user.js +0 -33
- package/dist/esm/resources/user.js.map +0 -1
- package/dist/esm/resources/wallet.d.ts +0 -11
- package/dist/esm/resources/wallet.d.ts.map +0 -1
- package/dist/esm/resources/wallet.js +0 -15
- package/dist/esm/resources/wallet.js.map +0 -1
- package/dist/types/client.d.ts +0 -19
- package/dist/types/client.d.ts.map +0 -1
- package/dist/types/error.d.ts +0 -15
- package/dist/types/error.d.ts.map +0 -1
- package/dist/types/http.d.ts +0 -21
- package/dist/types/http.d.ts.map +0 -1
- package/dist/types/index.d.ts +0 -4
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/resources/asset.d.ts +0 -11
- package/dist/types/resources/asset.d.ts.map +0 -1
- package/dist/types/resources/bank.d.ts +0 -13
- package/dist/types/resources/bank.d.ts.map +0 -1
- package/dist/types/resources/order.d.ts +0 -17
- package/dist/types/resources/order.d.ts.map +0 -1
- package/dist/types/resources/stats.d.ts +0 -11
- package/dist/types/resources/stats.d.ts.map +0 -1
- package/dist/types/resources/transaction.d.ts +0 -15
- package/dist/types/resources/transaction.d.ts.map +0 -1
- package/dist/types/resources/user.d.ts +0 -22
- package/dist/types/resources/user.d.ts.map +0 -1
- package/dist/types/resources/wallet.d.ts +0 -11
- package/dist/types/resources/wallet.d.ts.map +0 -1
- package/dist/types/types/index.d.ts +0 -213
- package/dist/types/types/index.d.ts.map +0 -1
- package/dist/types/utils.d.ts +0 -7
- package/dist/types/utils.d.ts.map +0 -1
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import type { Env } from '../constants.js'
|
|
2
|
+
import type { Asset as AssetModel } from './asset.js'
|
|
3
|
+
import type { Account, Customer } from './customer.js'
|
|
4
|
+
import type { OrderUser } from './trading.js'
|
|
5
|
+
|
|
6
|
+
// ─── Client config ────────────────────────────────────────────────────────────
|
|
7
|
+
|
|
8
|
+
/** `'production' | 'sandbox' | 'staging' | 'localhost'` — the values of `Env` */
|
|
9
|
+
export type BitgenEnv = (typeof Env)[keyof typeof Env]
|
|
10
|
+
|
|
11
|
+
export interface BitgenConfig {
|
|
12
|
+
scope: string
|
|
13
|
+
apiKey: string
|
|
14
|
+
env?: BitgenEnv
|
|
15
|
+
host?: string
|
|
16
|
+
port?: number
|
|
17
|
+
isSsl?: boolean
|
|
18
|
+
/** Request timeout in seconds — default 30, `0` = no timeout. Expiry → `BitgenError { status: 0, code: 'request_timeout' }` */
|
|
19
|
+
timeout?: number
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// ─── Shared ───────────────────────────────────────────────────────────────────
|
|
23
|
+
|
|
24
|
+
/** `{ uuid }` — what a creation answers (`customer.create`, `bank.credit`, `staking.stake`, `webhooks.subscribe`); carries a customer's uuid where it is one */
|
|
25
|
+
export interface Created {
|
|
26
|
+
uuid: string
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** The asset of a wallet, an order, a movement, a connector — `{ uuid, iso, label }`; `iso` has the case the API stores: compare it case-insensitively */
|
|
30
|
+
export interface AssetRef {
|
|
31
|
+
uuid: string
|
|
32
|
+
iso: string
|
|
33
|
+
label: string
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** An asset as accepted by every method expecting one: its uuid or ISO code (`Asset.ETH`), or an `Asset` / `AssetRef` returned by the SDK — its uuid is then sent */
|
|
37
|
+
export type AssetInput = string | AssetModel | AssetRef
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* A user as a transaction or a staking movement references them — `{ uuid, state, login, account: { firstname, lastname, fin } }`:
|
|
41
|
+
* the customer (`owner`) or the compliance officer in charge (`assignee`). An `owner` carries the customer's uuid.
|
|
42
|
+
*/
|
|
43
|
+
export interface UserSummary {
|
|
44
|
+
uuid: string
|
|
45
|
+
state: string
|
|
46
|
+
/** Email */
|
|
47
|
+
login: string
|
|
48
|
+
account: { firstname: string, lastname: string | null, fin: string | null }
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** The hub an organization belongs to — `{ uuid, name }` */
|
|
52
|
+
export interface OrganizationHub {
|
|
53
|
+
uuid: string
|
|
54
|
+
name: string
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** An organization as a transaction or a staking movement references it — `hub` is only given on a transaction */
|
|
58
|
+
export interface OrganizationSummary {
|
|
59
|
+
uuid: string
|
|
60
|
+
state: string
|
|
61
|
+
name: string
|
|
62
|
+
hub?: OrganizationHub | null
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* A customer, as accepted by every method expecting one: their uuid (or an email, where the API resolves it) as a string,
|
|
67
|
+
* or one of the models that carry a customer's uuid — the `Created` of `customer.create`, a `Customer`, an `Account`,
|
|
68
|
+
* the `user` of an `Order`, the `owner` of a `Transaction` or of a `StakingMovement`. The SDK sends the uuid.
|
|
69
|
+
*/
|
|
70
|
+
export type UserRef = string | Created | Customer | Account | UserSummary | OrderUser
|
|
71
|
+
|
|
72
|
+
/** An amount as accepted by the SDK — always sent to the API as a string; prefer strings, a `number` only keeps ~15 significant digits */
|
|
73
|
+
export type Amount = string | number
|
|
74
|
+
|
|
75
|
+
/** Pagination query — `limit` default 10, max 50 (100 on `/transaction`) */
|
|
76
|
+
export interface PageParams {
|
|
77
|
+
offset?: number
|
|
78
|
+
limit?: number
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/** Paginated list: query `offset` / `limit` in, `{ count, items }` out */
|
|
82
|
+
export interface Page<T> {
|
|
83
|
+
count: number
|
|
84
|
+
items: T[]
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Time series returned by the API: `d` = last 24 h (hourly), `w`/`m` = daily,
|
|
89
|
+
* `y`/`all` = monthly. Each point is `[epoch seconds, value]`, last point = current value.
|
|
90
|
+
*/
|
|
91
|
+
export type History = Record<'d' | 'w' | 'm' | 'y' | 'all', [number, number][]>
|
|
92
|
+
|
|
93
|
+
// ─── Error ────────────────────────────────────────────────────────────────────
|
|
94
|
+
|
|
95
|
+
/** Error body sent by the API along with the real HTTP status */
|
|
96
|
+
export interface BitgenErrorBody {
|
|
97
|
+
error: true
|
|
98
|
+
/** Stable snake_case error code (e.g. `invalid_amount`), never a sentence */
|
|
99
|
+
message: string
|
|
100
|
+
/** HTTP status, duplicated in the body */
|
|
101
|
+
code: number
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// ─── Resources ────────────────────────────────────────────────────────────────
|
|
105
|
+
|
|
106
|
+
export type {
|
|
107
|
+
Asset,
|
|
108
|
+
AssetState,
|
|
109
|
+
AssetTicker,
|
|
110
|
+
AssetFees,
|
|
111
|
+
AssetNetwork,
|
|
112
|
+
AssetNetworkType,
|
|
113
|
+
} from './asset.js'
|
|
114
|
+
|
|
115
|
+
export type {
|
|
116
|
+
Locale,
|
|
117
|
+
CustomerState,
|
|
118
|
+
IdentityState,
|
|
119
|
+
IdentityMode,
|
|
120
|
+
OrganizationCategory,
|
|
121
|
+
KycIdentity,
|
|
122
|
+
KybIdentity,
|
|
123
|
+
Identity,
|
|
124
|
+
CustomerAccount,
|
|
125
|
+
CustomerClient,
|
|
126
|
+
CustomerSetup,
|
|
127
|
+
CollaboratorLink,
|
|
128
|
+
ManagerLink,
|
|
129
|
+
CustomerAlert,
|
|
130
|
+
CustomerBusiness,
|
|
131
|
+
Customer,
|
|
132
|
+
AccountAddress,
|
|
133
|
+
Account,
|
|
134
|
+
CreateCustomerParams,
|
|
135
|
+
CustomerListParams,
|
|
136
|
+
UpdateCustomerParams,
|
|
137
|
+
} from './customer.js'
|
|
138
|
+
|
|
139
|
+
export type {
|
|
140
|
+
BankDirection,
|
|
141
|
+
BankAccount,
|
|
142
|
+
BankOperation,
|
|
143
|
+
BankOperationsParams,
|
|
144
|
+
BankWithdrawParams,
|
|
145
|
+
BankCreditParams,
|
|
146
|
+
} from './bank.js'
|
|
147
|
+
|
|
148
|
+
export type {
|
|
149
|
+
WalletState,
|
|
150
|
+
WalletType,
|
|
151
|
+
Wallet,
|
|
152
|
+
CustodyPortfolio,
|
|
153
|
+
TravelRule,
|
|
154
|
+
CustodyWithdrawParams,
|
|
155
|
+
} from './custody.js'
|
|
156
|
+
|
|
157
|
+
export type {
|
|
158
|
+
OrderState,
|
|
159
|
+
OrderSide,
|
|
160
|
+
TradingDirection,
|
|
161
|
+
OrderUser,
|
|
162
|
+
OrderOrganization,
|
|
163
|
+
Order,
|
|
164
|
+
TradingOrderParams,
|
|
165
|
+
TradingListParams,
|
|
166
|
+
} from './trading.js'
|
|
167
|
+
|
|
168
|
+
export type {
|
|
169
|
+
TransactionState,
|
|
170
|
+
TransactionSource,
|
|
171
|
+
TransactionDirection,
|
|
172
|
+
TransactionAlert,
|
|
173
|
+
Transaction,
|
|
174
|
+
TransactionListParams,
|
|
175
|
+
} from './transaction.js'
|
|
176
|
+
|
|
177
|
+
export type {
|
|
178
|
+
CoreType,
|
|
179
|
+
CoreState,
|
|
180
|
+
CoreConfigField,
|
|
181
|
+
Core,
|
|
182
|
+
CoreListParams,
|
|
183
|
+
} from './core.js'
|
|
184
|
+
|
|
185
|
+
export type {
|
|
186
|
+
StakingMovementState,
|
|
187
|
+
StakingMovementKind,
|
|
188
|
+
StakingPositionState,
|
|
189
|
+
CoreRef,
|
|
190
|
+
StakingPosition,
|
|
191
|
+
StakingMovement,
|
|
192
|
+
StakingOperation,
|
|
193
|
+
StakingPortfolio,
|
|
194
|
+
StakeParams,
|
|
195
|
+
StakingListParams,
|
|
196
|
+
StakingAmountParams,
|
|
197
|
+
} from './staking.js'
|
|
198
|
+
|
|
199
|
+
export type {
|
|
200
|
+
WebhookEventName,
|
|
201
|
+
SubscriberState,
|
|
202
|
+
WebhookType,
|
|
203
|
+
Subscriber,
|
|
204
|
+
WebhookSubscriptions,
|
|
205
|
+
DeliveryLog,
|
|
206
|
+
WebhookEvent,
|
|
207
|
+
VerifyInput,
|
|
208
|
+
} from './webhooks.js'
|
|
209
|
+
|
|
210
|
+
export type {
|
|
211
|
+
ApikeyState,
|
|
212
|
+
Apikey,
|
|
213
|
+
ApikeyLog,
|
|
214
|
+
ApikeyListParams,
|
|
215
|
+
} from './apikeys.js'
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import type { Amount, AssetInput, AssetRef, History, OrganizationSummary, UserRef, UserSummary } from './index.js'
|
|
2
|
+
|
|
3
|
+
export type { StakingMovementState, StakingMovementKind, StakingPositionState } from '../constants.js'
|
|
4
|
+
import type { StakingMovementState, StakingMovementKind, StakingPositionState } from '../constants.js'
|
|
5
|
+
|
|
6
|
+
/** The position carried by a movement — its `uuid` is what `rewards` / `unstake` take */
|
|
7
|
+
export interface StakingPosition {
|
|
8
|
+
uuid: string
|
|
9
|
+
state: StakingPositionState
|
|
10
|
+
/** Net capital placed */
|
|
11
|
+
amount: string
|
|
12
|
+
error: string | null
|
|
13
|
+
data: { rewards?: string, lastRewardAt?: number }
|
|
14
|
+
createdAt: number
|
|
15
|
+
updatedAt: number
|
|
16
|
+
/** The provider */
|
|
17
|
+
core: CoreRef
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** The connector of a staking position — `{ uuid, name, label }` */
|
|
21
|
+
export interface CoreRef {
|
|
22
|
+
uuid: string
|
|
23
|
+
/** Connector identifier (`figment_sol`) */
|
|
24
|
+
name: string
|
|
25
|
+
label: string
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** A staking request — its `uuid` is what `stake` returns and `get` / `list` / `movements` handle */
|
|
29
|
+
export interface StakingMovement {
|
|
30
|
+
uuid: string
|
|
31
|
+
state: StakingMovementState
|
|
32
|
+
kind: StakingMovementKind
|
|
33
|
+
provider: string
|
|
34
|
+
amount: string
|
|
35
|
+
createdAt: number
|
|
36
|
+
updatedAt: number
|
|
37
|
+
staking: StakingPosition
|
|
38
|
+
/** The customer */
|
|
39
|
+
owner: UserSummary
|
|
40
|
+
asset: AssetRef
|
|
41
|
+
/** `hub` is never given here */
|
|
42
|
+
organization: OrganizationSummary | null
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface StakingOperation {
|
|
46
|
+
txId: string
|
|
47
|
+
movement: string | null
|
|
48
|
+
asset: string
|
|
49
|
+
kind: string
|
|
50
|
+
amount: string
|
|
51
|
+
price: number
|
|
52
|
+
value: number
|
|
53
|
+
/** Known events, but the API may send others: any string is accepted */
|
|
54
|
+
event: 'created' | 'pending' | 'validated' | 'failed' | 'reward' | 'claimed' | 'unstake' | 'closed' | (string & {})
|
|
55
|
+
provider: string
|
|
56
|
+
date: number
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export interface StakingPortfolio {
|
|
60
|
+
uuid: string
|
|
61
|
+
/** EUR */
|
|
62
|
+
balances: { capital: number, revenues: number }
|
|
63
|
+
histories: { capital: History, revenues: History }
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export interface StakeParams {
|
|
67
|
+
/** uuid or ISO code (`Asset.SOL`), or an `Asset` / `AssetRef` model — its uuid is sent */
|
|
68
|
+
asset: AssetInput
|
|
69
|
+
/** Crypto quantity — prefer a string */
|
|
70
|
+
amount: Amount
|
|
71
|
+
/** `uuid` or `name` of a `STAKING` core of the organization (see `providers()`) */
|
|
72
|
+
provider: string
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export interface StakingListParams {
|
|
76
|
+
/** Customer (unknown → `404 unknown_user`) */
|
|
77
|
+
user?: UserRef
|
|
78
|
+
/** Movement kind — any other value = all */
|
|
79
|
+
direction?: StakingMovementKind
|
|
80
|
+
offset?: number
|
|
81
|
+
limit?: number
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/** `amount` absent = everything (a full exit ignores the minimums) */
|
|
85
|
+
export interface StakingAmountParams {
|
|
86
|
+
amount?: Amount
|
|
87
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { Amount, AssetInput, AssetRef, UserRef } from './index.js'
|
|
2
|
+
|
|
3
|
+
export type { OrderState, OrderSide, TradingDirection } from '../constants.js'
|
|
4
|
+
import type { OrderState, OrderSide, TradingDirection } from '../constants.js'
|
|
5
|
+
|
|
6
|
+
export interface Order {
|
|
7
|
+
uuid: string
|
|
8
|
+
state: OrderState
|
|
9
|
+
side: OrderSide
|
|
10
|
+
/** BUY: EUR (`"25.00"`) — SELL: crypto quantity */
|
|
11
|
+
amount: string
|
|
12
|
+
reference: string | null
|
|
13
|
+
/** BUY: crypto quantity received — SELL: EUR credited */
|
|
14
|
+
received: number | null
|
|
15
|
+
/** EUR price of the token */
|
|
16
|
+
executedPrice: number | null
|
|
17
|
+
fee: number | null
|
|
18
|
+
completedAt: number | null
|
|
19
|
+
createdAt: number
|
|
20
|
+
user: OrderUser
|
|
21
|
+
organization: OrderOrganization
|
|
22
|
+
asset: AssetRef
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** The customer of an order — `{ uuid, login }`; carries the customer's uuid: accepted wherever a customer is expected */
|
|
26
|
+
export interface OrderUser {
|
|
27
|
+
uuid: string
|
|
28
|
+
/** Email */
|
|
29
|
+
login: string
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** The organization of an order — `{ uuid, name }` */
|
|
33
|
+
export interface OrderOrganization {
|
|
34
|
+
uuid: string
|
|
35
|
+
name: string
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface TradingOrderParams {
|
|
39
|
+
/** uuid or ISO code (`Asset.ETH`), or an `Asset` / `AssetRef` model — must be `AVAILABLE` */
|
|
40
|
+
asset: AssetInput
|
|
41
|
+
/** BUY: EUR, 2 decimals max, ≥ MIN_BUY_CRYPTO — SELL: crypto quantity, ≤ the asset's decimals, EUR value ≥ MIN_SELL_CRYPTO */
|
|
42
|
+
amount: Amount
|
|
43
|
+
/** Idempotency per (user, side, reference): replaying returns the existing order */
|
|
44
|
+
reference?: string
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export interface TradingListParams {
|
|
48
|
+
/** Customer uuid (unknown → `404 unknown_user`) */
|
|
49
|
+
user?: UserRef
|
|
50
|
+
/** `TradingDirection.BUY` or `TradingDirection.SELL` — absent = both sides */
|
|
51
|
+
direction?: TradingDirection
|
|
52
|
+
/** Only this asset: ISO code, uuid, or an `Asset` / `AssetRef` model */
|
|
53
|
+
asset?: AssetInput
|
|
54
|
+
offset?: number
|
|
55
|
+
limit?: number
|
|
56
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { AssetInput, OrganizationHub, OrganizationSummary, UserRef, UserSummary } from './index.js'
|
|
2
|
+
|
|
3
|
+
export type { TransactionState, TransactionSource, TransactionDirection } from '../constants.js'
|
|
4
|
+
import type { TransactionState, TransactionSource, TransactionDirection } from '../constants.js'
|
|
5
|
+
|
|
6
|
+
/** Compliance alert attached to a transaction */
|
|
7
|
+
export interface TransactionAlert {
|
|
8
|
+
uuid: string
|
|
9
|
+
state: 'OPEN' | 'RESOLVED' | 'DISMISSED' | 'DECLARATED' | 'CONFIRMED'
|
|
10
|
+
severity: 'SUCCESS' | 'WARNING' | 'CRITICAL'
|
|
11
|
+
type: 'KYT' | 'KYC_EXPIRE' | 'SUSPICIOUS_ACTIVITY' | 'AML' | 'SANCTIONS'
|
|
12
|
+
description: string
|
|
13
|
+
confidence: number
|
|
14
|
+
recommendation: string | null
|
|
15
|
+
factors: unknown
|
|
16
|
+
sources: Record<string, unknown>
|
|
17
|
+
history: unknown
|
|
18
|
+
incidentKey: string | null
|
|
19
|
+
createdAt: number
|
|
20
|
+
updatedAt: number
|
|
21
|
+
user: unknown
|
|
22
|
+
assignee: unknown
|
|
23
|
+
organization: unknown
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** Unified journal of fiat and crypto movements — created internally, never through REST */
|
|
27
|
+
export interface Transaction {
|
|
28
|
+
uuid: string
|
|
29
|
+
state: TransactionState
|
|
30
|
+
source: TransactionSource
|
|
31
|
+
direction: TransactionDirection
|
|
32
|
+
asset: string
|
|
33
|
+
amount: number
|
|
34
|
+
eurValue: number | null
|
|
35
|
+
reference: string | null
|
|
36
|
+
credited: boolean
|
|
37
|
+
/** Internal leg (staking, sale), not a customer operation */
|
|
38
|
+
silent: boolean
|
|
39
|
+
data: Record<string, unknown>
|
|
40
|
+
createdAt: number
|
|
41
|
+
updatedAt: number
|
|
42
|
+
/** The customer */
|
|
43
|
+
owner: UserSummary | null
|
|
44
|
+
/** The compliance officer assigned while the transaction is on hold */
|
|
45
|
+
assignee: UserSummary | null
|
|
46
|
+
organization: (OrganizationSummary & { hub: OrganizationHub | null }) | null
|
|
47
|
+
alert: TransactionAlert | null
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export interface TransactionListParams {
|
|
51
|
+
/** Customer uuid (unknown → `404 unknown_user`) */
|
|
52
|
+
user?: UserRef
|
|
53
|
+
/** One state (anything else → `400 invalid_transaction_state`) */
|
|
54
|
+
status?: TransactionState
|
|
55
|
+
source?: TransactionSource
|
|
56
|
+
direction?: TransactionDirection
|
|
57
|
+
/** Only this asset: ISO code, uuid, or an `Asset` / `AssetRef` model */
|
|
58
|
+
asset?: AssetInput
|
|
59
|
+
offset?: number
|
|
60
|
+
/** Max 100 on this list */
|
|
61
|
+
limit?: number
|
|
62
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
export type { WebhookEventName, SubscriberState } from '../constants.js'
|
|
2
|
+
import type { WebhookEventName, SubscriberState } from '../constants.js'
|
|
3
|
+
|
|
4
|
+
/** An event of the catalogue (`GET /webhook`) */
|
|
5
|
+
export interface WebhookType {
|
|
6
|
+
uuid: string
|
|
7
|
+
state: SubscriberState
|
|
8
|
+
name: string
|
|
9
|
+
/** Raw JSON `{"fr": "…", "en": "…"}` */
|
|
10
|
+
label: string
|
|
11
|
+
/** Raw JSON */
|
|
12
|
+
data: string
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/** A subscription of the organization to an event */
|
|
16
|
+
export interface Subscriber {
|
|
17
|
+
uuid: string
|
|
18
|
+
state: SubscriberState
|
|
19
|
+
updatedAt: number
|
|
20
|
+
webhook: WebhookType
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** `GET /webhooks/{organization}` — the HMAC secret, the endpoint and the subscriptions */
|
|
24
|
+
export interface WebhookSubscriptions {
|
|
25
|
+
secret: string
|
|
26
|
+
endpoint: string
|
|
27
|
+
items: Subscriber[]
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** One delivery attempt of a subscription (`GET /webhooks/{subscriber}/logs`) */
|
|
31
|
+
export interface DeliveryLog {
|
|
32
|
+
date: number
|
|
33
|
+
webhook: string
|
|
34
|
+
url: string
|
|
35
|
+
status: string
|
|
36
|
+
http_code: number | null
|
|
37
|
+
duration_ms: number | null
|
|
38
|
+
attempts: number
|
|
39
|
+
payload: Record<string, unknown>
|
|
40
|
+
error: string | null
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** Envelope delivered to the endpoint — `data` depends on the event */
|
|
44
|
+
export interface WebhookEvent {
|
|
45
|
+
delivery_id: string
|
|
46
|
+
timestamp: number
|
|
47
|
+
event: WebhookEventName
|
|
48
|
+
data: unknown
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface VerifyInput {
|
|
52
|
+
/** The bytes received, never a re-serialized JSON */
|
|
53
|
+
rawBody: string | Uint8Array
|
|
54
|
+
/** Headers as received (Node `IncomingHttpHeaders`) — names are matched case-insensitively */
|
|
55
|
+
headers: Record<string, string | string[] | undefined>
|
|
56
|
+
/** The organization's secret, from `list().secret` */
|
|
57
|
+
secret: string
|
|
58
|
+
/** Seconds, default 300 — `0` disables the freshness check */
|
|
59
|
+
tolerance?: number
|
|
60
|
+
}
|
package/src/utils.ts
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type { Amount, AssetInput, UserRef } from './types/index.js'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Resolve a UserRef (uuid or email string, or a model carrying a `uuid`) to its string.
|
|
5
|
+
* Used by all resource methods that accept a user parameter.
|
|
6
|
+
*/
|
|
7
|
+
export function resolveUuid(ref: UserRef): string {
|
|
8
|
+
const value = typeof ref === 'string' ? ref : ref?.uuid
|
|
9
|
+
if (typeof value !== 'string' || value.trim() === '') {
|
|
10
|
+
throw new TypeError('user must be a non-empty uuid or email, or a model with a non-empty uuid')
|
|
11
|
+
}
|
|
12
|
+
return value
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* The uuid of a reference given as a string (sent as is) or as a model carrying a `uuid` (an `Order`, a
|
|
17
|
+
* `StakingPosition`, an `Apikey`…). An empty string, or a model without one, is refused before any request.
|
|
18
|
+
*/
|
|
19
|
+
export function idOf(ref: string | { uuid: string }, name: string): string {
|
|
20
|
+
const value = typeof ref === 'string' ? ref : ref?.uuid
|
|
21
|
+
if (typeof value !== 'string' || value.trim() === '') {
|
|
22
|
+
throw new TypeError(`${name} must be a non-empty string, or a model with a non-empty uuid`)
|
|
23
|
+
}
|
|
24
|
+
return value
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** An asset as given — a uuid or ISO code string as is, or the uuid of an `Asset` / `AssetRef` model; empty → `TypeError` before any request */
|
|
28
|
+
export function assetId(asset: AssetInput): string {
|
|
29
|
+
const value = typeof asset === 'string' ? asset : asset?.uuid
|
|
30
|
+
if (typeof value !== 'string' || value.trim() === '') {
|
|
31
|
+
throw new TypeError('asset must be a uuid or an ISO code, or a model with a non-empty uuid')
|
|
32
|
+
}
|
|
33
|
+
return value
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** An optional asset filter of a list: absent or `null` stays absent, otherwise `assetId` */
|
|
37
|
+
export function assetFilter(asset: AssetInput | null | undefined): string | undefined {
|
|
38
|
+
return asset === undefined || asset === null ? undefined : assetId(asset)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** Validate and encode a value used as a path segment (`/asset/{asset}`, `/account/{user}`…) */
|
|
42
|
+
export function pathSegment(value: string, name: string): string {
|
|
43
|
+
if (typeof value !== 'string' || value.trim() === '') {
|
|
44
|
+
throw new TypeError(`${name} must be a non-empty string`)
|
|
45
|
+
}
|
|
46
|
+
// `.` and `..` are not encoded by encodeURIComponent and would be normalized away by the URL parser
|
|
47
|
+
if (value === '.' || value === '..') {
|
|
48
|
+
throw new TypeError(`${name} must not be "." or ".."`)
|
|
49
|
+
}
|
|
50
|
+
return encodeURIComponent(value)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Normalize an amount for the API, which always receives a string: a string is sent as is
|
|
55
|
+
* (trimmed), a finite number ≥ 0 is converted with `String(n)`. Numbers that `String()` writes
|
|
56
|
+
* in exponent notation (below 1e-6 or from 1e21) are refused: pass them as strings.
|
|
57
|
+
*/
|
|
58
|
+
export function amount(value: Amount): string {
|
|
59
|
+
if (typeof value === 'string') {
|
|
60
|
+
const trimmed = value.trim()
|
|
61
|
+
if (trimmed === '') {
|
|
62
|
+
throw new TypeError('amount must be a non-empty string or a finite number >= 0')
|
|
63
|
+
}
|
|
64
|
+
return trimmed
|
|
65
|
+
}
|
|
66
|
+
if (typeof value !== 'number' || !Number.isFinite(value) || value < 0) {
|
|
67
|
+
throw new TypeError('amount must be a non-empty string or a finite number >= 0')
|
|
68
|
+
}
|
|
69
|
+
const text = String(value)
|
|
70
|
+
if (text.includes('e')) {
|
|
71
|
+
throw new TypeError(`amount ${text} would be sent in exponent notation: pass it as a decimal string`)
|
|
72
|
+
}
|
|
73
|
+
return text
|
|
74
|
+
}
|
package/src/version.ts
ADDED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { HttpClient } from '../http.js';
|
|
2
|
-
import type { CreateOrderParams, CreatedOrder, Order, UserRef } from '../types/index.js';
|
|
3
|
-
export declare class OrderResource {
|
|
4
|
-
private readonly http;
|
|
5
|
-
constructor(http: HttpClient);
|
|
6
|
-
/**
|
|
7
|
-
* Create a buy or sell order.
|
|
8
|
-
* - BUY: amount is in EUR → delivers the target asset
|
|
9
|
-
* - SELL: amount is in asset units → delivers EUR
|
|
10
|
-
*/
|
|
11
|
-
create(params: CreateOrderParams): Promise<CreatedOrder>;
|
|
12
|
-
/** Get the current status of an order by its tunnel ID */
|
|
13
|
-
get(tunnel: string): Promise<Order>;
|
|
14
|
-
/** Get full order history for a user */
|
|
15
|
-
history(user: UserRef): Promise<Order[]>;
|
|
16
|
-
}
|
|
17
|
-
//# sourceMappingURL=order.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"order.d.ts","sourceRoot":"","sources":["../../../src/resources/order.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAC5C,OAAO,KAAK,EACV,iBAAiB,EACjB,YAAY,EACZ,KAAK,EACL,OAAO,EACR,MAAM,mBAAmB,CAAA;AAG1B,qBAAa,aAAa;IACZ,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,UAAU;IAE7C;;;;OAIG;IACH,MAAM,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,YAAY,CAAC;IAOxD,0DAA0D;IAC1D,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC;IAInC,wCAAwC;IACxC,OAAO,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC;CAGzC"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.OrderResource = void 0;
|
|
4
|
-
const utils_js_1 = require("../utils.js");
|
|
5
|
-
class OrderResource {
|
|
6
|
-
constructor(http) {
|
|
7
|
-
this.http = http;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Create a buy or sell order.
|
|
11
|
-
* - BUY: amount is in EUR → delivers the target asset
|
|
12
|
-
* - SELL: amount is in asset units → delivers EUR
|
|
13
|
-
*/
|
|
14
|
-
create(params) {
|
|
15
|
-
return this.http.post('/api/v3/order', {
|
|
16
|
-
...params,
|
|
17
|
-
user: (0, utils_js_1.resolveUuid)(params.user),
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
/** Get the current status of an order by its tunnel ID */
|
|
21
|
-
get(tunnel) {
|
|
22
|
-
return this.http.get(`/api/v3/order/${tunnel}`);
|
|
23
|
-
}
|
|
24
|
-
/** Get full order history for a user */
|
|
25
|
-
history(user) {
|
|
26
|
-
return this.http.get(`/api/v3/orders/${(0, utils_js_1.resolveUuid)(user)}`);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
exports.OrderResource = OrderResource;
|
|
30
|
-
//# sourceMappingURL=order.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"order.js","sourceRoot":"","sources":["../../../src/resources/order.ts"],"names":[],"mappings":";;;AAOA,0CAAyC;AAEzC,MAAa,aAAa;IACxB,YAA6B,IAAgB;QAAhB,SAAI,GAAJ,IAAI,CAAY;IAAG,CAAC;IAEjD;;;;OAIG;IACH,MAAM,CAAC,MAAyB;QAC9B,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAe,eAAe,EAAE;YACnD,GAAG,MAAM;YACT,IAAI,EAAE,IAAA,sBAAW,EAAC,MAAM,CAAC,IAAI,CAAC;SAC/B,CAAC,CAAA;IACJ,CAAC;IAED,0DAA0D;IAC1D,GAAG,CAAC,MAAc;QAChB,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAQ,iBAAiB,MAAM,EAAE,CAAC,CAAA;IACxD,CAAC;IAED,wCAAwC;IACxC,OAAO,CAAC,IAAa;QACnB,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAU,kBAAkB,IAAA,sBAAW,EAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IACtE,CAAC;CACF;AAxBD,sCAwBC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { HttpClient } from '../http.js';
|
|
2
|
-
import type { HealthCheck, Stats } from '../types/index.js';
|
|
3
|
-
export declare class StatsResource {
|
|
4
|
-
private readonly http;
|
|
5
|
-
constructor(http: HttpClient);
|
|
6
|
-
/** Check API health */
|
|
7
|
-
health(): Promise<HealthCheck>;
|
|
8
|
-
/** Get service quotas (user slots, etc.) */
|
|
9
|
-
quotas(): Promise<Stats>;
|
|
10
|
-
}
|
|
11
|
-
//# sourceMappingURL=stats.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"stats.d.ts","sourceRoot":"","sources":["../../../src/resources/stats.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAC5C,OAAO,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAE3D,qBAAa,aAAa;IACZ,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,UAAU;IAE7C,uBAAuB;IACvB,MAAM,IAAI,OAAO,CAAC,WAAW,CAAC;IAI9B,4CAA4C;IAC5C,MAAM,IAAI,OAAO,CAAC,KAAK,CAAC;CAGzB"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.StatsResource = void 0;
|
|
4
|
-
class StatsResource {
|
|
5
|
-
constructor(http) {
|
|
6
|
-
this.http = http;
|
|
7
|
-
}
|
|
8
|
-
/** Check API health */
|
|
9
|
-
health() {
|
|
10
|
-
return this.http.get('/health');
|
|
11
|
-
}
|
|
12
|
-
/** Get service quotas (user slots, etc.) */
|
|
13
|
-
quotas() {
|
|
14
|
-
return this.http.get('/api/v3/stats');
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
exports.StatsResource = StatsResource;
|
|
18
|
-
//# sourceMappingURL=stats.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"stats.js","sourceRoot":"","sources":["../../../src/resources/stats.ts"],"names":[],"mappings":";;;AAGA,MAAa,aAAa;IACxB,YAA6B,IAAgB;QAAhB,SAAI,GAAJ,IAAI,CAAY;IAAG,CAAC;IAEjD,uBAAuB;IACvB,MAAM;QACJ,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAc,SAAS,CAAC,CAAA;IAC9C,CAAC;IAED,4CAA4C;IAC5C,MAAM;QACJ,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAQ,eAAe,CAAC,CAAA;IAC9C,CAAC;CACF;AAZD,sCAYC"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { HttpClient } from '../http.js';
|
|
2
|
-
import type { CreateUserParams, UserDetail, UserList, UserListParams, UpdateUserParams, UserRef } from '../types/index.js';
|
|
3
|
-
export declare class UserResource {
|
|
4
|
-
private readonly http;
|
|
5
|
-
constructor(http: HttpClient);
|
|
6
|
-
/** Create a new user — returns their UUID */
|
|
7
|
-
create(params: CreateUserParams): Promise<{
|
|
8
|
-
uuid: string;
|
|
9
|
-
}>;
|
|
10
|
-
/** List all users (paginated) */
|
|
11
|
-
list(params: UserListParams): Promise<UserList>;
|
|
12
|
-
/** Get full user details (profile, wallets, bank) by UUID or User object */
|
|
13
|
-
get(user: UserRef): Promise<UserDetail>;
|
|
14
|
-
/** Update a user's profile — returns nothing on success (204) */
|
|
15
|
-
update(user: UserRef, params: UpdateUserParams): Promise<void>;
|
|
16
|
-
/**
|
|
17
|
-
* Soft-disable a user account.
|
|
18
|
-
* Data is retained — this is not a permanent deletion.
|
|
19
|
-
*/
|
|
20
|
-
disable(user: UserRef): Promise<void>;
|
|
21
|
-
}
|
|
22
|
-
//# sourceMappingURL=user.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"user.d.ts","sourceRoot":"","sources":["../../../src/resources/user.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAC5C,OAAO,KAAK,EACV,gBAAgB,EAChB,UAAU,EACV,QAAQ,EACR,cAAc,EACd,gBAAgB,EAChB,OAAO,EACR,MAAM,mBAAmB,CAAA;AAG1B,qBAAa,YAAY;IACX,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,UAAU;IAE7C,6CAA6C;IAC7C,MAAM,CAAC,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IAI3D,iCAAiC;IACjC,IAAI,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,QAAQ,CAAC;IAO/C,4EAA4E;IAC5E,GAAG,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC;IAIvC,iEAAiE;IACjE,MAAM,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;IAI9D;;;OAGG;IACH,OAAO,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;CAGtC"}
|