@typus/typus-perp-sdk 1.1.30 → 1.1.31-codegen

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/api/sentio.js +604 -538
  2. package/dist/src/client.d.ts +27 -0
  3. package/dist/src/client.js +108 -0
  4. package/dist/src/fetch.d.ts +160 -34
  5. package/dist/src/fetch.js +365 -665
  6. package/dist/src/generated/typus_perp/admin.d.ts +117 -0
  7. package/dist/src/generated/typus_perp/admin.js +110 -0
  8. package/dist/src/generated/typus_perp/competition.d.ts +22 -0
  9. package/dist/src/generated/typus_perp/competition.js +58 -0
  10. package/dist/src/generated/typus_perp/deps/std/type_name.d.ts +17 -0
  11. package/dist/src/generated/typus_perp/deps/std/type_name.js +25 -0
  12. package/dist/src/generated/typus_perp/deps/sui/balance.d.ts +12 -0
  13. package/dist/src/generated/typus_perp/deps/sui/balance.js +20 -0
  14. package/dist/src/generated/typus_perp/deps/sui/object.d.ts +8 -0
  15. package/dist/src/generated/typus_perp/deps/sui/object.js +16 -0
  16. package/dist/src/generated/typus_perp/deps/sui/object_table.d.ts +19 -0
  17. package/dist/src/generated/typus_perp/deps/sui/object_table.js +59 -0
  18. package/dist/src/generated/typus_perp/deps/sui/vec_set.d.ts +18 -0
  19. package/dist/src/generated/typus_perp/deps/sui/vec_set.js +25 -0
  20. package/dist/src/generated/typus_perp/deps/typus/keyed_big_vector.d.ts +30 -0
  21. package/dist/src/generated/typus_perp/deps/typus/keyed_big_vector.js +67 -0
  22. package/dist/src/generated/typus_perp/deps/typus/linked_object_table.d.ts +32 -0
  23. package/dist/src/generated/typus_perp/deps/typus/linked_object_table.js +71 -0
  24. package/dist/src/generated/typus_perp/deps/typus_framework/vault.d.ts +23 -0
  25. package/dist/src/generated/typus_perp/deps/typus_framework/vault.js +61 -0
  26. package/dist/src/generated/typus_perp/escrow.d.ts +59 -0
  27. package/dist/src/generated/typus_perp/escrow.js +76 -0
  28. package/dist/src/generated/typus_perp/lending.d.ts +47 -0
  29. package/dist/src/generated/typus_perp/lending.js +50 -0
  30. package/dist/src/generated/typus_perp/lp_pool.d.ts +2327 -0
  31. package/dist/src/generated/typus_perp/lp_pool.js +1956 -0
  32. package/dist/src/generated/typus_perp/math.d.ts +95 -0
  33. package/dist/src/generated/typus_perp/math.js +97 -0
  34. package/dist/src/generated/typus_perp/position.d.ts +234 -0
  35. package/dist/src/generated/typus_perp/position.js +204 -0
  36. package/dist/src/generated/typus_perp/symbol.d.ts +18 -0
  37. package/dist/src/generated/typus_perp/symbol.js +55 -0
  38. package/dist/src/generated/typus_perp/tlp.d.ts +13 -0
  39. package/dist/src/generated/typus_perp/tlp.js +56 -0
  40. package/dist/src/generated/typus_perp/trading.d.ts +2486 -0
  41. package/dist/src/generated/typus_perp/trading.js +2476 -0
  42. package/dist/src/generated/typus_perp/treasury_caps.d.ts +13 -0
  43. package/dist/src/{_framework/init-loader.js → generated/typus_perp/treasury_caps.js} +17 -10
  44. package/dist/src/generated/typus_perp/user_account.d.ts +40 -0
  45. package/dist/src/generated/typus_perp/user_account.js +72 -0
  46. package/dist/src/generated/typus_stake_pool/admin.d.ts +100 -0
  47. package/dist/src/generated/typus_stake_pool/admin.js +91 -0
  48. package/dist/src/generated/typus_stake_pool/deps/std/type_name.d.ts +17 -0
  49. package/dist/src/generated/typus_stake_pool/deps/std/type_name.js +25 -0
  50. package/dist/src/generated/typus_stake_pool/deps/sui/object.d.ts +8 -0
  51. package/dist/src/generated/typus_stake_pool/deps/sui/object.js +16 -0
  52. package/dist/src/generated/typus_stake_pool/deps/sui/vec_map.d.ts +30 -0
  53. package/dist/src/generated/typus_stake_pool/deps/sui/vec_map.js +37 -0
  54. package/dist/src/generated/typus_stake_pool/deps/sui/vec_set.d.ts +18 -0
  55. package/dist/src/generated/typus_stake_pool/deps/sui/vec_set.js +25 -0
  56. package/dist/src/generated/typus_stake_pool/stake_pool.d.ts +1023 -0
  57. package/dist/src/generated/typus_stake_pool/stake_pool.js +918 -0
  58. package/dist/src/generated/utils/index.d.ts +11 -0
  59. package/dist/src/generated/utils/index.js +135 -0
  60. package/dist/src/grpc/graphql.d.ts +26 -0
  61. package/dist/src/grpc/graphql.js +126 -0
  62. package/dist/src/grpc/grpc.d.ts +1 -0
  63. package/dist/src/grpc/grpc.js +38 -0
  64. package/dist/src/grpc/ledgerService.js +64 -0
  65. package/dist/src/grpc/liveDataService.d.ts +0 -0
  66. package/dist/src/grpc/liveDataService.js +49 -0
  67. package/dist/src/index.d.ts +0 -4
  68. package/dist/src/index.js +20 -39
  69. package/dist/src/user/history.js +611 -680
  70. package/dist/src/user/order.d.ts +11 -11
  71. package/dist/src/user/order.js +171 -302
  72. package/dist/src/user/orderWithBidReceipt.d.ts +8 -6
  73. package/dist/src/user/orderWithBidReceipt.js +127 -226
  74. package/dist/src/user/tlp.d.ts +32 -23
  75. package/dist/src/user/tlp.js +316 -468
  76. package/package.json +44 -36
  77. package/dist/src/_dependencies/source/0x1/ascii/structs.d.ts +0 -88
  78. package/dist/src/_dependencies/source/0x1/ascii/structs.js +0 -398
  79. package/dist/src/_dependencies/source/0x1/index.d.ts +0 -3
  80. package/dist/src/_dependencies/source/0x1/index.js +0 -6
  81. package/dist/src/_dependencies/source/0x1/option/structs.d.ts +0 -50
  82. package/dist/src/_dependencies/source/0x1/option/structs.js +0 -271
  83. package/dist/src/_dependencies/source/0x1/string/structs.d.ts +0 -48
  84. package/dist/src/_dependencies/source/0x1/string/structs.js +0 -256
  85. package/dist/src/_dependencies/source/0x1/type-name/structs.d.ts +0 -49
  86. package/dist/src/_dependencies/source/0x1/type-name/structs.js +0 -223
  87. package/dist/src/_dependencies/source/0x2/bag/structs.d.ts +0 -54
  88. package/dist/src/_dependencies/source/0x2/bag/structs.js +0 -229
  89. package/dist/src/_dependencies/source/0x2/balance/structs.d.ts +0 -84
  90. package/dist/src/_dependencies/source/0x2/balance/structs.js +0 -386
  91. package/dist/src/_dependencies/source/0x2/coin/structs.d.ts +0 -406
  92. package/dist/src/_dependencies/source/0x2/coin/structs.js +0 -1247
  93. package/dist/src/_dependencies/source/0x2/index.d.ts +0 -3
  94. package/dist/src/_dependencies/source/0x2/index.js +0 -6
  95. package/dist/src/_dependencies/source/0x2/linked-table/structs.d.ts +0 -132
  96. package/dist/src/_dependencies/source/0x2/linked-table/structs.js +0 -438
  97. package/dist/src/_dependencies/source/0x2/object/structs.d.ts +0 -86
  98. package/dist/src/_dependencies/source/0x2/object/structs.js +0 -364
  99. package/dist/src/_dependencies/source/0x2/object-table/structs.d.ts +0 -54
  100. package/dist/src/_dependencies/source/0x2/object-table/structs.js +0 -248
  101. package/dist/src/_dependencies/source/0x2/sui/structs.d.ts +0 -44
  102. package/dist/src/_dependencies/source/0x2/sui/structs.js +0 -222
  103. package/dist/src/_dependencies/source/0x2/table/structs.d.ts +0 -54
  104. package/dist/src/_dependencies/source/0x2/table/structs.js +0 -248
  105. package/dist/src/_dependencies/source/0x2/table-vec/structs.d.ts +0 -59
  106. package/dist/src/_dependencies/source/0x2/table-vec/structs.js +0 -274
  107. package/dist/src/_dependencies/source/0x2/token/structs.d.ts +0 -421
  108. package/dist/src/_dependencies/source/0x2/token/structs.js +0 -1095
  109. package/dist/src/_dependencies/source/0x2/transfer-policy/structs.d.ts +0 -348
  110. package/dist/src/_dependencies/source/0x2/transfer-policy/structs.js +0 -1091
  111. package/dist/src/_dependencies/source/0x2/url/structs.d.ts +0 -49
  112. package/dist/src/_dependencies/source/0x2/url/structs.js +0 -223
  113. package/dist/src/_dependencies/source/0x2/vec-map/structs.d.ts +0 -106
  114. package/dist/src/_dependencies/source/0x2/vec-map/structs.js +0 -446
  115. package/dist/src/_dependencies/source/0x2/vec-set/structs.d.ts +0 -49
  116. package/dist/src/_dependencies/source/0x2/vec-set/structs.js +0 -270
  117. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/airdrop/structs.d.ts +0 -422
  118. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/airdrop/structs.js +0 -1084
  119. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/big-vector/structs.d.ts +0 -130
  120. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/big-vector/structs.js +0 -456
  121. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/critbit/structs.d.ts +0 -208
  122. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/critbit/structs.js +0 -653
  123. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/ecosystem/structs.d.ts +0 -362
  124. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/ecosystem/structs.js +0 -899
  125. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/index.d.ts +0 -8
  126. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/index.js +0 -11
  127. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/init.d.ts +0 -2
  128. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/init.js +0 -102
  129. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/keyed-big-vector/structs.d.ts +0 -202
  130. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/keyed-big-vector/structs.js +0 -632
  131. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/leaderboard/structs.d.ts +0 -600
  132. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/leaderboard/structs.js +0 -1459
  133. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/linked-object-table/structs.d.ts +0 -136
  134. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/linked-object-table/structs.js +0 -438
  135. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/linked-set/structs.d.ts +0 -127
  136. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/linked-set/structs.js +0 -430
  137. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/tails-staking/structs.d.ts +0 -957
  138. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/tails-staking/structs.js +0 -2261
  139. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/tgld/structs.d.ts +0 -244
  140. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/tgld/structs.js +0 -733
  141. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/user/structs.d.ts +0 -294
  142. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/user/structs.js +0 -892
  143. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/authority/structs.d.ts +0 -73
  144. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/authority/structs.js +0 -263
  145. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/balance-pool/structs.d.ts +0 -294
  146. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/balance-pool/structs.js +0 -591
  147. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/big-vector/structs.d.ts +0 -64
  148. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/big-vector/structs.js +0 -258
  149. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/dutch/structs.d.ts +0 -756
  150. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/dutch/structs.js +0 -1721
  151. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/i64/structs.d.ts +0 -44
  152. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/i64/structs.js +0 -222
  153. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/index.d.ts +0 -3
  154. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/index.js +0 -6
  155. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/init.d.ts +0 -2
  156. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/init.js +0 -89
  157. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/linked-list/structs.d.ts +0 -135
  158. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/linked-list/structs.js +0 -444
  159. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/vault/structs.d.ts +0 -2106
  160. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/vault/structs.js +0 -4952
  161. package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/discount-mint/structs.d.ts +0 -390
  162. package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/discount-mint/structs.js +0 -844
  163. package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/index.d.ts +0 -6
  164. package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/index.js +0 -9
  165. package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/init.d.ts +0 -2
  166. package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/init.js +0 -69
  167. package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/royalty-rule/structs.d.ts +0 -89
  168. package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/royalty-rule/structs.js +0 -376
  169. package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/staking/structs.d.ts +0 -386
  170. package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/staking/structs.js +0 -881
  171. package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/table-vec/structs.d.ts +0 -59
  172. package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/table-vec/structs.js +0 -274
  173. package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/typus-nft/structs.d.ts +0 -974
  174. package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/typus-nft/structs.js +0 -2387
  175. package/dist/src/_framework/init-loader.d.ts +0 -2
  176. package/dist/src/_framework/loader.d.ts +0 -17
  177. package/dist/src/_framework/loader.js +0 -108
  178. package/dist/src/_framework/reified.d.ts +0 -108
  179. package/dist/src/_framework/reified.js +0 -237
  180. package/dist/src/_framework/util.d.ts +0 -35
  181. package/dist/src/_framework/util.js +0 -396
  182. package/dist/src/_framework/vector.d.ts +0 -42
  183. package/dist/src/_framework/vector.js +0 -112
  184. package/dist/src/pyth.js +0 -1
  185. package/dist/src/typus_perp/admin/functions.d.ts +0 -59
  186. package/dist/src/typus_perp/admin/functions.js +0 -122
  187. package/dist/src/typus_perp/admin/structs.d.ts +0 -467
  188. package/dist/src/typus_perp/admin/structs.js +0 -1065
  189. package/dist/src/typus_perp/competition/functions.d.ts +0 -24
  190. package/dist/src/typus_perp/competition/functions.js +0 -38
  191. package/dist/src/typus_perp/competition/structs.d.ts +0 -80
  192. package/dist/src/typus_perp/competition/structs.js +0 -288
  193. package/dist/src/typus_perp/error/functions.d.ts +0 -73
  194. package/dist/src/typus_perp/error/functions.js +0 -363
  195. package/dist/src/typus_perp/escrow/functions.d.ts +0 -17
  196. package/dist/src/typus_perp/escrow/functions.js +0 -36
  197. package/dist/src/typus_perp/escrow/structs.d.ts +0 -160
  198. package/dist/src/typus_perp/escrow/structs.js +0 -324
  199. package/dist/src/typus_perp/index.d.ts +0 -1
  200. package/dist/src/typus_perp/index.js +0 -7
  201. package/dist/src/typus_perp/init.d.ts +0 -2
  202. package/dist/src/typus_perp/init.js +0 -118
  203. package/dist/src/typus_perp/lending/functions.d.ts +0 -15
  204. package/dist/src/typus_perp/lending/functions.js +0 -22
  205. package/dist/src/typus_perp/lp-pool/functions.d.ts +0 -460
  206. package/dist/src/typus_perp/lp-pool/functions.js +0 -732
  207. package/dist/src/typus_perp/lp-pool/structs.d.ts +0 -3705
  208. package/dist/src/typus_perp/lp-pool/structs.js +0 -6789
  209. package/dist/src/typus_perp/math/functions.d.ts +0 -29
  210. package/dist/src/typus_perp/math/functions.js +0 -61
  211. package/dist/src/typus_perp/position/functions.d.ts +0 -379
  212. package/dist/src/typus_perp/position/functions.js +0 -713
  213. package/dist/src/typus_perp/position/structs.d.ts +0 -905
  214. package/dist/src/typus_perp/position/structs.js +0 -1450
  215. package/dist/src/typus_perp/symbol/functions.d.ts +0 -9
  216. package/dist/src/typus_perp/symbol/functions.js +0 -24
  217. package/dist/src/typus_perp/symbol/structs.d.ts +0 -70
  218. package/dist/src/typus_perp/symbol/structs.js +0 -235
  219. package/dist/src/typus_perp/tlp/functions.d.ts +0 -19
  220. package/dist/src/typus_perp/tlp/functions.js +0 -40
  221. package/dist/src/typus_perp/tlp/structs.d.ts +0 -89
  222. package/dist/src/typus_perp/tlp/structs.js +0 -365
  223. package/dist/src/typus_perp/token-interface/functions.d.ts +0 -11
  224. package/dist/src/typus_perp/token-interface/functions.js +0 -22
  225. package/dist/src/typus_perp/trading/functions.d.ts +0 -812
  226. package/dist/src/typus_perp/trading/functions.js +0 -1218
  227. package/dist/src/typus_perp/trading/structs.d.ts +0 -3060
  228. package/dist/src/typus_perp/trading/structs.js +0 -5813
  229. package/dist/src/typus_perp/treasury-caps/functions.d.ts +0 -9
  230. package/dist/src/typus_perp/treasury-caps/functions.js +0 -36
  231. package/dist/src/typus_perp/treasury-caps/structs.d.ts +0 -49
  232. package/dist/src/typus_perp/treasury-caps/structs.js +0 -223
  233. package/dist/src/typus_perp/user-account/functions.d.ts +0 -36
  234. package/dist/src/typus_perp/user-account/functions.js +0 -70
  235. package/dist/src/typus_perp/user-account/structs.d.ts +0 -148
  236. package/dist/src/typus_perp/user-account/structs.js +0 -448
  237. package/dist/src/typus_stake_pool/admin/functions.d.ts +0 -49
  238. package/dist/src/typus_stake_pool/admin/functions.js +0 -105
  239. package/dist/src/typus_stake_pool/admin/structs.d.ts +0 -365
  240. package/dist/src/typus_stake_pool/admin/structs.js +0 -789
  241. package/dist/src/typus_stake_pool/index.d.ts +0 -1
  242. package/dist/src/typus_stake_pool/index.js +0 -7
  243. package/dist/src/typus_stake_pool/init.d.ts +0 -2
  244. package/dist/src/typus_stake_pool/init.js +0 -69
  245. package/dist/src/typus_stake_pool/stake-pool/functions.d.ts +0 -229
  246. package/dist/src/typus_stake_pool/stake-pool/functions.js +0 -380
  247. package/dist/src/typus_stake_pool/stake-pool/structs.d.ts +0 -2199
  248. package/dist/src/typus_stake_pool/stake-pool/structs.js +0 -4653
  249. /package/dist/src/{pyth.d.ts → grpc/ledgerService.d.ts} +0 -0
@@ -1,8 +1,8 @@
1
- import { Position, TradingOrder } from "../typus_perp/position/structs";
2
- import { PythClient, TypusConfig } from "@typus/typus-sdk/dist/src/utils";
1
+ import { Position, TradingOrder } from "../../src/generated/typus_perp/position";
3
2
  import { TOKEN } from "@typus/typus-sdk/dist/src/constants";
4
3
  import { Transaction } from "@mysten/sui/transactions";
5
- export declare function createTradingOrder(config: TypusConfig, tx: Transaction, pythClient: PythClient, input: {
4
+ import { TypusClient } from "../../src/client";
5
+ export declare function createTradingOrder(client: TypusClient, tx: Transaction, input: {
6
6
  coins: string[];
7
7
  cToken: TOKEN;
8
8
  amount: string;
@@ -16,22 +16,22 @@ export declare function createTradingOrder(config: TypusConfig, tx: Transaction,
16
16
  suiCoins?: string[];
17
17
  }): Promise<Transaction>;
18
18
  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;
19
+ export declare function cancelTradingOrder(client: TypusClient, tx: Transaction, input: {
20
+ order: typeof TradingOrder.$inferType;
21
21
  user: string;
22
22
  }): Promise<Transaction>;
23
- export declare function increaseCollateral(config: TypusConfig, tx: Transaction, pythClient: PythClient, input: {
23
+ export declare function increaseCollateral(client: TypusClient, tx: Transaction, input: {
24
24
  coins: string[];
25
25
  amount: string;
26
- position: Position;
26
+ position: typeof Position.$inferType;
27
27
  suiCoins?: string[];
28
28
  }): Promise<Transaction>;
29
- export declare function releaseCollateral(config: TypusConfig, tx: Transaction, pythClient: PythClient, input: {
30
- position: Position;
29
+ export declare function releaseCollateral(client: TypusClient, tx: Transaction, input: {
30
+ position: typeof Position.$inferType;
31
31
  amount: string;
32
32
  suiCoins?: string[];
33
33
  }): Promise<Transaction>;
34
- export declare function collectPositionFundingFee(config: TypusConfig, tx: Transaction, pythClient: PythClient, input: {
35
- position: Position;
34
+ export declare function collectPositionFundingFee(client: TypusClient, tx: Transaction, input: {
35
+ position: typeof Position.$inferType;
36
36
  suiCoins?: string[];
37
37
  }): Promise<Transaction>;
@@ -1,67 +1,4 @@
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 });
66
3
  exports.createTradingOrder = createTradingOrder;
67
4
  exports.zeroCoin = zeroCoin;
@@ -69,253 +6,185 @@ exports.cancelTradingOrder = cancelTradingOrder;
69
6
  exports.increaseCollateral = increaseCollateral;
70
7
  exports.releaseCollateral = releaseCollateral;
71
8
  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];
139
- }
140
- });
141
- });
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(0),
44
+ poolIndex: BigInt(0),
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;
142
63
  }
143
64
  function zeroCoin(tx, typeArgs) {
144
65
  return tx.moveCall({
145
- target: "0x2::coin::zero",
66
+ target: `0x2::coin::zero`,
146
67
  typeArguments: typeArgs,
147
68
  arguments: [],
148
69
  });
149
70
  }
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
- });
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(0),
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;
168
87
  }
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
- });
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(0),
119
+ poolIndex: BigInt(0),
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;
225
128
  }
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
- });
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(0),
150
+ poolIndex: BigInt(0),
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;
274
160
  }
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
- });
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(0),
182
+ poolIndex: BigInt(0),
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;
321
190
  }
@@ -1,19 +1,19 @@
1
1
  import { Transaction } from "@mysten/sui/transactions";
2
- import { PythClient, TypusConfig } from "@typus/typus-sdk/dist/src/utils";
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 createTradingOrderWithBidReceiptByAutoBid(client: TypusClient, tx: Transaction, input: {
5
5
  cToken: TOKEN;
6
6
  tradingToken: TOKEN;
7
7
  isLong: boolean;
8
8
  user: string;
9
- index: string;
9
+ dovIndex: string;
10
10
  bToken: TOKEN;
11
11
  signalIndex: string;
12
12
  strategyIndex: string;
13
- share?: string;
14
13
  suiCoins?: string[];
14
+ perpIndex?: number;
15
15
  }): Promise<Transaction>;
16
- export declare function createTradingOrderWithBidReceipt(config: TypusConfig, tx: Transaction, pythClient: PythClient, input: {
16
+ export declare function createTradingOrderWithBidReceipt(client: TypusClient, tx: Transaction, input: {
17
17
  cToken: TOKEN;
18
18
  tradingToken: TOKEN;
19
19
  isLong: boolean;
@@ -23,12 +23,14 @@ export declare function createTradingOrderWithBidReceipt(config: TypusConfig, tx
23
23
  bidReceipts: string[];
24
24
  share?: string;
25
25
  suiCoins?: string[];
26
+ perpIndex?: number;
26
27
  }): Promise<Transaction>;
27
- export declare function reduceOptionCollateralPositionSize(config: TypusConfig, tx: Transaction, pythClient: PythClient, input: {
28
+ export declare function reduceOptionCollateralPositionSize(client: TypusClient, tx: Transaction, input: {
28
29
  cToken: TOKEN;
29
30
  tradingToken: TOKEN;
30
31
  bToken: string;
31
32
  positionId: string;
32
33
  orderSize: string | null;
33
34
  suiCoins?: string[];
35
+ perpIndex?: number;
34
36
  }): Promise<Transaction>;