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.
- package/dist/index.d.ts +16828 -5
- package/dist/index.js +22695 -19
- package/dist/index.js.map +1 -0
- package/package.json +69 -60
- package/dist/general/apiHelpers/dynamicFieldsApiHelpers.d.ts +0 -41
- package/dist/general/apiHelpers/dynamicFieldsApiHelpers.d.ts.map +0 -1
- package/dist/general/apiHelpers/dynamicFieldsApiHelpers.js +0 -110
- package/dist/general/apiHelpers/eventsApiHelpers.d.ts +0 -43
- package/dist/general/apiHelpers/eventsApiHelpers.d.ts.map +0 -1
- package/dist/general/apiHelpers/eventsApiHelpers.js +0 -170
- package/dist/general/apiHelpers/inspectionsApiHelpers.d.ts +0 -28
- package/dist/general/apiHelpers/inspectionsApiHelpers.d.ts.map +0 -1
- package/dist/general/apiHelpers/inspectionsApiHelpers.js +0 -58
- package/dist/general/apiHelpers/objectsApiHelpers.d.ts +0 -77
- package/dist/general/apiHelpers/objectsApiHelpers.d.ts.map +0 -1
- package/dist/general/apiHelpers/objectsApiHelpers.js +0 -197
- package/dist/general/apiHelpers/transactionsApiHelpers.d.ts +0 -50
- package/dist/general/apiHelpers/transactionsApiHelpers.d.ts.map +0 -1
- package/dist/general/apiHelpers/transactionsApiHelpers.js +0 -256
- package/dist/general/dynamicGas/dynamicGas.d.ts +0 -48
- package/dist/general/dynamicGas/dynamicGas.d.ts.map +0 -1
- package/dist/general/dynamicGas/dynamicGas.js +0 -69
- package/dist/general/dynamicGas/dynamicGasTypes.d.ts +0 -37
- package/dist/general/dynamicGas/dynamicGasTypes.d.ts.map +0 -1
- package/dist/general/dynamicGas/dynamicGasTypes.js +0 -2
- package/dist/general/nfts/nftsApi.d.ts +0 -35
- package/dist/general/nfts/nftsApi.d.ts.map +0 -1
- package/dist/general/nfts/nftsApi.js +0 -124
- package/dist/general/nfts/nftsApiCasting.d.ts +0 -11
- package/dist/general/nfts/nftsApiCasting.d.ts.map +0 -1
- package/dist/general/nfts/nftsApiCasting.js +0 -115
- package/dist/general/nfts/nftsTypes.d.ts +0 -31
- package/dist/general/nfts/nftsTypes.d.ts.map +0 -1
- package/dist/general/nfts/nftsTypes.js +0 -2
- package/dist/general/priceFeeds/priceFeeds.d.ts +0 -3
- package/dist/general/priceFeeds/priceFeeds.d.ts.map +0 -1
- package/dist/general/priceFeeds/priceFeeds.js +0 -26
- package/dist/general/priceFeeds/priceFeedsApi.d.ts +0 -3
- package/dist/general/priceFeeds/priceFeedsApi.d.ts.map +0 -1
- package/dist/general/priceFeeds/priceFeedsApi.js +0 -33
- package/dist/general/priceFeeds/priceFeedsTypes.d.ts +0 -3
- package/dist/general/priceFeeds/priceFeedsTypes.d.ts.map +0 -1
- package/dist/general/priceFeeds/priceFeedsTypes.js +0 -7
- package/dist/general/prices/coinGeckoTypes.d.ts +0 -16
- package/dist/general/prices/coinGeckoTypes.d.ts.map +0 -1
- package/dist/general/prices/coinGeckoTypes.js +0 -2
- package/dist/general/prices/prices.d.ts +0 -92
- package/dist/general/prices/prices.d.ts.map +0 -1
- package/dist/general/prices/prices.js +0 -124
- package/dist/general/providers/aftermath.d.ts +0 -200
- package/dist/general/providers/aftermath.d.ts.map +0 -1
- package/dist/general/providers/aftermath.js +0 -258
- package/dist/general/providers/aftermathApi.d.ts +0 -197
- package/dist/general/providers/aftermathApi.d.ts.map +0 -1
- package/dist/general/providers/aftermathApi.js +0 -255
- package/dist/general/providers/index.d.ts +0 -3
- package/dist/general/providers/index.d.ts.map +0 -1
- package/dist/general/providers/index.js +0 -18
- package/dist/general/types/castingTypes.d.ts +0 -51
- package/dist/general/types/castingTypes.d.ts.map +0 -1
- package/dist/general/types/castingTypes.js +0 -8
- package/dist/general/types/configTypes.d.ts +0 -187
- package/dist/general/types/configTypes.d.ts.map +0 -1
- package/dist/general/types/configTypes.js +0 -2
- package/dist/general/types/generalTypes.d.ts +0 -349
- package/dist/general/types/generalTypes.d.ts.map +0 -1
- package/dist/general/types/generalTypes.js +0 -2
- package/dist/general/types/index.d.ts +0 -7
- package/dist/general/types/index.d.ts.map +0 -1
- package/dist/general/types/index.js +0 -22
- package/dist/general/types/moveErrorsInterface.d.ts +0 -6
- package/dist/general/types/moveErrorsInterface.d.ts.map +0 -1
- package/dist/general/types/moveErrorsInterface.js +0 -2
- package/dist/general/types/suiTypes.d.ts +0 -2
- package/dist/general/types/suiTypes.d.ts.map +0 -1
- package/dist/general/types/suiTypes.js +0 -5
- package/dist/general/utils/caller.d.ts +0 -58
- package/dist/general/utils/caller.d.ts.map +0 -1
- package/dist/general/utils/caller.js +0 -231
- package/dist/general/utils/casting.d.ts +0 -212
- package/dist/general/utils/casting.d.ts.map +0 -1
- package/dist/general/utils/casting.js +0 -273
- package/dist/general/utils/fixedUtils.d.ts +0 -109
- package/dist/general/utils/fixedUtils.d.ts.map +0 -1
- package/dist/general/utils/fixedUtils.js +0 -100
- package/dist/general/utils/helpers.d.ts +0 -408
- package/dist/general/utils/helpers.d.ts.map +0 -1
- package/dist/general/utils/helpers.js +0 -725
- package/dist/general/utils/iFixedUtils.d.ts +0 -78
- package/dist/general/utils/iFixedUtils.d.ts.map +0 -1
- package/dist/general/utils/iFixedUtils.js +0 -109
- package/dist/general/utils/index.d.ts +0 -3
- package/dist/general/utils/index.d.ts.map +0 -1
- package/dist/general/utils/index.js +0 -18
- package/dist/general/wallet/wallet.d.ts +0 -89
- package/dist/general/wallet/wallet.d.ts.map +0 -1
- package/dist/general/wallet/wallet.js +0 -120
- package/dist/general/wallet/walletApi.d.ts +0 -20
- package/dist/general/wallet/walletApi.d.ts.map +0 -1
- package/dist/general/wallet/walletApi.js +0 -66
- package/dist/index.d.ts.map +0 -1
- package/dist/packages/auth/auth.d.ts +0 -135
- package/dist/packages/auth/auth.d.ts.map +0 -1
- package/dist/packages/auth/auth.js +0 -289
- package/dist/packages/auth/authTypes.d.ts +0 -102
- package/dist/packages/auth/authTypes.d.ts.map +0 -1
- package/dist/packages/auth/authTypes.js +0 -2
- package/dist/packages/auth/index.d.ts +0 -2
- package/dist/packages/auth/index.d.ts.map +0 -1
- package/dist/packages/auth/index.js +0 -17
- package/dist/packages/coin/api/coinApi.d.ts +0 -33
- package/dist/packages/coin/api/coinApi.d.ts.map +0 -1
- package/dist/packages/coin/api/coinApi.js +0 -167
- package/dist/packages/coin/coin.d.ts +0 -320
- package/dist/packages/coin/coin.d.ts.map +0 -1
- package/dist/packages/coin/coin.js +0 -467
- package/dist/packages/coin/coinTypes.d.ts +0 -139
- package/dist/packages/coin/coinTypes.d.ts.map +0 -1
- package/dist/packages/coin/coinTypes.js +0 -2
- package/dist/packages/coin/index.d.ts +0 -2
- package/dist/packages/coin/index.d.ts.map +0 -1
- package/dist/packages/coin/index.js +0 -17
- package/dist/packages/dca/api/dcaApi.d.ts +0 -26
- package/dist/packages/dca/api/dcaApi.d.ts.map +0 -1
- package/dist/packages/dca/api/dcaApi.js +0 -60
- package/dist/packages/dca/dca.d.ts +0 -174
- package/dist/packages/dca/dca.d.ts.map +0 -1
- package/dist/packages/dca/dca.js +0 -230
- package/dist/packages/dca/dcaTypes.d.ts +0 -319
- package/dist/packages/dca/dcaTypes.d.ts.map +0 -1
- package/dist/packages/dca/dcaTypes.js +0 -2
- package/dist/packages/dca/index.d.ts +0 -2
- package/dist/packages/dca/index.d.ts.map +0 -1
- package/dist/packages/dca/index.js +0 -17
- package/dist/packages/farms/api/farmsApi.d.ts +0 -996
- package/dist/packages/farms/api/farmsApi.d.ts.map +0 -1
- package/dist/packages/farms/api/farmsApi.js +0 -1826
- package/dist/packages/farms/api/farmsApiCasting.d.ts +0 -39
- package/dist/packages/farms/api/farmsApiCasting.d.ts.map +0 -1
- package/dist/packages/farms/api/farmsApiCasting.js +0 -427
- package/dist/packages/farms/api/farmsApiCastingTypes.d.ts +0 -235
- package/dist/packages/farms/api/farmsApiCastingTypes.d.ts.map +0 -1
- package/dist/packages/farms/api/farmsApiCastingTypes.js +0 -2
- package/dist/packages/farms/farms.d.ts +0 -221
- package/dist/packages/farms/farms.d.ts.map +0 -1
- package/dist/packages/farms/farms.js +0 -302
- package/dist/packages/farms/farmsStakedPosition.d.ts +0 -229
- package/dist/packages/farms/farmsStakedPosition.d.ts.map +0 -1
- package/dist/packages/farms/farmsStakedPosition.js +0 -473
- package/dist/packages/farms/farmsStakingPool.d.ts +0 -285
- package/dist/packages/farms/farmsStakingPool.d.ts.map +0 -1
- package/dist/packages/farms/farmsStakingPool.js +0 -488
- package/dist/packages/farms/farmsTypes.d.ts +0 -571
- package/dist/packages/farms/farmsTypes.d.ts.map +0 -1
- package/dist/packages/farms/farmsTypes.js +0 -49
- package/dist/packages/farms/index.d.ts +0 -4
- package/dist/packages/farms/index.d.ts.map +0 -1
- package/dist/packages/farms/index.js +0 -19
- package/dist/packages/faucet/api/faucetApi.d.ts +0 -37
- package/dist/packages/faucet/api/faucetApi.d.ts.map +0 -1
- package/dist/packages/faucet/api/faucetApi.js +0 -145
- package/dist/packages/faucet/api/faucetApiCasting.d.ts +0 -7
- package/dist/packages/faucet/api/faucetApiCasting.d.ts.map +0 -1
- package/dist/packages/faucet/api/faucetApiCasting.js +0 -33
- package/dist/packages/faucet/api/faucetApiCastingTypes.d.ts +0 -10
- package/dist/packages/faucet/api/faucetApiCastingTypes.d.ts.map +0 -1
- package/dist/packages/faucet/api/faucetApiCastingTypes.js +0 -2
- package/dist/packages/faucet/faucet.d.ts +0 -16
- package/dist/packages/faucet/faucet.d.ts.map +0 -1
- package/dist/packages/faucet/faucet.js +0 -64
- package/dist/packages/faucet/faucetTypes.d.ts +0 -20
- package/dist/packages/faucet/faucetTypes.d.ts.map +0 -1
- package/dist/packages/faucet/faucetTypes.js +0 -2
- package/dist/packages/faucet/index.d.ts +0 -2
- package/dist/packages/faucet/index.d.ts.map +0 -1
- package/dist/packages/faucet/index.js +0 -17
- package/dist/packages/index.d.ts +0 -14
- package/dist/packages/index.d.ts.map +0 -1
- package/dist/packages/index.js +0 -29
- package/dist/packages/leveragedStaking/api/leveragedStakingApi.d.ts +0 -202
- package/dist/packages/leveragedStaking/api/leveragedStakingApi.d.ts.map +0 -1
- package/dist/packages/leveragedStaking/api/leveragedStakingApi.js +0 -1104
- package/dist/packages/leveragedStaking/api/leveragedStakingApiCasting.d.ts +0 -12
- package/dist/packages/leveragedStaking/api/leveragedStakingApiCasting.d.ts.map +0 -1
- package/dist/packages/leveragedStaking/api/leveragedStakingApiCasting.js +0 -69
- package/dist/packages/leveragedStaking/api/leveragedStakingApiCastingTypes.d.ts +0 -39
- package/dist/packages/leveragedStaking/api/leveragedStakingApiCastingTypes.d.ts.map +0 -1
- package/dist/packages/leveragedStaking/api/leveragedStakingApiCastingTypes.js +0 -2
- package/dist/packages/leveragedStaking/index.d.ts +0 -2
- package/dist/packages/leveragedStaking/index.d.ts.map +0 -1
- package/dist/packages/leveragedStaking/index.js +0 -17
- package/dist/packages/leveragedStaking/leveragedStaking.d.ts +0 -68
- package/dist/packages/leveragedStaking/leveragedStaking.d.ts.map +0 -1
- package/dist/packages/leveragedStaking/leveragedStaking.js +0 -154
- package/dist/packages/leveragedStaking/leveragedStakingTypes.d.ts +0 -48
- package/dist/packages/leveragedStaking/leveragedStakingTypes.d.ts.map +0 -1
- package/dist/packages/leveragedStaking/leveragedStakingTypes.js +0 -16
- package/dist/packages/limitOrders/api/limitOrdersApi.d.ts +0 -12
- package/dist/packages/limitOrders/api/limitOrdersApi.d.ts.map +0 -1
- package/dist/packages/limitOrders/api/limitOrdersApi.js +0 -25
- package/dist/packages/limitOrders/index.d.ts +0 -2
- package/dist/packages/limitOrders/index.d.ts.map +0 -1
- package/dist/packages/limitOrders/index.js +0 -17
- package/dist/packages/limitOrders/limitOrders.d.ts +0 -143
- package/dist/packages/limitOrders/limitOrders.d.ts.map +0 -1
- package/dist/packages/limitOrders/limitOrders.js +0 -190
- package/dist/packages/limitOrders/limitOrdersTypes.d.ts +0 -211
- package/dist/packages/limitOrders/limitOrdersTypes.d.ts.map +0 -1
- package/dist/packages/limitOrders/limitOrdersTypes.js +0 -2
- package/dist/packages/multisig/api/multisigApi.d.ts +0 -10
- package/dist/packages/multisig/api/multisigApi.d.ts.map +0 -1
- package/dist/packages/multisig/api/multisigApi.js +0 -39
- package/dist/packages/multisig/index.d.ts +0 -2
- package/dist/packages/multisig/index.d.ts.map +0 -1
- package/dist/packages/multisig/index.js +0 -17
- package/dist/packages/multisig/multisig.d.ts +0 -46
- package/dist/packages/multisig/multisig.d.ts.map +0 -1
- package/dist/packages/multisig/multisig.js +0 -65
- package/dist/packages/multisig/multisigTypes.d.ts +0 -26
- package/dist/packages/multisig/multisigTypes.d.ts.map +0 -1
- package/dist/packages/multisig/multisigTypes.js +0 -2
- package/dist/packages/nftAmm/api/nftAmmApi.d.ts +0 -93
- package/dist/packages/nftAmm/api/nftAmmApi.d.ts.map +0 -1
- package/dist/packages/nftAmm/api/nftAmmApi.js +0 -250
- package/dist/packages/nftAmm/api/nftAmmApiCasting.d.ts +0 -6
- package/dist/packages/nftAmm/api/nftAmmApiCasting.d.ts.map +0 -1
- package/dist/packages/nftAmm/api/nftAmmApiCasting.js +0 -43
- package/dist/packages/nftAmm/api/nftAmmApiCastingTypes.d.ts +0 -10
- package/dist/packages/nftAmm/api/nftAmmApiCastingTypes.d.ts.map +0 -1
- package/dist/packages/nftAmm/api/nftAmmApiCastingTypes.js +0 -2
- package/dist/packages/nftAmm/index.d.ts +0 -2
- package/dist/packages/nftAmm/index.d.ts.map +0 -1
- package/dist/packages/nftAmm/index.js +0 -17
- package/dist/packages/nftAmm/nftAmm.d.ts +0 -18
- package/dist/packages/nftAmm/nftAmm.d.ts.map +0 -1
- package/dist/packages/nftAmm/nftAmm.js +0 -73
- package/dist/packages/nftAmm/nftAmmMarket.d.ts +0 -54
- package/dist/packages/nftAmm/nftAmmMarket.d.ts.map +0 -1
- package/dist/packages/nftAmm/nftAmmMarket.js +0 -154
- package/dist/packages/nftAmm/nftAmmTypes.d.ts +0 -51
- package/dist/packages/nftAmm/nftAmmTypes.d.ts.map +0 -1
- package/dist/packages/nftAmm/nftAmmTypes.js +0 -2
- package/dist/packages/perpetuals/api/perpetualsApi.d.ts +0 -44
- package/dist/packages/perpetuals/api/perpetualsApi.d.ts.map +0 -1
- package/dist/packages/perpetuals/api/perpetualsApi.js +0 -1420
- package/dist/packages/perpetuals/api/perpetualsApiCasting.d.ts +0 -27
- package/dist/packages/perpetuals/api/perpetualsApiCasting.d.ts.map +0 -1
- package/dist/packages/perpetuals/api/perpetualsApiCasting.js +0 -463
- package/dist/packages/perpetuals/index.d.ts +0 -5
- package/dist/packages/perpetuals/index.d.ts.map +0 -1
- package/dist/packages/perpetuals/index.js +0 -20
- package/dist/packages/perpetuals/perpetuals.d.ts +0 -860
- package/dist/packages/perpetuals/perpetuals.d.ts.map +0 -1
- package/dist/packages/perpetuals/perpetuals.js +0 -1102
- package/dist/packages/perpetuals/perpetualsAccount.d.ts +0 -780
- package/dist/packages/perpetuals/perpetualsAccount.d.ts.map +0 -1
- package/dist/packages/perpetuals/perpetualsAccount.js +0 -1406
- package/dist/packages/perpetuals/perpetualsCastingTypes.d.ts +0 -170
- package/dist/packages/perpetuals/perpetualsCastingTypes.d.ts.map +0 -1
- package/dist/packages/perpetuals/perpetualsCastingTypes.js +0 -2
- package/dist/packages/perpetuals/perpetualsMarket.d.ts +0 -360
- package/dist/packages/perpetuals/perpetualsMarket.d.ts.map +0 -1
- package/dist/packages/perpetuals/perpetualsMarket.js +0 -475
- package/dist/packages/perpetuals/perpetualsTypes.d.ts +0 -2968
- package/dist/packages/perpetuals/perpetualsTypes.d.ts.map +0 -1
- package/dist/packages/perpetuals/perpetualsTypes.js +0 -165
- package/dist/packages/perpetuals/perpetualsVault.d.ts +0 -438
- package/dist/packages/perpetuals/perpetualsVault.d.ts.map +0 -1
- package/dist/packages/perpetuals/perpetualsVault.js +0 -601
- package/dist/packages/perpetuals/utils/index.d.ts +0 -2
- package/dist/packages/perpetuals/utils/index.d.ts.map +0 -1
- package/dist/packages/perpetuals/utils/index.js +0 -17
- package/dist/packages/perpetuals/utils/perpetualsOrderUtils.d.ts +0 -12
- package/dist/packages/perpetuals/utils/perpetualsOrderUtils.d.ts.map +0 -1
- package/dist/packages/perpetuals/utils/perpetualsOrderUtils.js +0 -60
- package/dist/packages/pools/api/poolsApi.d.ts +0 -342
- package/dist/packages/pools/api/poolsApi.d.ts.map +0 -1
- package/dist/packages/pools/api/poolsApi.js +0 -857
- package/dist/packages/pools/api/poolsApiCasting.d.ts +0 -13
- package/dist/packages/pools/api/poolsApiCasting.d.ts.map +0 -1
- package/dist/packages/pools/api/poolsApiCasting.js +0 -91
- package/dist/packages/pools/api/poolsApiCastingTypes.d.ts +0 -64
- package/dist/packages/pools/api/poolsApiCastingTypes.d.ts.map +0 -1
- package/dist/packages/pools/api/poolsApiCastingTypes.js +0 -2
- package/dist/packages/pools/index.d.ts +0 -3
- package/dist/packages/pools/index.d.ts.map +0 -1
- package/dist/packages/pools/index.js +0 -18
- package/dist/packages/pools/pool.d.ts +0 -459
- package/dist/packages/pools/pool.d.ts.map +0 -1
- package/dist/packages/pools/pool.js +0 -647
- package/dist/packages/pools/pools.d.ts +0 -405
- package/dist/packages/pools/pools.d.ts.map +0 -1
- package/dist/packages/pools/pools.js +0 -533
- package/dist/packages/pools/poolsTypes.d.ts +0 -469
- package/dist/packages/pools/poolsTypes.d.ts.map +0 -1
- package/dist/packages/pools/poolsTypes.js +0 -2
- package/dist/packages/pools/utils/cmmmCalculations.d.ts +0 -42
- package/dist/packages/pools/utils/cmmmCalculations.d.ts.map +0 -1
- package/dist/packages/pools/utils/cmmmCalculations.js +0 -1380
- package/dist/packages/referralVault/api/referralVaultApi.d.ts +0 -39
- package/dist/packages/referralVault/api/referralVaultApi.d.ts.map +0 -1
- package/dist/packages/referralVault/api/referralVaultApi.js +0 -125
- package/dist/packages/referralVault/index.d.ts +0 -2
- package/dist/packages/referralVault/index.d.ts.map +0 -1
- package/dist/packages/referralVault/index.js +0 -17
- package/dist/packages/referralVault/referralVault.d.ts +0 -47
- package/dist/packages/referralVault/referralVault.d.ts.map +0 -1
- package/dist/packages/referralVault/referralVault.js +0 -71
- package/dist/packages/referralVault/referralVaultTypes.d.ts +0 -2
- package/dist/packages/referralVault/referralVaultTypes.d.ts.map +0 -1
- package/dist/packages/referralVault/referralVaultTypes.js +0 -2
- package/dist/packages/referrals/index.d.ts +0 -2
- package/dist/packages/referrals/index.d.ts.map +0 -1
- package/dist/packages/referrals/index.js +0 -17
- package/dist/packages/referrals/referrals.d.ts +0 -27
- package/dist/packages/referrals/referrals.d.ts.map +0 -1
- package/dist/packages/referrals/referrals.js +0 -95
- package/dist/packages/referrals/referralsTypes.d.ts +0 -166
- package/dist/packages/referrals/referralsTypes.d.ts.map +0 -1
- package/dist/packages/referrals/referralsTypes.js +0 -2
- package/dist/packages/rewards/index.d.ts +0 -2
- package/dist/packages/rewards/index.d.ts.map +0 -1
- package/dist/packages/rewards/index.js +0 -17
- package/dist/packages/rewards/rewards.d.ts +0 -21
- package/dist/packages/rewards/rewards.d.ts.map +0 -1
- package/dist/packages/rewards/rewards.js +0 -65
- package/dist/packages/rewards/rewardsTypes.d.ts +0 -169
- package/dist/packages/rewards/rewardsTypes.d.ts.map +0 -1
- package/dist/packages/rewards/rewardsTypes.js +0 -2
- package/dist/packages/router/api/routerApi.d.ts +0 -35
- package/dist/packages/router/api/routerApi.d.ts.map +0 -1
- package/dist/packages/router/api/routerApi.js +0 -88
- package/dist/packages/router/api/routerApiCasting.d.ts +0 -6
- package/dist/packages/router/api/routerApiCasting.d.ts.map +0 -1
- package/dist/packages/router/api/routerApiCasting.js +0 -22
- package/dist/packages/router/api/routerApiCastingTypes.d.ts +0 -12
- package/dist/packages/router/api/routerApiCastingTypes.d.ts.map +0 -1
- package/dist/packages/router/api/routerApiCastingTypes.js +0 -2
- package/dist/packages/router/index.d.ts +0 -2
- package/dist/packages/router/index.d.ts.map +0 -1
- package/dist/packages/router/index.js +0 -17
- package/dist/packages/router/router.d.ts +0 -224
- package/dist/packages/router/router.d.ts.map +0 -1
- package/dist/packages/router/router.js +0 -283
- package/dist/packages/router/routerTypes.d.ts +0 -300
- package/dist/packages/router/routerTypes.d.ts.map +0 -1
- package/dist/packages/router/routerTypes.js +0 -2
- package/dist/packages/staking/api/stakingApi.d.ts +0 -129
- package/dist/packages/staking/api/stakingApi.d.ts.map +0 -1
- package/dist/packages/staking/api/stakingApi.js +0 -487
- package/dist/packages/staking/api/stakingApiCasting.d.ts +0 -11
- package/dist/packages/staking/api/stakingApiCasting.d.ts.map +0 -1
- package/dist/packages/staking/api/stakingApiCasting.js +0 -87
- package/dist/packages/staking/api/stakingApiCastingTypes.d.ts +0 -97
- package/dist/packages/staking/api/stakingApiCastingTypes.d.ts.map +0 -1
- package/dist/packages/staking/api/stakingApiCastingTypes.js +0 -2
- package/dist/packages/staking/index.d.ts +0 -2
- package/dist/packages/staking/index.d.ts.map +0 -1
- package/dist/packages/staking/index.js +0 -17
- package/dist/packages/staking/staking.d.ts +0 -385
- package/dist/packages/staking/staking.d.ts.map +0 -1
- package/dist/packages/staking/staking.js +0 -501
- package/dist/packages/staking/stakingTypes.d.ts +0 -575
- package/dist/packages/staking/stakingTypes.d.ts.map +0 -1
- package/dist/packages/staking/stakingTypes.js +0 -45
- package/dist/packages/sui/api/suiApi.d.ts +0 -21
- package/dist/packages/sui/api/suiApi.d.ts.map +0 -1
- package/dist/packages/sui/api/suiApi.js +0 -46
- package/dist/packages/sui/index.d.ts +0 -2
- package/dist/packages/sui/index.d.ts.map +0 -1
- package/dist/packages/sui/index.js +0 -17
- package/dist/packages/sui/sui.d.ts +0 -53
- package/dist/packages/sui/sui.d.ts.map +0 -1
- package/dist/packages/sui/sui.js +0 -77
- package/dist/packages/suiFrens/api/suiFrensApi.d.ts +0 -204
- package/dist/packages/suiFrens/api/suiFrensApi.d.ts.map +0 -1
- package/dist/packages/suiFrens/api/suiFrensApi.js +0 -756
- package/dist/packages/suiFrens/api/suiFrensApiCasting.d.ts +0 -21
- package/dist/packages/suiFrens/api/suiFrensApiCasting.d.ts.map +0 -1
- package/dist/packages/suiFrens/api/suiFrensApiCasting.js +0 -181
- package/dist/packages/suiFrens/api/suiFrensApiCastingTypes.d.ts +0 -77
- package/dist/packages/suiFrens/api/suiFrensApiCastingTypes.d.ts.map +0 -1
- package/dist/packages/suiFrens/api/suiFrensApiCastingTypes.js +0 -2
- package/dist/packages/suiFrens/index.d.ts +0 -4
- package/dist/packages/suiFrens/index.d.ts.map +0 -1
- package/dist/packages/suiFrens/index.js +0 -19
- package/dist/packages/suiFrens/stakedSuiFren.d.ts +0 -31
- package/dist/packages/suiFrens/stakedSuiFren.d.ts.map +0 -1
- package/dist/packages/suiFrens/stakedSuiFren.js +0 -90
- package/dist/packages/suiFrens/suiFren.d.ts +0 -32
- package/dist/packages/suiFrens/suiFren.d.ts.map +0 -1
- package/dist/packages/suiFrens/suiFren.js +0 -150
- package/dist/packages/suiFrens/suiFrens.d.ts +0 -56
- package/dist/packages/suiFrens/suiFrens.d.ts.map +0 -1
- package/dist/packages/suiFrens/suiFrens.js +0 -218
- package/dist/packages/suiFrens/suiFrensTypes.d.ts +0 -148
- package/dist/packages/suiFrens/suiFrensTypes.d.ts.map +0 -1
- package/dist/packages/suiFrens/suiFrensTypes.js +0 -8
- package/dist/packages/userData/index.d.ts +0 -2
- package/dist/packages/userData/index.d.ts.map +0 -1
- package/dist/packages/userData/index.js +0 -17
- package/dist/packages/userData/userData.d.ts +0 -89
- package/dist/packages/userData/userData.d.ts.map +0 -1
- package/dist/packages/userData/userData.js +0 -119
- package/dist/packages/userData/userDataTypes.d.ts +0 -29
- package/dist/packages/userData/userDataTypes.d.ts.map +0 -1
- package/dist/packages/userData/userDataTypes.js +0 -2
- package/dist/types.d.ts +0 -15
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -31
|
@@ -1,473 +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
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.FarmsStakedPosition = void 0;
|
|
16
|
-
const caller_1 = require("../../general/utils/caller");
|
|
17
|
-
const farmsStakingPool_1 = require("./farmsStakingPool");
|
|
18
|
-
const fixedUtils_1 = require("../../general/utils/fixedUtils");
|
|
19
|
-
const utils_1 = require("../../general/utils");
|
|
20
|
-
const dayjs_1 = __importDefault(require("dayjs"));
|
|
21
|
-
const farms_1 = require("./farms");
|
|
22
|
-
/**
|
|
23
|
-
* The `FarmsStakedPosition` class represents a user's individual staked position
|
|
24
|
-
* in a particular staking pool. It provides methods to query position details,
|
|
25
|
-
* calculate potential rewards, lock/unlock stake, and build transactions
|
|
26
|
-
* for depositing, unstaking, or harvesting rewards.
|
|
27
|
-
*/
|
|
28
|
-
class FarmsStakedPosition extends caller_1.Caller {
|
|
29
|
-
// =========================================================================
|
|
30
|
-
// Constructor
|
|
31
|
-
// =========================================================================
|
|
32
|
-
/**
|
|
33
|
-
* Creates a `FarmsStakedPosition` instance for a user's staked position in a farm.
|
|
34
|
-
*
|
|
35
|
-
* @param stakedPosition - The on-chain data object representing the user's staked position.
|
|
36
|
-
* @param trueLastHarvestRewardsTimestamp - Optionally overrides the last harvest time from the on-chain data.
|
|
37
|
-
* @param config - Optional configuration for the underlying `Caller`.
|
|
38
|
-
* @param Provider - Optional `AftermathApi` instance for transaction building.
|
|
39
|
-
*/
|
|
40
|
-
constructor(stakedPosition, trueLastHarvestRewardsTimestamp = undefined, config, Provider) {
|
|
41
|
-
super(config, "farms");
|
|
42
|
-
this.stakedPosition = stakedPosition;
|
|
43
|
-
this.Provider = Provider;
|
|
44
|
-
// =========================================================================
|
|
45
|
-
// Public
|
|
46
|
-
// =========================================================================
|
|
47
|
-
// =========================================================================
|
|
48
|
-
// Getters
|
|
49
|
-
// =========================================================================
|
|
50
|
-
/**
|
|
51
|
-
* Returns the version of the farm system that this position belongs to (1 or 2).
|
|
52
|
-
*/
|
|
53
|
-
this.version = () => {
|
|
54
|
-
return this.stakedPosition.version;
|
|
55
|
-
};
|
|
56
|
-
/**
|
|
57
|
-
* Checks whether the position is still locked, based on the current time and the lock parameters.
|
|
58
|
-
*
|
|
59
|
-
* @param inputs - Contains a `FarmsStakingPool` instance to check for system constraints.
|
|
60
|
-
* @returns `true` if the position is locked; otherwise, `false`.
|
|
61
|
-
*/
|
|
62
|
-
this.isLocked = (inputs) => {
|
|
63
|
-
return !this.isUnlocked(inputs);
|
|
64
|
-
};
|
|
65
|
-
/**
|
|
66
|
-
* Checks if the position is strictly locked, meaning it is currently locked and the pool uses strict lock enforcement.
|
|
67
|
-
*
|
|
68
|
-
* @param inputs - Contains a `FarmsStakingPool` instance to check lock state and enforcement.
|
|
69
|
-
* @returns `true` if locked with strict enforcement; otherwise, `false`.
|
|
70
|
-
*/
|
|
71
|
-
this.isStrictlyLocked = (inputs) => {
|
|
72
|
-
const { stakingPool } = inputs;
|
|
73
|
-
return (this.isLocked({ stakingPool }) &&
|
|
74
|
-
stakingPool.isStrictLockEnforcement());
|
|
75
|
-
};
|
|
76
|
-
/**
|
|
77
|
-
* Checks if the position is relaxed locked, meaning it is currently locked and the pool uses relaxed lock enforcement.
|
|
78
|
-
*
|
|
79
|
-
* @param inputs - Contains a `FarmsStakingPool` instance to check lock state and enforcement.
|
|
80
|
-
* @returns `true` if locked with relaxed enforcement; otherwise, `false`.
|
|
81
|
-
*/
|
|
82
|
-
this.isRelaxedLocked = (inputs) => {
|
|
83
|
-
const { stakingPool } = inputs;
|
|
84
|
-
return (this.isLocked({ stakingPool }) &&
|
|
85
|
-
stakingPool.isRelaxedLockEnforcement());
|
|
86
|
-
};
|
|
87
|
-
/**
|
|
88
|
-
* Checks whether the position has a non-zero lock duration.
|
|
89
|
-
*
|
|
90
|
-
* @returns `true` if the position was created with a lock duration > 0.
|
|
91
|
-
*/
|
|
92
|
-
this.isLockDuration = () => {
|
|
93
|
-
return this.stakedPosition.lockDurationMs > 0;
|
|
94
|
-
};
|
|
95
|
-
/**
|
|
96
|
-
* Computes the timestamp (in ms) at which this position's lock will end.
|
|
97
|
-
*
|
|
98
|
-
* @returns The unlock timestamp (lock start + lock duration).
|
|
99
|
-
*/
|
|
100
|
-
this.unlockTimestamp = () => {
|
|
101
|
-
return (this.stakedPosition.lockStartTimestamp +
|
|
102
|
-
this.stakedPosition.lockDurationMs);
|
|
103
|
-
};
|
|
104
|
-
/**
|
|
105
|
-
* Computes the user's accrued rewards for each reward coin in this position,
|
|
106
|
-
* returned as a `CoinsToBalance` object keyed by coin type.
|
|
107
|
-
*
|
|
108
|
-
* @param inputs - Contains a reference to the `FarmsStakingPool`.
|
|
109
|
-
* @returns A mapping from `coinType` to the amount of earned rewards.
|
|
110
|
-
*/
|
|
111
|
-
this.rewardCoinsToClaimableBalance = (inputs) => {
|
|
112
|
-
return this.stakedPosition.rewardCoins.reduce((acc, coin) => (Object.assign(Object.assign({}, acc), { [coin.coinType]: this.rewardsEarned(Object.assign(Object.assign({}, inputs), { coinType: coin.coinType })) })), {});
|
|
113
|
-
};
|
|
114
|
-
/**
|
|
115
|
-
* Lists all reward coin types associated with this position.
|
|
116
|
-
*
|
|
117
|
-
* @returns An array of `CoinType` strings representing the reward coins.
|
|
118
|
-
*/
|
|
119
|
-
this.rewardCoinTypes = () => {
|
|
120
|
-
return this.stakedPosition.rewardCoins.map((coin) => coin.coinType);
|
|
121
|
-
};
|
|
122
|
-
/**
|
|
123
|
-
* Returns only the reward coin types that currently have a non-zero claimable balance.
|
|
124
|
-
*
|
|
125
|
-
* @param inputs - Contains a reference to the `FarmsStakingPool`.
|
|
126
|
-
* @returns An array of `CoinType` strings that have pending rewards > 0.
|
|
127
|
-
*/
|
|
128
|
-
this.nonZeroRewardCoinTypes = (inputs) => {
|
|
129
|
-
return Object.entries(this.rewardCoinsToClaimableBalance(inputs))
|
|
130
|
-
.filter(([, val]) => val > BigInt(0))
|
|
131
|
-
.map(([key]) => key);
|
|
132
|
-
};
|
|
133
|
-
/**
|
|
134
|
-
* Retrieves the reward coin record for a specific coin type in this position.
|
|
135
|
-
*
|
|
136
|
-
* @param inputs - Must contain a `coinType` string to look up.
|
|
137
|
-
* @throws If the coin type is not found in this position.
|
|
138
|
-
* @returns The reward coin object from the position.
|
|
139
|
-
*/
|
|
140
|
-
this.rewardCoin = (inputs) => {
|
|
141
|
-
const foundCoin = this.stakedPosition.rewardCoins.find((coin) => coin.coinType === inputs.coinType);
|
|
142
|
-
if (!foundCoin)
|
|
143
|
-
throw new Error("Invalid coin type");
|
|
144
|
-
return foundCoin;
|
|
145
|
-
};
|
|
146
|
-
/**
|
|
147
|
-
* Checks if this position has any claimable rewards across all reward coin types.
|
|
148
|
-
*
|
|
149
|
-
* @param inputs - Contains a reference to the `FarmsStakingPool`.
|
|
150
|
-
* @returns `true` if there are unclaimed rewards; otherwise, `false`.
|
|
151
|
-
*/
|
|
152
|
-
this.hasClaimableRewards = (inputs) => {
|
|
153
|
-
const { stakingPool } = inputs;
|
|
154
|
-
return (utils_1.Helpers.sumBigInt(this.rewardCoinTypes().map((coinType) => this.rewardsEarned({
|
|
155
|
-
coinType,
|
|
156
|
-
stakingPool,
|
|
157
|
-
}))) > BigInt(0));
|
|
158
|
-
};
|
|
159
|
-
// =========================================================================
|
|
160
|
-
// Calculations
|
|
161
|
-
// =========================================================================
|
|
162
|
-
/**
|
|
163
|
-
* Calculates the current amount of earned rewards for a specific coin type,
|
|
164
|
-
* factoring in any emission constraints and the pool's actual reward availability.
|
|
165
|
-
*
|
|
166
|
-
* @param inputs - Contains the `coinType` to check and a reference to the `FarmsStakingPool`.
|
|
167
|
-
* @returns The total `BigInt` amount of rewards earned for the specified coin type.
|
|
168
|
-
*/
|
|
169
|
-
this.rewardsEarned = (inputs) => {
|
|
170
|
-
if (inputs.stakingPool.rewardCoin(inputs).actualRewards === BigInt(0))
|
|
171
|
-
return BigInt(0);
|
|
172
|
-
// this.updatePosition(inputs);
|
|
173
|
-
const rewardCoin = this.rewardCoin(inputs);
|
|
174
|
-
const totalRewards = rewardCoin.multiplierRewardsAccumulated +
|
|
175
|
-
rewardCoin.baseRewardsAccumulated;
|
|
176
|
-
// If below the minimum threshold to claim, show 0. If the total rewards
|
|
177
|
-
// exceed what's actually in the pool, we clamp it to 0 or a logic fallback.
|
|
178
|
-
if (totalRewards < farms_1.Farms.constants.minRewardsToClaim) {
|
|
179
|
-
return BigInt(0);
|
|
180
|
-
}
|
|
181
|
-
// Additional clamp to handle overshoot beyond actual pool reserves
|
|
182
|
-
return totalRewards >
|
|
183
|
-
inputs.stakingPool.rewardCoin(inputs).actualRewards
|
|
184
|
-
? BigInt(0)
|
|
185
|
-
: totalRewards;
|
|
186
|
-
};
|
|
187
|
-
/**
|
|
188
|
-
* Updates the position's reward calculations based on the pool's current
|
|
189
|
-
* emission state, effectively "syncing" the on-chain logic into this local
|
|
190
|
-
* representation. Also checks if the lock duration has elapsed.
|
|
191
|
-
*
|
|
192
|
-
* @param inputs - Contains a reference to the `FarmsStakingPool`.
|
|
193
|
-
* @remarks This method is typically called before computing `rewardsEarned()`.
|
|
194
|
-
*/
|
|
195
|
-
this.updatePosition = (inputs) => {
|
|
196
|
-
const stakingPool = new farmsStakingPool_1.FarmsStakingPool(utils_1.Helpers.deepCopy(inputs.stakingPool.stakingPool), this.config);
|
|
197
|
-
// If the lock multiplier is valid, proceed. If not, adjust the staked position
|
|
198
|
-
// to the pool's maximum allowed lock multiplier or duration.
|
|
199
|
-
if (this.stakedPosition.lockDurationMs <=
|
|
200
|
-
stakingPool.stakingPool.maxLockDurationMs &&
|
|
201
|
-
this.stakedPosition.lockMultiplier <=
|
|
202
|
-
stakingPool.stakingPool.maxLockMultiplier) {
|
|
203
|
-
// Lock multiplier is valid; do nothing special
|
|
204
|
-
}
|
|
205
|
-
else {
|
|
206
|
-
// The position's lock duration or multiplier exceeds the pool's max allowed -> clamp
|
|
207
|
-
stakingPool.stakingPool.stakedAmountWithMultiplier -=
|
|
208
|
-
this.stakedPosition.stakedAmountWithMultiplier;
|
|
209
|
-
// ii. Update the `lock_duration` and `lock_multiplier` related fields.
|
|
210
|
-
this.stakedPosition.lockDurationMs =
|
|
211
|
-
stakingPool.stakingPool.maxLockDurationMs;
|
|
212
|
-
this.stakedPosition.lockMultiplier =
|
|
213
|
-
stakingPool.stakingPool.maxLockMultiplier;
|
|
214
|
-
this.stakedPosition.stakedAmountWithMultiplier =
|
|
215
|
-
(this.stakedPosition.stakedAmount *
|
|
216
|
-
(this.stakedPosition.lockMultiplier -
|
|
217
|
-
fixedUtils_1.FixedUtils.fixedOneB)) /
|
|
218
|
-
fixedUtils_1.FixedUtils.fixedOneB;
|
|
219
|
-
this.stakedPosition.rewardCoins = [
|
|
220
|
-
...this.stakedPosition.rewardCoins.map((rewardCoin) => {
|
|
221
|
-
const currentDebtPerShare = stakingPool.rewardCoin({
|
|
222
|
-
coinType: rewardCoin.coinType,
|
|
223
|
-
}).rewardsAccumulatedPerShare;
|
|
224
|
-
return Object.assign(Object.assign({}, rewardCoin), { multiplierRewardsDebt: (this.stakedPosition.stakedAmountWithMultiplier *
|
|
225
|
-
currentDebtPerShare) /
|
|
226
|
-
fixedUtils_1.FixedUtils.fixedOneB });
|
|
227
|
-
}),
|
|
228
|
-
];
|
|
229
|
-
// iii. Increase the `Vault`'s `total_staked_amount_with_multiplier` to account for the
|
|
230
|
-
// positions new lock multiplier.
|
|
231
|
-
stakingPool.stakingPool.stakedAmountWithMultiplier +=
|
|
232
|
-
this.stakedPosition.stakedAmountWithMultiplier;
|
|
233
|
-
}
|
|
234
|
-
const currentTimestamp = (0, dayjs_1.default)().valueOf();
|
|
235
|
-
// Accumulate any newly emitted rewards in the pool’s state
|
|
236
|
-
stakingPool.emitRewards();
|
|
237
|
-
// Update position’s base + multiplier rewards using the updated pool info
|
|
238
|
-
for (const [rewardCoinIndex, rewardCoin,] of stakingPool.stakingPool.rewardCoins.entries()) {
|
|
239
|
-
//******************************************************************************************//
|
|
240
|
-
// debt (i.e. total_rewards_from_time_t0_to_th-1) //
|
|
241
|
-
// .--- pending_rewards_at_time_th_minus_1 ---| //
|
|
242
|
-
// |------------------------------------------+-------------------------------------------| //
|
|
243
|
-
// t0 th-1 now //
|
|
244
|
-
// '----------------------------- total_rewards_from_time_t0 -----------------------------' //
|
|
245
|
-
//******************************************************************************************//
|
|
246
|
-
// NOTE: new reward types might have been added to the vault since this position last called
|
|
247
|
-
// `update_ pending_rewards`, so we need to be cautious when borrowing from `rewards_debt`
|
|
248
|
-
// and `rewards_accumulated`.
|
|
249
|
-
//
|
|
250
|
-
if (rewardCoinIndex >= this.stakedPosition.rewardCoins.length) {
|
|
251
|
-
this.stakedPosition.rewardCoins.push({
|
|
252
|
-
coinType: rewardCoin.coinType,
|
|
253
|
-
baseRewardsAccumulated: BigInt(0),
|
|
254
|
-
baseRewardsDebt: BigInt(0),
|
|
255
|
-
multiplierRewardsAccumulated: BigInt(0),
|
|
256
|
-
multiplierRewardsDebt: BigInt(0),
|
|
257
|
-
});
|
|
258
|
-
}
|
|
259
|
-
const stakedPositionRewardCoin = this.stakedPosition.rewardCoins[rewardCoinIndex];
|
|
260
|
-
const [totalBaseRewardsFromTimeT0, totalMultiplierRewardsFromTimeT0,] = this.calcTotalRewardsFromTimeT0({
|
|
261
|
-
rewardsAccumulatedPerShare: rewardCoin.rewardsAccumulatedPerShare,
|
|
262
|
-
multiplierRewardsDebt: stakedPositionRewardCoin.multiplierRewardsDebt,
|
|
263
|
-
emissionEndTimestamp: stakingPool.stakingPool.emissionEndTimestamp,
|
|
264
|
-
});
|
|
265
|
-
// Add newly accrued rewards since the last update
|
|
266
|
-
this.stakedPosition.rewardCoins[rewardCoinIndex].baseRewardsAccumulated =
|
|
267
|
-
totalBaseRewardsFromTimeT0 -
|
|
268
|
-
stakedPositionRewardCoin.baseRewardsDebt +
|
|
269
|
-
stakedPositionRewardCoin.baseRewardsAccumulated;
|
|
270
|
-
this.stakedPosition.rewardCoins[rewardCoinIndex].multiplierRewardsAccumulated =
|
|
271
|
-
totalMultiplierRewardsFromTimeT0 -
|
|
272
|
-
stakedPositionRewardCoin.multiplierRewardsDebt +
|
|
273
|
-
stakedPositionRewardCoin.multiplierRewardsAccumulated;
|
|
274
|
-
// Update debts to the new total from time t0
|
|
275
|
-
this.stakedPosition.rewardCoins[rewardCoinIndex].baseRewardsDebt =
|
|
276
|
-
totalBaseRewardsFromTimeT0;
|
|
277
|
-
this.stakedPosition.rewardCoins[rewardCoinIndex].multiplierRewardsDebt = totalMultiplierRewardsFromTimeT0;
|
|
278
|
-
}
|
|
279
|
-
// Check if this position’s lock has expired
|
|
280
|
-
// if (this.unlockTimestamp() < currentTimestamp) {
|
|
281
|
-
// this.unlock();
|
|
282
|
-
// }
|
|
283
|
-
this.stakedPosition.lastHarvestRewardsTimestamp = currentTimestamp;
|
|
284
|
-
};
|
|
285
|
-
// /**
|
|
286
|
-
// * Removes the lock multiplier from this position if the current time is beyond the lock duration,
|
|
287
|
-
// * reverting `lockMultiplier` to 1.0 (fixedOneB).
|
|
288
|
-
// */
|
|
289
|
-
// private unlock = () => {
|
|
290
|
-
// // ia. Remove position's `multiplier_staked_amount` from the pool.
|
|
291
|
-
// // afterburner_vault::decrease_stake_with_multiplier(vault, self.multiplier_staked_amount);
|
|
292
|
-
// this.stakedPosition.stakedAmountWithMultiplier = BigInt(0);
|
|
293
|
-
// // ib. Reset position's lock parameters.
|
|
294
|
-
// this.stakedPosition.lockDurationMs = 0;
|
|
295
|
-
// this.stakedPosition.lockMultiplier = FixedUtils.fixedOneB;
|
|
296
|
-
// };
|
|
297
|
-
/**
|
|
298
|
-
* Determines if this position is unlocked based on the lock end timestamp, the emission end timestamp,
|
|
299
|
-
* or a forced unlock condition in the pool.
|
|
300
|
-
*/
|
|
301
|
-
this.isUnlocked = (inputs) => {
|
|
302
|
-
const { stakingPool } = inputs;
|
|
303
|
-
const currentTime = (0, dayjs_1.default)().valueOf();
|
|
304
|
-
// If lock has expired, the emission has ended, or the pool is forcibly unlocked, then it is unlocked
|
|
305
|
-
return (this.unlockTimestamp() <= currentTime ||
|
|
306
|
-
stakingPool.stakingPool.emissionEndTimestamp <= currentTime ||
|
|
307
|
-
stakingPool.stakingPool.isUnlocked);
|
|
308
|
-
};
|
|
309
|
-
/**
|
|
310
|
-
* Provides access to the `Farms` provider in the `AftermathApi`.
|
|
311
|
-
*/
|
|
312
|
-
this.useProvider = () => {
|
|
313
|
-
var _a;
|
|
314
|
-
const provider = (_a = this.Provider) === null || _a === void 0 ? void 0 : _a.Farms();
|
|
315
|
-
if (!provider)
|
|
316
|
-
throw new Error("missing AftermathApi Provider");
|
|
317
|
-
return provider;
|
|
318
|
-
};
|
|
319
|
-
this.stakedPosition = stakedPosition;
|
|
320
|
-
this.trueLastHarvestRewardsTimestamp =
|
|
321
|
-
trueLastHarvestRewardsTimestamp !== null && trueLastHarvestRewardsTimestamp !== void 0 ? trueLastHarvestRewardsTimestamp : stakedPosition.lastHarvestRewardsTimestamp;
|
|
322
|
-
}
|
|
323
|
-
// =========================================================================
|
|
324
|
-
// Transactions
|
|
325
|
-
// =========================================================================
|
|
326
|
-
// =========================================================================
|
|
327
|
-
// Staking Transactions
|
|
328
|
-
// =========================================================================
|
|
329
|
-
/**
|
|
330
|
-
* Builds a transaction to deposit additional principal into this staked position.
|
|
331
|
-
*
|
|
332
|
-
* @param inputs - Contains `depositAmount`, the `walletAddress` performing the deposit, and optional sponsorship.
|
|
333
|
-
* @returns A transaction object (or bytes) that can be signed and executed to increase stake.
|
|
334
|
-
*/
|
|
335
|
-
getDepositPrincipalTransaction(inputs) {
|
|
336
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
337
|
-
const args = Object.assign(Object.assign({}, inputs), { stakedPositionId: this.stakedPosition.objectId, stakeCoinType: this.stakedPosition.stakeCoinType, stakingPoolId: this.stakedPosition.stakingPoolObjectId });
|
|
338
|
-
return this.version() === 1
|
|
339
|
-
? this.useProvider().fetchBuildDepositPrincipalTxV1(args)
|
|
340
|
-
: this.useProvider().fetchBuildDepositPrincipalTxV2(args);
|
|
341
|
-
});
|
|
342
|
-
}
|
|
343
|
-
/**
|
|
344
|
-
* Builds a transaction to unstake this entire position, optionally claiming SUI as afSUI.
|
|
345
|
-
*
|
|
346
|
-
* @param inputs - Contains `walletAddress`, the `FarmsStakingPool` reference, and optional `claimSuiAsAfSui`.
|
|
347
|
-
* @returns A transaction that can be signed and executed to fully withdraw principal and possibly rewards.
|
|
348
|
-
*/
|
|
349
|
-
getUnstakeTransaction(inputs) {
|
|
350
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
351
|
-
const args = Object.assign(Object.assign({}, inputs), { stakedPositionId: this.stakedPosition.objectId, stakeCoinType: this.stakedPosition.stakeCoinType, stakingPoolId: this.stakedPosition.stakingPoolObjectId, withdrawAmount: this.stakedPosition.stakedAmount, rewardCoinTypes: this.nonZeroRewardCoinTypes(inputs) });
|
|
352
|
-
return this.version() === 1
|
|
353
|
-
? this.useProvider().buildUnstakeTxV1(args)
|
|
354
|
-
: this.useProvider().buildUnstakeTxV2(args);
|
|
355
|
-
});
|
|
356
|
-
}
|
|
357
|
-
/**
|
|
358
|
-
* Builds a transaction to withdraw a partial amount of principal from this staked position.
|
|
359
|
-
* Unlike `getUnstakeTransaction`, this does NOT destroy the position.
|
|
360
|
-
*
|
|
361
|
-
* @param inputs - Contains `walletAddress`, `withdrawAmount`, and the `FarmsStakingPool` reference.
|
|
362
|
-
* @returns A transaction that can be signed and executed to withdraw principal without destroying the position.
|
|
363
|
-
*/
|
|
364
|
-
getWithdrawPrincipalTransaction(inputs) {
|
|
365
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
366
|
-
const args = Object.assign(Object.assign({}, inputs), { stakedPositionId: this.stakedPosition.objectId, stakeCoinType: this.stakedPosition.stakeCoinType, stakingPoolId: this.stakedPosition.stakingPoolObjectId });
|
|
367
|
-
return this.version() === 1
|
|
368
|
-
? this.useProvider().buildWithdrawPrincipalTxV1(args)
|
|
369
|
-
: this.useProvider().buildWithdrawPrincipalTxV2(args);
|
|
370
|
-
});
|
|
371
|
-
}
|
|
372
|
-
// =========================================================================
|
|
373
|
-
// Locking Transactions
|
|
374
|
-
// =========================================================================
|
|
375
|
-
/**
|
|
376
|
-
* Builds a transaction to lock this position for a specified duration, increasing its lock multiplier (if any).
|
|
377
|
-
*
|
|
378
|
-
* @param inputs - Contains the `lockDurationMs` and the `walletAddress`.
|
|
379
|
-
* @returns A transaction that can be signed and executed to lock the position.
|
|
380
|
-
*/
|
|
381
|
-
getLockTransaction(inputs) {
|
|
382
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
383
|
-
const args = Object.assign(Object.assign({}, inputs), { stakedPositionId: this.stakedPosition.objectId, stakeCoinType: this.stakedPosition.stakeCoinType, stakingPoolId: this.stakedPosition.stakingPoolObjectId });
|
|
384
|
-
return this.version() === 1
|
|
385
|
-
? this.useProvider().buildLockTxV1(args)
|
|
386
|
-
: this.useProvider().buildLockTxV2(args);
|
|
387
|
-
});
|
|
388
|
-
}
|
|
389
|
-
/**
|
|
390
|
-
* Builds a transaction to re-lock this position (renew lock duration) at the current multiplier.
|
|
391
|
-
*
|
|
392
|
-
* @param inputs - Contains the `walletAddress`.
|
|
393
|
-
* @returns A transaction that can be signed and executed to extend or refresh the lock.
|
|
394
|
-
*/
|
|
395
|
-
getRenewLockTransaction(inputs) {
|
|
396
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
397
|
-
const args = Object.assign(Object.assign({}, inputs), { stakedPositionId: this.stakedPosition.objectId, stakeCoinType: this.stakedPosition.stakeCoinType, stakingPoolId: this.stakedPosition.stakingPoolObjectId });
|
|
398
|
-
return this.version() === 1
|
|
399
|
-
? this.useProvider().buildRenewLockTxV1(args)
|
|
400
|
-
: this.useProvider().buildRenewLockTxV2(args);
|
|
401
|
-
});
|
|
402
|
-
}
|
|
403
|
-
/**
|
|
404
|
-
* Builds a transaction to unlock this position, removing any lock-based multiplier.
|
|
405
|
-
*
|
|
406
|
-
* @param inputs - Contains the `walletAddress`.
|
|
407
|
-
* @returns A transaction that can be signed and executed to unlock the position immediately.
|
|
408
|
-
*/
|
|
409
|
-
getUnlockTransaction(inputs) {
|
|
410
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
411
|
-
const args = Object.assign(Object.assign({}, inputs), { stakedPositionId: this.stakedPosition.objectId, stakeCoinType: this.stakedPosition.stakeCoinType, stakingPoolId: this.stakedPosition.stakingPoolObjectId });
|
|
412
|
-
return this.version() === 1
|
|
413
|
-
? this.useProvider().buildUnlockTxV1(args)
|
|
414
|
-
: this.useProvider().buildUnlockTxV2(args);
|
|
415
|
-
});
|
|
416
|
-
}
|
|
417
|
-
// =========================================================================
|
|
418
|
-
// Reward Harvesting Transactions
|
|
419
|
-
// =========================================================================
|
|
420
|
-
/**
|
|
421
|
-
* Builds a transaction to harvest (claim) the rewards from this position,
|
|
422
|
-
* optionally receiving SUI as afSUI.
|
|
423
|
-
*
|
|
424
|
-
* @param inputs - Includes the `walletAddress`, the `FarmsStakingPool`, and optional `claimSuiAsAfSui`.
|
|
425
|
-
* @returns A transaction that can be signed and executed to claim accrued rewards.
|
|
426
|
-
*/
|
|
427
|
-
getHarvestRewardsTransaction(inputs) {
|
|
428
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
429
|
-
const args = Object.assign(Object.assign({}, inputs), { stakedPositionIds: [this.stakedPosition.objectId], stakeCoinType: this.stakedPosition.stakeCoinType, stakingPoolId: this.stakedPosition.stakingPoolObjectId, rewardCoinTypes: this.nonZeroRewardCoinTypes(inputs) });
|
|
430
|
-
return this.version() === 1
|
|
431
|
-
? this.useProvider().buildHarvestRewardsTxV1(args)
|
|
432
|
-
: this.useProvider().buildHarvestRewardsTxV2(args);
|
|
433
|
-
});
|
|
434
|
-
}
|
|
435
|
-
// =========================================================================
|
|
436
|
-
// Private
|
|
437
|
-
// =========================================================================
|
|
438
|
-
// =========================================================================
|
|
439
|
-
// Calculations
|
|
440
|
-
// =========================================================================
|
|
441
|
-
/**
|
|
442
|
-
* Calculates the total base + multiplier rewards from time t0 for this position,
|
|
443
|
-
* ensuring that multiplier rewards only apply during the locked period.
|
|
444
|
-
*
|
|
445
|
-
* @param inputs - Contains updated `rewardsAccumulatedPerShare`, the position’s `multiplierRewardsDebt`, and the pool’s `emissionEndTimestamp`.
|
|
446
|
-
* @returns A tuple `[baseRewards, multiplierRewards]`.
|
|
447
|
-
*/
|
|
448
|
-
calcTotalRewardsFromTimeT0(inputs) {
|
|
449
|
-
const { rewardsAccumulatedPerShare, multiplierRewardsDebt, emissionEndTimestamp, } = inputs;
|
|
450
|
-
const lastRewardTimestamp = this.stakedPosition.lastHarvestRewardsTimestamp;
|
|
451
|
-
const lockEndTimestamp = this.unlockTimestamp();
|
|
452
|
-
const principalStakedAmount = this.stakedPosition.stakedAmount;
|
|
453
|
-
const baseRewards = (principalStakedAmount * rewardsAccumulatedPerShare) /
|
|
454
|
-
fixedUtils_1.FixedUtils.fixedOneB;
|
|
455
|
-
// const totalMultiplierRewards =
|
|
456
|
-
// (this.stakedPosition.stakedAmountWithMultiplier *
|
|
457
|
-
// rewardsAccumulatedPerShare) /
|
|
458
|
-
// FixedUtils.fixedOneB;
|
|
459
|
-
const multiplierEndTimestamp = Math.min(lockEndTimestamp, emissionEndTimestamp);
|
|
460
|
-
const multiplierRewards = (() => {
|
|
461
|
-
if (lastRewardTimestamp <= multiplierEndTimestamp) {
|
|
462
|
-
return ((rewardsAccumulatedPerShare *
|
|
463
|
-
this.stakedPosition.stakedAmountWithMultiplier) /
|
|
464
|
-
fixedUtils_1.FixedUtils.fixedOneB);
|
|
465
|
-
}
|
|
466
|
-
else {
|
|
467
|
-
return multiplierRewardsDebt;
|
|
468
|
-
}
|
|
469
|
-
})();
|
|
470
|
-
return [baseRewards, multiplierRewards];
|
|
471
|
-
}
|
|
472
|
-
}
|
|
473
|
-
exports.FarmsStakedPosition = FarmsStakedPosition;
|