@typus/typus-perp-sdk 1.1.32-codegen-exp3 → 1.1.32-testnet-exp1

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 (249) hide show
  1. package/dist/src/_dependencies/source/0x1/ascii/structs.d.ts +88 -0
  2. package/dist/src/_dependencies/source/0x1/ascii/structs.js +398 -0
  3. package/dist/src/_dependencies/source/0x1/index.d.ts +3 -0
  4. package/dist/src/_dependencies/source/0x1/index.js +6 -0
  5. package/dist/src/_dependencies/source/0x1/option/structs.d.ts +50 -0
  6. package/dist/src/_dependencies/source/0x1/option/structs.js +271 -0
  7. package/dist/src/_dependencies/source/0x1/string/structs.d.ts +48 -0
  8. package/dist/src/_dependencies/source/0x1/string/structs.js +256 -0
  9. package/dist/src/_dependencies/source/0x1/type-name/structs.d.ts +49 -0
  10. package/dist/src/_dependencies/source/0x1/type-name/structs.js +223 -0
  11. package/dist/src/_dependencies/source/0x2/bag/structs.d.ts +54 -0
  12. package/dist/src/_dependencies/source/0x2/bag/structs.js +229 -0
  13. package/dist/src/_dependencies/source/0x2/balance/structs.d.ts +84 -0
  14. package/dist/src/_dependencies/source/0x2/balance/structs.js +386 -0
  15. package/dist/src/_dependencies/source/0x2/coin/structs.d.ts +406 -0
  16. package/dist/src/_dependencies/source/0x2/coin/structs.js +1247 -0
  17. package/dist/src/_dependencies/source/0x2/index.d.ts +3 -0
  18. package/dist/src/_dependencies/source/0x2/index.js +6 -0
  19. package/dist/src/_dependencies/source/0x2/linked-table/structs.d.ts +132 -0
  20. package/dist/src/_dependencies/source/0x2/linked-table/structs.js +438 -0
  21. package/dist/src/_dependencies/source/0x2/object/structs.d.ts +86 -0
  22. package/dist/src/_dependencies/source/0x2/object/structs.js +364 -0
  23. package/dist/src/_dependencies/source/0x2/object-table/structs.d.ts +54 -0
  24. package/dist/src/_dependencies/source/0x2/object-table/structs.js +248 -0
  25. package/dist/src/_dependencies/source/0x2/sui/structs.d.ts +44 -0
  26. package/dist/src/_dependencies/source/0x2/sui/structs.js +222 -0
  27. package/dist/src/_dependencies/source/0x2/table/structs.d.ts +54 -0
  28. package/dist/src/_dependencies/source/0x2/table/structs.js +248 -0
  29. package/dist/src/_dependencies/source/0x2/table-vec/structs.d.ts +59 -0
  30. package/dist/src/_dependencies/source/0x2/table-vec/structs.js +274 -0
  31. package/dist/src/_dependencies/source/0x2/token/structs.d.ts +421 -0
  32. package/dist/src/_dependencies/source/0x2/token/structs.js +1095 -0
  33. package/dist/src/_dependencies/source/0x2/transfer-policy/structs.d.ts +348 -0
  34. package/dist/src/_dependencies/source/0x2/transfer-policy/structs.js +1091 -0
  35. package/dist/src/_dependencies/source/0x2/url/structs.d.ts +49 -0
  36. package/dist/src/_dependencies/source/0x2/url/structs.js +223 -0
  37. package/dist/src/_dependencies/source/0x2/vec-map/structs.d.ts +106 -0
  38. package/dist/src/_dependencies/source/0x2/vec-map/structs.js +446 -0
  39. package/dist/src/_dependencies/source/0x2/vec-set/structs.d.ts +49 -0
  40. package/dist/src/_dependencies/source/0x2/vec-set/structs.js +270 -0
  41. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/airdrop/structs.d.ts +422 -0
  42. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/airdrop/structs.js +1084 -0
  43. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/big-vector/structs.d.ts +130 -0
  44. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/big-vector/structs.js +456 -0
  45. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/critbit/structs.d.ts +208 -0
  46. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/critbit/structs.js +653 -0
  47. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/ecosystem/structs.d.ts +362 -0
  48. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/ecosystem/structs.js +899 -0
  49. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/index.d.ts +8 -0
  50. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/index.js +11 -0
  51. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/init.d.ts +2 -0
  52. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/init.js +102 -0
  53. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/keyed-big-vector/structs.d.ts +202 -0
  54. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/keyed-big-vector/structs.js +632 -0
  55. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/leaderboard/structs.d.ts +600 -0
  56. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/leaderboard/structs.js +1459 -0
  57. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/linked-object-table/structs.d.ts +136 -0
  58. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/linked-object-table/structs.js +438 -0
  59. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/linked-set/structs.d.ts +127 -0
  60. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/linked-set/structs.js +430 -0
  61. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/tails-staking/structs.d.ts +957 -0
  62. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/tails-staking/structs.js +2261 -0
  63. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/tgld/structs.d.ts +244 -0
  64. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/tgld/structs.js +733 -0
  65. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/user/structs.d.ts +294 -0
  66. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/user/structs.js +892 -0
  67. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/authority/structs.d.ts +73 -0
  68. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/authority/structs.js +263 -0
  69. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/balance-pool/structs.d.ts +294 -0
  70. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/balance-pool/structs.js +591 -0
  71. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/big-vector/structs.d.ts +64 -0
  72. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/big-vector/structs.js +258 -0
  73. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/dutch/structs.d.ts +756 -0
  74. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/dutch/structs.js +1721 -0
  75. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/i64/structs.d.ts +44 -0
  76. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/i64/structs.js +222 -0
  77. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/index.d.ts +3 -0
  78. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/index.js +6 -0
  79. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/init.d.ts +2 -0
  80. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/init.js +89 -0
  81. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/linked-list/structs.d.ts +135 -0
  82. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/linked-list/structs.js +444 -0
  83. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/vault/structs.d.ts +2106 -0
  84. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/vault/structs.js +4952 -0
  85. package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/discount-mint/structs.d.ts +390 -0
  86. package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/discount-mint/structs.js +844 -0
  87. package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/index.d.ts +6 -0
  88. package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/index.js +9 -0
  89. package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/init.d.ts +2 -0
  90. package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/init.js +69 -0
  91. package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/royalty-rule/structs.d.ts +89 -0
  92. package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/royalty-rule/structs.js +376 -0
  93. package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/staking/structs.d.ts +386 -0
  94. package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/staking/structs.js +881 -0
  95. package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/table-vec/structs.d.ts +59 -0
  96. package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/table-vec/structs.js +274 -0
  97. package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/typus-nft/structs.d.ts +974 -0
  98. package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/typus-nft/structs.js +2387 -0
  99. package/dist/src/_framework/init-loader.d.ts +2 -0
  100. package/dist/src/{generated/typus_perp/treasury_caps.js → _framework/init-loader.js} +10 -17
  101. package/dist/src/_framework/loader.d.ts +17 -0
  102. package/dist/src/_framework/loader.js +108 -0
  103. package/dist/src/_framework/reified.d.ts +108 -0
  104. package/dist/src/_framework/reified.js +237 -0
  105. package/dist/src/_framework/util.d.ts +35 -0
  106. package/dist/src/_framework/util.js +396 -0
  107. package/dist/src/_framework/vector.d.ts +42 -0
  108. package/dist/src/_framework/vector.js +112 -0
  109. package/dist/src/api/sentio.js +538 -604
  110. package/dist/src/fetch.d.ts +36 -577
  111. package/dist/src/fetch.js +665 -367
  112. package/dist/src/index.d.ts +4 -0
  113. package/dist/src/index.js +39 -20
  114. package/dist/src/pyth.js +1 -0
  115. package/dist/src/typus_perp/admin/functions.d.ts +59 -0
  116. package/dist/src/typus_perp/admin/functions.js +122 -0
  117. package/dist/src/typus_perp/admin/structs.d.ts +467 -0
  118. package/dist/src/typus_perp/admin/structs.js +1065 -0
  119. package/dist/src/typus_perp/competition/functions.d.ts +24 -0
  120. package/dist/src/typus_perp/competition/functions.js +38 -0
  121. package/dist/src/typus_perp/competition/structs.d.ts +80 -0
  122. package/dist/src/typus_perp/competition/structs.js +288 -0
  123. package/dist/src/typus_perp/error/functions.d.ts +73 -0
  124. package/dist/src/typus_perp/error/functions.js +363 -0
  125. package/dist/src/typus_perp/escrow/functions.d.ts +17 -0
  126. package/dist/src/typus_perp/escrow/functions.js +36 -0
  127. package/dist/src/typus_perp/escrow/structs.d.ts +160 -0
  128. package/dist/src/typus_perp/escrow/structs.js +324 -0
  129. package/dist/src/typus_perp/index.d.ts +1 -0
  130. package/dist/src/typus_perp/index.js +7 -0
  131. package/dist/src/typus_perp/init.d.ts +2 -0
  132. package/dist/src/typus_perp/init.js +118 -0
  133. package/dist/src/typus_perp/lending/functions.d.ts +15 -0
  134. package/dist/src/typus_perp/lending/functions.js +22 -0
  135. package/dist/src/typus_perp/lp-pool/functions.d.ts +460 -0
  136. package/dist/src/typus_perp/lp-pool/functions.js +732 -0
  137. package/dist/src/typus_perp/lp-pool/structs.d.ts +3705 -0
  138. package/dist/src/typus_perp/lp-pool/structs.js +6789 -0
  139. package/dist/src/typus_perp/math/functions.d.ts +29 -0
  140. package/dist/src/typus_perp/math/functions.js +61 -0
  141. package/dist/src/typus_perp/position/functions.d.ts +379 -0
  142. package/dist/src/typus_perp/position/functions.js +713 -0
  143. package/dist/src/typus_perp/position/structs.d.ts +905 -0
  144. package/dist/src/typus_perp/position/structs.js +1450 -0
  145. package/dist/src/typus_perp/symbol/functions.d.ts +9 -0
  146. package/dist/src/typus_perp/symbol/functions.js +24 -0
  147. package/dist/src/typus_perp/symbol/structs.d.ts +70 -0
  148. package/dist/src/typus_perp/symbol/structs.js +235 -0
  149. package/dist/src/typus_perp/tlp/functions.d.ts +19 -0
  150. package/dist/src/typus_perp/tlp/functions.js +40 -0
  151. package/dist/src/typus_perp/tlp/structs.d.ts +89 -0
  152. package/dist/src/typus_perp/tlp/structs.js +365 -0
  153. package/dist/src/typus_perp/token-interface/functions.d.ts +11 -0
  154. package/dist/src/typus_perp/token-interface/functions.js +22 -0
  155. package/dist/src/typus_perp/trading/functions.d.ts +812 -0
  156. package/dist/src/typus_perp/trading/functions.js +1218 -0
  157. package/dist/src/typus_perp/trading/structs.d.ts +3060 -0
  158. package/dist/src/typus_perp/trading/structs.js +5813 -0
  159. package/dist/src/typus_perp/treasury-caps/functions.d.ts +9 -0
  160. package/dist/src/typus_perp/treasury-caps/functions.js +36 -0
  161. package/dist/src/typus_perp/treasury-caps/structs.d.ts +49 -0
  162. package/dist/src/typus_perp/treasury-caps/structs.js +223 -0
  163. package/dist/src/typus_perp/user-account/functions.d.ts +36 -0
  164. package/dist/src/typus_perp/user-account/functions.js +70 -0
  165. package/dist/src/typus_perp/user-account/structs.d.ts +148 -0
  166. package/dist/src/typus_perp/user-account/structs.js +448 -0
  167. package/dist/src/typus_stake_pool/admin/functions.d.ts +49 -0
  168. package/dist/src/typus_stake_pool/admin/functions.js +105 -0
  169. package/dist/src/typus_stake_pool/admin/structs.d.ts +365 -0
  170. package/dist/src/typus_stake_pool/admin/structs.js +789 -0
  171. package/dist/src/typus_stake_pool/index.d.ts +1 -0
  172. package/dist/src/typus_stake_pool/index.js +7 -0
  173. package/dist/src/typus_stake_pool/init.d.ts +2 -0
  174. package/dist/src/typus_stake_pool/init.js +69 -0
  175. package/dist/src/typus_stake_pool/stake-pool/functions.d.ts +229 -0
  176. package/dist/src/typus_stake_pool/stake-pool/functions.js +380 -0
  177. package/dist/src/typus_stake_pool/stake-pool/structs.d.ts +2199 -0
  178. package/dist/src/typus_stake_pool/stake-pool/structs.js +4653 -0
  179. package/dist/src/user/history.js +685 -614
  180. package/dist/src/user/order.d.ts +11 -16
  181. package/dist/src/user/order.js +302 -171
  182. package/dist/src/user/orderWithBidReceipt.d.ts +6 -8
  183. package/dist/src/user/orderWithBidReceipt.js +225 -127
  184. package/dist/src/user/tlp.d.ts +24 -25
  185. package/dist/src/user/tlp.js +468 -317
  186. package/package.json +3 -11
  187. package/dist/src/client.d.ts +0 -27
  188. package/dist/src/client.js +0 -108
  189. package/dist/src/generated/typus_perp/admin.d.ts +0 -117
  190. package/dist/src/generated/typus_perp/admin.js +0 -110
  191. package/dist/src/generated/typus_perp/competition.d.ts +0 -22
  192. package/dist/src/generated/typus_perp/competition.js +0 -58
  193. package/dist/src/generated/typus_perp/deps/std/type_name.d.ts +0 -17
  194. package/dist/src/generated/typus_perp/deps/std/type_name.js +0 -25
  195. package/dist/src/generated/typus_perp/deps/sui/balance.d.ts +0 -12
  196. package/dist/src/generated/typus_perp/deps/sui/balance.js +0 -20
  197. package/dist/src/generated/typus_perp/deps/sui/object.d.ts +0 -8
  198. package/dist/src/generated/typus_perp/deps/sui/object.js +0 -16
  199. package/dist/src/generated/typus_perp/deps/sui/object_table.d.ts +0 -19
  200. package/dist/src/generated/typus_perp/deps/sui/object_table.js +0 -59
  201. package/dist/src/generated/typus_perp/deps/sui/vec_set.d.ts +0 -18
  202. package/dist/src/generated/typus_perp/deps/sui/vec_set.js +0 -25
  203. package/dist/src/generated/typus_perp/deps/typus/keyed_big_vector.d.ts +0 -30
  204. package/dist/src/generated/typus_perp/deps/typus/keyed_big_vector.js +0 -67
  205. package/dist/src/generated/typus_perp/deps/typus/linked_object_table.d.ts +0 -32
  206. package/dist/src/generated/typus_perp/deps/typus/linked_object_table.js +0 -71
  207. package/dist/src/generated/typus_perp/deps/typus_framework/vault.d.ts +0 -23
  208. package/dist/src/generated/typus_perp/deps/typus_framework/vault.js +0 -61
  209. package/dist/src/generated/typus_perp/escrow.d.ts +0 -59
  210. package/dist/src/generated/typus_perp/escrow.js +0 -76
  211. package/dist/src/generated/typus_perp/lending.d.ts +0 -47
  212. package/dist/src/generated/typus_perp/lending.js +0 -50
  213. package/dist/src/generated/typus_perp/lp_pool.d.ts +0 -2327
  214. package/dist/src/generated/typus_perp/lp_pool.js +0 -1956
  215. package/dist/src/generated/typus_perp/math.d.ts +0 -95
  216. package/dist/src/generated/typus_perp/math.js +0 -97
  217. package/dist/src/generated/typus_perp/position.d.ts +0 -234
  218. package/dist/src/generated/typus_perp/position.js +0 -204
  219. package/dist/src/generated/typus_perp/symbol.d.ts +0 -18
  220. package/dist/src/generated/typus_perp/symbol.js +0 -55
  221. package/dist/src/generated/typus_perp/tlp.d.ts +0 -13
  222. package/dist/src/generated/typus_perp/tlp.js +0 -56
  223. package/dist/src/generated/typus_perp/trading.d.ts +0 -2486
  224. package/dist/src/generated/typus_perp/trading.js +0 -2476
  225. package/dist/src/generated/typus_perp/treasury_caps.d.ts +0 -13
  226. package/dist/src/generated/typus_perp/user_account.d.ts +0 -40
  227. package/dist/src/generated/typus_perp/user_account.js +0 -72
  228. package/dist/src/generated/typus_stake_pool/admin.d.ts +0 -234
  229. package/dist/src/generated/typus_stake_pool/admin.js +0 -272
  230. package/dist/src/generated/typus_stake_pool/deps/std/type_name.d.ts +0 -17
  231. package/dist/src/generated/typus_stake_pool/deps/std/type_name.js +0 -25
  232. package/dist/src/generated/typus_stake_pool/deps/sui/object.d.ts +0 -8
  233. package/dist/src/generated/typus_stake_pool/deps/sui/object.js +0 -16
  234. package/dist/src/generated/typus_stake_pool/deps/sui/vec_map.d.ts +0 -30
  235. package/dist/src/generated/typus_stake_pool/deps/sui/vec_map.js +0 -37
  236. package/dist/src/generated/typus_stake_pool/deps/sui/vec_set.d.ts +0 -18
  237. package/dist/src/generated/typus_stake_pool/deps/sui/vec_set.js +0 -25
  238. package/dist/src/generated/typus_stake_pool/stake_pool.d.ts +0 -986
  239. package/dist/src/generated/typus_stake_pool/stake_pool.js +0 -874
  240. package/dist/src/generated/utils/index.d.ts +0 -11
  241. package/dist/src/generated/utils/index.js +0 -135
  242. package/dist/src/grpc/graphql.d.ts +0 -26
  243. package/dist/src/grpc/graphql.js +0 -126
  244. package/dist/src/grpc/grpc.d.ts +0 -1
  245. package/dist/src/grpc/grpc.js +0 -38
  246. package/dist/src/grpc/ledgerService.js +0 -64
  247. package/dist/src/grpc/liveDataService.d.ts +0 -0
  248. package/dist/src/grpc/liveDataService.js +0 -49
  249. /package/dist/src/{grpc/ledgerService.d.ts → pyth.d.ts} +0 -0
@@ -1,9 +1,8 @@
1
- import { Position, TradingOrder } from "../../src/generated/typus_perp/position";
1
+ import { Position, TradingOrder } from "../typus_perp/position/structs";
2
+ import { PythClient, TypusConfig } from "@typus/typus-sdk/dist/src/utils";
2
3
  import { TOKEN } from "@typus/typus-sdk/dist/src/constants";
3
4
  import { Transaction } from "@mysten/sui/transactions";
4
- import { TypusClient } from "../../src/client";
5
- export declare function createTradingOrder(client: TypusClient, tx: Transaction, input: {
6
- perpIndex: string;
5
+ export declare function createTradingOrder(config: TypusConfig, tx: Transaction, pythClient: PythClient, input: {
7
6
  coins: string[];
8
7
  cToken: TOKEN;
9
8
  amount: string;
@@ -17,26 +16,22 @@ export declare function createTradingOrder(client: TypusClient, tx: Transaction,
17
16
  suiCoins?: string[];
18
17
  }): Promise<Transaction>;
19
18
  export declare function zeroCoin(tx: Transaction, typeArgs: [string]): import("@mysten/sui/transactions").TransactionResult;
20
- export declare function cancelTradingOrder(client: TypusClient, tx: Transaction, input: {
21
- perpIndex: string;
22
- order: typeof TradingOrder.$inferType;
19
+ export declare function cancelTradingOrder(config: TypusConfig, tx: Transaction, input: {
20
+ order: TradingOrder;
23
21
  user: string;
24
22
  }): Promise<Transaction>;
25
- export declare function increaseCollateral(client: TypusClient, tx: Transaction, input: {
26
- perpIndex: string;
23
+ export declare function increaseCollateral(config: TypusConfig, tx: Transaction, pythClient: PythClient, input: {
27
24
  coins: string[];
28
25
  amount: string;
29
- position: typeof Position.$inferType;
26
+ position: Position;
30
27
  suiCoins?: string[];
31
28
  }): Promise<Transaction>;
32
- export declare function releaseCollateral(client: TypusClient, tx: Transaction, input: {
33
- perpIndex: string;
34
- position: typeof Position.$inferType;
29
+ export declare function releaseCollateral(config: TypusConfig, tx: Transaction, pythClient: PythClient, input: {
30
+ position: Position;
35
31
  amount: string;
36
32
  suiCoins?: string[];
37
33
  }): Promise<Transaction>;
38
- export declare function collectPositionFundingFee(client: TypusClient, tx: Transaction, input: {
39
- perpIndex: string;
40
- position: typeof Position.$inferType;
34
+ export declare function collectPositionFundingFee(config: TypusConfig, tx: Transaction, pythClient: PythClient, input: {
35
+ position: Position;
41
36
  suiCoins?: string[];
42
37
  }): Promise<Transaction>;
@@ -1,4 +1,67 @@
1
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 __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
13
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ var __read = (this && this.__read) || function (o, n) {
39
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
40
+ if (!m) return o;
41
+ var i = m.call(o), r, ar = [], e;
42
+ try {
43
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
44
+ }
45
+ catch (error) { e = { error: error }; }
46
+ finally {
47
+ try {
48
+ if (r && !r.done && (m = i["return"])) m.call(i);
49
+ }
50
+ finally { if (e) throw e.error; }
51
+ }
52
+ return ar;
53
+ };
54
+ var __values = (this && this.__values) || function(o) {
55
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
56
+ if (m) return m.call(o);
57
+ if (o && typeof o.length === "number") return {
58
+ next: function () {
59
+ if (o && i >= o.length) o = void 0;
60
+ return { value: o && o[i++], done: !o };
61
+ }
62
+ };
63
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
64
+ };
2
65
  Object.defineProperty(exports, "__esModule", { value: true });
3
66
  exports.createTradingOrder = createTradingOrder;
4
67
  exports.zeroCoin = zeroCoin;
@@ -6,185 +69,253 @@ exports.cancelTradingOrder = cancelTradingOrder;
6
69
  exports.increaseCollateral = increaseCollateral;
7
70
  exports.releaseCollateral = releaseCollateral;
8
71
  exports.collectPositionFundingFee = collectPositionFundingFee;
9
- const trading_1 = require("../../src/generated/typus_perp/trading");
10
- const __1 = require("..");
11
- const utils_1 = require("@typus/typus-sdk/dist/src/utils");
12
- const constants_1 = require("@typus/typus-sdk/dist/src/constants");
13
- async function createTradingOrder(client, tx, input) {
14
- // INPUTS
15
- let TOKEN = input.cToken;
16
- let BASE_TOKEN = input.tradingToken;
17
- let tokens = Array.from(new Set([TOKEN, BASE_TOKEN]));
18
- let cToken = constants_1.tokenType[__1.NETWORK][TOKEN];
19
- let baseToken = constants_1.tokenType[__1.NETWORK][BASE_TOKEN];
20
- let coin;
21
- let suiCoin;
22
- if (TOKEN == "SUI" && client.config.sponsored) {
23
- // split together
24
- [coin, suiCoin] = (0, utils_1.splitCoins)(tx, constants_1.tokenType.MAINNET.SUI, input.coins, [input.amount, tokens.length.toString()], client.config.sponsored);
25
- }
26
- else if (client.config.sponsored) {
27
- coin = (0, utils_1.splitCoin)(tx, cToken, input.coins, input.amount, client.config.sponsored);
28
- suiCoin = (0, utils_1.splitCoin)(tx, constants_1.tokenType.MAINNET.SUI, input.suiCoins, tokens.length.toString(), client.config.sponsored);
29
- }
30
- else {
31
- coin = (0, utils_1.splitCoin)(tx, cToken, input.coins, input.amount, client.config.sponsored);
32
- // no suiCoin
33
- }
34
- await (0, utils_1.updatePyth)(client.pythClient, tx, tokens, suiCoin);
35
- for (let token of tokens) {
36
- (0, utils_1.updateOracleWithPythUsd)(client.pythClient, tx, client.config.package.oracle, token);
37
- }
38
- tx.add((0, trading_1.createTradingOrderV2)({
39
- arguments: {
40
- version: __1.PERP_VERSION,
41
- registry: __1.MARKET,
42
- poolRegistry: __1.LP_POOL,
43
- marketIndex: BigInt(input.perpIndex),
44
- poolIndex: BigInt(input.perpIndex),
45
- typusOracleCToken: constants_1.oracle[__1.NETWORK][TOKEN],
46
- typusOracleTradingSymbol: constants_1.oracle[__1.NETWORK][BASE_TOKEN],
47
- typusEcosystemVersion: client.config.version.typus,
48
- typusUserRegistry: client.config.registry.typus.user,
49
- typusLeaderboardRegistry: client.config.registry.typus.leaderboard,
50
- collateral: coin,
51
- size: BigInt(input.size),
52
- triggerPrice: BigInt(input.triggerPrice),
53
- isLong: input.isLong,
54
- isStopOrder: input.isStopOrder,
55
- reduceOnly: input.reduceOnly,
56
- linkedPositionId: input.linkedPositionId ? BigInt(input.linkedPositionId) : null,
57
- tailsStakingRegistry: client.config.registry.typus.tailsStaking,
58
- competitionConfig: __1.COMPETITION_CONFIG,
59
- },
60
- typeArguments: [cToken, baseToken],
61
- }));
62
- return tx;
72
+ var functions_1 = require("../typus_perp/trading/functions");
73
+ var __1 = require("..");
74
+ var utils_1 = require("@typus/typus-sdk/dist/src/utils");
75
+ var constants_1 = require("@typus/typus-sdk/dist/src/constants");
76
+ function createTradingOrder(config, tx, pythClient, input) {
77
+ return __awaiter(this, void 0, void 0, function () {
78
+ var TOKEN, BASE_TOKEN, tokens, cToken, baseToken, coin, suiCoin, tokens_1, tokens_1_1, token;
79
+ var _a, e_1, _b;
80
+ return __generator(this, function (_c) {
81
+ switch (_c.label) {
82
+ case 0:
83
+ TOKEN = input.cToken;
84
+ BASE_TOKEN = input.tradingToken;
85
+ tokens = Array.from(new Set([TOKEN, BASE_TOKEN]));
86
+ cToken = constants_1.tokenType[__1.NETWORK][TOKEN];
87
+ baseToken = constants_1.tokenType[__1.NETWORK][BASE_TOKEN];
88
+ if (TOKEN == "SUI" && config.sponsored) {
89
+ // split together
90
+ _a = __read((0, utils_1.splitCoins)(tx, constants_1.tokenType.MAINNET.SUI, input.coins, [input.amount, tokens.length.toString()], config.sponsored), 2), coin = _a[0], suiCoin = _a[1];
91
+ }
92
+ else if (config.sponsored) {
93
+ coin = (0, utils_1.splitCoin)(tx, cToken, input.coins, input.amount, config.sponsored);
94
+ suiCoin = (0, utils_1.splitCoin)(tx, constants_1.tokenType.MAINNET.SUI, input.suiCoins, tokens.length.toString(), config.sponsored);
95
+ }
96
+ else {
97
+ coin = (0, utils_1.splitCoin)(tx, cToken, input.coins, input.amount, config.sponsored);
98
+ // no suiCoin
99
+ }
100
+ return [4 /*yield*/, (0, utils_1.updatePyth)(pythClient, tx, tokens, suiCoin)];
101
+ case 1:
102
+ _c.sent();
103
+ try {
104
+ for (tokens_1 = __values(tokens), tokens_1_1 = tokens_1.next(); !tokens_1_1.done; tokens_1_1 = tokens_1.next()) {
105
+ token = tokens_1_1.value;
106
+ (0, utils_1.updateOracleWithPythUsd)(pythClient, tx, config.package.oracle, token);
107
+ }
108
+ }
109
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
110
+ finally {
111
+ try {
112
+ if (tokens_1_1 && !tokens_1_1.done && (_b = tokens_1.return)) _b.call(tokens_1);
113
+ }
114
+ finally { if (e_1) throw e_1.error; }
115
+ }
116
+ (0, functions_1.createTradingOrderV2)(tx, [cToken, baseToken], {
117
+ version: __1.PERP_VERSION,
118
+ registry: __1.MARKET,
119
+ poolRegistry: __1.LP_POOL,
120
+ marketIndex: BigInt(0),
121
+ poolIndex: BigInt(0),
122
+ typusOracleCToken: constants_1.oracle[__1.NETWORK][TOKEN],
123
+ typusOracleTradingSymbol: constants_1.oracle[__1.NETWORK][BASE_TOKEN],
124
+ clock: constants_1.CLOCK,
125
+ typusEcosystemVersion: config.version.typus,
126
+ typusUserRegistry: config.registry.typus.user,
127
+ typusLeaderboardRegistry: config.registry.typus.leaderboard,
128
+ collateral: coin,
129
+ size: BigInt(input.size),
130
+ triggerPrice: BigInt(input.triggerPrice),
131
+ isLong: input.isLong,
132
+ isStopOrder: input.isStopOrder,
133
+ reduceOnly: input.reduceOnly,
134
+ linkedPositionId: input.linkedPositionId ? BigInt(input.linkedPositionId) : null,
135
+ tailsStakingRegistry: config.registry.typus.tailsStaking,
136
+ competitionConfig: __1.COMPETITION_CONFIG,
137
+ });
138
+ return [2 /*return*/, tx];
139
+ }
140
+ });
141
+ });
63
142
  }
64
143
  function zeroCoin(tx, typeArgs) {
65
144
  return tx.moveCall({
66
- target: `0x2::coin::zero`,
145
+ target: "0x2::coin::zero",
67
146
  typeArguments: typeArgs,
68
147
  arguments: [],
69
148
  });
70
149
  }
71
- async function cancelTradingOrder(client, tx, input) {
72
- let cToken = "0x" + input.order.collateral_token.name;
73
- let BASE_TOKEN = "0x" + input.order.symbol.base_token.name;
74
- let coin = tx.add((0, trading_1.cancelTradingOrder)({
75
- arguments: {
76
- version: __1.PERP_VERSION,
77
- registry: __1.MARKET,
78
- marketIndex: BigInt(input.perpIndex),
79
- orderId: BigInt(input.order.order_id),
80
- triggerPrice: BigInt(input.order.trigger_price),
81
- orderUser: null,
82
- },
83
- typeArguments: [cToken, BASE_TOKEN],
84
- }));
85
- tx.transferObjects([coin], input.user);
86
- return tx;
150
+ function cancelTradingOrder(config, tx, input) {
151
+ return __awaiter(this, void 0, void 0, function () {
152
+ var cToken, BASE_TOKEN, coin;
153
+ return __generator(this, function (_a) {
154
+ cToken = "0x" + input.order.collateralToken.name;
155
+ BASE_TOKEN = "0x" + input.order.symbol.baseToken.name;
156
+ coin = (0, functions_1.cancelTradingOrder)(tx, [cToken, BASE_TOKEN], {
157
+ version: __1.PERP_VERSION,
158
+ registry: __1.MARKET,
159
+ marketIndex: BigInt(0),
160
+ orderId: input.order.orderId,
161
+ triggerPrice: input.order.triggerPrice,
162
+ orderUser: null,
163
+ });
164
+ tx.transferObjects([coin], input.user);
165
+ return [2 /*return*/, tx];
166
+ });
167
+ });
87
168
  }
88
- async function increaseCollateral(client, tx, input) {
89
- // parse from Position
90
- let TOKEN = (0, constants_1.typeArgToAsset)(input.position.collateral_token.name);
91
- let BASE_TOKEN = (0, constants_1.typeArgToAsset)(input.position.symbol.base_token.name);
92
- let tokens = Array.from(new Set([TOKEN, BASE_TOKEN]));
93
- let cToken = constants_1.tokenType[__1.NETWORK][TOKEN];
94
- let baseToken = constants_1.tokenType[__1.NETWORK][BASE_TOKEN];
95
- let coin;
96
- let suiCoin;
97
- if (TOKEN == "SUI" && client.config.sponsored) {
98
- // split together
99
- [coin, suiCoin] = (0, utils_1.splitCoins)(tx, constants_1.tokenType.MAINNET.SUI, input.coins, [input.amount, tokens.length.toString()], client.config.sponsored);
100
- }
101
- else if (client.config.sponsored) {
102
- coin = (0, utils_1.splitCoin)(tx, cToken, input.coins, input.amount, client.config.sponsored);
103
- suiCoin = (0, utils_1.splitCoin)(tx, constants_1.tokenType.MAINNET.SUI, input.suiCoins, tokens.length.toString(), client.config.sponsored);
104
- }
105
- else {
106
- coin = (0, utils_1.splitCoin)(tx, cToken, input.coins, input.amount, client.config.sponsored);
107
- // no suiCoin
108
- }
109
- await (0, utils_1.updatePyth)(client.pythClient, tx, tokens, suiCoin);
110
- for (let token of tokens) {
111
- (0, utils_1.updateOracleWithPythUsd)(client.pythClient, tx, client.config.package.oracle, token);
112
- }
113
- tx.add((0, trading_1.increaseCollateral)({
114
- arguments: {
115
- version: __1.PERP_VERSION,
116
- registry: __1.MARKET,
117
- poolRegistry: __1.LP_POOL,
118
- marketIndex: BigInt(input.perpIndex),
119
- poolIndex: BigInt(input.perpIndex),
120
- typusOracleCToken: constants_1.oracle[__1.NETWORK][TOKEN],
121
- typusOracleTradingSymbol: constants_1.oracle[__1.NETWORK][BASE_TOKEN],
122
- positionId: BigInt(input.position.position_id),
123
- collateral: coin,
124
- },
125
- typeArguments: [cToken, baseToken],
126
- }));
127
- return tx;
169
+ function increaseCollateral(config, tx, pythClient, input) {
170
+ return __awaiter(this, void 0, void 0, function () {
171
+ var TOKEN, BASE_TOKEN, tokens, cToken, baseToken, coin, suiCoin, tokens_2, tokens_2_1, token;
172
+ var _a, e_2, _b;
173
+ return __generator(this, function (_c) {
174
+ switch (_c.label) {
175
+ case 0:
176
+ TOKEN = (0, constants_1.typeArgToAsset)(input.position.collateralToken.name);
177
+ BASE_TOKEN = (0, constants_1.typeArgToAsset)(input.position.symbol.baseToken.name);
178
+ tokens = Array.from(new Set([TOKEN, BASE_TOKEN]));
179
+ cToken = constants_1.tokenType[__1.NETWORK][TOKEN];
180
+ baseToken = constants_1.tokenType[__1.NETWORK][BASE_TOKEN];
181
+ if (TOKEN == "SUI" && config.sponsored) {
182
+ // split together
183
+ _a = __read((0, utils_1.splitCoins)(tx, constants_1.tokenType.MAINNET.SUI, input.coins, [input.amount, tokens.length.toString()], config.sponsored), 2), coin = _a[0], suiCoin = _a[1];
184
+ }
185
+ else if (config.sponsored) {
186
+ coin = (0, utils_1.splitCoin)(tx, cToken, input.coins, input.amount, config.sponsored);
187
+ suiCoin = (0, utils_1.splitCoin)(tx, constants_1.tokenType.MAINNET.SUI, input.suiCoins, tokens.length.toString(), config.sponsored);
188
+ }
189
+ else {
190
+ coin = (0, utils_1.splitCoin)(tx, cToken, input.coins, input.amount, config.sponsored);
191
+ // no suiCoin
192
+ }
193
+ return [4 /*yield*/, (0, utils_1.updatePyth)(pythClient, tx, tokens, suiCoin)];
194
+ case 1:
195
+ _c.sent();
196
+ try {
197
+ for (tokens_2 = __values(tokens), tokens_2_1 = tokens_2.next(); !tokens_2_1.done; tokens_2_1 = tokens_2.next()) {
198
+ token = tokens_2_1.value;
199
+ (0, utils_1.updateOracleWithPythUsd)(pythClient, tx, config.package.oracle, token);
200
+ }
201
+ }
202
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
203
+ finally {
204
+ try {
205
+ if (tokens_2_1 && !tokens_2_1.done && (_b = tokens_2.return)) _b.call(tokens_2);
206
+ }
207
+ finally { if (e_2) throw e_2.error; }
208
+ }
209
+ (0, functions_1.increaseCollateral)(tx, [cToken, baseToken], {
210
+ version: __1.PERP_VERSION,
211
+ registry: __1.MARKET,
212
+ poolRegistry: __1.LP_POOL,
213
+ marketIndex: BigInt(0),
214
+ poolIndex: BigInt(0),
215
+ typusOracleCToken: constants_1.oracle[__1.NETWORK][TOKEN],
216
+ typusOracleTradingSymbol: constants_1.oracle[__1.NETWORK][BASE_TOKEN],
217
+ clock: constants_1.CLOCK,
218
+ positionId: BigInt(input.position.positionId),
219
+ collateral: coin,
220
+ });
221
+ return [2 /*return*/, tx];
222
+ }
223
+ });
224
+ });
128
225
  }
129
- async function releaseCollateral(client, tx, input) {
130
- // parse from Position
131
- let TOKEN = (0, constants_1.typeArgToAsset)(input.position.collateral_token.name);
132
- let BASE_TOKEN = (0, constants_1.typeArgToAsset)(input.position.symbol.base_token.name);
133
- let tokens = Array.from(new Set([TOKEN, BASE_TOKEN]));
134
- let suiCoin;
135
- if (client.config.sponsored) {
136
- suiCoin = (0, utils_1.splitCoin)(tx, constants_1.tokenType.MAINNET.SUI, input.suiCoins, tokens.length.toString(), client.config.sponsored);
137
- }
138
- await (0, utils_1.updatePyth)(client.pythClient, tx, tokens, suiCoin);
139
- for (let token of tokens) {
140
- (0, utils_1.updateOracleWithPythUsd)(client.pythClient, tx, client.config.package.oracle, token);
141
- }
142
- let cToken = constants_1.tokenType[__1.NETWORK][TOKEN];
143
- let baseToken = constants_1.tokenType[__1.NETWORK][BASE_TOKEN];
144
- let coin = tx.add((0, trading_1.releaseCollateral)({
145
- arguments: {
146
- version: __1.PERP_VERSION,
147
- registry: __1.MARKET,
148
- poolRegistry: __1.LP_POOL,
149
- marketIndex: BigInt(input.perpIndex),
150
- poolIndex: BigInt(input.perpIndex),
151
- typusOracleCToken: constants_1.oracle[__1.NETWORK][TOKEN],
152
- typusOracleTradingSymbol: constants_1.oracle[__1.NETWORK][BASE_TOKEN],
153
- positionId: BigInt(input.position.position_id),
154
- releaseAmount: BigInt(input.amount),
155
- },
156
- typeArguments: [cToken, baseToken],
157
- }));
158
- tx.transferObjects([coin], input.position.user);
159
- return tx;
226
+ function releaseCollateral(config, tx, pythClient, input) {
227
+ return __awaiter(this, void 0, void 0, function () {
228
+ var TOKEN, BASE_TOKEN, tokens, suiCoin, tokens_3, tokens_3_1, token, cToken, baseToken, coin;
229
+ var e_3, _a;
230
+ return __generator(this, function (_b) {
231
+ switch (_b.label) {
232
+ case 0:
233
+ TOKEN = (0, constants_1.typeArgToAsset)(input.position.collateralToken.name);
234
+ BASE_TOKEN = (0, constants_1.typeArgToAsset)(input.position.symbol.baseToken.name);
235
+ tokens = Array.from(new Set([TOKEN, BASE_TOKEN]));
236
+ if (config.sponsored) {
237
+ suiCoin = (0, utils_1.splitCoin)(tx, constants_1.tokenType.MAINNET.SUI, input.suiCoins, tokens.length.toString(), config.sponsored);
238
+ }
239
+ return [4 /*yield*/, (0, utils_1.updatePyth)(pythClient, tx, tokens, suiCoin)];
240
+ case 1:
241
+ _b.sent();
242
+ try {
243
+ for (tokens_3 = __values(tokens), tokens_3_1 = tokens_3.next(); !tokens_3_1.done; tokens_3_1 = tokens_3.next()) {
244
+ token = tokens_3_1.value;
245
+ (0, utils_1.updateOracleWithPythUsd)(pythClient, tx, config.package.oracle, token);
246
+ }
247
+ }
248
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
249
+ finally {
250
+ try {
251
+ if (tokens_3_1 && !tokens_3_1.done && (_a = tokens_3.return)) _a.call(tokens_3);
252
+ }
253
+ finally { if (e_3) throw e_3.error; }
254
+ }
255
+ cToken = constants_1.tokenType[__1.NETWORK][TOKEN];
256
+ baseToken = constants_1.tokenType[__1.NETWORK][BASE_TOKEN];
257
+ coin = (0, functions_1.releaseCollateral)(tx, [cToken, baseToken], {
258
+ version: __1.PERP_VERSION,
259
+ registry: __1.MARKET,
260
+ poolRegistry: __1.LP_POOL,
261
+ marketIndex: BigInt(0),
262
+ poolIndex: BigInt(0),
263
+ typusOracleCToken: constants_1.oracle[__1.NETWORK][TOKEN],
264
+ typusOracleTradingSymbol: constants_1.oracle[__1.NETWORK][BASE_TOKEN],
265
+ clock: constants_1.CLOCK,
266
+ positionId: BigInt(input.position.positionId),
267
+ releaseAmount: BigInt(input.amount),
268
+ });
269
+ tx.transferObjects([coin], input.position.user);
270
+ return [2 /*return*/, tx];
271
+ }
272
+ });
273
+ });
160
274
  }
161
- async function collectPositionFundingFee(client, tx, input) {
162
- // parse from Position
163
- let TOKEN = (0, constants_1.typeArgToAsset)(input.position.collateral_token.name);
164
- let BASE_TOKEN = (0, constants_1.typeArgToAsset)(input.position.symbol.base_token.name);
165
- let tokens = Array.from(new Set([TOKEN, BASE_TOKEN]));
166
- let suiCoin;
167
- if (client.config.sponsored) {
168
- suiCoin = (0, utils_1.splitCoin)(tx, constants_1.tokenType.MAINNET.SUI, input.suiCoins, tokens.length.toString(), client.config.sponsored);
169
- }
170
- await (0, utils_1.updatePyth)(client.pythClient, tx, tokens, suiCoin);
171
- for (let token of tokens) {
172
- (0, utils_1.updateOracleWithPythUsd)(client.pythClient, tx, client.config.package.oracle, token);
173
- }
174
- let cToken = constants_1.tokenType[__1.NETWORK][TOKEN];
175
- let baseToken = constants_1.tokenType[__1.NETWORK][BASE_TOKEN];
176
- tx.add((0, trading_1.collectPositionFundingFee)({
177
- arguments: {
178
- version: __1.PERP_VERSION,
179
- registry: __1.MARKET,
180
- poolRegistry: __1.LP_POOL,
181
- marketIndex: BigInt(input.perpIndex),
182
- poolIndex: BigInt(input.perpIndex),
183
- typusOracleCToken: constants_1.oracle[__1.NETWORK][TOKEN],
184
- typusOracleTradingSymbol: constants_1.oracle[__1.NETWORK][BASE_TOKEN],
185
- positionId: BigInt(input.position.position_id),
186
- },
187
- typeArguments: [cToken, baseToken],
188
- }));
189
- return tx;
275
+ function collectPositionFundingFee(config, tx, pythClient, input) {
276
+ return __awaiter(this, void 0, void 0, function () {
277
+ var TOKEN, BASE_TOKEN, tokens, suiCoin, tokens_4, tokens_4_1, token, cToken, baseToken;
278
+ var e_4, _a;
279
+ return __generator(this, function (_b) {
280
+ switch (_b.label) {
281
+ case 0:
282
+ TOKEN = (0, constants_1.typeArgToAsset)(input.position.collateralToken.name);
283
+ BASE_TOKEN = (0, constants_1.typeArgToAsset)(input.position.symbol.baseToken.name);
284
+ tokens = Array.from(new Set([TOKEN, BASE_TOKEN]));
285
+ if (config.sponsored) {
286
+ suiCoin = (0, utils_1.splitCoin)(tx, constants_1.tokenType.MAINNET.SUI, input.suiCoins, tokens.length.toString(), config.sponsored);
287
+ }
288
+ return [4 /*yield*/, (0, utils_1.updatePyth)(pythClient, tx, tokens, suiCoin)];
289
+ case 1:
290
+ _b.sent();
291
+ try {
292
+ for (tokens_4 = __values(tokens), tokens_4_1 = tokens_4.next(); !tokens_4_1.done; tokens_4_1 = tokens_4.next()) {
293
+ token = tokens_4_1.value;
294
+ (0, utils_1.updateOracleWithPythUsd)(pythClient, tx, config.package.oracle, token);
295
+ }
296
+ }
297
+ catch (e_4_1) { e_4 = { error: e_4_1 }; }
298
+ finally {
299
+ try {
300
+ if (tokens_4_1 && !tokens_4_1.done && (_a = tokens_4.return)) _a.call(tokens_4);
301
+ }
302
+ finally { if (e_4) throw e_4.error; }
303
+ }
304
+ cToken = constants_1.tokenType[__1.NETWORK][TOKEN];
305
+ baseToken = constants_1.tokenType[__1.NETWORK][BASE_TOKEN];
306
+ (0, functions_1.collectPositionFundingFee)(tx, [cToken, baseToken], {
307
+ version: __1.PERP_VERSION,
308
+ registry: __1.MARKET,
309
+ poolRegistry: __1.LP_POOL,
310
+ marketIndex: BigInt(0),
311
+ poolIndex: BigInt(0),
312
+ typusOracleCToken: constants_1.oracle[__1.NETWORK][TOKEN],
313
+ typusOracleTradingSymbol: constants_1.oracle[__1.NETWORK][BASE_TOKEN],
314
+ clock: constants_1.CLOCK,
315
+ positionId: BigInt(input.position.positionId),
316
+ });
317
+ return [2 /*return*/, tx];
318
+ }
319
+ });
320
+ });
190
321
  }
@@ -1,19 +1,19 @@
1
1
  import { Transaction } from "@mysten/sui/transactions";
2
+ import { PythClient, TypusConfig } from "@typus/typus-sdk/dist/src/utils";
2
3
  import { TOKEN } from "@typus/typus-sdk/dist/src/constants";
3
- import { TypusClient } from "../../src/client";
4
- export declare function createTradingOrderWithBidReceiptByAutoBid(client: TypusClient, tx: Transaction, input: {
4
+ export declare function createTradingOrderWithBidReceiptByAutoBid(config: TypusConfig, tx: Transaction, pythClient: PythClient, input: {
5
5
  cToken: TOKEN;
6
6
  tradingToken: TOKEN;
7
7
  isLong: boolean;
8
8
  user: string;
9
- dovIndex: string;
9
+ index: string;
10
10
  bToken: TOKEN;
11
11
  signalIndex: string;
12
12
  strategyIndex: string;
13
+ share?: string;
13
14
  suiCoins?: string[];
14
- perpIndex?: number;
15
15
  }): Promise<Transaction>;
16
- export declare function createTradingOrderWithBidReceipt(client: TypusClient, tx: Transaction, input: {
16
+ export declare function createTradingOrderWithBidReceipt(config: TypusConfig, tx: Transaction, pythClient: PythClient, input: {
17
17
  cToken: TOKEN;
18
18
  tradingToken: TOKEN;
19
19
  isLong: boolean;
@@ -23,14 +23,12 @@ export declare function createTradingOrderWithBidReceipt(client: TypusClient, tx
23
23
  bidReceipts: string[];
24
24
  share?: string;
25
25
  suiCoins?: string[];
26
- perpIndex?: number;
27
26
  }): Promise<Transaction>;
28
- export declare function reduceOptionCollateralPositionSize(client: TypusClient, tx: Transaction, input: {
27
+ export declare function reduceOptionCollateralPositionSize(config: TypusConfig, tx: Transaction, pythClient: PythClient, input: {
29
28
  cToken: TOKEN;
30
29
  tradingToken: TOKEN;
31
30
  bToken: string;
32
31
  positionId: string;
33
32
  orderSize: string | null;
34
33
  suiCoins?: string[];
35
- perpIndex?: number;
36
34
  }): Promise<Transaction>;