@bitgen/sdk 0.1.6 → 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.
Files changed (328) hide show
  1. package/CHANGELOG.md +55 -2
  2. package/README.md +27 -106
  3. package/dist/cjs/client.d.ts +20 -8
  4. package/dist/cjs/client.d.ts.map +1 -1
  5. package/dist/cjs/client.js +33 -12
  6. package/dist/cjs/client.js.map +1 -1
  7. package/dist/cjs/constants.d.ts +256 -0
  8. package/dist/cjs/constants.d.ts.map +1 -0
  9. package/dist/cjs/constants.js +214 -0
  10. package/dist/cjs/constants.js.map +1 -0
  11. package/dist/cjs/error.d.ts +17 -10
  12. package/dist/cjs/error.d.ts.map +1 -1
  13. package/dist/cjs/error.js +25 -7
  14. package/dist/cjs/error.js.map +1 -1
  15. package/dist/cjs/http.d.ts +13 -8
  16. package/dist/cjs/http.d.ts.map +1 -1
  17. package/dist/cjs/http.js +135 -44
  18. package/dist/cjs/http.js.map +1 -1
  19. package/dist/cjs/index.d.ts +14 -1
  20. package/dist/cjs/index.d.ts.map +1 -1
  21. package/dist/cjs/index.js +30 -1
  22. package/dist/cjs/index.js.map +1 -1
  23. package/dist/cjs/resources/apikeys.d.ts +18 -0
  24. package/dist/cjs/resources/apikeys.d.ts.map +1 -0
  25. package/dist/cjs/resources/apikeys.js +31 -0
  26. package/dist/cjs/resources/apikeys.js.map +1 -0
  27. package/dist/cjs/resources/asset.d.ts +17 -5
  28. package/dist/cjs/resources/asset.d.ts.map +1 -1
  29. package/dist/cjs/resources/asset.js +17 -6
  30. package/dist/cjs/resources/asset.js.map +1 -1
  31. package/dist/cjs/resources/bank.d.ts +11 -6
  32. package/dist/cjs/resources/bank.d.ts.map +1 -1
  33. package/dist/cjs/resources/bank.js +17 -9
  34. package/dist/cjs/resources/bank.js.map +1 -1
  35. package/dist/cjs/resources/core.d.ts +12 -0
  36. package/dist/cjs/resources/core.d.ts.map +1 -0
  37. package/dist/cjs/resources/core.js +22 -0
  38. package/dist/cjs/resources/core.js.map +1 -0
  39. package/dist/cjs/resources/custody.d.ts +27 -0
  40. package/dist/cjs/resources/custody.d.ts.map +1 -0
  41. package/dist/cjs/resources/custody.js +38 -0
  42. package/dist/cjs/resources/custody.js.map +1 -0
  43. package/dist/cjs/resources/customer.d.ts +20 -0
  44. package/dist/cjs/resources/customer.d.ts.map +1 -0
  45. package/dist/cjs/resources/customer.js +38 -0
  46. package/dist/cjs/resources/customer.js.map +1 -0
  47. package/dist/cjs/resources/staking.d.ts +32 -0
  48. package/dist/cjs/resources/staking.d.ts.map +1 -0
  49. package/dist/cjs/resources/staking.js +69 -0
  50. package/dist/cjs/resources/staking.js.map +1 -0
  51. package/dist/cjs/resources/trading.d.ts +24 -0
  52. package/dist/cjs/resources/trading.d.ts.map +1 -0
  53. package/dist/cjs/resources/trading.js +41 -0
  54. package/dist/cjs/resources/trading.js.map +1 -0
  55. package/dist/cjs/resources/transaction.d.ts +6 -9
  56. package/dist/cjs/resources/transaction.d.ts.map +1 -1
  57. package/dist/cjs/resources/transaction.js +10 -15
  58. package/dist/cjs/resources/transaction.js.map +1 -1
  59. package/dist/cjs/resources/webhooks.d.ts +46 -0
  60. package/dist/cjs/resources/webhooks.d.ts.map +1 -0
  61. package/dist/cjs/resources/webhooks.js +142 -0
  62. package/dist/cjs/resources/webhooks.js.map +1 -0
  63. package/dist/cjs/types/apikeys.d.ts +43 -0
  64. package/dist/cjs/types/apikeys.d.ts.map +1 -0
  65. package/dist/cjs/types/apikeys.js +3 -0
  66. package/dist/cjs/types/apikeys.js.map +1 -0
  67. package/dist/cjs/types/asset.d.ts +57 -0
  68. package/dist/cjs/types/asset.d.ts.map +1 -0
  69. package/dist/cjs/types/asset.js +3 -0
  70. package/dist/cjs/types/asset.js.map +1 -0
  71. package/dist/cjs/types/bank.d.ts +58 -0
  72. package/dist/cjs/types/bank.d.ts.map +1 -0
  73. package/dist/cjs/types/bank.js +3 -0
  74. package/dist/cjs/types/bank.js.map +1 -0
  75. package/dist/cjs/types/core.d.ts +32 -0
  76. package/dist/cjs/types/core.d.ts.map +1 -0
  77. package/dist/cjs/types/core.js +3 -0
  78. package/dist/cjs/types/core.js.map +1 -0
  79. package/dist/cjs/types/custody.d.ts +50 -0
  80. package/dist/cjs/types/custody.d.ts.map +1 -0
  81. package/dist/cjs/types/custody.js +3 -0
  82. package/dist/cjs/types/custody.js.map +1 -0
  83. package/dist/cjs/types/customer.d.ts +190 -0
  84. package/dist/cjs/types/customer.d.ts.map +1 -0
  85. package/dist/cjs/types/customer.js +3 -0
  86. package/dist/cjs/types/customer.js.map +1 -0
  87. package/dist/cjs/types/index.d.ts +78 -194
  88. package/dist/cjs/types/index.d.ts.map +1 -1
  89. package/dist/cjs/types/index.js +0 -1
  90. package/dist/cjs/types/index.js.map +1 -1
  91. package/dist/cjs/types/staking.d.ts +88 -0
  92. package/dist/cjs/types/staking.d.ts.map +1 -0
  93. package/dist/cjs/types/staking.js +3 -0
  94. package/dist/cjs/types/staking.js.map +1 -0
  95. package/dist/cjs/types/trading.d.ts +51 -0
  96. package/dist/cjs/types/trading.d.ts.map +1 -0
  97. package/dist/cjs/types/trading.js +3 -0
  98. package/dist/cjs/types/trading.js.map +1 -0
  99. package/dist/cjs/types/transaction.d.ts +61 -0
  100. package/dist/cjs/types/transaction.d.ts.map +1 -0
  101. package/dist/cjs/types/transaction.js +3 -0
  102. package/dist/cjs/types/transaction.js.map +1 -0
  103. package/dist/cjs/types/webhooks.d.ts +55 -0
  104. package/dist/cjs/types/webhooks.d.ts.map +1 -0
  105. package/dist/cjs/types/webhooks.js +3 -0
  106. package/dist/cjs/types/webhooks.js.map +1 -0
  107. package/dist/cjs/utils.d.ts +21 -2
  108. package/dist/cjs/utils.d.ts.map +1 -1
  109. package/dist/cjs/utils.js +67 -4
  110. package/dist/cjs/utils.js.map +1 -1
  111. package/dist/cjs/version.d.ts +2 -0
  112. package/dist/cjs/version.d.ts.map +1 -0
  113. package/dist/cjs/version.js +6 -0
  114. package/dist/cjs/version.js.map +1 -0
  115. package/dist/esm/client.d.ts +20 -8
  116. package/dist/esm/client.d.ts.map +1 -1
  117. package/dist/esm/client.js +33 -12
  118. package/dist/esm/client.js.map +1 -1
  119. package/dist/esm/constants.d.ts +256 -0
  120. package/dist/esm/constants.d.ts.map +1 -0
  121. package/dist/esm/constants.js +211 -0
  122. package/dist/esm/constants.js.map +1 -0
  123. package/dist/esm/error.d.ts +17 -10
  124. package/dist/esm/error.d.ts.map +1 -1
  125. package/dist/esm/error.js +24 -6
  126. package/dist/esm/error.js.map +1 -1
  127. package/dist/esm/http.d.ts +13 -8
  128. package/dist/esm/http.d.ts.map +1 -1
  129. package/dist/esm/http.js +136 -45
  130. package/dist/esm/http.js.map +1 -1
  131. package/dist/esm/index.d.ts +14 -1
  132. package/dist/esm/index.d.ts.map +1 -1
  133. package/dist/esm/index.js +6 -0
  134. package/dist/esm/index.js.map +1 -1
  135. package/dist/esm/resources/apikeys.d.ts +18 -0
  136. package/dist/esm/resources/apikeys.d.ts.map +1 -0
  137. package/dist/esm/resources/apikeys.js +27 -0
  138. package/dist/esm/resources/apikeys.js.map +1 -0
  139. package/dist/esm/resources/asset.d.ts +17 -5
  140. package/dist/esm/resources/asset.d.ts.map +1 -1
  141. package/dist/esm/resources/asset.js +17 -6
  142. package/dist/esm/resources/asset.js.map +1 -1
  143. package/dist/esm/resources/bank.d.ts +11 -6
  144. package/dist/esm/resources/bank.d.ts.map +1 -1
  145. package/dist/esm/resources/bank.js +18 -10
  146. package/dist/esm/resources/bank.js.map +1 -1
  147. package/dist/esm/resources/core.d.ts +12 -0
  148. package/dist/esm/resources/core.d.ts.map +1 -0
  149. package/dist/esm/resources/core.js +18 -0
  150. package/dist/esm/resources/core.js.map +1 -0
  151. package/dist/esm/resources/custody.d.ts +27 -0
  152. package/dist/esm/resources/custody.d.ts.map +1 -0
  153. package/dist/esm/resources/custody.js +34 -0
  154. package/dist/esm/resources/custody.js.map +1 -0
  155. package/dist/esm/resources/customer.d.ts +20 -0
  156. package/dist/esm/resources/customer.d.ts.map +1 -0
  157. package/dist/esm/resources/customer.js +34 -0
  158. package/dist/esm/resources/customer.js.map +1 -0
  159. package/dist/esm/resources/staking.d.ts +32 -0
  160. package/dist/esm/resources/staking.d.ts.map +1 -0
  161. package/dist/esm/resources/staking.js +65 -0
  162. package/dist/esm/resources/staking.js.map +1 -0
  163. package/dist/esm/resources/trading.d.ts +24 -0
  164. package/dist/esm/resources/trading.d.ts.map +1 -0
  165. package/dist/esm/resources/trading.js +37 -0
  166. package/dist/esm/resources/trading.js.map +1 -0
  167. package/dist/esm/resources/transaction.d.ts +6 -9
  168. package/dist/esm/resources/transaction.d.ts.map +1 -1
  169. package/dist/esm/resources/transaction.js +11 -16
  170. package/dist/esm/resources/transaction.js.map +1 -1
  171. package/dist/esm/resources/webhooks.d.ts +46 -0
  172. package/dist/esm/resources/webhooks.d.ts.map +1 -0
  173. package/dist/esm/resources/webhooks.js +138 -0
  174. package/dist/esm/resources/webhooks.js.map +1 -0
  175. package/dist/esm/types/apikeys.d.ts +43 -0
  176. package/dist/esm/types/apikeys.d.ts.map +1 -0
  177. package/dist/esm/types/apikeys.js +2 -0
  178. package/dist/esm/types/apikeys.js.map +1 -0
  179. package/dist/esm/types/asset.d.ts +57 -0
  180. package/dist/esm/types/asset.d.ts.map +1 -0
  181. package/dist/esm/types/asset.js +2 -0
  182. package/dist/esm/types/asset.js.map +1 -0
  183. package/dist/esm/types/bank.d.ts +58 -0
  184. package/dist/esm/types/bank.d.ts.map +1 -0
  185. package/dist/esm/types/bank.js +2 -0
  186. package/dist/esm/types/bank.js.map +1 -0
  187. package/dist/esm/types/core.d.ts +32 -0
  188. package/dist/esm/types/core.d.ts.map +1 -0
  189. package/dist/esm/types/core.js +2 -0
  190. package/dist/esm/types/core.js.map +1 -0
  191. package/dist/esm/types/custody.d.ts +50 -0
  192. package/dist/esm/types/custody.d.ts.map +1 -0
  193. package/dist/esm/types/custody.js +2 -0
  194. package/dist/esm/types/custody.js.map +1 -0
  195. package/dist/esm/types/customer.d.ts +190 -0
  196. package/dist/esm/types/customer.d.ts.map +1 -0
  197. package/dist/esm/types/customer.js +2 -0
  198. package/dist/esm/types/customer.js.map +1 -0
  199. package/dist/esm/types/index.d.ts +78 -194
  200. package/dist/esm/types/index.d.ts.map +1 -1
  201. package/dist/esm/types/index.js +0 -1
  202. package/dist/esm/types/index.js.map +1 -1
  203. package/dist/esm/types/staking.d.ts +88 -0
  204. package/dist/esm/types/staking.d.ts.map +1 -0
  205. package/dist/esm/types/staking.js +2 -0
  206. package/dist/esm/types/staking.js.map +1 -0
  207. package/dist/esm/types/trading.d.ts +51 -0
  208. package/dist/esm/types/trading.d.ts.map +1 -0
  209. package/dist/esm/types/trading.js +2 -0
  210. package/dist/esm/types/trading.js.map +1 -0
  211. package/dist/esm/types/transaction.d.ts +61 -0
  212. package/dist/esm/types/transaction.d.ts.map +1 -0
  213. package/dist/esm/types/transaction.js +2 -0
  214. package/dist/esm/types/transaction.js.map +1 -0
  215. package/dist/esm/types/webhooks.d.ts +55 -0
  216. package/dist/esm/types/webhooks.d.ts.map +1 -0
  217. package/dist/esm/types/webhooks.js +2 -0
  218. package/dist/esm/types/webhooks.js.map +1 -0
  219. package/dist/esm/utils.d.ts +21 -2
  220. package/dist/esm/utils.d.ts.map +1 -1
  221. package/dist/esm/utils.js +62 -4
  222. package/dist/esm/utils.js.map +1 -1
  223. package/dist/esm/version.d.ts +2 -0
  224. package/dist/esm/version.d.ts.map +1 -0
  225. package/dist/esm/version.js +3 -0
  226. package/dist/esm/version.js.map +1 -0
  227. package/package.json +29 -12
  228. package/readme/concepts.md +104 -0
  229. package/readme/configuration.md +72 -0
  230. package/readme/errors.md +67 -0
  231. package/readme/installation.md +43 -0
  232. package/readme/quick-start.md +87 -0
  233. package/readme/resource/apikeys.md +103 -0
  234. package/readme/resource/asset.md +121 -0
  235. package/readme/resource/bank.md +156 -0
  236. package/readme/resource/core.md +91 -0
  237. package/readme/resource/custody.md +166 -0
  238. package/readme/resource/customer.md +208 -0
  239. package/readme/resource/staking.md +277 -0
  240. package/readme/resource/trading.md +166 -0
  241. package/readme/resource/transaction.md +106 -0
  242. package/readme/resource/webhooks.md +307 -0
  243. package/src/client.ts +46 -0
  244. package/src/constants.ts +281 -0
  245. package/src/error.ts +36 -0
  246. package/src/http.ts +201 -0
  247. package/src/index.ts +111 -0
  248. package/src/resources/apikeys.ts +30 -0
  249. package/src/resources/asset.ts +28 -0
  250. package/src/resources/bank.ts +39 -0
  251. package/src/resources/core.ts +19 -0
  252. package/src/resources/custody.ts +37 -0
  253. package/src/resources/customer.ts +46 -0
  254. package/src/resources/staking.ts +88 -0
  255. package/src/resources/trading.ts +41 -0
  256. package/src/resources/transaction.ts +20 -0
  257. package/src/resources/webhooks.ts +169 -0
  258. package/src/types/apikeys.ts +35 -0
  259. package/src/types/asset.ts +59 -0
  260. package/src/types/bank.ts +60 -0
  261. package/src/types/core.ts +32 -0
  262. package/src/types/custody.ts +40 -0
  263. package/src/types/customer.ts +189 -0
  264. package/src/types/index.ts +215 -0
  265. package/src/types/staking.ts +87 -0
  266. package/src/types/trading.ts +56 -0
  267. package/src/types/transaction.ts +62 -0
  268. package/src/types/webhooks.ts +60 -0
  269. package/src/utils.ts +74 -0
  270. package/src/version.ts +2 -0
  271. package/dist/cjs/resources/order.d.ts +0 -17
  272. package/dist/cjs/resources/order.d.ts.map +0 -1
  273. package/dist/cjs/resources/order.js +0 -30
  274. package/dist/cjs/resources/order.js.map +0 -1
  275. package/dist/cjs/resources/stats.d.ts +0 -11
  276. package/dist/cjs/resources/stats.d.ts.map +0 -1
  277. package/dist/cjs/resources/stats.js +0 -18
  278. package/dist/cjs/resources/stats.js.map +0 -1
  279. package/dist/cjs/resources/user.d.ts +0 -22
  280. package/dist/cjs/resources/user.d.ts.map +0 -1
  281. package/dist/cjs/resources/user.js +0 -37
  282. package/dist/cjs/resources/user.js.map +0 -1
  283. package/dist/cjs/resources/wallet.d.ts +0 -11
  284. package/dist/cjs/resources/wallet.d.ts.map +0 -1
  285. package/dist/cjs/resources/wallet.js +0 -19
  286. package/dist/cjs/resources/wallet.js.map +0 -1
  287. package/dist/esm/resources/order.d.ts +0 -17
  288. package/dist/esm/resources/order.d.ts.map +0 -1
  289. package/dist/esm/resources/order.js +0 -26
  290. package/dist/esm/resources/order.js.map +0 -1
  291. package/dist/esm/resources/stats.d.ts +0 -11
  292. package/dist/esm/resources/stats.d.ts.map +0 -1
  293. package/dist/esm/resources/stats.js +0 -14
  294. package/dist/esm/resources/stats.js.map +0 -1
  295. package/dist/esm/resources/user.d.ts +0 -22
  296. package/dist/esm/resources/user.d.ts.map +0 -1
  297. package/dist/esm/resources/user.js +0 -33
  298. package/dist/esm/resources/user.js.map +0 -1
  299. package/dist/esm/resources/wallet.d.ts +0 -11
  300. package/dist/esm/resources/wallet.d.ts.map +0 -1
  301. package/dist/esm/resources/wallet.js +0 -15
  302. package/dist/esm/resources/wallet.js.map +0 -1
  303. package/dist/types/client.d.ts +0 -19
  304. package/dist/types/client.d.ts.map +0 -1
  305. package/dist/types/error.d.ts +0 -15
  306. package/dist/types/error.d.ts.map +0 -1
  307. package/dist/types/http.d.ts +0 -21
  308. package/dist/types/http.d.ts.map +0 -1
  309. package/dist/types/index.d.ts +0 -4
  310. package/dist/types/index.d.ts.map +0 -1
  311. package/dist/types/resources/asset.d.ts +0 -11
  312. package/dist/types/resources/asset.d.ts.map +0 -1
  313. package/dist/types/resources/bank.d.ts +0 -13
  314. package/dist/types/resources/bank.d.ts.map +0 -1
  315. package/dist/types/resources/order.d.ts +0 -17
  316. package/dist/types/resources/order.d.ts.map +0 -1
  317. package/dist/types/resources/stats.d.ts +0 -11
  318. package/dist/types/resources/stats.d.ts.map +0 -1
  319. package/dist/types/resources/transaction.d.ts +0 -15
  320. package/dist/types/resources/transaction.d.ts.map +0 -1
  321. package/dist/types/resources/user.d.ts +0 -22
  322. package/dist/types/resources/user.d.ts.map +0 -1
  323. package/dist/types/resources/wallet.d.ts +0 -11
  324. package/dist/types/resources/wallet.d.ts.map +0 -1
  325. package/dist/types/types/index.d.ts +0 -213
  326. package/dist/types/types/index.d.ts.map +0 -1
  327. package/dist/types/utils.d.ts +0 -7
  328. package/dist/types/utils.d.ts.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,10 +1,63 @@
1
+ ## [1.0.2] - 2026-09-17
2
+
3
+ ### Added
4
+ - Constants for every value the API enumerates, exported as frozen objects with a type of the same name: `ApikeyState`, `AssetState`, `BankDirection`, `CoreState`, `CoreType`, `CustomerState`, `IdentityMode`, `IdentityState`, `Locale`, `OrderSide`, `OrderState`, `OrganizationCategory`, `StakingMovementKind`, `StakingMovementState`, `StakingPositionState`, `SubscriberState`, `TradingDirection`, `TransactionDirection`, `TransactionSource`, `TransactionState`, `WalletState`, `WalletType`, `WebhookEventName` — `CreateCustomerParams.organization`, `Apikey.state`, `Subscriber.state` and `WebhookType.state` are typed with them (`CustomerSetup.choosenOrganization` stays open: `OrganizationCategory | string`)
5
+ - Typed references: wherever a method expects the uuid of something the SDK returns, it also accepts the model and sends its uuid — `UserRef` is `string | Created | Customer | Account | UserSummary | OrderUser`; assets take `AssetInput` (`string | Asset | AssetRef`); `trading.get(string | Order)`, `transaction.get(string | Transaction)`, `core.get(string | Core)`, `staking.get(string | StakingMovement)`, `staking.rewards` / `unstake(string | StakingPosition)`, `webhooks.subscribe` / `catalogItem(string | WebhookType)`, `webhooks.archive` / `reactivate` / `logs(string | Subscriber)`, `apikeys.get` / `logs(string | Apikey)`
6
+ - Types `Created`, `AssetRef`, `AssetInput`, `UserSummary`, `OrganizationSummary`, `OrganizationHub`, `OrderUser`, `OrderOrganization`, `CoreRef`; `customer.create`, `bank.credit`, `staking.stake` and `webhooks.subscribe` return a `Created`
7
+
8
+ ### Changed
9
+ - `Locale` is `FR` or `EN` — `ES` and `DE` are gone: the API knows no other value (anything else falls back to `FR` on its side)
10
+ - `host` must be a bare hostname (letters, digits, `.`, `-`, `_`): credentials, query, fragment, brackets and spaces are refused
11
+ - An empty `asset` — or a model without uuid — is refused with a `TypeError` before any request, in request bodies too (`trading.buy` / `sell`, `custody.withdraw`, `staking.stake`); in the lists, `asset: null` means no filter, like `user: null`
12
+ - `Wallet.history` is typed `History | {}`: `{}` on a new wallet until its curve has been computed, as the API answers
13
+ - Documentation: the SDK's methods, types and constants — no API routes; constants instead of string literals; minimums stated with their error code, without figures
14
+
15
+ ## [1.0.1] - 2026-09-16
16
+
17
+ ### Changed
18
+ - `User-Agent` header is now `bitgen-sdk-nodejs/<version>` (was `bitgen-sdk/<version>`)
19
+
20
+ ## [1.0.0] - 2026-09-16
21
+
22
+ ### Breaking
23
+ - Targets the BITGEN API v4: no more `/api/v3` prefix, real HTTP status codes
24
+ - `BitgenError` exposes `status` (the HTTP status) and `code` (the stable error code); `service`, `module` and `apiMessage` are removed
25
+ - Requires Node.js 20 or later
26
+ - Every resource method is `async`: an invalid argument rejects the returned promise with a `TypeError` (the constructor stays synchronous)
27
+ - The 0.1.x resources are replaced by the ones below
28
+
29
+ ### Added
30
+ - `customer` resource: `create` (with the `needActivation` / `notify` options), `list`, `get`, `update`
31
+ - `bank` resource: `get`, `operations`, `withdraw`, `credit`
32
+ - `custody` resource: `wallets`, `wallet`, `portfolio`, `withdraw`
33
+ - `trading` resource: `buy`, `sell`, `get`, `list`
34
+ - `transaction` resource: `list`, `get`
35
+ - `staking` resource: `providers`, `stake`, `list`, `movements`, `get`, `rewards`, `unstake`, `operations`, `portfolio`
36
+ - `core` resource: `list`, `get`
37
+ - `webhooks` resource: `activate`, `updateEndpoint`, `regenerate`, `list`, `subscribe`, `archive`, `reactivate`, `logs`, `catalog`, `catalogItem`, `verify`
38
+ - `apikeys` resource: `list`, `get`, `logs`
39
+ - `asset` resource: `list`, `get`, `tickers`, `ticker`
40
+ - `Env` (`PRODUCTION`, `SANDBOX`) and `Asset` (`BTC`, `ETH`, `USDC`, `XRP`, `SOL` — provisional list) constants, usable from JavaScript and TypeScript
41
+ - `Page<T>` and `PageParams` types for paginated lists (`{ count, items }`, `offset` / `limit`)
42
+ - `Amount` type: amounts accept `string | number` and are always sent as strings
43
+ - `Identity` type as a union discriminated on `mode` (`KycIdentity | KybIdentity`)
44
+ - `timeout` option, in seconds (default `30`, `0` disables)
45
+ - `request_timeout` / `network_error` errors (`status: 0`, native error in `cause`)
46
+ - `webhooks.verify`: HMAC verification of a received delivery (raw bytes, constant time, anti-replay window)
47
+ - `User-Agent: bitgen-sdk/<version>` header on every request
48
+ - `BitgenError.toJSON()`, and `instanceof` reliable when the ESM and CommonJS builds are both loaded
49
+
50
+ ## [0.1.6] - 2026-03-22
51
+
52
+ ### Changed
53
+ - Added `isSsl` config option (default `true`) for custom host mode
54
+ - Localhost default port changed from `80` to `14303`
55
+
1
56
  ## [0.1.5] - 2026-03-22
2
57
 
3
58
  ### Changed
4
59
  - Sandbox URL updated from `api.btgn.dev` to `api.staging.btgn.dev`
5
60
  - Removed `dist/` from repository (built by CI on release)
6
- - Added `isSsl` config option (default `true`) for custom host mode
7
- - Localhost default port changed from `80` to `14303`
8
61
 
9
62
  ## [0.1.3] - 2026-03-11
10
63
 
package/README.md CHANGED
@@ -1,119 +1,40 @@
1
- # @bitgen/sdk
1
+ # @bitgen/sdk — v1.0.3
2
2
 
3
- Official Node.js SDK for the BITGEN Crypto-as-a-Service API v3.1.x.
4
-
5
- ## Installation
6
-
7
- ```bash
8
- npm install @bitgen/sdk
9
- ```
10
-
11
- ## Quick start
3
+ Official Node.js SDK for the BITGEN API v4 — server-side, TypeScript, ESM and CommonJS, no runtime dependency.
4
+ Install it with `npm install @bitgen/sdk` (Node.js 20 or later).
12
5
 
13
6
  ```ts
14
- import { BitgenClient } from '@bitgen/sdk'
7
+ import { BitgenClient, Env } from '@bitgen/sdk'
15
8
 
16
9
  const client = new BitgenClient({
17
- scope: 'YOUR_SCOPE_UUID',
18
- apiKey: 'YOUR_API_KEY'
10
+ scope: 'YOUR_SCOPE_UUID', // uuid of the organization that owns the key
11
+ apiKey: 'YOUR_API_KEY',
12
+ env: Env.SANDBOX, // Env.PRODUCTION by default
19
13
  })
20
- ```
21
14
 
22
- ## Environments
23
-
24
- | env |
25
- |---------------|
26
- | `production` |
27
- | `sandbox` |
28
-
29
- ```ts
30
- // Custom host (e.g. Docker container)
31
- const client = new BitgenClient({
32
- scope: '...',
33
- apiKey: '...',
34
- host: 'my-container',
35
- port: 8080
36
- })
15
+ const account = await client.bank.get('CUSTOMER_UUID')
16
+ console.log(account.balance) // EUR balance of the customer
37
17
  ```
38
18
 
39
- ## Resources
19
+ - [Installation](readme/installation.md) — Node.js 20+, ESM, CommonJS, TypeScript
20
+ - [Quick start](readme/quick-start.md) — a customer, their EUR account, a wallet, a purchase
21
+ - [Configuration](readme/configuration.md) — credentials, environments, custom host, timeout
22
+ - [Concepts](readme/concepts.md) — user references, amounts, pagination, assets, activation, constants
23
+ - [Errors](readme/errors.md) — `BitgenError`, error codes, rejected promises
40
24
 
41
- ### `client.asset`
42
- ```ts
43
- const assets = await client.asset.list()
44
- const btc = await client.asset.get('BTC')
45
- ```
25
+ Resources, in the order of an integration:
46
26
 
47
- ### `client.user`
48
- ```ts
49
- const { uuid } = await client.user.create({ email, iban, firstname, lastname })
50
- const { items } = await client.user.list({ offset: 0, limit: 100 })
51
- const user = await client.user.get('uuid')
52
- await client.user.update(user, { email: 'new@email.com' })
53
- await client.user.disable(user)
54
- ```
27
+ - [Customers](readme/resource/customer.md) — `client.customer`
28
+ - [Bank accounts](readme/resource/bank.md) — `client.bank`
29
+ - [Custody wallets](readme/resource/custody.md) — `client.custody`
30
+ - [Trading](readme/resource/trading.md) — `client.trading`
31
+ - [Transactions](readme/resource/transaction.md) — `client.transaction`
32
+ - [Staking](readme/resource/staking.md) — `client.staking`
33
+ - [Connectors](readme/resource/core.md) — `client.core`
34
+ - [Webhooks](readme/resource/webhooks.md) — `client.webhooks`
35
+ - [API keys](readme/resource/apikeys.md) — `client.apikeys`
36
+ - [Assets](readme/resource/asset.md) — `client.asset`
55
37
 
56
- ### `client.bank`
57
- ```ts
58
- const account = await client.bank.get(user)
59
- const withdrawal = await client.bank.withdraw(user, 50)
60
- const history = await client.bank.operations(user, { direction: 'WITHDRAWAL' })
61
- ```
62
-
63
- ### `client.order`
64
- ```ts
65
- const order = await client.order.create({ user, asset: 'ETH', amount: 25, mode: 'BUY' })
66
- const order = await client.order.create({ user, asset: 'BTC', amount: 0.001, mode: 'SELL' })
67
- const status = await client.order.get(order.tunnel)
68
- const history = await client.order.history(user)
69
- ```
70
-
71
- ### `client.transaction`
72
- ```ts
73
- const tx = await client.transaction.create({
74
- user,
75
- asset: 'BTC',
76
- amount: 0.001,
77
- targetAddress: 'tb1q...',
78
- })
79
- const status = await client.transaction.get(tx.txId)
80
- const history = await client.transaction.history(user, { asset: 'BTC' })
81
- ```
82
-
83
- ### `client.wallet`
84
- ```ts
85
- const wallets = await client.wallet.list(user)
86
- const btcWallet = await client.wallet.get(user, 'BTC')
87
- ```
88
-
89
- ### `client.stats`
90
- ```ts
91
- const health = await client.stats.health()
92
- const quotas = await client.stats.quotas()
93
- ```
94
-
95
- ## UserRef
96
-
97
- Toutes les méthodes acceptant un `user` acceptent soit un UUID string, soit un objet `User` :
98
-
99
- ```ts
100
- const user = await client.user.get('ed1a19bb-...')
101
- await client.bank.get(user) // objet User
102
- await client.bank.get('ed1a19bb-...') // UUID string
103
- ```
104
-
105
- ## Error handling
106
-
107
- ```ts
108
- import { BitgenClient, BitgenError } from '@bitgen/sdk'
38
+ ## License
109
39
 
110
- try {
111
- await client.order.create({ user, asset: 'ETH', amount: 25, mode: 'BUY' })
112
- } catch (err) {
113
- if (err instanceof BitgenError) {
114
- console.log(err.service) // e.g. "order"
115
- console.log(err.code) // e.g. 416
116
- console.log(err.apiMessage) // e.g. "requested_amount_error"
117
- }
118
- }
119
- ```
40
+ Private — © BITGEN
@@ -1,19 +1,31 @@
1
+ import { HttpClient } from './http.js';
2
+ import { ApikeysResource } from './resources/apikeys.js';
1
3
  import { AssetResource } from './resources/asset.js';
2
4
  import { BankResource } from './resources/bank.js';
3
- import { OrderResource } from './resources/order.js';
5
+ import { CoreResource } from './resources/core.js';
6
+ import { CustodyResource } from './resources/custody.js';
7
+ import { CustomerResource } from './resources/customer.js';
8
+ import { StakingResource } from './resources/staking.js';
9
+ import { TradingResource } from './resources/trading.js';
4
10
  import { TransactionResource } from './resources/transaction.js';
5
- import { UserResource } from './resources/user.js';
6
- import { WalletResource } from './resources/wallet.js';
7
- import { StatsResource } from './resources/stats.js';
11
+ import { WebhooksResource } from './resources/webhooks.js';
8
12
  import type { BitgenConfig } from './types/index.js';
13
+ /**
14
+ * Entry point of the SDK: one instance per API key, resources hang off it (`client.asset`…).
15
+ * Invalid config throws a `TypeError` here, before any request is sent.
16
+ */
9
17
  export declare class BitgenClient {
18
+ protected readonly http: HttpClient;
10
19
  readonly asset: AssetResource;
20
+ readonly customer: CustomerResource;
11
21
  readonly bank: BankResource;
12
- readonly order: OrderResource;
22
+ readonly custody: CustodyResource;
23
+ readonly trading: TradingResource;
13
24
  readonly transaction: TransactionResource;
14
- readonly user: UserResource;
15
- readonly wallet: WalletResource;
16
- readonly stats: StatsResource;
25
+ readonly core: CoreResource;
26
+ readonly staking: StakingResource;
27
+ readonly webhooks: WebhooksResource;
28
+ readonly apikeys: ApikeysResource;
17
29
  constructor(config: BitgenConfig);
18
30
  }
19
31
  //# sourceMappingURL=client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAA;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA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,qBAAa,YAAY;IACvB,SAAS,CAAC,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAA;IAEnC,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAA;IAC7B,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAA;IACnC,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAA;IAC3B,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAA;IACjC,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAA;IACjC,QAAQ,CAAC,WAAW,EAAE,mBAAmB,CAAA;IACzC,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAA;IAC3B,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAA;IACjC,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAA;IACnC,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAA;gBAErB,MAAM,EAAE,YAAY;CAcjC"}
@@ -2,23 +2,44 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.BitgenClient = void 0;
4
4
  const http_js_1 = require("./http.js");
5
+ const apikeys_js_1 = require("./resources/apikeys.js");
5
6
  const asset_js_1 = require("./resources/asset.js");
6
7
  const bank_js_1 = require("./resources/bank.js");
7
- const order_js_1 = require("./resources/order.js");
8
+ const core_js_1 = require("./resources/core.js");
9
+ const custody_js_1 = require("./resources/custody.js");
10
+ const customer_js_1 = require("./resources/customer.js");
11
+ const staking_js_1 = require("./resources/staking.js");
12
+ const trading_js_1 = require("./resources/trading.js");
8
13
  const transaction_js_1 = require("./resources/transaction.js");
9
- const user_js_1 = require("./resources/user.js");
10
- const wallet_js_1 = require("./resources/wallet.js");
11
- const stats_js_1 = require("./resources/stats.js");
14
+ const webhooks_js_1 = require("./resources/webhooks.js");
15
+ /**
16
+ * Entry point of the SDK: one instance per API key, resources hang off it (`client.asset`…).
17
+ * Invalid config throws a `TypeError` here, before any request is sent.
18
+ */
12
19
  class BitgenClient {
20
+ http;
21
+ asset;
22
+ customer;
23
+ bank;
24
+ custody;
25
+ trading;
26
+ transaction;
27
+ core;
28
+ staking;
29
+ webhooks;
30
+ apikeys;
13
31
  constructor(config) {
14
- const http = new http_js_1.HttpClient(config);
15
- this.asset = new asset_js_1.AssetResource(http);
16
- this.bank = new bank_js_1.BankResource(http);
17
- this.order = new order_js_1.OrderResource(http);
18
- this.transaction = new transaction_js_1.TransactionResource(http);
19
- this.user = new user_js_1.UserResource(http);
20
- this.wallet = new wallet_js_1.WalletResource(http);
21
- this.stats = new stats_js_1.StatsResource(http);
32
+ this.http = new http_js_1.HttpClient(config);
33
+ this.asset = new asset_js_1.AssetResource(this.http);
34
+ this.customer = new customer_js_1.CustomerResource(this.http);
35
+ this.bank = new bank_js_1.BankResource(this.http);
36
+ this.custody = new custody_js_1.CustodyResource(this.http);
37
+ this.trading = new trading_js_1.TradingResource(this.http);
38
+ this.transaction = new transaction_js_1.TransactionResource(this.http);
39
+ this.core = new core_js_1.CoreResource(this.http);
40
+ this.staking = new staking_js_1.StakingResource(this.http, this.core);
41
+ this.webhooks = new webhooks_js_1.WebhooksResource(this.http);
42
+ this.apikeys = new apikeys_js_1.ApikeysResource(this.http);
22
43
  }
23
44
  }
24
45
  exports.BitgenClient = BitgenClient;
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":";;;AAAA,uCAAsC;AACtC,mDAAoD;AACpD,iDAAkD;AAClD,mDAAoD;AACpD,+DAAgE;AAChE,iDAAkD;AAClD,qDAAsD;AACtD,mDAAoD;AAGpD,MAAa,YAAY;IASvB,YAAY,MAAoB;QAC9B,MAAM,IAAI,GAAG,IAAI,oBAAU,CAAC,MAAM,CAAC,CAAA;QAEnC,IAAI,CAAC,KAAK,GAAG,IAAI,wBAAa,CAAC,IAAI,CAAC,CAAA;QACpC,IAAI,CAAC,IAAI,GAAG,IAAI,sBAAY,CAAC,IAAI,CAAC,CAAA;QAClC,IAAI,CAAC,KAAK,GAAG,IAAI,wBAAa,C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,GAAG,IAAI,4BAAe,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QAC7C,IAAI,CAAC,WAAW,GAAG,IAAI,oCAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QACrD,IAAI,CAAC,IAAI,GAAG,IAAI,sBAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QACvC,IAAI,CAAC,OAAO,GAAG,IAAI,4BAAe,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,CAAA;QACxD,IAAI,CAAC,QAAQ,GAAG,IAAI,8BAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QAC/C,IAAI,CAAC,OAAO,GAAG,IAAI,4BAAe,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAC/C,CAAC;CACF;AA5BD,oCA4BC"}
@@ -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,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