@upbit-official/upbit-sdk 0.9.0

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 (622) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +390 -0
  3. package/api-promise.d.mts +2 -0
  4. package/api-promise.d.mts.map +1 -0
  5. package/api-promise.d.ts +2 -0
  6. package/api-promise.d.ts.map +1 -0
  7. package/api-promise.js +6 -0
  8. package/api-promise.js.map +1 -0
  9. package/api-promise.mjs +2 -0
  10. package/api-promise.mjs.map +1 -0
  11. package/client.d.mts +261 -0
  12. package/client.d.mts.map +1 -0
  13. package/client.d.ts +261 -0
  14. package/client.d.ts.map +1 -0
  15. package/client.js +557 -0
  16. package/client.js.map +1 -0
  17. package/client.mjs +553 -0
  18. package/client.mjs.map +1 -0
  19. package/core/EventEmitter.d.mts +56 -0
  20. package/core/EventEmitter.d.mts.map +1 -0
  21. package/core/EventEmitter.d.ts +56 -0
  22. package/core/EventEmitter.d.ts.map +1 -0
  23. package/core/EventEmitter.js +93 -0
  24. package/core/EventEmitter.js.map +1 -0
  25. package/core/EventEmitter.mjs +88 -0
  26. package/core/EventEmitter.mjs.map +1 -0
  27. package/core/api-promise.d.mts +46 -0
  28. package/core/api-promise.d.mts.map +1 -0
  29. package/core/api-promise.d.ts +46 -0
  30. package/core/api-promise.d.ts.map +1 -0
  31. package/core/api-promise.js +73 -0
  32. package/core/api-promise.js.map +1 -0
  33. package/core/api-promise.mjs +69 -0
  34. package/core/api-promise.mjs.map +1 -0
  35. package/core/error.d.mts +51 -0
  36. package/core/error.d.mts.map +1 -0
  37. package/core/error.d.ts +51 -0
  38. package/core/error.d.ts.map +1 -0
  39. package/core/error.js +150 -0
  40. package/core/error.js.map +1 -0
  41. package/core/error.mjs +133 -0
  42. package/core/error.mjs.map +1 -0
  43. package/core/pagination.d.mts +63 -0
  44. package/core/pagination.d.mts.map +1 -0
  45. package/core/pagination.d.ts +63 -0
  46. package/core/pagination.d.ts.map +1 -0
  47. package/core/pagination.js +125 -0
  48. package/core/pagination.js.map +1 -0
  49. package/core/pagination.mjs +118 -0
  50. package/core/pagination.mjs.map +1 -0
  51. package/core/resource.d.mts +6 -0
  52. package/core/resource.d.mts.map +1 -0
  53. package/core/resource.d.ts +6 -0
  54. package/core/resource.d.ts.map +1 -0
  55. package/core/resource.js +10 -0
  56. package/core/resource.js.map +1 -0
  57. package/core/resource.mjs +6 -0
  58. package/core/resource.mjs.map +1 -0
  59. package/core/uploads.d.mts +3 -0
  60. package/core/uploads.d.mts.map +1 -0
  61. package/core/uploads.d.ts +3 -0
  62. package/core/uploads.d.ts.map +1 -0
  63. package/core/uploads.js +6 -0
  64. package/core/uploads.js.map +1 -0
  65. package/core/uploads.mjs +2 -0
  66. package/core/uploads.mjs.map +1 -0
  67. package/error.d.mts +2 -0
  68. package/error.d.mts.map +1 -0
  69. package/error.d.ts +2 -0
  70. package/error.d.ts.map +1 -0
  71. package/error.js +6 -0
  72. package/error.js.map +1 -0
  73. package/error.mjs +2 -0
  74. package/error.mjs.map +1 -0
  75. package/index.d.mts +8 -0
  76. package/index.d.mts.map +1 -0
  77. package/index.d.ts +8 -0
  78. package/index.d.ts.map +1 -0
  79. package/index.js +36 -0
  80. package/index.js.map +1 -0
  81. package/index.mjs +8 -0
  82. package/index.mjs.map +1 -0
  83. package/internal/builtin-types.d.mts +73 -0
  84. package/internal/builtin-types.d.mts.map +1 -0
  85. package/internal/builtin-types.d.ts +73 -0
  86. package/internal/builtin-types.d.ts.map +1 -0
  87. package/internal/builtin-types.js +3 -0
  88. package/internal/builtin-types.js.map +1 -0
  89. package/internal/builtin-types.mjs +2 -0
  90. package/internal/builtin-types.mjs.map +1 -0
  91. package/internal/errors.d.mts +3 -0
  92. package/internal/errors.d.mts.map +1 -0
  93. package/internal/errors.d.ts +3 -0
  94. package/internal/errors.d.ts.map +1 -0
  95. package/internal/errors.js +40 -0
  96. package/internal/errors.js.map +1 -0
  97. package/internal/errors.mjs +35 -0
  98. package/internal/errors.mjs.map +1 -0
  99. package/internal/headers.d.mts +20 -0
  100. package/internal/headers.d.mts.map +1 -0
  101. package/internal/headers.d.ts +20 -0
  102. package/internal/headers.d.ts.map +1 -0
  103. package/internal/headers.js +78 -0
  104. package/internal/headers.js.map +1 -0
  105. package/internal/headers.mjs +73 -0
  106. package/internal/headers.mjs.map +1 -0
  107. package/internal/parse.d.mts +12 -0
  108. package/internal/parse.d.mts.map +1 -0
  109. package/internal/parse.d.ts +12 -0
  110. package/internal/parse.d.ts.map +1 -0
  111. package/internal/parse.js +40 -0
  112. package/internal/parse.js.map +1 -0
  113. package/internal/parse.mjs +37 -0
  114. package/internal/parse.mjs.map +1 -0
  115. package/internal/qs/formats.d.mts +7 -0
  116. package/internal/qs/formats.d.mts.map +1 -0
  117. package/internal/qs/formats.d.ts +7 -0
  118. package/internal/qs/formats.d.ts.map +1 -0
  119. package/internal/qs/formats.js +13 -0
  120. package/internal/qs/formats.js.map +1 -0
  121. package/internal/qs/formats.mjs +9 -0
  122. package/internal/qs/formats.mjs.map +1 -0
  123. package/internal/qs/index.d.mts +10 -0
  124. package/internal/qs/index.d.mts.map +1 -0
  125. package/internal/qs/index.d.ts +10 -0
  126. package/internal/qs/index.d.ts.map +1 -0
  127. package/internal/qs/index.js +14 -0
  128. package/internal/qs/index.js.map +1 -0
  129. package/internal/qs/index.mjs +10 -0
  130. package/internal/qs/index.mjs.map +1 -0
  131. package/internal/qs/stringify.d.mts +3 -0
  132. package/internal/qs/stringify.d.mts.map +1 -0
  133. package/internal/qs/stringify.d.ts +3 -0
  134. package/internal/qs/stringify.d.ts.map +1 -0
  135. package/internal/qs/stringify.js +277 -0
  136. package/internal/qs/stringify.js.map +1 -0
  137. package/internal/qs/stringify.mjs +274 -0
  138. package/internal/qs/stringify.mjs.map +1 -0
  139. package/internal/qs/types.d.mts +57 -0
  140. package/internal/qs/types.d.mts.map +1 -0
  141. package/internal/qs/types.d.ts +57 -0
  142. package/internal/qs/types.d.ts.map +1 -0
  143. package/internal/qs/types.js +3 -0
  144. package/internal/qs/types.js.map +1 -0
  145. package/internal/qs/types.mjs +2 -0
  146. package/internal/qs/types.mjs.map +1 -0
  147. package/internal/qs/utils.d.mts +15 -0
  148. package/internal/qs/utils.d.mts.map +1 -0
  149. package/internal/qs/utils.d.ts +15 -0
  150. package/internal/qs/utils.d.ts.map +1 -0
  151. package/internal/qs/utils.js +230 -0
  152. package/internal/qs/utils.js.map +1 -0
  153. package/internal/qs/utils.mjs +217 -0
  154. package/internal/qs/utils.mjs.map +1 -0
  155. package/internal/request-options.d.mts +78 -0
  156. package/internal/request-options.d.mts.map +1 -0
  157. package/internal/request-options.d.ts +78 -0
  158. package/internal/request-options.d.ts.map +1 -0
  159. package/internal/request-options.js +13 -0
  160. package/internal/request-options.js.map +1 -0
  161. package/internal/request-options.mjs +9 -0
  162. package/internal/request-options.mjs.map +1 -0
  163. package/internal/shim-types.d.mts +17 -0
  164. package/internal/shim-types.d.mts.map +1 -0
  165. package/internal/shim-types.d.ts +17 -0
  166. package/internal/shim-types.d.ts.map +1 -0
  167. package/internal/shim-types.js +9 -0
  168. package/internal/shim-types.js.map +1 -0
  169. package/internal/shim-types.mjs +8 -0
  170. package/internal/shim-types.mjs.map +1 -0
  171. package/internal/shims.d.mts +26 -0
  172. package/internal/shims.d.mts.map +1 -0
  173. package/internal/shims.d.ts +26 -0
  174. package/internal/shims.d.ts.map +1 -0
  175. package/internal/shims.js +97 -0
  176. package/internal/shims.js.map +1 -0
  177. package/internal/shims.mjs +90 -0
  178. package/internal/shims.mjs.map +1 -0
  179. package/internal/to-file.d.mts +45 -0
  180. package/internal/to-file.d.mts.map +1 -0
  181. package/internal/to-file.d.ts +45 -0
  182. package/internal/to-file.d.ts.map +1 -0
  183. package/internal/to-file.js +91 -0
  184. package/internal/to-file.js.map +1 -0
  185. package/internal/to-file.mjs +88 -0
  186. package/internal/to-file.mjs.map +1 -0
  187. package/internal/tslib.js +81 -0
  188. package/internal/tslib.mjs +17 -0
  189. package/internal/types.d.mts +69 -0
  190. package/internal/types.d.mts.map +1 -0
  191. package/internal/types.d.ts +69 -0
  192. package/internal/types.d.ts.map +1 -0
  193. package/internal/types.js +3 -0
  194. package/internal/types.js.map +1 -0
  195. package/internal/types.mjs +2 -0
  196. package/internal/types.mjs.map +1 -0
  197. package/internal/uploads.d.mts +42 -0
  198. package/internal/uploads.d.mts.map +1 -0
  199. package/internal/uploads.d.ts +42 -0
  200. package/internal/uploads.d.ts.map +1 -0
  201. package/internal/uploads.js +141 -0
  202. package/internal/uploads.js.map +1 -0
  203. package/internal/uploads.mjs +131 -0
  204. package/internal/uploads.mjs.map +1 -0
  205. package/internal/utils/base64.d.mts +3 -0
  206. package/internal/utils/base64.d.mts.map +1 -0
  207. package/internal/utils/base64.d.ts +3 -0
  208. package/internal/utils/base64.d.ts.map +1 -0
  209. package/internal/utils/base64.js +37 -0
  210. package/internal/utils/base64.js.map +1 -0
  211. package/internal/utils/base64.mjs +32 -0
  212. package/internal/utils/base64.mjs.map +1 -0
  213. package/internal/utils/bytes.d.mts +4 -0
  214. package/internal/utils/bytes.d.mts.map +1 -0
  215. package/internal/utils/bytes.d.ts +4 -0
  216. package/internal/utils/bytes.d.ts.map +1 -0
  217. package/internal/utils/bytes.js +31 -0
  218. package/internal/utils/bytes.js.map +1 -0
  219. package/internal/utils/bytes.mjs +26 -0
  220. package/internal/utils/bytes.mjs.map +1 -0
  221. package/internal/utils/env.d.mts +9 -0
  222. package/internal/utils/env.d.mts.map +1 -0
  223. package/internal/utils/env.d.ts +9 -0
  224. package/internal/utils/env.d.ts.map +1 -0
  225. package/internal/utils/env.js +21 -0
  226. package/internal/utils/env.js.map +1 -0
  227. package/internal/utils/env.mjs +17 -0
  228. package/internal/utils/env.mjs.map +1 -0
  229. package/internal/utils/log.d.mts +37 -0
  230. package/internal/utils/log.d.mts.map +1 -0
  231. package/internal/utils/log.d.ts +37 -0
  232. package/internal/utils/log.d.ts.map +1 -0
  233. package/internal/utils/log.js +84 -0
  234. package/internal/utils/log.js.map +1 -0
  235. package/internal/utils/log.mjs +78 -0
  236. package/internal/utils/log.mjs.map +1 -0
  237. package/internal/utils/path.d.mts +15 -0
  238. package/internal/utils/path.d.mts.map +1 -0
  239. package/internal/utils/path.d.ts +15 -0
  240. package/internal/utils/path.d.ts.map +1 -0
  241. package/internal/utils/path.js +79 -0
  242. package/internal/utils/path.js.map +1 -0
  243. package/internal/utils/path.mjs +74 -0
  244. package/internal/utils/path.mjs.map +1 -0
  245. package/internal/utils/query.d.mts +2 -0
  246. package/internal/utils/query.d.mts.map +1 -0
  247. package/internal/utils/query.d.ts +2 -0
  248. package/internal/utils/query.d.ts.map +1 -0
  249. package/internal/utils/query.js +9 -0
  250. package/internal/utils/query.js.map +1 -0
  251. package/internal/utils/query.mjs +5 -0
  252. package/internal/utils/query.mjs.map +1 -0
  253. package/internal/utils/sleep.d.mts +2 -0
  254. package/internal/utils/sleep.d.mts.map +1 -0
  255. package/internal/utils/sleep.d.ts +2 -0
  256. package/internal/utils/sleep.d.ts.map +1 -0
  257. package/internal/utils/sleep.js +6 -0
  258. package/internal/utils/sleep.js.map +1 -0
  259. package/internal/utils/sleep.mjs +2 -0
  260. package/internal/utils/sleep.mjs.map +1 -0
  261. package/internal/utils/uuid.d.mts +5 -0
  262. package/internal/utils/uuid.d.mts.map +1 -0
  263. package/internal/utils/uuid.d.ts +5 -0
  264. package/internal/utils/uuid.d.ts.map +1 -0
  265. package/internal/utils/uuid.js +21 -0
  266. package/internal/utils/uuid.js.map +1 -0
  267. package/internal/utils/uuid.mjs +17 -0
  268. package/internal/utils/uuid.mjs.map +1 -0
  269. package/internal/utils/values.d.mts +18 -0
  270. package/internal/utils/values.d.mts.map +1 -0
  271. package/internal/utils/values.d.ts +18 -0
  272. package/internal/utils/values.d.ts.map +1 -0
  273. package/internal/utils/values.js +111 -0
  274. package/internal/utils/values.js.map +1 -0
  275. package/internal/utils/values.mjs +93 -0
  276. package/internal/utils/values.mjs.map +1 -0
  277. package/internal/utils.d.mts +8 -0
  278. package/internal/utils.d.mts.map +1 -0
  279. package/internal/utils.d.ts +8 -0
  280. package/internal/utils.d.ts.map +1 -0
  281. package/internal/utils.js +11 -0
  282. package/internal/utils.js.map +1 -0
  283. package/internal/utils.mjs +8 -0
  284. package/internal/utils.mjs.map +1 -0
  285. package/internal/ws.d.mts +31 -0
  286. package/internal/ws.d.mts.map +1 -0
  287. package/internal/ws.d.ts +31 -0
  288. package/internal/ws.d.ts.map +1 -0
  289. package/internal/ws.js +39 -0
  290. package/internal/ws.js.map +1 -0
  291. package/internal/ws.mjs +36 -0
  292. package/internal/ws.mjs.map +1 -0
  293. package/lib/index.d.mts +5 -0
  294. package/lib/index.d.mts.map +1 -0
  295. package/lib/index.d.ts +5 -0
  296. package/lib/index.d.ts.map +1 -0
  297. package/lib/index.js +11 -0
  298. package/lib/index.js.map +1 -0
  299. package/lib/index.mjs +4 -0
  300. package/lib/index.mjs.map +1 -0
  301. package/lib/jsonParseFloat.d.mts +16 -0
  302. package/lib/jsonParseFloat.d.mts.map +1 -0
  303. package/lib/jsonParseFloat.d.ts +16 -0
  304. package/lib/jsonParseFloat.d.ts.map +1 -0
  305. package/lib/jsonParseFloat.js +77 -0
  306. package/lib/jsonParseFloat.js.map +1 -0
  307. package/lib/jsonParseFloat.mjs +74 -0
  308. package/lib/jsonParseFloat.mjs.map +1 -0
  309. package/lib/jwtAuth.d.mts +7 -0
  310. package/lib/jwtAuth.d.mts.map +1 -0
  311. package/lib/jwtAuth.d.ts +7 -0
  312. package/lib/jwtAuth.d.ts.map +1 -0
  313. package/lib/jwtAuth.js +33 -0
  314. package/lib/jwtAuth.js.map +1 -0
  315. package/lib/jwtAuth.mjs +30 -0
  316. package/lib/jwtAuth.mjs.map +1 -0
  317. package/lib/ws.d.mts +95 -0
  318. package/lib/ws.d.mts.map +1 -0
  319. package/lib/ws.d.ts +95 -0
  320. package/lib/ws.d.ts.map +1 -0
  321. package/lib/ws.js +229 -0
  322. package/lib/ws.js.map +1 -0
  323. package/lib/ws.mjs +223 -0
  324. package/lib/ws.mjs.map +1 -0
  325. package/package.json +169 -0
  326. package/pagination.d.mts +2 -0
  327. package/pagination.d.mts.map +1 -0
  328. package/pagination.d.ts +2 -0
  329. package/pagination.d.ts.map +1 -0
  330. package/pagination.js +6 -0
  331. package/pagination.js.map +1 -0
  332. package/pagination.mjs +2 -0
  333. package/pagination.mjs.map +1 -0
  334. package/resource.d.mts +2 -0
  335. package/resource.d.mts.map +1 -0
  336. package/resource.d.ts +2 -0
  337. package/resource.d.ts.map +1 -0
  338. package/resource.js +6 -0
  339. package/resource.js.map +1 -0
  340. package/resource.mjs +2 -0
  341. package/resource.mjs.map +1 -0
  342. package/resources/accounts.d.mts +48 -0
  343. package/resources/accounts.d.mts.map +1 -0
  344. package/resources/accounts.d.ts +48 -0
  345. package/resources/accounts.d.ts.map +1 -0
  346. package/resources/accounts.js +19 -0
  347. package/resources/accounts.js.map +1 -0
  348. package/resources/accounts.mjs +15 -0
  349. package/resources/accounts.mjs.map +1 -0
  350. package/resources/api-keys.d.mts +33 -0
  351. package/resources/api-keys.d.mts.map +1 -0
  352. package/resources/api-keys.d.ts +33 -0
  353. package/resources/api-keys.d.ts.map +1 -0
  354. package/resources/api-keys.js +19 -0
  355. package/resources/api-keys.js.map +1 -0
  356. package/resources/api-keys.mjs +15 -0
  357. package/resources/api-keys.mjs.map +1 -0
  358. package/resources/candles.d.mts +310 -0
  359. package/resources/candles.d.mts.map +1 -0
  360. package/resources/candles.d.ts +310 -0
  361. package/resources/candles.d.ts.map +1 -0
  362. package/resources/candles.js +117 -0
  363. package/resources/candles.js.map +1 -0
  364. package/resources/candles.mjs +113 -0
  365. package/resources/candles.mjs.map +1 -0
  366. package/resources/deposits.d.mts +373 -0
  367. package/resources/deposits.d.mts.map +1 -0
  368. package/resources/deposits.d.ts +373 -0
  369. package/resources/deposits.d.ts.map +1 -0
  370. package/resources/deposits.js +139 -0
  371. package/resources/deposits.js.map +1 -0
  372. package/resources/deposits.mjs +135 -0
  373. package/resources/deposits.mjs.map +1 -0
  374. package/resources/index.d.mts +15 -0
  375. package/resources/index.d.mts.map +1 -0
  376. package/resources/index.d.ts +15 -0
  377. package/resources/index.d.ts.map +1 -0
  378. package/resources/index.js +32 -0
  379. package/resources/index.js.map +1 -0
  380. package/resources/index.mjs +15 -0
  381. package/resources/index.mjs.map +1 -0
  382. package/resources/orderbooks.d.mts +134 -0
  383. package/resources/orderbooks.d.mts.map +1 -0
  384. package/resources/orderbooks.d.ts +134 -0
  385. package/resources/orderbooks.d.ts.map +1 -0
  386. package/resources/orderbooks.js +31 -0
  387. package/resources/orderbooks.js.map +1 -0
  388. package/resources/orderbooks.mjs +27 -0
  389. package/resources/orderbooks.mjs.map +1 -0
  390. package/resources/orders.d.mts +886 -0
  391. package/resources/orders.d.mts.map +1 -0
  392. package/resources/orders.d.ts +886 -0
  393. package/resources/orders.d.ts.map +1 -0
  394. package/resources/orders.js +250 -0
  395. package/resources/orders.js.map +1 -0
  396. package/resources/orders.mjs +246 -0
  397. package/resources/orders.mjs.map +1 -0
  398. package/resources/tickers.d.mts +184 -0
  399. package/resources/tickers.d.mts.map +1 -0
  400. package/resources/tickers.d.ts +184 -0
  401. package/resources/tickers.d.ts.map +1 -0
  402. package/resources/tickers.js +30 -0
  403. package/resources/tickers.js.map +1 -0
  404. package/resources/tickers.mjs +26 -0
  405. package/resources/tickers.mjs.map +1 -0
  406. package/resources/trades.d.mts +107 -0
  407. package/resources/trades.d.mts.map +1 -0
  408. package/resources/trades.d.ts +107 -0
  409. package/resources/trades.d.ts.map +1 -0
  410. package/resources/trades.js +19 -0
  411. package/resources/trades.js.map +1 -0
  412. package/resources/trades.mjs +15 -0
  413. package/resources/trades.mjs.map +1 -0
  414. package/resources/trading-pairs.d.mts +96 -0
  415. package/resources/trading-pairs.d.mts.map +1 -0
  416. package/resources/trading-pairs.d.ts +96 -0
  417. package/resources/trading-pairs.d.ts.map +1 -0
  418. package/resources/trading-pairs.js +19 -0
  419. package/resources/trading-pairs.js.map +1 -0
  420. package/resources/trading-pairs.mjs +15 -0
  421. package/resources/trading-pairs.mjs.map +1 -0
  422. package/resources/travel-rule.d.mts +139 -0
  423. package/resources/travel-rule.d.mts.map +1 -0
  424. package/resources/travel-rule.d.ts +139 -0
  425. package/resources/travel-rule.d.ts.map +1 -0
  426. package/resources/travel-rule.js +68 -0
  427. package/resources/travel-rule.js.map +1 -0
  428. package/resources/travel-rule.mjs +64 -0
  429. package/resources/travel-rule.mjs.map +1 -0
  430. package/resources/wallet-status.d.mts +74 -0
  431. package/resources/wallet-status.d.mts.map +1 -0
  432. package/resources/wallet-status.d.ts +74 -0
  433. package/resources/wallet-status.d.ts.map +1 -0
  434. package/resources/wallet-status.js +19 -0
  435. package/resources/wallet-status.js.map +1 -0
  436. package/resources/wallet-status.mjs +15 -0
  437. package/resources/wallet-status.mjs.map +1 -0
  438. package/resources/withdraws.d.mts +599 -0
  439. package/resources/withdraws.d.mts.map +1 -0
  440. package/resources/withdraws.d.ts +599 -0
  441. package/resources/withdraws.d.ts.map +1 -0
  442. package/resources/withdraws.js +139 -0
  443. package/resources/withdraws.js.map +1 -0
  444. package/resources/withdraws.mjs +135 -0
  445. package/resources/withdraws.mjs.map +1 -0
  446. package/resources/ws-private/index.d.mts +3 -0
  447. package/resources/ws-private/index.d.mts.map +1 -0
  448. package/resources/ws-private/index.d.ts +3 -0
  449. package/resources/ws-private/index.d.ts.map +1 -0
  450. package/resources/ws-private/index.js +6 -0
  451. package/resources/ws-private/index.js.map +1 -0
  452. package/resources/ws-private/index.mjs +2 -0
  453. package/resources/ws-private/index.mjs.map +1 -0
  454. package/resources/ws-private/internal-base.d.mts +58 -0
  455. package/resources/ws-private/internal-base.d.mts.map +1 -0
  456. package/resources/ws-private/internal-base.d.ts +58 -0
  457. package/resources/ws-private/internal-base.d.ts.map +1 -0
  458. package/resources/ws-private/internal-base.js +51 -0
  459. package/resources/ws-private/internal-base.js.map +1 -0
  460. package/resources/ws-private/internal-base.mjs +45 -0
  461. package/resources/ws-private/internal-base.mjs.map +1 -0
  462. package/resources/ws-private/ws-private.d.mts +224 -0
  463. package/resources/ws-private/ws-private.d.mts.map +1 -0
  464. package/resources/ws-private/ws-private.d.ts +224 -0
  465. package/resources/ws-private/ws-private.d.ts.map +1 -0
  466. package/resources/ws-private/ws-private.js +8 -0
  467. package/resources/ws-private/ws-private.js.map +1 -0
  468. package/resources/ws-private/ws-private.mjs +4 -0
  469. package/resources/ws-private/ws-private.mjs.map +1 -0
  470. package/resources/ws-private/ws.d.mts +85 -0
  471. package/resources/ws-private/ws.d.mts.map +1 -0
  472. package/resources/ws-private/ws.d.ts +85 -0
  473. package/resources/ws-private/ws.d.ts.map +1 -0
  474. package/resources/ws-private/ws.js +433 -0
  475. package/resources/ws-private/ws.js.map +1 -0
  476. package/resources/ws-private/ws.mjs +428 -0
  477. package/resources/ws-private/ws.mjs.map +1 -0
  478. package/resources/ws-private.d.mts +2 -0
  479. package/resources/ws-private.d.mts.map +1 -0
  480. package/resources/ws-private.d.ts +2 -0
  481. package/resources/ws-private.d.ts.map +1 -0
  482. package/resources/ws-private.js +5 -0
  483. package/resources/ws-private.js.map +1 -0
  484. package/resources/ws-private.mjs +2 -0
  485. package/resources/ws-private.mjs.map +1 -0
  486. package/resources/ws-public/index.d.mts +3 -0
  487. package/resources/ws-public/index.d.mts.map +1 -0
  488. package/resources/ws-public/index.d.ts +3 -0
  489. package/resources/ws-public/index.d.ts.map +1 -0
  490. package/resources/ws-public/index.js +6 -0
  491. package/resources/ws-public/index.js.map +1 -0
  492. package/resources/ws-public/index.mjs +2 -0
  493. package/resources/ws-public/index.mjs.map +1 -0
  494. package/resources/ws-public/internal-base.d.mts +58 -0
  495. package/resources/ws-public/internal-base.d.mts.map +1 -0
  496. package/resources/ws-public/internal-base.d.ts +58 -0
  497. package/resources/ws-public/internal-base.d.ts.map +1 -0
  498. package/resources/ws-public/internal-base.js +51 -0
  499. package/resources/ws-public/internal-base.js.map +1 -0
  500. package/resources/ws-public/internal-base.mjs +45 -0
  501. package/resources/ws-public/internal-base.mjs.map +1 -0
  502. package/resources/ws-public/ws-public.d.mts +427 -0
  503. package/resources/ws-public/ws-public.d.mts.map +1 -0
  504. package/resources/ws-public/ws-public.d.ts +427 -0
  505. package/resources/ws-public/ws-public.d.ts.map +1 -0
  506. package/resources/ws-public/ws-public.js +8 -0
  507. package/resources/ws-public/ws-public.js.map +1 -0
  508. package/resources/ws-public/ws-public.mjs +4 -0
  509. package/resources/ws-public/ws-public.mjs.map +1 -0
  510. package/resources/ws-public/ws.d.mts +85 -0
  511. package/resources/ws-public/ws.d.mts.map +1 -0
  512. package/resources/ws-public/ws.d.ts +85 -0
  513. package/resources/ws-public/ws.d.ts.map +1 -0
  514. package/resources/ws-public/ws.js +428 -0
  515. package/resources/ws-public/ws.js.map +1 -0
  516. package/resources/ws-public/ws.mjs +423 -0
  517. package/resources/ws-public/ws.mjs.map +1 -0
  518. package/resources/ws-public.d.mts +2 -0
  519. package/resources/ws-public.d.mts.map +1 -0
  520. package/resources/ws-public.d.ts +2 -0
  521. package/resources/ws-public.d.ts.map +1 -0
  522. package/resources/ws-public.js +5 -0
  523. package/resources/ws-public.js.map +1 -0
  524. package/resources/ws-public.mjs +2 -0
  525. package/resources/ws-public.mjs.map +1 -0
  526. package/resources.d.mts +2 -0
  527. package/resources.d.mts.map +1 -0
  528. package/resources.d.ts +2 -0
  529. package/resources.d.ts.map +1 -0
  530. package/resources.js +5 -0
  531. package/resources.js.map +1 -0
  532. package/resources.mjs +2 -0
  533. package/resources.mjs.map +1 -0
  534. package/src/api-promise.ts +2 -0
  535. package/src/client.ts +1112 -0
  536. package/src/core/EventEmitter.ts +114 -0
  537. package/src/core/README.md +3 -0
  538. package/src/core/api-promise.ts +91 -0
  539. package/src/core/error.ts +182 -0
  540. package/src/core/pagination.ts +195 -0
  541. package/src/core/resource.ts +10 -0
  542. package/src/core/uploads.ts +2 -0
  543. package/src/error.ts +2 -0
  544. package/src/index.ts +24 -0
  545. package/src/internal/README.md +3 -0
  546. package/src/internal/builtin-types.ts +92 -0
  547. package/src/internal/errors.ts +32 -0
  548. package/src/internal/headers.ts +96 -0
  549. package/src/internal/parse.ts +56 -0
  550. package/src/internal/qs/LICENSE.md +13 -0
  551. package/src/internal/qs/README.md +3 -0
  552. package/src/internal/qs/formats.ts +10 -0
  553. package/src/internal/qs/index.ts +13 -0
  554. package/src/internal/qs/stringify.ts +385 -0
  555. package/src/internal/qs/types.ts +71 -0
  556. package/src/internal/qs/utils.ts +265 -0
  557. package/src/internal/request-options.ts +92 -0
  558. package/src/internal/shim-types.ts +25 -0
  559. package/src/internal/shims.ts +106 -0
  560. package/src/internal/to-file.ts +154 -0
  561. package/src/internal/types.ts +94 -0
  562. package/src/internal/uploads.ts +187 -0
  563. package/src/internal/utils/base64.ts +39 -0
  564. package/src/internal/utils/bytes.ts +32 -0
  565. package/src/internal/utils/env.ts +17 -0
  566. package/src/internal/utils/log.ts +125 -0
  567. package/src/internal/utils/path.ts +88 -0
  568. package/src/internal/utils/query.ts +6 -0
  569. package/src/internal/utils/sleep.ts +2 -0
  570. package/src/internal/utils/uuid.ts +19 -0
  571. package/src/internal/utils/values.ts +104 -0
  572. package/src/internal/utils.ts +8 -0
  573. package/src/internal/ws.ts +68 -0
  574. package/src/lib/index.ts +4 -0
  575. package/src/lib/jsonParseFloat.ts +73 -0
  576. package/src/lib/jwtAuth.ts +39 -0
  577. package/src/lib/ws.ts +282 -0
  578. package/src/pagination.ts +2 -0
  579. package/src/resource.ts +2 -0
  580. package/src/resources/accounts.ts +59 -0
  581. package/src/resources/api-keys.ts +40 -0
  582. package/src/resources/candles.ts +392 -0
  583. package/src/resources/deposits.ts +484 -0
  584. package/src/resources/index.ts +102 -0
  585. package/src/resources/orderbooks.ts +170 -0
  586. package/src/resources/orders.ts +1102 -0
  587. package/src/resources/tickers.ts +233 -0
  588. package/src/resources/trades.ts +127 -0
  589. package/src/resources/trading-pairs.ts +120 -0
  590. package/src/resources/travel-rule.ts +181 -0
  591. package/src/resources/wallet-status.ts +87 -0
  592. package/src/resources/withdraws.ts +734 -0
  593. package/src/resources/ws-private/index.ts +3 -0
  594. package/src/resources/ws-private/internal-base.ts +99 -0
  595. package/src/resources/ws-private/ws-private.ts +283 -0
  596. package/src/resources/ws-private/ws.ts +529 -0
  597. package/src/resources/ws-private.ts +2 -0
  598. package/src/resources/ws-public/index.ts +3 -0
  599. package/src/resources/ws-public/internal-base.ts +99 -0
  600. package/src/resources/ws-public/ws-public.ts +561 -0
  601. package/src/resources/ws-public/ws.ts +525 -0
  602. package/src/resources/ws-public.ts +2 -0
  603. package/src/resources.ts +1 -0
  604. package/src/tsconfig.json +11 -0
  605. package/src/uploads.ts +2 -0
  606. package/src/version.ts +1 -0
  607. package/uploads.d.mts +2 -0
  608. package/uploads.d.mts.map +1 -0
  609. package/uploads.d.ts +2 -0
  610. package/uploads.d.ts.map +1 -0
  611. package/uploads.js +6 -0
  612. package/uploads.js.map +1 -0
  613. package/uploads.mjs +2 -0
  614. package/uploads.mjs.map +1 -0
  615. package/version.d.mts +2 -0
  616. package/version.d.mts.map +1 -0
  617. package/version.d.ts +2 -0
  618. package/version.d.ts.map +1 -0
  619. package/version.js +5 -0
  620. package/version.js.map +1 -0
  621. package/version.mjs +2 -0
  622. package/version.mjs.map +1 -0
package/client.mjs ADDED
@@ -0,0 +1,553 @@
1
+ var _Upbit_instances, _a, _Upbit_encoder, _Upbit_baseURLOverridden;
2
+ import { __classPrivateFieldGet, __classPrivateFieldSet } from "./internal/tslib.mjs";
3
+ import { uuid4 } from "./internal/utils/uuid.mjs";
4
+ import { validatePositiveInteger, isAbsoluteURL, safeJSON } from "./internal/utils/values.mjs";
5
+ import { sleep } from "./internal/utils/sleep.mjs";
6
+ import { castToError, isAbortError } from "./internal/errors.mjs";
7
+ import * as Shims from "./internal/shims.mjs";
8
+ import * as Opts from "./internal/request-options.mjs";
9
+ import { stringifyQuery } from "./internal/utils/query.mjs";
10
+ import { VERSION } from "./version.mjs";
11
+ import * as Errors from "./core/error.mjs";
12
+ import * as Pagination from "./core/pagination.mjs";
13
+ import * as Uploads from "./core/uploads.mjs";
14
+ import * as API from "./resources/index.mjs";
15
+ import { APIPromise } from "./core/api-promise.mjs";
16
+ import { Accounts } from "./resources/accounts.mjs";
17
+ import { APIKeys } from "./resources/api-keys.mjs";
18
+ import { Candles, } from "./resources/candles.mjs";
19
+ import { Deposits, } from "./resources/deposits.mjs";
20
+ import { Orderbooks, } from "./resources/orderbooks.mjs";
21
+ import { Orders, } from "./resources/orders.mjs";
22
+ import { Tickers, } from "./resources/tickers.mjs";
23
+ import { Trades } from "./resources/trades.mjs";
24
+ import { TradingPairs } from "./resources/trading-pairs.mjs";
25
+ import { TravelRule, } from "./resources/travel-rule.mjs";
26
+ import { WalletStatus } from "./resources/wallet-status.mjs";
27
+ import { Withdraws, } from "./resources/withdraws.mjs";
28
+ import { WsPrivate, } from "./resources/ws-private/ws-private.mjs";
29
+ import { WsPublic, } from "./resources/ws-public/ws-public.mjs";
30
+ import { buildHeaders } from "./internal/headers.mjs";
31
+ import { readEnv } from "./internal/utils/env.mjs";
32
+ import { createJwtToken } from "./lib/jwtAuth.mjs";
33
+ import { WsStream } from "./lib/ws.mjs";
34
+ import { formatRequestDetails, loggerFor, parseLogLevel, } from "./internal/utils/log.mjs";
35
+ import { isEmptyObj } from "./internal/utils/values.mjs";
36
+ const environments = {
37
+ kr: 'https://api.upbit.com',
38
+ sg: 'https://sg-api.upbit.com',
39
+ id: 'https://id-api.upbit.com',
40
+ th: 'https://th-api.upbit.com',
41
+ };
42
+ /**
43
+ * API Client for interfacing with the Upbit API.
44
+ */
45
+ export class Upbit {
46
+ /**
47
+ * API Client for interfacing with the Upbit API.
48
+ *
49
+ * @param {string | null | undefined} [opts.accessKey=process.env['UPBIT_ACCESS_KEY'] ?? null]
50
+ * @param {string | null | undefined} [opts.secretKey=process.env['UPBIT_SECRET_KEY'] ?? null]
51
+ * @param {Environment} [opts.environment=kr] - Specifies the environment URL to use for the API.
52
+ * @param {string} [opts.baseURL=process.env['UPBIT_BASE_URL'] ?? https://api.upbit.com] - Override the default base URL for the API.
53
+ * @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
54
+ * @param {MergedRequestInit} [opts.fetchOptions] - Additional `RequestInit` options to be passed to `fetch` calls.
55
+ * @param {Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
56
+ * @param {number} [opts.maxRetries=2] - The maximum number of times the client will retry a request.
57
+ * @param {HeadersLike} opts.defaultHeaders - Default headers to include with every request to the API.
58
+ * @param {Record<string, string | undefined>} opts.defaultQuery - Default query parameters to include with every request to the API.
59
+ */
60
+ constructor({ baseURL = readEnv('UPBIT_BASE_URL'), accessKey = readEnv('UPBIT_ACCESS_KEY') ?? null, secretKey = readEnv('UPBIT_SECRET_KEY') ?? null, ...opts } = {}) {
61
+ _Upbit_instances.add(this);
62
+ _Upbit_encoder.set(this, void 0);
63
+ this.accounts = new API.Accounts(this);
64
+ this.travelRule = new API.TravelRule(this);
65
+ this.walletStatus = new API.WalletStatus(this);
66
+ this.apiKeys = new API.APIKeys(this);
67
+ this.orders = new API.Orders(this);
68
+ this.withdraws = new API.Withdraws(this);
69
+ this.deposits = new API.Deposits(this);
70
+ this.tradingPairs = new API.TradingPairs(this);
71
+ this.tickers = new API.Tickers(this);
72
+ this.orderbooks = new API.Orderbooks(this);
73
+ this.trades = new API.Trades(this);
74
+ this.candles = new API.Candles(this);
75
+ this.wsPublic = new API.WsPublic(this);
76
+ this.wsPrivate = new API.WsPrivate(this);
77
+ const options = {
78
+ accessKey,
79
+ secretKey,
80
+ ...opts,
81
+ baseURL,
82
+ environment: opts.environment ?? 'kr',
83
+ };
84
+ if (baseURL && opts.environment) {
85
+ throw new Errors.UpbitError('Ambiguous URL; The `baseURL` option (or UPBIT_BASE_URL env var) and the `environment` option are given. If you want to use the environment you must pass baseURL: null');
86
+ }
87
+ this.baseURL = options.baseURL || environments[options.environment || 'kr'];
88
+ this.timeout = options.timeout ?? _a.DEFAULT_TIMEOUT /* 1 minute */;
89
+ this.logger = options.logger ?? console;
90
+ const defaultLogLevel = 'warn';
91
+ // Set default logLevel early so that we can log a warning in parseLogLevel.
92
+ this.logLevel = defaultLogLevel;
93
+ this.logLevel =
94
+ parseLogLevel(options.logLevel, 'ClientOptions.logLevel', this) ??
95
+ parseLogLevel(readEnv('UPBIT_LOG'), "process.env['UPBIT_LOG']", this) ??
96
+ defaultLogLevel;
97
+ this.fetchOptions = options.fetchOptions;
98
+ this.maxRetries = options.maxRetries ?? 2;
99
+ this.fetch = options.fetch ?? Shims.getDefaultFetch();
100
+ __classPrivateFieldSet(this, _Upbit_encoder, Opts.FallbackEncoder, "f");
101
+ this._options = options;
102
+ this.accessKey = accessKey;
103
+ this.secretKey = secretKey;
104
+ }
105
+ /**
106
+ * Create a new client instance re-using the same options given to the current client with optional overriding.
107
+ */
108
+ withOptions(options) {
109
+ const client = new this.constructor({
110
+ ...this._options,
111
+ environment: options.environment ? options.environment : undefined,
112
+ baseURL: options.environment ? undefined : this.baseURL,
113
+ maxRetries: this.maxRetries,
114
+ timeout: this.timeout,
115
+ logger: this.logger,
116
+ logLevel: this.logLevel,
117
+ fetch: this.fetch,
118
+ fetchOptions: this.fetchOptions,
119
+ accessKey: this.accessKey,
120
+ secretKey: this.secretKey,
121
+ ...options,
122
+ });
123
+ return client;
124
+ }
125
+ defaultQuery() {
126
+ return this._options.defaultQuery;
127
+ }
128
+ validateHeaders({ values, nulls }) {
129
+ return;
130
+ }
131
+ async authHeaders(opts, schemes) {
132
+ return buildHeaders([schemes.bearerAuth ? await this.bearerAuth(opts) : null]);
133
+ }
134
+ async bearerAuth(opts) {
135
+ if (this.accessKey == null || this.secretKey == null) {
136
+ return undefined;
137
+ }
138
+ const queryParams = opts.query ??
139
+ (opts.body != null && typeof opts.body === 'object' && !Array.isArray(opts.body) ?
140
+ opts.body
141
+ : null);
142
+ const token = createJwtToken(this.accessKey, this.secretKey, queryParams);
143
+ return buildHeaders([{ Authorization: `Bearer ${token}` }]);
144
+ }
145
+ stringifyQuery(query) {
146
+ return stringifyQuery(query);
147
+ }
148
+ getUserAgent() {
149
+ return `${this.constructor.name}/JS ${VERSION}`;
150
+ }
151
+ defaultIdempotencyKey() {
152
+ return `node-retry-${uuid4()}`;
153
+ }
154
+ makeStatusError(status, error, message, headers) {
155
+ return Errors.APIError.generate(status, error, message, headers);
156
+ }
157
+ buildURL(path, query, defaultBaseURL) {
158
+ const baseURL = (!__classPrivateFieldGet(this, _Upbit_instances, "m", _Upbit_baseURLOverridden).call(this) && defaultBaseURL) || this.baseURL;
159
+ const url = isAbsoluteURL(path) ?
160
+ new URL(path)
161
+ : new URL(baseURL + (baseURL.endsWith('/') && path.startsWith('/') ? path.slice(1) : path));
162
+ const defaultQuery = this.defaultQuery();
163
+ const pathQuery = Object.fromEntries(url.searchParams);
164
+ if (!isEmptyObj(defaultQuery) || !isEmptyObj(pathQuery)) {
165
+ query = { ...pathQuery, ...defaultQuery, ...query };
166
+ }
167
+ if (typeof query === 'object' && query && !Array.isArray(query)) {
168
+ url.search = this.stringifyQuery(query);
169
+ }
170
+ return url.toString();
171
+ }
172
+ /**
173
+ * Used as a callback for mutating the given `FinalRequestOptions` object.
174
+ */
175
+ async prepareOptions(options) { }
176
+ /**
177
+ * Used as a callback for mutating the given `RequestInit` object.
178
+ *
179
+ * This is useful for cases where you want to add certain headers based off of
180
+ * the request properties, e.g. `method` or `url`.
181
+ */
182
+ async prepareRequest(request, { url, options }) { }
183
+ get(path, opts) {
184
+ return this.methodRequest('get', path, opts);
185
+ }
186
+ post(path, opts) {
187
+ return this.methodRequest('post', path, opts);
188
+ }
189
+ patch(path, opts) {
190
+ return this.methodRequest('patch', path, opts);
191
+ }
192
+ put(path, opts) {
193
+ return this.methodRequest('put', path, opts);
194
+ }
195
+ delete(path, opts) {
196
+ return this.methodRequest('delete', path, opts);
197
+ }
198
+ methodRequest(method, path, opts) {
199
+ return this.request(Promise.resolve(opts).then((opts) => {
200
+ return { method, path, ...opts };
201
+ }));
202
+ }
203
+ request(options, remainingRetries = null) {
204
+ return new APIPromise(this, this.makeRequest(options, remainingRetries, undefined));
205
+ }
206
+ async makeRequest(optionsInput, retriesRemaining, retryOfRequestLogID) {
207
+ const options = await optionsInput;
208
+ const maxRetries = options.maxRetries ?? this.maxRetries;
209
+ if (retriesRemaining == null) {
210
+ retriesRemaining = maxRetries;
211
+ }
212
+ await this.prepareOptions(options);
213
+ const { req, url, timeout } = await this.buildRequest(options, {
214
+ retryCount: maxRetries - retriesRemaining,
215
+ });
216
+ await this.prepareRequest(req, { url, options });
217
+ /** Not an API request ID, just for correlating local log entries. */
218
+ const requestLogID = 'log_' + ((Math.random() * (1 << 24)) | 0).toString(16).padStart(6, '0');
219
+ const retryLogStr = retryOfRequestLogID === undefined ? '' : `, retryOf: ${retryOfRequestLogID}`;
220
+ const startTime = Date.now();
221
+ loggerFor(this).debug(`[${requestLogID}] sending request`, formatRequestDetails({
222
+ retryOfRequestLogID,
223
+ method: options.method,
224
+ url,
225
+ options,
226
+ headers: req.headers,
227
+ }));
228
+ if (options.signal?.aborted) {
229
+ throw new Errors.APIUserAbortError();
230
+ }
231
+ const controller = new AbortController();
232
+ const response = await this.fetchWithTimeout(url, req, timeout, controller).catch(castToError);
233
+ const headersTime = Date.now();
234
+ if (response instanceof globalThis.Error) {
235
+ const retryMessage = `retrying, ${retriesRemaining} attempts remaining`;
236
+ if (options.signal?.aborted) {
237
+ throw new Errors.APIUserAbortError();
238
+ }
239
+ // detect native connection timeout errors
240
+ // deno throws "TypeError: error sending request for url (https://example/): client error (Connect): tcp connect error: Operation timed out (os error 60): Operation timed out (os error 60)"
241
+ // undici throws "TypeError: fetch failed" with cause "ConnectTimeoutError: Connect Timeout Error (attempted address: example:443, timeout: 1ms)"
242
+ // others do not provide enough information to distinguish timeouts from other connection errors
243
+ const isTimeout = isAbortError(response) ||
244
+ /timed? ?out/i.test(String(response) + ('cause' in response ? String(response.cause) : ''));
245
+ if (retriesRemaining) {
246
+ loggerFor(this).info(`[${requestLogID}] connection ${isTimeout ? 'timed out' : 'failed'} - ${retryMessage}`);
247
+ loggerFor(this).debug(`[${requestLogID}] connection ${isTimeout ? 'timed out' : 'failed'} (${retryMessage})`, formatRequestDetails({
248
+ retryOfRequestLogID,
249
+ url,
250
+ durationMs: headersTime - startTime,
251
+ message: response.message,
252
+ }));
253
+ return this.retryRequest(options, retriesRemaining, retryOfRequestLogID ?? requestLogID);
254
+ }
255
+ loggerFor(this).info(`[${requestLogID}] connection ${isTimeout ? 'timed out' : 'failed'} - error; no more retries left`);
256
+ loggerFor(this).debug(`[${requestLogID}] connection ${isTimeout ? 'timed out' : 'failed'} (error; no more retries left)`, formatRequestDetails({
257
+ retryOfRequestLogID,
258
+ url,
259
+ durationMs: headersTime - startTime,
260
+ message: response.message,
261
+ }));
262
+ if (isTimeout) {
263
+ throw new Errors.APIConnectionTimeoutError();
264
+ }
265
+ throw new Errors.APIConnectionError({ cause: response });
266
+ }
267
+ const responseInfo = `[${requestLogID}${retryLogStr}] ${req.method} ${url} ${response.ok ? 'succeeded' : 'failed'} with status ${response.status} in ${headersTime - startTime}ms`;
268
+ if (!response.ok) {
269
+ const shouldRetry = await this.shouldRetry(response);
270
+ if (retriesRemaining && shouldRetry) {
271
+ const retryMessage = `retrying, ${retriesRemaining} attempts remaining`;
272
+ // We don't need the body of this response.
273
+ await Shims.CancelReadableStream(response.body);
274
+ loggerFor(this).info(`${responseInfo} - ${retryMessage}`);
275
+ loggerFor(this).debug(`[${requestLogID}] response error (${retryMessage})`, formatRequestDetails({
276
+ retryOfRequestLogID,
277
+ url: response.url,
278
+ status: response.status,
279
+ headers: response.headers,
280
+ durationMs: headersTime - startTime,
281
+ }));
282
+ return this.retryRequest(options, retriesRemaining, retryOfRequestLogID ?? requestLogID, response.headers);
283
+ }
284
+ const retryMessage = shouldRetry ? `error; no more retries left` : `error; not retryable`;
285
+ loggerFor(this).info(`${responseInfo} - ${retryMessage}`);
286
+ const errText = await response.text().catch((err) => castToError(err).message);
287
+ const errJSON = safeJSON(errText);
288
+ const errMessage = errJSON ? undefined : errText;
289
+ loggerFor(this).debug(`[${requestLogID}] response error (${retryMessage})`, formatRequestDetails({
290
+ retryOfRequestLogID,
291
+ url: response.url,
292
+ status: response.status,
293
+ headers: response.headers,
294
+ message: errMessage,
295
+ durationMs: Date.now() - startTime,
296
+ }));
297
+ const err = this.makeStatusError(response.status, errJSON, errMessage, response.headers);
298
+ throw err;
299
+ }
300
+ loggerFor(this).info(responseInfo);
301
+ loggerFor(this).debug(`[${requestLogID}] response start`, formatRequestDetails({
302
+ retryOfRequestLogID,
303
+ url: response.url,
304
+ status: response.status,
305
+ headers: response.headers,
306
+ durationMs: headersTime - startTime,
307
+ }));
308
+ return { response, options, controller, requestLogID, retryOfRequestLogID, startTime };
309
+ }
310
+ getAPIList(path, Page, opts) {
311
+ return this.requestAPIList(Page, opts && 'then' in opts ?
312
+ opts.then((opts) => ({ method: 'get', path, ...opts }))
313
+ : { method: 'get', path, ...opts });
314
+ }
315
+ requestAPIList(Page, options) {
316
+ const request = this.makeRequest(options, null, undefined);
317
+ return new Pagination.PagePromise(this, request, Page);
318
+ }
319
+ async fetchWithTimeout(url, init, ms, controller) {
320
+ const { signal, method, ...options } = init || {};
321
+ const abort = this._makeAbort(controller);
322
+ if (signal)
323
+ signal.addEventListener('abort', abort, { once: true });
324
+ const timeout = setTimeout(abort, ms);
325
+ const isReadableBody = (globalThis.ReadableStream && options.body instanceof globalThis.ReadableStream) ||
326
+ (typeof options.body === 'object' && options.body !== null && Symbol.asyncIterator in options.body);
327
+ const fetchOptions = {
328
+ signal: controller.signal,
329
+ ...(isReadableBody ? { duplex: 'half' } : {}),
330
+ method: 'GET',
331
+ ...options,
332
+ };
333
+ if (method) {
334
+ // Custom methods like 'patch' need to be uppercased
335
+ // See https://github.com/nodejs/undici/issues/2294
336
+ fetchOptions.method = method.toUpperCase();
337
+ }
338
+ try {
339
+ // use undefined this binding; fetch errors if bound to something else in browser/cloudflare
340
+ return await this.fetch.call(undefined, url, fetchOptions);
341
+ }
342
+ finally {
343
+ clearTimeout(timeout);
344
+ }
345
+ }
346
+ async shouldRetry(response) {
347
+ // Note this is not a standard header.
348
+ const shouldRetryHeader = response.headers.get('x-should-retry');
349
+ // If the server explicitly says whether or not to retry, obey.
350
+ if (shouldRetryHeader === 'true')
351
+ return true;
352
+ if (shouldRetryHeader === 'false')
353
+ return false;
354
+ // Retry on request timeouts.
355
+ if (response.status === 408)
356
+ return true;
357
+ // Retry on lock timeouts.
358
+ if (response.status === 409)
359
+ return true;
360
+ // Retry on rate limits.
361
+ if (response.status === 429)
362
+ return true;
363
+ // Retry internal errors.
364
+ if (response.status >= 500)
365
+ return true;
366
+ return false;
367
+ }
368
+ async retryRequest(options, retriesRemaining, requestLogID, responseHeaders) {
369
+ let timeoutMillis;
370
+ // Note the `retry-after-ms` header may not be standard, but is a good idea and we'd like proactive support for it.
371
+ const retryAfterMillisHeader = responseHeaders?.get('retry-after-ms');
372
+ if (retryAfterMillisHeader) {
373
+ const timeoutMs = parseFloat(retryAfterMillisHeader);
374
+ if (!Number.isNaN(timeoutMs)) {
375
+ timeoutMillis = timeoutMs;
376
+ }
377
+ }
378
+ // About the Retry-After header: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After
379
+ const retryAfterHeader = responseHeaders?.get('retry-after');
380
+ if (retryAfterHeader && !timeoutMillis) {
381
+ const timeoutSeconds = parseFloat(retryAfterHeader);
382
+ if (!Number.isNaN(timeoutSeconds)) {
383
+ timeoutMillis = timeoutSeconds * 1000;
384
+ }
385
+ else {
386
+ timeoutMillis = Date.parse(retryAfterHeader) - Date.now();
387
+ }
388
+ }
389
+ // If the API asks us to wait a certain amount of time, just do what it
390
+ // says, but otherwise calculate a default
391
+ if (timeoutMillis === undefined) {
392
+ const maxRetries = options.maxRetries ?? this.maxRetries;
393
+ timeoutMillis = this.calculateDefaultRetryTimeoutMillis(retriesRemaining, maxRetries);
394
+ }
395
+ await sleep(timeoutMillis);
396
+ return this.makeRequest(options, retriesRemaining - 1, requestLogID);
397
+ }
398
+ calculateDefaultRetryTimeoutMillis(retriesRemaining, maxRetries) {
399
+ const initialRetryDelay = 0.5;
400
+ const maxRetryDelay = 8.0;
401
+ const numRetries = maxRetries - retriesRemaining;
402
+ // Apply exponential backoff, but not more than the max.
403
+ const sleepSeconds = Math.min(initialRetryDelay * Math.pow(2, numRetries), maxRetryDelay);
404
+ // Apply some jitter, take up to at most 25 percent of the retry time.
405
+ const jitter = 1 - Math.random() * 0.25;
406
+ return sleepSeconds * jitter * 1000;
407
+ }
408
+ async buildRequest(inputOptions, { retryCount = 0 } = {}) {
409
+ const options = { ...inputOptions };
410
+ const { method, path, query, defaultBaseURL } = options;
411
+ const url = this.buildURL(path, query, defaultBaseURL);
412
+ if ('timeout' in options)
413
+ validatePositiveInteger('timeout', options.timeout);
414
+ options.timeout = options.timeout ?? this.timeout;
415
+ const { bodyHeaders, body } = this.buildBody({ options });
416
+ const reqHeaders = await this.buildHeaders({ options: inputOptions, method, bodyHeaders, retryCount });
417
+ const req = {
418
+ method,
419
+ headers: reqHeaders,
420
+ ...(options.signal && { signal: options.signal }),
421
+ ...(globalThis.ReadableStream &&
422
+ body instanceof globalThis.ReadableStream && { duplex: 'half' }),
423
+ ...(body && { body }),
424
+ ...(this.fetchOptions ?? {}),
425
+ ...(options.fetchOptions ?? {}),
426
+ };
427
+ return { req, url, timeout: options.timeout };
428
+ }
429
+ async buildHeaders({ options, method, bodyHeaders, retryCount, }) {
430
+ let idempotencyHeaders = {};
431
+ if (this.idempotencyHeader && method !== 'get') {
432
+ if (!options.idempotencyKey)
433
+ options.idempotencyKey = this.defaultIdempotencyKey();
434
+ idempotencyHeaders[this.idempotencyHeader] = options.idempotencyKey;
435
+ }
436
+ const headers = buildHeaders([
437
+ idempotencyHeaders,
438
+ {
439
+ Accept: 'application/json',
440
+ 'User-Agent': this.getUserAgent(),
441
+ 'X-Upbit-SDK-Lang': 'typescript',
442
+ 'X-Upbit-SDK-Version': VERSION,
443
+ 'X-Upbit-Runtime': getRuntimeName(),
444
+ 'X-Upbit-Runtime-Version': getRuntimeVersion(),
445
+ },
446
+ await this.authHeaders(options, options.__security ?? { bearerAuth: true }),
447
+ this._options.defaultHeaders,
448
+ bodyHeaders,
449
+ options.headers,
450
+ ]);
451
+ this.validateHeaders(headers);
452
+ return headers.values;
453
+ }
454
+ _makeAbort(controller) {
455
+ // note: we can't just inline this method inside `fetchWithTimeout()` because then the closure
456
+ // would capture all request options, and cause a memory leak.
457
+ return () => controller.abort();
458
+ }
459
+ buildBody({ options: { body, headers: rawHeaders } }) {
460
+ if (!body) {
461
+ return { bodyHeaders: undefined, body: undefined };
462
+ }
463
+ const headers = buildHeaders([rawHeaders]);
464
+ if (
465
+ // Pass raw type verbatim
466
+ ArrayBuffer.isView(body) ||
467
+ body instanceof ArrayBuffer ||
468
+ body instanceof DataView ||
469
+ (typeof body === 'string' &&
470
+ // Preserve legacy string encoding behavior for now
471
+ headers.values.has('content-type')) ||
472
+ // `Blob` is superset of `File`
473
+ (globalThis.Blob && body instanceof globalThis.Blob) ||
474
+ // `FormData` -> `multipart/form-data`
475
+ body instanceof FormData ||
476
+ // `URLSearchParams` -> `application/x-www-form-urlencoded`
477
+ body instanceof URLSearchParams ||
478
+ // Send chunked stream (each chunk has own `length`)
479
+ (globalThis.ReadableStream && body instanceof globalThis.ReadableStream)) {
480
+ return { bodyHeaders: undefined, body: body };
481
+ }
482
+ else if (typeof body === 'object' &&
483
+ (Symbol.asyncIterator in body ||
484
+ (Symbol.iterator in body && 'next' in body && typeof body.next === 'function'))) {
485
+ return { bodyHeaders: undefined, body: Shims.ReadableStreamFrom(body) };
486
+ }
487
+ else if (typeof body === 'object' &&
488
+ headers.values.get('content-type') === 'application/x-www-form-urlencoded') {
489
+ return {
490
+ bodyHeaders: { 'content-type': 'application/x-www-form-urlencoded' },
491
+ body: this.stringifyQuery(body),
492
+ };
493
+ }
494
+ else {
495
+ return __classPrivateFieldGet(this, _Upbit_encoder, "f").call(this, { body, headers });
496
+ }
497
+ }
498
+ /** Convenience accessor for WebSocket streams. */
499
+ get wsStream() {
500
+ return (this._wsStream ?? (this._wsStream = new WsStream(this)));
501
+ }
502
+ }
503
+ _a = Upbit, _Upbit_encoder = new WeakMap(), _Upbit_instances = new WeakSet(), _Upbit_baseURLOverridden = function _Upbit_baseURLOverridden() {
504
+ return this.baseURL !== environments[this._options.environment || 'kr'];
505
+ };
506
+ Upbit.Upbit = _a;
507
+ Upbit.DEFAULT_TIMEOUT = 60000; // 1 minute
508
+ Upbit.UpbitError = Errors.UpbitError;
509
+ Upbit.APIError = Errors.APIError;
510
+ Upbit.APIConnectionError = Errors.APIConnectionError;
511
+ Upbit.APIConnectionTimeoutError = Errors.APIConnectionTimeoutError;
512
+ Upbit.APIUserAbortError = Errors.APIUserAbortError;
513
+ Upbit.NotFoundError = Errors.NotFoundError;
514
+ Upbit.ConflictError = Errors.ConflictError;
515
+ Upbit.RateLimitError = Errors.RateLimitError;
516
+ Upbit.RateLimitPenaltyError = Errors.RateLimitPenaltyError;
517
+ Upbit.BadRequestError = Errors.BadRequestError;
518
+ Upbit.AuthenticationError = Errors.AuthenticationError;
519
+ Upbit.InternalServerError = Errors.InternalServerError;
520
+ Upbit.PermissionDeniedError = Errors.PermissionDeniedError;
521
+ Upbit.UnprocessableEntityError = Errors.UnprocessableEntityError;
522
+ Upbit.toFile = Uploads.toFile;
523
+ Upbit.Accounts = Accounts;
524
+ Upbit.TravelRule = TravelRule;
525
+ Upbit.WalletStatus = WalletStatus;
526
+ Upbit.APIKeys = APIKeys;
527
+ Upbit.Orders = Orders;
528
+ Upbit.Withdraws = Withdraws;
529
+ Upbit.Deposits = Deposits;
530
+ Upbit.TradingPairs = TradingPairs;
531
+ Upbit.Tickers = Tickers;
532
+ Upbit.Orderbooks = Orderbooks;
533
+ Upbit.Trades = Trades;
534
+ Upbit.Candles = Candles;
535
+ Upbit.WsPublic = WsPublic;
536
+ Upbit.WsPrivate = WsPrivate;
537
+ function getRuntimeName() {
538
+ if (typeof globalThis.Bun !== 'undefined')
539
+ return 'bun';
540
+ if (typeof globalThis.Deno !== 'undefined')
541
+ return 'deno';
542
+ return 'node';
543
+ }
544
+ function getRuntimeVersion() {
545
+ if (typeof globalThis.Bun !== 'undefined') {
546
+ return globalThis.Bun.version ?? 'unknown';
547
+ }
548
+ if (typeof globalThis.Deno !== 'undefined') {
549
+ return globalThis.Deno.version?.deno ?? 'unknown';
550
+ }
551
+ return typeof process !== 'undefined' ? process.version : 'unknown';
552
+ }
553
+ //# sourceMappingURL=client.mjs.map
package/client.mjs.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.mjs","sourceRoot":"","sources":["src/client.ts"],"names":[],"mappings":";;OAGO,EAAE,KAAK,EAAE;OACT,EAAE,uBAAuB,EAAE,aAAa,EAAE,QAAQ,EAAE;OACpD,EAAE,KAAK,EAAE;OAET,EAAE,WAAW,EAAE,YAAY,EAAE;OAE7B,KAAK,KAAK;OACV,KAAK,IAAI;OACT,EAAE,cAAc,EAAE;OAClB,EAAE,OAAO,EAAE;OACX,KAAK,MAAM;OACX,KAAK,UAAU;OAQf,KAAK,OAAO;OACZ,KAAK,GAAG;OACR,EAAE,UAAU,EAAE;OACd,EAAuB,QAAQ,EAAE;OACjC,EAAsB,OAAO,EAAE;OAC/B,EAeL,OAAO,GACR;OACM,EAYL,QAAQ,GAET;OACM,EAKL,UAAU,GACX;OACM,EAoBL,MAAM,GAKP;OACM,EAML,OAAO,GACR;OACM,EAAsC,MAAM,EAAE;OAC9C,EAAkD,YAAY,EAAE;OAChE,EACL,UAAU,GAKX;OACM,EAAE,YAAY,EAA4B;OAC1C,EAWL,SAAS,GAEV;OACM,EAGL,SAAS,GACV;OACM,EAGL,QAAQ,GACT;OAEM,EAAg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,CAAC,SAAS,CAAC;AACtE,CAAC"}
@@ -0,0 +1,56 @@
1
+ type EventListener<Events, EventType extends keyof Events> = Events[EventType];
2
+ export type EventParameters<Events, EventType extends keyof Events> = {
3
+ [Event in EventType]: EventListener<Events, EventType> extends (...args: infer P) => any ? P : never;
4
+ }[EventType];
5
+ export declare class EventEmitter<EventTypes extends Record<string, (...args: any) => any>> {
6
+ #private;
7
+ /**
8
+ * Adds the listener function to the end of the listeners array for the event.
9
+ * No checks are made to see if the listener has already been added. Multiple calls passing
10
+ * the same combination of event and listener will result in the listener being added, and
11
+ * called, multiple times.
12
+ * @returns this, so that calls can be chained
13
+ */
14
+ on<Event extends keyof EventTypes>(event: Event, listener: EventListener<EventTypes, Event>): this;
15
+ /**
16
+ * Removes the specified listener from the listener array for the event.
17
+ * off() will remove, at most, one instance of a listener from the listener array. If any single
18
+ * listener has been added multiple times to the listener array for the specified event, then
19
+ * off() must be called multiple times to remove each instance.
20
+ * @returns this, so that calls can be chained
21
+ */
22
+ off<Event extends keyof EventTypes>(event: Event, listener: EventListener<EventTypes, Event>): this;
23
+ /**
24
+ * Adds a one-time listener function for the event. The next time the event is triggered,
25
+ * this listener is removed and then invoked.
26
+ * @returns this, so that calls can be chained
27
+ */
28
+ once<Event extends keyof EventTypes>(event: Event, listener: EventListener<EventTypes, Event>): this;
29
+ /**
30
+ * This is similar to `.once()`, but returns a Promise that resolves the next time
31
+ * the event is triggered, instead of calling a listener callback.
32
+ * @returns a Promise that resolves the next time given event is triggered,
33
+ * or rejects if an error is emitted. (If you request the 'error' event,
34
+ * returns a promise that resolves with the error).
35
+ *
36
+ * Example:
37
+ *
38
+ * const message = await stream.emitted('message') // rejects if the stream errors
39
+ */
40
+ emitted<Event extends keyof EventTypes>(event: Event): Promise<EventParameters<EventTypes, Event> extends [infer Param] ? Param : EventParameters<EventTypes, Event> extends [] ? void : EventParameters<EventTypes, Event>>;
41
+ protected _emit<Event extends keyof EventTypes>(this: EventEmitter<EventTypes>, event: Event, ...args: EventParameters<EventTypes, Event>): void;
42
+ protected _hasListener(event: keyof EventTypes): boolean;
43
+ }
44
+ /**
45
+ * An EventEmitter variant that exposes `_emit()` publicly.
46
+ *
47
+ * The base {@link EventEmitter} keeps `_emit` protected so that consumers
48
+ * can only listen, not dispatch. When you need a separate emitter instance
49
+ * that your own code can emit on, without exposing emit on the
50
+ * consumer-facing emitter, use this class.
51
+ */
52
+ export declare class InternalEventEmitter<EventTypes extends Record<string, (...args: any) => any>> extends EventEmitter<EventTypes> {
53
+ _emit<Event extends keyof EventTypes>(event: Event, ...args: EventParameters<EventTypes, Event>): void;
54
+ }
55
+ export {};
56
+ //# sourceMappingURL=EventEmitter.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EventEmitter.d.mts","sourceRoot":"","sources":["../src/core/EventEmitter.ts"],"names":[],"mappings":"AAAA,KAAK,aAAa,CAAC,MAAM,EAAE,SAAS,SAAS,MAAM,MAAM,IAAI,MAAM,CAAC,SAAS,CAAC,CAAC;AAO/E,MAAM,MAAM,eAAe,CAAC,MAAM,EAAE,SAAS,SAAS,MAAM,MAAM,IAAI;KACnE,KAAK,IAAI,SAAS,GAAG,aAAa,CAAC,MAAM,EAAE,SAAS,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,MAAM,CAAC,KAAK,GAAG,GAAG,CAAC,GAAG,KAAK;CACrG,CAAC,SAAS,CAAC,CAAC;AAEb,qBAAa,YAAY,CAAC,UAAU,SAAS,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,KAAK,GAAG,CAAC;;IAKhF;;;;;;OAMG;IACH,EAAE,CAAC,KAAK,SAAS,MAAM,UAAU,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,aAAa,CAAC,UAAU,EAAE,KAAK,CAAC,GAAG,IAAI;IAOlG;;;;;;OAMG;IACH,GAAG,CAAC,KAAK,SAAS,MAAM,UAAU,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ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