@riocrypto/common-server 1.0.506

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 (349) hide show
  1. package/build/clients/bitstamp-client.d.ts +16 -0
  2. package/build/clients/bitstamp-client.js +83 -0
  3. package/build/clients/ccxt-client.d.ts +48 -0
  4. package/build/clients/ccxt-client.js +201 -0
  5. package/build/clients/etherscan-client.d.ts +6 -0
  6. package/build/clients/etherscan-client.js +24 -0
  7. package/build/clients/fireblocks-client.d.ts +15 -0
  8. package/build/clients/fireblocks-client.js +140 -0
  9. package/build/clients/fixer-client.d.ts +8 -0
  10. package/build/clients/fixer-client.js +34 -0
  11. package/build/clients/gueno-client.d.ts +10 -0
  12. package/build/clients/gueno-client.js +44 -0
  13. package/build/clients/kapstar-client.d.ts +6 -0
  14. package/build/clients/kapstar-client.js +26 -0
  15. package/build/clients/kushki-client.d.ts +14 -0
  16. package/build/clients/kushki-client.js +150 -0
  17. package/build/clients/rio-client.d.ts +82 -0
  18. package/build/clients/rio-client.js +315 -0
  19. package/build/clients/slack-client.d.ts +7 -0
  20. package/build/clients/slack-client.js +34 -0
  21. package/build/errors/address-check-failed-error.d.ts +8 -0
  22. package/build/errors/address-check-failed-error.js +15 -0
  23. package/build/errors/admin-already-exists-error.d.ts +8 -0
  24. package/build/errors/admin-already-exists-error.js +15 -0
  25. package/build/errors/admin-not-found-error.d.ts +8 -0
  26. package/build/errors/admin-not-found-error.js +15 -0
  27. package/build/errors/admin-only-error.d.ts +8 -0
  28. package/build/errors/admin-only-error.js +15 -0
  29. package/build/errors/api-key-not-found-error.d.ts +8 -0
  30. package/build/errors/api-key-not-found-error.js +15 -0
  31. package/build/errors/auth-already-exists-error.d.ts +8 -0
  32. package/build/errors/auth-already-exists-error.js +15 -0
  33. package/build/errors/auth-not-found-error.d.ts +8 -0
  34. package/build/errors/auth-not-found-error.js +15 -0
  35. package/build/errors/authorization-failed-error.d.ts +8 -0
  36. package/build/errors/authorization-failed-error.js +15 -0
  37. package/build/errors/custom-error.d.ts +8 -0
  38. package/build/errors/custom-error.js +10 -0
  39. package/build/errors/database-connection-error.d.ts +9 -0
  40. package/build/errors/database-connection-error.js +16 -0
  41. package/build/errors/insufficient-liquidity-error.d.ts +8 -0
  42. package/build/errors/insufficient-liquidity-error.js +19 -0
  43. package/build/errors/invalid-order-size-error.d.ts +8 -0
  44. package/build/errors/invalid-order-size-error.js +15 -0
  45. package/build/errors/message-failed-error.d.ts +8 -0
  46. package/build/errors/message-failed-error.js +15 -0
  47. package/build/errors/missing-kyc-approval-error.d.ts +8 -0
  48. package/build/errors/missing-kyc-approval-error.js +15 -0
  49. package/build/errors/missing-password-error.d.ts +8 -0
  50. package/build/errors/missing-password-error.js +15 -0
  51. package/build/errors/missing-security-question-error.d.ts +8 -0
  52. package/build/errors/missing-security-question-error.js +15 -0
  53. package/build/errors/missing-user-error.d.ts +8 -0
  54. package/build/errors/missing-user-error.js +15 -0
  55. package/build/errors/not-authorized-error.d.ts +8 -0
  56. package/build/errors/not-authorized-error.js +15 -0
  57. package/build/errors/not-broker-error.d.ts +8 -0
  58. package/build/errors/not-broker-error.js +17 -0
  59. package/build/errors/not-found-error.d.ts +8 -0
  60. package/build/errors/not-found-error.js +15 -0
  61. package/build/errors/partner-already-exists-error.d.ts +8 -0
  62. package/build/errors/partner-already-exists-error.js +15 -0
  63. package/build/errors/partner-not-found-error.d.ts +8 -0
  64. package/build/errors/partner-not-found-error.js +15 -0
  65. package/build/errors/password-already-used-error.d.ts +8 -0
  66. package/build/errors/password-already-used-error.js +15 -0
  67. package/build/errors/request-validation-error.d.ts +11 -0
  68. package/build/errors/request-validation-error.js +18 -0
  69. package/build/errors/rio-settings-already-exists-error.d.ts +8 -0
  70. package/build/errors/rio-settings-already-exists-error.js +15 -0
  71. package/build/errors/rio-settings-not-found-error.d.ts +8 -0
  72. package/build/errors/rio-settings-not-found-error.js +15 -0
  73. package/build/errors/user-already-exists-error.d.ts +8 -0
  74. package/build/errors/user-already-exists-error.js +15 -0
  75. package/build/errors/verification-failed-error.d.ts +8 -0
  76. package/build/errors/verification-failed-error.js +15 -0
  77. package/build/errors/wrong-order-state-error.d.ts +8 -0
  78. package/build/errors/wrong-order-state-error.js +17 -0
  79. package/build/errors/wrong-password-error.d.ts +8 -0
  80. package/build/errors/wrong-password-error.js +15 -0
  81. package/build/errors/wrong-processor-error.d.ts +8 -0
  82. package/build/errors/wrong-processor-error.js +15 -0
  83. package/build/errors/wrong-security-answer-error.d.ts +8 -0
  84. package/build/errors/wrong-security-answer-error.js +15 -0
  85. package/build/events/admin-created-event.d.ts +8 -0
  86. package/build/events/admin-created-event.js +2 -0
  87. package/build/events/admin-deleted-event.d.ts +7 -0
  88. package/build/events/admin-deleted-event.js +2 -0
  89. package/build/events/bank-payout-initialized-event.d.ts +12 -0
  90. package/build/events/bank-payout-initialized-event.js +2 -0
  91. package/build/events/base-listener.d.ts +18 -0
  92. package/build/events/base-listener.js +30 -0
  93. package/build/events/base-publisher.d.ts +13 -0
  94. package/build/events/base-publisher.js +20 -0
  95. package/build/events/business-kyc-failed-event.d.ts +7 -0
  96. package/build/events/business-kyc-failed-event.js +2 -0
  97. package/build/events/business-kyc-passed-event.d.ts +7 -0
  98. package/build/events/business-kyc-passed-event.js +2 -0
  99. package/build/events/checked-address-created-event.d.ts +11 -0
  100. package/build/events/checked-address-created-event.js +2 -0
  101. package/build/events/checked-address-updated-event.d.ts +10 -0
  102. package/build/events/checked-address-updated-event.js +2 -0
  103. package/build/events/clip-card-payment-created-event.d.ts +8 -0
  104. package/build/events/clip-card-payment-created-event.js +2 -0
  105. package/build/events/clip-card-payment-failed-event.d.ts +7 -0
  106. package/build/events/clip-card-payment-failed-event.js +2 -0
  107. package/build/events/deposit-address-created-event.d.ts +8 -0
  108. package/build/events/deposit-address-created-event.js +2 -0
  109. package/build/events/deposit-address-failed-event.d.ts +7 -0
  110. package/build/events/deposit-address-failed-event.js +2 -0
  111. package/build/events/deposit-completed-event.d.ts +9 -0
  112. package/build/events/deposit-completed-event.js +2 -0
  113. package/build/events/deposit-registered-event.d.ts +9 -0
  114. package/build/events/deposit-registered-event.js +2 -0
  115. package/build/events/dlocal-bank-payment-created-event.d.ts +9 -0
  116. package/build/events/dlocal-bank-payment-created-event.js +2 -0
  117. package/build/events/dlocal-bank-payment-failed-event.d.ts +7 -0
  118. package/build/events/dlocal-bank-payment-failed-event.js +2 -0
  119. package/build/events/fees-failed-event.d.ts +7 -0
  120. package/build/events/fees-failed-event.js +2 -0
  121. package/build/events/kyc-failed-event.d.ts +7 -0
  122. package/build/events/kyc-failed-event.js +2 -0
  123. package/build/events/kyc-passed-event.d.ts +7 -0
  124. package/build/events/kyc-passed-event.js +2 -0
  125. package/build/events/liquidity-fill-failed-event.d.ts +7 -0
  126. package/build/events/liquidity-fill-failed-event.js +2 -0
  127. package/build/events/liquidity-filled-event.d.ts +11 -0
  128. package/build/events/liquidity-filled-event.js +2 -0
  129. package/build/events/liquidity-routed-event.d.ts +9 -0
  130. package/build/events/liquidity-routed-event.js +2 -0
  131. package/build/events/liquidity-routing-failed-event.d.ts +7 -0
  132. package/build/events/liquidity-routing-failed-event.js +2 -0
  133. package/build/events/liquidity-transfer-failed-event.d.ts +7 -0
  134. package/build/events/liquidity-transfer-failed-event.js +2 -0
  135. package/build/events/liquidity-transfered-event.d.ts +9 -0
  136. package/build/events/liquidity-transfered-event.js +2 -0
  137. package/build/events/order-created-event.d.ts +39 -0
  138. package/build/events/order-created-event.js +2 -0
  139. package/build/events/order-deleted-event.d.ts +7 -0
  140. package/build/events/order-deleted-event.js +2 -0
  141. package/build/events/order-updated-event.d.ts +37 -0
  142. package/build/events/order-updated-event.js +2 -0
  143. package/build/events/partner-created-event.d.ts +14 -0
  144. package/build/events/partner-created-event.js +2 -0
  145. package/build/events/partner-updated-event.d.ts +19 -0
  146. package/build/events/partner-updated-event.js +2 -0
  147. package/build/events/payment-complete-event.d.ts +9 -0
  148. package/build/events/payment-complete-event.js +2 -0
  149. package/build/events/payment-created-event.d.ts +8 -0
  150. package/build/events/payment-created-event.js +2 -0
  151. package/build/events/payment-failed-event.d.ts +7 -0
  152. package/build/events/payment-failed-event.js +2 -0
  153. package/build/events/processor-routed-event.d.ts +9 -0
  154. package/build/events/processor-routed-event.js +2 -0
  155. package/build/events/processor-routing-failed-event.d.ts +7 -0
  156. package/build/events/processor-routing-failed-event.js +2 -0
  157. package/build/events/quote-failed-event.d.ts +7 -0
  158. package/build/events/quote-failed-event.js +2 -0
  159. package/build/events/rio-settings-created-event.d.ts +8 -0
  160. package/build/events/rio-settings-created-event.js +2 -0
  161. package/build/events/rio-settings-updated-event.d.ts +8 -0
  162. package/build/events/rio-settings-updated-event.js +2 -0
  163. package/build/events/subjects.d.ts +60 -0
  164. package/build/events/subjects.js +64 -0
  165. package/build/events/user-created-event.d.ts +25 -0
  166. package/build/events/user-created-event.js +2 -0
  167. package/build/events/user-deleted-event.d.ts +7 -0
  168. package/build/events/user-deleted-event.js +2 -0
  169. package/build/events/user-disabled-event.d.ts +7 -0
  170. package/build/events/user-disabled-event.js +2 -0
  171. package/build/events/user-updated-event.d.ts +23 -0
  172. package/build/events/user-updated-event.js +2 -0
  173. package/build/events/wyre-ach-payment-created-event.d.ts +9 -0
  174. package/build/events/wyre-ach-payment-created-event.js +2 -0
  175. package/build/events/wyre-payment-method-created-event.d.ts +11 -0
  176. package/build/events/wyre-payment-method-created-event.js +2 -0
  177. package/build/events/wyre-transfer-completed-event.d.ts +9 -0
  178. package/build/events/wyre-transfer-completed-event.js +2 -0
  179. package/build/events/wyre-transfer-created-event.d.ts +9 -0
  180. package/build/events/wyre-transfer-created-event.js +2 -0
  181. package/build/events/wyre-transfer-failed-event.d.ts +9 -0
  182. package/build/events/wyre-transfer-failed-event.js +2 -0
  183. package/build/events/wyre-user-created-event.d.ts +9 -0
  184. package/build/events/wyre-user-created-event.js +2 -0
  185. package/build/helpers/get-user-helper.d.ts +4 -0
  186. package/build/helpers/get-user-helper.js +35 -0
  187. package/build/index.d.ts +91 -0
  188. package/build/index.js +107 -0
  189. package/build/middlewares/authorize.d.ts +28 -0
  190. package/build/middlewares/authorize.js +195 -0
  191. package/build/middlewares/current-admin-auth.d.ts +15 -0
  192. package/build/middlewares/current-admin-auth.js +20 -0
  193. package/build/middlewares/current-auth.d.ts +16 -0
  194. package/build/middlewares/current-auth.js +20 -0
  195. package/build/middlewares/error-handler.d.ts +2 -0
  196. package/build/middlewares/error-handler.js +14 -0
  197. package/build/middlewares/get-order.d.ts +11 -0
  198. package/build/middlewares/get-order.js +57 -0
  199. package/build/middlewares/get-partner.d.ts +10 -0
  200. package/build/middlewares/get-partner.js +41 -0
  201. package/build/middlewares/get-user.d.ts +12 -0
  202. package/build/middlewares/get-user.js +45 -0
  203. package/build/middlewares/require-admin-api-key.d.ts +2 -0
  204. package/build/middlewares/require-admin-api-key.js +11 -0
  205. package/build/middlewares/require-auth.d.ts +2 -0
  206. package/build/middlewares/require-auth.js +11 -0
  207. package/build/middlewares/require-priveleges.d.ts +2 -0
  208. package/build/middlewares/require-priveleges.js +15 -0
  209. package/build/middlewares/validate-auth.d.ts +2 -0
  210. package/build/middlewares/validate-auth.js +30 -0
  211. package/build/middlewares/validate-kyc.d.ts +2 -0
  212. package/build/middlewares/validate-kyc.js +30 -0
  213. package/build/middlewares/validate-order.d.ts +0 -0
  214. package/build/middlewares/validate-order.js +20 -0
  215. package/build/middlewares/validate-request.d.ts +2 -0
  216. package/build/middlewares/validate-request.js +13 -0
  217. package/build/middlewares/verify-admin-api-key.d.ts +9 -0
  218. package/build/middlewares/verify-admin-api-key.js +11 -0
  219. package/build/models/admin-auth.d.ts +16 -0
  220. package/build/models/admin-auth.js +59 -0
  221. package/build/models/auth.d.ts +24 -0
  222. package/build/models/auth.js +83 -0
  223. package/build/models/bank-payout.d.ts +20 -0
  224. package/build/models/bank-payout.js +44 -0
  225. package/build/models/business-user.d.ts +57 -0
  226. package/build/models/business-user.js +111 -0
  227. package/build/models/ccxt-order.d.ts +16 -0
  228. package/build/models/ccxt-order.js +37 -0
  229. package/build/models/checked-address.d.ts +17 -0
  230. package/build/models/checked-address.js +37 -0
  231. package/build/models/kushki-payment.d.ts +16 -0
  232. package/build/models/kushki-payment.js +37 -0
  233. package/build/models/kyc.d.ts +20 -0
  234. package/build/models/kyc.js +45 -0
  235. package/build/models/order.d.ts +67 -0
  236. package/build/models/order.js +123 -0
  237. package/build/models/partner.d.ts +35 -0
  238. package/build/models/partner.js +69 -0
  239. package/build/models/rio-settings.d.ts +12 -0
  240. package/build/models/rio-settings.js +29 -0
  241. package/build/models/user.d.ts +53 -0
  242. package/build/models/user.js +94 -0
  243. package/build/services/apiKey.d.ts +3 -0
  244. package/build/services/apiKey.js +24 -0
  245. package/build/services/password.d.ts +4 -0
  246. package/build/services/password.js +32 -0
  247. package/build/services/s3.d.ts +5 -0
  248. package/build/services/s3.js +21 -0
  249. package/build/types/address-check-result.d.ts +4 -0
  250. package/build/types/address-check-result.js +8 -0
  251. package/build/types/admin.d.ts +4 -0
  252. package/build/types/admin.js +2 -0
  253. package/build/types/api-key.d.ts +5 -0
  254. package/build/types/api-key.js +2 -0
  255. package/build/types/auth-update.d.ts +8 -0
  256. package/build/types/auth-update.js +2 -0
  257. package/build/types/auth.d.ts +6 -0
  258. package/build/types/auth.js +2 -0
  259. package/build/types/authorization-type.d.ts +8 -0
  260. package/build/types/authorization-type.js +12 -0
  261. package/build/types/bank-payout.d.ts +7 -0
  262. package/build/types/bank-payout.js +2 -0
  263. package/build/types/business-user-input.d.ts +27 -0
  264. package/build/types/business-user-input.js +2 -0
  265. package/build/types/business-user-update.d.ts +26 -0
  266. package/build/types/business-user-update.js +2 -0
  267. package/build/types/business-user.d.ts +30 -0
  268. package/build/types/business-user.js +2 -0
  269. package/build/types/ccxt-liquidity-provider.d.ts +5 -0
  270. package/build/types/ccxt-liquidity-provider.js +9 -0
  271. package/build/types/checked-address.d.ts +7 -0
  272. package/build/types/checked-address.js +2 -0
  273. package/build/types/clip-payment-status.d.ts +3 -0
  274. package/build/types/clip-payment-status.js +7 -0
  275. package/build/types/country.d.ts +57 -0
  276. package/build/types/country.js +256 -0
  277. package/build/types/crypto.d.ts +6 -0
  278. package/build/types/crypto.js +38 -0
  279. package/build/types/dlocal-payment-method.d.ts +4 -0
  280. package/build/types/dlocal-payment-method.js +8 -0
  281. package/build/types/fees.d.ts +9 -0
  282. package/build/types/fees.js +2 -0
  283. package/build/types/fiat.d.ts +6 -0
  284. package/build/types/fiat.js +45 -0
  285. package/build/types/kyc-status.d.ts +7 -0
  286. package/build/types/kyc-status.js +11 -0
  287. package/build/types/language.d.ts +6 -0
  288. package/build/types/language.js +10 -0
  289. package/build/types/liquidity-provider.d.ts +9 -0
  290. package/build/types/liquidity-provider.js +13 -0
  291. package/build/types/order-input.d.ts +31 -0
  292. package/build/types/order-input.js +2 -0
  293. package/build/types/order-status.d.ts +21 -0
  294. package/build/types/order-status.js +51 -0
  295. package/build/types/order.d.ts +37 -0
  296. package/build/types/order.js +2 -0
  297. package/build/types/partner-auth.d.ts +5 -0
  298. package/build/types/partner-auth.js +2 -0
  299. package/build/types/partner-stats.d.ts +5 -0
  300. package/build/types/partner-stats.js +2 -0
  301. package/build/types/partner-status.d.ts +6 -0
  302. package/build/types/partner-status.js +10 -0
  303. package/build/types/partner-update.d.ts +10 -0
  304. package/build/types/partner-update.js +2 -0
  305. package/build/types/partner.d.ts +15 -0
  306. package/build/types/partner.js +2 -0
  307. package/build/types/payment-method.d.ts +5 -0
  308. package/build/types/payment-method.js +9 -0
  309. package/build/types/payout-method.d.ts +3 -0
  310. package/build/types/payout-method.js +7 -0
  311. package/build/types/platform-fee-range.d.ts +5 -0
  312. package/build/types/platform-fee-range.js +2 -0
  313. package/build/types/processor.d.ts +12 -0
  314. package/build/types/processor.js +16 -0
  315. package/build/types/quote.d.ts +21 -0
  316. package/build/types/quote.js +2 -0
  317. package/build/types/rio-env.d.ts +6 -0
  318. package/build/types/rio-env.js +10 -0
  319. package/build/types/rio-settings-update.d.ts +4 -0
  320. package/build/types/rio-settings-update.js +2 -0
  321. package/build/types/rio-settings.d.ts +4 -0
  322. package/build/types/rio-settings.js +2 -0
  323. package/build/types/security-question.d.ts +7 -0
  324. package/build/types/security-question.js +11 -0
  325. package/build/types/side.d.ts +4 -0
  326. package/build/types/side.js +8 -0
  327. package/build/types/us-state.d.ts +61 -0
  328. package/build/types/us-state.js +65 -0
  329. package/build/types/user-attribute.d.ts +10 -0
  330. package/build/types/user-attribute.js +14 -0
  331. package/build/types/user-input.d.ts +26 -0
  332. package/build/types/user-input.js +2 -0
  333. package/build/types/user-type.d.ts +4 -0
  334. package/build/types/user-type.js +8 -0
  335. package/build/types/user-update.d.ts +25 -0
  336. package/build/types/user-update.js +2 -0
  337. package/build/types/user.d.ts +30 -0
  338. package/build/types/user.js +2 -0
  339. package/build/types/users-stats.d.ts +3 -0
  340. package/build/types/users-stats.js +2 -0
  341. package/build/types/wyre-address.d.ts +9 -0
  342. package/build/types/wyre-address.js +2 -0
  343. package/build/types/wyre-order-status.d.ts +7 -0
  344. package/build/types/wyre-order-status.js +11 -0
  345. package/build/types/wyre-payment-method.d.ts +40 -0
  346. package/build/types/wyre-payment-method.js +2 -0
  347. package/build/types/wyre-webhook-notification.d.ts +12 -0
  348. package/build/types/wyre-webhook-notification.js +2 -0
  349. package/package.json +36 -0
@@ -0,0 +1,16 @@
1
+ declare class BitstampClient {
2
+ private apiKey;
3
+ private apiSecret;
4
+ constructor(apiKey: string, apiSecret: string);
5
+ getHeaders(payload?: any): Promise<{
6
+ "X-Auth": string;
7
+ "X-Auth-Signature": string;
8
+ "X-Auth-Nonce": string;
9
+ "X-Auth-Timestamp": string;
10
+ "X-Auth-Version": string;
11
+ "Content-Type": string;
12
+ }>;
13
+ getTransactions(): Promise<any>;
14
+ }
15
+ export declare const bitstampClient: BitstampClient;
16
+ export {};
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
+ return new (P || (P = Promise))(function (resolve, reject) {
28
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
29
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
30
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
31
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
32
+ });
33
+ };
34
+ var __importDefault = (this && this.__importDefault) || function (mod) {
35
+ return (mod && mod.__esModule) ? mod : { "default": mod };
36
+ };
37
+ Object.defineProperty(exports, "__esModule", { value: true });
38
+ exports.bitstampClient = void 0;
39
+ const axios_1 = __importDefault(require("axios"));
40
+ const crypto = __importStar(require("crypto"));
41
+ const uuid = __importStar(require("uuid"));
42
+ class BitstampClient {
43
+ constructor(apiKey, apiSecret) {
44
+ this.apiKey = apiKey;
45
+ this.apiSecret = apiSecret;
46
+ }
47
+ getHeaders(payload) {
48
+ return __awaiter(this, void 0, void 0, function* () {
49
+ const timestamp = String(Math.round(Date.now()));
50
+ const nonce = uuid.v4().toString();
51
+ const content_type = "application/x-www-form-urlencoded";
52
+ let payload_string = new URLSearchParams(payload).toString();
53
+ const message = `BITSTAMP ${this.apiKey}POSTwww.bitstamp.net/api/v2/crypto-transactions/${content_type}${nonce}${timestamp}v2${payload_string}`;
54
+ const message_encoded = new TextEncoder().encode(message);
55
+ const signature = crypto
56
+ .createHmac("sha256", this.apiSecret)
57
+ .update(message_encoded)
58
+ .digest("hex");
59
+ const headers = {
60
+ "X-Auth": `BITSTAMP ${this.apiKey}`,
61
+ "X-Auth-Signature": signature,
62
+ "X-Auth-Nonce": nonce,
63
+ "X-Auth-Timestamp": timestamp,
64
+ "X-Auth-Version": "v2",
65
+ "Content-Type": content_type,
66
+ };
67
+ return headers;
68
+ });
69
+ }
70
+ getTransactions() {
71
+ return __awaiter(this, void 0, void 0, function* () {
72
+ const payload = { offset: "0" };
73
+ let payload_string = new URLSearchParams(payload).toString();
74
+ const headers = yield this.getHeaders(payload);
75
+ const response = yield axios_1.default.post("https://www.bitstamp.net/api/v2/crypto-transactions/", payload_string, { headers });
76
+ if (response.status !== 200) {
77
+ throw new Error("Status code not 200");
78
+ }
79
+ return response.data;
80
+ });
81
+ }
82
+ }
83
+ exports.bitstampClient = new BitstampClient(process.env.BITSTAMP_API_KEY, process.env.BITSTAMP_SECRET);
@@ -0,0 +1,48 @@
1
+ import { Crypto } from "../types/crypto";
2
+ import { CCXTLiquidityProvider } from "../types/ccxt-liquidity-provider";
3
+ import { Fiat } from "../types/fiat";
4
+ import { Side } from "../types/side";
5
+ declare class CCXTClient {
6
+ private env;
7
+ constructor(env: "production" | "development");
8
+ createBuyOrder(amount: number, crypto: Crypto, fiat: Fiat, ccxtLiquidityProvider: CCXTLiquidityProvider): Promise<{
9
+ ccxtId: any;
10
+ price: any;
11
+ amountCrypto: any;
12
+ amountFiat: number;
13
+ crypto: Crypto;
14
+ fiat: Fiat;
15
+ side: Side;
16
+ }>;
17
+ createSellOrder(amount: number, crypto: Crypto, fiat: Fiat, ccxtLiquidityProvider: CCXTLiquidityProvider): Promise<{
18
+ ccxtId: any;
19
+ price: any;
20
+ amountCrypto: number;
21
+ amountFiat: number;
22
+ crypto: Crypto;
23
+ fiat: Fiat;
24
+ side: Side;
25
+ }>;
26
+ transfer(side: Side, amount: number, crypto: Crypto, cryptoAddress: string, ccxtLiquidityProvider: CCXTLiquidityProvider): Promise<void>;
27
+ getBuyQuote(amount: number, crypto: Crypto, fiat: Fiat): Promise<{
28
+ price: number;
29
+ amountCrypto: number;
30
+ amountFiat: number;
31
+ crypto: Crypto;
32
+ fiat: Fiat;
33
+ side: Side;
34
+ }>;
35
+ private getOptimalExchange;
36
+ private round;
37
+ private getExchange;
38
+ getSellQuote(amount: number, crypto: Crypto, fiat: Fiat): Promise<{
39
+ price: number;
40
+ amountCrypto: number;
41
+ amountFiat: number;
42
+ crypto: Crypto;
43
+ fiat: Fiat;
44
+ }>;
45
+ getDepositAddress(crypto: Crypto): Promise<string>;
46
+ }
47
+ export declare const ccxtWrapper: CCXTClient;
48
+ export {};
@@ -0,0 +1,201 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.ccxtWrapper = void 0;
16
+ const ccxt_1 = __importDefault(require("ccxt"));
17
+ const ccxt_liquidity_provider_1 = require("../types/ccxt-liquidity-provider");
18
+ const rio_env_1 = require("../types/rio-env");
19
+ const side_1 = require("../types/side");
20
+ class CCXTClient {
21
+ constructor(env) {
22
+ this.env = env;
23
+ }
24
+ createBuyOrder(amount, crypto, fiat, ccxtLiquidityProvider) {
25
+ return __awaiter(this, void 0, void 0, function* () {
26
+ if (this.env === "production") {
27
+ const exchange = yield this.getExchange(ccxtLiquidityProvider);
28
+ const order = yield exchange.createOrder(`${crypto}/${fiat}`, "market", "buy", amount);
29
+ return {
30
+ ccxtId: order.id,
31
+ price: order.price,
32
+ amountCrypto: order.amount,
33
+ amountFiat: amount,
34
+ crypto,
35
+ fiat,
36
+ side: side_1.Side.Buy,
37
+ };
38
+ }
39
+ else {
40
+ return {
41
+ ccxtId: "1",
42
+ price: 1,
43
+ amountCrypto: amount,
44
+ amountFiat: amount,
45
+ crypto,
46
+ fiat,
47
+ side: side_1.Side.Buy,
48
+ };
49
+ }
50
+ });
51
+ }
52
+ createSellOrder(amount, crypto, fiat, ccxtLiquidityProvider) {
53
+ return __awaiter(this, void 0, void 0, function* () {
54
+ if (this.env === "production") {
55
+ const exchange = yield this.getExchange(ccxtLiquidityProvider);
56
+ const order = yield exchange.createOrder(`${crypto}/${fiat}`, "market", "sell", amount);
57
+ return {
58
+ ccxtId: order.id,
59
+ price: order.price,
60
+ amountCrypto: amount,
61
+ amountFiat: order.amount * order.price,
62
+ crypto,
63
+ fiat,
64
+ side: side_1.Side.Sell,
65
+ };
66
+ }
67
+ else {
68
+ return {
69
+ ccxtId: "1",
70
+ price: 1,
71
+ amountCrypto: amount,
72
+ amountFiat: amount,
73
+ crypto,
74
+ fiat,
75
+ side: side_1.Side.Sell,
76
+ };
77
+ }
78
+ });
79
+ }
80
+ transfer(side, amount, crypto, cryptoAddress, ccxtLiquidityProvider) {
81
+ return __awaiter(this, void 0, void 0, function* () {
82
+ if (this.env === "production") {
83
+ const exchange = yield this.getExchange(ccxtLiquidityProvider);
84
+ const params = ccxtLiquidityProvider === ccxt_liquidity_provider_1.CCXTLiquidityProvider.Kraken
85
+ ? {
86
+ key: "Metamask",
87
+ }
88
+ : undefined;
89
+ yield exchange.withdraw(crypto, this.round(amount, 8), cryptoAddress, undefined, params);
90
+ }
91
+ });
92
+ }
93
+ getBuyQuote(amount, crypto, fiat) {
94
+ return __awaiter(this, void 0, void 0, function* () {
95
+ if (this.env === "production") {
96
+ const exchange = yield this.getOptimalExchange(crypto);
97
+ if (!exchange)
98
+ throw new Error("Unable to get optimal exchange");
99
+ let ticker = yield exchange.fetchTicker(`${crypto}/${fiat}`);
100
+ if (!ticker.vwap)
101
+ throw new Error("Unable to get ticker vwap");
102
+ return {
103
+ price: ticker.vwap,
104
+ amountCrypto: amount / ticker.vwap,
105
+ amountFiat: amount,
106
+ crypto,
107
+ fiat,
108
+ side: side_1.Side.Buy,
109
+ };
110
+ }
111
+ else {
112
+ return {
113
+ price: 0.5,
114
+ amountCrypto: amount,
115
+ amountFiat: amount,
116
+ crypto,
117
+ fiat,
118
+ side: side_1.Side.Buy,
119
+ };
120
+ }
121
+ });
122
+ }
123
+ getOptimalExchange(crypto) {
124
+ return __awaiter(this, void 0, void 0, function* () {
125
+ for (let exchangeId of ccxt_1.default.exchanges) {
126
+ if (exchangeId === "bitstamp") {
127
+ //@ts-ignore
128
+ const exchangeClass = ccxt_1.default[exchangeId], exchange = new exchangeClass({
129
+ apiKey: process.env[`${exchangeId.toLocaleUpperCase()}_API_KEY`],
130
+ secret: process.env[`${exchangeId.toLocaleUpperCase()}_SECRET`],
131
+ });
132
+ return exchange;
133
+ }
134
+ }
135
+ return null;
136
+ });
137
+ }
138
+ round(value, precision) {
139
+ if (Number.isInteger(precision)) {
140
+ var shift = Math.pow(10, precision);
141
+ // Limited preventing decimal issue
142
+ return Math.round(value * shift + 0.00000000000001) / shift;
143
+ }
144
+ else {
145
+ return Math.round(value);
146
+ }
147
+ }
148
+ getExchange(ccxtLiquidityProvider) {
149
+ return __awaiter(this, void 0, void 0, function* () {
150
+ // @ts-ignore
151
+ const exchangeClass = ccxt_1.default[ccxtLiquidityProvider], exchange = new exchangeClass({
152
+ apiKey: process.env[`${ccxtLiquidityProvider.toLocaleUpperCase()}_API_KEY`],
153
+ secret: process.env[`${ccxtLiquidityProvider.toLocaleUpperCase()}_SECRET`],
154
+ });
155
+ return exchange;
156
+ });
157
+ }
158
+ getSellQuote(amount, crypto, fiat) {
159
+ return __awaiter(this, void 0, void 0, function* () {
160
+ if (this.env === "production") {
161
+ const exchange = yield this.getOptimalExchange(crypto);
162
+ if (!exchange)
163
+ throw new Error("Unable to get optimal exchange");
164
+ exchange.options["fetchMarketsMethod"] = "fetch_markets_from_api";
165
+ let ticker = yield exchange.fetchTicker(`${crypto}/${fiat}`);
166
+ if (!ticker.vwap)
167
+ throw new Error("Unable to get ticker vwap");
168
+ return {
169
+ price: ticker.vwap,
170
+ amountCrypto: amount,
171
+ amountFiat: amount * ticker.vwap,
172
+ crypto,
173
+ fiat,
174
+ };
175
+ }
176
+ else {
177
+ return {
178
+ price: 1,
179
+ amountCrypto: 100,
180
+ amountFiat: 100,
181
+ crypto,
182
+ fiat,
183
+ };
184
+ }
185
+ });
186
+ }
187
+ getDepositAddress(crypto) {
188
+ return __awaiter(this, void 0, void 0, function* () {
189
+ const exchange = yield this.getOptimalExchange(crypto);
190
+ if (!exchange)
191
+ throw new Error("Unable to get optimal exchange");
192
+ let depositAddress = yield exchange.fetchDepositAddress(crypto);
193
+ if (!depositAddress)
194
+ throw new Error("Unable to get deposit address");
195
+ return depositAddress.address;
196
+ });
197
+ }
198
+ }
199
+ exports.ccxtWrapper = new CCXTClient([rio_env_1.RioEnv.Production, rio_env_1.RioEnv.Staging].includes(process.env.RIO_ENV)
200
+ ? "production"
201
+ : "development");
@@ -0,0 +1,6 @@
1
+ import { AxiosInstance, AxiosStatic } from "axios";
2
+ export declare class EtherscanClient {
3
+ private axios;
4
+ constructor(axios: AxiosStatic | AxiosInstance);
5
+ getTransactions(address: string): Promise<any[]>;
6
+ }
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.EtherscanClient = void 0;
13
+ class EtherscanClient {
14
+ constructor(axios) {
15
+ this.axios = axios;
16
+ }
17
+ getTransactions(address) {
18
+ return __awaiter(this, void 0, void 0, function* () {
19
+ const { data } = yield this.axios.get(`https://api.etherscan.io/api?module=account&action=txlist&address=${address}&startblock=0&endblock=99999999&page=1&offset=100&sort=asc&apikey=${"DDR78IVPYXCVGFKTT6YWBBYZBRD18S2EW1"}`);
20
+ return data.result;
21
+ });
22
+ }
23
+ }
24
+ exports.EtherscanClient = EtherscanClient;
@@ -0,0 +1,15 @@
1
+ import { Crypto } from "../types/crypto";
2
+ import { FireblocksSDK } from "fireblocks-sdk";
3
+ declare class FireblocksClient {
4
+ fireblocks: FireblocksSDK;
5
+ constructor(privateKey: string, apiKey: string);
6
+ estimateWithdrawFromExchangeFee(crypto: Crypto, address: string, amountCrypto: number): Promise<string | undefined>;
7
+ estimateWithdrawFromVaultFee(crypto: Crypto, address: string, amountCrypto: number): Promise<string | undefined>;
8
+ withdrawFromExchange(crypto: Crypto, address: string, amountCrypto: number): Promise<void>;
9
+ withdrawFromVault(crypto: Crypto, address: string, amountCrypto: number): Promise<void>;
10
+ getVaultCryptoBalance(crypto: Crypto): Promise<number>;
11
+ getExchangeCryptoBalance(crypto: Crypto): Promise<number>;
12
+ getExchangeFiatBalance(): Promise<number>;
13
+ }
14
+ export declare const fireblocksClient: FireblocksClient;
15
+ export {};
@@ -0,0 +1,140 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.fireblocksClient = void 0;
13
+ const fireblocks_sdk_1 = require("fireblocks-sdk");
14
+ class FireblocksClient {
15
+ constructor(privateKey, apiKey) {
16
+ this.fireblocks = new fireblocks_sdk_1.FireblocksSDK(privateKey, apiKey, "https://api.fireblocks.io");
17
+ }
18
+ estimateWithdrawFromExchangeFee(crypto, address, amountCrypto) {
19
+ return __awaiter(this, void 0, void 0, function* () {
20
+ let estimate = yield this.fireblocks.estimateFeeForTransaction({
21
+ assetId: crypto,
22
+ source: {
23
+ type: fireblocks_sdk_1.PeerType.VAULT_ACCOUNT,
24
+ id: "0",
25
+ },
26
+ destination: {
27
+ type: fireblocks_sdk_1.PeerType.ONE_TIME_ADDRESS,
28
+ oneTimeAddress: {
29
+ address,
30
+ },
31
+ },
32
+ amount: amountCrypto,
33
+ operation: fireblocks_sdk_1.TransactionOperation.TRANSFER,
34
+ });
35
+ return estimate.medium.networkFee;
36
+ });
37
+ }
38
+ estimateWithdrawFromVaultFee(crypto, address, amountCrypto) {
39
+ return __awaiter(this, void 0, void 0, function* () {
40
+ let estimate = yield this.fireblocks.estimateFeeForTransaction({
41
+ assetId: crypto,
42
+ source: {
43
+ type: fireblocks_sdk_1.PeerType.VAULT_ACCOUNT,
44
+ id: "0",
45
+ },
46
+ destination: {
47
+ type: fireblocks_sdk_1.PeerType.ONE_TIME_ADDRESS,
48
+ oneTimeAddress: {
49
+ address,
50
+ },
51
+ },
52
+ amount: amountCrypto,
53
+ operation: fireblocks_sdk_1.TransactionOperation.TRANSFER,
54
+ });
55
+ return estimate.medium.networkFee;
56
+ });
57
+ }
58
+ withdrawFromExchange(crypto, address, amountCrypto) {
59
+ return __awaiter(this, void 0, void 0, function* () {
60
+ let withdraw = yield this.fireblocks.createTransaction({
61
+ assetId: crypto,
62
+ source: {
63
+ type: fireblocks_sdk_1.PeerType.EXCHANGE_ACCOUNT,
64
+ id: "b227e245-a32e-c7ab-ff37-b365fa361077",
65
+ },
66
+ destination: {
67
+ type: fireblocks_sdk_1.PeerType.ONE_TIME_ADDRESS,
68
+ oneTimeAddress: {
69
+ address,
70
+ },
71
+ },
72
+ amount: amountCrypto,
73
+ operation: fireblocks_sdk_1.TransactionOperation.TRANSFER,
74
+ });
75
+ });
76
+ }
77
+ withdrawFromVault(crypto, address, amountCrypto) {
78
+ return __awaiter(this, void 0, void 0, function* () {
79
+ let withdraw = yield this.fireblocks.createTransaction({
80
+ assetId: crypto,
81
+ source: {
82
+ type: fireblocks_sdk_1.PeerType.VAULT_ACCOUNT,
83
+ id: "2",
84
+ },
85
+ destination: {
86
+ type: fireblocks_sdk_1.PeerType.ONE_TIME_ADDRESS,
87
+ oneTimeAddress: {
88
+ address,
89
+ },
90
+ },
91
+ amount: amountCrypto,
92
+ operation: fireblocks_sdk_1.TransactionOperation.TRANSFER,
93
+ });
94
+ });
95
+ }
96
+ getVaultCryptoBalance(crypto) {
97
+ return __awaiter(this, void 0, void 0, function* () {
98
+ let vault = yield this.fireblocks.getVaultAccountById("2");
99
+ let balance = 0;
100
+ if (!(vault === null || vault === void 0 ? void 0 : vault.assets)) {
101
+ throw new Error();
102
+ }
103
+ vault.assets.forEach((asset) => {
104
+ if (asset.id === crypto) {
105
+ balance += Number(asset.available);
106
+ }
107
+ });
108
+ return balance;
109
+ });
110
+ }
111
+ getExchangeCryptoBalance(crypto) {
112
+ return __awaiter(this, void 0, void 0, function* () {
113
+ let exchanges = yield this.fireblocks.getExchangeAccounts();
114
+ let balance = 0;
115
+ exchanges.forEach((exchange) => {
116
+ exchange.assets.forEach((asset) => {
117
+ if (asset.id === crypto) {
118
+ balance += Number(asset.available);
119
+ }
120
+ });
121
+ });
122
+ return balance;
123
+ });
124
+ }
125
+ getExchangeFiatBalance() {
126
+ return __awaiter(this, void 0, void 0, function* () {
127
+ let exchanges = yield this.fireblocks.getExchangeAccounts();
128
+ let balance = 0;
129
+ exchanges.forEach((exchange) => {
130
+ exchange.assets.forEach((asset) => {
131
+ if (asset.id === "USD") {
132
+ balance += Number(asset.available);
133
+ }
134
+ });
135
+ });
136
+ return balance;
137
+ });
138
+ }
139
+ }
140
+ exports.fireblocksClient = new FireblocksClient(process.env.FIREBLOCKS_PRIVATE_KEY, process.env.FIREBLOCKS_API_KEY);
@@ -0,0 +1,8 @@
1
+ import { Fiat } from "../types/fiat";
2
+ declare class FixerClient {
3
+ private apiKey;
4
+ constructor(apiKey: string);
5
+ convert(from: Fiat, to: Fiat): Promise<number>;
6
+ }
7
+ export declare const fixerClient: FixerClient;
8
+ export {};
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.fixerClient = void 0;
16
+ const axios_1 = __importDefault(require("axios"));
17
+ class FixerClient {
18
+ constructor(apiKey) {
19
+ this.apiKey = apiKey;
20
+ }
21
+ convert(from, to) {
22
+ return __awaiter(this, void 0, void 0, function* () {
23
+ const fixerResponse = yield axios_1.default.get(`https://api.apilayer.com/fixer/latest?base=${from}&symbols=${to}`, {
24
+ headers: {
25
+ apikey: this.apiKey,
26
+ "Accept-Encoding": "gzip,deflate,compress",
27
+ },
28
+ });
29
+ const exchangeRate = fixerResponse.data.rates[to];
30
+ return exchangeRate;
31
+ });
32
+ }
33
+ }
34
+ exports.fixerClient = new FixerClient(process.env.FIXER_API_KEY);
@@ -0,0 +1,10 @@
1
+ declare class GuenoClient {
2
+ private email;
3
+ private password;
4
+ private env;
5
+ constructor(email: string, password: string, env: "sandbox" | "production");
6
+ getAddressRiskScore(address: string, protocol: Crypto): Promise<any>;
7
+ getAccessToken(): Promise<any>;
8
+ }
9
+ export declare const guenoClient: GuenoClient;
10
+ export {};
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.guenoClient = void 0;
16
+ const axios_1 = __importDefault(require("axios"));
17
+ class GuenoClient {
18
+ constructor(email, password, env) {
19
+ this.email = email;
20
+ this.password = password;
21
+ this.env = env;
22
+ }
23
+ getAddressRiskScore(address, protocol) {
24
+ return __awaiter(this, void 0, void 0, function* () {
25
+ const accessToken = yield this.getAccessToken();
26
+ const { data } = yield axios_1.default.get(`https://api-gueno.${this.env === "production" ? "prd" : "stg"}.gueno.com/api/amlCrypto/addressRiskScore?address=${address}&protocol=${protocol}`, {
27
+ headers: {
28
+ Authorization: `Bearer ${accessToken}`,
29
+ },
30
+ });
31
+ return data;
32
+ });
33
+ }
34
+ getAccessToken() {
35
+ return __awaiter(this, void 0, void 0, function* () {
36
+ const { data } = yield axios_1.default.post(`https://api-gueno.${this.env === "production" ? "prd" : "stg"}.gueno.com/api/auth/login`, {
37
+ email: this.email,
38
+ password: this.password,
39
+ });
40
+ return data.access_token;
41
+ });
42
+ }
43
+ }
44
+ exports.guenoClient = new GuenoClient(process.env.GUENO_EMAIL, process.env.GUENO_PASSWORD, process.env.GUENO_ENV);
@@ -0,0 +1,6 @@
1
+ declare class KapstarClient {
2
+ constructor();
3
+ getBRLExchangeRateUSD(): Promise<number>;
4
+ }
5
+ export declare const kapstarClient: KapstarClient;
6
+ export {};
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.kapstarClient = void 0;
16
+ const axios_1 = __importDefault(require("axios"));
17
+ class KapstarClient {
18
+ constructor() { }
19
+ getBRLExchangeRateUSD() {
20
+ return __awaiter(this, void 0, void 0, function* () {
21
+ const kapstarResponse = yield axios_1.default.get(`https://api.ecsa.finance/quotation-service/v1/quotation/last`);
22
+ return 1 / kapstarResponse.data;
23
+ });
24
+ }
25
+ }
26
+ exports.kapstarClient = new KapstarClient();