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,857 +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.PoolsApi = void 0;
|
|
13
|
-
const transactions_1 = require("@mysten/sui/transactions");
|
|
14
|
-
const utils_1 = require("@mysten/sui/utils");
|
|
15
|
-
const casting_1 = require("../../../general/utils/casting");
|
|
16
|
-
const pools_1 = require("../pools");
|
|
17
|
-
const utils_2 = require("../../../general/utils");
|
|
18
|
-
const coin_1 = require("../../coin");
|
|
19
|
-
const eventsApiHelpers_1 = require("../../../general/apiHelpers/eventsApiHelpers");
|
|
20
|
-
const bcs_1 = require("@mysten/sui/bcs");
|
|
21
|
-
/**
|
|
22
|
-
* This file contains the implementation of the PoolsApi class, which provides methods for interacting with the Aftermath protocol's pools.
|
|
23
|
-
* @packageDocumentation
|
|
24
|
-
*/
|
|
25
|
-
/**
|
|
26
|
-
* Provides methods to interact with the Pools API.
|
|
27
|
-
*/
|
|
28
|
-
class PoolsApi {
|
|
29
|
-
// =========================================================================
|
|
30
|
-
// Constructor
|
|
31
|
-
// =========================================================================
|
|
32
|
-
/**
|
|
33
|
-
* Creates an instance of PoolsApi.
|
|
34
|
-
* @param {AftermathApi} Provider - An instance of AftermathApi.
|
|
35
|
-
* @throws {Error} Throws an error if not all required addresses have been set in AfSdk
|
|
36
|
-
*/
|
|
37
|
-
constructor(Provider) {
|
|
38
|
-
this.Provider = Provider;
|
|
39
|
-
// =========================================================================
|
|
40
|
-
// Public Methods
|
|
41
|
-
// =========================================================================
|
|
42
|
-
// =========================================================================
|
|
43
|
-
// Objects
|
|
44
|
-
// =========================================================================
|
|
45
|
-
this.fetchOwnedDaoFeePoolOwnerCaps = (inputs) => __awaiter(this, void 0, void 0, function* () {
|
|
46
|
-
const { walletAddress } = inputs;
|
|
47
|
-
if (!this.objectTypes.daoFeePoolOwnerCap)
|
|
48
|
-
throw new Error("dao fee pool addresses have not been set in provider");
|
|
49
|
-
return this.Provider.Objects().fetchCastObjectsOwnedByAddressOfType({
|
|
50
|
-
walletAddress,
|
|
51
|
-
objectType: this.objectTypes.daoFeePoolOwnerCap,
|
|
52
|
-
objectFromSuiObjectResponse: casting_1.Casting.pools.daoFeePoolOwnerCapObjectFromSuiObjectResponse,
|
|
53
|
-
});
|
|
54
|
-
});
|
|
55
|
-
// =========================================================================
|
|
56
|
-
// Transaction Commands
|
|
57
|
-
// =========================================================================
|
|
58
|
-
/**
|
|
59
|
-
* Executes a trade transaction on the specified pool.
|
|
60
|
-
* @param inputs An object containing the necessary inputs for the trade transaction.
|
|
61
|
-
* @returns A `TransactionObjectArgument` representing the trade transaction.
|
|
62
|
-
*/
|
|
63
|
-
this.tradeTx = (inputs) => {
|
|
64
|
-
const { tx, poolId, coinInId, coinInType, expectedCoinOutAmount, coinOutType, lpCoinType, slippage, withTransfer, } = inputs;
|
|
65
|
-
return tx.moveCall({
|
|
66
|
-
target: utils_2.Helpers.transactions.createTxTarget(withTransfer
|
|
67
|
-
? this.addresses.pools.packages.ammInterface
|
|
68
|
-
: this.addresses.pools.packages.amm, withTransfer
|
|
69
|
-
? PoolsApi.constants.moduleNames.interface
|
|
70
|
-
: PoolsApi.constants.moduleNames.swap, "swap_exact_in"),
|
|
71
|
-
typeArguments: [lpCoinType, coinInType, coinOutType],
|
|
72
|
-
arguments: [
|
|
73
|
-
tx.object(poolId),
|
|
74
|
-
tx.object(this.addresses.pools.objects.poolRegistry),
|
|
75
|
-
tx.object(this.addresses.pools.objects.protocolFeeVault),
|
|
76
|
-
tx.object(this.addresses.pools.objects.treasury),
|
|
77
|
-
tx.object(this.addresses.pools.objects.insuranceFund),
|
|
78
|
-
tx.object(this.addresses.referralVault.objects.referralVault),
|
|
79
|
-
typeof coinInId === "string" ? tx.object(coinInId) : coinInId,
|
|
80
|
-
tx.pure.u64(expectedCoinOutAmount.toString()),
|
|
81
|
-
tx.pure.u64(pools_1.Pools.normalizeInvertSlippage(slippage)),
|
|
82
|
-
],
|
|
83
|
-
});
|
|
84
|
-
};
|
|
85
|
-
/**
|
|
86
|
-
* Creates a transaction object argument for depositing multiple coins into a pool.
|
|
87
|
-
*
|
|
88
|
-
* @param inputs - An object containing the necessary parameters for the deposit transaction.
|
|
89
|
-
* @returns A transaction object argument representing the deposit transaction.
|
|
90
|
-
*/
|
|
91
|
-
this.multiCoinDepositTx = (inputs) => {
|
|
92
|
-
const { tx, poolId, coinIds, coinTypes, expectedLpRatio, lpCoinType, slippage, withTransfer, } = inputs;
|
|
93
|
-
const poolSize = coinTypes.length;
|
|
94
|
-
return tx.moveCall({
|
|
95
|
-
target: utils_2.Helpers.transactions.createTxTarget(withTransfer
|
|
96
|
-
? this.addresses.pools.packages.ammInterface
|
|
97
|
-
: this.addresses.pools.packages.amm, withTransfer
|
|
98
|
-
? PoolsApi.constants.moduleNames.interface
|
|
99
|
-
: PoolsApi.constants.moduleNames.deposit, `deposit_${poolSize}_coins`),
|
|
100
|
-
typeArguments: [lpCoinType, ...coinTypes],
|
|
101
|
-
arguments: [
|
|
102
|
-
tx.object(poolId),
|
|
103
|
-
tx.object(this.addresses.pools.objects.poolRegistry),
|
|
104
|
-
tx.object(this.addresses.pools.objects.protocolFeeVault),
|
|
105
|
-
tx.object(this.addresses.pools.objects.treasury),
|
|
106
|
-
tx.object(this.addresses.pools.objects.insuranceFund),
|
|
107
|
-
tx.object(this.addresses.referralVault.objects.referralVault),
|
|
108
|
-
...coinIds.map((coinId) => typeof coinId === "string" ? tx.object(coinId) : coinId),
|
|
109
|
-
tx.pure.u128(expectedLpRatio.toString()),
|
|
110
|
-
tx.pure.u64(pools_1.Pools.normalizeInvertSlippage(slippage)),
|
|
111
|
-
],
|
|
112
|
-
});
|
|
113
|
-
};
|
|
114
|
-
/**
|
|
115
|
-
* Withdraws multiple coins from a pool.
|
|
116
|
-
* @param inputs An object containing the necessary parameters for the transaction.
|
|
117
|
-
* @returns A TransactionObjectArgument representing the transaction.
|
|
118
|
-
*/
|
|
119
|
-
this.multiCoinWithdrawTx = (inputs) => {
|
|
120
|
-
const { tx, poolId, lpCoinId, expectedAmountsOut, coinTypes, lpCoinType, slippage, withTransfer, } = inputs;
|
|
121
|
-
const poolSize = coinTypes.length;
|
|
122
|
-
return tx.moveCall({
|
|
123
|
-
target: utils_2.Helpers.transactions.createTxTarget(withTransfer
|
|
124
|
-
? this.addresses.pools.packages.ammInterface
|
|
125
|
-
: this.addresses.pools.packages.amm, withTransfer
|
|
126
|
-
? PoolsApi.constants.moduleNames.interface
|
|
127
|
-
: PoolsApi.constants.moduleNames.withdraw, `withdraw_${poolSize}_coins`),
|
|
128
|
-
typeArguments: [lpCoinType, ...coinTypes],
|
|
129
|
-
arguments: [
|
|
130
|
-
tx.object(poolId),
|
|
131
|
-
tx.object(this.addresses.pools.objects.poolRegistry),
|
|
132
|
-
tx.object(this.addresses.pools.objects.protocolFeeVault),
|
|
133
|
-
tx.object(this.addresses.pools.objects.treasury),
|
|
134
|
-
tx.object(this.addresses.pools.objects.insuranceFund),
|
|
135
|
-
tx.object(this.addresses.referralVault.objects.referralVault),
|
|
136
|
-
typeof lpCoinId === "string" ? tx.object(lpCoinId) : lpCoinId,
|
|
137
|
-
tx.pure(bcs_1.bcs
|
|
138
|
-
.vector(bcs_1.bcs.u64())
|
|
139
|
-
.serialize(expectedAmountsOut.map((amount) => amount.toString()))),
|
|
140
|
-
tx.pure.u64(pools_1.Pools.normalizeInvertSlippage(slippage)),
|
|
141
|
-
],
|
|
142
|
-
});
|
|
143
|
-
};
|
|
144
|
-
/**
|
|
145
|
-
* Withdraws all coins from a liquidity pool.
|
|
146
|
-
* @param inputs - The inputs required for the transaction.
|
|
147
|
-
* @param inputs.tx - The transaction block.
|
|
148
|
-
* @param inputs.poolId - The ID of the liquidity pool.
|
|
149
|
-
* @param inputs.lpCoinId - The ID of the LP coin.
|
|
150
|
-
* @param inputs.lpCoinType - The type of the LP coin.
|
|
151
|
-
* @param inputs.coinTypes - An array of coin types.
|
|
152
|
-
* @param inputs.withTransfer - Whether or not to include a transfer.
|
|
153
|
-
* @returns An array of transaction objects.
|
|
154
|
-
*/
|
|
155
|
-
this.allCoinWithdrawTx = (inputs) => {
|
|
156
|
-
const { tx, poolId, lpCoinId, coinTypes, lpCoinType, withTransfer } = inputs;
|
|
157
|
-
const poolSize = coinTypes.length;
|
|
158
|
-
return tx.moveCall({
|
|
159
|
-
target: utils_2.Helpers.transactions.createTxTarget(withTransfer
|
|
160
|
-
? this.addresses.pools.packages.ammInterface
|
|
161
|
-
: this.addresses.pools.packages.amm, withTransfer
|
|
162
|
-
? PoolsApi.constants.moduleNames.interface
|
|
163
|
-
: PoolsApi.constants.moduleNames.withdraw, `all_coin_withdraw_${poolSize}_coins`),
|
|
164
|
-
typeArguments: [lpCoinType, ...coinTypes],
|
|
165
|
-
arguments: [
|
|
166
|
-
tx.object(poolId),
|
|
167
|
-
tx.object(this.addresses.pools.objects.poolRegistry),
|
|
168
|
-
tx.object(this.addresses.pools.objects.protocolFeeVault),
|
|
169
|
-
tx.object(this.addresses.pools.objects.treasury),
|
|
170
|
-
tx.object(this.addresses.pools.objects.insuranceFund),
|
|
171
|
-
tx.object(this.addresses.referralVault.objects.referralVault),
|
|
172
|
-
typeof lpCoinId === "string" ? tx.object(lpCoinId) : lpCoinId,
|
|
173
|
-
],
|
|
174
|
-
});
|
|
175
|
-
};
|
|
176
|
-
/**
|
|
177
|
-
* Publishes a transaction block for creating a liquidity pool coin.
|
|
178
|
-
* @param inputs An object containing the transaction block and the decimal value of the liquidity pool coin.
|
|
179
|
-
* @returns A promise that resolves to the result of the transaction publishing.
|
|
180
|
-
*/
|
|
181
|
-
this.publishLpCoinTx = (inputs) => {
|
|
182
|
-
var _a;
|
|
183
|
-
const compilations = (_a = this.addresses.pools.other) === null || _a === void 0 ? void 0 : _a.createLpCoinPackageCompilations;
|
|
184
|
-
if (!compilations)
|
|
185
|
-
throw new Error("not all required addresses have been set in provider for lp coin publishing (requires package compilations)");
|
|
186
|
-
const { tx, lpCoinDecimals } = inputs;
|
|
187
|
-
const compiledModulesAndDeps = JSON.parse(compilations[lpCoinDecimals]);
|
|
188
|
-
return tx.publish({
|
|
189
|
-
modules: compiledModulesAndDeps.modules.map((m) => Array.from((0, utils_1.fromB64)(m))),
|
|
190
|
-
dependencies: compiledModulesAndDeps.dependencies.map((addr) => (0, utils_1.normalizeSuiObjectId)(addr)),
|
|
191
|
-
});
|
|
192
|
-
};
|
|
193
|
-
// TODO: handle bounds checks here instead of just on-chain ?
|
|
194
|
-
/**
|
|
195
|
-
* Creates a transaction to create a new pool.
|
|
196
|
-
* @param inputs - An object containing the necessary inputs to create the pool.
|
|
197
|
-
* @returns A transaction block to create the pool.
|
|
198
|
-
*/
|
|
199
|
-
this.createPoolTx = (inputs) => {
|
|
200
|
-
const { tx, lpCoinType, createPoolCapId, coinsInfo, lpCoinMetadata, lpCoinDescription, lpCoinIconUrl, withTransfer, } = inputs;
|
|
201
|
-
const poolSize = coinsInfo.length;
|
|
202
|
-
const coinTypes = coinsInfo.map((coin) => coin.coinType);
|
|
203
|
-
const decimals = coinsInfo.map((coin) => coin.decimals);
|
|
204
|
-
return tx.moveCall({
|
|
205
|
-
target: utils_2.Helpers.transactions.createTxTarget(withTransfer
|
|
206
|
-
? this.addresses.pools.packages.ammInterface
|
|
207
|
-
: this.addresses.pools.packages.amm, withTransfer
|
|
208
|
-
? PoolsApi.constants.moduleNames.interface
|
|
209
|
-
: PoolsApi.constants.moduleNames.poolFactory, `create_pool_${poolSize}_coins`),
|
|
210
|
-
typeArguments: [lpCoinType, ...coinTypes],
|
|
211
|
-
arguments: [
|
|
212
|
-
typeof createPoolCapId === "string"
|
|
213
|
-
? tx.object(createPoolCapId)
|
|
214
|
-
: createPoolCapId,
|
|
215
|
-
tx.object(this.addresses.pools.objects.poolRegistry),
|
|
216
|
-
tx.pure(bcs_1.bcs
|
|
217
|
-
.vector(bcs_1.bcs.u8())
|
|
218
|
-
.serialize(casting_1.Casting.u8VectorFromString(inputs.poolName))),
|
|
219
|
-
tx.pure(bcs_1.bcs
|
|
220
|
-
.vector(bcs_1.bcs.u8())
|
|
221
|
-
.serialize(casting_1.Casting.u8VectorFromString(lpCoinMetadata.name.toString()))),
|
|
222
|
-
tx.pure(bcs_1.bcs
|
|
223
|
-
.vector(bcs_1.bcs.u8())
|
|
224
|
-
.serialize(casting_1.Casting.u8VectorFromString(lpCoinMetadata.symbol.toString().toUpperCase()))),
|
|
225
|
-
tx.pure(bcs_1.bcs
|
|
226
|
-
.vector(bcs_1.bcs.u8())
|
|
227
|
-
.serialize(casting_1.Casting.u8VectorFromString(lpCoinDescription))),
|
|
228
|
-
tx.pure(bcs_1.bcs
|
|
229
|
-
.vector(bcs_1.bcs.u8())
|
|
230
|
-
.serialize(casting_1.Casting.u8VectorFromString(lpCoinIconUrl))), // lp_icon_url
|
|
231
|
-
tx.pure(bcs_1.bcs
|
|
232
|
-
.vector(bcs_1.bcs.u64())
|
|
233
|
-
.serialize(coinsInfo.map((coin) => coin.weight))),
|
|
234
|
-
tx.pure.u64(inputs.poolFlatness),
|
|
235
|
-
tx.pure(bcs_1.bcs
|
|
236
|
-
.vector(bcs_1.bcs.u64())
|
|
237
|
-
.serialize(coinsInfo.map((coin) => coin.tradeFeeIn))),
|
|
238
|
-
tx.pure(bcs_1.bcs
|
|
239
|
-
.vector(bcs_1.bcs.u64())
|
|
240
|
-
.serialize(coinsInfo.map((coin) => coin.tradeFeeOut))),
|
|
241
|
-
tx.pure(bcs_1.bcs
|
|
242
|
-
.vector(bcs_1.bcs.u64())
|
|
243
|
-
.serialize(coinsInfo.map((coin) => coin.depositFee))),
|
|
244
|
-
tx.pure(bcs_1.bcs
|
|
245
|
-
.vector(bcs_1.bcs.u64())
|
|
246
|
-
.serialize(coinsInfo.map((coin) => coin.withdrawFee))),
|
|
247
|
-
...coinsInfo.map((coin) => typeof coin.coinId === "string"
|
|
248
|
-
? tx.object(coin.coinId)
|
|
249
|
-
: coin.coinId),
|
|
250
|
-
tx.pure(bcs_1.bcs
|
|
251
|
-
.option(bcs_1.bcs.vector(bcs_1.bcs.u8()))
|
|
252
|
-
.serialize(decimals.includes(undefined)
|
|
253
|
-
? undefined
|
|
254
|
-
: decimals)), // decimals
|
|
255
|
-
tx.pure.bool(inputs.respectDecimals), // respect_decimals
|
|
256
|
-
tx.pure(bcs_1.bcs.option(bcs_1.bcs.u8()).serialize(inputs.forceLpDecimals)), // force_lp_decimals
|
|
257
|
-
],
|
|
258
|
-
});
|
|
259
|
-
};
|
|
260
|
-
/**
|
|
261
|
-
* Returns the pool object ID for a given LP coin type transaction.
|
|
262
|
-
* @param inputs - An object containing the transaction block and LP coin type.
|
|
263
|
-
* @returns The pool object ID.
|
|
264
|
-
*/
|
|
265
|
-
this.poolObjectIdForLpCoinTypeTx = (inputs) => {
|
|
266
|
-
const { tx, lpCoinType } = inputs;
|
|
267
|
-
return tx.moveCall({
|
|
268
|
-
target: utils_2.Helpers.transactions.createTxTarget(this.addresses.pools.packages.amm, PoolsApi.constants.moduleNames.poolRegistry, "lp_type_to_pool_id"),
|
|
269
|
-
typeArguments: [lpCoinType],
|
|
270
|
-
arguments: [tx.object(this.addresses.pools.objects.poolRegistry)],
|
|
271
|
-
});
|
|
272
|
-
};
|
|
273
|
-
this.daoFeePoolNewTx = (inputs) => {
|
|
274
|
-
const { tx, poolId } = inputs;
|
|
275
|
-
if (!this.addresses.daoFeePools)
|
|
276
|
-
throw new Error("dao fee pool addresses have not been set in provider");
|
|
277
|
-
return tx.moveCall({
|
|
278
|
-
target: utils_2.Helpers.transactions.createTxTarget(this.addresses.daoFeePools.packages.amm, PoolsApi.constants.moduleNames.pool, "new"),
|
|
279
|
-
typeArguments: [inputs.lpCoinType],
|
|
280
|
-
arguments: [
|
|
281
|
-
typeof poolId === "string" ? tx.object(poolId) : poolId, // Pool
|
|
282
|
-
tx.object(this.addresses.daoFeePools.objects.version),
|
|
283
|
-
tx.pure.u16(Number(inputs.feeBps)),
|
|
284
|
-
tx.pure.address(inputs.feeRecipient),
|
|
285
|
-
],
|
|
286
|
-
});
|
|
287
|
-
};
|
|
288
|
-
this.daoFeePoolUpdateFeeBpsTx = (inputs) => {
|
|
289
|
-
const { tx } = inputs;
|
|
290
|
-
if (!this.addresses.daoFeePools)
|
|
291
|
-
throw new Error("dao fee pool addresses have not been set in provider");
|
|
292
|
-
return tx.moveCall({
|
|
293
|
-
target: utils_2.Helpers.transactions.createTxTarget(this.addresses.daoFeePools.packages.amm, PoolsApi.constants.moduleNames.pool, "update_fee_bps"),
|
|
294
|
-
typeArguments: [inputs.lpCoinType],
|
|
295
|
-
arguments: [
|
|
296
|
-
tx.object(inputs.daoFeePoolOwnerCapId), // OwnerCap
|
|
297
|
-
tx.object(inputs.daoFeePoolId), // DaoFeePool
|
|
298
|
-
tx.object(this.addresses.daoFeePools.objects.version),
|
|
299
|
-
tx.pure.u16(Number(inputs.newFeeBps)),
|
|
300
|
-
],
|
|
301
|
-
});
|
|
302
|
-
};
|
|
303
|
-
this.daoFeePoolUpdateFeeRecipientTx = (inputs) => {
|
|
304
|
-
const { tx } = inputs;
|
|
305
|
-
if (!this.addresses.daoFeePools)
|
|
306
|
-
throw new Error("dao fee pool addresses have not been set in provider");
|
|
307
|
-
return tx.moveCall({
|
|
308
|
-
target: utils_2.Helpers.transactions.createTxTarget(this.addresses.daoFeePools.packages.amm, PoolsApi.constants.moduleNames.pool, "update_fee_recipient"),
|
|
309
|
-
typeArguments: [inputs.lpCoinType],
|
|
310
|
-
arguments: [
|
|
311
|
-
tx.object(inputs.daoFeePoolOwnerCapId), // OwnerCap
|
|
312
|
-
tx.object(inputs.daoFeePoolId), // DaoFeePool
|
|
313
|
-
tx.object(this.addresses.daoFeePools.objects.version),
|
|
314
|
-
tx.pure.address(inputs.newFeeRecipient),
|
|
315
|
-
],
|
|
316
|
-
});
|
|
317
|
-
};
|
|
318
|
-
/**
|
|
319
|
-
* Executes a trade transaction on the specified pool.
|
|
320
|
-
* @param inputs An object containing the necessary inputs for the trade transaction.
|
|
321
|
-
* @returns A `TransactionObjectArgument` representing the trade transaction.
|
|
322
|
-
*/
|
|
323
|
-
this.daoFeePoolTradeTx = (inputs) => {
|
|
324
|
-
const { tx, daoFeePoolId, coinInId, coinInType, expectedCoinOutAmount, coinOutType, lpCoinType, slippage, } = inputs;
|
|
325
|
-
if (!this.addresses.daoFeePools)
|
|
326
|
-
throw new Error("dao fee pool addresses have not been set in provider");
|
|
327
|
-
return tx.moveCall({
|
|
328
|
-
target: utils_2.Helpers.transactions.createTxTarget(this.addresses.daoFeePools.packages.amm, PoolsApi.constants.moduleNames.swap, "swap_exact_in"),
|
|
329
|
-
typeArguments: [lpCoinType, coinInType, coinOutType],
|
|
330
|
-
arguments: [
|
|
331
|
-
tx.object(daoFeePoolId),
|
|
332
|
-
tx.object(this.addresses.daoFeePools.objects.version),
|
|
333
|
-
tx.object(this.addresses.pools.objects.poolRegistry),
|
|
334
|
-
tx.object(this.addresses.pools.objects.protocolFeeVault),
|
|
335
|
-
tx.object(this.addresses.pools.objects.treasury),
|
|
336
|
-
tx.object(this.addresses.pools.objects.insuranceFund),
|
|
337
|
-
tx.object(this.addresses.referralVault.objects.referralVault),
|
|
338
|
-
typeof coinInId === "string" ? tx.object(coinInId) : coinInId,
|
|
339
|
-
tx.pure.u64(expectedCoinOutAmount.toString()),
|
|
340
|
-
tx.pure.u64(pools_1.Pools.normalizeInvertSlippage(slippage)),
|
|
341
|
-
],
|
|
342
|
-
});
|
|
343
|
-
};
|
|
344
|
-
/**
|
|
345
|
-
* Creates a transaction object argument for depositing multiple coins into a pool.
|
|
346
|
-
*
|
|
347
|
-
* @param inputs - An object containing the necessary parameters for the deposit transaction.
|
|
348
|
-
* @returns A transaction object argument representing the deposit transaction.
|
|
349
|
-
*/
|
|
350
|
-
this.daoFeePoolMultiCoinDepositTx = (inputs) => {
|
|
351
|
-
const { tx, daoFeePoolId, coinIds, coinTypes, expectedLpRatio, lpCoinType, slippage, } = inputs;
|
|
352
|
-
if (!this.addresses.daoFeePools)
|
|
353
|
-
throw new Error("dao fee pool addresses have not been set in provider");
|
|
354
|
-
const poolSize = coinTypes.length;
|
|
355
|
-
return tx.moveCall({
|
|
356
|
-
target: utils_2.Helpers.transactions.createTxTarget(this.addresses.daoFeePools.packages.amm, PoolsApi.constants.moduleNames.deposit, `deposit_${poolSize}_coins`),
|
|
357
|
-
typeArguments: [lpCoinType, ...coinTypes],
|
|
358
|
-
arguments: [
|
|
359
|
-
tx.object(daoFeePoolId),
|
|
360
|
-
tx.object(this.addresses.daoFeePools.objects.version),
|
|
361
|
-
tx.object(this.addresses.pools.objects.poolRegistry),
|
|
362
|
-
tx.object(this.addresses.pools.objects.protocolFeeVault),
|
|
363
|
-
tx.object(this.addresses.pools.objects.treasury),
|
|
364
|
-
tx.object(this.addresses.pools.objects.insuranceFund),
|
|
365
|
-
tx.object(this.addresses.referralVault.objects.referralVault),
|
|
366
|
-
...coinIds.map((coinId) => typeof coinId === "string" ? tx.object(coinId) : coinId),
|
|
367
|
-
tx.pure.u128(expectedLpRatio.toString()),
|
|
368
|
-
tx.pure.u64(pools_1.Pools.normalizeInvertSlippage(slippage)),
|
|
369
|
-
],
|
|
370
|
-
});
|
|
371
|
-
};
|
|
372
|
-
/**
|
|
373
|
-
* Withdraws all coins from a liquidity pool.
|
|
374
|
-
* @param inputs - The inputs required for the transaction.
|
|
375
|
-
* @param inputs.tx - The transaction block.
|
|
376
|
-
* @param inputs.poolId - The ID of the liquidity pool.
|
|
377
|
-
* @param inputs.lpCoinId - The ID of the LP coin.
|
|
378
|
-
* @param inputs.lpCoinType - The type of the LP coin.
|
|
379
|
-
* @param inputs.coinTypes - An array of coin types.
|
|
380
|
-
* @returns An array of transaction objects.
|
|
381
|
-
*/
|
|
382
|
-
this.daoFeePoolAllCoinWithdrawTx = (inputs) => {
|
|
383
|
-
const { tx, daoFeePoolId, lpCoinId, coinTypes, lpCoinType } = inputs;
|
|
384
|
-
if (!this.addresses.daoFeePools)
|
|
385
|
-
throw new Error("dao fee pool addresses have not been set in provider");
|
|
386
|
-
const poolSize = coinTypes.length;
|
|
387
|
-
return tx.moveCall({
|
|
388
|
-
target: utils_2.Helpers.transactions.createTxTarget(this.addresses.daoFeePools.packages.amm, PoolsApi.constants.moduleNames.withdraw, `all_coin_withdraw_${poolSize}_coins`),
|
|
389
|
-
typeArguments: [lpCoinType, ...coinTypes],
|
|
390
|
-
arguments: [
|
|
391
|
-
tx.object(daoFeePoolId),
|
|
392
|
-
tx.object(this.addresses.daoFeePools.objects.version),
|
|
393
|
-
tx.object(this.addresses.pools.objects.poolRegistry),
|
|
394
|
-
tx.object(this.addresses.pools.objects.protocolFeeVault),
|
|
395
|
-
tx.object(this.addresses.pools.objects.treasury),
|
|
396
|
-
tx.object(this.addresses.pools.objects.insuranceFund),
|
|
397
|
-
tx.object(this.addresses.referralVault.objects.referralVault),
|
|
398
|
-
typeof lpCoinId === "string" ? tx.object(lpCoinId) : lpCoinId,
|
|
399
|
-
],
|
|
400
|
-
});
|
|
401
|
-
};
|
|
402
|
-
// =========================================================================
|
|
403
|
-
// Transaction Builders
|
|
404
|
-
// =========================================================================
|
|
405
|
-
/**
|
|
406
|
-
* Fetches a transaction block for trading in a pool.
|
|
407
|
-
* @async
|
|
408
|
-
* @param {SuiAddress} inputs.walletAddress - The wallet address of the user trading in the pool.
|
|
409
|
-
* @param {Pool} inputs.pool - The pool to trade in.
|
|
410
|
-
* @param {CoinType} inputs.coinInType - The coin type of the coin being traded in.
|
|
411
|
-
* @param {Balance} inputs.coinInAmount - The amount of the coin being traded in.
|
|
412
|
-
* @param {CoinType} inputs.coinOutType - The coin type of the coin being traded out.
|
|
413
|
-
* @param {Slippage} inputs.slippage - The slippage of the trade.
|
|
414
|
-
* @param {SuiAddress} [inputs.referrer] - The referrer of the trade.
|
|
415
|
-
* @param {boolean} [inputs.isSponsoredTx] - Whether the transaction is sponsored.
|
|
416
|
-
* @returns {Promise<Transaction>} A promise that resolves to the fetched transaction block.
|
|
417
|
-
*/
|
|
418
|
-
this.fetchBuildTradeTx = (inputs) => __awaiter(this, void 0, void 0, function* () {
|
|
419
|
-
const { walletAddress, pool, coinInAmount, coinInType, coinOutType, slippage, referrer, isSponsoredTx, } = inputs;
|
|
420
|
-
const tx = new transactions_1.Transaction();
|
|
421
|
-
tx.setSender(walletAddress);
|
|
422
|
-
if (referrer)
|
|
423
|
-
this.Provider.ReferralVault().updateReferrerTx({
|
|
424
|
-
tx,
|
|
425
|
-
referrer,
|
|
426
|
-
});
|
|
427
|
-
const amountOut = pool.getTradeAmountOut({
|
|
428
|
-
coinInAmount,
|
|
429
|
-
coinInType,
|
|
430
|
-
coinOutType,
|
|
431
|
-
referral: referrer !== undefined,
|
|
432
|
-
});
|
|
433
|
-
const coinInId = yield this.Provider.Coin().fetchCoinWithAmountTx({
|
|
434
|
-
tx,
|
|
435
|
-
walletAddress,
|
|
436
|
-
coinType: coinInType,
|
|
437
|
-
coinAmount: coinInAmount,
|
|
438
|
-
isSponsoredTx,
|
|
439
|
-
});
|
|
440
|
-
if (pool.pool.daoFeePoolObject) {
|
|
441
|
-
const coinOutId = this.daoFeePoolTradeTx({
|
|
442
|
-
tx,
|
|
443
|
-
coinInId,
|
|
444
|
-
daoFeePoolId: pool.pool.daoFeePoolObject.objectId,
|
|
445
|
-
expectedCoinOutAmount: amountOut,
|
|
446
|
-
lpCoinType: pool.pool.lpCoinType,
|
|
447
|
-
coinInType,
|
|
448
|
-
coinOutType,
|
|
449
|
-
slippage,
|
|
450
|
-
});
|
|
451
|
-
tx.transferObjects([coinOutId], walletAddress);
|
|
452
|
-
}
|
|
453
|
-
else {
|
|
454
|
-
this.tradeTx({
|
|
455
|
-
tx,
|
|
456
|
-
coinInId,
|
|
457
|
-
poolId: pool.pool.objectId,
|
|
458
|
-
expectedCoinOutAmount: amountOut,
|
|
459
|
-
lpCoinType: pool.pool.lpCoinType,
|
|
460
|
-
coinInType,
|
|
461
|
-
coinOutType,
|
|
462
|
-
slippage,
|
|
463
|
-
withTransfer: true,
|
|
464
|
-
});
|
|
465
|
-
}
|
|
466
|
-
return tx;
|
|
467
|
-
});
|
|
468
|
-
this.fetchAddTradeTx = (inputs) => __awaiter(this, void 0, void 0, function* () {
|
|
469
|
-
const { tx, coinInId, coinInAmount, coinInType, coinOutType, slippage, pool, referrer, } = inputs;
|
|
470
|
-
const amountOut = pool.getTradeAmountOut({
|
|
471
|
-
coinInAmount,
|
|
472
|
-
coinInType,
|
|
473
|
-
coinOutType,
|
|
474
|
-
referral: referrer !== undefined,
|
|
475
|
-
});
|
|
476
|
-
return this.tradeTx({
|
|
477
|
-
tx,
|
|
478
|
-
coinInId,
|
|
479
|
-
poolId: pool.pool.objectId,
|
|
480
|
-
expectedCoinOutAmount: amountOut,
|
|
481
|
-
lpCoinType: pool.pool.lpCoinType,
|
|
482
|
-
coinInType,
|
|
483
|
-
coinOutType,
|
|
484
|
-
slippage,
|
|
485
|
-
});
|
|
486
|
-
});
|
|
487
|
-
/**
|
|
488
|
-
* Fetches a transaction block for depositing in a pool.
|
|
489
|
-
* @async
|
|
490
|
-
* @param {SuiAddress} inputs.walletAddress - The wallet address of the user depositing in the pool.
|
|
491
|
-
* @param {Pool} inputs.pool - The pool to deposit in.
|
|
492
|
-
* @param {CoinsToBalance} inputs.amountsIn - The amounts of coins being deposited.
|
|
493
|
-
* @param {Slippage} inputs.slippage - The slippage of the deposit.
|
|
494
|
-
* @param {SuiAddress} [inputs.referrer] - The referrer of the deposit.
|
|
495
|
-
* @param {boolean} [inputs.isSponsoredTx] - Whether the transaction is sponsored.
|
|
496
|
-
* @returns {Promise<Transaction>} A promise that resolves to the fetched transaction block.
|
|
497
|
-
*/
|
|
498
|
-
this.fetchBuildDepositTx = (inputs) => __awaiter(this, void 0, void 0, function* () {
|
|
499
|
-
const { walletAddress, pool, amountsIn, slippage, referrer, isSponsoredTx, } = inputs;
|
|
500
|
-
const tx = new transactions_1.Transaction();
|
|
501
|
-
tx.setSender(walletAddress);
|
|
502
|
-
if (referrer)
|
|
503
|
-
this.Provider.ReferralVault().updateReferrerTx({
|
|
504
|
-
tx,
|
|
505
|
-
referrer,
|
|
506
|
-
});
|
|
507
|
-
const { coins: coinTypes, balances: coinAmounts } = coin_1.Coin.coinsAndBalancesOverZero(amountsIn);
|
|
508
|
-
const { lpRatio } = pool.getDepositLpAmountOut({
|
|
509
|
-
amountsIn,
|
|
510
|
-
referral: referrer !== undefined,
|
|
511
|
-
});
|
|
512
|
-
// TODO: move this somewhere else and into its own func
|
|
513
|
-
const expectedLpRatio = casting_1.Casting.numberToFixedBigInt(lpRatio);
|
|
514
|
-
const coinIds = yield this.Provider.Coin().fetchCoinsWithAmountTx(Object.assign(Object.assign({}, inputs), { tx,
|
|
515
|
-
coinTypes,
|
|
516
|
-
coinAmounts,
|
|
517
|
-
isSponsoredTx }));
|
|
518
|
-
if (pool.pool.daoFeePoolObject) {
|
|
519
|
-
const lpCoinId = this.daoFeePoolMultiCoinDepositTx({
|
|
520
|
-
tx,
|
|
521
|
-
daoFeePoolId: pool.pool.daoFeePoolObject.objectId,
|
|
522
|
-
lpCoinType: pool.pool.lpCoinType,
|
|
523
|
-
coinIds,
|
|
524
|
-
coinTypes,
|
|
525
|
-
expectedLpRatio,
|
|
526
|
-
slippage,
|
|
527
|
-
});
|
|
528
|
-
tx.transferObjects([lpCoinId], walletAddress);
|
|
529
|
-
}
|
|
530
|
-
else {
|
|
531
|
-
this.multiCoinDepositTx({
|
|
532
|
-
tx,
|
|
533
|
-
poolId: pool.pool.objectId,
|
|
534
|
-
lpCoinType: pool.pool.lpCoinType,
|
|
535
|
-
coinIds,
|
|
536
|
-
coinTypes,
|
|
537
|
-
expectedLpRatio,
|
|
538
|
-
slippage,
|
|
539
|
-
withTransfer: true,
|
|
540
|
-
});
|
|
541
|
-
}
|
|
542
|
-
return tx;
|
|
543
|
-
});
|
|
544
|
-
/**
|
|
545
|
-
* Fetches a transaction block for withdrawing from a pool.
|
|
546
|
-
* @async
|
|
547
|
-
* @param {SuiAddress} inputs.walletAddress - The wallet address of the user withdrawing from the pool.
|
|
548
|
-
* @param {Pool} inputs.pool - The pool to withdraw from.
|
|
549
|
-
* @param {CoinsToBalance} inputs.amountsOutDirection - The amounts of coins being withdrawn.
|
|
550
|
-
* @param {Balance} inputs.lpCoinAmount - The amount of LP tokens being withdrawn.
|
|
551
|
-
* @param {Slippage} inputs.slippage - The slippage of the withdrawal.
|
|
552
|
-
* @param {SuiAddress} [inputs.referrer] - The referrer of the withdrawal.
|
|
553
|
-
* @returns {Promise<Transaction>} A promise that resolves to the fetched transaction block.
|
|
554
|
-
*/
|
|
555
|
-
this.fetchBuildWithdrawTx = (inputs) => __awaiter(this, void 0, void 0, function* () {
|
|
556
|
-
const { walletAddress, pool, amountsOutDirection, lpCoinAmount, slippage, referrer, } = inputs;
|
|
557
|
-
const tx = new transactions_1.Transaction();
|
|
558
|
-
tx.setSender(walletAddress);
|
|
559
|
-
if (referrer)
|
|
560
|
-
this.Provider.ReferralVault().updateReferrerTx({
|
|
561
|
-
tx,
|
|
562
|
-
referrer,
|
|
563
|
-
});
|
|
564
|
-
const lpRatio = pool.getMultiCoinWithdrawLpRatio({
|
|
565
|
-
lpCoinAmountIn: lpCoinAmount,
|
|
566
|
-
});
|
|
567
|
-
const amountsOut = pool.getWithdrawAmountsOut({
|
|
568
|
-
lpRatio,
|
|
569
|
-
amountsOutDirection,
|
|
570
|
-
referral: referrer !== undefined,
|
|
571
|
-
});
|
|
572
|
-
const { coins: coinTypes, balances: coinAmounts } = coin_1.Coin.coinsAndBalancesOverZero(amountsOut);
|
|
573
|
-
const lpCoinId = yield this.Provider.Coin().fetchCoinWithAmountTx({
|
|
574
|
-
tx,
|
|
575
|
-
walletAddress,
|
|
576
|
-
coinType: pool.pool.lpCoinType,
|
|
577
|
-
coinAmount: lpCoinAmount,
|
|
578
|
-
});
|
|
579
|
-
if (pool.pool.daoFeePoolObject) {
|
|
580
|
-
// TODO: handle dao fee pool
|
|
581
|
-
// TODO: handle transfer
|
|
582
|
-
}
|
|
583
|
-
else {
|
|
584
|
-
this.multiCoinWithdrawTx({
|
|
585
|
-
tx,
|
|
586
|
-
poolId: pool.pool.objectId,
|
|
587
|
-
lpCoinType: pool.pool.lpCoinType,
|
|
588
|
-
expectedAmountsOut: coinAmounts,
|
|
589
|
-
coinTypes: coinTypes,
|
|
590
|
-
lpCoinId,
|
|
591
|
-
slippage,
|
|
592
|
-
withTransfer: true,
|
|
593
|
-
});
|
|
594
|
-
}
|
|
595
|
-
return tx;
|
|
596
|
-
});
|
|
597
|
-
/**
|
|
598
|
-
* Fetches a transaction block that withdraws all coins from a pool in exchange for the corresponding LP tokens.
|
|
599
|
-
* @param inputs An object containing the wallet address, pool, LP coin amount, and optional referrer.
|
|
600
|
-
* @returns A promise that resolves to a Transaction object.
|
|
601
|
-
*/
|
|
602
|
-
this.fetchBuildAllCoinWithdrawTx = (inputs) => __awaiter(this, void 0, void 0, function* () {
|
|
603
|
-
const { walletAddress, pool, lpCoinAmount, referrer } = inputs;
|
|
604
|
-
const tx = new transactions_1.Transaction();
|
|
605
|
-
tx.setSender(walletAddress);
|
|
606
|
-
if (referrer)
|
|
607
|
-
this.Provider.ReferralVault().updateReferrerTx({
|
|
608
|
-
tx,
|
|
609
|
-
referrer,
|
|
610
|
-
});
|
|
611
|
-
const lpCoinId = yield this.Provider.Coin().fetchCoinWithAmountTx({
|
|
612
|
-
tx,
|
|
613
|
-
walletAddress,
|
|
614
|
-
coinType: pool.pool.lpCoinType,
|
|
615
|
-
coinAmount: lpCoinAmount,
|
|
616
|
-
});
|
|
617
|
-
const coinTypes = Object.keys(pool.pool.coins);
|
|
618
|
-
if (pool.pool.daoFeePoolObject) {
|
|
619
|
-
const withdrawnCoinIds = this.daoFeePoolAllCoinWithdrawTx({
|
|
620
|
-
tx,
|
|
621
|
-
daoFeePoolId: pool.pool.daoFeePoolObject.objectId,
|
|
622
|
-
lpCoinType: pool.pool.lpCoinType,
|
|
623
|
-
coinTypes,
|
|
624
|
-
lpCoinId,
|
|
625
|
-
});
|
|
626
|
-
tx.transferObjects(coinTypes.map((_, index) => withdrawnCoinIds[index]), walletAddress);
|
|
627
|
-
}
|
|
628
|
-
else {
|
|
629
|
-
this.allCoinWithdrawTx({
|
|
630
|
-
tx,
|
|
631
|
-
poolId: pool.pool.objectId,
|
|
632
|
-
lpCoinType: pool.pool.lpCoinType,
|
|
633
|
-
coinTypes,
|
|
634
|
-
lpCoinId,
|
|
635
|
-
withTransfer: true,
|
|
636
|
-
});
|
|
637
|
-
}
|
|
638
|
-
return tx;
|
|
639
|
-
});
|
|
640
|
-
/**
|
|
641
|
-
* Builds a transaction block for publishing an LP coin.
|
|
642
|
-
* @param inputs - The input parameters for the transaction.
|
|
643
|
-
* @returns The built transaction block.
|
|
644
|
-
*/
|
|
645
|
-
this.buildPublishLpCoinTx = (inputs) => {
|
|
646
|
-
const { lpCoinDecimals } = inputs;
|
|
647
|
-
const tx = new transactions_1.Transaction();
|
|
648
|
-
tx.setSender(inputs.walletAddress);
|
|
649
|
-
const upgradeCap = this.publishLpCoinTx({ tx, lpCoinDecimals });
|
|
650
|
-
tx.transferObjects([upgradeCap], inputs.walletAddress);
|
|
651
|
-
return tx;
|
|
652
|
-
};
|
|
653
|
-
this.buildDaoFeePoolUpdateFeeBpsTx = utils_2.Helpers.transactions.createBuildTxFunc(this.daoFeePoolUpdateFeeBpsTx);
|
|
654
|
-
this.buildDaoFeePoolUpdateFeeRecipientTx = utils_2.Helpers.transactions.createBuildTxFunc(this.daoFeePoolUpdateFeeRecipientTx);
|
|
655
|
-
// =========================================================================
|
|
656
|
-
// Event Types
|
|
657
|
-
// =========================================================================
|
|
658
|
-
this.tradeEventType = () => eventsApiHelpers_1.EventsApiHelpers.createEventType(this.addresses.pools.packages.events, PoolsApi.constants.moduleNames.events, PoolsApi.constants.eventNames.swap);
|
|
659
|
-
this.depositEventType = () => eventsApiHelpers_1.EventsApiHelpers.createEventType(this.addresses.pools.packages.events, PoolsApi.constants.moduleNames.events, PoolsApi.constants.eventNames.deposit);
|
|
660
|
-
this.withdrawEventType = () => eventsApiHelpers_1.EventsApiHelpers.createEventType(this.addresses.pools.packages.events, PoolsApi.constants.moduleNames.events, PoolsApi.constants.eventNames.withdraw);
|
|
661
|
-
this.tradeV2EventType = () => eventsApiHelpers_1.EventsApiHelpers.createEventType(this.addresses.pools.packages.eventsV2, PoolsApi.constants.moduleNames.events, PoolsApi.constants.eventNames.swapV2);
|
|
662
|
-
this.depositV2EventType = () => eventsApiHelpers_1.EventsApiHelpers.createEventType(this.addresses.pools.packages.eventsV2, PoolsApi.constants.moduleNames.events, PoolsApi.constants.eventNames.depositV2);
|
|
663
|
-
this.withdrawV2EventType = () => eventsApiHelpers_1.EventsApiHelpers.createEventType(this.addresses.pools.packages.eventsV2, PoolsApi.constants.moduleNames.events, PoolsApi.constants.eventNames.withdrawV2);
|
|
664
|
-
const pools = Provider.addresses.pools;
|
|
665
|
-
const referralVault = Provider.addresses.referralVault;
|
|
666
|
-
const daoFeePools = Provider.addresses.daoFeePools;
|
|
667
|
-
if (!pools || !referralVault)
|
|
668
|
-
throw new Error("not all required addresses have been set in provider");
|
|
669
|
-
this.addresses = {
|
|
670
|
-
pools,
|
|
671
|
-
referralVault,
|
|
672
|
-
daoFeePools,
|
|
673
|
-
};
|
|
674
|
-
this.objectTypes = {
|
|
675
|
-
pool: `${pools.packages.events}::pool::Pool`,
|
|
676
|
-
daoFeePool: daoFeePools
|
|
677
|
-
? `${daoFeePools.packages.events}::pool::DaoFeePool`
|
|
678
|
-
: undefined,
|
|
679
|
-
daoFeePoolOwnerCap: daoFeePools
|
|
680
|
-
? `${daoFeePools.packages.events}::pool::OwnerCap`
|
|
681
|
-
: undefined,
|
|
682
|
-
};
|
|
683
|
-
this.eventTypes = {
|
|
684
|
-
trade: this.tradeEventType(),
|
|
685
|
-
deposit: this.depositEventType(),
|
|
686
|
-
withdraw: this.withdrawEventType(),
|
|
687
|
-
tradeV2: this.tradeV2EventType(),
|
|
688
|
-
depositV2: this.depositV2EventType(),
|
|
689
|
-
withdrawV2: this.withdrawV2EventType(),
|
|
690
|
-
};
|
|
691
|
-
this.moveErrors = Object.assign({ [this.addresses.pools.packages.amm]: {
|
|
692
|
-
[PoolsApi.constants.moduleNames.pool]: {
|
|
693
|
-
/// A user provides a input that should be between 0 and `FIXED_ONE` but isn't.
|
|
694
|
-
0: "Flatness Not Normalized",
|
|
695
|
-
/// A user attempts to create a Pool with a `flatness` parameter we do not support yet.
|
|
696
|
-
1: "Flatness Not Supported",
|
|
697
|
-
/// A user attempts to create a pool with weights that don't sum to `FIXED_ONE`.
|
|
698
|
-
2: "Weights Not Normalized",
|
|
699
|
-
/// A user attempts to create a Pool with an individual weight outside of the
|
|
700
|
-
/// range [MIN_WEIGHT, MAX_WEIGHT].
|
|
701
|
-
3: "Invalid Weight",
|
|
702
|
-
/// A user attempts to create a Pool with an individual fee outside of the
|
|
703
|
-
/// range [MIN_FEE, MAX_FEE].
|
|
704
|
-
4: "Invalid Fee",
|
|
705
|
-
/// A user provides an input vector (with length m != n) for a pool of size n.
|
|
706
|
-
5: "Bad Vector Length",
|
|
707
|
-
/// A user tries to create a Pool but provides an initial deposit that equates to less than
|
|
708
|
-
/// `MIN_LP_SUPPLY` worth of LP Coins.
|
|
709
|
-
6: "Not Enough Initial Liquidity",
|
|
710
|
-
/// A user attempts to create a Pool with an LP `TreasuryCap` that has already minted Coins.
|
|
711
|
-
7: "Non Zero Total Supply",
|
|
712
|
-
/// A user attempts to interact with the Pool and specifies a type that isn't in the Pool.
|
|
713
|
-
8: "Bad Type",
|
|
714
|
-
/// A user attempts to create a pool with invalid decimal scalars
|
|
715
|
-
9: "Bad Decimals",
|
|
716
|
-
/// A user attempts to create a pool with type names which are not sorted
|
|
717
|
-
10: "Not Sorted",
|
|
718
|
-
},
|
|
719
|
-
[PoolsApi.constants.moduleNames.poolRegistry]: {
|
|
720
|
-
/// A user tries to create a Pool and the generic parameters of `create_pool_n_coins` were
|
|
721
|
-
/// provided in nonlexicographical order.
|
|
722
|
-
60: "Not Sorted",
|
|
723
|
-
/// A user tries to create a Pool with exact parameters as an already active Pool.
|
|
724
|
-
61: "Duplicate Pool",
|
|
725
|
-
/// A user tries to upgrade the `PoolRegistry` to a value
|
|
726
|
-
62: "Invalid Upgrade",
|
|
727
|
-
},
|
|
728
|
-
[PoolsApi.constants.moduleNames.deposit]: {
|
|
729
|
-
/// A user attempts to perform a `deposit` with an older contract.
|
|
730
|
-
20: "Invalid Protocol Version",
|
|
731
|
-
/// A user attempts to perform `deposit-n-coins` on a Pool with a size `m` < `n`.
|
|
732
|
-
21: "Invalid Pool Size",
|
|
733
|
-
/// A user attempts to perform a deposit and provides a coin with a value of zero.
|
|
734
|
-
22: "Zero Value",
|
|
735
|
-
// A user calls `deposit_n_coins` or `all_coin_deposit_n_coins` and provides the same generic
|
|
736
|
-
// at least twice.
|
|
737
|
-
23: "Duplicate Types",
|
|
738
|
-
},
|
|
739
|
-
[PoolsApi.constants.moduleNames.poolFactory]: {
|
|
740
|
-
/// A user attempts to create a pool on an older contract.
|
|
741
|
-
10: "Invalid Protocol Version",
|
|
742
|
-
/// A user attempts to create a Pool and provides a coin with a value of zero.
|
|
743
|
-
11: "Zero Value",
|
|
744
|
-
},
|
|
745
|
-
[PoolsApi.constants.moduleNames.price]: {
|
|
746
|
-
/// A user attempts to query spot/oracle price using an old contract.
|
|
747
|
-
10: "Invalid Protocol Version",
|
|
748
|
-
},
|
|
749
|
-
[PoolsApi.constants.moduleNames.swap]: {
|
|
750
|
-
/// A user attempts to perform a `swap` with an older contract.
|
|
751
|
-
40: "Invalid Protocol Version",
|
|
752
|
-
/// A user attempts to perform `multi-swap-exact-in/out-n-to-m` on a Pool with a size
|
|
753
|
-
/// `s` < `n` + `m`.
|
|
754
|
-
41: "Invalid Pool Size",
|
|
755
|
-
/// A user attempts to perform swap and providing provides a coin with a
|
|
756
|
-
/// value of zero.
|
|
757
|
-
42: "Zero Value",
|
|
758
|
-
/// A user attempts to perform a multi-coin withdraw and provides an `amounts_out`
|
|
759
|
-
/// vector whose length does
|
|
760
|
-
43: "Bad Vector Length",
|
|
761
|
-
/// A user attempts to swap attempts to swap `Coin<CI>` for `amount_out` of `Coin<CO>`
|
|
762
|
-
/// but its value is insufficient.
|
|
763
|
-
44: "Insufficient Coin In",
|
|
764
|
-
// A user calls `multi_swap_exact_in_1_to_n` or `multi_swap_exact_out_1_to_n` and provides the same
|
|
765
|
-
// generic at least twice.
|
|
766
|
-
45: "Duplicate Types",
|
|
767
|
-
/// Something went wrong with the internal calculations
|
|
768
|
-
46: "Internal Error",
|
|
769
|
-
/// An external app is trying to call authorized functions without permission.
|
|
770
|
-
47: "Not Authorized",
|
|
771
|
-
},
|
|
772
|
-
[PoolsApi.constants.moduleNames.withdraw]: {
|
|
773
|
-
/// A user attempts to perform a `withdraw` with an older contract.
|
|
774
|
-
30: "Invalid Protocol Version",
|
|
775
|
-
/// A user attempts to perform `withdraw-n-coins` on a Pool with a size `m` < `n`.
|
|
776
|
-
31: "Invalid PoolSize",
|
|
777
|
-
/// A user attempts to perform a withdraw and provides an LP coin with a value of zero.
|
|
778
|
-
32: "Zero Value",
|
|
779
|
-
/// A user attempts to perform a multi-coin withdraw and provides an `amounts_out`
|
|
780
|
-
/// vector whose length does
|
|
781
|
-
33: "Bad Vector Length",
|
|
782
|
-
// A user calls `withdraw_n_coins` or `all_coin_withdraw_n_coins` and provides the same generic
|
|
783
|
-
// at least twice.
|
|
784
|
-
34: "Duplicate Types",
|
|
785
|
-
},
|
|
786
|
-
[PoolsApi.constants.moduleNames.math]: {
|
|
787
|
-
// TODO: change error code in move
|
|
788
|
-
/// A user tries to create a Pool that would result in the Pool's invariant equalling zero.
|
|
789
|
-
// 51: "ZeroInvariant",
|
|
790
|
-
/// A user tries to perform an action with the Pool that results in too much slippage.
|
|
791
|
-
51: "Slippage",
|
|
792
|
-
/// A user tries to perform a swap that would result in more than `MAX_SWAP_AMOUNT_IN` worth of
|
|
793
|
-
/// one of the Pool's coins entering the Pool.
|
|
794
|
-
52: "Invalid Swap Amount In",
|
|
795
|
-
/// A user tries to perform a swap that would result in more than `MAX_SWAP_AMOUNT_OUT` worth of
|
|
796
|
-
/// one of the Pool's coins exiting the Pool.
|
|
797
|
-
53: "Invalid Swap Amount Out",
|
|
798
|
-
/// A user tries to perform a `swap_exact_out` with a value for `amount_out` that equates to
|
|
799
|
-
/// zero amount of `Coin<CI>`.
|
|
800
|
-
54: "Zero Amount In",
|
|
801
|
-
/// A user tries to perform a `swap_exact_in` with an amount of `Coin<CI>` that equates to
|
|
802
|
-
/// zero amount of `Coin<CO>`.
|
|
803
|
-
55: "Zero Amount Out",
|
|
804
|
-
/// A user tries to deposit into a Pool with a deposit that is worth zero LP coins.
|
|
805
|
-
56: "Zero Lp Out",
|
|
806
|
-
/// A user tries to invest with an lp ratio of 0
|
|
807
|
-
57: "Zero Lp Ratio",
|
|
808
|
-
},
|
|
809
|
-
[PoolsApi.constants.moduleNames.geometricMeanCalculations]: {},
|
|
810
|
-
[PoolsApi.constants.moduleNames.stableCalculations]: {},
|
|
811
|
-
} }, (this.addresses.daoFeePools
|
|
812
|
-
? {
|
|
813
|
-
[this.addresses.daoFeePools.packages.amm]: {
|
|
814
|
-
version: {
|
|
815
|
-
/// A user tried to interact with an old contract.
|
|
816
|
-
0: "Invalid Version",
|
|
817
|
-
/// `init_package_version` has been called outside of this packages `init` function.
|
|
818
|
-
1: "Version Object Already Created",
|
|
819
|
-
},
|
|
820
|
-
},
|
|
821
|
-
}
|
|
822
|
-
: {}));
|
|
823
|
-
}
|
|
824
|
-
}
|
|
825
|
-
exports.PoolsApi = PoolsApi;
|
|
826
|
-
// =========================================================================
|
|
827
|
-
// Constants
|
|
828
|
-
// =========================================================================
|
|
829
|
-
/**
|
|
830
|
-
* Constants used in the pools API.
|
|
831
|
-
*/
|
|
832
|
-
PoolsApi.constants = {
|
|
833
|
-
moduleNames: {
|
|
834
|
-
interface: "amm_interface",
|
|
835
|
-
pool: "pool",
|
|
836
|
-
swap: "swap",
|
|
837
|
-
deposit: "deposit",
|
|
838
|
-
withdraw: "withdraw",
|
|
839
|
-
events: "events",
|
|
840
|
-
poolRegistry: "pool_registry",
|
|
841
|
-
routerWrapper: "router",
|
|
842
|
-
poolFactory: "pool_factory",
|
|
843
|
-
math: "math",
|
|
844
|
-
geometricMeanCalculations: "geometric_mean_calculations",
|
|
845
|
-
stableCalculations: "stable_calculations",
|
|
846
|
-
price: "price",
|
|
847
|
-
},
|
|
848
|
-
eventNames: {
|
|
849
|
-
swap: "SwapEvent",
|
|
850
|
-
deposit: "DepositEvent",
|
|
851
|
-
withdraw: "WithdrawEvent",
|
|
852
|
-
swapV2: "SwapEventV2",
|
|
853
|
-
depositV2: "DepositEventV2",
|
|
854
|
-
withdrawV2: "WithdrawEventV2",
|
|
855
|
-
},
|
|
856
|
-
defaultLpCoinIconImageUrl: "https://aftermath.finance/coins/lp/af_lp.svg",
|
|
857
|
-
};
|