@typus/typus-perp-sdk 1.1.32-type-test → 1.1.33

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 (253) hide show
  1. package/dist/src/api/sentio.d.ts +5 -5
  2. package/dist/src/api/sentio.js +690 -541
  3. package/dist/src/client.d.ts +28 -0
  4. package/dist/src/client.js +171 -0
  5. package/dist/src/fetch.d.ts +554 -36
  6. package/dist/src/fetch.js +545 -661
  7. package/dist/src/generated/typus_perp/admin.d.ts +274 -0
  8. package/dist/src/generated/typus_perp/admin.js +321 -0
  9. package/dist/src/generated/typus_perp/competition.d.ts +60 -0
  10. package/dist/src/generated/typus_perp/competition.js +104 -0
  11. package/dist/src/generated/typus_perp/deps/std/type_name.d.ts +17 -0
  12. package/dist/src/generated/typus_perp/deps/std/type_name.js +25 -0
  13. package/dist/src/generated/typus_perp/deps/sui/balance.d.ts +12 -0
  14. package/dist/src/generated/typus_perp/deps/sui/balance.js +20 -0
  15. package/dist/src/generated/typus_perp/deps/sui/object.d.ts +8 -0
  16. package/dist/src/generated/typus_perp/deps/sui/object.js +16 -0
  17. package/dist/src/generated/typus_perp/deps/sui/object_table.d.ts +19 -0
  18. package/dist/src/generated/typus_perp/deps/sui/object_table.js +59 -0
  19. package/dist/src/generated/typus_perp/deps/sui/table.d.ts +31 -0
  20. package/dist/src/generated/typus_perp/deps/sui/table.js +71 -0
  21. package/dist/src/generated/typus_perp/deps/sui/vec_set.d.ts +18 -0
  22. package/dist/src/generated/typus_perp/deps/sui/vec_set.js +25 -0
  23. package/dist/src/generated/typus_perp/deps/typus/keyed_big_vector.d.ts +30 -0
  24. package/dist/src/generated/typus_perp/deps/typus/keyed_big_vector.js +67 -0
  25. package/dist/src/generated/typus_perp/deps/typus/linked_object_table.d.ts +32 -0
  26. package/dist/src/generated/typus_perp/deps/typus/linked_object_table.js +71 -0
  27. package/dist/src/generated/typus_perp/deps/typus_framework/vault.d.ts +15 -0
  28. package/dist/src/{_framework/init-loader.js → generated/typus_perp/deps/typus_framework/vault.js} +18 -10
  29. package/dist/src/generated/typus_perp/error.d.ts +443 -0
  30. package/dist/src/generated/typus_perp/error.js +788 -0
  31. package/dist/src/generated/typus_perp/escrow.d.ts +109 -0
  32. package/dist/src/generated/typus_perp/escrow.js +139 -0
  33. package/dist/src/generated/typus_perp/lp_pool.d.ts +1853 -0
  34. package/dist/src/generated/typus_perp/lp_pool.js +1483 -0
  35. package/dist/src/generated/typus_perp/math.d.ts +95 -0
  36. package/dist/src/generated/typus_perp/math.js +97 -0
  37. package/dist/src/generated/typus_perp/position.d.ts +1251 -0
  38. package/dist/src/generated/typus_perp/position.js +1393 -0
  39. package/dist/src/generated/typus_perp/profit_vault.d.ts +272 -0
  40. package/dist/src/generated/typus_perp/profit_vault.js +321 -0
  41. package/dist/src/generated/typus_perp/symbol.d.ts +47 -0
  42. package/dist/src/generated/typus_perp/symbol.js +97 -0
  43. package/dist/src/generated/typus_perp/trading.d.ts +2134 -0
  44. package/dist/src/generated/typus_perp/trading.js +2050 -0
  45. package/dist/src/generated/typus_perp/treasury_caps.d.ts +44 -0
  46. package/dist/src/generated/typus_perp/treasury_caps.js +92 -0
  47. package/dist/src/generated/typus_perp/user_account.d.ts +146 -0
  48. package/dist/src/generated/typus_perp/user_account.js +221 -0
  49. package/dist/src/generated/typus_stake_pool/admin.d.ts +218 -0
  50. package/dist/src/generated/typus_stake_pool/admin.js +247 -0
  51. package/dist/src/generated/typus_stake_pool/deps/std/type_name.d.ts +17 -0
  52. package/dist/src/generated/typus_stake_pool/deps/std/type_name.js +25 -0
  53. package/dist/src/generated/typus_stake_pool/deps/sui/object.d.ts +8 -0
  54. package/dist/src/generated/typus_stake_pool/deps/sui/object.js +16 -0
  55. package/dist/src/generated/typus_stake_pool/deps/sui/vec_map.d.ts +30 -0
  56. package/dist/src/generated/typus_stake_pool/deps/sui/vec_map.js +37 -0
  57. package/dist/src/generated/typus_stake_pool/deps/sui/vec_set.d.ts +18 -0
  58. package/dist/src/generated/typus_stake_pool/deps/sui/vec_set.js +25 -0
  59. package/dist/src/generated/typus_stake_pool/stake_pool.d.ts +1038 -0
  60. package/dist/src/generated/typus_stake_pool/stake_pool.js +938 -0
  61. package/dist/src/generated/utils/index.d.ts +11 -0
  62. package/dist/src/generated/utils/index.js +138 -0
  63. package/dist/src/grpc/graphql.d.ts +26 -0
  64. package/dist/src/grpc/graphql.js +126 -0
  65. package/dist/src/grpc/grpc.d.ts +1 -0
  66. package/dist/src/grpc/grpc.js +38 -0
  67. package/dist/src/grpc/ledgerService.js +64 -0
  68. package/dist/src/grpc/liveDataService.d.ts +0 -0
  69. package/dist/src/grpc/liveDataService.js +49 -0
  70. package/dist/src/index.d.ts +2 -8
  71. package/dist/src/index.js +30 -56
  72. package/dist/src/user/history.d.ts +1 -1
  73. package/dist/src/user/history.js +649 -679
  74. package/dist/src/user/order.d.ts +21 -11
  75. package/dist/src/user/order.js +204 -301
  76. package/dist/src/user/orderWithBidReceipt.d.ts +17 -6
  77. package/dist/src/user/orderWithBidReceipt.js +164 -224
  78. package/dist/src/user/tlp.d.ts +25 -25
  79. package/dist/src/user/tlp.js +317 -468
  80. package/package.json +12 -3
  81. package/dist/src/_dependencies/source/0x1/ascii/structs.d.ts +0 -88
  82. package/dist/src/_dependencies/source/0x1/ascii/structs.js +0 -398
  83. package/dist/src/_dependencies/source/0x1/index.d.ts +0 -3
  84. package/dist/src/_dependencies/source/0x1/index.js +0 -6
  85. package/dist/src/_dependencies/source/0x1/option/structs.d.ts +0 -50
  86. package/dist/src/_dependencies/source/0x1/option/structs.js +0 -271
  87. package/dist/src/_dependencies/source/0x1/string/structs.d.ts +0 -48
  88. package/dist/src/_dependencies/source/0x1/string/structs.js +0 -256
  89. package/dist/src/_dependencies/source/0x1/type-name/structs.d.ts +0 -49
  90. package/dist/src/_dependencies/source/0x1/type-name/structs.js +0 -223
  91. package/dist/src/_dependencies/source/0x2/bag/structs.d.ts +0 -54
  92. package/dist/src/_dependencies/source/0x2/bag/structs.js +0 -229
  93. package/dist/src/_dependencies/source/0x2/balance/structs.d.ts +0 -84
  94. package/dist/src/_dependencies/source/0x2/balance/structs.js +0 -386
  95. package/dist/src/_dependencies/source/0x2/coin/structs.d.ts +0 -406
  96. package/dist/src/_dependencies/source/0x2/coin/structs.js +0 -1247
  97. package/dist/src/_dependencies/source/0x2/index.d.ts +0 -3
  98. package/dist/src/_dependencies/source/0x2/index.js +0 -6
  99. package/dist/src/_dependencies/source/0x2/linked-table/structs.d.ts +0 -132
  100. package/dist/src/_dependencies/source/0x2/linked-table/structs.js +0 -438
  101. package/dist/src/_dependencies/source/0x2/object/structs.d.ts +0 -86
  102. package/dist/src/_dependencies/source/0x2/object/structs.js +0 -364
  103. package/dist/src/_dependencies/source/0x2/object-table/structs.d.ts +0 -54
  104. package/dist/src/_dependencies/source/0x2/object-table/structs.js +0 -248
  105. package/dist/src/_dependencies/source/0x2/sui/structs.d.ts +0 -44
  106. package/dist/src/_dependencies/source/0x2/sui/structs.js +0 -222
  107. package/dist/src/_dependencies/source/0x2/table/structs.d.ts +0 -54
  108. package/dist/src/_dependencies/source/0x2/table/structs.js +0 -248
  109. package/dist/src/_dependencies/source/0x2/table-vec/structs.d.ts +0 -59
  110. package/dist/src/_dependencies/source/0x2/table-vec/structs.js +0 -274
  111. package/dist/src/_dependencies/source/0x2/token/structs.d.ts +0 -421
  112. package/dist/src/_dependencies/source/0x2/token/structs.js +0 -1095
  113. package/dist/src/_dependencies/source/0x2/transfer-policy/structs.d.ts +0 -348
  114. package/dist/src/_dependencies/source/0x2/transfer-policy/structs.js +0 -1091
  115. package/dist/src/_dependencies/source/0x2/url/structs.d.ts +0 -49
  116. package/dist/src/_dependencies/source/0x2/url/structs.js +0 -223
  117. package/dist/src/_dependencies/source/0x2/vec-map/structs.d.ts +0 -106
  118. package/dist/src/_dependencies/source/0x2/vec-map/structs.js +0 -446
  119. package/dist/src/_dependencies/source/0x2/vec-set/structs.d.ts +0 -49
  120. package/dist/src/_dependencies/source/0x2/vec-set/structs.js +0 -270
  121. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/airdrop/structs.d.ts +0 -422
  122. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/airdrop/structs.js +0 -1084
  123. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/big-vector/structs.d.ts +0 -130
  124. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/big-vector/structs.js +0 -456
  125. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/critbit/structs.d.ts +0 -208
  126. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/critbit/structs.js +0 -653
  127. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/ecosystem/structs.d.ts +0 -362
  128. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/ecosystem/structs.js +0 -899
  129. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/index.d.ts +0 -8
  130. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/index.js +0 -11
  131. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/init.d.ts +0 -2
  132. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/init.js +0 -102
  133. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/keyed-big-vector/structs.d.ts +0 -202
  134. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/keyed-big-vector/structs.js +0 -632
  135. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/leaderboard/structs.d.ts +0 -600
  136. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/leaderboard/structs.js +0 -1459
  137. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/linked-object-table/structs.d.ts +0 -136
  138. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/linked-object-table/structs.js +0 -438
  139. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/linked-set/structs.d.ts +0 -127
  140. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/linked-set/structs.js +0 -430
  141. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/tails-staking/structs.d.ts +0 -957
  142. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/tails-staking/structs.js +0 -2261
  143. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/tgld/structs.d.ts +0 -244
  144. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/tgld/structs.js +0 -733
  145. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/user/structs.d.ts +0 -294
  146. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/user/structs.js +0 -892
  147. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/authority/structs.d.ts +0 -73
  148. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/authority/structs.js +0 -263
  149. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/balance-pool/structs.d.ts +0 -294
  150. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/balance-pool/structs.js +0 -591
  151. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/big-vector/structs.d.ts +0 -64
  152. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/big-vector/structs.js +0 -258
  153. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/dutch/structs.d.ts +0 -756
  154. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/dutch/structs.js +0 -1721
  155. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/i64/structs.d.ts +0 -44
  156. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/i64/structs.js +0 -222
  157. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/index.d.ts +0 -3
  158. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/index.js +0 -6
  159. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/init.d.ts +0 -2
  160. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/init.js +0 -89
  161. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/linked-list/structs.d.ts +0 -135
  162. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/linked-list/structs.js +0 -444
  163. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/vault/structs.d.ts +0 -2106
  164. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/vault/structs.js +0 -4952
  165. package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/discount-mint/structs.d.ts +0 -390
  166. package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/discount-mint/structs.js +0 -844
  167. package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/index.d.ts +0 -6
  168. package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/index.js +0 -9
  169. package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/init.d.ts +0 -2
  170. package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/init.js +0 -69
  171. package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/royalty-rule/structs.d.ts +0 -89
  172. package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/royalty-rule/structs.js +0 -376
  173. package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/staking/structs.d.ts +0 -386
  174. package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/staking/structs.js +0 -881
  175. package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/table-vec/structs.d.ts +0 -59
  176. package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/table-vec/structs.js +0 -274
  177. package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/typus-nft/structs.d.ts +0 -974
  178. package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/typus-nft/structs.js +0 -2387
  179. package/dist/src/_framework/init-loader.d.ts +0 -2
  180. package/dist/src/_framework/loader.d.ts +0 -17
  181. package/dist/src/_framework/loader.js +0 -108
  182. package/dist/src/_framework/reified.d.ts +0 -108
  183. package/dist/src/_framework/reified.js +0 -237
  184. package/dist/src/_framework/util.d.ts +0 -35
  185. package/dist/src/_framework/util.js +0 -396
  186. package/dist/src/_framework/vector.d.ts +0 -42
  187. package/dist/src/_framework/vector.js +0 -112
  188. package/dist/src/pyth.js +0 -1
  189. package/dist/src/typus_perp/admin/functions.d.ts +0 -59
  190. package/dist/src/typus_perp/admin/functions.js +0 -122
  191. package/dist/src/typus_perp/admin/structs.d.ts +0 -467
  192. package/dist/src/typus_perp/admin/structs.js +0 -1065
  193. package/dist/src/typus_perp/competition/functions.d.ts +0 -24
  194. package/dist/src/typus_perp/competition/functions.js +0 -38
  195. package/dist/src/typus_perp/competition/structs.d.ts +0 -80
  196. package/dist/src/typus_perp/competition/structs.js +0 -288
  197. package/dist/src/typus_perp/error/functions.d.ts +0 -73
  198. package/dist/src/typus_perp/error/functions.js +0 -363
  199. package/dist/src/typus_perp/escrow/functions.d.ts +0 -17
  200. package/dist/src/typus_perp/escrow/functions.js +0 -36
  201. package/dist/src/typus_perp/escrow/structs.d.ts +0 -160
  202. package/dist/src/typus_perp/escrow/structs.js +0 -324
  203. package/dist/src/typus_perp/index.d.ts +0 -1
  204. package/dist/src/typus_perp/index.js +0 -7
  205. package/dist/src/typus_perp/init.d.ts +0 -2
  206. package/dist/src/typus_perp/init.js +0 -118
  207. package/dist/src/typus_perp/lending/functions.d.ts +0 -15
  208. package/dist/src/typus_perp/lending/functions.js +0 -22
  209. package/dist/src/typus_perp/lp-pool/functions.d.ts +0 -460
  210. package/dist/src/typus_perp/lp-pool/functions.js +0 -732
  211. package/dist/src/typus_perp/lp-pool/structs.d.ts +0 -3705
  212. package/dist/src/typus_perp/lp-pool/structs.js +0 -6789
  213. package/dist/src/typus_perp/math/functions.d.ts +0 -29
  214. package/dist/src/typus_perp/math/functions.js +0 -61
  215. package/dist/src/typus_perp/position/functions.d.ts +0 -379
  216. package/dist/src/typus_perp/position/functions.js +0 -713
  217. package/dist/src/typus_perp/position/structs.d.ts +0 -905
  218. package/dist/src/typus_perp/position/structs.js +0 -1450
  219. package/dist/src/typus_perp/symbol/functions.d.ts +0 -9
  220. package/dist/src/typus_perp/symbol/functions.js +0 -24
  221. package/dist/src/typus_perp/symbol/structs.d.ts +0 -70
  222. package/dist/src/typus_perp/symbol/structs.js +0 -235
  223. package/dist/src/typus_perp/tlp/functions.d.ts +0 -19
  224. package/dist/src/typus_perp/tlp/functions.js +0 -40
  225. package/dist/src/typus_perp/tlp/structs.d.ts +0 -121
  226. package/dist/src/typus_perp/tlp/structs.js +0 -416
  227. package/dist/src/typus_perp/token-interface/functions.d.ts +0 -11
  228. package/dist/src/typus_perp/token-interface/functions.js +0 -22
  229. package/dist/src/typus_perp/trading/functions.d.ts +0 -812
  230. package/dist/src/typus_perp/trading/functions.js +0 -1218
  231. package/dist/src/typus_perp/trading/structs.d.ts +0 -3060
  232. package/dist/src/typus_perp/trading/structs.js +0 -5813
  233. package/dist/src/typus_perp/treasury-caps/functions.d.ts +0 -9
  234. package/dist/src/typus_perp/treasury-caps/functions.js +0 -36
  235. package/dist/src/typus_perp/treasury-caps/structs.d.ts +0 -49
  236. package/dist/src/typus_perp/treasury-caps/structs.js +0 -223
  237. package/dist/src/typus_perp/user-account/functions.d.ts +0 -36
  238. package/dist/src/typus_perp/user-account/functions.js +0 -70
  239. package/dist/src/typus_perp/user-account/structs.d.ts +0 -148
  240. package/dist/src/typus_perp/user-account/structs.js +0 -448
  241. package/dist/src/typus_stake_pool/admin/functions.d.ts +0 -49
  242. package/dist/src/typus_stake_pool/admin/functions.js +0 -105
  243. package/dist/src/typus_stake_pool/admin/structs.d.ts +0 -365
  244. package/dist/src/typus_stake_pool/admin/structs.js +0 -789
  245. package/dist/src/typus_stake_pool/index.d.ts +0 -1
  246. package/dist/src/typus_stake_pool/index.js +0 -7
  247. package/dist/src/typus_stake_pool/init.d.ts +0 -2
  248. package/dist/src/typus_stake_pool/init.js +0 -69
  249. package/dist/src/typus_stake_pool/stake-pool/functions.d.ts +0 -229
  250. package/dist/src/typus_stake_pool/stake-pool/functions.js +0 -380
  251. package/dist/src/typus_stake_pool/stake-pool/structs.d.ts +0 -2199
  252. package/dist/src/typus_stake_pool/stake-pool/structs.js +0 -4653
  253. /package/dist/src/{pyth.d.ts → grpc/ledgerService.d.ts} +0 -0
@@ -1,8 +1,15 @@
1
- import { Position, TradingOrder } from "../typus_perp/position/structs";
2
- import { PythClient, TypusConfig } from "@typus/typus-sdk/dist/src/utils";
1
+ import { Markets } from "../../src/generated/typus_perp/trading";
2
+ import { Position, TradingOrder } from "../../src/generated/typus_perp/position";
3
3
  import { TOKEN } from "@typus/typus-sdk/dist/src/constants";
4
4
  import { Transaction } from "@mysten/sui/transactions";
5
- export declare function createTradingOrder(config: TypusConfig, tx: Transaction, pythClient: PythClient, input: {
5
+ import { TypusClient } from "../../src/client";
6
+ export declare function findMarketIndex(client: TypusClient, input: {
7
+ markets: (typeof Markets.$inferType)[];
8
+ tradingToken: TOKEN;
9
+ }): number | undefined;
10
+ export declare function createTradingOrder(client: TypusClient, tx: Transaction, input: {
11
+ perpIndex: string;
12
+ poolIndex: string;
6
13
  coins: string[];
7
14
  cToken: TOKEN;
8
15
  amount: string;
@@ -16,22 +23,25 @@ export declare function createTradingOrder(config: TypusConfig, tx: Transaction,
16
23
  suiCoins?: string[];
17
24
  }): Promise<Transaction>;
18
25
  export declare function zeroCoin(tx: Transaction, typeArgs: [string]): import("@mysten/sui/transactions").TransactionResult;
19
- export declare function cancelTradingOrder(config: TypusConfig, tx: Transaction, input: {
20
- order: TradingOrder;
26
+ export declare function cancelTradingOrder(client: TypusClient, tx: Transaction, input: {
27
+ order: typeof TradingOrder.$inferType;
21
28
  user: string;
22
29
  }): Promise<Transaction>;
23
- export declare function increaseCollateral(config: TypusConfig, tx: Transaction, pythClient: PythClient, input: {
30
+ export declare function increaseCollateral(client: TypusClient, tx: Transaction, input: {
31
+ oracleContract?: string;
24
32
  coins: string[];
25
33
  amount: string;
26
- position: Position;
34
+ position: typeof Position.$inferType;
27
35
  suiCoins?: string[];
28
36
  }): Promise<Transaction>;
29
- export declare function releaseCollateral(config: TypusConfig, tx: Transaction, pythClient: PythClient, input: {
30
- position: Position;
37
+ export declare function releaseCollateral(client: TypusClient, tx: Transaction, input: {
38
+ oracleContract?: string;
39
+ position: typeof Position.$inferType;
31
40
  amount: string;
32
41
  suiCoins?: string[];
33
42
  }): Promise<Transaction>;
34
- export declare function collectPositionFundingFee(config: TypusConfig, tx: Transaction, pythClient: PythClient, input: {
35
- position: Position;
43
+ export declare function collectPositionFundingFee(client: TypusClient, tx: Transaction, input: {
44
+ oracleContract?: string;
45
+ position: typeof Position.$inferType;
36
46
  suiCoins?: string[];
37
47
  }): Promise<Transaction>;
@@ -1,321 +1,224 @@
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
- };
65
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.findMarketIndex = findMarketIndex;
66
4
  exports.createTradingOrder = createTradingOrder;
67
5
  exports.zeroCoin = zeroCoin;
68
6
  exports.cancelTradingOrder = cancelTradingOrder;
69
7
  exports.increaseCollateral = increaseCollateral;
70
8
  exports.releaseCollateral = releaseCollateral;
71
9
  exports.collectPositionFundingFee = collectPositionFundingFee;
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];
10
+ const trading_1 = require("../../src/generated/typus_perp/trading");
11
+ const __1 = require("..");
12
+ const utils_1 = require("@typus/typus-sdk/dist/src/utils");
13
+ const utils_2 = require("@typus/typus-sdk/dist/src/utils");
14
+ const constants_1 = require("@typus/typus-sdk/dist/src/constants");
15
+ const utils_3 = require("@mysten/sui/utils");
16
+ function findMarketIndex(client, input) {
17
+ let target = constants_1.tokenType[client.config.network][input.tradingToken];
18
+ for (let i = 0; i < input.markets.length; i++) {
19
+ for (let symbol of input.markets[i].symbols) {
20
+ if ((0, utils_3.normalizeStructTag)(symbol.name) == target) {
21
+ return i;
139
22
  }
140
- });
141
- });
23
+ }
24
+ }
25
+ }
26
+ async function createTradingOrder(client, tx, input) {
27
+ // INPUTS
28
+ let TOKEN = input.cToken;
29
+ let BASE_TOKEN = input.tradingToken;
30
+ let tokens = Array.from(new Set([TOKEN, BASE_TOKEN]));
31
+ let cToken = constants_1.tokenType[__1.NETWORK][TOKEN];
32
+ let baseToken = constants_1.tokenType[__1.NETWORK][BASE_TOKEN];
33
+ let coin;
34
+ let suiCoin;
35
+ if (TOKEN == "SUI" && client.config.sponsored) {
36
+ // split together
37
+ [coin, suiCoin] = (0, utils_2.splitCoins)(tx, constants_1.tokenType.MAINNET.SUI, input.coins, [input.amount, tokens.length.toString()], client.config.sponsored);
38
+ }
39
+ else if (client.config.sponsored) {
40
+ coin = (0, utils_2.splitCoin)(tx, cToken, input.coins, input.amount, client.config.sponsored);
41
+ suiCoin = (0, utils_2.splitCoin)(tx, constants_1.tokenType.MAINNET.SUI, input.suiCoins, tokens.length.toString(), client.config.sponsored);
42
+ }
43
+ else {
44
+ coin = (0, utils_2.splitCoin)(tx, cToken, input.coins, input.amount, client.config.sponsored);
45
+ // no suiCoin
46
+ }
47
+ const tokensWithoutTypus = Array.from(new Set([TOKEN, BASE_TOKEN])).filter((token) => token !== "TYPUS");
48
+ await (0, utils_2.updatePyth)(client.pythClient, tx, tokensWithoutTypus, suiCoin);
49
+ for (let token of tokensWithoutTypus) {
50
+ (0, utils_2.updateOracleWithPythUsd)(client.pythClient, tx, client.config.package.oracle, token);
51
+ }
52
+ if (tokens.includes("TYPUS")) {
53
+ tx = await (0, utils_1.updateOracleWithSignatureTx)(__1.NETWORK, tx, client.config.package.oracle, constants_1.tokenType[__1.NETWORK]["TYPUS"]);
54
+ }
55
+ tx.add((0, trading_1.createTradingOrder)({
56
+ arguments: {
57
+ version: __1.PERP_VERSION,
58
+ registry: __1.MARKET,
59
+ poolRegistry: __1.LP_POOL,
60
+ marketIndex: BigInt(input.perpIndex),
61
+ poolIndex: BigInt(input.poolIndex),
62
+ typusOracleCToken: constants_1.oracle[__1.NETWORK][TOKEN],
63
+ typusOracleTradingSymbol: constants_1.oracle[__1.NETWORK][BASE_TOKEN],
64
+ collateral: coin,
65
+ size: BigInt(input.size),
66
+ triggerPrice: BigInt(input.triggerPrice),
67
+ isLong: input.isLong,
68
+ isStopOrder: input.isStopOrder,
69
+ reduceOnly: input.reduceOnly,
70
+ linkedPositionId: input.linkedPositionId ? BigInt(input.linkedPositionId) : null,
71
+ },
72
+ typeArguments: [cToken, baseToken],
73
+ }));
74
+ return tx;
142
75
  }
143
76
  function zeroCoin(tx, typeArgs) {
144
77
  return tx.moveCall({
145
- target: "0x2::coin::zero",
78
+ target: `0x2::coin::zero`,
146
79
  typeArguments: typeArgs,
147
80
  arguments: [],
148
81
  });
149
82
  }
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
- });
83
+ async function cancelTradingOrder(client, tx, input) {
84
+ let cToken = "0x" + input.order.collateral_token.name;
85
+ let BASE_TOKEN = "0x" + input.order.symbol.base_token.name;
86
+ let coin = tx.add((0, trading_1.cancelTradingOrder)({
87
+ arguments: {
88
+ version: __1.PERP_VERSION,
89
+ registry: __1.MARKET,
90
+ // @ts-ignore
91
+ marketIndex: BigInt(input.order.marketIndex),
92
+ orderId: BigInt(input.order.order_id),
93
+ triggerPrice: BigInt(input.order.trigger_price),
94
+ orderUser: null,
95
+ },
96
+ typeArguments: [cToken, BASE_TOKEN],
97
+ }));
98
+ tx.transferObjects([coin], input.user);
99
+ return tx;
168
100
  }
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
- });
101
+ async function increaseCollateral(client, tx, input) {
102
+ // parse from Position
103
+ let TOKEN = (0, constants_1.typeArgToAsset)(input.position.collateral_token.name);
104
+ let BASE_TOKEN = (0, constants_1.typeArgToAsset)(input.position.symbol.base_token.name);
105
+ let tokens = Array.from(new Set([TOKEN, BASE_TOKEN]));
106
+ let cToken = constants_1.tokenType[__1.NETWORK][TOKEN];
107
+ let baseToken = constants_1.tokenType[__1.NETWORK][BASE_TOKEN];
108
+ let coin;
109
+ let suiCoin;
110
+ if (TOKEN == "SUI" && client.config.sponsored) {
111
+ // split together
112
+ [coin, suiCoin] = (0, utils_2.splitCoins)(tx, constants_1.tokenType.MAINNET.SUI, input.coins, [input.amount, tokens.length.toString()], client.config.sponsored);
113
+ }
114
+ else if (client.config.sponsored) {
115
+ coin = (0, utils_2.splitCoin)(tx, cToken, input.coins, input.amount, client.config.sponsored);
116
+ suiCoin = (0, utils_2.splitCoin)(tx, constants_1.tokenType.MAINNET.SUI, input.suiCoins, tokens.length.toString(), client.config.sponsored);
117
+ }
118
+ else {
119
+ coin = (0, utils_2.splitCoin)(tx, cToken, input.coins, input.amount, client.config.sponsored);
120
+ // no suiCoin
121
+ }
122
+ const tokensWithoutTypus = Array.from(new Set([TOKEN, BASE_TOKEN])).filter((token) => token !== "TYPUS");
123
+ await (0, utils_2.updatePyth)(client.pythClient, tx, tokensWithoutTypus, suiCoin);
124
+ for (let token of tokensWithoutTypus) {
125
+ (0, utils_2.updateOracleWithPythUsd)(client.pythClient, tx, client.config.package.oracle, token);
126
+ }
127
+ if (tokens.includes("TYPUS")) {
128
+ const oracleContract = input.oracleContract ?? client.config.package.oracle;
129
+ tx = await (0, utils_1.updateOracleWithSignatureTx)(__1.NETWORK, tx, oracleContract, constants_1.tokenType[__1.NETWORK]["TYPUS"]);
130
+ }
131
+ // @ts-ignore
132
+ let marketIndex = BigInt(input.position.marketIndex);
133
+ tx.add((0, trading_1.increaseCollateral)({
134
+ arguments: {
135
+ version: __1.PERP_VERSION,
136
+ registry: __1.MARKET,
137
+ poolRegistry: __1.LP_POOL,
138
+ marketIndex: marketIndex,
139
+ poolIndex: marketIndex,
140
+ typusOracleCToken: constants_1.oracle[__1.NETWORK][TOKEN],
141
+ typusOracleTradingSymbol: constants_1.oracle[__1.NETWORK][BASE_TOKEN],
142
+ positionId: BigInt(input.position.position_id),
143
+ collateral: coin,
144
+ },
145
+ typeArguments: [cToken, baseToken],
146
+ }));
147
+ return tx;
225
148
  }
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
- });
149
+ async function releaseCollateral(client, tx, input) {
150
+ // parse from Position
151
+ let TOKEN = (0, constants_1.typeArgToAsset)(input.position.collateral_token.name);
152
+ let BASE_TOKEN = (0, constants_1.typeArgToAsset)(input.position.symbol.base_token.name);
153
+ let tokens = Array.from(new Set([TOKEN, BASE_TOKEN]));
154
+ let suiCoin;
155
+ if (client.config.sponsored) {
156
+ suiCoin = (0, utils_2.splitCoin)(tx, constants_1.tokenType.MAINNET.SUI, input.suiCoins, tokens.length.toString(), client.config.sponsored);
157
+ }
158
+ const tokensWithoutTypus = Array.from(new Set([TOKEN, BASE_TOKEN])).filter((token) => token !== "TYPUS");
159
+ await (0, utils_2.updatePyth)(client.pythClient, tx, tokensWithoutTypus, suiCoin);
160
+ for (let token of tokensWithoutTypus) {
161
+ (0, utils_2.updateOracleWithPythUsd)(client.pythClient, tx, client.config.package.oracle, token);
162
+ }
163
+ if (tokens.includes("TYPUS")) {
164
+ const oracleContract = input.oracleContract ?? client.config.package.oracle;
165
+ tx = await (0, utils_1.updateOracleWithSignatureTx)(__1.NETWORK, tx, oracleContract, constants_1.tokenType[__1.NETWORK]["TYPUS"]);
166
+ }
167
+ let cToken = constants_1.tokenType[__1.NETWORK][TOKEN];
168
+ let baseToken = constants_1.tokenType[__1.NETWORK][BASE_TOKEN];
169
+ // @ts-ignore
170
+ let marketIndex = BigInt(input.position.marketIndex);
171
+ let coin = tx.add((0, trading_1.releaseCollateral)({
172
+ arguments: {
173
+ version: __1.PERP_VERSION,
174
+ registry: __1.MARKET,
175
+ poolRegistry: __1.LP_POOL,
176
+ marketIndex: marketIndex,
177
+ poolIndex: marketIndex,
178
+ typusOracleCToken: constants_1.oracle[__1.NETWORK][TOKEN],
179
+ typusOracleTradingSymbol: constants_1.oracle[__1.NETWORK][BASE_TOKEN],
180
+ positionId: BigInt(input.position.position_id),
181
+ releaseAmount: BigInt(input.amount),
182
+ },
183
+ typeArguments: [cToken, baseToken],
184
+ }));
185
+ tx.transferObjects([coin], input.position.user);
186
+ return tx;
274
187
  }
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
- });
188
+ async function collectPositionFundingFee(client, tx, input) {
189
+ // parse from Position
190
+ let TOKEN = (0, constants_1.typeArgToAsset)(input.position.collateral_token.name);
191
+ let BASE_TOKEN = (0, constants_1.typeArgToAsset)(input.position.symbol.base_token.name);
192
+ let tokens = Array.from(new Set([TOKEN, BASE_TOKEN]));
193
+ let suiCoin;
194
+ if (client.config.sponsored) {
195
+ suiCoin = (0, utils_2.splitCoin)(tx, constants_1.tokenType.MAINNET.SUI, input.suiCoins, tokens.length.toString(), client.config.sponsored);
196
+ }
197
+ const tokensWithoutTypus = Array.from(new Set([TOKEN, BASE_TOKEN])).filter((token) => token !== "TYPUS");
198
+ await (0, utils_2.updatePyth)(client.pythClient, tx, tokensWithoutTypus, suiCoin);
199
+ for (let token of tokensWithoutTypus) {
200
+ (0, utils_2.updateOracleWithPythUsd)(client.pythClient, tx, client.config.package.oracle, token);
201
+ }
202
+ if (tokens.includes("TYPUS")) {
203
+ const oracleContract = input.oracleContract ?? client.config.package.oracle;
204
+ tx = await (0, utils_1.updateOracleWithSignatureTx)(__1.NETWORK, tx, oracleContract, constants_1.tokenType[__1.NETWORK]["TYPUS"]);
205
+ }
206
+ let cToken = constants_1.tokenType[__1.NETWORK][TOKEN];
207
+ let baseToken = constants_1.tokenType[__1.NETWORK][BASE_TOKEN];
208
+ // @ts-ignore
209
+ let marketIndex = BigInt(input.position.marketIndex);
210
+ tx.add((0, trading_1.collectPositionFundingFee)({
211
+ arguments: {
212
+ version: __1.PERP_VERSION,
213
+ registry: __1.MARKET,
214
+ poolRegistry: __1.LP_POOL,
215
+ marketIndex: marketIndex,
216
+ poolIndex: marketIndex,
217
+ typusOracleCToken: constants_1.oracle[__1.NETWORK][TOKEN],
218
+ typusOracleTradingSymbol: constants_1.oracle[__1.NETWORK][BASE_TOKEN],
219
+ positionId: BigInt(input.position.position_id),
220
+ },
221
+ typeArguments: [cToken, baseToken],
222
+ }));
223
+ return tx;
321
224
  }
@@ -1,19 +1,29 @@
1
- import { Transaction } from "@mysten/sui/transactions";
2
- import { PythClient, TypusConfig } from "@typus/typus-sdk/dist/src/utils";
1
+ import { Transaction, TransactionObjectArgument } from "@mysten/sui/transactions";
3
2
  import { TOKEN } from "@typus/typus-sdk/dist/src/constants";
4
- export declare function createTradingOrderWithBidReceiptByAutoBid(config: TypusConfig, tx: Transaction, pythClient: PythClient, input: {
3
+ import { TypusClient } from "../../src/client";
4
+ export declare function splitBidReceiptTx(client: TypusClient, tx: Transaction, input: {
5
+ index: string;
6
+ receipts: TransactionObjectArgument[];
7
+ share?: string;
8
+ recipient: string;
9
+ }): import("@mysten/sui/transactions").TransactionResult;
10
+ export declare function createTradingOrderWithBidReceiptByAutoBid(client: TypusClient, tx: Transaction, input: {
11
+ perpIndex: string;
12
+ poolIndex: string;
5
13
  cToken: TOKEN;
6
14
  tradingToken: TOKEN;
7
15
  isLong: boolean;
8
16
  user: string;
9
- index: string;
17
+ dovIndex: string;
10
18
  bToken: TOKEN;
11
19
  signalIndex: string;
12
20
  strategyIndex: string;
13
21
  share?: string;
14
22
  suiCoins?: string[];
15
23
  }): Promise<Transaction>;
16
- export declare function createTradingOrderWithBidReceipt(config: TypusConfig, tx: Transaction, pythClient: PythClient, input: {
24
+ export declare function createTradingOrderWithBidReceipt(client: TypusClient, tx: Transaction, input: {
25
+ perpIndex: string;
26
+ poolIndex: string;
17
27
  cToken: TOKEN;
18
28
  tradingToken: TOKEN;
19
29
  isLong: boolean;
@@ -24,7 +34,8 @@ export declare function createTradingOrderWithBidReceipt(config: TypusConfig, tx
24
34
  share?: string;
25
35
  suiCoins?: string[];
26
36
  }): Promise<Transaction>;
27
- export declare function reduceOptionCollateralPositionSize(config: TypusConfig, tx: Transaction, pythClient: PythClient, input: {
37
+ export declare function reduceOptionCollateralPositionSize(client: TypusClient, tx: Transaction, input: {
38
+ perpIndex: string;
28
39
  cToken: TOKEN;
29
40
  tradingToken: TOKEN;
30
41
  bToken: string;