@bitgen/sdk 0.1.5 → 1.0.3
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 +55 -0
- 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 -43
- 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 +79 -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 -44
- 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 +79 -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 +104 -0
- package/readme/configuration.md +72 -0
- package/readme/errors.md +67 -0
- package/readme/installation.md +43 -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 +156 -0
- package/readme/resource/core.md +91 -0
- package/readme/resource/custody.md +166 -0
- package/readme/resource/customer.md +208 -0
- package/readme/resource/staking.md +277 -0
- package/readme/resource/trading.md +166 -0
- package/readme/resource/transaction.md +106 -0
- package/readme/resource/webhooks.md +307 -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 -212
- 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,256 @@
|
|
|
1
|
+
/** Target environment — value goes in `BitgenConfig.env` (`env: Env.PRODUCTION`) */
|
|
2
|
+
export declare const Env: Readonly<{
|
|
3
|
+
readonly PRODUCTION: "production";
|
|
4
|
+
readonly SANDBOX: "sandbox";
|
|
5
|
+
readonly STAGING: "staging";
|
|
6
|
+
readonly LOCALHOST: "localhost";
|
|
7
|
+
}>;
|
|
8
|
+
/**
|
|
9
|
+
* Asset ISO codes, accepted wherever an asset is expected (the API takes a uuid or an iso in any case).
|
|
10
|
+
* The `iso` returned by the API has its stored case (`ETH` today): compare it case-insensitively.
|
|
11
|
+
* Provisional list — extended once the production list is confirmed.
|
|
12
|
+
*/
|
|
13
|
+
export declare const Asset: Readonly<{
|
|
14
|
+
readonly BTC: "btc";
|
|
15
|
+
readonly ETH: "eth";
|
|
16
|
+
readonly USDC: "usdc";
|
|
17
|
+
readonly XRP: "xrp";
|
|
18
|
+
readonly SOL: "sol";
|
|
19
|
+
}>;
|
|
20
|
+
/** States of an API key — `Apikey.state`; `client.apikeys.list` leaves the `REVOKED` ones out unless `includeRevoked` */
|
|
21
|
+
export declare const ApikeyState: Readonly<{
|
|
22
|
+
readonly ENABLED: "ENABLED";
|
|
23
|
+
readonly REVOKED: "REVOKED";
|
|
24
|
+
}>;
|
|
25
|
+
/** The values of `ApikeyState` */
|
|
26
|
+
export type ApikeyState = (typeof ApikeyState)[keyof typeof ApikeyState];
|
|
27
|
+
/** States of an asset — `Asset.state` is a string, compare it with `AssetState.AVAILABLE` */
|
|
28
|
+
export declare const AssetState: Readonly<{
|
|
29
|
+
readonly AVAILABLE: "AVAILABLE";
|
|
30
|
+
readonly UNAVAILABLE: "UNAVAILABLE";
|
|
31
|
+
readonly ARCHIVED: "ARCHIVED";
|
|
32
|
+
readonly HIDDEN: "HIDDEN";
|
|
33
|
+
}>;
|
|
34
|
+
/** The values of `AssetState` */
|
|
35
|
+
export type AssetState = (typeof AssetState)[keyof typeof AssetState];
|
|
36
|
+
/** Filter of the EUR operations (`client.bank.operations`) — `ALL` (default), or one kind */
|
|
37
|
+
export declare const BankDirection: Readonly<{
|
|
38
|
+
readonly ALL: "ALL";
|
|
39
|
+
readonly DEPOSIT: "DEPOSIT";
|
|
40
|
+
readonly WITHDRAWAL: "WITHDRAWAL";
|
|
41
|
+
readonly PURCHASE: "PURCHASE";
|
|
42
|
+
readonly SELL: "SELL";
|
|
43
|
+
}>;
|
|
44
|
+
/** The values of `BankDirection` */
|
|
45
|
+
export type BankDirection = (typeof BankDirection)[keyof typeof BankDirection];
|
|
46
|
+
/** States of a connector — `Core.state`; also the `state` filter of `client.core.list` */
|
|
47
|
+
export declare const CoreState: Readonly<{
|
|
48
|
+
readonly ENABLED: "ENABLED";
|
|
49
|
+
readonly DISABLED: "DISABLED";
|
|
50
|
+
}>;
|
|
51
|
+
/** The values of `CoreState` */
|
|
52
|
+
export type CoreState = (typeof CoreState)[keyof typeof CoreState];
|
|
53
|
+
/** Kinds of connectors — `Core.type`; also the `type` filter of `client.core.list` */
|
|
54
|
+
export declare const CoreType: Readonly<{
|
|
55
|
+
/** Identity verification service */
|
|
56
|
+
readonly IDENTITY: "IDENTITY";
|
|
57
|
+
/** Anti-money-laundering service */
|
|
58
|
+
readonly AML: "AML";
|
|
59
|
+
/** Exchange */
|
|
60
|
+
readonly TRADING: "TRADING";
|
|
61
|
+
/** Custodian */
|
|
62
|
+
readonly CUSTODY: "CUSTODY";
|
|
63
|
+
/** Staking provider */
|
|
64
|
+
readonly STAKING: "STAKING";
|
|
65
|
+
/** Bank */
|
|
66
|
+
readonly RAMP: "RAMP";
|
|
67
|
+
}>;
|
|
68
|
+
/** The values of `CoreType` */
|
|
69
|
+
export type CoreType = (typeof CoreType)[keyof typeof CoreType];
|
|
70
|
+
/** States of a customer — `Customer.state`, compare it with `CustomerState.ENABLED` */
|
|
71
|
+
export declare const CustomerState: Readonly<{
|
|
72
|
+
readonly CREATED: "CREATED";
|
|
73
|
+
readonly ENABLED: "ENABLED";
|
|
74
|
+
readonly CLOSED: "CLOSED";
|
|
75
|
+
readonly FROZEN: "FROZEN";
|
|
76
|
+
}>;
|
|
77
|
+
/** The values of `CustomerState` */
|
|
78
|
+
export type CustomerState = (typeof CustomerState)[keyof typeof CustomerState];
|
|
79
|
+
/** `KYC` (a person) or `KYB` (a business) — `Identity.mode` */
|
|
80
|
+
export declare const IdentityMode: Readonly<{
|
|
81
|
+
readonly KYC: "KYC";
|
|
82
|
+
readonly KYB: "KYB";
|
|
83
|
+
}>;
|
|
84
|
+
/** The values of `IdentityMode` */
|
|
85
|
+
export type IdentityMode = (typeof IdentityMode)[keyof typeof IdentityMode];
|
|
86
|
+
/** States of an identity file — `Identity.state` */
|
|
87
|
+
export declare const IdentityState: Readonly<{
|
|
88
|
+
readonly CREATED: "CREATED";
|
|
89
|
+
readonly IN_PROGRESS: "IN_PROGRESS";
|
|
90
|
+
readonly WAIT: "WAIT";
|
|
91
|
+
readonly PENDING: "PENDING";
|
|
92
|
+
readonly VALIDATED: "VALIDATED";
|
|
93
|
+
readonly REJECTED: "REJECTED";
|
|
94
|
+
readonly FROZEN: "FROZEN";
|
|
95
|
+
readonly EXPIRED: "EXPIRED";
|
|
96
|
+
readonly CLOSED: "CLOSED";
|
|
97
|
+
}>;
|
|
98
|
+
/** The values of `IdentityState` */
|
|
99
|
+
export type IdentityState = (typeof IdentityState)[keyof typeof IdentityState];
|
|
100
|
+
/** Language of the BITGEN web application and of the emails — `Locale.FR` (default) or `Locale.EN` */
|
|
101
|
+
export declare const Locale: Readonly<{
|
|
102
|
+
readonly FR: "FR";
|
|
103
|
+
readonly EN: "EN";
|
|
104
|
+
}>;
|
|
105
|
+
/** The values of `Locale` */
|
|
106
|
+
export type Locale = (typeof Locale)[keyof typeof Locale];
|
|
107
|
+
/** Side of an order — `Order.side` */
|
|
108
|
+
export declare const OrderSide: Readonly<{
|
|
109
|
+
readonly BUY: "BUY";
|
|
110
|
+
readonly SELL: "SELL";
|
|
111
|
+
}>;
|
|
112
|
+
/** The values of `OrderSide` */
|
|
113
|
+
export type OrderSide = (typeof OrderSide)[keyof typeof OrderSide];
|
|
114
|
+
/** States of an order — `Order.state`. A purchase goes `REGISTERED` → `EXECUTING` → `FILLED` → `DELIVERING` → `DONE`; a sale `REGISTERED` → `TRANSFERRING` → `DEPOSITED` → `EXECUTING` → `FILLED` → `DONE`. `PARKED`: executed but nothing was received (terminal); `FAILED` */
|
|
115
|
+
export declare const OrderState: Readonly<{
|
|
116
|
+
readonly REGISTERED: "REGISTERED";
|
|
117
|
+
readonly TRANSFERRING: "TRANSFERRING";
|
|
118
|
+
readonly DEPOSITED: "DEPOSITED";
|
|
119
|
+
readonly EXECUTING: "EXECUTING";
|
|
120
|
+
readonly FILLED: "FILLED";
|
|
121
|
+
readonly DELIVERING: "DELIVERING";
|
|
122
|
+
readonly DONE: "DONE";
|
|
123
|
+
readonly PARKED: "PARKED";
|
|
124
|
+
readonly FAILED: "FAILED";
|
|
125
|
+
}>;
|
|
126
|
+
/** The values of `OrderState` */
|
|
127
|
+
export type OrderState = (typeof OrderState)[keyof typeof OrderState];
|
|
128
|
+
/** Category of a customer — the `organization` of `client.customer.create` (`CUSTOMER` by default; `B2B` also opens a KYB file) and `setup.choosenOrganization` */
|
|
129
|
+
export declare const OrganizationCategory: Readonly<{
|
|
130
|
+
readonly CUSTOMER: "CUSTOMER";
|
|
131
|
+
readonly B2B: "B2B";
|
|
132
|
+
}>;
|
|
133
|
+
/** The values of `OrganizationCategory` */
|
|
134
|
+
export type OrganizationCategory = (typeof OrganizationCategory)[keyof typeof OrganizationCategory];
|
|
135
|
+
/** Kinds of staking movements — `StakingMovement.kind`; also the `direction` filter of `client.staking.list` / `movements` */
|
|
136
|
+
export declare const StakingMovementKind: Readonly<{
|
|
137
|
+
readonly STAKE: "STAKE";
|
|
138
|
+
readonly UNSTAKE: "UNSTAKE";
|
|
139
|
+
readonly WITHDRAW: "WITHDRAW";
|
|
140
|
+
readonly REWARD: "REWARD";
|
|
141
|
+
}>;
|
|
142
|
+
/** The values of `StakingMovementKind` */
|
|
143
|
+
export type StakingMovementKind = (typeof StakingMovementKind)[keyof typeof StakingMovementKind];
|
|
144
|
+
/** States of a staking movement — `StakingMovement.state` */
|
|
145
|
+
export declare const StakingMovementState: Readonly<{
|
|
146
|
+
readonly REQUESTED: "REQUESTED";
|
|
147
|
+
readonly PENDING: "PENDING";
|
|
148
|
+
readonly COMPLETED: "COMPLETED";
|
|
149
|
+
readonly FAILED: "FAILED";
|
|
150
|
+
readonly CANCELED: "CANCELED";
|
|
151
|
+
}>;
|
|
152
|
+
/** The values of `StakingMovementState` */
|
|
153
|
+
export type StakingMovementState = (typeof StakingMovementState)[keyof typeof StakingMovementState];
|
|
154
|
+
/** States of a staking position — `StakingPosition.state` */
|
|
155
|
+
export declare const StakingPositionState: Readonly<{
|
|
156
|
+
readonly CREATED: "CREATED";
|
|
157
|
+
readonly ENABLED: "ENABLED";
|
|
158
|
+
readonly UNSTAKING: "UNSTAKING";
|
|
159
|
+
readonly CLOSED: "CLOSED";
|
|
160
|
+
readonly FAILED: "FAILED";
|
|
161
|
+
}>;
|
|
162
|
+
/** The values of `StakingPositionState` */
|
|
163
|
+
export type StakingPositionState = (typeof StakingPositionState)[keyof typeof StakingPositionState];
|
|
164
|
+
/** States of a webhook subscription (`Subscriber.state`) and of an event of the catalogue (`WebhookType.state`) — `ARCHIVED` ones are left out of `client.webhooks.list` unless `includeArchived` */
|
|
165
|
+
export declare const SubscriberState: Readonly<{
|
|
166
|
+
readonly ENABLED: "ENABLED";
|
|
167
|
+
readonly ARCHIVED: "ARCHIVED";
|
|
168
|
+
}>;
|
|
169
|
+
/** The values of `SubscriberState` */
|
|
170
|
+
export type SubscriberState = (typeof SubscriberState)[keyof typeof SubscriberState];
|
|
171
|
+
/** Filter of `client.trading.list`: only purchases, or only sales — lowercase, as the API expects it */
|
|
172
|
+
export declare const TradingDirection: Readonly<{
|
|
173
|
+
readonly BUY: "buy";
|
|
174
|
+
readonly SELL: "sell";
|
|
175
|
+
}>;
|
|
176
|
+
/** The values of `TradingDirection` */
|
|
177
|
+
export type TradingDirection = (typeof TradingDirection)[keyof typeof TradingDirection];
|
|
178
|
+
/** Direction of a transaction — `Transaction.direction`; also a filter of `client.transaction.list` */
|
|
179
|
+
export declare const TransactionDirection: Readonly<{
|
|
180
|
+
readonly IN: "IN";
|
|
181
|
+
readonly OUT: "OUT";
|
|
182
|
+
}>;
|
|
183
|
+
/** The values of `TransactionDirection` */
|
|
184
|
+
export type TransactionDirection = (typeof TransactionDirection)[keyof typeof TransactionDirection];
|
|
185
|
+
/** Where a transaction comes from: the EUR account (`BANK`) or a custody wallet (`CUSTODY`) — `Transaction.source`; also a filter of `client.transaction.list` */
|
|
186
|
+
export declare const TransactionSource: Readonly<{
|
|
187
|
+
readonly BANK: "BANK";
|
|
188
|
+
readonly CUSTODY: "CUSTODY";
|
|
189
|
+
}>;
|
|
190
|
+
/** The values of `TransactionSource` */
|
|
191
|
+
export type TransactionSource = (typeof TransactionSource)[keyof typeof TransactionSource];
|
|
192
|
+
/** States of a transaction (`TRANSFERING` is the API's spelling) — `Transaction.state`; also the `status` filter of `client.transaction.list` */
|
|
193
|
+
export declare const TransactionState: Readonly<{
|
|
194
|
+
readonly ANALYZING: "ANALYZING";
|
|
195
|
+
readonly PENDING: "PENDING";
|
|
196
|
+
readonly COMPLETED: "COMPLETED";
|
|
197
|
+
readonly FROZEN: "FROZEN";
|
|
198
|
+
readonly FAILED: "FAILED";
|
|
199
|
+
readonly TRANSFERING: "TRANSFERING";
|
|
200
|
+
readonly SEIZED: "SEIZED";
|
|
201
|
+
}>;
|
|
202
|
+
/** The values of `TransactionState` */
|
|
203
|
+
export type TransactionState = (typeof TransactionState)[keyof typeof TransactionState];
|
|
204
|
+
/** States of a wallet — `Wallet.state` */
|
|
205
|
+
export declare const WalletState: Readonly<{
|
|
206
|
+
readonly CREATED: "CREATED";
|
|
207
|
+
readonly FROZEN: "FROZEN";
|
|
208
|
+
}>;
|
|
209
|
+
/** The values of `WalletState` */
|
|
210
|
+
export type WalletState = (typeof WalletState)[keyof typeof WalletState];
|
|
211
|
+
/** `USER`: the wallet of a customer — `TREASURY`: a wallet of the organization itself (read-only). `Wallet.type` */
|
|
212
|
+
export declare const WalletType: Readonly<{
|
|
213
|
+
readonly USER: "USER";
|
|
214
|
+
readonly TREASURY: "TREASURY";
|
|
215
|
+
}>;
|
|
216
|
+
/** The values of `WalletType` */
|
|
217
|
+
export type WalletType = (typeof WalletType)[keyof typeof WalletType];
|
|
218
|
+
/** Events of the catalogue — `WebhookEvent.event` and `WebhookType.name` (the catalogue may grow: any string stays accepted); `client.webhooks.subscribe` takes a constant, any name or uuid of the catalogue, or a `WebhookType` */
|
|
219
|
+
export declare const WebhookEventName: Readonly<{
|
|
220
|
+
readonly USER_CREATED: "user.created";
|
|
221
|
+
readonly ORGANIZATION_CREATED: "organization.created";
|
|
222
|
+
readonly USER_IDENTITY_STARTED: "user.identity.started";
|
|
223
|
+
readonly USER_IDENTITY_PENDING: "user.identity.pending";
|
|
224
|
+
readonly USER_IDENTITY_STEP_VALIDATED: "user.identity.step.validated";
|
|
225
|
+
readonly USER_IDENTITY_STEP_REJECTED: "user.identity.step.rejected";
|
|
226
|
+
readonly USER_IDENTITY_STEP_REQUESTED: "user.identity.step.requested";
|
|
227
|
+
readonly USER_IDENTITY_VALIDATED: "user.identity.validated";
|
|
228
|
+
readonly USER_IDENTITY_RENEW: "user.identity.renew";
|
|
229
|
+
readonly USER_IDENTITY_REQUEST: "user.identity.request";
|
|
230
|
+
readonly ORGANIZATION_IDENTITY_STARTED: "organization.identity.started";
|
|
231
|
+
readonly ORGANIZATION_IDENTITY_PENDING: "organization.identity.pending";
|
|
232
|
+
readonly ORGANIZATION_IDENTITY_STEP_VALIDATED: "organization.identity.step.validated";
|
|
233
|
+
readonly ORGANIZATION_IDENTITY_STEP_REJECTED: "organization.identity.step.rejected";
|
|
234
|
+
readonly ORGANIZATION_IDENTITY_STEP_REQUESTED: "organization.identity.step.requested";
|
|
235
|
+
readonly ORGANIZATION_IDENTITY_VALIDATED: "organization.identity.validated";
|
|
236
|
+
readonly ORGANIZATION_IDENTITY_RENEW: "organization.identity.renew";
|
|
237
|
+
readonly ORGANIZATION_IDENTITY_REQUEST: "organization.identity.request";
|
|
238
|
+
readonly BANK_CREDITED: "bank.credited";
|
|
239
|
+
readonly BANK_DEBITED: "bank.debited";
|
|
240
|
+
readonly BANK_TRANSACTION: "bank.transaction";
|
|
241
|
+
readonly CUSTODY_TRANSACTION: "custody.transaction";
|
|
242
|
+
readonly CUSTODY_WALLET_CREATED: "custody.wallet.created";
|
|
243
|
+
readonly CUSTODY_SENT: "custody.sent";
|
|
244
|
+
readonly CUSTODY_RECEIVED: "custody.received";
|
|
245
|
+
readonly TRADING_BUY: "trading.buy";
|
|
246
|
+
readonly TRADING_SELL: "trading.sell";
|
|
247
|
+
readonly STAKING_REQUESTED: "staking.requested";
|
|
248
|
+
readonly STAKING_STATUS: "staking.status";
|
|
249
|
+
readonly STAKING_REWARDS: "staking.rewards";
|
|
250
|
+
readonly STAKING_CLAIMED: "staking.claimed";
|
|
251
|
+
readonly ALERT_OPENED: "alert.opened";
|
|
252
|
+
readonly ALERT_STATUS: "alert.status";
|
|
253
|
+
}>;
|
|
254
|
+
/** Known event names — the catalogue may grow: any string is accepted */
|
|
255
|
+
export type WebhookEventName = (typeof WebhookEventName)[keyof typeof WebhookEventName] | (string & {});
|
|
256
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,eAAO,MAAM,GAAG;;;;;EAKL,CAAA;AAEX;;;;GAIG;AACH,eAAO,MAAM,KAAK;;;;;;EAMP,CAAA;AAIX,yHAAyH;AACzH,eAAO,MAAM,WAAW;;;EAGb,CAAA;AACX,kCAAkC;AAClC,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,OAAO,WAAW,CAAC,CAAA;AAExE,6FAA6F;AAC7F,eAAO,MAAM,UAAU;;;;;EAKZ,CAAA;AACX,iCAAiC;AACjC,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,OAAO,UAAU,CAAC,CAAA;AAErE,6FAA6F;AAC7F,eAAO,MAAM,aAAa;;;;;;EAMf,CAAA;AACX,oCAAoC;AACpC,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,OAAO,aAAa,CAAC,CAAA;AAE9E,0FAA0F;AAC1F,eAAO,MAAM,SAAS;;;EAGX,CAAA;AACX,gCAAgC;AAChC,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,OAAO,SAAS,CAAC,CAAA;AAElE,sFAAsF;AACtF,eAAO,MAAM,QAAQ;IACnB,oCAAoC;;IA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O,iBAAiB,CAAC,CAAC,MAAM,OAAO,iBAAiB,CAAC,CAAA;AAE1F,iJAAiJ;AACjJ,eAAO,MAAM,gBAAgB;;;;;;;;EAQlB,CAAA;AACX,uCAAuC;AACvC,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,OAAO,gBAAgB,CAAC,CAAA;AAEvF,0CAA0C;AAC1C,eAAO,MAAM,WAAW;;;EAGb,CAAA;AACX,kCAAkC;AAClC,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,OAAO,WAAW,CAAC,CAAA;AAExE,oHAAoH;AACpH,eAAO,MAAM,UAAU;;;EAGZ,CAAA;AACX,iCAAiC;AACjC,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,OAAO,UAAU,CAAC,CAAA;AAErE,qOAAqO;AACrO,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkClB,CAAA;AACX,yEAAyE;AACzE,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,OAAO,gBAAgB,CAAC,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAA"}
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
/** Target environment — value goes in `BitgenConfig.env` (`env: Env.PRODUCTION`) */
|
|
2
|
+
export const Env = Object.freeze({
|
|
3
|
+
PRODUCTION: 'production',
|
|
4
|
+
SANDBOX: 'sandbox',
|
|
5
|
+
STAGING: 'staging',
|
|
6
|
+
LOCALHOST: 'localhost',
|
|
7
|
+
});
|
|
8
|
+
/**
|
|
9
|
+
* Asset ISO codes, accepted wherever an asset is expected (the API takes a uuid or an iso in any case).
|
|
10
|
+
* The `iso` returned by the API has its stored case (`ETH` today): compare it case-insensitively.
|
|
11
|
+
* Provisional list — extended once the production list is confirmed.
|
|
12
|
+
*/
|
|
13
|
+
export const Asset = Object.freeze({
|
|
14
|
+
BTC: 'btc',
|
|
15
|
+
ETH: 'eth',
|
|
16
|
+
USDC: 'usdc',
|
|
17
|
+
XRP: 'xrp',
|
|
18
|
+
SOL: 'sol',
|
|
19
|
+
});
|
|
20
|
+
// ─── Enumerated values (mirror of the API's; value and type share the name, like `Env` and `Asset`) ─────
|
|
21
|
+
/** States of an API key — `Apikey.state`; `client.apikeys.list` leaves the `REVOKED` ones out unless `includeRevoked` */
|
|
22
|
+
export const ApikeyState = Object.freeze({
|
|
23
|
+
ENABLED: 'ENABLED',
|
|
24
|
+
REVOKED: 'REVOKED',
|
|
25
|
+
});
|
|
26
|
+
/** States of an asset — `Asset.state` is a string, compare it with `AssetState.AVAILABLE` */
|
|
27
|
+
export const AssetState = Object.freeze({
|
|
28
|
+
AVAILABLE: 'AVAILABLE',
|
|
29
|
+
UNAVAILABLE: 'UNAVAILABLE',
|
|
30
|
+
ARCHIVED: 'ARCHIVED',
|
|
31
|
+
HIDDEN: 'HIDDEN',
|
|
32
|
+
});
|
|
33
|
+
/** Filter of the EUR operations (`client.bank.operations`) — `ALL` (default), or one kind */
|
|
34
|
+
export const BankDirection = Object.freeze({
|
|
35
|
+
ALL: 'ALL',
|
|
36
|
+
DEPOSIT: 'DEPOSIT',
|
|
37
|
+
WITHDRAWAL: 'WITHDRAWAL',
|
|
38
|
+
PURCHASE: 'PURCHASE',
|
|
39
|
+
SELL: 'SELL',
|
|
40
|
+
});
|
|
41
|
+
/** States of a connector — `Core.state`; also the `state` filter of `client.core.list` */
|
|
42
|
+
export const CoreState = Object.freeze({
|
|
43
|
+
ENABLED: 'ENABLED',
|
|
44
|
+
DISABLED: 'DISABLED',
|
|
45
|
+
});
|
|
46
|
+
/** Kinds of connectors — `Core.type`; also the `type` filter of `client.core.list` */
|
|
47
|
+
export const CoreType = Object.freeze({
|
|
48
|
+
/** Identity verification service */
|
|
49
|
+
IDENTITY: 'IDENTITY',
|
|
50
|
+
/** Anti-money-laundering service */
|
|
51
|
+
AML: 'AML',
|
|
52
|
+
/** Exchange */
|
|
53
|
+
TRADING: 'TRADING',
|
|
54
|
+
/** Custodian */
|
|
55
|
+
CUSTODY: 'CUSTODY',
|
|
56
|
+
/** Staking provider */
|
|
57
|
+
STAKING: 'STAKING',
|
|
58
|
+
/** Bank */
|
|
59
|
+
RAMP: 'RAMP',
|
|
60
|
+
});
|
|
61
|
+
/** States of a customer — `Customer.state`, compare it with `CustomerState.ENABLED` */
|
|
62
|
+
export const CustomerState = Object.freeze({
|
|
63
|
+
CREATED: 'CREATED',
|
|
64
|
+
ENABLED: 'ENABLED',
|
|
65
|
+
CLOSED: 'CLOSED',
|
|
66
|
+
FROZEN: 'FROZEN',
|
|
67
|
+
});
|
|
68
|
+
/** `KYC` (a person) or `KYB` (a business) — `Identity.mode` */
|
|
69
|
+
export const IdentityMode = Object.freeze({
|
|
70
|
+
KYC: 'KYC',
|
|
71
|
+
KYB: 'KYB',
|
|
72
|
+
});
|
|
73
|
+
/** States of an identity file — `Identity.state` */
|
|
74
|
+
export const IdentityState = Object.freeze({
|
|
75
|
+
CREATED: 'CREATED',
|
|
76
|
+
IN_PROGRESS: 'IN_PROGRESS',
|
|
77
|
+
WAIT: 'WAIT',
|
|
78
|
+
PENDING: 'PENDING',
|
|
79
|
+
VALIDATED: 'VALIDATED',
|
|
80
|
+
REJECTED: 'REJECTED',
|
|
81
|
+
FROZEN: 'FROZEN',
|
|
82
|
+
EXPIRED: 'EXPIRED',
|
|
83
|
+
CLOSED: 'CLOSED',
|
|
84
|
+
});
|
|
85
|
+
/** Language of the BITGEN web application and of the emails — `Locale.FR` (default) or `Locale.EN` */
|
|
86
|
+
export const Locale = Object.freeze({
|
|
87
|
+
FR: 'FR',
|
|
88
|
+
EN: 'EN',
|
|
89
|
+
});
|
|
90
|
+
/** Side of an order — `Order.side` */
|
|
91
|
+
export const OrderSide = Object.freeze({
|
|
92
|
+
BUY: 'BUY',
|
|
93
|
+
SELL: 'SELL',
|
|
94
|
+
});
|
|
95
|
+
/** States of an order — `Order.state`. A purchase goes `REGISTERED` → `EXECUTING` → `FILLED` → `DELIVERING` → `DONE`; a sale `REGISTERED` → `TRANSFERRING` → `DEPOSITED` → `EXECUTING` → `FILLED` → `DONE`. `PARKED`: executed but nothing was received (terminal); `FAILED` */
|
|
96
|
+
export const OrderState = Object.freeze({
|
|
97
|
+
REGISTERED: 'REGISTERED',
|
|
98
|
+
TRANSFERRING: 'TRANSFERRING',
|
|
99
|
+
DEPOSITED: 'DEPOSITED',
|
|
100
|
+
EXECUTING: 'EXECUTING',
|
|
101
|
+
FILLED: 'FILLED',
|
|
102
|
+
DELIVERING: 'DELIVERING',
|
|
103
|
+
DONE: 'DONE',
|
|
104
|
+
PARKED: 'PARKED',
|
|
105
|
+
FAILED: 'FAILED',
|
|
106
|
+
});
|
|
107
|
+
/** Category of a customer — the `organization` of `client.customer.create` (`CUSTOMER` by default; `B2B` also opens a KYB file) and `setup.choosenOrganization` */
|
|
108
|
+
export const OrganizationCategory = Object.freeze({
|
|
109
|
+
CUSTOMER: 'CUSTOMER',
|
|
110
|
+
B2B: 'B2B',
|
|
111
|
+
});
|
|
112
|
+
/** Kinds of staking movements — `StakingMovement.kind`; also the `direction` filter of `client.staking.list` / `movements` */
|
|
113
|
+
export const StakingMovementKind = Object.freeze({
|
|
114
|
+
STAKE: 'STAKE',
|
|
115
|
+
UNSTAKE: 'UNSTAKE',
|
|
116
|
+
WITHDRAW: 'WITHDRAW',
|
|
117
|
+
REWARD: 'REWARD',
|
|
118
|
+
});
|
|
119
|
+
/** States of a staking movement — `StakingMovement.state` */
|
|
120
|
+
export const StakingMovementState = Object.freeze({
|
|
121
|
+
REQUESTED: 'REQUESTED',
|
|
122
|
+
PENDING: 'PENDING',
|
|
123
|
+
COMPLETED: 'COMPLETED',
|
|
124
|
+
FAILED: 'FAILED',
|
|
125
|
+
CANCELED: 'CANCELED',
|
|
126
|
+
});
|
|
127
|
+
/** States of a staking position — `StakingPosition.state` */
|
|
128
|
+
export const StakingPositionState = Object.freeze({
|
|
129
|
+
CREATED: 'CREATED',
|
|
130
|
+
ENABLED: 'ENABLED',
|
|
131
|
+
UNSTAKING: 'UNSTAKING',
|
|
132
|
+
CLOSED: 'CLOSED',
|
|
133
|
+
FAILED: 'FAILED',
|
|
134
|
+
});
|
|
135
|
+
/** States of a webhook subscription (`Subscriber.state`) and of an event of the catalogue (`WebhookType.state`) — `ARCHIVED` ones are left out of `client.webhooks.list` unless `includeArchived` */
|
|
136
|
+
export const SubscriberState = Object.freeze({
|
|
137
|
+
ENABLED: 'ENABLED',
|
|
138
|
+
ARCHIVED: 'ARCHIVED',
|
|
139
|
+
});
|
|
140
|
+
/** Filter of `client.trading.list`: only purchases, or only sales — lowercase, as the API expects it */
|
|
141
|
+
export const TradingDirection = Object.freeze({
|
|
142
|
+
BUY: 'buy',
|
|
143
|
+
SELL: 'sell',
|
|
144
|
+
});
|
|
145
|
+
/** Direction of a transaction — `Transaction.direction`; also a filter of `client.transaction.list` */
|
|
146
|
+
export const TransactionDirection = Object.freeze({
|
|
147
|
+
IN: 'IN',
|
|
148
|
+
OUT: 'OUT',
|
|
149
|
+
});
|
|
150
|
+
/** Where a transaction comes from: the EUR account (`BANK`) or a custody wallet (`CUSTODY`) — `Transaction.source`; also a filter of `client.transaction.list` */
|
|
151
|
+
export const TransactionSource = Object.freeze({
|
|
152
|
+
BANK: 'BANK',
|
|
153
|
+
CUSTODY: 'CUSTODY',
|
|
154
|
+
});
|
|
155
|
+
/** States of a transaction (`TRANSFERING` is the API's spelling) — `Transaction.state`; also the `status` filter of `client.transaction.list` */
|
|
156
|
+
export const TransactionState = Object.freeze({
|
|
157
|
+
ANALYZING: 'ANALYZING',
|
|
158
|
+
PENDING: 'PENDING',
|
|
159
|
+
COMPLETED: 'COMPLETED',
|
|
160
|
+
FROZEN: 'FROZEN',
|
|
161
|
+
FAILED: 'FAILED',
|
|
162
|
+
TRANSFERING: 'TRANSFERING',
|
|
163
|
+
SEIZED: 'SEIZED',
|
|
164
|
+
});
|
|
165
|
+
/** States of a wallet — `Wallet.state` */
|
|
166
|
+
export const WalletState = Object.freeze({
|
|
167
|
+
CREATED: 'CREATED',
|
|
168
|
+
FROZEN: 'FROZEN',
|
|
169
|
+
});
|
|
170
|
+
/** `USER`: the wallet of a customer — `TREASURY`: a wallet of the organization itself (read-only). `Wallet.type` */
|
|
171
|
+
export const WalletType = Object.freeze({
|
|
172
|
+
USER: 'USER',
|
|
173
|
+
TREASURY: 'TREASURY',
|
|
174
|
+
});
|
|
175
|
+
/** Events of the catalogue — `WebhookEvent.event` and `WebhookType.name` (the catalogue may grow: any string stays accepted); `client.webhooks.subscribe` takes a constant, any name or uuid of the catalogue, or a `WebhookType` */
|
|
176
|
+
export const WebhookEventName = Object.freeze({
|
|
177
|
+
USER_CREATED: 'user.created',
|
|
178
|
+
ORGANIZATION_CREATED: 'organization.created',
|
|
179
|
+
USER_IDENTITY_STARTED: 'user.identity.started',
|
|
180
|
+
USER_IDENTITY_PENDING: 'user.identity.pending',
|
|
181
|
+
USER_IDENTITY_STEP_VALIDATED: 'user.identity.step.validated',
|
|
182
|
+
USER_IDENTITY_STEP_REJECTED: 'user.identity.step.rejected',
|
|
183
|
+
USER_IDENTITY_STEP_REQUESTED: 'user.identity.step.requested',
|
|
184
|
+
USER_IDENTITY_VALIDATED: 'user.identity.validated',
|
|
185
|
+
USER_IDENTITY_RENEW: 'user.identity.renew',
|
|
186
|
+
USER_IDENTITY_REQUEST: 'user.identity.request',
|
|
187
|
+
ORGANIZATION_IDENTITY_STARTED: 'organization.identity.started',
|
|
188
|
+
ORGANIZATION_IDENTITY_PENDING: 'organization.identity.pending',
|
|
189
|
+
ORGANIZATION_IDENTITY_STEP_VALIDATED: 'organization.identity.step.validated',
|
|
190
|
+
ORGANIZATION_IDENTITY_STEP_REJECTED: 'organization.identity.step.rejected',
|
|
191
|
+
ORGANIZATION_IDENTITY_STEP_REQUESTED: 'organization.identity.step.requested',
|
|
192
|
+
ORGANIZATION_IDENTITY_VALIDATED: 'organization.identity.validated',
|
|
193
|
+
ORGANIZATION_IDENTITY_RENEW: 'organization.identity.renew',
|
|
194
|
+
ORGANIZATION_IDENTITY_REQUEST: 'organization.identity.request',
|
|
195
|
+
BANK_CREDITED: 'bank.credited',
|
|
196
|
+
BANK_DEBITED: 'bank.debited',
|
|
197
|
+
BANK_TRANSACTION: 'bank.transaction',
|
|
198
|
+
CUSTODY_TRANSACTION: 'custody.transaction',
|
|
199
|
+
CUSTODY_WALLET_CREATED: 'custody.wallet.created',
|
|
200
|
+
CUSTODY_SENT: 'custody.sent',
|
|
201
|
+
CUSTODY_RECEIVED: 'custody.received',
|
|
202
|
+
TRADING_BUY: 'trading.buy',
|
|
203
|
+
TRADING_SELL: 'trading.sell',
|
|
204
|
+
STAKING_REQUESTED: 'staking.requested',
|
|
205
|
+
STAKING_STATUS: 'staking.status',
|
|
206
|
+
STAKING_REWARDS: 'staking.rewards',
|
|
207
|
+
STAKING_CLAIMED: 'staking.claimed',
|
|
208
|
+
ALERT_OPENED: 'alert.opened',
|
|
209
|
+
ALERT_STATUS: 'alert.status',
|
|
210
|
+
});
|
|
211
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,MAAM,CAAC,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC;IAC/B,UAAU,EAAE,YAAY;IACxB,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE,SAAS;IAClB,SAAS,EAAE,WAAW;CACd,CAAC,CAAA;AAEX;;;;GAIG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC;IACjC,GAAG,EAAE,KAAK;IACV,GAAG,EAAE,KAAK;IACV,IAAI,EAAE,MAAM;IACZ,GAAG,EAAE,KAAK;IACV,GAAG,EAAE,KAAK;CACF,CAA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AE,cAAc;IAC5B,gBAAgB,EAAE,kBAAkB;IACpC,WAAW,EAAE,aAAa;IAC1B,YAAY,EAAE,cAAc;IAC5B,iBAAiB,EAAE,mBAAmB;IACtC,cAAc,EAAE,gBAAgB;IAChC,eAAe,EAAE,iBAAiB;IAClC,eAAe,EAAE,iBAAiB;IAClC,YAAY,EAAE,cAAc;IAC5B,YAAY,EAAE,cAAc;CACpB,CAAC,CAAA"}
|
package/dist/esm/error.d.ts
CHANGED
|
@@ -1,15 +1,22 @@
|
|
|
1
1
|
import type { BitgenErrorBody } from './types/index.js';
|
|
2
|
+
/** Max length kept for `code`: the API sends short snake_case codes, anything longer is a foreign body (proxy page…) */
|
|
3
|
+
export declare const MAX_CODE_LENGTH = 200;
|
|
2
4
|
export declare class BitgenError extends Error {
|
|
3
|
-
/** HTTP status code */
|
|
5
|
+
/** HTTP status code — `0` when no HTTP response was received (`request_timeout`, `network_error`) */
|
|
4
6
|
readonly status: number;
|
|
5
|
-
/** BITGEN error code (
|
|
6
|
-
readonly code:
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
/** Stable BITGEN error code (e.g. `invalid_amount`), or the raw response text (≤ 200 chars) when the API did not answer JSON */
|
|
8
|
+
readonly code: string;
|
|
9
|
+
constructor(status: number, body: BitgenErrorBody, options?: {
|
|
10
|
+
cause?: unknown;
|
|
11
|
+
});
|
|
12
|
+
/** `instanceof` also recognizes a BitgenError thrown by another copy of the SDK (ESM and CJS builds loaded together) */
|
|
13
|
+
static [Symbol.hasInstance](value: unknown): boolean;
|
|
14
|
+
/** `JSON.stringify(err)` → `{ name, message, status, code }` (`cause` is left out) */
|
|
15
|
+
toJSON(): {
|
|
16
|
+
name: string;
|
|
17
|
+
message: string;
|
|
18
|
+
status: number;
|
|
19
|
+
code: string;
|
|
20
|
+
};
|
|
14
21
|
}
|
|
15
22
|
//# sourceMappingURL=error.d.ts.map
|
package/dist/esm/error.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../src/error.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAEvD,qBAAa,WAAY,SAAQ,KAAK;IACpC,
|
|
1
|
+
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../src/error.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAEvD,wHAAwH;AACxH,eAAO,MAAM,eAAe,MAAM,CAAA;AAKlC,qBAAa,WAAY,SAAQ,KAAK;IACpC,qGAAqG;IACrG,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,gIAAgI;IAChI,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;gBAET,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,eAAe,EAAE,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE;IAShF,wHAAwH;WACxG,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO;IAO7D,sFAAsF;IACtF,MAAM,IAAI;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE;CAG1E"}
|
package/dist/esm/error.js
CHANGED
|
@@ -1,12 +1,30 @@
|
|
|
1
|
+
/** Max length kept for `code`: the API sends short snake_case codes, anything longer is a foreign body (proxy page…) */
|
|
2
|
+
export const MAX_CODE_LENGTH = 200;
|
|
3
|
+
/** Brand shared by every copy of the SDK loaded in a process (ESM and CJS builds side by side) */
|
|
4
|
+
const BRAND = Symbol.for('@bitgen/sdk:BitgenError');
|
|
1
5
|
export class BitgenError extends Error {
|
|
2
|
-
|
|
3
|
-
|
|
6
|
+
/** HTTP status code — `0` when no HTTP response was received (`request_timeout`, `network_error`) */
|
|
7
|
+
status;
|
|
8
|
+
/** Stable BITGEN error code (e.g. `invalid_amount`), or the raw response text (≤ 200 chars) when the API did not answer JSON */
|
|
9
|
+
code;
|
|
10
|
+
constructor(status, body, options) {
|
|
11
|
+
const code = body.message.slice(0, MAX_CODE_LENGTH);
|
|
12
|
+
super(`[${status}] ${code}`, options);
|
|
4
13
|
this.name = 'BitgenError';
|
|
5
14
|
this.status = status;
|
|
6
|
-
this.code =
|
|
7
|
-
this
|
|
8
|
-
|
|
9
|
-
|
|
15
|
+
this.code = code;
|
|
16
|
+
Object.defineProperty(this, BRAND, { value: true });
|
|
17
|
+
}
|
|
18
|
+
/** `instanceof` also recognizes a BitgenError thrown by another copy of the SDK (ESM and CJS builds loaded together) */
|
|
19
|
+
static [Symbol.hasInstance](value) {
|
|
20
|
+
if (Function.prototype[Symbol.hasInstance].call(this, value)) {
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
23
|
+
return this === BitgenError && typeof value === 'object' && value !== null && BRAND in value;
|
|
24
|
+
}
|
|
25
|
+
/** `JSON.stringify(err)` → `{ name, message, status, code }` (`cause` is left out) */
|
|
26
|
+
toJSON() {
|
|
27
|
+
return { name: this.name, message: this.message, status: this.status, code: this.code };
|
|
10
28
|
}
|
|
11
29
|
}
|
|
12
30
|
//# sourceMappingURL=error.js.map
|
package/dist/esm/error.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.js","sourceRoot":"","sources":["../../src/error.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,WAAY,SAAQ,KAAK;
|
|
1
|
+
{"version":3,"file":"error.js","sourceRoot":"","sources":["../../src/error.ts"],"names":[],"mappings":"AAEA,wHAAwH;AACxH,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,CAAA;AAElC,kGAAkG;AAClG,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,yBAAyB,CAAC,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'GET' | 'POST' | 'PUT' | 'DELETE';
|
|
2
|
+
type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
3
|
+
/** Query string entries — `undefined` and `null` are skipped */
|
|
4
|
+
export type Query = Record<string, string | number | boolean | null | undefined>;
|
|
3
5
|
interface RequestOptions {
|
|
4
6
|
method?: HttpMethod;
|
|
5
7
|
body?: unknown;
|
|
6
|
-
query?:
|
|
7
|
-
/** Set to true for endpoints that return raw non-JSON errors (POST /tx) */
|
|
8
|
-
rawErrors?: boolean;
|
|
8
|
+
query?: Query | undefined;
|
|
9
9
|
}
|
|
10
10
|
export declare class HttpClient {
|
|
11
|
+
/** Organization uuid of the key — resources use it where the API expects the organization */
|
|
12
|
+
readonly scope: string;
|
|
11
13
|
private readonly baseUrl;
|
|
12
14
|
private readonly headers;
|
|
15
|
+
/** Request timeout in milliseconds (`BitgenConfig.timeout` × 1000), `0` = none */
|
|
16
|
+
private readonly timeout;
|
|
13
17
|
constructor(config: BitgenConfig);
|
|
14
18
|
request<T>(path: string, options?: RequestOptions): Promise<T>;
|
|
15
|
-
get<T>(path: string, query?:
|
|
16
|
-
post<T>(path: string, body
|
|
17
|
-
put<T>(path: string, body
|
|
18
|
-
|
|
19
|
+
get<T>(path: string, query?: Query): Promise<T>;
|
|
20
|
+
post<T>(path: string, body?: unknown): Promise<T>;
|
|
21
|
+
put<T>(path: string, body?: unknown): Promise<T>;
|
|
22
|
+
patch<T>(path: string, body?: unknown): Promise<T>;
|
|
23
|
+
delete<T>(path: string, body?: unknown): Promise<T>;
|
|
19
24
|
}
|
|
20
25
|
export {};
|
|
21
26
|
//# sourceMappingURL=http.d.ts.map
|
package/dist/esm/http.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/http.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/http.ts"],"names":[],"m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