aftermath-ts-sdk 1.3.28 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (410) hide show
  1. package/dist/index.d.ts +16828 -5
  2. package/dist/index.js +22695 -19
  3. package/dist/index.js.map +1 -0
  4. package/package.json +69 -60
  5. package/dist/general/apiHelpers/dynamicFieldsApiHelpers.d.ts +0 -41
  6. package/dist/general/apiHelpers/dynamicFieldsApiHelpers.d.ts.map +0 -1
  7. package/dist/general/apiHelpers/dynamicFieldsApiHelpers.js +0 -110
  8. package/dist/general/apiHelpers/eventsApiHelpers.d.ts +0 -43
  9. package/dist/general/apiHelpers/eventsApiHelpers.d.ts.map +0 -1
  10. package/dist/general/apiHelpers/eventsApiHelpers.js +0 -170
  11. package/dist/general/apiHelpers/inspectionsApiHelpers.d.ts +0 -28
  12. package/dist/general/apiHelpers/inspectionsApiHelpers.d.ts.map +0 -1
  13. package/dist/general/apiHelpers/inspectionsApiHelpers.js +0 -58
  14. package/dist/general/apiHelpers/objectsApiHelpers.d.ts +0 -77
  15. package/dist/general/apiHelpers/objectsApiHelpers.d.ts.map +0 -1
  16. package/dist/general/apiHelpers/objectsApiHelpers.js +0 -197
  17. package/dist/general/apiHelpers/transactionsApiHelpers.d.ts +0 -50
  18. package/dist/general/apiHelpers/transactionsApiHelpers.d.ts.map +0 -1
  19. package/dist/general/apiHelpers/transactionsApiHelpers.js +0 -256
  20. package/dist/general/dynamicGas/dynamicGas.d.ts +0 -48
  21. package/dist/general/dynamicGas/dynamicGas.d.ts.map +0 -1
  22. package/dist/general/dynamicGas/dynamicGas.js +0 -69
  23. package/dist/general/dynamicGas/dynamicGasTypes.d.ts +0 -37
  24. package/dist/general/dynamicGas/dynamicGasTypes.d.ts.map +0 -1
  25. package/dist/general/dynamicGas/dynamicGasTypes.js +0 -2
  26. package/dist/general/nfts/nftsApi.d.ts +0 -35
  27. package/dist/general/nfts/nftsApi.d.ts.map +0 -1
  28. package/dist/general/nfts/nftsApi.js +0 -124
  29. package/dist/general/nfts/nftsApiCasting.d.ts +0 -11
  30. package/dist/general/nfts/nftsApiCasting.d.ts.map +0 -1
  31. package/dist/general/nfts/nftsApiCasting.js +0 -115
  32. package/dist/general/nfts/nftsTypes.d.ts +0 -31
  33. package/dist/general/nfts/nftsTypes.d.ts.map +0 -1
  34. package/dist/general/nfts/nftsTypes.js +0 -2
  35. package/dist/general/priceFeeds/priceFeeds.d.ts +0 -3
  36. package/dist/general/priceFeeds/priceFeeds.d.ts.map +0 -1
  37. package/dist/general/priceFeeds/priceFeeds.js +0 -26
  38. package/dist/general/priceFeeds/priceFeedsApi.d.ts +0 -3
  39. package/dist/general/priceFeeds/priceFeedsApi.d.ts.map +0 -1
  40. package/dist/general/priceFeeds/priceFeedsApi.js +0 -33
  41. package/dist/general/priceFeeds/priceFeedsTypes.d.ts +0 -3
  42. package/dist/general/priceFeeds/priceFeedsTypes.d.ts.map +0 -1
  43. package/dist/general/priceFeeds/priceFeedsTypes.js +0 -7
  44. package/dist/general/prices/coinGeckoTypes.d.ts +0 -16
  45. package/dist/general/prices/coinGeckoTypes.d.ts.map +0 -1
  46. package/dist/general/prices/coinGeckoTypes.js +0 -2
  47. package/dist/general/prices/prices.d.ts +0 -92
  48. package/dist/general/prices/prices.d.ts.map +0 -1
  49. package/dist/general/prices/prices.js +0 -124
  50. package/dist/general/providers/aftermath.d.ts +0 -200
  51. package/dist/general/providers/aftermath.d.ts.map +0 -1
  52. package/dist/general/providers/aftermath.js +0 -258
  53. package/dist/general/providers/aftermathApi.d.ts +0 -197
  54. package/dist/general/providers/aftermathApi.d.ts.map +0 -1
  55. package/dist/general/providers/aftermathApi.js +0 -255
  56. package/dist/general/providers/index.d.ts +0 -3
  57. package/dist/general/providers/index.d.ts.map +0 -1
  58. package/dist/general/providers/index.js +0 -18
  59. package/dist/general/types/castingTypes.d.ts +0 -51
  60. package/dist/general/types/castingTypes.d.ts.map +0 -1
  61. package/dist/general/types/castingTypes.js +0 -8
  62. package/dist/general/types/configTypes.d.ts +0 -187
  63. package/dist/general/types/configTypes.d.ts.map +0 -1
  64. package/dist/general/types/configTypes.js +0 -2
  65. package/dist/general/types/generalTypes.d.ts +0 -349
  66. package/dist/general/types/generalTypes.d.ts.map +0 -1
  67. package/dist/general/types/generalTypes.js +0 -2
  68. package/dist/general/types/index.d.ts +0 -7
  69. package/dist/general/types/index.d.ts.map +0 -1
  70. package/dist/general/types/index.js +0 -22
  71. package/dist/general/types/moveErrorsInterface.d.ts +0 -6
  72. package/dist/general/types/moveErrorsInterface.d.ts.map +0 -1
  73. package/dist/general/types/moveErrorsInterface.js +0 -2
  74. package/dist/general/types/suiTypes.d.ts +0 -2
  75. package/dist/general/types/suiTypes.d.ts.map +0 -1
  76. package/dist/general/types/suiTypes.js +0 -5
  77. package/dist/general/utils/caller.d.ts +0 -58
  78. package/dist/general/utils/caller.d.ts.map +0 -1
  79. package/dist/general/utils/caller.js +0 -231
  80. package/dist/general/utils/casting.d.ts +0 -212
  81. package/dist/general/utils/casting.d.ts.map +0 -1
  82. package/dist/general/utils/casting.js +0 -273
  83. package/dist/general/utils/fixedUtils.d.ts +0 -109
  84. package/dist/general/utils/fixedUtils.d.ts.map +0 -1
  85. package/dist/general/utils/fixedUtils.js +0 -100
  86. package/dist/general/utils/helpers.d.ts +0 -408
  87. package/dist/general/utils/helpers.d.ts.map +0 -1
  88. package/dist/general/utils/helpers.js +0 -725
  89. package/dist/general/utils/iFixedUtils.d.ts +0 -78
  90. package/dist/general/utils/iFixedUtils.d.ts.map +0 -1
  91. package/dist/general/utils/iFixedUtils.js +0 -109
  92. package/dist/general/utils/index.d.ts +0 -3
  93. package/dist/general/utils/index.d.ts.map +0 -1
  94. package/dist/general/utils/index.js +0 -18
  95. package/dist/general/wallet/wallet.d.ts +0 -89
  96. package/dist/general/wallet/wallet.d.ts.map +0 -1
  97. package/dist/general/wallet/wallet.js +0 -120
  98. package/dist/general/wallet/walletApi.d.ts +0 -20
  99. package/dist/general/wallet/walletApi.d.ts.map +0 -1
  100. package/dist/general/wallet/walletApi.js +0 -66
  101. package/dist/index.d.ts.map +0 -1
  102. package/dist/packages/auth/auth.d.ts +0 -135
  103. package/dist/packages/auth/auth.d.ts.map +0 -1
  104. package/dist/packages/auth/auth.js +0 -289
  105. package/dist/packages/auth/authTypes.d.ts +0 -102
  106. package/dist/packages/auth/authTypes.d.ts.map +0 -1
  107. package/dist/packages/auth/authTypes.js +0 -2
  108. package/dist/packages/auth/index.d.ts +0 -2
  109. package/dist/packages/auth/index.d.ts.map +0 -1
  110. package/dist/packages/auth/index.js +0 -17
  111. package/dist/packages/coin/api/coinApi.d.ts +0 -33
  112. package/dist/packages/coin/api/coinApi.d.ts.map +0 -1
  113. package/dist/packages/coin/api/coinApi.js +0 -167
  114. package/dist/packages/coin/coin.d.ts +0 -320
  115. package/dist/packages/coin/coin.d.ts.map +0 -1
  116. package/dist/packages/coin/coin.js +0 -467
  117. package/dist/packages/coin/coinTypes.d.ts +0 -139
  118. package/dist/packages/coin/coinTypes.d.ts.map +0 -1
  119. package/dist/packages/coin/coinTypes.js +0 -2
  120. package/dist/packages/coin/index.d.ts +0 -2
  121. package/dist/packages/coin/index.d.ts.map +0 -1
  122. package/dist/packages/coin/index.js +0 -17
  123. package/dist/packages/dca/api/dcaApi.d.ts +0 -26
  124. package/dist/packages/dca/api/dcaApi.d.ts.map +0 -1
  125. package/dist/packages/dca/api/dcaApi.js +0 -60
  126. package/dist/packages/dca/dca.d.ts +0 -174
  127. package/dist/packages/dca/dca.d.ts.map +0 -1
  128. package/dist/packages/dca/dca.js +0 -230
  129. package/dist/packages/dca/dcaTypes.d.ts +0 -319
  130. package/dist/packages/dca/dcaTypes.d.ts.map +0 -1
  131. package/dist/packages/dca/dcaTypes.js +0 -2
  132. package/dist/packages/dca/index.d.ts +0 -2
  133. package/dist/packages/dca/index.d.ts.map +0 -1
  134. package/dist/packages/dca/index.js +0 -17
  135. package/dist/packages/farms/api/farmsApi.d.ts +0 -996
  136. package/dist/packages/farms/api/farmsApi.d.ts.map +0 -1
  137. package/dist/packages/farms/api/farmsApi.js +0 -1826
  138. package/dist/packages/farms/api/farmsApiCasting.d.ts +0 -39
  139. package/dist/packages/farms/api/farmsApiCasting.d.ts.map +0 -1
  140. package/dist/packages/farms/api/farmsApiCasting.js +0 -427
  141. package/dist/packages/farms/api/farmsApiCastingTypes.d.ts +0 -235
  142. package/dist/packages/farms/api/farmsApiCastingTypes.d.ts.map +0 -1
  143. package/dist/packages/farms/api/farmsApiCastingTypes.js +0 -2
  144. package/dist/packages/farms/farms.d.ts +0 -221
  145. package/dist/packages/farms/farms.d.ts.map +0 -1
  146. package/dist/packages/farms/farms.js +0 -302
  147. package/dist/packages/farms/farmsStakedPosition.d.ts +0 -229
  148. package/dist/packages/farms/farmsStakedPosition.d.ts.map +0 -1
  149. package/dist/packages/farms/farmsStakedPosition.js +0 -473
  150. package/dist/packages/farms/farmsStakingPool.d.ts +0 -285
  151. package/dist/packages/farms/farmsStakingPool.d.ts.map +0 -1
  152. package/dist/packages/farms/farmsStakingPool.js +0 -488
  153. package/dist/packages/farms/farmsTypes.d.ts +0 -571
  154. package/dist/packages/farms/farmsTypes.d.ts.map +0 -1
  155. package/dist/packages/farms/farmsTypes.js +0 -49
  156. package/dist/packages/farms/index.d.ts +0 -4
  157. package/dist/packages/farms/index.d.ts.map +0 -1
  158. package/dist/packages/farms/index.js +0 -19
  159. package/dist/packages/faucet/api/faucetApi.d.ts +0 -37
  160. package/dist/packages/faucet/api/faucetApi.d.ts.map +0 -1
  161. package/dist/packages/faucet/api/faucetApi.js +0 -145
  162. package/dist/packages/faucet/api/faucetApiCasting.d.ts +0 -7
  163. package/dist/packages/faucet/api/faucetApiCasting.d.ts.map +0 -1
  164. package/dist/packages/faucet/api/faucetApiCasting.js +0 -33
  165. package/dist/packages/faucet/api/faucetApiCastingTypes.d.ts +0 -10
  166. package/dist/packages/faucet/api/faucetApiCastingTypes.d.ts.map +0 -1
  167. package/dist/packages/faucet/api/faucetApiCastingTypes.js +0 -2
  168. package/dist/packages/faucet/faucet.d.ts +0 -16
  169. package/dist/packages/faucet/faucet.d.ts.map +0 -1
  170. package/dist/packages/faucet/faucet.js +0 -64
  171. package/dist/packages/faucet/faucetTypes.d.ts +0 -20
  172. package/dist/packages/faucet/faucetTypes.d.ts.map +0 -1
  173. package/dist/packages/faucet/faucetTypes.js +0 -2
  174. package/dist/packages/faucet/index.d.ts +0 -2
  175. package/dist/packages/faucet/index.d.ts.map +0 -1
  176. package/dist/packages/faucet/index.js +0 -17
  177. package/dist/packages/index.d.ts +0 -14
  178. package/dist/packages/index.d.ts.map +0 -1
  179. package/dist/packages/index.js +0 -29
  180. package/dist/packages/leveragedStaking/api/leveragedStakingApi.d.ts +0 -202
  181. package/dist/packages/leveragedStaking/api/leveragedStakingApi.d.ts.map +0 -1
  182. package/dist/packages/leveragedStaking/api/leveragedStakingApi.js +0 -1104
  183. package/dist/packages/leveragedStaking/api/leveragedStakingApiCasting.d.ts +0 -12
  184. package/dist/packages/leveragedStaking/api/leveragedStakingApiCasting.d.ts.map +0 -1
  185. package/dist/packages/leveragedStaking/api/leveragedStakingApiCasting.js +0 -69
  186. package/dist/packages/leveragedStaking/api/leveragedStakingApiCastingTypes.d.ts +0 -39
  187. package/dist/packages/leveragedStaking/api/leveragedStakingApiCastingTypes.d.ts.map +0 -1
  188. package/dist/packages/leveragedStaking/api/leveragedStakingApiCastingTypes.js +0 -2
  189. package/dist/packages/leveragedStaking/index.d.ts +0 -2
  190. package/dist/packages/leveragedStaking/index.d.ts.map +0 -1
  191. package/dist/packages/leveragedStaking/index.js +0 -17
  192. package/dist/packages/leveragedStaking/leveragedStaking.d.ts +0 -68
  193. package/dist/packages/leveragedStaking/leveragedStaking.d.ts.map +0 -1
  194. package/dist/packages/leveragedStaking/leveragedStaking.js +0 -154
  195. package/dist/packages/leveragedStaking/leveragedStakingTypes.d.ts +0 -48
  196. package/dist/packages/leveragedStaking/leveragedStakingTypes.d.ts.map +0 -1
  197. package/dist/packages/leveragedStaking/leveragedStakingTypes.js +0 -16
  198. package/dist/packages/limitOrders/api/limitOrdersApi.d.ts +0 -12
  199. package/dist/packages/limitOrders/api/limitOrdersApi.d.ts.map +0 -1
  200. package/dist/packages/limitOrders/api/limitOrdersApi.js +0 -25
  201. package/dist/packages/limitOrders/index.d.ts +0 -2
  202. package/dist/packages/limitOrders/index.d.ts.map +0 -1
  203. package/dist/packages/limitOrders/index.js +0 -17
  204. package/dist/packages/limitOrders/limitOrders.d.ts +0 -143
  205. package/dist/packages/limitOrders/limitOrders.d.ts.map +0 -1
  206. package/dist/packages/limitOrders/limitOrders.js +0 -190
  207. package/dist/packages/limitOrders/limitOrdersTypes.d.ts +0 -211
  208. package/dist/packages/limitOrders/limitOrdersTypes.d.ts.map +0 -1
  209. package/dist/packages/limitOrders/limitOrdersTypes.js +0 -2
  210. package/dist/packages/multisig/api/multisigApi.d.ts +0 -10
  211. package/dist/packages/multisig/api/multisigApi.d.ts.map +0 -1
  212. package/dist/packages/multisig/api/multisigApi.js +0 -39
  213. package/dist/packages/multisig/index.d.ts +0 -2
  214. package/dist/packages/multisig/index.d.ts.map +0 -1
  215. package/dist/packages/multisig/index.js +0 -17
  216. package/dist/packages/multisig/multisig.d.ts +0 -46
  217. package/dist/packages/multisig/multisig.d.ts.map +0 -1
  218. package/dist/packages/multisig/multisig.js +0 -65
  219. package/dist/packages/multisig/multisigTypes.d.ts +0 -26
  220. package/dist/packages/multisig/multisigTypes.d.ts.map +0 -1
  221. package/dist/packages/multisig/multisigTypes.js +0 -2
  222. package/dist/packages/nftAmm/api/nftAmmApi.d.ts +0 -93
  223. package/dist/packages/nftAmm/api/nftAmmApi.d.ts.map +0 -1
  224. package/dist/packages/nftAmm/api/nftAmmApi.js +0 -250
  225. package/dist/packages/nftAmm/api/nftAmmApiCasting.d.ts +0 -6
  226. package/dist/packages/nftAmm/api/nftAmmApiCasting.d.ts.map +0 -1
  227. package/dist/packages/nftAmm/api/nftAmmApiCasting.js +0 -43
  228. package/dist/packages/nftAmm/api/nftAmmApiCastingTypes.d.ts +0 -10
  229. package/dist/packages/nftAmm/api/nftAmmApiCastingTypes.d.ts.map +0 -1
  230. package/dist/packages/nftAmm/api/nftAmmApiCastingTypes.js +0 -2
  231. package/dist/packages/nftAmm/index.d.ts +0 -2
  232. package/dist/packages/nftAmm/index.d.ts.map +0 -1
  233. package/dist/packages/nftAmm/index.js +0 -17
  234. package/dist/packages/nftAmm/nftAmm.d.ts +0 -18
  235. package/dist/packages/nftAmm/nftAmm.d.ts.map +0 -1
  236. package/dist/packages/nftAmm/nftAmm.js +0 -73
  237. package/dist/packages/nftAmm/nftAmmMarket.d.ts +0 -54
  238. package/dist/packages/nftAmm/nftAmmMarket.d.ts.map +0 -1
  239. package/dist/packages/nftAmm/nftAmmMarket.js +0 -154
  240. package/dist/packages/nftAmm/nftAmmTypes.d.ts +0 -51
  241. package/dist/packages/nftAmm/nftAmmTypes.d.ts.map +0 -1
  242. package/dist/packages/nftAmm/nftAmmTypes.js +0 -2
  243. package/dist/packages/perpetuals/api/perpetualsApi.d.ts +0 -44
  244. package/dist/packages/perpetuals/api/perpetualsApi.d.ts.map +0 -1
  245. package/dist/packages/perpetuals/api/perpetualsApi.js +0 -1420
  246. package/dist/packages/perpetuals/api/perpetualsApiCasting.d.ts +0 -27
  247. package/dist/packages/perpetuals/api/perpetualsApiCasting.d.ts.map +0 -1
  248. package/dist/packages/perpetuals/api/perpetualsApiCasting.js +0 -463
  249. package/dist/packages/perpetuals/index.d.ts +0 -5
  250. package/dist/packages/perpetuals/index.d.ts.map +0 -1
  251. package/dist/packages/perpetuals/index.js +0 -20
  252. package/dist/packages/perpetuals/perpetuals.d.ts +0 -860
  253. package/dist/packages/perpetuals/perpetuals.d.ts.map +0 -1
  254. package/dist/packages/perpetuals/perpetuals.js +0 -1102
  255. package/dist/packages/perpetuals/perpetualsAccount.d.ts +0 -780
  256. package/dist/packages/perpetuals/perpetualsAccount.d.ts.map +0 -1
  257. package/dist/packages/perpetuals/perpetualsAccount.js +0 -1406
  258. package/dist/packages/perpetuals/perpetualsCastingTypes.d.ts +0 -170
  259. package/dist/packages/perpetuals/perpetualsCastingTypes.d.ts.map +0 -1
  260. package/dist/packages/perpetuals/perpetualsCastingTypes.js +0 -2
  261. package/dist/packages/perpetuals/perpetualsMarket.d.ts +0 -360
  262. package/dist/packages/perpetuals/perpetualsMarket.d.ts.map +0 -1
  263. package/dist/packages/perpetuals/perpetualsMarket.js +0 -475
  264. package/dist/packages/perpetuals/perpetualsTypes.d.ts +0 -2968
  265. package/dist/packages/perpetuals/perpetualsTypes.d.ts.map +0 -1
  266. package/dist/packages/perpetuals/perpetualsTypes.js +0 -165
  267. package/dist/packages/perpetuals/perpetualsVault.d.ts +0 -438
  268. package/dist/packages/perpetuals/perpetualsVault.d.ts.map +0 -1
  269. package/dist/packages/perpetuals/perpetualsVault.js +0 -601
  270. package/dist/packages/perpetuals/utils/index.d.ts +0 -2
  271. package/dist/packages/perpetuals/utils/index.d.ts.map +0 -1
  272. package/dist/packages/perpetuals/utils/index.js +0 -17
  273. package/dist/packages/perpetuals/utils/perpetualsOrderUtils.d.ts +0 -12
  274. package/dist/packages/perpetuals/utils/perpetualsOrderUtils.d.ts.map +0 -1
  275. package/dist/packages/perpetuals/utils/perpetualsOrderUtils.js +0 -60
  276. package/dist/packages/pools/api/poolsApi.d.ts +0 -342
  277. package/dist/packages/pools/api/poolsApi.d.ts.map +0 -1
  278. package/dist/packages/pools/api/poolsApi.js +0 -857
  279. package/dist/packages/pools/api/poolsApiCasting.d.ts +0 -13
  280. package/dist/packages/pools/api/poolsApiCasting.d.ts.map +0 -1
  281. package/dist/packages/pools/api/poolsApiCasting.js +0 -91
  282. package/dist/packages/pools/api/poolsApiCastingTypes.d.ts +0 -64
  283. package/dist/packages/pools/api/poolsApiCastingTypes.d.ts.map +0 -1
  284. package/dist/packages/pools/api/poolsApiCastingTypes.js +0 -2
  285. package/dist/packages/pools/index.d.ts +0 -3
  286. package/dist/packages/pools/index.d.ts.map +0 -1
  287. package/dist/packages/pools/index.js +0 -18
  288. package/dist/packages/pools/pool.d.ts +0 -459
  289. package/dist/packages/pools/pool.d.ts.map +0 -1
  290. package/dist/packages/pools/pool.js +0 -647
  291. package/dist/packages/pools/pools.d.ts +0 -405
  292. package/dist/packages/pools/pools.d.ts.map +0 -1
  293. package/dist/packages/pools/pools.js +0 -533
  294. package/dist/packages/pools/poolsTypes.d.ts +0 -469
  295. package/dist/packages/pools/poolsTypes.d.ts.map +0 -1
  296. package/dist/packages/pools/poolsTypes.js +0 -2
  297. package/dist/packages/pools/utils/cmmmCalculations.d.ts +0 -42
  298. package/dist/packages/pools/utils/cmmmCalculations.d.ts.map +0 -1
  299. package/dist/packages/pools/utils/cmmmCalculations.js +0 -1380
  300. package/dist/packages/referralVault/api/referralVaultApi.d.ts +0 -39
  301. package/dist/packages/referralVault/api/referralVaultApi.d.ts.map +0 -1
  302. package/dist/packages/referralVault/api/referralVaultApi.js +0 -125
  303. package/dist/packages/referralVault/index.d.ts +0 -2
  304. package/dist/packages/referralVault/index.d.ts.map +0 -1
  305. package/dist/packages/referralVault/index.js +0 -17
  306. package/dist/packages/referralVault/referralVault.d.ts +0 -47
  307. package/dist/packages/referralVault/referralVault.d.ts.map +0 -1
  308. package/dist/packages/referralVault/referralVault.js +0 -71
  309. package/dist/packages/referralVault/referralVaultTypes.d.ts +0 -2
  310. package/dist/packages/referralVault/referralVaultTypes.d.ts.map +0 -1
  311. package/dist/packages/referralVault/referralVaultTypes.js +0 -2
  312. package/dist/packages/referrals/index.d.ts +0 -2
  313. package/dist/packages/referrals/index.d.ts.map +0 -1
  314. package/dist/packages/referrals/index.js +0 -17
  315. package/dist/packages/referrals/referrals.d.ts +0 -27
  316. package/dist/packages/referrals/referrals.d.ts.map +0 -1
  317. package/dist/packages/referrals/referrals.js +0 -95
  318. package/dist/packages/referrals/referralsTypes.d.ts +0 -166
  319. package/dist/packages/referrals/referralsTypes.d.ts.map +0 -1
  320. package/dist/packages/referrals/referralsTypes.js +0 -2
  321. package/dist/packages/rewards/index.d.ts +0 -2
  322. package/dist/packages/rewards/index.d.ts.map +0 -1
  323. package/dist/packages/rewards/index.js +0 -17
  324. package/dist/packages/rewards/rewards.d.ts +0 -21
  325. package/dist/packages/rewards/rewards.d.ts.map +0 -1
  326. package/dist/packages/rewards/rewards.js +0 -65
  327. package/dist/packages/rewards/rewardsTypes.d.ts +0 -169
  328. package/dist/packages/rewards/rewardsTypes.d.ts.map +0 -1
  329. package/dist/packages/rewards/rewardsTypes.js +0 -2
  330. package/dist/packages/router/api/routerApi.d.ts +0 -35
  331. package/dist/packages/router/api/routerApi.d.ts.map +0 -1
  332. package/dist/packages/router/api/routerApi.js +0 -88
  333. package/dist/packages/router/api/routerApiCasting.d.ts +0 -6
  334. package/dist/packages/router/api/routerApiCasting.d.ts.map +0 -1
  335. package/dist/packages/router/api/routerApiCasting.js +0 -22
  336. package/dist/packages/router/api/routerApiCastingTypes.d.ts +0 -12
  337. package/dist/packages/router/api/routerApiCastingTypes.d.ts.map +0 -1
  338. package/dist/packages/router/api/routerApiCastingTypes.js +0 -2
  339. package/dist/packages/router/index.d.ts +0 -2
  340. package/dist/packages/router/index.d.ts.map +0 -1
  341. package/dist/packages/router/index.js +0 -17
  342. package/dist/packages/router/router.d.ts +0 -224
  343. package/dist/packages/router/router.d.ts.map +0 -1
  344. package/dist/packages/router/router.js +0 -283
  345. package/dist/packages/router/routerTypes.d.ts +0 -300
  346. package/dist/packages/router/routerTypes.d.ts.map +0 -1
  347. package/dist/packages/router/routerTypes.js +0 -2
  348. package/dist/packages/staking/api/stakingApi.d.ts +0 -129
  349. package/dist/packages/staking/api/stakingApi.d.ts.map +0 -1
  350. package/dist/packages/staking/api/stakingApi.js +0 -487
  351. package/dist/packages/staking/api/stakingApiCasting.d.ts +0 -11
  352. package/dist/packages/staking/api/stakingApiCasting.d.ts.map +0 -1
  353. package/dist/packages/staking/api/stakingApiCasting.js +0 -87
  354. package/dist/packages/staking/api/stakingApiCastingTypes.d.ts +0 -97
  355. package/dist/packages/staking/api/stakingApiCastingTypes.d.ts.map +0 -1
  356. package/dist/packages/staking/api/stakingApiCastingTypes.js +0 -2
  357. package/dist/packages/staking/index.d.ts +0 -2
  358. package/dist/packages/staking/index.d.ts.map +0 -1
  359. package/dist/packages/staking/index.js +0 -17
  360. package/dist/packages/staking/staking.d.ts +0 -385
  361. package/dist/packages/staking/staking.d.ts.map +0 -1
  362. package/dist/packages/staking/staking.js +0 -501
  363. package/dist/packages/staking/stakingTypes.d.ts +0 -575
  364. package/dist/packages/staking/stakingTypes.d.ts.map +0 -1
  365. package/dist/packages/staking/stakingTypes.js +0 -45
  366. package/dist/packages/sui/api/suiApi.d.ts +0 -21
  367. package/dist/packages/sui/api/suiApi.d.ts.map +0 -1
  368. package/dist/packages/sui/api/suiApi.js +0 -46
  369. package/dist/packages/sui/index.d.ts +0 -2
  370. package/dist/packages/sui/index.d.ts.map +0 -1
  371. package/dist/packages/sui/index.js +0 -17
  372. package/dist/packages/sui/sui.d.ts +0 -53
  373. package/dist/packages/sui/sui.d.ts.map +0 -1
  374. package/dist/packages/sui/sui.js +0 -77
  375. package/dist/packages/suiFrens/api/suiFrensApi.d.ts +0 -204
  376. package/dist/packages/suiFrens/api/suiFrensApi.d.ts.map +0 -1
  377. package/dist/packages/suiFrens/api/suiFrensApi.js +0 -756
  378. package/dist/packages/suiFrens/api/suiFrensApiCasting.d.ts +0 -21
  379. package/dist/packages/suiFrens/api/suiFrensApiCasting.d.ts.map +0 -1
  380. package/dist/packages/suiFrens/api/suiFrensApiCasting.js +0 -181
  381. package/dist/packages/suiFrens/api/suiFrensApiCastingTypes.d.ts +0 -77
  382. package/dist/packages/suiFrens/api/suiFrensApiCastingTypes.d.ts.map +0 -1
  383. package/dist/packages/suiFrens/api/suiFrensApiCastingTypes.js +0 -2
  384. package/dist/packages/suiFrens/index.d.ts +0 -4
  385. package/dist/packages/suiFrens/index.d.ts.map +0 -1
  386. package/dist/packages/suiFrens/index.js +0 -19
  387. package/dist/packages/suiFrens/stakedSuiFren.d.ts +0 -31
  388. package/dist/packages/suiFrens/stakedSuiFren.d.ts.map +0 -1
  389. package/dist/packages/suiFrens/stakedSuiFren.js +0 -90
  390. package/dist/packages/suiFrens/suiFren.d.ts +0 -32
  391. package/dist/packages/suiFrens/suiFren.d.ts.map +0 -1
  392. package/dist/packages/suiFrens/suiFren.js +0 -150
  393. package/dist/packages/suiFrens/suiFrens.d.ts +0 -56
  394. package/dist/packages/suiFrens/suiFrens.d.ts.map +0 -1
  395. package/dist/packages/suiFrens/suiFrens.js +0 -218
  396. package/dist/packages/suiFrens/suiFrensTypes.d.ts +0 -148
  397. package/dist/packages/suiFrens/suiFrensTypes.d.ts.map +0 -1
  398. package/dist/packages/suiFrens/suiFrensTypes.js +0 -8
  399. package/dist/packages/userData/index.d.ts +0 -2
  400. package/dist/packages/userData/index.d.ts.map +0 -1
  401. package/dist/packages/userData/index.js +0 -17
  402. package/dist/packages/userData/userData.d.ts +0 -89
  403. package/dist/packages/userData/userData.d.ts.map +0 -1
  404. package/dist/packages/userData/userData.js +0 -119
  405. package/dist/packages/userData/userDataTypes.d.ts +0 -29
  406. package/dist/packages/userData/userDataTypes.d.ts.map +0 -1
  407. package/dist/packages/userData/userDataTypes.js +0 -2
  408. package/dist/types.d.ts +0 -15
  409. package/dist/types.d.ts.map +0 -1
  410. package/dist/types.js +0 -31
@@ -1,467 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.Coin = void 0;
13
- const caller_1 = require("../../general/utils/caller");
14
- const helpers_1 = require("../../general/utils/helpers");
15
- const prices_1 = require("../../general/prices/prices");
16
- /**
17
- * The `Coin` class provides functionality to manage and inspect coin types,
18
- * retrieve metadata and prices, and convert balances with respect to coin decimals.
19
- * It can be instantiated with or without a specific `coinType` for convenience.
20
- *
21
- * @example
22
- * ```typescript
23
- *
24
- * const afSdk = new Aftermath("MAINNET");
25
- * await afSdk.init(); // initialize provider
26
- *
27
- * const coin = afSdk.Coin("0x2::sui::SUI");
28
- *
29
- * const metadata = await coin.getCoinMetadata(); // fetch metadata for SUI coin
30
- * ```
31
- */
32
- class Coin extends caller_1.Caller {
33
- // =========================================================================
34
- // Constructor
35
- // =========================================================================
36
- /**
37
- * Creates a new instance of `Coin`.
38
- *
39
- * @param coinType - The coin's type string (e.g., "0x2::sui::SUI"). If omitted, methods that require a type will need it passed in manually.
40
- * @param config - Optional caller configuration (network, access token).
41
- * @param Provider - An optional `AftermathApi` instance for coin-specific API calls.
42
- */
43
- constructor(coinType = undefined, config, Provider) {
44
- super(config, "coins");
45
- this.coinType = coinType;
46
- this.Provider = Provider;
47
- // =========================================================================
48
- // Private Helpers
49
- // =========================================================================
50
- /**
51
- * Internal method to retrieve a specialized coin-related API from `AftermathApi`.
52
- * Throws an error if no provider is set.
53
- */
54
- this.useProvider = () => {
55
- var _a;
56
- const provider = (_a = this.Provider) === null || _a === void 0 ? void 0 : _a.Coin();
57
- if (!provider)
58
- throw new Error("missing AftermathApi Provider");
59
- return provider;
60
- };
61
- this.coinType = coinType;
62
- // Pre-extract segments for convenience
63
- this.coinTypePackageName = this.coinType
64
- ? Coin.getCoinTypePackageName(this.coinType)
65
- : "";
66
- this.coinTypeSymbol = this.coinType
67
- ? Coin.getCoinTypeSymbol(this.coinType)
68
- : "";
69
- this.innerCoinType = this.coinType
70
- ? Coin.getInnerCoinType(this.coinType)
71
- : "";
72
- }
73
- // =========================================================================
74
- // Public Methods
75
- // =========================================================================
76
- // =========================================================================
77
- // Inspections
78
- // =========================================================================
79
- /**
80
- * Retrieves the decimals for multiple coins by calling the Aftermath API for metadata
81
- * and extracting the `decimals` property.
82
- *
83
- * @param inputs - An object containing an array of coin types.
84
- * @returns An object mapping each coin type to a numeric decimal count.
85
- *
86
- * @example
87
- * ```typescript
88
- * const decimals = await coin.getCoinsToDecimals({ coins: ["0x2::sui::SUI", "0x<...>"] });
89
- * console.log(decimals); // { "0x2::sui::SUI": 9, "0x<...>": 6 }
90
- * ```
91
- */
92
- getCoinsToDecimals(inputs) {
93
- return __awaiter(this, void 0, void 0, function* () {
94
- const { coins } = inputs;
95
- const metadatas = yield this.getCoinMetadatas(inputs);
96
- const coinsToDecimals = metadatas
97
- .map((data) => data.decimals)
98
- .reduce((acc, decimals, index) => {
99
- return Object.assign(Object.assign({}, acc), { [coins[index]]: decimals });
100
- }, {});
101
- return coinsToDecimals;
102
- });
103
- }
104
- /**
105
- * Fetches the metadata (name, symbol, decimals) for this coin type or a provided one,
106
- * caching it if already requested.
107
- *
108
- * @param coin - Optionally override the constructor coinType.
109
- * @returns The `CoinMetadaWithInfo` object containing metadata and optional external references.
110
- * @throws If neither constructor nor argument coinType is available.
111
- *
112
- * @example
113
- * ```typescript
114
- * const metadata = await coin.getCoinMetadata("0x2::sui::SUI");
115
- * console.log(metadata.name, metadata.symbol, metadata.decimals);
116
- * ```
117
- */
118
- getCoinMetadata(coin) {
119
- return __awaiter(this, void 0, void 0, function* () {
120
- var _a;
121
- if (this.metadata)
122
- return this.metadata;
123
- const coinType = (_a = this.coinType) !== null && _a !== void 0 ? _a : coin;
124
- if (!coinType)
125
- throw new Error("no valid coin type");
126
- const [metadata] = yield this.getCoinMetadatas({ coins: [coinType] });
127
- this.setCoinMetadata(metadata);
128
- return metadata;
129
- });
130
- }
131
- /**
132
- * Fetches metadata for multiple coins at once, returning an array in the same order
133
- * as the coin types requested.
134
- *
135
- * @param inputs - An object with `coins`, an array of coin types.
136
- * @returns An array of `CoinMetadaWithInfo` with length matching `coins`.
137
- *
138
- * @example
139
- * ```typescript
140
- * const metas = await coin.getCoinMetadatas({
141
- * coins: ["0x2::sui::SUI", "0x<custom::TOKEN>"]
142
- * });
143
- * console.log(metas[0].symbol, metas[1].symbol);
144
- * ```
145
- */
146
- getCoinMetadatas(inputs) {
147
- return __awaiter(this, void 0, void 0, function* () {
148
- return this.fetchApi("metadata", {
149
- coins: inputs.coins.map((coin) => helpers_1.Helpers.addLeadingZeroesToType(coin)),
150
- });
151
- });
152
- }
153
- /**
154
- * Manually sets the metadata in this Coin instance, storing it in `this.metadata`.
155
- *
156
- * @param metadata - A `CoinMetadaWithInfo` object to cache in this instance.
157
- */
158
- setCoinMetadata(metadata) {
159
- this.metadata = metadata;
160
- }
161
- /**
162
- * Retrieves price information (including current price and 24h change) for this coin or a provided coin.
163
- * If already fetched, it returns the cached data.
164
- *
165
- * @param coin - Optionally override the constructor coinType.
166
- * @returns A `CoinPriceInfo` with `price` and `priceChange24HoursPercentage`.
167
- * @throws If no valid coin type is present.
168
- *
169
- * @example
170
- * ```typescript
171
- * const priceInfo = await coin.getPrice("0x2::sui::SUI");
172
- * console.log(priceInfo.price, priceInfo.priceChange24HoursPercentage);
173
- * ```
174
- */
175
- getPrice(coin) {
176
- return __awaiter(this, void 0, void 0, function* () {
177
- var _a;
178
- if (this.priceInfo !== undefined)
179
- return this.priceInfo;
180
- const coinType = (_a = this.coinType) !== null && _a !== void 0 ? _a : coin;
181
- if (!coinType)
182
- throw new Error("no valid coin type");
183
- const priceInfo = yield new prices_1.Prices(this.config).getCoinPriceInfo({
184
- coin: coinType,
185
- });
186
- // NOTE: do we want this here ? (unexpected behavior)
187
- // if (price <= 0) throw new Error("No price found.")
188
- this.setPriceInfo(priceInfo);
189
- return priceInfo;
190
- });
191
- }
192
- /**
193
- * Manually sets the price info in this Coin instance, storing it in `this.priceInfo`.
194
- *
195
- * @param priceInfo - A `CoinPriceInfo` object to cache in this instance.
196
- */
197
- setPriceInfo(priceInfo) {
198
- this.priceInfo = priceInfo;
199
- }
200
- /**
201
- * Fetches a list of "verified" coin types from the Aftermath backend. Verified coins
202
- * typically pass certain safety or liquidity checks.
203
- *
204
- * @returns An array of `CoinType` strings that are considered verified.
205
- *
206
- * @example
207
- * ```typescript
208
- * const verified = await coin.getVerifiedCoins();
209
- * console.log(verified); // e.g. ["0x2::sui::SUI", "0x...::MYCOIN", ...]
210
- * ```
211
- */
212
- getVerifiedCoins() {
213
- return __awaiter(this, void 0, void 0, function* () {
214
- return this.fetchApi("verified");
215
- });
216
- }
217
- }
218
- exports.Coin = Coin;
219
- // =========================================================================
220
- // Constants
221
- // =========================================================================
222
- /**
223
- * Static configuration and defaults for Sui coin types, including the standard
224
- * SUI coin type, default decimals, and coin object type path.
225
- */
226
- Coin.constants = {
227
- /**
228
- * The canonical coin type string for SUI.
229
- */
230
- suiCoinType: "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI",
231
- /**
232
- * The default number of decimals for SUI (9).
233
- */
234
- suiCoinDecimals: 9,
235
- /**
236
- * The canonical coin object type path for Sui's Move module, used in verifying coin objects.
237
- */
238
- coinObjectType: "0x0000000000000000000000000000000000000000000000000000000000000002::coin::Coin",
239
- /**
240
- * The maximum number of decimals
241
- */
242
- maxCoinDecimals: 18,
243
- /**
244
- * Default decimals for various blockchains or ecosystems. For instance,
245
- * "sui" => 9, "evm" => 18, etc.
246
- */
247
- defaultCoinDecimals: {
248
- sui: 9,
249
- evm: 18,
250
- svm: 9,
251
- },
252
- };
253
- // =========================================================================
254
- // Public Static Methods
255
- // =========================================================================
256
- // =========================================================================
257
- // Coin Type
258
- // =========================================================================
259
- /**
260
- * Extracts the Move package name portion from a coin type string.
261
- * E.g., "0x2::sui::SUI" => "sui".
262
- *
263
- * @param coin - The coin type string (e.g., "0x2::sui::SUI").
264
- * @returns The middle segment of the type or empty string if not parseable.
265
- */
266
- Coin.getCoinTypePackageName = (coin) => {
267
- const splitCoin = coin.split("::");
268
- if (splitCoin.length !== 3)
269
- return "";
270
- const packageName = splitCoin[splitCoin.length - 2];
271
- if (!packageName)
272
- return "";
273
- return packageName;
274
- };
275
- /**
276
- * Extracts the final part of the coin type (the symbol or short name).
277
- * For example, "0x2::sui::SUI" => "SUI".
278
- *
279
- * @param coin - The coin type string.
280
- * @returns The extracted symbol or empty string if not found.
281
- */
282
- Coin.getCoinTypeSymbol = (coin) => {
283
- const startIndex = coin.lastIndexOf("::") + 2;
284
- // NOTE: should error if coin is not a valid coin type instead of empty string ?
285
- if (startIndex <= 1)
286
- return "";
287
- const foundEndIndex = coin.indexOf(">");
288
- const endIndex = foundEndIndex < 0 ? coin.length : foundEndIndex;
289
- const displayType = coin.slice(startIndex, endIndex);
290
- return displayType;
291
- };
292
- /**
293
- * Extracts the inner generic argument of a coin type if present. E.g.,
294
- * "0x2::coin::Coin<0x2::sui::SUI>" => "0x2::sui::SUI".
295
- *
296
- * @param coin - The coin type with a possible `<...>` suffix.
297
- * @returns The inner type or an empty string if not found.
298
- */
299
- Coin.getInnerCoinType = (coin) => coin.includes("<") ? coin.split("<")[1].slice(0, -1) : "";
300
- /**
301
- * If a `KeyType` string references a type in angle brackets, extracts the type
302
- * inside. Typically for "0x2::coin::Coin<0x2::mycoin::MYCOIN>" -> "0x2::mycoin::MYCOIN".
303
- *
304
- * @param keyType - The key type string to parse.
305
- * @returns The substring inside `<...>` or the original if no brackets found.
306
- */
307
- Coin.coinTypeFromKeyType = (keyType) => {
308
- const startIndex = keyType.lastIndexOf("<") + 1;
309
- const endIndex = keyType.indexOf(">", startIndex);
310
- return keyType.slice(startIndex, endIndex);
311
- };
312
- /**
313
- * Checks if a coin type string corresponds to the canonical SUI coin.
314
- *
315
- * @param coin - A coin type string.
316
- * @returns `true` if it matches "0x2::sui::SUI", otherwise `false`.
317
- */
318
- Coin.isSuiCoin = (coin) => helpers_1.Helpers.stripLeadingZeroesFromType(coin) ===
319
- helpers_1.Helpers.stripLeadingZeroesFromType(Coin.constants.suiCoinType);
320
- /**
321
- * Checks if an object type string is a `Coin<...>` object from the standard Sui Move module.
322
- *
323
- * @param objectType - The object type to test.
324
- * @returns `true` if it matches "0x2::coin::Coin<...>", otherwise `false`.
325
- */
326
- Coin.isCoinObjectType = (objectType) => helpers_1.Helpers.stripLeadingZeroesFromType(objectType).startsWith(helpers_1.Helpers.stripLeadingZeroesFromType(Coin.constants.coinObjectType));
327
- // =========================================================================
328
- // Helpers
329
- // =========================================================================
330
- /**
331
- * Given a record of coin types => numeric amounts, filters out those
332
- * with zero or negative amounts, returning only the positive pairs.
333
- *
334
- * @param coinAmounts - A record mapping coin types to numeric amounts.
335
- * @returns An object with `coins` array and `amounts` array in matching indexes.
336
- */
337
- Coin.coinsAndAmountsOverZero = (coinAmounts) => {
338
- // NOTE: will these loops always run in same order (is this a js guarantee or not) ?
339
- const coins = Object.keys(coinAmounts).filter((key) => coinAmounts[key] > 0);
340
- const amounts = Object.values(coinAmounts).filter((amount) => amount > 0);
341
- return { coins, amounts };
342
- };
343
- /**
344
- * Given a record of coin types => bigint balances, filters out those with zero
345
- * or negative balances, returning only the positive pairs.
346
- *
347
- * @param coinsToBalance - A record mapping coin types to bigints.
348
- * @returns An object with `coins` array and `balances` array in matching indexes.
349
- */
350
- Coin.coinsAndBalancesOverZero = (coinsToBalance) => {
351
- // NOTE: will these loops always run in same order (is this a js guarantee or not) ?
352
- const coins = Object.keys(coinsToBalance).filter((key) => BigInt(coinsToBalance[key]) > BigInt(0));
353
- const balances = Object.values(coinsToBalance)
354
- .map(BigInt)
355
- .filter((amount) => amount > BigInt(0));
356
- return { coins, balances };
357
- };
358
- /**
359
- * Filters a list of `coinTypes` by a textual query, matching against both zero-padded
360
- * and non-padded forms as well as substring checks.
361
- *
362
- * @param inputs - Contains `filter` (the search string) and `coinTypes`.
363
- * @returns An array of coin types that match the filter in either raw or zero-padded form.
364
- *
365
- * @example
366
- * ```typescript
367
- * const filtered = Coin.filterCoinsByType({
368
- * filter: "sui",
369
- * coinTypes: ["0x2::sui::SUI", "0x<...>"]
370
- * });
371
- * ```
372
- */
373
- Coin.filterCoinsByType = (inputs) => {
374
- var _a;
375
- const filter = inputs.filter.toLowerCase().trim();
376
- return (_a = inputs.coinTypes) === null || _a === void 0 ? void 0 : _a.filter((coinType) => {
377
- try {
378
- return (helpers_1.Helpers.stripLeadingZeroesFromType(coinType)
379
- .toLowerCase()
380
- .includes(helpers_1.Helpers.stripLeadingZeroesFromType(filter)) ||
381
- coinType
382
- .toLowerCase()
383
- .includes(helpers_1.Helpers.addLeadingZeroesToType(filter)));
384
- }
385
- catch (e) { }
386
- return (helpers_1.Helpers.stripLeadingZeroesFromType(coinType)
387
- .toLowerCase()
388
- .includes(filter) || coinType.toLowerCase().includes(filter));
389
- });
390
- };
391
- /**
392
- * Filters a record of coin metadata by a textual query, matching both the coin type
393
- * and the metadata's name/symbol fields.
394
- *
395
- * @param inputs - An object containing `filter` and a record of `coinMetadatas`.
396
- * @returns An array of coin types that match the search criteria.
397
- */
398
- Coin.filterCoinsByMetadata = (inputs) => {
399
- var _a;
400
- return (_a = Object.entries(inputs.coinMetadatas)) === null || _a === void 0 ? void 0 : _a.filter(([coin, metadata]) => {
401
- const cleanInput = inputs.filter.toLowerCase().trim();
402
- return (coin.startsWith(cleanInput) ||
403
- [metadata.name, metadata.symbol].some((str) => str.toLowerCase().includes(cleanInput)));
404
- }).map(([coin]) => coin);
405
- };
406
- // =========================================================================
407
- // Balance
408
- // =========================================================================
409
- // =========================================================================
410
- // Conversions
411
- // =========================================================================
412
- /**
413
- * Converts a user-friendly decimal number (e.g., 1.5) to a raw on-chain
414
- * integer representation by scaling with the given coin decimals.
415
- * For example, `1.5` with `decimals = 9` => `1500000000n`.
416
- *
417
- * @param balance - The user-friendly balance as a number.
418
- * @param decimals - Number of decimal places for this coin.
419
- * @returns A bigint representing the raw on-chain balance.
420
- */
421
- Coin.normalizeBalance = (balance, decimals) => BigInt(Math.floor(balance * Math.pow(10, decimals)));
422
- /**
423
- * Scales a raw bigint or numeric `amount` down by `decimals` to get a display-friendly float.
424
- * For example, `1500000000n` with `decimals = 9` => `1.5`.
425
- *
426
- * @param amount - The raw on-chain amount as `bigint` or `number`.
427
- * @param decimals - Number of decimal places for this coin.
428
- * @returns The resulting float as an easily readable balance.
429
- */
430
- Coin.balanceWithDecimals = (amount, decimals) => {
431
- // TODO: make this conversion via string so no overflow or loss when bigint to number ?
432
- return Number(amount) / Number(Math.pow(10, decimals));
433
- };
434
- /**
435
- * Scales a raw `amount` down by `decimals` and multiplies by a `price` in USD,
436
- * returning a final USD value. E.g., `1500000000n`, `decimals=9`, `price=2.0` => `3.0`.
437
- *
438
- * @param amount - The raw balance as bigint or number.
439
- * @param decimals - The coin decimals.
440
- * @param price - The coin's price in USD.
441
- * @returns The computed float in USD.
442
- */
443
- Coin.balanceWithDecimalsUsd = (amount, decimals, price) => {
444
- return Coin.balanceWithDecimals(amount, decimals) * price;
445
- };
446
- /**
447
- * Looks up a coin's symbol if it is known in a provided `coinSymbolToCoinTypes`
448
- * record. For instance, if "SUI" => `["0x2::sui::SUI"]`, we can find "SUI" from
449
- * the coin type "0x2::sui::SUI".
450
- *
451
- * @param inputs - An object with `coinType` and `coinSymbolToCoinTypes`.
452
- * @returns The coin symbol string or `undefined` if not found.
453
- */
454
- Coin.coinSymbolForCoinType = (inputs) => {
455
- const { coinType, coinSymbolToCoinTypes } = inputs;
456
- try {
457
- const fullCoinType = helpers_1.Helpers.addLeadingZeroesToType(coinType);
458
- const foundCoinData = Object.entries(coinSymbolToCoinTypes).find(([, coinsTypes]) => coinsTypes
459
- .map(helpers_1.Helpers.addLeadingZeroesToType)
460
- .includes(fullCoinType));
461
- const foundCoinSymbol = foundCoinData === null || foundCoinData === void 0 ? void 0 : foundCoinData[0];
462
- return foundCoinSymbol;
463
- }
464
- catch (_a) {
465
- return undefined;
466
- }
467
- };
@@ -1,139 +0,0 @@
1
- import { CoinMetadata } from "@mysten/sui/client";
2
- import { Balance, ObjectId, Percentage } from "../../general/types/generalTypes";
3
- import { CoinGeckoCoinApiId } from "../../types";
4
- /**
5
- * Represents the decimal precision of a coin (e.g., 9 or 18).
6
- */
7
- export type CoinDecimal = number;
8
- /**
9
- * A string that uniquely identifies a coin type in the Sui network
10
- * (e.g., "0x2::sui::SUI").
11
- */
12
- export type CoinType = string;
13
- /**
14
- * Represents a short symbol or ticker for a coin (e.g., "SUI", "BTC").
15
- */
16
- export type CoinSymbol = string;
17
- /**
18
- * Represents a coin with an amount in integer or floating form, typically used
19
- * to specify a user’s holding or a transaction amount.
20
- */
21
- export interface CoinWithAmount {
22
- /**
23
- * The coin type, e.g. "0x2::sui::SUI".
24
- */
25
- coin: CoinType;
26
- /**
27
- * The amount of the coin, typically expressed as an integer number of smallest units.
28
- */
29
- amount: number;
30
- }
31
- /**
32
- * Represents a coin with an amount that can be `undefined`, typically for optional or
33
- * deferred usage scenarios.
34
- */
35
- export interface CoinWithAmountOrUndefined {
36
- /**
37
- * The coin type, e.g. "0x2::sui::SUI".
38
- */
39
- coin: CoinType;
40
- /**
41
- * The amount of the coin, which can be `undefined`.
42
- */
43
- amount: number | undefined;
44
- }
45
- /**
46
- * Represents an amount in both coin denomination and USD value for reference.
47
- */
48
- export interface AmountInCoinAndUsd {
49
- /**
50
- * The amount of the coin in smallest units.
51
- */
52
- amount: number;
53
- /**
54
- * The USD equivalent of that coin amount.
55
- */
56
- amountUsd: number;
57
- }
58
- /**
59
- * Maps a coin type to a numerical balance. Typically used to store multiple
60
- * coin balances under their respective coin types.
61
- */
62
- export type CoinsToBalance = Record<CoinType, Balance>;
63
- /**
64
- * Maps a coin type to a numerical balance, which may be `undefined`.
65
- */
66
- export type CoinsToBalanceOrUndefined = Record<CoinType, Balance | undefined>;
67
- /**
68
- * Maps a coin type to its price, typically as a number in USD or another fiat currency.
69
- */
70
- export type CoinsToPrice = Record<CoinType, number>;
71
- /**
72
- * Maps a coin type to its on-chain decimal precision.
73
- */
74
- export type CoinsToDecimals = Record<CoinType, CoinDecimal>;
75
- /**
76
- * Maps a coin type to price information, typically containing a price and a 24-hour change.
77
- */
78
- export type CoinsToPriceInfo = Record<CoinType, CoinPriceInfo>;
79
- /**
80
- * Maps a coin symbol (e.g., "SUI") to its price information, typically containing a price and a 24-hour change.
81
- */
82
- export type CoinSymbolsToPriceInfo = Record<CoinSymbol, CoinPriceInfo>;
83
- /**
84
- * Maps a coin symbol (e.g., "SUI") to an array of possible coin types (e.g., "0x2::sui::SUI").
85
- */
86
- export type CoinSymbolToCoinTypes = Record<CoinSymbol, CoinType[]>;
87
- /**
88
- * Represents pricing information for a coin, including current price and 24-hour percentage change.
89
- */
90
- export interface CoinPriceInfo {
91
- /**
92
- * The current price in USD or another currency.
93
- */
94
- price: number;
95
- /**
96
- * The 24-hour percentage change of the coin price.
97
- * @remarks 0.54 = 54%
98
- */
99
- priceChange24HoursPercentage: Percentage;
100
- }
101
- /**
102
- * Extends the Sui `CoinMetadata` with optional properties relevant to external data
103
- * sources (e.g., CoinGecko).
104
- */
105
- export type CoinMetadaWithInfo = CoinMetadata & {
106
- /**
107
- * Indicates whether this coin's metadata was generated automatically.
108
- */
109
- isGenerated?: boolean;
110
- /**
111
- * The associated CoinGecko API ID, if available.
112
- */
113
- coingeckoId?: CoinGeckoCoinApiId;
114
- };
115
- /**
116
- * Represents a coin reference in the Move environment, using either an on-chain ObjectId
117
- * or an input index or result index from a transaction.
118
- */
119
- export type ServiceCoinData = {
120
- Coin: ObjectId;
121
- } | {
122
- Input: number;
123
- } | {
124
- Result: number;
125
- } | {
126
- NestedResult: [number, number];
127
- };
128
- /**
129
- * **Legacy type** representing a coin reference in the Move environment, using
130
- * older transaction output indexing structures.
131
- */
132
- export type ServiceCoinDataV2 = "Gas" | {
133
- Input: number;
134
- } | {
135
- Result: number;
136
- } | {
137
- NestedResult: [number, number];
138
- };
139
- //# sourceMappingURL=coinTypes.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"coinTypes.d.ts","sourceRoot":"","sources":["../../../src/packages/coin/coinTypes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EACN,OAAO,EACP,QAAQ,EACR,UAAU,EACV,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEjD;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC;AAEjC;;;GAGG;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC;AAE9B;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC;AAEhC;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC9B;;OAEG;IACH,IAAI,EAAE,QAAQ,CAAC;IACf;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;CACf;AAED;;;GAGG;AACH,MAAM,WAAW,yBAAyB;IACzC;;OAEG;IACH,IAAI,EAAE,QAAQ,CAAC;IACf;;OAEG;IACH,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAClC;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;CAClB;AAED;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;AAEvD;;GAEG;AACH,MAAM,MAAM,yBAAyB,GAAG,MAAM,CAAC,QAAQ,EAAE,OAAO,GAAG,SAAS,CAAC,CAAC;AAE9E;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;AAEpD;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;AAE5D;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;AAE/D;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,CAAC;AAEvE;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG,MAAM,CAAC,UAAU,EAAE,QAAQ,EAAE,CAAC,CAAC;AAEnE;;GAEG;AACH,MAAM,WAAW,aAAa;IAC7B;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,4BAA4B,EAAE,UAAU,CAAC;CACzC;AAED;;;GAGG;AACH,MAAM,MAAM,kBAAkB,GAAG,YAAY,GAAG;IAC/C;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;OAEG;IACH,WAAW,CAAC,EAAE,kBAAkB,CAAC;CACjC,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,eAAe,GACxB;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,GAClB;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,GACjB;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,GAClB;IAAE,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,CAAC;AAEtC;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAC1B,KAAK,GACL;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,GACjB;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,GAClB;IAAE,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,CAAC"}
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,2 +0,0 @@
1
- export * from "./coin";
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/packages/coin/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC"}
@@ -1,17 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./coin"), exports);
@@ -1,26 +0,0 @@
1
- import { AftermathApi } from "../../../general/providers";
2
- import { AnyObjectType, CoinType, DcaAddresses, ObjectId } from "../../../types";
3
- import { Transaction, TransactionArgument } from "@mysten/sui/transactions";
4
- export declare class DcaApi {
5
- private readonly Provider;
6
- private static readonly constants;
7
- readonly addresses: DcaAddresses;
8
- readonly eventTypes: {
9
- createdOrder: AnyObjectType;
10
- createdOrderV2: AnyObjectType;
11
- closedOrder: AnyObjectType;
12
- executedTrade: AnyObjectType;
13
- };
14
- constructor(Provider: AftermathApi);
15
- createCloseOrderTx: (inputs: {
16
- tx: Transaction;
17
- allocateCoinType: CoinType;
18
- buyCoinType: CoinType;
19
- orderId: ObjectId | TransactionArgument;
20
- }) => import("@mysten/sui/transactions").TransactionResult;
21
- private createdOrderEventType;
22
- private createdOrderEventTypeV2;
23
- private closedOrderEventType;
24
- private executedOrderEventType;
25
- }
26
- //# sourceMappingURL=dcaApi.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dcaApi.d.ts","sourceRoot":"","sources":["../../../../src/packages/dca/api/dcaApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EACN,aAAa,EACb,QAAQ,EACR,YAAY,EACZ,QAAQ,EACR,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE5E,qBAAa,MAAM;IAmCN,OAAO,CAAC,QAAQ,CAAC,QAAQ;IA9BrC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,CAY/B;IAMF,SAAgB,SAAS,EAAE,YAAY,CAAC;IACxC,SAAgB,UAAU,EAAE;QAC3B,YAAY,EAAE,aAAa,CAAC;QAC5B,cAAc,EAAE,aAAa,CAAC;QAC9B,WAAW,EAAE,aAAa,CAAC;QAC3B,aAAa,EAAE,aAAa,CAAC;KAC7B,CAAC;gBAM2B,QAAQ,EAAE,YAAY;IAgB5C,kBAAkB,GAAI,QAAQ;QACpC,EAAE,EAAE,WAAW,CAAC;QAChB,gBAAgB,EAAE,QAAQ,CAAC;QAC3B,WAAW,EAAE,QAAQ,CAAC;QACtB,OAAO,EAAE,QAAQ,GAAG,mBAAmB,CAAC;KACxC,0DAgBC;IAMF,OAAO,CAAC,qBAAqB,CAK1B;IAEH,OAAO,CAAC,uBAAuB,CAK5B;IAEH,OAAO,CAAC,oBAAoB,CAKzB;IAEH,OAAO,CAAC,sBAAsB,CAK3B;CACH"}