@bitgen/sdk 0.1.6 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (338) hide show
  1. package/CHANGELOG.md +63 -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 +128 -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/media/activation.svg +58 -0
  233. package/readme/media/deposit-flow.svg +70 -0
  234. package/readme/media/order-buy.svg +43 -0
  235. package/readme/media/order-sell.svg +47 -0
  236. package/readme/media/purchase-flow.svg +61 -0
  237. package/readme/media/sale-flow.svg +61 -0
  238. package/readme/media/staking-position.svg +75 -0
  239. package/readme/media/transaction-lifecycle.svg +61 -0
  240. package/readme/media/webhook-delivery.svg +53 -0
  241. package/readme/media/withdrawal-flow.svg +64 -0
  242. package/readme/quick-start.md +87 -0
  243. package/readme/resource/apikeys.md +103 -0
  244. package/readme/resource/asset.md +121 -0
  245. package/readme/resource/bank.md +161 -0
  246. package/readme/resource/core.md +91 -0
  247. package/readme/resource/custody.md +166 -0
  248. package/readme/resource/customer.md +210 -0
  249. package/readme/resource/staking.md +281 -0
  250. package/readme/resource/trading.md +171 -0
  251. package/readme/resource/transaction.md +110 -0
  252. package/readme/resource/webhooks.md +309 -0
  253. package/src/client.ts +46 -0
  254. package/src/constants.ts +281 -0
  255. package/src/error.ts +36 -0
  256. package/src/http.ts +201 -0
  257. package/src/index.ts +111 -0
  258. package/src/resources/apikeys.ts +30 -0
  259. package/src/resources/asset.ts +28 -0
  260. package/src/resources/bank.ts +39 -0
  261. package/src/resources/core.ts +19 -0
  262. package/src/resources/custody.ts +37 -0
  263. package/src/resources/customer.ts +46 -0
  264. package/src/resources/staking.ts +88 -0
  265. package/src/resources/trading.ts +41 -0
  266. package/src/resources/transaction.ts +20 -0
  267. package/src/resources/webhooks.ts +169 -0
  268. package/src/types/apikeys.ts +35 -0
  269. package/src/types/asset.ts +59 -0
  270. package/src/types/bank.ts +60 -0
  271. package/src/types/core.ts +32 -0
  272. package/src/types/custody.ts +40 -0
  273. package/src/types/customer.ts +189 -0
  274. package/src/types/index.ts +215 -0
  275. package/src/types/staking.ts +87 -0
  276. package/src/types/trading.ts +56 -0
  277. package/src/types/transaction.ts +62 -0
  278. package/src/types/webhooks.ts +60 -0
  279. package/src/utils.ts +74 -0
  280. package/src/version.ts +2 -0
  281. package/dist/cjs/resources/order.d.ts +0 -17
  282. package/dist/cjs/resources/order.d.ts.map +0 -1
  283. package/dist/cjs/resources/order.js +0 -30
  284. package/dist/cjs/resources/order.js.map +0 -1
  285. package/dist/cjs/resources/stats.d.ts +0 -11
  286. package/dist/cjs/resources/stats.d.ts.map +0 -1
  287. package/dist/cjs/resources/stats.js +0 -18
  288. package/dist/cjs/resources/stats.js.map +0 -1
  289. package/dist/cjs/resources/user.d.ts +0 -22
  290. package/dist/cjs/resources/user.d.ts.map +0 -1
  291. package/dist/cjs/resources/user.js +0 -37
  292. package/dist/cjs/resources/user.js.map +0 -1
  293. package/dist/cjs/resources/wallet.d.ts +0 -11
  294. package/dist/cjs/resources/wallet.d.ts.map +0 -1
  295. package/dist/cjs/resources/wallet.js +0 -19
  296. package/dist/cjs/resources/wallet.js.map +0 -1
  297. package/dist/esm/resources/order.d.ts +0 -17
  298. package/dist/esm/resources/order.d.ts.map +0 -1
  299. package/dist/esm/resources/order.js +0 -26
  300. package/dist/esm/resources/order.js.map +0 -1
  301. package/dist/esm/resources/stats.d.ts +0 -11
  302. package/dist/esm/resources/stats.d.ts.map +0 -1
  303. package/dist/esm/resources/stats.js +0 -14
  304. package/dist/esm/resources/stats.js.map +0 -1
  305. package/dist/esm/resources/user.d.ts +0 -22
  306. package/dist/esm/resources/user.d.ts.map +0 -1
  307. package/dist/esm/resources/user.js +0 -33
  308. package/dist/esm/resources/user.js.map +0 -1
  309. package/dist/esm/resources/wallet.d.ts +0 -11
  310. package/dist/esm/resources/wallet.d.ts.map +0 -1
  311. package/dist/esm/resources/wallet.js +0 -15
  312. package/dist/esm/resources/wallet.js.map +0 -1
  313. package/dist/types/client.d.ts +0 -19
  314. package/dist/types/client.d.ts.map +0 -1
  315. package/dist/types/error.d.ts +0 -15
  316. package/dist/types/error.d.ts.map +0 -1
  317. package/dist/types/http.d.ts +0 -21
  318. package/dist/types/http.d.ts.map +0 -1
  319. package/dist/types/index.d.ts +0 -4
  320. package/dist/types/index.d.ts.map +0 -1
  321. package/dist/types/resources/asset.d.ts +0 -11
  322. package/dist/types/resources/asset.d.ts.map +0 -1
  323. package/dist/types/resources/bank.d.ts +0 -13
  324. package/dist/types/resources/bank.d.ts.map +0 -1
  325. package/dist/types/resources/order.d.ts +0 -17
  326. package/dist/types/resources/order.d.ts.map +0 -1
  327. package/dist/types/resources/stats.d.ts +0 -11
  328. package/dist/types/resources/stats.d.ts.map +0 -1
  329. package/dist/types/resources/transaction.d.ts +0 -15
  330. package/dist/types/resources/transaction.d.ts.map +0 -1
  331. package/dist/types/resources/user.d.ts +0 -22
  332. package/dist/types/resources/user.d.ts.map +0 -1
  333. package/dist/types/resources/wallet.d.ts +0 -11
  334. package/dist/types/resources/wallet.d.ts.map +0 -1
  335. package/dist/types/types/index.d.ts +0 -213
  336. package/dist/types/types/index.d.ts.map +0 -1
  337. package/dist/types/utils.d.ts +0 -7
  338. package/dist/types/utils.d.ts.map +0 -1
@@ -0,0 +1,53 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 540" role="img" aria-labelledby="title">
2
+ <title id="title">Receiving a webhook delivery: the POST, its verification, the 2xx answer and the retries</title>
3
+ <defs>
4
+ <marker id="m0d9488" viewBox="0 0 8 8" refX="7" refY="4" markerWidth="8" markerHeight="8" markerUnits="userSpaceOnUse" orient="auto"><path d="M0,0.5 L7,4 L0,7.5 z" fill="#0d9488"/></marker>
5
+ <marker id="m7c3aed" viewBox="0 0 8 8" refX="7" refY="4" markerWidth="8" markerHeight="8" markerUnits="userSpaceOnUse" orient="auto"><path d="M0,0.5 L7,4 L0,7.5 z" fill="#7c3aed"/></marker>
6
+ <pattern id="grid" width="16" height="16" patternUnits="userSpaceOnUse"><circle cx="8" cy="8" r="1" fill="#e2e8f0"/></pattern>
7
+ <filter id="shadow" x="-10%" y="-20%" width="120%" height="160%"><feDropShadow dx="0" dy="1" stdDeviation="2" flood-color="#0f172a" flood-opacity="0.10"/></filter>
8
+ </defs>
9
+ <rect width="1000" height="540" fill="#ffffff"/>
10
+ <rect width="1000" height="540" fill="url(#grid)"/>
11
+ <text x="500.0" y="34.5" font-family="Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif" font-size="14" font-weight="600" fill="#0f172a" text-anchor="middle">Receiving a delivery</text>
12
+ <line x1="250" y1="48" x2="250" y2="524" stroke="#e2e8f0" stroke-width="2"/>
13
+ <rect x="248" y="21" width="4" height="18" rx="2" fill="#7c3aed"/>
14
+ <text x="260.0" y="34.5" font-family="Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif" font-size="13" font-weight="600" fill="#0f172a" text-anchor="start">BITGEN</text>
15
+ <line x1="750" y1="48" x2="750" y2="524" stroke="#e2e8f0" stroke-width="2"/>
16
+ <rect x="748" y="21" width="4" height="18" rx="2" fill="#0d9488"/>
17
+ <text x="760.0" y="34.5" font-family="Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif" font-size="13" font-weight="600" fill="#0f172a" text-anchor="start">Your endpoint</text>
18
+ <rect x="247" y="82" width="6" height="100" rx="3" fill="#7c3aed"/>
19
+ <rect x="747" y="82" width="6" height="100" rx="3" fill="#0d9488"/>
20
+ <path d="M254,132 H745" fill="none" stroke="#7c3aed" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" marker-end="url(#m7c3aed)"/>
21
+ <rect x="310" y="78" width="380" height="108" rx="10" fill="#ffffff" stroke="#e2e8f0" filter="url(#shadow)"/>
22
+ <text x="326.0" y="102.0" font-family="Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif" font-size="12" font-weight="600" fill="#0f172a" text-anchor="start">POST — the delivery</text>
23
+ <text x="326.0" y="122.0" font-family="Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif" font-size="11.5" font-weight="400" fill="#475569" text-anchor="start"><tspan font-family="'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" font-size="0.92em" font-weight="600">Content-Type: application/json</tspan></text>
24
+ <text x="326.0" y="139.0" font-family="Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif" font-size="11.5" font-weight="400" fill="#475569" text-anchor="start"><tspan font-family="'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" font-size="0.92em" font-weight="600">X-BITGEN-Timestamp: &lt;epoch seconds&gt;</tspan></text>
25
+ <text x="326.0" y="156.0" font-family="Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif" font-size="11.5" font-weight="400" fill="#475569" text-anchor="start"><tspan font-family="'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" font-size="0.92em" font-weight="600">X-BITGEN-Signature: sha256=&lt;hex&gt;</tspan></text>
26
+ <text x="326.0" y="173.0" font-family="Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif" font-size="11.5" font-weight="400" fill="#475569" text-anchor="start"><tspan font-family="'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" font-size="0.92em" font-weight="600">{ delivery_id, timestamp, event, data }</tspan></text>
27
+ <rect x="747" y="204" width="6" height="132" rx="3" fill="#0d9488"/>
28
+ <rect x="550" y="208" width="400" height="124" rx="10" fill="#ffffff" stroke="#e2e8f0" filter="url(#shadow)"/>
29
+ <text x="566.0" y="232.0" font-family="Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif" font-size="12" font-weight="600" fill="#0f172a" text-anchor="start">Verify the delivery</text>
30
+ <text x="566.0" y="252.0" font-family="Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif" font-size="11.5" font-weight="400" fill="#475569" text-anchor="start">1 · Recompute <tspan font-family="'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" font-size="0.92em" font-weight="600">HMAC_SHA256(secret, "&lt;timestamp&gt;.&lt;rawBody&gt;")</tspan></text>
31
+ <text x="566.0" y="269.0" font-family="Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif" font-size="11.5" font-weight="400" fill="#475569" text-anchor="start">&#160;&#160;&#160;&#160;on the raw body, with the timestamp of the header</text>
32
+ <text x="566.0" y="286.0" font-family="Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif" font-size="11.5" font-weight="400" fill="#475569" text-anchor="start">2 · Compare it with <tspan font-family="'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" font-size="0.92em" font-weight="600">X-BITGEN-Signature</tspan> in constant time</text>
33
+ <text x="566.0" y="303.0" font-family="Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif" font-size="11.5" font-weight="400" fill="#475569" text-anchor="start">3 · Reject it when <tspan font-family="'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" font-size="0.92em" font-weight="600">X-BITGEN-Timestamp</tspan> is more than 300 s away</text>
34
+ <text x="566.0" y="320.0" font-family="Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif" font-size="11.5" font-weight="400" fill="#475569" text-anchor="start">4 · Only then, parse the body</text>
35
+ <rect x="247" y="362" width="6" height="36" rx="3" fill="#7c3aed"/>
36
+ <rect x="747" y="362" width="6" height="36" rx="3" fill="#0d9488"/>
37
+ <path d="M746,380 H255" fill="none" stroke="#0d9488" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" marker-end="url(#m0d9488)"/>
38
+ <rect x="410" y="364" width="180" height="32" rx="10" fill="#dcfce7" stroke="#bbf7d0" filter="url(#shadow)"/>
39
+ <text x="500.0" y="384.3" font-family="Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif" font-size="12" font-weight="600" fill="#15803d" text-anchor="middle"><tspan font-family="'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" font-size="0.92em" font-weight="600">2xx</tspan> — delivered</text>
40
+ <rect x="247" y="428" width="6" height="68" rx="3" fill="#7c3aed"/>
41
+ <rect x="747" y="428" width="6" height="68" rx="3" fill="#0d9488"/>
42
+ <path d="M254,462 H745" fill="none" stroke="#7c3aed" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" stroke-dasharray="4 4" marker-end="url(#m7c3aed)"/>
43
+ <rect x="310" y="428" width="380" height="68" rx="10" fill="#ffffff" stroke="#e2e8f0" filter="url(#shadow)"/>
44
+ <text x="326.0" y="452.0" font-family="Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif" font-size="12" font-weight="600" fill="#0f172a" text-anchor="start">No 2xx: the delivery is retried 4 times</text>
45
+ <rect x="326" y="466" width="85" height="24" rx="12.0" fill="#f1f5f9"/>
46
+ <text x="368.0" y="482.1" font-family="Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif" font-size="11.5" font-weight="500" fill="#475569" text-anchor="middle">after 60 s</text>
47
+ <rect x="429" y="466" width="54" height="24" rx="12.0" fill="#f1f5f9"/>
48
+ <text x="456.0" y="482.1" font-family="Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif" font-size="11.5" font-weight="500" fill="#475569" text-anchor="middle">5 min</text>
49
+ <rect x="504" y="466" width="60" height="24" rx="12.0" fill="#f1f5f9"/>
50
+ <text x="534.0" y="482.1" font-family="Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif" font-size="11.5" font-weight="500" fill="#475569" text-anchor="middle">15 min</text>
51
+ <rect x="584" y="466" width="41" height="24" rx="12.0" fill="#f1f5f9"/>
52
+ <text x="604.0" y="482.1" font-family="Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif" font-size="11.5" font-weight="500" fill="#475569" text-anchor="middle">1 h</text>
53
+ </svg>
@@ -0,0 +1,64 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 600" role="img" aria-labelledby="title">
2
+ <title id="title">An EUR withdrawal: the reserve on the ledger, the compliance analysis, the wire from the organization account to the customer IBAN, the debit at confirmation</title>
3
+ <defs>
4
+ <marker id="md97706" viewBox="0 0 8 8" refX="7" refY="4" markerWidth="8" markerHeight="8" markerUnits="userSpaceOnUse" orient="auto"><path d="M0,0.5 L7,4 L0,7.5 z" fill="#d97706"/></marker>
5
+ <marker id="m7c3aed" viewBox="0 0 8 8" refX="7" refY="4" markerWidth="8" markerHeight="8" markerUnits="userSpaceOnUse" orient="auto"><path d="M0,0.5 L7,4 L0,7.5 z" fill="#7c3aed"/></marker>
6
+ <marker id="m0d9488" viewBox="0 0 8 8" refX="7" refY="4" markerWidth="8" markerHeight="8" markerUnits="userSpaceOnUse" orient="auto"><path d="M0,0.5 L7,4 L0,7.5 z" fill="#0d9488"/></marker>
7
+ <pattern id="grid" width="16" height="16" patternUnits="userSpaceOnUse"><circle cx="8" cy="8" r="1" fill="#e2e8f0"/></pattern>
8
+ <filter id="shadow" x="-10%" y="-20%" width="120%" height="160%"><feDropShadow dx="0" dy="1" stdDeviation="2" flood-color="#0f172a" flood-opacity="0.10"/></filter>
9
+ </defs>
10
+ <rect width="1000" height="600" fill="#ffffff"/>
11
+ <rect width="1000" height="600" fill="url(#grid)"/>
12
+ <line x1="110" y1="48" x2="110" y2="520" stroke="#e2e8f0" stroke-width="2"/>
13
+ <rect x="108" y="21" width="4" height="18" rx="2" fill="#0f172a"/>
14
+ <text x="120.0" y="34.5" font-family="Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif" font-size="13" font-weight="600" fill="#0f172a" text-anchor="start">Customer</text>
15
+ <line x1="370" y1="48" x2="370" y2="520" stroke="#e2e8f0" stroke-width="2"/>
16
+ <rect x="368" y="21" width="4" height="18" rx="2" fill="#d97706"/>
17
+ <text x="380.0" y="34.5" font-family="Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif" font-size="13" font-weight="600" fill="#0f172a" text-anchor="start">Bank provider (holds the funds)</text>
18
+ <line x1="630" y1="48" x2="630" y2="520" stroke="#e2e8f0" stroke-width="2"/>
19
+ <rect x="628" y="21" width="4" height="18" rx="2" fill="#7c3aed"/>
20
+ <text x="640.0" y="34.5" font-family="Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif" font-size="13" font-weight="600" fill="#0f172a" text-anchor="start">BITGEN ledger</text>
21
+ <line x1="870" y1="48" x2="870" y2="520" stroke="#e2e8f0" stroke-width="2"/>
22
+ <rect x="868" y="21" width="4" height="18" rx="2" fill="#0d9488"/>
23
+ <text x="880.0" y="34.5" font-family="Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif" font-size="13" font-weight="600" fill="#0f172a" text-anchor="start">Your organization</text>
24
+ <rect x="867" y="62" width="6" height="108" rx="3" fill="#0d9488"/>
25
+ <rect x="627" y="62" width="6" height="108" rx="3" fill="#7c3aed"/>
26
+ <path d="M866,116 H635" fill="none" stroke="#0d9488" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" marker-end="url(#m0d9488)"/>
27
+ <rect x="650" y="62" width="200" height="108" rx="10" fill="#ffffff" stroke="#e2e8f0" filter="url(#shadow)"/>
28
+ <text x="666.0" y="86.0" font-family="Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif" font-size="12" font-weight="600" fill="#0f172a" text-anchor="start">Withdraw</text>
29
+ <text x="666.0" y="106.0" font-family="Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif" font-size="11.5" font-weight="400" fill="#475569" text-anchor="start"><tspan font-family="'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" font-size="0.92em" font-weight="600">amount</tspan> 50.00 EUR, to the IBAN</text>
30
+ <text x="666.0" y="123.0" font-family="Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif" font-size="11.5" font-weight="400" fill="#475569" text-anchor="start">→ <tspan font-family="'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" font-size="0.92em" font-weight="600">200 { transaction }</tspan></text>
31
+ <text x="666.0" y="140.0" font-family="Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif" font-size="11.5" font-weight="400" fill="#475569" text-anchor="start">reserved: <tspan font-family="'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" font-size="0.92em" font-weight="600">pending.out</tspan> 50,</text>
32
+ <text x="666.0" y="157.0" font-family="Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif" font-size="11.5" font-weight="400" fill="#475569" text-anchor="start"><tspan font-family="'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" font-size="0.92em" font-weight="600">balance</tspan> untouched</text>
33
+ <rect x="627" y="178" width="6" height="92" rx="3" fill="#7c3aed"/>
34
+ <rect x="867" y="178" width="6" height="92" rx="3" fill="#0d9488"/>
35
+ <path d="M634,224 H865" fill="none" stroke="#7c3aed" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" marker-end="url(#m7c3aed)"/>
36
+ <rect x="650" y="178" width="200" height="92" rx="10" fill="#ffffff" stroke="#e2e8f0" filter="url(#shadow)"/>
37
+ <text x="666.0" y="202.0" font-family="Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif" font-size="12" font-weight="600" fill="#0f172a" text-anchor="start">Compliance analysis</text>
38
+ <text x="666.0" y="222.0" font-family="Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif" font-size="11.5" font-weight="400" fill="#475569" text-anchor="start">transaction <tspan font-family="'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" font-size="0.92em" font-weight="600">BANK</tspan> <tspan font-family="'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" font-size="0.92em" font-weight="600">OUT</tspan></text>
39
+ <text x="666.0" y="239.0" font-family="Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif" font-size="11.5" font-weight="400" fill="#475569" text-anchor="start">event <tspan font-family="'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" font-size="0.92em" font-weight="600">bank.transaction</tspan>,</text>
40
+ <text x="666.0" y="256.0" font-family="Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif" font-size="11.5" font-weight="400" fill="#475569" text-anchor="start"><tspan font-family="'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" font-size="0.92em" font-weight="600">PENDING</tspan> if an alert holds it</text>
41
+ <rect x="627" y="285" width="6" height="74" rx="3" fill="#7c3aed"/>
42
+ <rect x="367" y="285" width="6" height="74" rx="3" fill="#d97706"/>
43
+ <path d="M626,322 H375" fill="none" stroke="#7c3aed" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" marker-end="url(#m7c3aed)"/>
44
+ <rect x="400" y="285" width="200" height="74" rx="10" fill="#ffffff" stroke="#e2e8f0" filter="url(#shadow)"/>
45
+ <text x="416.0" y="309.0" font-family="Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif" font-size="12" font-weight="600" fill="#0f172a" text-anchor="start">Wire ordered</text>
46
+ <text x="416.0" y="329.0" font-family="Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif" font-size="11.5" font-weight="400" fill="#475569" text-anchor="start">from the organization's account</text>
47
+ <text x="416.0" y="346.0" font-family="Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif" font-size="11.5" font-weight="400" fill="#475569" text-anchor="start">to the customer's IBAN</text>
48
+ <rect x="367" y="374" width="6" height="60" rx="3" fill="#d97706"/>
49
+ <rect x="107" y="374" width="6" height="60" rx="3" fill="#0f172a"/>
50
+ <path d="M366,404 H115" fill="none" stroke="#d97706" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" marker-end="url(#md97706)"/>
51
+ <rect x="140" y="374" width="200" height="60" rx="10" fill="#ffffff" stroke="#e2e8f0" filter="url(#shadow)"/>
52
+ <text x="156.0" y="398.0" font-family="Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif" font-size="12" font-weight="600" fill="#0f172a" text-anchor="start">Wire transfer</text>
53
+ <text x="156.0" y="418.0" font-family="Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif" font-size="11.5" font-weight="400" fill="#475569" text-anchor="start">the customer receives <tspan font-family="'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" font-size="0.92em" font-weight="600">net</tspan></text>
54
+ <rect x="627" y="436" width="6" height="108" rx="3" fill="#7c3aed"/>
55
+ <rect x="867" y="436" width="6" height="108" rx="3" fill="#0d9488"/>
56
+ <path d="M634,490 H865" fill="none" stroke="#7c3aed" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" marker-end="url(#m7c3aed)"/>
57
+ <rect x="650" y="436" width="200" height="108" rx="10" fill="#ffffff" stroke="#e2e8f0" filter="url(#shadow)"/>
58
+ <text x="666.0" y="460.0" font-family="Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif" font-size="12" font-weight="600" fill="#0f172a" text-anchor="start">Debited, at confirmation</text>
59
+ <text x="666.0" y="480.0" font-family="Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif" font-size="11.5" font-weight="400" fill="#475569" text-anchor="start"><tspan font-family="'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" font-size="0.92em" font-weight="600">balance</tspan> debited,</text>
60
+ <text x="666.0" y="497.0" font-family="Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif" font-size="11.5" font-weight="400" fill="#475569" text-anchor="start">operation <tspan font-family="'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" font-size="0.92em" font-weight="600">WITHDRAWAL</tspan></text>
61
+ <text x="666.0" y="514.0" font-family="Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif" font-size="11.5" font-weight="400" fill="#475569" text-anchor="start">event <tspan font-family="'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" font-size="0.92em" font-weight="600">bank.debited</tspan>: <tspan font-family="'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" font-size="0.92em" font-weight="600">amount</tspan>, <tspan font-family="'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" font-size="0.92em" font-weight="600">fee</tspan>, <tspan font-family="'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" font-size="0.92em" font-weight="600">net</tspan></text>
62
+ <text x="666.0" y="531.0" font-family="Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif" font-size="11.5" font-weight="400" fill="#475569" text-anchor="start"><tspan font-family="'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" font-size="0.92em" font-weight="600">bank.transaction</tspan> <tspan font-family="'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" font-size="0.92em" font-weight="600">COMPLETED</tspan></text>
63
+ <text x="500.0" y="566.0" font-family="Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif" font-size="11.5" font-weight="400" fill="#475569" text-anchor="middle" font-style="italic">If it fails, the reserve is released: <tspan font-family="'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" font-size="0.92em" font-weight="600">pending.out</tspan> goes back down.</text>
64
+ </svg>
@@ -0,0 +1,87 @@
1
+ # Quick start
2
+
3
+ Create the client once, then run a first journey: create a customer, read their EUR account, open a wallet, buy crypto.
4
+
5
+ ## 1. Create the client
6
+
7
+ ```ts
8
+ import { BitgenClient, Env } from '@bitgen/sdk'
9
+
10
+ const client = new BitgenClient({
11
+ scope: 'YOUR_SCOPE_UUID', // uuid of the organization that owns the key
12
+ apiKey: 'YOUR_API_KEY',
13
+ env: Env.SANDBOX, // Env.PRODUCTION by default
14
+ })
15
+ ```
16
+
17
+ One instance per API key, reused for every call. `scope`, `apiKey`, environments and the other options are detailed in [Configuration](configuration.md).
18
+
19
+ ## 2. Create a customer
20
+
21
+ ```ts
22
+ import { Locale } from '@bitgen/sdk'
23
+
24
+ const customer = await client.customer.create({
25
+ account: { email: 'jean@valjean.fr', firstname: 'Jean', lastname: 'Valjean' },
26
+ group: { manager: 'MANAGER_UUID' }, // the collaborator of your organization who follows this customer
27
+ locale: Locale.FR,
28
+ })
29
+ ```
30
+
31
+ The customer receives an activation email: until they click it, their account stays `CustomerState.CREATED` and the bank, custody, trading and staking resources do not see it (unless you create them with `needActivation: false` — [Customers › create](resource/customer.md#create)). If your organization uses BITGEN's identity verification, their identity must also be validated before the next steps ([Activation and identity](concepts.md#activation-and-identity)). The `Created` object the API returned is a `UserRef`: the next steps pass it as is, wherever a customer is expected ([User references](concepts.md#user-references)).
32
+
33
+ ## 3. Read the EUR account
34
+
35
+ ```ts
36
+ const account = await client.bank.get(customer)
37
+
38
+ console.log(account.message) // wire reference: the customer puts it on their bank transfer
39
+ console.log(account.balance) // EUR balance, credited once the transfer is received
40
+ ```
41
+
42
+ The EUR account is created on first read. Balance, operations and withdrawals: [Bank accounts](resource/bank.md).
43
+
44
+ ## 4. Open a wallet
45
+
46
+ ```ts
47
+ import { Asset } from '@bitgen/sdk'
48
+
49
+ const wallet = await client.custody.wallet(customer, Asset.ETH)
50
+
51
+ console.log(wallet.address) // deposit address, created at the custodian on first read
52
+ console.log(wallet.balance) // exact quantity, as a string
53
+ ```
54
+
55
+ Wallets, balances and on-chain withdrawals: [Custody wallets](resource/custody.md).
56
+
57
+ ## 5. Buy crypto
58
+
59
+ ```ts
60
+ const { tunnel, state } = await client.trading.buy(customer, {
61
+ asset: Asset.ETH,
62
+ amount: '25.00', // EUR, taken from the customer's EUR account
63
+ reference: 'order-42', // optional idempotency key
64
+ })
65
+
66
+ const order = await client.trading.get(tunnel) // `tunnel` is the order uuid; `order.state` follows its lifecycle (`OrderState`)
67
+ ```
68
+
69
+ Orders, states and sales: [Trading](resource/trading.md).
70
+
71
+ ## Handling errors
72
+
73
+ Every call returns a promise. An error of the API rejects it with a `BitgenError` carrying the HTTP `status` and a stable `code`:
74
+
75
+ ```ts
76
+ import { BitgenError } from '@bitgen/sdk'
77
+
78
+ try {
79
+ await client.bank.withdraw(customer, { amount: '50.00' })
80
+ } catch (err) {
81
+ if (err instanceof BitgenError && err.code === 'requested_amount_error') {
82
+ // insufficient EUR balance
83
+ }
84
+ }
85
+ ```
86
+
87
+ All the details, including the errors that happen before any request is sent: [Errors](errors.md).
@@ -0,0 +1,103 @@
1
+ # API keys
2
+
3
+ An API key belongs to your organization: it is valid until it expires or is revoked, and every call made with it is journaled. `client.apikeys` reads the keys of your organization and the journal of their calls — it is read-only: a key cannot be created through the API, and the SDK does not revoke.
4
+
5
+ Examples use `client`, a configured `BitgenClient` ([Configuration](../configuration.md)). Wherever the API expects your organization, the SDK sends the `scope` of the client.
6
+
7
+ ## Methods
8
+
9
+ | Method | What it does | Returns |
10
+ |---|---|---|
11
+ | `list(params?)` | Lists the keys of your organization | `Page<Apikey>` |
12
+ | `get(apikey)` | Reads one key | `Apikey` |
13
+ | `logs(apikey, params?)` | Lists the calls made with a key | `Page<ApikeyLog>` |
14
+
15
+ TypeScript types of this resource, exported by the package: `Apikey`, `ApikeyLog`, `ApikeyListParams` — the constant `ApikeyState` (also a type) — plus the shared `PageParams`.
16
+
17
+ ## List
18
+
19
+ ```
20
+ client.apikeys.list(params?: ApikeyListParams): Promise<Page<Apikey>>
21
+ ```
22
+
23
+ | Parameter | Type | Description |
24
+ |---|---|---|
25
+ | `params.offset`, `params.limit` | `number` | [Pagination](../concepts.md#pagination) |
26
+ | `params.includeRevoked` | `boolean` | Also returns the `ApikeyState.REVOKED` keys — default `false` ([Query booleans](../concepts.md#query-booleans)) |
27
+
28
+ ```ts
29
+ import { ApikeyState } from '@bitgen/sdk'
30
+
31
+ const { count, items } = await client.apikeys.list({ includeRevoked: true })
32
+
33
+ for (const key of items) {
34
+ console.log(key.name, key.state === ApikeyState.ENABLED, key.expireAt) // 'backend' true 1735689600
35
+ }
36
+ ```
37
+
38
+ Returns a page of `Apikey` ([get](#get)).
39
+
40
+ ## Get
41
+
42
+ ```
43
+ client.apikeys.get(apikey: string | Apikey): Promise<Apikey>
44
+ ```
45
+
46
+ `apikey` is the uuid of the key, or an `Apikey` of `list()`.
47
+
48
+ ```ts
49
+ import { ApikeyState } from '@bitgen/sdk'
50
+
51
+ const key = await client.apikeys.get('APIKEY_UUID')
52
+
53
+ console.log(key.state === ApikeyState.ENABLED, new Date(key.expireAt * 1000)) // true 2025-01-01T00:00:00.000Z
54
+ ```
55
+
56
+ Returns an `Apikey`:
57
+
58
+ | Field | Description |
59
+ |---|---|
60
+ | `uuid` | The key |
61
+ | `state` | `ApikeyState.ENABLED` or `ApikeyState.REVOKED` |
62
+ | `name` | Label given at creation |
63
+ | `permissions` | What the key is allowed to do, as set by BITGEN |
64
+ | `expireAt`, `createdAt` | Epoch seconds |
65
+ | `organization` | `{ uuid, state, name, hub, owner }` — `hub` is `{ uuid, state, name, options }` or `null` (`options`: internal), `owner` is the owner of the organization, `{ uuid, login, firstname, lastname }` or `null` |
66
+
67
+ An unknown uuid answers `404 unknown_apikey`. The raw key itself is never returned: it is shown once, when the key is created.
68
+
69
+ ## Logs
70
+
71
+ ```
72
+ client.apikeys.logs(apikey: string | Apikey, params?: PageParams): Promise<Page<ApikeyLog>>
73
+ ```
74
+
75
+ `apikey` is the uuid of the key, or an `Apikey` of `list()`.
76
+
77
+ | Parameter | Type | Description |
78
+ |---|---|---|
79
+ | `params.offset`, `params.limit` | `number` | [Pagination](../concepts.md#pagination) |
80
+
81
+ ```ts
82
+ const { count, items } = await client.apikeys.logs('APIKEY_UUID', { offset: 0, limit: 50 })
83
+
84
+ for (const call of items) {
85
+ console.log(call.date, call.path, call.status, call.error) // 1701000000 'GET /custody/…' 200 null
86
+ }
87
+ ```
88
+
89
+ Returns a page of `ApikeyLog`, one entry per call made with the key: `date` (epoch seconds), `path` (`"GET /custody/…"`), `payload` (the inputs of the call as a JSON string, personal data masked), `status` (the HTTP status answered), `error` (response body of the failed call, `null` when the call succeeded).
90
+
91
+ ## Errors
92
+
93
+ In addition to the [common errors](../errors.md#common-errors):
94
+
95
+ | Status | `code` | Meaning |
96
+ |---|---|---|
97
+ | `404` | `unknown_apikey` | Unknown key |
98
+ | `422` | `invalid_include_revoked` | `includeRevoked` is not a boolean value |
99
+
100
+ ## Related
101
+
102
+ - [Configuration](../configuration.md#credentials) — `scope` and `apiKey`
103
+ - [Errors](../errors.md#common-errors) — a missing, unknown, revoked or expired key
@@ -0,0 +1,121 @@
1
+ # Assets
2
+
3
+ The assets are the crypto currencies and tokens of the BITGEN platform, each on its network, with its decimals, its fees, a live ticker and its EUR price history. `client.asset` reads this catalogue: which assets exist and are `AssetState.AVAILABLE`, how many decimals an amount may carry, and the prices.
4
+
5
+ Examples use `client`, a configured `BitgenClient` ([Configuration](../configuration.md)). An asset is designated by its uuid or its ISO code, in any case, or by a model carrying its uuid ([Assets](../concepts.md#assets)).
6
+
7
+ ## Methods
8
+
9
+ | Method | What it does | Returns |
10
+ |---|---|---|
11
+ | `list()` | Lists the assets of the platform | `Page<Asset>` |
12
+ | `get(asset)` | Reads one asset | `Asset` |
13
+ | `tickers()` | Reads the ticker of every asset | `Page<{ iso, ticker }>` |
14
+ | `ticker(iso)` | Reads the ticker and the EUR price history of one asset | `{ iso, ticker, history }` |
15
+
16
+ TypeScript types of this resource, exported by the package: `AssetTicker`, `AssetFees`, `AssetNetworkType`, `AssetNetwork`, `Asset` — the constants `AssetState` (also a type) and `Asset` (the ISO codes, a value only: the `Asset` type is the model) — plus the shared `AssetRef`, `AssetInput`, `History`.
17
+
18
+ ## List
19
+
20
+ ```
21
+ client.asset.list(): Promise<Page<Asset>>
22
+ ```
23
+
24
+ ```ts
25
+ import { AssetState } from '@bitgen/sdk'
26
+
27
+ const { count, items } = await client.asset.list()
28
+
29
+ const available = items.filter((asset) => asset.state === AssetState.AVAILABLE)
30
+ for (const asset of available) {
31
+ console.log(asset.iso, asset.label, asset.baseUnit) // 'ETH' 'Ethereum' 18
32
+ }
33
+ ```
34
+
35
+ Returns a page of `Asset` ([get](#get)).
36
+
37
+ ## Get
38
+
39
+ ```
40
+ client.asset.get(asset: AssetInput): Promise<Asset>
41
+ ```
42
+
43
+ `asset` is the uuid or the ISO code of the asset (`Asset.ETH`), or a model carrying its uuid — an `AssetRef` such as `wallet.asset`.
44
+
45
+ ```ts
46
+ import { Asset, AssetState } from '@bitgen/sdk'
47
+
48
+ const eth = await client.asset.get(Asset.ETH)
49
+
50
+ console.log(eth.state === AssetState.AVAILABLE, eth.baseUnit, eth.ticker.price) // true 18 2031.5
51
+ ```
52
+
53
+ Returns an `Asset`:
54
+
55
+ | Field | Description |
56
+ |---|---|
57
+ | `uuid` | The asset |
58
+ | `state` | `AssetState.AVAILABLE`, `UNAVAILABLE`, `ARCHIVED` or `HIDDEN` |
59
+ | `iso` | The ISO code, with the case it is stored with (`ETH`) — compare it case-insensitively |
60
+ | `label` | Display name (`Bitcoin`) |
61
+ | `contractAddress` | The contract address of a token — `''` for a native asset, never `null` |
62
+ | `baseUnit` | The decimals of the asset (18 by default, 24 at most): the precision amounts may carry |
63
+ | `gasUnit` | Gas units consumed by a transfer of this asset on its network; with the network's `gasBase`, it sizes the network fee |
64
+ | `logo` | The logo as a data URI (SVG), or `null` |
65
+ | `data` | Internal connector mapping, raw JSON string — not needed for an integration |
66
+ | `fees` | `low`, `medium`, `high` — the raw fee schedule of the gas provider, opaque — and `computed`: `gas` (gas cost of a transfer, in the smallest unit of the native coin), `native` (the same, in native coin units) |
67
+ | `ticker` | `price` and `marketcap` (in EUR), `rank` (market cap rank), `percentChange24h` (24-hour change, in %) |
68
+ | `history` | The EUR price curve, a `History` ([Timestamps and histories](../concepts.md#timestamps-and-histories)) |
69
+ | `network` | `uuid`, `state` (state of the network record), `caip2` (chain identifier, CAIP-2 — `eip155:1`), `label`, `gasBase`, `data`, `type` (`{ uuid, code, label, data }` — `code` is the network family: `UTXO`, `EVM`, `COMPUTE_UNIT` or `DROPS`; `label` its name) — both `data` are internal connector mappings, raw JSON strings, not needed for an integration |
70
+
71
+ An unknown uuid or ISO code answers `404 unknown_asset`.
72
+
73
+ ## Tickers
74
+
75
+ ```
76
+ client.asset.tickers(): Promise<Page<{ iso: string, ticker: AssetTicker }>>
77
+ ```
78
+
79
+ ```ts
80
+ const { items } = await client.asset.tickers()
81
+
82
+ for (const { iso, ticker } of items) {
83
+ console.log(iso, ticker.price, ticker.percentChange24h) // 'BTC' 61230.4 -1.2
84
+ }
85
+ ```
86
+
87
+ Returns, for every asset, its `iso` and its `ticker` (`AssetTicker`): `price` and `marketcap` (in EUR), `rank` (market cap rank), `percentChange24h` (24-hour change, in %).
88
+
89
+ ## Ticker
90
+
91
+ ```
92
+ client.asset.ticker(iso: string): Promise<{ iso: string, ticker: AssetTicker, history: History }>
93
+ ```
94
+
95
+ `iso` is the ISO code of the asset (`Asset.BTC`) — this read takes no uuid and no model.
96
+
97
+ ```ts
98
+ import { Asset } from '@bitgen/sdk'
99
+
100
+ const btc = await client.asset.ticker(Asset.BTC)
101
+
102
+ console.log(btc.ticker.price) // 61230.4
103
+ console.log(btc.history.d) // EUR price over the last 24 hours, one point per hour
104
+ ```
105
+
106
+ Returns the `iso`, the `ticker` and the EUR price `history` of the asset.
107
+
108
+ ## Errors
109
+
110
+ In addition to the [common errors](../errors.md#common-errors):
111
+
112
+ | Status | `code` | Meaning |
113
+ |---|---|---|
114
+ | `404` | `unknown_asset` | Unknown uuid or ISO code |
115
+
116
+ ## Related
117
+
118
+ - [Assets](../concepts.md#assets) — the `Asset` constants, uuid or ISO code, case
119
+ - [Amounts](../concepts.md#amounts) — crypto amounts as strings, up to the decimals of the asset
120
+ - [Custody wallets](custody.md) — one wallet per customer and per asset
121
+ - [Trading](trading.md) — orders take an `AssetState.AVAILABLE` asset
@@ -0,0 +1,161 @@
1
+ # Bank accounts
2
+
3
+ Every customer has an EUR account on the BITGEN platform: a **ledger** of the EUR they hold with the bank provider of your organization — the provider receives their bank transfers and pays their withdrawals to their IBAN, BITGEN keeps the account and notifies you ([Following a deposit and a withdrawal](../concepts.md#following-a-deposit-and-a-withdrawal)). The balance pays their purchases and is credited by their sales. `client.bank` reads the account and its operations, withdraws EUR, and credits deposits.
4
+
5
+ Examples use `client`, a configured `BitgenClient` ([Configuration](../configuration.md)). A customer is designated by a `UserRef`: their uuid, or a model carrying it, such as the `Created` returned by `client.customer.create` ([User references](../concepts.md#user-references)). The customer must belong to your organization and be activated, otherwise the API answers `404 unknown_bank` ([Activation and identity](../concepts.md#activation-and-identity)).
6
+
7
+ ## Methods
8
+
9
+ | Method | What it does | Returns |
10
+ |---|---|---|
11
+ | `get(user)` | Reads the EUR account of a customer — creates it on first read | `BankAccount` |
12
+ | `operations(user, params?)` | Lists the EUR operations of a customer | `Page<BankOperation>` |
13
+ | `withdraw(user, params)` | Withdraws EUR to the customer's IBAN | `{ transaction }` |
14
+ | `credit(params)` | Credits an EUR deposit to a customer's account | `Created` (the deposit) |
15
+
16
+ TypeScript types of this resource, exported by the package: `BankAccount`, `BankOperation`, `BankOperationsParams`, `BankWithdrawParams`, `BankCreditParams` — the constant `BankDirection` (also a type) — plus the shared `UserRef`, `Created`, `Amount`.
17
+
18
+ ## Get
19
+
20
+ ```
21
+ client.bank.get(user: UserRef): Promise<BankAccount>
22
+ ```
23
+
24
+ The account is created on first read — if your organization uses BITGEN's identity verification, the customer's identity must be validated first ([Activation and identity](../concepts.md#activation-and-identity)). The `message` of the account is the reference the customer must indicate on their bank transfers.
25
+
26
+ ```ts
27
+ const account = await client.bank.get('CUSTOMER_UUID')
28
+
29
+ // 1. Give the customer the reference to put on their wire transfer
30
+ console.log(account.message) // 'BTGN…'
31
+
32
+ // 2. Once the transfer is received, the balance is credited
33
+ console.log(account.balance) // 150
34
+ console.log(account.pending) // { in: 0, out: 0 }
35
+ ```
36
+
37
+ Returns a `BankAccount`:
38
+
39
+ | Field | Description |
40
+ |---|---|
41
+ | `uuid` | The account |
42
+ | `message` | The wire transfer reference the customer must indicate (`BTGN` prefix) |
43
+ | `iban`, `bank`, `bic` | The customer's bank details, `null` until set — `withdraw` can set them |
44
+ | `balance` | EUR balance (number) |
45
+ | `pending` | `{ in, out }` — `in`: reported deposits not credited yet (BITGEN processing and compliance analysis); `out`: withdrawals requested and purchase reserves, not settled yet |
46
+ | `history` | EUR balance curve, a `History` ([Timestamps and histories](../concepts.md#timestamps-and-histories)); `{}` until the hourly computation has run for this account |
47
+
48
+ ## Operations
49
+
50
+ ```
51
+ client.bank.operations(user: UserRef, params?: BankOperationsParams): Promise<Page<BankOperation>>
52
+ ```
53
+
54
+ | Parameter | Type | Description |
55
+ |---|---|---|
56
+ | `params.direction` | `BankDirection` | `BankDirection.ALL` (default), `DEPOSIT`, `WITHDRAWAL`, `PURCHASE` or `SELL` — an unknown value means `ALL` |
57
+ | `params.from`, `params.to` | `number` | Epoch seconds; both together, otherwise ignored |
58
+ | `params.offset`, `params.limit` | `number` | [Pagination](../concepts.md#pagination) |
59
+
60
+ ```ts
61
+ import { BankDirection } from '@bitgen/sdk'
62
+
63
+ const { count, items } = await client.bank.operations('CUSTOMER_UUID', {
64
+ direction: BankDirection.DEPOSIT,
65
+ from: 1700000000,
66
+ to: 1702592000,
67
+ offset: 0,
68
+ limit: 50,
69
+ })
70
+
71
+ for (const operation of items) {
72
+ console.log(operation.date, operation.direction === BankDirection.DEPOSIT, operation.amount) // 1701000000 true 150
73
+ }
74
+ ```
75
+
76
+ Returns a page of `BankOperation`: `txId` (identifier of the ledger entry), `amount` (EUR, number), `direction` (`BankDirection.DEPOSIT`, `WITHDRAWAL`, `PURCHASE` or `SELL` — never `ALL`), `date` (epoch seconds), `info` (free label of the operation — for instance the asset bought or sold — or `null`).
77
+
78
+ ## Withdraw
79
+
80
+ ```
81
+ client.bank.withdraw(user: UserRef, params: BankWithdrawParams): Promise<{ transaction: string }>
82
+ ```
83
+
84
+ | Parameter | Type | Description |
85
+ |---|---|---|
86
+ | `params.amount` | `Amount` | EUR, rounded to 2 decimals ([Amounts](../concepts.md#amounts)) |
87
+ | `params.iban`, `params.bank`, `params.bic` | `string` | Optional: update the customer's bank details before the withdrawal |
88
+
89
+ ```ts
90
+ const { transaction } = await client.bank.withdraw('CUSTOMER_UUID', {
91
+ amount: '50.00',
92
+ iban: 'FR76…', // optional, sets or replaces the customer's bank details
93
+ bic: 'BNPAFRPP',
94
+ })
95
+
96
+ const movement = await client.transaction.get(transaction) // follow the withdrawal in the transaction journal
97
+ ```
98
+
99
+ The withdrawal goes to the customer's IBAN: the amount is reserved in `pending.out` and debited from the balance when the provider confirms the wire; the event `bank.debited` reports it then, with `amount`, `fee` and `net` — what the customer receives ([Following a deposit and a withdrawal](../concepts.md#following-a-deposit-and-a-withdrawal)). The account must have bank details (`412 bank_rib_required`), a sufficient balance (`416 requested_amount_error`) and an amount above the fee (`416 amount_below_fee`). `transaction` identifies the withdrawal — its `Transaction` in the journal ([Transactions](transaction.md)).
100
+
101
+ ![An EUR withdrawal: the reserve on the ledger, the compliance analysis, the wire from the organization account to the customer IBAN, the debit at confirmation](../media/withdrawal-flow.svg)
102
+
103
+ ## Credit
104
+
105
+ ```
106
+ client.bank.credit(params: BankCreditParams): Promise<Created>
107
+ ```
108
+
109
+ `credit` only applies when your organization's bank provider is **manual** — deposits are not reported to BITGEN automatically: you tell BITGEN a wire has arrived on the organization's account. The amount enters `pending.in`, goes through BITGEN's processing and the compliance analysis, and the account is credited then — `bank.credited` at that moment ([Following a deposit and a withdrawal](../concepts.md#following-a-deposit-and-a-withdrawal)). With an automated provider, deposits are detected and credited automatically and you are notified by the `bank.credited` webhook ([Webhooks](webhooks.md)) — do not call `credit`: the API refuses it (`412 deposit_reported_by_provider`). The account is designated either by the customer (`user`) or by the wire transfer reference of the account (`message`).
110
+
111
+ | Parameter | Type | Description |
112
+ |---|---|---|
113
+ | `params.amount` | `Amount` | EUR ([Amounts](../concepts.md#amounts)) |
114
+ | `params.currency` | `'EUR'` | Optional |
115
+ | `params.user` | `UserRef` | The customer — or `message` |
116
+ | `params.message` | `string` | The wire transfer reference of the account (`BTGN…`) — or `user` |
117
+ | `params.reference` | `string` | The bank's transfer reference — it makes the call idempotent: calling twice with the same reference declares once (and returns the same `uuid`) |
118
+
119
+ ```ts
120
+ const { uuid } = await client.bank.credit({
121
+ amount: '100.00',
122
+ user: 'CUSTOMER_UUID',
123
+ reference: 'BANK-TRANSFER-REF-42', // the bank's transfer reference: credited once, however many times it is sent
124
+ })
125
+ ```
126
+
127
+ Returns a `Created` — the `uuid` of the declared deposit: the incoming movement, not credited yet. Without `user` nor `message`, the API answers `400 bank_target_required`.
128
+
129
+ ![An EUR deposit: the wire to the organization account at the bank provider, its report, the matching by reference, the compliance analysis, the credit of the ledger](../media/deposit-flow.svg)
130
+
131
+ ## Errors
132
+
133
+ In addition to the [common errors](../errors.md#common-errors):
134
+
135
+ | Status | `code` | Meaning |
136
+ |---|---|---|
137
+ | `400` | `invalid_amount` | The amount is not valid |
138
+ | `400` | `bank_target_required` | `credit` without `user` nor `message` |
139
+ | `400` | `invalid_currency` | `credit` with a currency other than `EUR` |
140
+ | `403` | `user_actions_disabled` | Customer actions are disabled for your organization (`user_can_actions` flag) |
141
+ | `404` | `unknown_bank` | The customer is not an activated member of your organization, or the account was not found |
142
+ | `404` | `unknown_organization` | `credit`: the organization is unknown |
143
+ | `412` | `owner_identity_not_validated` | Your organization uses BITGEN's identity verification and the customer's identity is not validated: the account cannot be created |
144
+ | `412` | `bank_rib_required` | `withdraw` without an IBAN or a bank on the account |
145
+ | `412` | `ramp_not_enabled` | The `CoreType.RAMP` (bank) connector of your organization is not enabled |
146
+ | `412` | `deposit_reported_by_provider` | `credit` on an automated bank provider: deposits are reported by the provider itself |
147
+ | `412` | `trading_not_enabled` | The `CoreType.TRADING` connector of your organization is not enabled |
148
+ | `416` | `requested_amount_error` | Insufficient balance |
149
+ | `416` | `amount_below_fee` | The amount does not cover the fee |
150
+ | `422` | `invalid_iban` | The IBAN is not valid |
151
+ | `423` | `account_frozen` | The customer's account is frozen |
152
+ | `423` | `blocked_by_alert` | An active compliance alert blocks the customer |
153
+ | `423` | `bank_lock_unavailable` | The account is locked by a concurrent operation (creation, withdrawal) |
154
+
155
+ ## Related
156
+
157
+ - [Following a deposit and a withdrawal](../concepts.md#following-a-deposit-and-a-withdrawal) — who holds the funds, what the ledger shows, when the events are sent
158
+ - [Amounts](../concepts.md#amounts) — EUR amounts as strings, 2 decimals
159
+ - [Trading](trading.md) — purchases paid from the EUR balance, sales credited to it
160
+ - [Transactions](transaction.md) — the journal where withdrawals appear
161
+ - [Webhooks](webhooks.md) — `bank.credited`, `bank.debited`, `bank.transaction`