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,1826 +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.FarmsApi = void 0;
13
- const utils_1 = require("../../../general/utils");
14
- const eventsApiHelpers_1 = require("../../../general/apiHelpers/eventsApiHelpers");
15
- const sui_1 = require("../../sui");
16
- const transactions_1 = require("@mysten/sui/transactions");
17
- const __1 = require("../..");
18
- class FarmsApi {
19
- // =========================================================================
20
- // Constructor
21
- // =========================================================================
22
- /**
23
- * Constructor for FarmsApi
24
- * @param Provider The AftermathApi provider instance
25
- * @throws Error if not all required addresses have been set in provider
26
- */
27
- constructor(Provider) {
28
- this.Provider = Provider;
29
- // =========================================================================
30
- // Public Methods
31
- // =========================================================================
32
- // =========================================================================
33
- // Objects
34
- // =========================================================================
35
- // =========================================================================
36
- // Staking Pool Objects
37
- // =========================================================================
38
- /**
39
- * @deprecated Use the new API method in Farms class instead.
40
- * Fetches the owner caps for staking pools owned by a specific wallet address
41
- * @param inputs Object containing wallet address
42
- * @returns Array of StakingPoolOwnerCapObject
43
- */
44
- this.fetchOwnedStakingPoolOwnerCaps = (inputs) => __awaiter(this, void 0, void 0, function* () {
45
- const { walletAddress } = inputs;
46
- const [capsV1, capsV2] = yield Promise.all([
47
- this.Provider.Objects().fetchCastObjectsOwnedByAddressOfType({
48
- walletAddress,
49
- objectType: this.objectTypes.stakingPoolOwnerCapV1,
50
- objectFromSuiObjectResponse: utils_1.Casting.farms
51
- .stakingPoolOwnerCapObjectFromSuiObjectResponseV1,
52
- }),
53
- this.Provider.Objects().fetchCastObjectsOwnedByAddressOfType({
54
- walletAddress,
55
- objectType: this.objectTypes.stakingPoolOwnerCapV2,
56
- objectFromSuiObjectResponse: utils_1.Casting.farms
57
- .stakingPoolOwnerCapObjectFromSuiObjectResponseV2,
58
- }),
59
- ]);
60
- return [...capsV1, ...capsV2];
61
- });
62
- /**
63
- * @deprecated Use the new API method in Farms class instead.
64
- * Fetches the one-time admin caps for staking pools owned by a specific wallet address
65
- * @param inputs Object containing wallet address
66
- * @returns Array of StakingPoolOneTimeAdminCapObject
67
- */
68
- this.fetchOwnedStakingPoolOneTimeAdminCaps = (inputs) => __awaiter(this, void 0, void 0, function* () {
69
- const { walletAddress } = inputs;
70
- const [capsV1, capsV2] = yield Promise.all([
71
- this.Provider.Objects().fetchCastObjectsOwnedByAddressOfType({
72
- walletAddress,
73
- objectType: this.objectTypes.stakingPoolOneTimeAdminCapV1,
74
- objectFromSuiObjectResponse: utils_1.Casting.farms
75
- .stakingPoolOneTimeAdminCapObjectFromSuiObjectResponseV1,
76
- }),
77
- this.Provider.Objects().fetchCastObjectsOwnedByAddressOfType({
78
- walletAddress,
79
- objectType: this.objectTypes.stakingPoolOneTimeAdminCapV2,
80
- objectFromSuiObjectResponse: utils_1.Casting.farms
81
- .stakingPoolOneTimeAdminCapObjectFromSuiObjectResponseV2,
82
- }),
83
- ]);
84
- return [...capsV1, ...capsV2];
85
- });
86
- // =========================================================================
87
- // Staked Position Objects
88
- // =========================================================================
89
- /**
90
- * @deprecated Use `getOwnedStakedPositions` method in Farms class instead.
91
- * Fetches partial staked positions owned by a specific wallet address
92
- * @param inputs Object containing wallet address
93
- * @returns Array of PartialFarmsStakedPositionObject
94
- */
95
- this.fetchOwnedPartialStakedPositions = (inputs) => __awaiter(this, void 0, void 0, function* () {
96
- const { walletAddress } = inputs;
97
- const [positionsV1, positionsV2] = yield Promise.all([
98
- this.Provider.Objects().fetchCastObjectsOwnedByAddressOfType({
99
- walletAddress,
100
- objectType: this.objectTypes.stakedPositionV1,
101
- objectFromSuiObjectResponse: utils_1.Casting.farms
102
- .partialStakedPositionObjectFromSuiObjectResponseV1,
103
- }),
104
- this.Provider.Objects().fetchCastObjectsOwnedByAddressOfType({
105
- walletAddress,
106
- objectType: this.objectTypes.stakedPositionV2,
107
- objectFromSuiObjectResponse: utils_1.Casting.farms
108
- .partialStakedPositionObjectFromSuiObjectResponseV2,
109
- }),
110
- ]);
111
- return [...positionsV1, ...positionsV2];
112
- });
113
- // =========================================================================
114
- // Transaction Commands
115
- // =========================================================================
116
- // =========================================================================
117
- // Staking Transaction Commands
118
- // =========================================================================
119
- /**
120
- * @deprecated use stakeTxV2 instead
121
- * Creates a transaction to stake coins in a staking pool (original version)
122
- * @param inputs Staking parameters including transaction, pool ID, coin ID, lock duration, and coin type
123
- * @returns Transaction object argument for StakedPosition
124
- */
125
- this.stakeTxV1 = (inputs) => {
126
- const { tx, stakeCoinId } = inputs;
127
- return tx.moveCall({
128
- target: utils_1.Helpers.transactions.createTxTarget(this.addresses.packages.vaults, FarmsApi.constants.moduleNames.stakedPosition, "stake"),
129
- typeArguments: [inputs.stakeCoinType],
130
- arguments: [
131
- tx.object(inputs.stakingPoolId), // AfterburnerVault
132
- tx.object(sui_1.Sui.constants.addresses.suiClockId), // Clock
133
- typeof stakeCoinId === "string"
134
- ? tx.object(stakeCoinId)
135
- : stakeCoinId, // Coin
136
- tx.pure.u64(inputs.lockDurationMs),
137
- ],
138
- });
139
- };
140
- /**
141
- * Creates a transaction to stake coins in a staking pool
142
- * @param inputs Staking parameters including transaction, pool ID, coin ID, lock duration, lock enforcement, and coin type
143
- * @returns Transaction object argument for StakedPosition
144
- */
145
- this.stakeTxV2 = (inputs) => {
146
- const { tx, stakeCoinId } = inputs;
147
- return tx.moveCall({
148
- target: utils_1.Helpers.transactions.createTxTarget(this.addresses.packages.vaultsV2, FarmsApi.constants.moduleNames.stakedPosition, "stake"),
149
- typeArguments: [inputs.stakeCoinType],
150
- arguments: [
151
- tx.object(inputs.stakingPoolId), // AfterburnerVault
152
- tx.object(this.addresses.objects.version), // Version
153
- tx.object(sui_1.Sui.constants.addresses.suiClockId), // Clock
154
- typeof stakeCoinId === "string"
155
- ? tx.object(stakeCoinId)
156
- : stakeCoinId, // Coin
157
- tx.pure.u8(inputs.lockEnforcement === "Strict" ? 0 : 1), // lock_enforcement
158
- tx.pure.u64(inputs.lockDurationMs), // lock_duration_ms
159
- ],
160
- });
161
- };
162
- /**
163
- * @deprecated use depositPrincipalTxV2 instead
164
- * Creates a transaction to deposit additional principal to a staked position (original version)
165
- * @param inputs Deposit parameters including transaction, position ID, pool ID, coin ID, and coin type
166
- * @returns Transaction command to deposit principal
167
- */
168
- this.depositPrincipalTxV1 = (inputs) => {
169
- const { tx, stakeCoinId } = inputs;
170
- return tx.moveCall({
171
- target: utils_1.Helpers.transactions.createTxTarget(this.addresses.packages.vaults, FarmsApi.constants.moduleNames.stakedPosition, "deposit_principal"),
172
- typeArguments: [inputs.stakeCoinType],
173
- arguments: [
174
- tx.object(inputs.stakedPositionId), // StakedPosition
175
- tx.object(inputs.stakingPoolId), // AfterburnerVault
176
- tx.object(sui_1.Sui.constants.addresses.suiClockId), // Clock
177
- typeof stakeCoinId === "string"
178
- ? tx.object(stakeCoinId)
179
- : stakeCoinId, // Coin
180
- ],
181
- });
182
- };
183
- /**
184
- * Creates a transaction to deposit additional principal to a staked position
185
- * @param inputs Deposit parameters including transaction, position ID, pool ID, coin ID, and coin type
186
- * @returns Transaction command to deposit principal
187
- */
188
- this.depositPrincipalTxV2 = (inputs) => {
189
- const { tx, stakeCoinId } = inputs;
190
- return tx.moveCall({
191
- target: utils_1.Helpers.transactions.createTxTarget(this.addresses.packages.vaultsV2, FarmsApi.constants.moduleNames.stakedPosition, "deposit_principal"),
192
- typeArguments: [inputs.stakeCoinType],
193
- arguments: [
194
- tx.object(inputs.stakedPositionId), // StakedPosition
195
- tx.object(inputs.stakingPoolId), // AfterburnerVault
196
- tx.object(this.addresses.objects.version), // Version
197
- tx.object(sui_1.Sui.constants.addresses.suiClockId), // Clock
198
- typeof stakeCoinId === "string"
199
- ? tx.object(stakeCoinId)
200
- : stakeCoinId, // Coin
201
- ],
202
- });
203
- };
204
- /**
205
- * @deprecated use withdrawPrincipalTxV2 instead
206
- * Creates a transaction to withdraw principal from a staked position (original version)
207
- * @param inputs Withdrawal parameters including transaction, position ID, pool ID, amount, and coin type
208
- * @returns Transaction object argument for the withdrawn Coin
209
- */
210
- this.withdrawPrincipalTxV1 = (inputs) => {
211
- const { tx } = inputs;
212
- return tx.moveCall({
213
- target: utils_1.Helpers.transactions.createTxTarget(this.addresses.packages.vaults, FarmsApi.constants.moduleNames.stakedPosition, "withdraw_principal"),
214
- typeArguments: [inputs.stakeCoinType],
215
- arguments: [
216
- tx.object(inputs.stakedPositionId), // StakedPosition
217
- tx.object(inputs.stakingPoolId), // AfterburnerVault
218
- tx.object(sui_1.Sui.constants.addresses.suiClockId), // Clock
219
- tx.pure.u64(inputs.withdrawAmount),
220
- ],
221
- });
222
- };
223
- /**
224
- * Creates a transaction to withdraw principal from a staked position
225
- * @param inputs Withdrawal parameters including transaction, position ID, pool ID, amount, and coin type
226
- * @returns Transaction object argument for the withdrawn Coin
227
- */
228
- this.withdrawPrincipalTxV2 = (inputs) => {
229
- const { tx } = inputs;
230
- return tx.moveCall({
231
- target: utils_1.Helpers.transactions.createTxTarget(this.addresses.packages.vaultsV2, FarmsApi.constants.moduleNames.stakedPosition, "withdraw_principal"),
232
- typeArguments: [inputs.stakeCoinType],
233
- arguments: [
234
- tx.object(inputs.stakedPositionId), // StakedPosition
235
- tx.object(inputs.stakingPoolId), // AfterburnerVault
236
- tx.object(this.addresses.objects.version), // Version
237
- tx.object(sui_1.Sui.constants.addresses.suiClockId), // Clock
238
- tx.pure.u64(inputs.withdrawAmount),
239
- ],
240
- });
241
- };
242
- /**
243
- * @deprecated use destroyStakedPositionTxV2 instead
244
- * Creates a transaction to destroy a staked position (original version)
245
- * @param inputs Destroy parameters including transaction, position ID, pool ID, and coin type
246
- * @returns Transaction command to destroy the position
247
- */
248
- this.destroyStakedPositionTxV1 = (inputs) => {
249
- const { tx } = inputs;
250
- return tx.moveCall({
251
- target: utils_1.Helpers.transactions.createTxTarget(this.addresses.packages.vaults, FarmsApi.constants.moduleNames.stakedPosition, "destroy"),
252
- typeArguments: [inputs.stakeCoinType],
253
- arguments: [
254
- tx.object(inputs.stakedPositionId), // StakedPosition
255
- tx.object(inputs.stakingPoolId), // AfterburnerVault
256
- tx.object(sui_1.Sui.constants.addresses.suiClockId), // Clock
257
- ],
258
- });
259
- };
260
- /**
261
- * Creates a transaction to destroy a staked position
262
- * @param inputs Destroy parameters including transaction, position ID, and coin type
263
- * @returns Transaction command to destroy the position
264
- */
265
- this.destroyStakedPositionTxV2 = (inputs) => {
266
- const { tx } = inputs;
267
- return tx.moveCall({
268
- target: utils_1.Helpers.transactions.createTxTarget(this.addresses.packages.vaultsV2, FarmsApi.constants.moduleNames.stakedPosition, "destroy"),
269
- typeArguments: [inputs.stakeCoinType],
270
- arguments: [
271
- tx.object(inputs.stakedPositionId), // StakedPosition
272
- tx.object(this.addresses.objects.version), // Version
273
- ],
274
- });
275
- };
276
- /**
277
- * @deprecated use updatePositionTxV2 instead
278
- * Creates a transaction to update a staked position, recalculating rewards (original version)
279
- * @param inputs Update parameters including transaction, position ID, pool ID, and coin type
280
- * @returns Transaction command to update the position
281
- */
282
- this.updatePositionTxV1 = (inputs) => {
283
- const { tx } = inputs;
284
- return tx.moveCall({
285
- target: utils_1.Helpers.transactions.createTxTarget(this.addresses.packages.vaults, FarmsApi.constants.moduleNames.stakedPosition, "update_position"),
286
- typeArguments: [inputs.stakeCoinType],
287
- arguments: [
288
- tx.object(inputs.stakedPositionId), // StakedPosition
289
- tx.object(inputs.stakingPoolId), // AfterburnerVault
290
- tx.object(sui_1.Sui.constants.addresses.suiClockId), // Clock
291
- ],
292
- });
293
- };
294
- /**
295
- * Creates a transaction to update a staked position, recalculating rewards
296
- * @param inputs Update parameters including transaction, position ID, pool ID, and coin type
297
- * @returns Transaction command to update the position
298
- */
299
- this.updatePositionTxV2 = (inputs) => {
300
- const { tx } = inputs;
301
- return tx.moveCall({
302
- target: utils_1.Helpers.transactions.createTxTarget(this.addresses.packages.vaultsV2, FarmsApi.constants.moduleNames.stakedPosition, "update_position"),
303
- typeArguments: [inputs.stakeCoinType],
304
- arguments: [
305
- tx.object(inputs.stakedPositionId), // StakedPosition
306
- tx.object(inputs.stakingPoolId), // AfterburnerVault
307
- tx.object(this.addresses.objects.version), // Version
308
- tx.object(sui_1.Sui.constants.addresses.suiClockId), // Clock
309
- ],
310
- });
311
- };
312
- // =========================================================================
313
- // Locking Transaction Commands
314
- // =========================================================================
315
- /**
316
- * @deprecated use lockTxV2 instead
317
- * Creates a transaction to lock a staked position for a specific duration (original version)
318
- * @param inputs Lock parameters including transaction, position ID, pool ID, lock duration, and coin type
319
- * @returns Transaction command to lock the position
320
- */
321
- this.lockTxV1 = (inputs) => {
322
- const { tx } = inputs;
323
- return tx.moveCall({
324
- target: utils_1.Helpers.transactions.createTxTarget(this.addresses.packages.vaults, FarmsApi.constants.moduleNames.stakedPosition, "lock"),
325
- typeArguments: [inputs.stakeCoinType],
326
- arguments: [
327
- tx.object(inputs.stakedPositionId), // StakedPosition
328
- tx.object(inputs.stakingPoolId), // AfterburnerVault
329
- tx.object(sui_1.Sui.constants.addresses.suiClockId), // Clock
330
- tx.pure.u64(inputs.lockDurationMs),
331
- ],
332
- });
333
- };
334
- /**
335
- * Creates a transaction to lock a staked position for a specific duration
336
- * @param inputs Lock parameters including transaction, position ID, pool ID, lock duration, and coin type
337
- * @returns Transaction command to lock the position
338
- */
339
- this.lockTxV2 = (inputs) => {
340
- const { tx } = inputs;
341
- return tx.moveCall({
342
- target: utils_1.Helpers.transactions.createTxTarget(this.addresses.packages.vaultsV2, FarmsApi.constants.moduleNames.stakedPosition, "lock"),
343
- typeArguments: [inputs.stakeCoinType],
344
- arguments: [
345
- tx.object(inputs.stakedPositionId), // StakedPosition
346
- tx.object(inputs.stakingPoolId), // AfterburnerVault
347
- tx.object(this.addresses.objects.version), // Version
348
- tx.object(sui_1.Sui.constants.addresses.suiClockId), // Clock
349
- tx.pure.u64(inputs.lockDurationMs),
350
- ],
351
- });
352
- };
353
- /**
354
- * @deprecated use renewLockTxV2 instead
355
- * Creates a transaction to renew the lock on a staked position (original version)
356
- * @param inputs Renew lock parameters including transaction, position ID, pool ID, and coin type
357
- * @returns Transaction command to renew the lock
358
- */
359
- this.renewLockTxV1 = (inputs) => {
360
- const { tx } = inputs;
361
- return tx.moveCall({
362
- target: utils_1.Helpers.transactions.createTxTarget(this.addresses.packages.vaults, FarmsApi.constants.moduleNames.stakedPosition, "renew_lock"),
363
- typeArguments: [inputs.stakeCoinType],
364
- arguments: [
365
- tx.object(inputs.stakedPositionId), // StakedPosition
366
- tx.object(inputs.stakingPoolId), // AfterburnerVault
367
- tx.object(sui_1.Sui.constants.addresses.suiClockId), // Clock
368
- ],
369
- });
370
- };
371
- /**
372
- * Creates a transaction to renew the lock on a staked position
373
- * @param inputs Renew lock parameters including transaction, position ID, pool ID, and coin type
374
- * @returns Transaction command to renew the lock
375
- */
376
- this.renewLockTxV2 = (inputs) => {
377
- const { tx } = inputs;
378
- return tx.moveCall({
379
- target: utils_1.Helpers.transactions.createTxTarget(this.addresses.packages.vaultsV2, FarmsApi.constants.moduleNames.stakedPosition, "renew_lock"),
380
- typeArguments: [inputs.stakeCoinType],
381
- arguments: [
382
- tx.object(inputs.stakedPositionId), // StakedPosition
383
- tx.object(inputs.stakingPoolId), // AfterburnerVault
384
- tx.object(sui_1.Sui.constants.addresses.suiClockId), // Clock
385
- tx.object(this.addresses.objects.version), // Version
386
- ],
387
- });
388
- };
389
- /**
390
- * @deprecated use unlockTxV2 instead
391
- * Creates a transaction to unlock a staked position (original version)
392
- * @param inputs Unlock parameters including transaction, position ID, pool ID, and coin type
393
- * @returns Transaction command to unlock the position
394
- */
395
- this.unlockTxV1 = (inputs) => {
396
- const { tx } = inputs;
397
- return tx.moveCall({
398
- target: utils_1.Helpers.transactions.createTxTarget(this.addresses.packages.vaults, FarmsApi.constants.moduleNames.stakedPosition, "unlock"),
399
- typeArguments: [inputs.stakeCoinType],
400
- arguments: [
401
- tx.object(inputs.stakedPositionId), // StakedPosition
402
- tx.object(inputs.stakingPoolId), // AfterburnerVault
403
- tx.object(sui_1.Sui.constants.addresses.suiClockId), // Clock
404
- ],
405
- });
406
- };
407
- /**
408
- * Creates a transaction to unlock a staked position
409
- * @param inputs Unlock parameters including transaction, position ID, pool ID, and coin type
410
- * @returns Transaction command to unlock the position
411
- */
412
- this.unlockTxV2 = (inputs) => {
413
- const { tx } = inputs;
414
- return tx.moveCall({
415
- target: utils_1.Helpers.transactions.createTxTarget(this.addresses.packages.vaultsV2, FarmsApi.constants.moduleNames.stakedPosition, "unlock"),
416
- typeArguments: [inputs.stakeCoinType],
417
- arguments: [
418
- tx.object(inputs.stakedPositionId), // StakedPosition
419
- tx.object(inputs.stakingPoolId), // AfterburnerVault
420
- tx.object(this.addresses.objects.version), // Version
421
- tx.object(sui_1.Sui.constants.addresses.suiClockId), // Clock
422
- ],
423
- });
424
- };
425
- // =========================================================================
426
- // Reward Harvesting Transaction Commands
427
- // =========================================================================
428
- /**
429
- * @deprecated use beginHarvestTxV2 instead
430
- * Creates a transaction to begin the reward harvesting process (original version)
431
- * @param inputs Begin harvest parameters including transaction, pool ID, and coin type
432
- * @returns Transaction object argument for the harvest metadata
433
- */
434
- this.beginHarvestTxV1 = (inputs) => {
435
- const { tx } = inputs;
436
- return tx.moveCall({
437
- target: utils_1.Helpers.transactions.createTxTarget(this.addresses.packages.vaults, FarmsApi.constants.moduleNames.stakedPosition, "begin_harvest"),
438
- typeArguments: [inputs.stakeCoinType],
439
- arguments: [
440
- tx.object(inputs.stakingPoolId), // AfterburnerVault
441
- ],
442
- });
443
- };
444
- /**
445
- * Creates a transaction to begin the reward harvesting process
446
- * @param inputs Begin harvest parameters including transaction, position ID, pool ID, and coin type
447
- * @returns Transaction object argument for the harvest cap
448
- */
449
- this.beginHarvestTxV2 = (inputs) => {
450
- const { tx } = inputs;
451
- return tx.moveCall({
452
- target: utils_1.Helpers.transactions.createTxTarget(this.addresses.packages.vaultsV2, FarmsApi.constants.moduleNames.stakedPosition, "begin_harvest_tx"),
453
- typeArguments: [inputs.stakeCoinType],
454
- arguments: [
455
- tx.object(inputs.stakedPositionId), // StakedPosition
456
- tx.object(inputs.stakingPoolId), // AfterburnerVault
457
- tx.object(this.addresses.objects.version), // Version
458
- ],
459
- });
460
- };
461
- /**
462
- * @deprecated use harvestRewardsTxV2 instead
463
- * Creates a transaction to harvest rewards from a staked position (original version)
464
- * @param inputs Harvest parameters including transaction, position ID, pool ID, harvest metadata, stake coin type, and reward coin type
465
- * @returns Transaction object argument for the harvested rewards
466
- */
467
- this.harvestRewardsTxV1 = (inputs) => {
468
- const { tx, harvestedRewardsEventMetadataId } = inputs;
469
- return tx.moveCall({
470
- target: utils_1.Helpers.transactions.createTxTarget(this.addresses.packages.vaults, FarmsApi.constants.moduleNames.stakedPosition, "harvest_rewards"),
471
- typeArguments: [inputs.stakeCoinType, inputs.rewardCoinType],
472
- arguments: [
473
- tx.object(inputs.stakedPositionId), // StakedPosition
474
- tx.object(inputs.stakingPoolId), // AfterburnerVault
475
- typeof harvestedRewardsEventMetadataId === "string"
476
- ? tx.object(harvestedRewardsEventMetadataId)
477
- : harvestedRewardsEventMetadataId, // HarvestedRewardsEventMetadata
478
- tx.object(sui_1.Sui.constants.addresses.suiClockId), // Clock
479
- ],
480
- });
481
- };
482
- /**
483
- * Creates a transaction to harvest rewards from a staked position
484
- * @param inputs Harvest parameters including transaction, harvest cap, position ID, pool ID, stake coin type, and reward coin type
485
- * @returns Transaction object argument for the harvested rewards
486
- */
487
- this.harvestRewardsTxV2 = (inputs) => {
488
- const { tx, harvestRewardsCap } = inputs;
489
- return tx.moveCall({
490
- target: utils_1.Helpers.transactions.createTxTarget(this.addresses.packages.vaultsV2, FarmsApi.constants.moduleNames.stakedPosition, "harvest_rewards"),
491
- typeArguments: [inputs.stakeCoinType, inputs.rewardCoinType],
492
- arguments: [
493
- typeof harvestRewardsCap === "string"
494
- ? tx.object(harvestRewardsCap)
495
- : harvestRewardsCap, // HarvestRewardsCap
496
- tx.object(inputs.stakedPositionId), // StakedPosition
497
- tx.object(inputs.stakingPoolId), // AfterburnerVault
498
- tx.object(this.addresses.objects.version), // Version
499
- tx.object(sui_1.Sui.constants.addresses.suiClockId), // Clock
500
- ],
501
- });
502
- };
503
- /**
504
- * @deprecated use endHarvestTxV2 instead
505
- * Creates a transaction to end the reward harvesting process (original version)
506
- * @param inputs End harvest parameters including transaction and harvest metadata
507
- * @returns Transaction command to end the harvest
508
- */
509
- this.endHarvestTxV1 = (inputs) => {
510
- const { tx, harvestedRewardsEventMetadataId } = inputs;
511
- return tx.moveCall({
512
- target: utils_1.Helpers.transactions.createTxTarget(this.addresses.packages.vaults, FarmsApi.constants.moduleNames.stakedPosition, "end_harvest"),
513
- typeArguments: [],
514
- arguments: [
515
- typeof harvestedRewardsEventMetadataId === "string"
516
- ? tx.object(harvestedRewardsEventMetadataId)
517
- : harvestedRewardsEventMetadataId, // HarvestedRewardsEventMetadata
518
- ],
519
- });
520
- };
521
- /**
522
- * Creates a transaction to end the reward harvesting process
523
- * @param inputs End harvest parameters including transaction and harvest cap
524
- * @returns Transaction command to end the harvest
525
- */
526
- this.endHarvestTxV2 = (inputs) => {
527
- const { tx, harvestRewardsCap } = inputs;
528
- return tx.moveCall({
529
- target: utils_1.Helpers.transactions.createTxTarget(this.addresses.packages.vaultsV2, FarmsApi.constants.moduleNames.stakedPosition, "end_harvest_tx"),
530
- typeArguments: [],
531
- arguments: [
532
- typeof harvestRewardsCap === "string"
533
- ? tx.object(harvestRewardsCap)
534
- : harvestRewardsCap, // HarvestRewardsCap
535
- tx.object(this.addresses.objects.version), // Version
536
- ],
537
- });
538
- };
539
- // =========================================================================
540
- // Staking Pool Creation Transaction Commands
541
- // =========================================================================
542
- /**
543
- * @deprecated use newStakingPoolTxV2 instead
544
- * Creates a transaction for the deprecated version of staking pool creation
545
- * @param inputs Pool creation parameters including transaction, lock enforcement, durations, multiplier, stake amount, and coin type
546
- * @returns Transaction objects for the vault and owner cap
547
- */
548
- this.newStakingPoolTxV1 = (inputs) => {
549
- const { tx } = inputs;
550
- return tx.moveCall({
551
- target: utils_1.Helpers.transactions.createTxTarget(this.addresses.packages.vaults, FarmsApi.constants.moduleNames.vaultV1, "new"),
552
- typeArguments: [inputs.stakeCoinType],
553
- arguments: [
554
- tx.pure.u64(inputs.lockEnforcement === "Strict" ? 0 : 1),
555
- tx.pure.u64(inputs.minLockDurationMs),
556
- tx.pure.u64(inputs.maxLockDurationMs),
557
- tx.pure.u64(inputs.maxLockMultiplier),
558
- tx.pure.u64(inputs.minStakeAmount),
559
- ],
560
- });
561
- };
562
- /**
563
- * Creates a transaction for the current version of staking pool creation
564
- * @param inputs Pool creation parameters including transaction, lock enforcements array, durations, multiplier, stake amount, and coin type
565
- * @returns Transaction objects for the vault and authority cap
566
- */
567
- this.newStakingPoolTxV2 = (inputs) => {
568
- const { tx } = inputs;
569
- return tx.moveCall({
570
- target: utils_1.Helpers.transactions.createTxTarget(this.addresses.packages.vaultsV2, FarmsApi.constants.moduleNames.vaultV2, "new"),
571
- typeArguments: [inputs.stakeCoinType],
572
- arguments: [
573
- tx.object(this.addresses.objects.version),
574
- tx.pure.vector("u8", inputs.lockEnforcements.map((lockEnforcement) => lockEnforcement === "Strict" ? 0 : 1)),
575
- tx.pure.u64(inputs.minLockDurationMs),
576
- tx.pure.u64(inputs.maxLockDurationMs),
577
- tx.pure.u64(inputs.maxLockMultiplier),
578
- tx.pure.u64(inputs.minStakeAmount),
579
- ],
580
- });
581
- };
582
- /**
583
- * @deprecated use shareStakingPoolTxV2 instead
584
- * Creates a transaction to share a staking pool, making it public
585
- * @param inputs Share pool parameters including transaction, pool ID, and coin type
586
- * @returns Transaction command to share the pool
587
- */
588
- this.shareStakingPoolTxV1 = (inputs) => {
589
- const { tx, stakingPoolId } = inputs;
590
- return tx.moveCall({
591
- target: utils_1.Helpers.transactions.createTxTarget(this.addresses.packages.vaults, FarmsApi.constants.moduleNames.vaultV1, "share_vault"),
592
- typeArguments: [inputs.stakeCoinType],
593
- arguments: [
594
- typeof stakingPoolId === "string"
595
- ? tx.object(stakingPoolId)
596
- : stakingPoolId, // AfterburnerVault
597
- ],
598
- });
599
- };
600
- /**
601
- * Creates a transaction to share a staking pool, making it public
602
- * @param inputs Share pool parameters including transaction, pool ID, and coin type
603
- * @returns Transaction command to share the pool
604
- */
605
- this.shareStakingPoolTxV2 = (inputs) => {
606
- const { tx, stakingPoolId } = inputs;
607
- return tx.moveCall({
608
- target: utils_1.Helpers.transactions.createTxTarget(this.addresses.packages.vaultsV2, FarmsApi.constants.moduleNames.vaultV2, "share"),
609
- typeArguments: [inputs.stakeCoinType],
610
- arguments: [
611
- typeof stakingPoolId === "string"
612
- ? tx.object(stakingPoolId)
613
- : stakingPoolId, // AfterburnerVault
614
- ],
615
- });
616
- };
617
- /**
618
- * @deprecated use transferOwnerCapTxV2 instead
619
- * Creates a transaction to transfer ownership of a staking pool
620
- * @param inputs Transfer parameters including transaction, owner cap ID, and recipient address
621
- * @returns Transaction command to transfer the owner cap
622
- */
623
- this.transferOwnerCapTxV1 = (inputs) => {
624
- const { tx, ownerCapId } = inputs;
625
- return tx.moveCall({
626
- target: utils_1.Helpers.transactions.createTxTarget(this.addresses.packages.vaults, FarmsApi.constants.moduleNames.vaultV1, "transfer_owner_cap"),
627
- typeArguments: [],
628
- arguments: [
629
- typeof ownerCapId === "string"
630
- ? tx.object(ownerCapId)
631
- : ownerCapId, // OwnerCap
632
- tx.pure.address(inputs.recipientAddress),
633
- ],
634
- });
635
- };
636
- /**
637
- * @deprecated use grantOneTimeAdminCapTxV2 instead
638
- * Creates a transaction to grant a one-time admin capability for a staking pool (original version)
639
- * @param inputs Grant parameters including transaction, owner cap ID, recipient address, and reward coin type
640
- * @returns Transaction command to grant the one-time admin cap
641
- */
642
- this.grantOneTimeAdminCapTxV1 = (inputs) => {
643
- const { tx, ownerCapId } = inputs;
644
- return tx.moveCall({
645
- target: utils_1.Helpers.transactions.createTxTarget(this.addresses.packages.vaults, FarmsApi.constants.moduleNames.vaultV1, "grant_one_time_admin_cap"),
646
- typeArguments: [inputs.rewardCoinType],
647
- arguments: [
648
- typeof ownerCapId === "string"
649
- ? tx.object(ownerCapId)
650
- : ownerCapId, // OwnerCap
651
- tx.pure.address(inputs.recipientAddress),
652
- ],
653
- });
654
- };
655
- /**
656
- * Creates a transaction to grant a one-time admin capability for a staking pool
657
- * @param inputs Grant parameters including transaction, owner cap ID, recipient address, and reward coin type
658
- * @returns Transaction command to grant the one-time admin cap
659
- */
660
- this.grantOneTimeAdminCapTxV2 = (inputs) => {
661
- const { tx, ownerCapId } = inputs;
662
- return tx.moveCall({
663
- target: utils_1.Helpers.transactions.createTxTarget(this.addresses.packages.vaultsV2, FarmsApi.constants.moduleNames.vaultV2, "grant_one_time_admin_cap"),
664
- typeArguments: [inputs.rewardCoinType],
665
- arguments: [
666
- typeof ownerCapId === "string"
667
- ? tx.object(ownerCapId)
668
- : ownerCapId, // OwnerCap
669
- tx.object(this.addresses.objects.version), // Version
670
- tx.pure.address(inputs.recipientAddress),
671
- ],
672
- });
673
- };
674
- // =========================================================================
675
- // Staking Pool Mutation Transaction Commands
676
- // =========================================================================
677
- /**
678
- * @deprecated use initializeStakingPoolRewardTxV2 instead
679
- * Creates a transaction to initialize rewards for a staking pool (original version)
680
- * @param inputs Initialize reward parameters including transaction, pool ID, reward coin ID, emission parameters, stake coin type, and reward coin type
681
- * @returns Transaction command to initialize the reward
682
- */
683
- this.initializeStakingPoolRewardTxV1 = (inputs) => {
684
- const { tx, rewardCoinId } = inputs;
685
- const isOneTimeAdminCap = FarmsApi.isFarmOneTimeAdminCapId(inputs);
686
- const capId = FarmsApi.farmCapId(inputs);
687
- return tx.moveCall({
688
- target: utils_1.Helpers.transactions.createTxTarget(this.addresses.packages.vaults, FarmsApi.constants.moduleNames.vaultV1, isOneTimeAdminCap
689
- ? "initialize_reward_and_consume_admin_cap"
690
- : "initialize_reward"),
691
- typeArguments: [inputs.stakeCoinType, inputs.rewardCoinType],
692
- arguments: [
693
- tx.object(capId), // OwnerCap / OneTimeAdminCap
694
- tx.object(inputs.stakingPoolId), // AfterburnerVault
695
- tx.object(sui_1.Sui.constants.addresses.suiClockId), // Clock
696
- typeof rewardCoinId === "string"
697
- ? tx.object(rewardCoinId)
698
- : rewardCoinId, // Coin
699
- tx.pure.u64(inputs.emissionScheduleMs),
700
- tx.pure.u64(inputs.emissionRate),
701
- tx.pure.u64(inputs.emissionDelayTimestampMs),
702
- ],
703
- });
704
- };
705
- /**
706
- * Creates a transaction to initialize rewards for a staking pool
707
- * @param inputs Initialize reward parameters including transaction, pool ID, reward coin ID, emission parameters, stake coin type, and reward coin type
708
- * @returns Transaction command to initialize the reward
709
- */
710
- this.initializeStakingPoolRewardTxV2 = (inputs) => {
711
- const { tx, rewardCoinId } = inputs;
712
- const isOneTimeAdminCap = FarmsApi.isFarmOneTimeAdminCapId(inputs);
713
- const capId = FarmsApi.farmCapId(inputs);
714
- return tx.moveCall({
715
- target: utils_1.Helpers.transactions.createTxTarget(this.addresses.packages.vaultsV2, FarmsApi.constants.moduleNames.vaultV2, isOneTimeAdminCap
716
- ? "initialize_reward_and_consume_admin_cap"
717
- : "initialize_reward"),
718
- typeArguments: [inputs.stakeCoinType, inputs.rewardCoinType],
719
- arguments: [
720
- tx.object(capId), // OwnerCap / OneTimeAdminCap
721
- tx.object(inputs.stakingPoolId), // AfterburnerVault
722
- tx.object(this.addresses.objects.version), // Version
723
- tx.object(sui_1.Sui.constants.addresses.suiClockId), // Clock
724
- typeof rewardCoinId === "string"
725
- ? tx.object(rewardCoinId)
726
- : rewardCoinId, // Coin
727
- tx.pure.u64(inputs.emissionScheduleMs),
728
- tx.pure.u64(inputs.emissionRate),
729
- tx.pure.u64(inputs.emissionDelayTimestampMs),
730
- ],
731
- });
732
- };
733
- /**
734
- * @deprecated use topUpStakingPoolRewardTxV2 instead
735
- * Creates a transaction to add more rewards to a staking pool (original version)
736
- * @param inputs Top up parameters including transaction, pool ID, reward coin ID, stake coin type, and reward coin type
737
- * @returns Transaction command to add rewards
738
- */
739
- this.topUpStakingPoolRewardTxV1 = (inputs) => {
740
- const { tx, rewardCoinId } = inputs;
741
- const isOneTimeAdminCap = FarmsApi.isFarmOneTimeAdminCapId(inputs);
742
- const capId = FarmsApi.farmCapId(inputs);
743
- return tx.moveCall({
744
- target: utils_1.Helpers.transactions.createTxTarget(this.addresses.packages.vaults, FarmsApi.constants.moduleNames.vaultV1, isOneTimeAdminCap
745
- ? "add_reward_and_consume_admin_cap"
746
- : "add_reward"),
747
- typeArguments: [inputs.stakeCoinType, inputs.rewardCoinType],
748
- arguments: [
749
- tx.object(capId), // OwnerCap / OneTimeAdminCap
750
- tx.object(inputs.stakingPoolId), // AfterburnerVault
751
- typeof rewardCoinId === "string"
752
- ? tx.object(rewardCoinId)
753
- : rewardCoinId, // Coin
754
- ],
755
- });
756
- };
757
- /**
758
- * Creates a transaction to add more rewards to a staking pool
759
- * @param inputs Top up parameters including transaction, pool ID, reward coin ID, stake coin type, and reward coin type
760
- * @returns Transaction command to add rewards
761
- */
762
- this.topUpStakingPoolRewardTxV2 = (inputs) => {
763
- const { tx, rewardCoinId } = inputs;
764
- const isOneTimeAdminCap = FarmsApi.isFarmOneTimeAdminCapId(inputs);
765
- const capId = FarmsApi.farmCapId(inputs);
766
- return tx.moveCall({
767
- target: utils_1.Helpers.transactions.createTxTarget(this.addresses.packages.vaultsV2, FarmsApi.constants.moduleNames.vaultV2, isOneTimeAdminCap
768
- ? "add_reward_and_consume_admin_cap"
769
- : "add_reward"),
770
- typeArguments: [inputs.stakeCoinType, inputs.rewardCoinType],
771
- arguments: [
772
- tx.object(capId), // OwnerCap / OneTimeAdminCap
773
- tx.object(inputs.stakingPoolId), // AfterburnerVault
774
- tx.object(this.addresses.objects.version), // Version
775
- typeof rewardCoinId === "string"
776
- ? tx.object(rewardCoinId)
777
- : rewardCoinId, // Coin
778
- ],
779
- });
780
- };
781
- /**
782
- * @deprecated use increaseStakingPoolRewardEmissionsTxV2 instead
783
- * Creates a transaction to increase the emission rate for a staking pool reward (original version)
784
- * @param inputs Increase emissions parameters including transaction, owner cap ID, pool ID, emission parameters, stake coin type, and reward coin type
785
- * @returns Transaction command to update emissions
786
- */
787
- this.increaseStakingPoolRewardEmissionsTxV1 = (inputs) => {
788
- const { tx } = inputs;
789
- return tx.moveCall({
790
- target: utils_1.Helpers.transactions.createTxTarget(this.addresses.packages.vaults, FarmsApi.constants.moduleNames.vaultV1, "update_emissions_for"),
791
- typeArguments: [inputs.stakeCoinType, inputs.rewardCoinType],
792
- arguments: [
793
- tx.object(inputs.ownerCapId), // OwnerCap
794
- tx.object(inputs.stakingPoolId), // AfterburnerVault
795
- tx.object(sui_1.Sui.constants.addresses.suiClockId), // Clock
796
- tx.pure.u64(inputs.emissionScheduleMs),
797
- tx.pure.u64(inputs.emissionRate),
798
- ],
799
- });
800
- };
801
- /**
802
- * Creates a transaction to increase the emission rate for a staking pool reward
803
- * @param inputs Increase emissions parameters including transaction, owner cap ID, pool ID, emission parameters, stake coin type, and reward coin type
804
- * @returns Transaction command to update emissions
805
- */
806
- this.increaseStakingPoolRewardEmissionsTxV2 = (inputs) => {
807
- const { tx } = inputs;
808
- return tx.moveCall({
809
- target: utils_1.Helpers.transactions.createTxTarget(this.addresses.packages.vaultsV2, FarmsApi.constants.moduleNames.vaultV2, "update_emission_schedule"),
810
- typeArguments: [inputs.stakeCoinType, inputs.rewardCoinType],
811
- arguments: [
812
- tx.object(inputs.ownerCapId), // OwnerCap
813
- tx.object(inputs.stakingPoolId), // AfterburnerVault
814
- tx.object(this.addresses.objects.version), // Version
815
- tx.object(sui_1.Sui.constants.addresses.suiClockId), // Clock
816
- tx.pure.u64(inputs.emissionScheduleMs),
817
- tx.pure.u64(inputs.emissionRate),
818
- ],
819
- });
820
- };
821
- /**
822
- * @deprecated use setStakingPoolMinStakeAmountTxV2 instead
823
- * Creates a transaction to set the minimum stake amount for a staking pool (original version)
824
- * @param inputs Min stake amount parameters including transaction, owner cap ID, pool ID, minimum amount, and stake coin type
825
- * @returns Transaction command to set the minimum stake amount
826
- */
827
- this.setStakingPoolMinStakeAmountTxV1 = (inputs) => {
828
- const { tx } = inputs;
829
- return tx.moveCall({
830
- target: utils_1.Helpers.transactions.createTxTarget(this.addresses.packages.vaults, FarmsApi.constants.moduleNames.vaultV1, "set_min_stake_amount"),
831
- typeArguments: [inputs.stakeCoinType],
832
- arguments: [
833
- tx.object(inputs.ownerCapId), // OwnerCap
834
- tx.object(inputs.stakingPoolId), // AfterburnerVault
835
- tx.pure.u64(inputs.minStakeAmount),
836
- ],
837
- });
838
- };
839
- /**
840
- * Creates a transaction to set the minimum stake amount for a staking pool
841
- * @param inputs Min stake amount parameters including transaction, owner cap ID, pool ID, minimum amount, and stake coin type
842
- * @returns Transaction command to set the minimum stake amount
843
- */
844
- this.setStakingPoolMinStakeAmountTxV2 = (inputs) => {
845
- const { tx } = inputs;
846
- return tx.moveCall({
847
- target: utils_1.Helpers.transactions.createTxTarget(this.addresses.packages.vaultsV2, FarmsApi.constants.moduleNames.vaultV2, "set_min_stake_amount"),
848
- typeArguments: [inputs.stakeCoinType],
849
- arguments: [
850
- tx.object(inputs.ownerCapId), // OwnerCap
851
- tx.object(inputs.stakingPoolId), // AfterburnerVault
852
- tx.object(this.addresses.objects.version), // Version
853
- tx.pure.u64(inputs.minStakeAmount),
854
- ],
855
- });
856
- };
857
- /**
858
- * Creates a Move call (V1) to **remove undistributed reward coins** from a staking pool.
859
- * Only callable by the pool **owner** (validated via `ownerCapId`). This does not claw back
860
- * rewards already accrued/claimed by stakers—only reduces the remaining reward balance
861
- * for the specified `rewardCoinType`.
862
- *
863
- * @param inputs Transaction assembly parameters
864
- * @param inputs.tx Transaction instance to append the command to
865
- * @param inputs.ownerCapId OwnerCap object ID authorizing the removal
866
- * @param inputs.stakingPoolId The staking pool (vault) object ID
867
- * @param inputs.rewardAmount Amount to remove (base units, encoded as u64)
868
- * @param inputs.stakeCoinType Stake coin type argument for the vault module
869
- * @param inputs.rewardCoinType Reward coin type to be removed
870
- * @returns The transaction command added to `tx`
871
- */
872
- this.removeStakingPoolRewardTxV1 = (inputs) => {
873
- const { tx } = inputs;
874
- return tx.moveCall({
875
- target: utils_1.Helpers.transactions.createTxTarget(this.addresses.packages.vaults, FarmsApi.constants.moduleNames.vaultV1, "remove_reward"),
876
- typeArguments: [inputs.stakeCoinType, inputs.rewardCoinType],
877
- arguments: [
878
- tx.object(inputs.ownerCapId), // OwnerCap
879
- tx.object(inputs.stakingPoolId), // AfterburnerVault
880
- tx.pure.u64(inputs.rewardAmount),
881
- ],
882
- });
883
- };
884
- /**
885
- * Creates a Move call (V2) to **remove undistributed reward coins** from a staking pool.
886
- * Only callable by the pool **owner** (validated via `ownerCapId`). Includes the protocol
887
- * `version` object as required by V2 modules.
888
- *
889
- * @param inputs Transaction assembly parameters
890
- * @param inputs.tx Transaction instance to append the command to
891
- * @param inputs.ownerCapId OwnerCap object ID authorizing the removal
892
- * @param inputs.stakingPoolId The staking pool (vault) object ID
893
- * @param inputs.rewardAmount Amount to remove (base units, encoded as u64)
894
- * @param inputs.stakeCoinType Stake coin type argument for the vault module
895
- * @param inputs.rewardCoinType Reward coin type to be removed
896
- * @returns The transaction command added to `tx`
897
- */
898
- this.removeStakingPoolRewardTxV2 = (inputs) => {
899
- const { tx } = inputs;
900
- return tx.moveCall({
901
- target: utils_1.Helpers.transactions.createTxTarget(this.addresses.packages.vaultsV2, FarmsApi.constants.moduleNames.vaultV2, "remove_reward"),
902
- typeArguments: [inputs.stakeCoinType, inputs.rewardCoinType],
903
- arguments: [
904
- tx.object(inputs.ownerCapId), // OwnerCap
905
- tx.object(inputs.stakingPoolId), // AfterburnerVault
906
- tx.object(this.addresses.objects.version), // Version
907
- tx.pure.u64(inputs.rewardAmount),
908
- ],
909
- });
910
- };
911
- // =========================================================================
912
- // Staking Pool Inspection Transaction Commands
913
- // =========================================================================
914
- /**
915
- * Creates a transaction to check if a staking pool is unlocked
916
- * @param inputs Check parameters including transaction, pool ID, and coin type
917
- * @returns Transaction object argument for the boolean result
918
- */
919
- this.isVaultUnlockedTxV1 = (inputs) => {
920
- const { tx } = inputs;
921
- return tx.moveCall({
922
- target: utils_1.Helpers.transactions.createTxTarget(this.addresses.packages.vaults, FarmsApi.constants.moduleNames.vaultV1, "is_vault_unlocked"),
923
- typeArguments: [inputs.stakeCoinType],
924
- arguments: [
925
- tx.object(inputs.stakingPoolId), // AfterburnerVault
926
- ],
927
- });
928
- };
929
- /**
930
- * Creates a transaction to get the remaining rewards for a staking pool
931
- * @param inputs Remaining rewards parameters including transaction, pool ID, and coin type
932
- * @returns Transaction object argument for the vector of remaining rewards
933
- */
934
- this.remainingRewardsTxV1 = (inputs) => {
935
- const { tx } = inputs;
936
- return tx.moveCall({
937
- target: utils_1.Helpers.transactions.createTxTarget(this.addresses.packages.vaults, FarmsApi.constants.moduleNames.vaultV1, "remaining_rewards"),
938
- typeArguments: [inputs.stakeCoinType],
939
- arguments: [
940
- tx.object(inputs.stakingPoolId), // AfterburnerVault
941
- ],
942
- });
943
- };
944
- // =========================================================================
945
- // Transactions
946
- // =========================================================================
947
- // =========================================================================
948
- // Staking Transactions
949
- // =========================================================================
950
- /**
951
- * @deprecated use fetchBuildStakeTxV2 instead
952
- * Builds a complete transaction for staking coins
953
- * @param inputs Staking parameters including wallet address, lock enforcement, stake amount, pool ID, lock duration, and coin type
954
- * @returns Complete transaction ready for signing and execution
955
- */
956
- this.fetchBuildStakeTxV1 = (inputs) => __awaiter(this, void 0, void 0, function* () {
957
- const { walletAddress, isSponsoredTx } = inputs;
958
- const tx = new transactions_1.Transaction();
959
- tx.setSender(walletAddress);
960
- const stakeCoinId = yield this.Provider.Coin().fetchCoinWithAmountTx({
961
- tx,
962
- walletAddress,
963
- coinType: inputs.stakeCoinType,
964
- coinAmount: inputs.stakeAmount,
965
- isSponsoredTx,
966
- });
967
- const stakedPosition = this.stakeTxV1(Object.assign(Object.assign({}, inputs), { tx,
968
- stakeCoinId }));
969
- tx.transferObjects([stakedPosition], walletAddress);
970
- return tx;
971
- });
972
- /**
973
- * Builds a complete transaction for staking coins
974
- * @param inputs Staking parameters including wallet address, lock enforcement, stake amount, pool ID, lock duration, and coin type
975
- * @returns Complete transaction ready for signing and execution
976
- */
977
- this.fetchBuildStakeTxV2 = (inputs) => __awaiter(this, void 0, void 0, function* () {
978
- const { walletAddress, isSponsoredTx } = inputs;
979
- const tx = new transactions_1.Transaction();
980
- tx.setSender(walletAddress);
981
- const stakeCoinId = yield this.Provider.Coin().fetchCoinWithAmountTx({
982
- tx,
983
- walletAddress,
984
- coinType: inputs.stakeCoinType,
985
- coinAmount: inputs.stakeAmount,
986
- isSponsoredTx,
987
- });
988
- const stakedPosition = this.stakeTxV2(Object.assign(Object.assign({}, inputs), { tx,
989
- stakeCoinId, lockEnforcement: "Strict" }));
990
- tx.transferObjects([stakedPosition], walletAddress);
991
- return tx;
992
- });
993
- /**
994
- * @deprecated use fetchBuildDepositPrincipalTxV2 instead
995
- * Builds a complete transaction for depositing additional principal to a staked position
996
- * @param inputs Deposit parameters including wallet address, position ID, pool ID, deposit amount, and coin type
997
- * @returns Complete transaction ready for signing and execution
998
- */
999
- this.fetchBuildDepositPrincipalTxV1 = (inputs) => __awaiter(this, void 0, void 0, function* () {
1000
- const { walletAddress, isSponsoredTx } = inputs;
1001
- const tx = new transactions_1.Transaction();
1002
- tx.setSender(walletAddress);
1003
- const stakeCoinId = yield this.Provider.Coin().fetchCoinWithAmountTx({
1004
- tx,
1005
- walletAddress,
1006
- coinType: inputs.stakeCoinType,
1007
- coinAmount: inputs.depositAmount,
1008
- isSponsoredTx,
1009
- });
1010
- this.depositPrincipalTxV1(Object.assign(Object.assign({}, inputs), { tx,
1011
- stakeCoinId }));
1012
- return tx;
1013
- });
1014
- /**
1015
- * Builds a complete transaction for depositing additional principal to a staked position
1016
- * @param inputs Deposit parameters including wallet address, position ID, pool ID, deposit amount, and coin type
1017
- * @returns Complete transaction ready for signing and execution
1018
- */
1019
- this.fetchBuildDepositPrincipalTxV2 = (inputs) => __awaiter(this, void 0, void 0, function* () {
1020
- const { walletAddress, isSponsoredTx } = inputs;
1021
- const tx = new transactions_1.Transaction();
1022
- tx.setSender(walletAddress);
1023
- const stakeCoinId = yield this.Provider.Coin().fetchCoinWithAmountTx({
1024
- tx,
1025
- walletAddress,
1026
- coinType: inputs.stakeCoinType,
1027
- coinAmount: inputs.depositAmount,
1028
- isSponsoredTx,
1029
- });
1030
- this.depositPrincipalTxV2(Object.assign(Object.assign({}, inputs), { tx,
1031
- stakeCoinId }));
1032
- return tx;
1033
- });
1034
- /**
1035
- * @deprecated use buildWithdrawPrincipalTxV2 instead
1036
- * Builds a complete transaction for withdrawing principal from a staked position
1037
- * @param inputs Withdraw parameters including wallet address, position ID, pool ID, withdraw amount, and coin type
1038
- * @returns Complete transaction ready for signing and execution
1039
- */
1040
- this.buildWithdrawPrincipalTxV1 = (inputs) => {
1041
- const { walletAddress } = inputs;
1042
- const tx = new transactions_1.Transaction();
1043
- tx.setSender(walletAddress);
1044
- const withdrawnCoin = this.withdrawPrincipalTxV1(Object.assign(Object.assign({}, inputs), { tx }));
1045
- tx.transferObjects([withdrawnCoin], walletAddress);
1046
- return tx;
1047
- };
1048
- /**
1049
- * Builds a complete transaction for withdrawing principal from a staked position
1050
- * @param inputs Withdraw parameters including wallet address, position ID, pool ID, withdraw amount, and coin type
1051
- * @returns Complete transaction ready for signing and execution
1052
- */
1053
- this.buildWithdrawPrincipalTxV2 = (inputs) => {
1054
- const { walletAddress } = inputs;
1055
- const tx = new transactions_1.Transaction();
1056
- tx.setSender(walletAddress);
1057
- const withdrawnCoin = this.withdrawPrincipalTxV2(Object.assign(Object.assign({}, inputs), { tx }));
1058
- tx.transferObjects([withdrawnCoin], walletAddress);
1059
- return tx;
1060
- };
1061
- /**
1062
- * @deprecated use buildUnstakeTxV2 instead
1063
- * Builds a complete transaction for unstaking (withdrawing and destroying a position)
1064
- * @param inputs Unstake parameters including wallet address, position ID, pool ID, reward coin types, and coin type
1065
- * @returns Complete transaction ready for signing and execution
1066
- */
1067
- this.buildUnstakeTxV1 = (inputs) => {
1068
- const { walletAddress } = inputs;
1069
- let tx;
1070
- if (inputs.rewardCoinTypes.length > 0) {
1071
- // harvest rewards
1072
- tx = this.buildHarvestRewardsTxV1(Object.assign(Object.assign({}, inputs), { stakedPositionIds: [inputs.stakedPositionId] }));
1073
- }
1074
- else {
1075
- // no rewards to harvest
1076
- tx = new transactions_1.Transaction();
1077
- tx.setSender(walletAddress);
1078
- }
1079
- // withdraw principal
1080
- const withdrawnCoin = this.withdrawPrincipalTxV1(Object.assign(Object.assign({}, inputs), { tx }));
1081
- tx.transferObjects([withdrawnCoin], walletAddress);
1082
- // destroy position
1083
- this.destroyStakedPositionTxV1({
1084
- tx,
1085
- stakingPoolId: inputs.stakingPoolId,
1086
- stakedPositionId: inputs.stakedPositionId,
1087
- stakeCoinType: inputs.stakeCoinType,
1088
- });
1089
- return tx;
1090
- };
1091
- /**
1092
- * Builds a complete transaction for unstaking (withdrawing and destroying a position)
1093
- * @param inputs Unstake parameters including wallet address, position ID, pool ID, reward coin types, and coin type
1094
- * @returns Complete transaction ready for signing and execution
1095
- */
1096
- this.buildUnstakeTxV2 = (inputs) => {
1097
- const { walletAddress } = inputs;
1098
- let tx;
1099
- if (inputs.rewardCoinTypes.length > 0) {
1100
- // harvest rewards
1101
- tx = this.buildHarvestRewardsTxV2(Object.assign(Object.assign({}, inputs), { stakedPositionIds: [inputs.stakedPositionId] }));
1102
- }
1103
- else {
1104
- // no rewards to harvest
1105
- tx = new transactions_1.Transaction();
1106
- tx.setSender(walletAddress);
1107
- }
1108
- // withdraw principal
1109
- const withdrawnCoin = this.withdrawPrincipalTxV2(Object.assign(Object.assign({}, inputs), { tx }));
1110
- tx.transferObjects([withdrawnCoin], walletAddress);
1111
- // destroy position
1112
- this.destroyStakedPositionTxV2({
1113
- tx,
1114
- stakedPositionId: inputs.stakedPositionId,
1115
- stakeCoinType: inputs.stakeCoinType,
1116
- });
1117
- return tx;
1118
- };
1119
- /**
1120
- * @deprecated use buildUpdatePositionTxV2 instead
1121
- * Builds a transaction for updating a staked position
1122
- * @param parameters for updatePositionTx
1123
- * @returns Complete transaction ready for signing and execution
1124
- */
1125
- this.buildUpdatePositionTxV1 = utils_1.Helpers.transactions.createBuildTxFunc(this.updatePositionTxV1);
1126
- /**
1127
- * Builds a transaction for updating a staked position
1128
- * @param parameters for updatePositionTx
1129
- * @returns Complete transaction ready for signing and execution
1130
- */
1131
- this.buildUpdatePositionTx2 = utils_1.Helpers.transactions.createBuildTxFunc(this.updatePositionTxV2);
1132
- // =========================================================================
1133
- // Locking Transactions
1134
- // =========================================================================
1135
- /**
1136
- * @deprecated use buildLockTxV2 instead
1137
- * Builds a transaction for locking a staked position
1138
- * @param parameters for lockTx
1139
- * @returns Complete transaction ready for signing and execution
1140
- */
1141
- this.buildLockTxV1 = utils_1.Helpers.transactions.createBuildTxFunc(this.lockTxV1);
1142
- /**
1143
- * Builds a transaction for locking a staked position
1144
- * @param parameters for lockTx
1145
- * @returns Complete transaction ready for signing and execution
1146
- */
1147
- this.buildLockTxV2 = utils_1.Helpers.transactions.createBuildTxFunc(this.lockTxV2);
1148
- /**
1149
- * @deprecated use buildRenewLockTxV2 instead
1150
- * Builds a transaction for renewing the lock on a staked position
1151
- * @param parameters for renewLockTx
1152
- * @returns Complete transaction ready for signing and execution
1153
- */
1154
- this.buildRenewLockTxV1 = utils_1.Helpers.transactions.createBuildTxFunc(this.renewLockTxV1);
1155
- /**
1156
- * Builds a transaction for renewing the lock on a staked position
1157
- * @param parameters for renewLockTx
1158
- * @returns Complete transaction ready for signing and execution
1159
- */
1160
- this.buildRenewLockTxV2 = utils_1.Helpers.transactions.createBuildTxFunc(this.renewLockTxV2);
1161
- /**
1162
- * @deprecated use buildUnlockTxV2 instead
1163
- * Builds a transaction for unlocking a staked position
1164
- * @param parameters for unlockTx
1165
- * @returns Complete transaction ready for signing and execution
1166
- */
1167
- this.buildUnlockTxV1 = utils_1.Helpers.transactions.createBuildTxFunc(this.unlockTxV1);
1168
- /**
1169
- * Builds a transaction for unlocking a staked position
1170
- * @param parameters for unlockTx
1171
- * @returns Complete transaction ready for signing and execution
1172
- */
1173
- this.buildUnlockTxV2 = utils_1.Helpers.transactions.createBuildTxFunc(this.unlockTxV2);
1174
- // =========================================================================
1175
- // Reward Harvesting Transactions
1176
- // =========================================================================
1177
- /**
1178
- * @deprecated use buildHarvestRewardsTxV2 instead
1179
- * Builds a complete transaction for harvesting rewards from staked positions
1180
- * @param inputs Harvest parameters including wallet address, position IDs, pool ID, reward coin types, and optional claim as AfSui flag
1181
- * @returns Complete transaction ready for signing and execution
1182
- */
1183
- this.buildHarvestRewardsTxV1 = (inputs) => {
1184
- var _a;
1185
- const { walletAddress, stakedPositionIds } = inputs;
1186
- const tx = (_a = inputs.tx) !== null && _a !== void 0 ? _a : new transactions_1.Transaction();
1187
- tx.setSender(walletAddress);
1188
- const harvestRewardsCap = this.beginHarvestTxV1(Object.assign(Object.assign({}, inputs), { tx }));
1189
- let harvestedCoins = {};
1190
- for (const stakedPositionId of stakedPositionIds) {
1191
- for (const rewardCoinType of inputs.rewardCoinTypes) {
1192
- const harvestedCoin = this.harvestRewardsTxV1(Object.assign(Object.assign({}, inputs), { tx,
1193
- stakedPositionId,
1194
- rewardCoinType, harvestedRewardsEventMetadataId: harvestRewardsCap }));
1195
- if (rewardCoinType in harvestedCoins) {
1196
- harvestedCoins[rewardCoinType].push(harvestedCoin);
1197
- }
1198
- else {
1199
- harvestedCoins[rewardCoinType] = [harvestedCoin];
1200
- }
1201
- }
1202
- }
1203
- this.endHarvestTxV1({
1204
- tx,
1205
- harvestedRewardsEventMetadataId: harvestRewardsCap,
1206
- });
1207
- for (const [coinType, harvestedCoinIds] of Object.entries(harvestedCoins)) {
1208
- const coinToTransfer = harvestedCoinIds[0];
1209
- if (harvestedCoinIds.length > 1)
1210
- tx.mergeCoins(coinToTransfer, harvestedCoinIds.slice(1));
1211
- if (inputs.claimSuiAsAfSui && __1.Coin.isCoinObjectType(coinType)) {
1212
- this.Provider.Staking().stakeTx({
1213
- tx,
1214
- suiCoin: coinToTransfer,
1215
- withTransfer: true,
1216
- validatorAddress: this.Provider.Staking().addresses.objects
1217
- .aftermathValidator,
1218
- });
1219
- }
1220
- else {
1221
- tx.transferObjects([coinToTransfer], walletAddress);
1222
- }
1223
- }
1224
- return tx;
1225
- };
1226
- /**
1227
- * Builds a complete transaction for harvesting rewards from staked positions
1228
- * @param inputs Harvest parameters including wallet address, position IDs, pool ID, reward coin types, and optional claim as AfSui flag
1229
- * @returns Complete transaction ready for signing and execution
1230
- */
1231
- this.buildHarvestRewardsTxV2 = (inputs) => {
1232
- var _a;
1233
- const { walletAddress, stakedPositionIds } = inputs;
1234
- const tx = (_a = inputs.tx) !== null && _a !== void 0 ? _a : new transactions_1.Transaction();
1235
- tx.setSender(walletAddress);
1236
- // For the first position, begin harvest
1237
- const firstPositionId = stakedPositionIds[0];
1238
- const harvestRewardsCap = this.beginHarvestTxV2(Object.assign(Object.assign({}, inputs), { tx, stakedPositionId: firstPositionId }));
1239
- let harvestedCoins = {};
1240
- for (const stakedPositionId of stakedPositionIds) {
1241
- for (const rewardCoinType of inputs.rewardCoinTypes) {
1242
- const harvestedCoin = this.harvestRewardsTxV2(Object.assign(Object.assign({}, inputs), { tx,
1243
- stakedPositionId,
1244
- harvestRewardsCap,
1245
- rewardCoinType }));
1246
- if (rewardCoinType in harvestedCoins) {
1247
- harvestedCoins[rewardCoinType].push(harvestedCoin);
1248
- }
1249
- else {
1250
- harvestedCoins[rewardCoinType] = [harvestedCoin];
1251
- }
1252
- }
1253
- }
1254
- this.endHarvestTxV2({ tx, harvestRewardsCap });
1255
- for (const [coinType, harvestedCoinIds] of Object.entries(harvestedCoins)) {
1256
- const coinToTransfer = harvestedCoinIds[0];
1257
- if (harvestedCoinIds.length > 1)
1258
- tx.mergeCoins(coinToTransfer, harvestedCoinIds.slice(1));
1259
- if (inputs.claimSuiAsAfSui && __1.Coin.isCoinObjectType(coinType)) {
1260
- this.Provider.Staking().stakeTx({
1261
- tx,
1262
- suiCoin: coinToTransfer,
1263
- withTransfer: true,
1264
- validatorAddress: this.Provider.Staking().addresses.objects
1265
- .aftermathValidator,
1266
- });
1267
- }
1268
- else {
1269
- tx.transferObjects([coinToTransfer], walletAddress);
1270
- }
1271
- }
1272
- return tx;
1273
- };
1274
- // =========================================================================
1275
- // Staking Pool Transactions
1276
- // =========================================================================
1277
- // =========================================================================
1278
- // Staking Pool Creation Transactions
1279
- // =========================================================================
1280
- /**
1281
- * @deprecated use buildCreateStakingPoolTxV2 instead
1282
- * Builds a complete transaction for creating a new staking pool
1283
- * @param inputs Pool creation parameters including wallet address, lock enforcements, durations, multiplier, stake amount, and coin type
1284
- * @returns Complete transaction ready for signing and execution
1285
- */
1286
- this.buildCreateStakingPoolTxV1 = (inputs) => {
1287
- const { walletAddress } = inputs;
1288
- const tx = new transactions_1.Transaction();
1289
- tx.setSender(walletAddress);
1290
- const [stakingPoolId, ownerCapId] = this.newStakingPoolTxV1(Object.assign(Object.assign({}, inputs), { tx, lockEnforcement: "Strict" }));
1291
- this.shareStakingPoolTxV1({
1292
- tx,
1293
- stakingPoolId,
1294
- stakeCoinType: inputs.stakeCoinType,
1295
- });
1296
- this.transferOwnerCapTxV1({
1297
- tx,
1298
- ownerCapId,
1299
- recipientAddress: walletAddress,
1300
- });
1301
- return tx;
1302
- };
1303
- /**
1304
- * Builds a complete transaction for creating a new staking pool
1305
- * @param inputs Pool creation parameters including wallet address, lock enforcements, durations, multiplier, stake amount, and coin type
1306
- * @returns Complete transaction ready for signing and execution
1307
- */
1308
- this.buildCreateStakingPoolTxV2 = (inputs) => {
1309
- const { walletAddress } = inputs;
1310
- const tx = new transactions_1.Transaction();
1311
- tx.setSender(walletAddress);
1312
- const [stakingPoolId, ownerCapId] = this.newStakingPoolTxV2(Object.assign(Object.assign({}, inputs), { tx, lockEnforcements: ["Strict"] }));
1313
- this.shareStakingPoolTxV2({
1314
- tx,
1315
- stakingPoolId,
1316
- stakeCoinType: inputs.stakeCoinType,
1317
- });
1318
- tx.transferObjects([ownerCapId], walletAddress);
1319
- return tx;
1320
- };
1321
- // =========================================================================
1322
- // Staking Pool Mutation Transactions
1323
- // =========================================================================
1324
- /**
1325
- * @deprecated use fetchBuildInitializeStakingPoolRewardTxV2 instead
1326
- * Builds a complete transaction for initializing rewards for a staking pool
1327
- * @param inputs Initialize rewards parameters including wallet address, owner cap ID, pool ID, reward amount, emission parameters, stake coin type, and reward coin type
1328
- * @returns Complete transaction ready for signing and execution
1329
- */
1330
- this.fetchBuildInitializeStakingPoolRewardTxV1 = (inputs) => __awaiter(this, void 0, void 0, function* () {
1331
- const { walletAddress, isSponsoredTx } = inputs;
1332
- const tx = new transactions_1.Transaction();
1333
- tx.setSender(walletAddress);
1334
- const rewardCoinId = yield this.Provider.Coin().fetchCoinWithAmountTx({
1335
- tx,
1336
- walletAddress,
1337
- coinType: inputs.rewardCoinType,
1338
- coinAmount: inputs.rewardAmount,
1339
- isSponsoredTx,
1340
- });
1341
- this.initializeStakingPoolRewardTxV1(Object.assign(Object.assign({}, inputs), { tx, rewardCoinId }));
1342
- return tx;
1343
- });
1344
- /**
1345
- * Builds a complete transaction for initializing rewards for a staking pool
1346
- * @param inputs Initialize rewards parameters including wallet address, owner cap ID, pool ID, reward amount, emission parameters, stake coin type, and reward coin type
1347
- * @returns Complete transaction ready for signing and execution
1348
- */
1349
- this.fetchBuildInitializeStakingPoolRewardTxV2 = (inputs) => __awaiter(this, void 0, void 0, function* () {
1350
- const { walletAddress, isSponsoredTx } = inputs;
1351
- const tx = new transactions_1.Transaction();
1352
- tx.setSender(walletAddress);
1353
- const rewardCoinId = yield this.Provider.Coin().fetchCoinWithAmountTx({
1354
- tx,
1355
- walletAddress,
1356
- coinType: inputs.rewardCoinType,
1357
- coinAmount: inputs.rewardAmount,
1358
- isSponsoredTx,
1359
- });
1360
- this.initializeStakingPoolRewardTxV2(Object.assign(Object.assign({}, inputs), { tx, rewardCoinId }));
1361
- return tx;
1362
- });
1363
- /**
1364
- * @deprecated use fetchBuildTopUpStakingPoolRewardsTxV2 instead
1365
- * Builds a complete transaction for adding more rewards to a staking pool
1366
- * @param inputs Top up rewards parameters including wallet address, owner cap ID, pool ID, rewards array with amounts and coin types, and stake coin type
1367
- * @returns Complete transaction ready for signing and execution
1368
- */
1369
- this.fetchBuildTopUpStakingPoolRewardsTxV1 = (inputs) => __awaiter(this, void 0, void 0, function* () {
1370
- const { walletAddress, isSponsoredTx } = inputs;
1371
- const tx = new transactions_1.Transaction();
1372
- tx.setSender(walletAddress);
1373
- for (const reward of inputs.rewards) {
1374
- const rewardCoinId = yield this.Provider.Coin().fetchCoinWithAmountTx({
1375
- tx,
1376
- walletAddress,
1377
- coinType: reward.rewardCoinType,
1378
- coinAmount: reward.rewardAmount,
1379
- isSponsoredTx,
1380
- });
1381
- this.topUpStakingPoolRewardTxV1(Object.assign(Object.assign(Object.assign({}, inputs), reward), { tx,
1382
- rewardCoinId }));
1383
- }
1384
- return tx;
1385
- });
1386
- /**
1387
- * Builds a complete transaction for adding more rewards to a staking pool
1388
- * @param inputs Top up rewards parameters including wallet address, owner cap ID, pool ID, rewards array with amounts and coin types, and stake coin type
1389
- * @returns Complete transaction ready for signing and execution
1390
- */
1391
- this.fetchBuildTopUpStakingPoolRewardsTxV2 = (inputs) => __awaiter(this, void 0, void 0, function* () {
1392
- const { walletAddress, isSponsoredTx } = inputs;
1393
- const tx = new transactions_1.Transaction();
1394
- tx.setSender(walletAddress);
1395
- for (const reward of inputs.rewards) {
1396
- const rewardCoinId = yield this.Provider.Coin().fetchCoinWithAmountTx({
1397
- tx,
1398
- walletAddress,
1399
- coinType: reward.rewardCoinType,
1400
- coinAmount: reward.rewardAmount,
1401
- isSponsoredTx,
1402
- });
1403
- this.topUpStakingPoolRewardTxV2(Object.assign(Object.assign(Object.assign({}, inputs), reward), { tx,
1404
- rewardCoinId }));
1405
- }
1406
- return tx;
1407
- });
1408
- /**
1409
- * @deprecated use buildIncreaseStakingPoolRewardsEmissionsTxV2 instead
1410
- * Builds a complete transaction for increasing the emission rate of rewards for a staking pool
1411
- * @param inputs Increase emissions parameters including wallet address, owner cap ID, pool ID, rewards array with emission parameters and coin types, and stake coin type
1412
- * @returns Complete transaction ready for signing and execution
1413
- */
1414
- this.buildIncreaseStakingPoolRewardsEmissionsTxV1 = (inputs) => {
1415
- const { walletAddress } = inputs;
1416
- const tx = new transactions_1.Transaction();
1417
- tx.setSender(walletAddress);
1418
- for (const reward of inputs.rewards) {
1419
- this.increaseStakingPoolRewardEmissionsTxV1(Object.assign(Object.assign(Object.assign({}, inputs), reward), { tx }));
1420
- }
1421
- return tx;
1422
- };
1423
- /**
1424
- * Builds a complete transaction for increasing the emission rate of rewards for a staking pool
1425
- * @param inputs Increase emissions parameters including wallet address, owner cap ID, pool ID, rewards array with emission parameters and coin types, and stake coin type
1426
- * @returns Complete transaction ready for signing and execution
1427
- */
1428
- this.buildIncreaseStakingPoolRewardsEmissionsTxV2 = (inputs) => {
1429
- const { walletAddress } = inputs;
1430
- const tx = new transactions_1.Transaction();
1431
- tx.setSender(walletAddress);
1432
- for (const reward of inputs.rewards) {
1433
- this.increaseStakingPoolRewardEmissionsTxV2(Object.assign(Object.assign(Object.assign({}, inputs), reward), { tx }));
1434
- }
1435
- return tx;
1436
- };
1437
- /**
1438
- * @deprecated use buildSetStakingPoolMinStakeAmountTxV2 instead
1439
- * Builds a transaction for setting the minimum stake amount for a staking pool
1440
- * @param parameters for setStakingPoolMinStakeAmountTx
1441
- * @returns Complete transaction ready for signing and execution
1442
- */
1443
- this.buildSetStakingPoolMinStakeAmountTxV1 = utils_1.Helpers.transactions.createBuildTxFunc(this.setStakingPoolMinStakeAmountTxV1);
1444
- /**
1445
- * Builds a transaction for setting the minimum stake amount for a staking pool
1446
- * @param parameters for setStakingPoolMinStakeAmountTx
1447
- * @returns Complete transaction ready for signing and execution
1448
- */
1449
- this.buildSetStakingPoolMinStakeAmountTxV2 = utils_1.Helpers.transactions.createBuildTxFunc(this.setStakingPoolMinStakeAmountTxV2);
1450
- /**
1451
- * Builds a transaction for **removing undistributed reward coins** from a staking pool (V1).
1452
- * Requires the pool **OwnerCap**. The removal is specific to a `rewardCoinType`.
1453
- *
1454
- * @param parameters Inputs accepted by `removeStakingPoolRewardTxV1`
1455
- * @returns Complete transaction ready for signing and execution
1456
- */
1457
- this.buildRemoveStakingPoolRewardTxV1 = (inputs) => {
1458
- const { walletAddress } = inputs;
1459
- const tx = new transactions_1.Transaction();
1460
- tx.setSender(walletAddress);
1461
- for (const reward of inputs.rewards) {
1462
- this.removeStakingPoolRewardTxV1(Object.assign(Object.assign(Object.assign({}, inputs), reward), { tx }));
1463
- }
1464
- return tx;
1465
- };
1466
- /**
1467
- * Builds a transaction for **removing undistributed reward coins** from a staking pool (V2).
1468
- * Requires the pool **OwnerCap** and includes the on-chain **version object**.
1469
- *
1470
- * @param parameters Inputs accepted by `removeStakingPoolRewardTxV2`
1471
- * @returns Complete transaction ready for signing and execution
1472
- */
1473
- this.buildRemoveStakingPoolRewardTxV2 = (inputs) => {
1474
- const { walletAddress } = inputs;
1475
- const tx = new transactions_1.Transaction();
1476
- tx.setSender(walletAddress);
1477
- for (const reward of inputs.rewards) {
1478
- this.removeStakingPoolRewardTxV2(Object.assign(Object.assign(Object.assign({}, inputs), reward), { tx }));
1479
- }
1480
- return tx;
1481
- };
1482
- /**
1483
- * @deprecated use buildGrantOneTimeAdminCapTxV2 instead
1484
- * Builds a transaction for granting a one-time admin capability for a staking pool
1485
- * @param parameters for grantOneTimeAdminCapTx
1486
- * @returns Complete transaction ready for signing and execution
1487
- */
1488
- this.buildGrantOneTimeAdminCapTxV1 = utils_1.Helpers.transactions.createBuildTxFunc(this.grantOneTimeAdminCapTxV1);
1489
- /**
1490
- * Builds a transaction for granting a one-time admin capability for a staking pool
1491
- * @param parameters for grantOneTimeAdminCapTx
1492
- * @returns Complete transaction ready for signing and execution
1493
- */
1494
- this.buildGrantOneTimeAdminCapTxV2 = utils_1.Helpers.transactions.createBuildTxFunc(this.grantOneTimeAdminCapTxV2);
1495
- // =========================================================================
1496
- // Private Methods
1497
- // =========================================================================
1498
- // =========================================================================
1499
- // Event Types
1500
- // =========================================================================
1501
- // =========================================================================
1502
- // Vault Creation
1503
- // =========================================================================
1504
- this.eventWrapperType = () => eventsApiHelpers_1.EventsApiHelpers.createEventType(this.addresses.packages.eventsV2, FarmsApi.constants.moduleNames.events, "Event");
1505
- /**
1506
- * Creates the event type for vault creation events
1507
- * @returns Fully qualified event type string
1508
- */
1509
- this.createdVaultEventType = (version) => eventsApiHelpers_1.EventsApiHelpers.createEventType(version === 1
1510
- ? this.addresses.packages.vaultsInitial
1511
- : this.addresses.packages.eventsV2, FarmsApi.constants.moduleNames.events, FarmsApi.constants.eventNames.createdVault, version === 1 ? undefined : this.eventWrapperType());
1512
- // =========================================================================
1513
- // Vault Mutation
1514
- // =========================================================================
1515
- /**
1516
- * Creates the event type for reward initialization events
1517
- * @returns Fully qualified event type string
1518
- */
1519
- this.initializedRewardEventType = (version) => eventsApiHelpers_1.EventsApiHelpers.createEventType(version === 1
1520
- ? this.addresses.packages.vaultsInitial
1521
- : this.addresses.packages.eventsV2, FarmsApi.constants.moduleNames.events, FarmsApi.constants.eventNames.initializedReward, version === 1 ? undefined : this.eventWrapperType());
1522
- /**
1523
- * Creates the event type for reward addition events
1524
- * @returns Fully qualified event type string
1525
- */
1526
- this.addedRewardEventType = (version) => eventsApiHelpers_1.EventsApiHelpers.createEventType(version === 1
1527
- ? this.addresses.packages.vaultsInitial
1528
- : this.addresses.packages.eventsV2, FarmsApi.constants.moduleNames.events, FarmsApi.constants.eventNames.addedReward, version === 1 ? undefined : this.eventWrapperType());
1529
- /**
1530
- * Creates the event type for emission increase events
1531
- * @returns Fully qualified event type string
1532
- */
1533
- this.increasedEmissionsEventType = () => eventsApiHelpers_1.EventsApiHelpers.createEventType(this.addresses.packages.vaultsInitial, FarmsApi.constants.moduleNames.events, FarmsApi.constants.eventNames.increasedEmissions);
1534
- /**
1535
- * Creates the event type for emission update events
1536
- * @returns Fully qualified event type string
1537
- */
1538
- this.updatedEmissionsEventType = () => eventsApiHelpers_1.EventsApiHelpers.createEventType(this.addresses.packages.eventsV2, FarmsApi.constants.moduleNames.events, FarmsApi.constants.eventNames.increasedEmissions, this.eventWrapperType());
1539
- // =========================================================================
1540
- // Staking Position Creation
1541
- // =========================================================================
1542
- /**
1543
- * Creates the event type for strict staking events
1544
- * @returns Fully qualified event type string
1545
- */
1546
- this.stakedEventType = (version) => eventsApiHelpers_1.EventsApiHelpers.createEventType(version === 1
1547
- ? this.addresses.packages.vaultsInitial
1548
- : this.addresses.packages.eventsV2, FarmsApi.constants.moduleNames.events, FarmsApi.constants.eventNames.staked, version === 1 ? undefined : this.eventWrapperType());
1549
- /**
1550
- * Creates the event type for relaxed staking events
1551
- * @returns Fully qualified event type string
1552
- */
1553
- this.stakedRelaxedEventType = (version) => eventsApiHelpers_1.EventsApiHelpers.createEventType(version === 1
1554
- ? this.addresses.packages.vaultsInitial
1555
- : this.addresses.packages.eventsV2, FarmsApi.constants.moduleNames.events, FarmsApi.constants.eventNames.stakedRelaxed, version === 1 ? undefined : this.eventWrapperType());
1556
- // =========================================================================
1557
- // Staking Position Locking
1558
- // =========================================================================
1559
- /**
1560
- * Creates the event type for position locking events
1561
- * @returns Fully qualified event type string
1562
- */
1563
- this.lockedEventType = (version) => eventsApiHelpers_1.EventsApiHelpers.createEventType(version === 1
1564
- ? this.addresses.packages.vaultsInitial
1565
- : this.addresses.packages.eventsV2, FarmsApi.constants.moduleNames.events, FarmsApi.constants.eventNames.locked, version === 1 ? undefined : this.eventWrapperType());
1566
- /**
1567
- * Creates the event type for position unlocking events
1568
- * @returns Fully qualified event type string
1569
- */
1570
- this.unlockedEventType = (version) => eventsApiHelpers_1.EventsApiHelpers.createEventType(version === 1
1571
- ? this.addresses.packages.vaultsInitial
1572
- : this.addresses.packages.eventsV2, FarmsApi.constants.moduleNames.events, FarmsApi.constants.eventNames.unlocked, version === 1 ? undefined : this.eventWrapperType());
1573
- // =========================================================================
1574
- // Staking Position Staking
1575
- // =========================================================================
1576
- /**
1577
- * Creates the event type for principal deposit events
1578
- * @returns Fully qualified event type string
1579
- */
1580
- this.depositedPrincipalEventType = (version) => eventsApiHelpers_1.EventsApiHelpers.createEventType(version === 1
1581
- ? this.addresses.packages.vaultsInitial
1582
- : this.addresses.packages.eventsV2, FarmsApi.constants.moduleNames.events, FarmsApi.constants.eventNames.depositedPrincipal, version === 1 ? undefined : this.eventWrapperType());
1583
- /**
1584
- * Creates the event type for principal withdrawal events
1585
- * @returns Fully qualified event type string
1586
- */
1587
- this.withdrewPrincipalEventType = (version) => eventsApiHelpers_1.EventsApiHelpers.createEventType(version === 1
1588
- ? this.addresses.packages.vaultsInitial
1589
- : this.addresses.packages.eventsV2, FarmsApi.constants.moduleNames.events, FarmsApi.constants.eventNames.withdrewPrincipal, version === 1 ? undefined : this.eventWrapperType());
1590
- // =========================================================================
1591
- // Staking Position Reward Harvesting
1592
- // =========================================================================
1593
- /**
1594
- * Creates the event type for reward harvesting events
1595
- * @returns Fully qualified event type string
1596
- */
1597
- this.harvestedRewardsEventType = (version) => eventsApiHelpers_1.EventsApiHelpers.createEventType(version === 1
1598
- ? this.addresses.packages.vaultsInitial
1599
- : this.addresses.packages.eventsV2, FarmsApi.constants.moduleNames.events, FarmsApi.constants.eventNames.harvestedRewards, version === 1 ? undefined : this.eventWrapperType());
1600
- const addresses = this.Provider.addresses.farms;
1601
- if (!addresses)
1602
- throw new Error("not all required addresses have been set in provider");
1603
- this.addresses = addresses;
1604
- this.objectTypes = {
1605
- stakedPositionV1: `${addresses.packages.vaultsInitial}::${FarmsApi.constants.moduleNames.stakedPosition}::StakedPosition`,
1606
- stakingPoolOwnerCapV1: `${addresses.packages.vaultsInitial}::${FarmsApi.constants.moduleNames.vaultV1}::OwnerCap`,
1607
- stakingPoolOneTimeAdminCapV1: `${addresses.packages.vaultsInitial}::${FarmsApi.constants.moduleNames.vaultV1}::OneTimeAdminCap`,
1608
- stakedPositionV2: `${addresses.packages.eventsV2}::${FarmsApi.constants.moduleNames.stakedPosition}::StakedPosition`,
1609
- stakingPoolOwnerCapV2: `${addresses.packages.eventsV2}::${FarmsApi.constants.moduleNames.authority}::AuthorityCap<${addresses.packages.eventsV2}::${FarmsApi.constants.moduleNames.authority}::VAULT<${addresses.packages.eventsV2}::${FarmsApi.constants.moduleNames.authority}::ADMIN>>`,
1610
- // NOTE: will this work with `<phantom Role, phantom Reward>` ?
1611
- stakingPoolOneTimeAdminCapV2: `${addresses.packages.eventsV2}::${FarmsApi.constants.moduleNames.vaultV2}::OneTime`,
1612
- };
1613
- this.eventTypes = {
1614
- // v1
1615
- // staking pools
1616
- // creation
1617
- createdVaultV1: this.createdVaultEventType(1),
1618
- // mutation
1619
- initializedRewardV1: this.initializedRewardEventType(1),
1620
- addedRewardV1: this.addedRewardEventType(1),
1621
- increasedEmissionsV1: this.increasedEmissionsEventType(),
1622
- // staking positions
1623
- // creation
1624
- stakedV1: this.stakedEventType(1),
1625
- stakedRelaxedV1: this.stakedRelaxedEventType(1),
1626
- // locking
1627
- lockedV1: this.lockedEventType(1),
1628
- unlockedV1: this.unlockedEventType(1),
1629
- // staking
1630
- depositedPrincipalV1: this.depositedPrincipalEventType(1),
1631
- withdrewPrincipalV1: this.withdrewPrincipalEventType(1),
1632
- // reward harvesting
1633
- harvestedRewardsV1: this.harvestedRewardsEventType(1),
1634
- // v2
1635
- // staking pools
1636
- // creation
1637
- createdVaultV2: this.createdVaultEventType(2),
1638
- // mutation
1639
- initializedRewardV2: this.initializedRewardEventType(2),
1640
- addedRewardV2: this.addedRewardEventType(2),
1641
- updatedEmissionsV2: this.updatedEmissionsEventType(),
1642
- // staking positions
1643
- // creation
1644
- stakedV2: this.stakedEventType(2),
1645
- // locking
1646
- lockedV2: this.lockedEventType(2),
1647
- unlockedV2: this.unlockedEventType(2),
1648
- // staking
1649
- depositedPrincipalV2: this.depositedPrincipalEventType(2),
1650
- withdrewPrincipalV2: this.withdrewPrincipalEventType(2),
1651
- // reward harvesting
1652
- harvestedRewardsV2: this.harvestedRewardsEventType(2),
1653
- };
1654
- this.moveErrors = {
1655
- [this.addresses.packages.vaults]: {
1656
- [FarmsApi.constants.moduleNames.vaultV1]: {
1657
- /// A user attempts provides a `Coin` or `u64` with value zero.
1658
- 0: "Zero",
1659
- /// A user provides a `StakedPosition` and a `AfterburnerVault` that don't correspond with one
1660
- /// another. This can only occur if two `AfterburnerVault` with the same underlying `STAKED` generic
1661
- /// are created.
1662
- 1: "Invalid Afterburner Vault",
1663
- /// A user tries to create an `AfterburnerVault` where `min_lock_duration_ms` is strictly greater than
1664
- /// `max_lock_duration_ms`.
1665
- 2: "Invalid Min Max Lock Durations",
1666
- /// The creator of a `AfterburnerVault` tries to update the vault's emission rate or add more rewards
1667
- /// without first initializing the emissions schedule.
1668
- 3: "Emissions Not Initialized",
1669
- /// The creator of a `AfterburnerVault` tries to update the vault's emission schedule/rate but
1670
- /// provides a schedule/rate pair that will decrease emissions for the specified reward type.
1671
- 4: "Emissions Not Increasing",
1672
- 5: "Bad Type",
1673
- /// A user attempts to stake into a `AfterburnerVault` below the vault's `min_stake_amount` or
1674
- /// an amount of principal that would bring their position below the vault's `min_stake_amount`.
1675
- 6: "Invalid Stake Amount",
1676
- /// A user attempts to create an `AfterburnerVault` and provides a `lock_enforcement` that doesn't
1677
- /// match one of `STRICT_LOCK_ENFORCEMENT` or `RELAXED_LOCK_ENFORCEMENT`.
1678
- 7: "Invalid Lock Enforcement",
1679
- /// A user tries to claim zero rewards
1680
- 8: "Zero Claim",
1681
- /// A user provided invalid max lock multiplier (< 1)
1682
- 9: "Invalid Lock Multiplier",
1683
- 10: "Invalid Argument",
1684
- 11: "Deprecated",
1685
- 12: "Afterburner Vault Still Active",
1686
- },
1687
- [FarmsApi.constants.moduleNames.stakedPosition]: {
1688
- /// A user attempts provides a `Coin` or `u64` with value zero.
1689
- 0: "Zero",
1690
- /// A user attempts to withdraw funds from a `StakedPosition` that is still locked.
1691
- 1: "Locked",
1692
- /// A user provides a `StakedPosition` and a `AfterburnerVault` that don't correspond with one another.
1693
- /// This can only occur if two `AfterburnerVault` with the same underlying `STAKED` generic are created.
1694
- 2: "Invalid Afterburner Vault",
1695
- /// A user tries to lock the coins in a `AfterburnerVault` with a `lock_duration_ms` below the vault's
1696
- /// `min_lock_duration_ms`.
1697
- 3: "Invalid Lock Duration",
1698
- /// A user attempts to destroy a `StakedPosition` that still holds rewards that can be harvested.
1699
- 4: "Harvest Rewards",
1700
- /// A user attempts to stake into a `AfterburnerVault` below the vault's `min_stake_amount` or
1701
- /// an amount of principal that would bring their position below the vault's `min_stake_amount`.
1702
- 5: "Invalid Stake Amount",
1703
- 6: "Invalid Withdraw Amount",
1704
- 7: "Invalid Split Amount",
1705
- 8: "Uninitialized Vault Rewards",
1706
- 9: "Not Implemented",
1707
- /// A user requested to harvest zero base rewards.
1708
- 10: "Zero Rewards",
1709
- },
1710
- },
1711
- [this.addresses.packages.vaultsV2]: {
1712
- [FarmsApi.constants.moduleNames.vaultV2]: {
1713
- /// A user provides a `Coin` with value zero.
1714
- 0: "Zero",
1715
- /// A user tries to create a `Vault` where `min_lock_duration_ms` is strictly greater than
1716
- /// `max_lock_duration_ms`.
1717
- 1: "Invalid Min Max Lock Durations",
1718
- /// A user tries to create a `Vault` and provides a `u8` that does not map to a valid lock
1719
- /// enforcement policy.
1720
- 2: "Invalid Lock Enforcement",
1721
- /// The creator of a `Vault` tries to update the emission schedule or add more of a specific
1722
- /// reward type that has not yet been initialized into the `Vault`.
1723
- 3: "Emissions Not Initialized",
1724
- /// A `Reward` `Coin` type was passed to a function and either the `Reward` type does not
1725
- /// correspond to any of the `Vault`'s reward types--for the functions that act on the `Reward`
1726
- /// type--or, for `initialize_reward`, the `Reward` type has already had its emissions initialized.
1727
- 4: "Invalid Reward Coin Type",
1728
- /// A user attempts to withdraw an amount of principal that would bring their position below the
1729
- /// `Vault`'s `min_stake_amount`.
1730
- 5: "Invalid Stake Amount",
1731
- /// A user tries to claim zero rewards
1732
- 6: "Zero Claim",
1733
- /// A user provided a max lock multiplier that was strictly less than the minimum lower bound.
1734
- 7: "Invalid Lock Multiplier",
1735
- },
1736
- [FarmsApi.constants.moduleNames.stakedPosition]: {
1737
- /// A user attempts to perform a restricted action on a `StakedPosition` that is still locked. For
1738
- /// example `unlock` can only be called on a `StakedPosition` that is no longer locked.
1739
- 0: "Locked",
1740
- /// A user provides a `StakedPosition` and a `Vault` that don't correspond with one another.
1741
- /// This can only occur if two `Vault`s with the same underlying `Stake` generic are created.
1742
- 1: "Invalid Vault",
1743
- /// A user tries to stake into a `Vault` with a `lock_duration_ms` below the vault's
1744
- /// `min_lock_duration_ms`.
1745
- 2: "Invalid Lock Duration",
1746
- /// A user attempts to withdraw an amount of principal that would bring their position below the
1747
- /// `Vault`'s `min_stake_amount`.
1748
- 3: "Invalid Stake Amount",
1749
- /// A user attempts to withdraw more principal than their `StakedPosition` holds.
1750
- 4: "Invalid Withdraw Amount",
1751
- /// A user attempts to split more principal than their `StakedPosition` holds.
1752
- 5: "Invalid Split Amount",
1753
- /// A user attempts to stake into a `Vault` that has no rewards.
1754
- 6: "Vault Is Inactive",
1755
- /// A user requested to harvest a reward type for which they've only accrued less than the minimal
1756
- /// claim amount.
1757
- 7: "Zero Rewards",
1758
- /// A user attempts to stake into a `Vault` with a `LockEnforcement` policy that the vault does
1759
- /// not support.
1760
- 8: "Invalid Lock Enforcement",
1761
- /// A user attempts to call `destroy` on a `StakedPosition` that has unharvested rewards.
1762
- 9: "Position Has Unclaimed Rewards",
1763
- },
1764
- },
1765
- };
1766
- }
1767
- }
1768
- exports.FarmsApi = FarmsApi;
1769
- // =========================================================================
1770
- // Constants
1771
- // =========================================================================
1772
- FarmsApi.constants = {
1773
- moduleNames: {
1774
- vaultV1: "afterburner_vault",
1775
- vaultV2: "vault",
1776
- stakedPosition: "staked_position",
1777
- vaultRegistry: "vault_registry",
1778
- events: "events",
1779
- authority: "authority",
1780
- },
1781
- eventNames: {
1782
- // staking pools
1783
- // creation
1784
- createdVault: "CreatedVaultEvent",
1785
- // mutation
1786
- initializedReward: "InitializedRewardEvent",
1787
- addedReward: "AddedRewardEvent",
1788
- increasedEmissions: "IncreasedEmissionsEvent",
1789
- updatedEmissions: "UpdatedEmissionsEvent",
1790
- // staking positions
1791
- // creation
1792
- staked: "StakedEvent",
1793
- stakedRelaxed: "StakedEventRelaxed",
1794
- // locking
1795
- locked: "LockedEvent",
1796
- unlocked: "UnlockedEvent",
1797
- // mutation
1798
- joined: "JoinedEvent",
1799
- split: "SplitEvent",
1800
- // staking
1801
- depositedPrincipal: "DepositedPrincipalEvent",
1802
- withdrewPrincipal: "WithdrewPrincipalEvent",
1803
- // reward harvesting
1804
- harvestedRewards: "HarvestedRewardsEvent",
1805
- // destruction
1806
- destroyedStakedPosition: "DestroyedStakedPositionEvent",
1807
- },
1808
- };
1809
- // =========================================================================
1810
- // Private Static Methods
1811
- // =========================================================================
1812
- // =========================================================================
1813
- // Helpers
1814
- // =========================================================================
1815
- /**
1816
- * Checks if the input contains a one-time admin cap ID
1817
- * @param inputs FarmOwnerOrOneTimeAdminCap object
1818
- * @returns True if the input contains a one-time admin cap ID
1819
- */
1820
- FarmsApi.isFarmOneTimeAdminCapId = (inputs) => "oneTimeAdminCapId" in inputs;
1821
- /**
1822
- * Gets the appropriate cap ID from the input
1823
- * @param inputs FarmOwnerOrOneTimeAdminCap object
1824
- * @returns Either the owner cap ID or one-time admin cap ID
1825
- */
1826
- FarmsApi.farmCapId = (inputs) => "ownerCapId" in inputs ? inputs.ownerCapId : inputs.oneTimeAdminCapId;