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,601 +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 __rest = (this && this.__rest) || function (s, e) {
|
|
12
|
-
var t = {};
|
|
13
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
14
|
-
t[p] = s[p];
|
|
15
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
16
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
17
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
18
|
-
t[p[i]] = s[p[i]];
|
|
19
|
-
}
|
|
20
|
-
return t;
|
|
21
|
-
};
|
|
22
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
-
exports.PerpetualsVault = void 0;
|
|
24
|
-
const transactions_1 = require("@mysten/sui/transactions");
|
|
25
|
-
const caller_1 = require("../../general/utils/caller");
|
|
26
|
-
const perpetuals_1 = require("./perpetuals");
|
|
27
|
-
/**
|
|
28
|
-
* High-level wrapper around a single Perpetuals vault.
|
|
29
|
-
*
|
|
30
|
-
* A vault is a managed perpetuals account that accepts user deposits (LP),
|
|
31
|
-
* trades across up to a bounded set of markets, and supports withdrawals via
|
|
32
|
-
* a request flow.
|
|
33
|
-
*
|
|
34
|
-
* This class provides:
|
|
35
|
-
*
|
|
36
|
-
* - Transaction builders for:
|
|
37
|
-
* - User actions (deposit, create/cancel withdraw request, update slippage)
|
|
38
|
-
* - Force-withdraw processing (close positions and settle a request)
|
|
39
|
-
* - Owner admin actions (update params, process requests, withdraw fees/collateral)
|
|
40
|
-
* - Read helpers for:
|
|
41
|
-
* - Vault withdraw requests
|
|
42
|
-
* - LP token pricing
|
|
43
|
-
* - Accessing the vault’s underlying perpetuals account
|
|
44
|
-
* - Static validation helpers for LP coin metadata (name/symbol constraints)
|
|
45
|
-
* - A small calculation helper for withdraw-request slippage
|
|
46
|
-
*
|
|
47
|
-
* Typical usage:
|
|
48
|
-
*
|
|
49
|
-
* ```ts
|
|
50
|
-
* const perps = afSdk.Perpetuals();
|
|
51
|
-
* const { vaults } = await perps.getAllVaults();
|
|
52
|
-
* const vault = vaults[0];
|
|
53
|
-
*
|
|
54
|
-
* const { tx } = await vault.getDepositTx({
|
|
55
|
-
* walletAddress: "0x...",
|
|
56
|
-
* depositAmount: BigInt("1000000000"),
|
|
57
|
-
* minLpAmountOut: 0n,
|
|
58
|
-
* });
|
|
59
|
-
* ```
|
|
60
|
-
*/
|
|
61
|
-
class PerpetualsVault extends caller_1.Caller {
|
|
62
|
-
// =========================================================================
|
|
63
|
-
// Constructor
|
|
64
|
-
// =========================================================================
|
|
65
|
-
/**
|
|
66
|
-
* Create a new {@link PerpetualsVault} wrapper.
|
|
67
|
-
*
|
|
68
|
-
* @param vaultObject - Raw on-chain vault object snapshot.
|
|
69
|
-
* @param config - Optional {@link CallerConfig} (network, auth, base URL).
|
|
70
|
-
* @param Provider - Optional shared {@link AftermathApi} provider. When provided,
|
|
71
|
-
* transaction builders will serialize {@link Transaction}s into `txKind`.
|
|
72
|
-
*/
|
|
73
|
-
constructor(vaultObject, config, Provider) {
|
|
74
|
-
super(config, "perpetuals");
|
|
75
|
-
this.vaultObject = vaultObject;
|
|
76
|
-
this.Provider = Provider;
|
|
77
|
-
}
|
|
78
|
-
// =========================================================================
|
|
79
|
-
// Transactions
|
|
80
|
-
// =========================================================================
|
|
81
|
-
// =========================================================================
|
|
82
|
-
// Withdraw Request Txs
|
|
83
|
-
// =========================================================================
|
|
84
|
-
/**
|
|
85
|
-
* Build a `process-force-withdraw-request` transaction.
|
|
86
|
-
*
|
|
87
|
-
* Force-withdraw is a mechanism that closes required positions and processes
|
|
88
|
-
* a withdraw request after a delay window (see vault params).
|
|
89
|
-
*
|
|
90
|
-
* @param inputs.walletAddress - User wallet that owns the withdraw request.
|
|
91
|
-
* @param inputs.sizesToClose - Mapping of marketId -> size (base units) to close.
|
|
92
|
-
* @param inputs.recipientAddress - Optional recipient of the withdrawn collateral.
|
|
93
|
-
* @param inputs.tx - Optional transaction to extend.
|
|
94
|
-
*
|
|
95
|
-
* @returns Transaction response containing `tx` (and any additional outputs
|
|
96
|
-
* provided by the backend response type).
|
|
97
|
-
*/
|
|
98
|
-
getProcessForceWithdrawRequestTx(inputs) {
|
|
99
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
100
|
-
var _a;
|
|
101
|
-
const { tx } = inputs, otherInputs = __rest(inputs, ["tx"]);
|
|
102
|
-
return this.fetchApiTxObject("vault/transactions/process-force-withdraw-request", Object.assign(Object.assign({}, otherInputs), { vaultId: this.vaultObject.objectId, txKind: yield ((_a = this.Provider) === null || _a === void 0 ? void 0 : _a.Transactions().fetchBase64TxKindFromTx({
|
|
103
|
-
tx: tx !== null && tx !== void 0 ? tx : new transactions_1.Transaction(),
|
|
104
|
-
})) }), undefined, { txKind: true });
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
// TODO: docs
|
|
108
|
-
getPauseVaultForForceWithdrawRequestTx(inputs) {
|
|
109
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
110
|
-
var _a;
|
|
111
|
-
const { tx } = inputs;
|
|
112
|
-
return this.fetchApiTxObject("vault/transactions/pause-vault-for-force-withdraw-request", {
|
|
113
|
-
vaultId: this.vaultObject.objectId,
|
|
114
|
-
txKind: yield ((_a = this.Provider) === null || _a === void 0 ? void 0 : _a.Transactions().fetchBase64TxKindFromTx({
|
|
115
|
-
tx: tx !== null && tx !== void 0 ? tx : new transactions_1.Transaction(),
|
|
116
|
-
})),
|
|
117
|
-
}, undefined, { txKind: true });
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* Build an `update-withdraw-request-slippage` transaction.
|
|
122
|
-
*
|
|
123
|
-
* This updates the user's minimum acceptable collateral output amount
|
|
124
|
-
* for an existing withdraw request.
|
|
125
|
-
*
|
|
126
|
-
* @param inputs.minCollateralAmountOut - New minimum collateral amount out.
|
|
127
|
-
* @param inputs.tx - Optional transaction to extend.
|
|
128
|
-
*
|
|
129
|
-
* @returns Transaction response containing `tx`.
|
|
130
|
-
*/
|
|
131
|
-
getUpdateWithdrawRequestSlippageTx(inputs) {
|
|
132
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
133
|
-
var _a;
|
|
134
|
-
const { tx } = inputs, otherInputs = __rest(inputs, ["tx"]);
|
|
135
|
-
return this.fetchApiTxObject("vault/transactions/update-withdraw-request-slippage", Object.assign(Object.assign({}, otherInputs), { vaultId: this.vaultObject.objectId, txKind: yield ((_a = this.Provider) === null || _a === void 0 ? void 0 : _a.Transactions().fetchBase64TxKindFromTx({
|
|
136
|
-
tx: tx !== null && tx !== void 0 ? tx : new transactions_1.Transaction(),
|
|
137
|
-
})) }), undefined, { txKind: true });
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
// =========================================================================
|
|
141
|
-
// Owner Settings Txs
|
|
142
|
-
// =========================================================================
|
|
143
|
-
/**
|
|
144
|
-
* Build an owner transaction to update the vault's force withdraw delay.
|
|
145
|
-
*
|
|
146
|
-
* @param inputs.forceWithdrawDelayMs - New delay (ms). Should be <= {@link constants.maxForceWithdrawDelayMs}.
|
|
147
|
-
* @param inputs.tx - Optional transaction to extend.
|
|
148
|
-
*
|
|
149
|
-
* @returns Transaction response containing `tx`.
|
|
150
|
-
*/
|
|
151
|
-
getOwnerUpdateForceWithdrawDelayTx(inputs) {
|
|
152
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
153
|
-
var _a;
|
|
154
|
-
const { tx } = inputs, otherInputs = __rest(inputs, ["tx"]);
|
|
155
|
-
return this.fetchApiTxObject("vault/transactions/owner/update-force-withdraw-delay", Object.assign(Object.assign({}, otherInputs), { vaultId: this.vaultObject.objectId, txKind: yield ((_a = this.Provider) === null || _a === void 0 ? void 0 : _a.Transactions().fetchBase64TxKindFromTx({
|
|
156
|
-
tx: tx !== null && tx !== void 0 ? tx : new transactions_1.Transaction(),
|
|
157
|
-
})) }), undefined, { txKind: true });
|
|
158
|
-
});
|
|
159
|
-
}
|
|
160
|
-
/**
|
|
161
|
-
* Build an owner transaction to update the vault's lock period.
|
|
162
|
-
*
|
|
163
|
-
* @param inputs.lockPeriodMs - New lock period (ms). Should be <= {@link constants.maxLockPeriodMs}.
|
|
164
|
-
* @param inputs.tx - Optional transaction to extend.
|
|
165
|
-
*
|
|
166
|
-
* @returns Transaction response containing `tx`.
|
|
167
|
-
*/
|
|
168
|
-
getOwnerUpdateLockPeriodTx(inputs) {
|
|
169
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
170
|
-
var _a;
|
|
171
|
-
const { tx } = inputs, otherInputs = __rest(inputs, ["tx"]);
|
|
172
|
-
return this.fetchApiTxObject("vault/transactions/owner/update-lock-period", Object.assign(Object.assign({}, otherInputs), { vaultId: this.vaultObject.objectId, txKind: yield ((_a = this.Provider) === null || _a === void 0 ? void 0 : _a.Transactions().fetchBase64TxKindFromTx({
|
|
173
|
-
tx: tx !== null && tx !== void 0 ? tx : new transactions_1.Transaction(),
|
|
174
|
-
})) }), undefined, { txKind: true });
|
|
175
|
-
});
|
|
176
|
-
}
|
|
177
|
-
/**
|
|
178
|
-
* Build an owner transaction to update the vault performance fee.
|
|
179
|
-
*
|
|
180
|
-
* @param inputs.performanceFeePercentage - New fee as a fraction (e.g. `0.2` = 20%).
|
|
181
|
-
* Should be <= {@link constants.maxPerformanceFeePercentage}.
|
|
182
|
-
* @param inputs.tx - Optional transaction to extend.
|
|
183
|
-
*
|
|
184
|
-
* @returns Transaction response containing `tx`.
|
|
185
|
-
*/
|
|
186
|
-
getOwnerUpdatePerformanceFeeTx(inputs) {
|
|
187
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
188
|
-
var _a;
|
|
189
|
-
const { tx } = inputs, otherInputs = __rest(inputs, ["tx"]);
|
|
190
|
-
return this.fetchApiTxObject("vault/transactions/owner/update-performance-fee", Object.assign(Object.assign({}, otherInputs), { vaultId: this.vaultObject.objectId, txKind: yield ((_a = this.Provider) === null || _a === void 0 ? void 0 : _a.Transactions().fetchBase64TxKindFromTx({
|
|
191
|
-
tx: tx !== null && tx !== void 0 ? tx : new transactions_1.Transaction(),
|
|
192
|
-
})) }), undefined, { txKind: true });
|
|
193
|
-
});
|
|
194
|
-
}
|
|
195
|
-
// =========================================================================
|
|
196
|
-
// Owner Interactions Txs
|
|
197
|
-
// =========================================================================
|
|
198
|
-
/**
|
|
199
|
-
* Build an owner transaction to process one or more users' withdraw requests.
|
|
200
|
-
*
|
|
201
|
-
* This is the normal (non-force) processing path for withdrawals. The owner
|
|
202
|
-
* batches users and settles their requests in a single transaction.
|
|
203
|
-
*
|
|
204
|
-
* @param inputs.userAddresses - Users whose requests should be processed.
|
|
205
|
-
* @param inputs.tx - Optional transaction to extend.
|
|
206
|
-
*
|
|
207
|
-
* @returns Transaction response containing `tx`.
|
|
208
|
-
*/
|
|
209
|
-
getOwnerProcessWithdrawRequestsTx(inputs) {
|
|
210
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
211
|
-
var _a;
|
|
212
|
-
const { tx } = inputs, otherInputs = __rest(inputs, ["tx"]);
|
|
213
|
-
return this.fetchApiTxObject("vault/transactions/owner/process-withdraw-requests", Object.assign(Object.assign({}, otherInputs), { vaultId: this.vaultObject.objectId, txKind: yield ((_a = this.Provider) === null || _a === void 0 ? void 0 : _a.Transactions().fetchBase64TxKindFromTx({
|
|
214
|
-
tx: tx !== null && tx !== void 0 ? tx : new transactions_1.Transaction(),
|
|
215
|
-
})) }), undefined, { txKind: true });
|
|
216
|
-
});
|
|
217
|
-
}
|
|
218
|
-
/**
|
|
219
|
-
* Build an owner transaction to withdraw accrued performance fees.
|
|
220
|
-
*
|
|
221
|
-
* @param inputs.withdrawAmount - Amount of collateral to withdraw as fees.
|
|
222
|
-
* @param inputs.recipientAddress - Optional recipient address for the withdrawn fees.
|
|
223
|
-
* @param inputs.tx - Optional transaction to extend.
|
|
224
|
-
*
|
|
225
|
-
* @returns Response containing `tx` and any extra outputs described by
|
|
226
|
-
* {@link ApiPerpetualsVaultOwnerWithdrawPerformanceFeesTxResponse}.
|
|
227
|
-
*/
|
|
228
|
-
getOwnerWithdrawPerformanceFeesTx(inputs) {
|
|
229
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
230
|
-
var _a;
|
|
231
|
-
const { tx: txFromInputs } = inputs, otherInputs = __rest(inputs, ["tx"]);
|
|
232
|
-
return this.fetchApiTxObject("vault/transactions/owner/withdraw-performance-fees", Object.assign(Object.assign({}, otherInputs), { vaultId: this.vaultObject.objectId, txKind: yield ((_a = this.Provider) === null || _a === void 0 ? void 0 : _a.Transactions().fetchBase64TxKindFromTx({
|
|
233
|
-
tx: txFromInputs !== null && txFromInputs !== void 0 ? txFromInputs : new transactions_1.Transaction(),
|
|
234
|
-
})) }), undefined, { txKind: true });
|
|
235
|
-
});
|
|
236
|
-
}
|
|
237
|
-
/**
|
|
238
|
-
* Build an owner transaction to withdraw vault collateral by redeeming LP.
|
|
239
|
-
*
|
|
240
|
-
* @param inputs.lpWithdrawAmount - Amount of LP to redeem.
|
|
241
|
-
* @param inputs.minCollateralAmountOut - Minimum collateral out to protect from slippage.
|
|
242
|
-
* @param inputs.recipientAddress - Optional recipient address for withdrawn collateral.
|
|
243
|
-
* @param inputs.tx - Optional transaction to extend.
|
|
244
|
-
*
|
|
245
|
-
* @returns Response containing `tx` and any extra outputs described by
|
|
246
|
-
* {@link ApiPerpetualsVaultOwnerWithdrawCollateralTxResponse}.
|
|
247
|
-
*/
|
|
248
|
-
getOwnerWithdrawCollateralTx(inputs) {
|
|
249
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
250
|
-
var _a;
|
|
251
|
-
const { tx } = inputs, otherInputs = __rest(inputs, ["tx"]);
|
|
252
|
-
return this.fetchApiTxObject("vault/transactions/owner/withdraw-collateral", Object.assign(Object.assign({}, otherInputs), { vaultId: this.vaultObject.objectId, txKind: yield ((_a = this.Provider) === null || _a === void 0 ? void 0 : _a.Transactions().fetchBase64TxKindFromTx({
|
|
253
|
-
tx: tx !== null && tx !== void 0 ? tx : new transactions_1.Transaction(),
|
|
254
|
-
})) }), undefined, { txKind: true });
|
|
255
|
-
});
|
|
256
|
-
}
|
|
257
|
-
// =========================================================================
|
|
258
|
-
// User Interactions Txs
|
|
259
|
-
// =========================================================================
|
|
260
|
-
/**
|
|
261
|
-
* Build a user transaction to create a vault withdraw request.
|
|
262
|
-
*
|
|
263
|
-
* Withdrawals are request-based: the user specifies how much LP to redeem
|
|
264
|
-
* and a minimum collateral output amount.
|
|
265
|
-
*
|
|
266
|
-
* @param inputs.walletAddress - Wallet creating the request.
|
|
267
|
-
* @param inputs.lpWithdrawAmount - Amount of LP to withdraw.
|
|
268
|
-
* @param inputs.minCollateralAmountOut - Minimum collateral out (slippage guard).
|
|
269
|
-
* @param inputs.tx - Optional transaction to extend.
|
|
270
|
-
*
|
|
271
|
-
* @returns Transaction response containing `tx`.
|
|
272
|
-
*/
|
|
273
|
-
getCreateWithdrawRequestTx(inputs) {
|
|
274
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
275
|
-
var _a;
|
|
276
|
-
const { tx } = inputs, otherInputs = __rest(inputs, ["tx"]);
|
|
277
|
-
return this.fetchApiTxObject("vault/transactions/create-withdraw-request", Object.assign(Object.assign({}, otherInputs), { vaultId: this.vaultObject.objectId, txKind: yield ((_a = this.Provider) === null || _a === void 0 ? void 0 : _a.Transactions().fetchBase64TxKindFromTx({
|
|
278
|
-
tx: tx !== null && tx !== void 0 ? tx : new transactions_1.Transaction(),
|
|
279
|
-
})) }), undefined, { txKind: true });
|
|
280
|
-
});
|
|
281
|
-
}
|
|
282
|
-
/**
|
|
283
|
-
* Build a user transaction to cancel an existing vault withdraw request.
|
|
284
|
-
*
|
|
285
|
-
* @param inputs.walletAddress - Wallet canceling the request.
|
|
286
|
-
* @param inputs.tx - Optional transaction to extend.
|
|
287
|
-
*
|
|
288
|
-
* @returns Transaction response containing `tx`.
|
|
289
|
-
*/
|
|
290
|
-
getCancelWithdrawRequestTx(inputs) {
|
|
291
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
292
|
-
var _a;
|
|
293
|
-
const { tx } = inputs, otherInputs = __rest(inputs, ["tx"]);
|
|
294
|
-
return this.fetchApiTxObject("vault/transactions/cancel-withdraw-request", Object.assign(Object.assign({}, otherInputs), { vaultId: this.vaultObject.objectId, txKind: yield ((_a = this.Provider) === null || _a === void 0 ? void 0 : _a.Transactions().fetchBase64TxKindFromTx({
|
|
295
|
-
tx: tx !== null && tx !== void 0 ? tx : new transactions_1.Transaction(),
|
|
296
|
-
})) }), undefined, { txKind: true });
|
|
297
|
-
});
|
|
298
|
-
}
|
|
299
|
-
/**
|
|
300
|
-
* Build a user transaction to deposit collateral into the vault in exchange for LP.
|
|
301
|
-
*
|
|
302
|
-
* You can specify the deposit as:
|
|
303
|
-
* - `depositAmount` (wallet pays directly), OR
|
|
304
|
-
* - `depositCoinArg` (use an existing transaction argument)
|
|
305
|
-
*
|
|
306
|
-
* @param inputs.walletAddress - Depositor wallet.
|
|
307
|
-
* @param inputs.minLpAmountOut - Minimum LP out (slippage guard).
|
|
308
|
-
* @param inputs.isSponsoredTx - Whether the tx is sponsored (gas paid by another party).
|
|
309
|
-
* @param inputs.depositAmount - Amount of collateral to deposit (mutually exclusive with `depositCoinArg`).
|
|
310
|
-
* @param inputs.depositCoinArg - Transaction argument referencing collateral coin.
|
|
311
|
-
* @param inputs.tx - Optional transaction to extend.
|
|
312
|
-
*
|
|
313
|
-
* @returns Transaction response containing `tx`.
|
|
314
|
-
*
|
|
315
|
-
* @example
|
|
316
|
-
* ```ts
|
|
317
|
-
* const { txKind } = await vault.getDepositTx({
|
|
318
|
-
* walletAddress: "0x...",
|
|
319
|
-
* depositAmount: 1_000_000_000n,
|
|
320
|
-
* minLpAmountOut: 0n,
|
|
321
|
-
* });
|
|
322
|
-
* ```
|
|
323
|
-
*/
|
|
324
|
-
// TODO: make return lp coin out ?
|
|
325
|
-
getDepositTx(inputs) {
|
|
326
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
327
|
-
var _a;
|
|
328
|
-
const { tx } = inputs, otherInputs = __rest(inputs, ["tx"]);
|
|
329
|
-
const depositInputs = "depositAmount" in otherInputs
|
|
330
|
-
? {
|
|
331
|
-
depositAmount: otherInputs.depositAmount,
|
|
332
|
-
collateralCoinType: this.vaultObject.collateralCoinType,
|
|
333
|
-
}
|
|
334
|
-
: { depositCoinArg: otherInputs.depositCoinArg };
|
|
335
|
-
return this.fetchApiTxObject("vault/transactions/deposit", Object.assign(Object.assign(Object.assign({}, otherInputs), depositInputs), { vaultId: this.vaultObject.objectId, txKind: yield ((_a = this.Provider) === null || _a === void 0 ? void 0 : _a.Transactions().fetchBase64TxKindFromTx({
|
|
336
|
-
tx: tx !== null && tx !== void 0 ? tx : new transactions_1.Transaction(),
|
|
337
|
-
})) }), undefined, { txKind: true });
|
|
338
|
-
});
|
|
339
|
-
}
|
|
340
|
-
// =========================================================================
|
|
341
|
-
// Objects
|
|
342
|
-
// =========================================================================
|
|
343
|
-
/**
|
|
344
|
-
* Fetch all withdraw requests for this vault.
|
|
345
|
-
*
|
|
346
|
-
* @returns {@link ApiPerpetualsVaultsWithdrawRequestsResponse} containing requests
|
|
347
|
-
* scoped to `this.vaultObject.objectId`.
|
|
348
|
-
*
|
|
349
|
-
* @remarks
|
|
350
|
-
* This currently calls the `vaults/withdraw-requests` endpoint with a single vault ID.
|
|
351
|
-
* This may be moved to {@link Perpetuals} as a shared helper.
|
|
352
|
-
*/
|
|
353
|
-
// TODO: move to `Perpetuals` (as well) ?
|
|
354
|
-
getAllWithdrawRequests() {
|
|
355
|
-
return this.fetchApi("vaults/withdraw-requests", {
|
|
356
|
-
vaultIds: [this.vaultObject.objectId],
|
|
357
|
-
});
|
|
358
|
-
}
|
|
359
|
-
// =========================================================================
|
|
360
|
-
// Owner Previews
|
|
361
|
-
// =========================================================================
|
|
362
|
-
/**
|
|
363
|
-
* Preview the results of an owner processing one or more withdraw requests.
|
|
364
|
-
*
|
|
365
|
-
* @param inputs.userAddresses - Users to process.
|
|
366
|
-
* @returns Preview response with expected effects.
|
|
367
|
-
*/
|
|
368
|
-
getPreviewOwnerProcessWithdrawRequests(inputs) {
|
|
369
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
370
|
-
return this.fetchApi("vault/previews/owner/process-withdraw-requests", Object.assign(Object.assign({}, inputs), { vaultId: this.vaultObject.objectId }));
|
|
371
|
-
});
|
|
372
|
-
}
|
|
373
|
-
/**
|
|
374
|
-
* Preview the amount available for the owner to withdraw as performance fees.
|
|
375
|
-
*
|
|
376
|
-
* @returns Preview response including withdrawable fees and related metadata.
|
|
377
|
-
*/
|
|
378
|
-
getPreviewOwnerWithdrawPerformanceFees() {
|
|
379
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
380
|
-
return this.fetchApi("vault/previews/owner/withdraw-performance-fees", {
|
|
381
|
-
vaultId: this.vaultObject.objectId,
|
|
382
|
-
});
|
|
383
|
-
});
|
|
384
|
-
}
|
|
385
|
-
/**
|
|
386
|
-
* Preview an owner collateral withdrawal (LP redemption).
|
|
387
|
-
*
|
|
388
|
-
* @param inputs.lpWithdrawAmount - LP amount to redeem.
|
|
389
|
-
* @returns Preview response including estimated collateral out.
|
|
390
|
-
*/
|
|
391
|
-
getPreviewOwnerWithdrawCollateral(inputs) {
|
|
392
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
393
|
-
return this.fetchApi("vault/previews/owner/withdraw-collateral", Object.assign(Object.assign({}, inputs), { vaultId: this.vaultObject.objectId }));
|
|
394
|
-
});
|
|
395
|
-
}
|
|
396
|
-
// =========================================================================
|
|
397
|
-
// User Previews
|
|
398
|
-
// =========================================================================
|
|
399
|
-
/**
|
|
400
|
-
* Preview creating a withdraw request.
|
|
401
|
-
*
|
|
402
|
-
* @param inputs.walletAddress - Requesting wallet.
|
|
403
|
-
* @param inputs.lpWithdrawAmount - LP amount to withdraw.
|
|
404
|
-
* @returns Preview response including estimated collateral out and constraints.
|
|
405
|
-
*/
|
|
406
|
-
getPreviewCreateWithdrawRequest(inputs) {
|
|
407
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
408
|
-
return this.fetchApi("vault/previews/create-withdraw-request", Object.assign(Object.assign({}, inputs), { vaultId: this.vaultObject.objectId }));
|
|
409
|
-
});
|
|
410
|
-
}
|
|
411
|
-
/**
|
|
412
|
-
* Preview depositing into the vault.
|
|
413
|
-
*
|
|
414
|
-
* @param inputs.depositAmount - Deposit amount in collateral coin units.
|
|
415
|
-
* @returns Preview response including estimated LP out.
|
|
416
|
-
*/
|
|
417
|
-
getPreviewDeposit(inputs) {
|
|
418
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
419
|
-
return this.fetchApi("vault/previews/deposit", Object.assign(Object.assign({}, inputs), { vaultId: this.vaultObject.objectId }));
|
|
420
|
-
});
|
|
421
|
-
}
|
|
422
|
-
/**
|
|
423
|
-
* Preview processing a force withdraw request for a user.
|
|
424
|
-
*
|
|
425
|
-
* This is useful to determine what positions/sizes must be closed or what
|
|
426
|
-
* the expected outputs are prior to building the actual transaction.
|
|
427
|
-
*
|
|
428
|
-
* @param inputs.walletAddress - User wallet with a pending force-withdraw.
|
|
429
|
-
* @returns Preview response describing expected processing effects.
|
|
430
|
-
*/
|
|
431
|
-
getPreviewProcessForceWithdrawRequest(inputs) {
|
|
432
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
433
|
-
return this.fetchApi("vault/previews/process-force-withdraw-request", Object.assign(Object.assign({}, inputs), { vaultId: this.vaultObject.objectId }));
|
|
434
|
-
});
|
|
435
|
-
}
|
|
436
|
-
// TODO: docs
|
|
437
|
-
getPreviewPauseVaultForForceWithdrawRequest(inputs) {
|
|
438
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
439
|
-
return this.fetchApi("vault/previews/pause-vault-for-force-withdraw-request", Object.assign(Object.assign({}, inputs), { vaultId: this.vaultObject.objectId }));
|
|
440
|
-
});
|
|
441
|
-
}
|
|
442
|
-
// =========================================================================
|
|
443
|
-
// Inspections
|
|
444
|
-
// =========================================================================
|
|
445
|
-
/**
|
|
446
|
-
* Fetch the current LP coin price for this vault (in collateral units).
|
|
447
|
-
*
|
|
448
|
-
* Internally calls {@link Perpetuals.getLpCoinPrices} and returns the first price.
|
|
449
|
-
*
|
|
450
|
-
* @returns LP coin price as a `number`.
|
|
451
|
-
*/
|
|
452
|
-
getLpCoinPrice() {
|
|
453
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
454
|
-
return (yield new perpetuals_1.Perpetuals(this.config, this.Provider).getLpCoinPrices({
|
|
455
|
-
vaultIds: [this.vaultObject.objectId],
|
|
456
|
-
})).lpCoinPrices[0];
|
|
457
|
-
});
|
|
458
|
-
}
|
|
459
|
-
// =========================================================================
|
|
460
|
-
// Account
|
|
461
|
-
// =========================================================================
|
|
462
|
-
/**
|
|
463
|
-
* Build a lightweight “cap-like” object for the vault’s underlying account.
|
|
464
|
-
*
|
|
465
|
-
* @returns {@link PerpetualsPartialVaultCap} suitable for account fetch helpers
|
|
466
|
-
* such as {@link Perpetuals.getAccount}.
|
|
467
|
-
*/
|
|
468
|
-
partialVaultCap() {
|
|
469
|
-
return {
|
|
470
|
-
vaultId: this.vaultObject.objectId,
|
|
471
|
-
ownerAddress: this.vaultObject.ownerAddress,
|
|
472
|
-
accountId: this.vaultObject.accountId,
|
|
473
|
-
accountObjectId: this.vaultObject.accountObjectId,
|
|
474
|
-
collateralCoinType: this.vaultObject.collateralCoinType,
|
|
475
|
-
};
|
|
476
|
-
}
|
|
477
|
-
/**
|
|
478
|
-
* Fetch the underlying perpetuals account object for this vault.
|
|
479
|
-
*
|
|
480
|
-
* @returns `{ account }` where `account` is the on-chain {@link PerpetualsAccountObject}.
|
|
481
|
-
*/
|
|
482
|
-
getAccountObject() {
|
|
483
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
484
|
-
return {
|
|
485
|
-
account: (yield new perpetuals_1.Perpetuals(this.config, this.Provider).getAccountObjects({
|
|
486
|
-
accountIds: [this.vaultObject.accountId],
|
|
487
|
-
})).accounts[0],
|
|
488
|
-
};
|
|
489
|
-
});
|
|
490
|
-
}
|
|
491
|
-
/**
|
|
492
|
-
* Fetch a {@link PerpetualsAccount} wrapper for the vault’s underlying account.
|
|
493
|
-
*
|
|
494
|
-
* @returns `{ account }` where `account` is a high-level {@link PerpetualsAccount}.
|
|
495
|
-
*/
|
|
496
|
-
getAccount() {
|
|
497
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
498
|
-
return new perpetuals_1.Perpetuals(this.config, this.Provider).getAccount({
|
|
499
|
-
accountCap: this.partialVaultCap(),
|
|
500
|
-
});
|
|
501
|
-
});
|
|
502
|
-
}
|
|
503
|
-
// =========================================================================
|
|
504
|
-
// Getters
|
|
505
|
-
// =========================================================================
|
|
506
|
-
// TODO: docs
|
|
507
|
-
isPaused() {
|
|
508
|
-
return !!(this.vaultObject.pausedUntilTimestamp &&
|
|
509
|
-
this.vaultObject.pausedUntilTimestamp > BigInt(Date.now()));
|
|
510
|
-
}
|
|
511
|
-
}
|
|
512
|
-
exports.PerpetualsVault = PerpetualsVault;
|
|
513
|
-
// =========================================================================
|
|
514
|
-
// Public Constants
|
|
515
|
-
// =========================================================================
|
|
516
|
-
/**
|
|
517
|
-
* Vault-level protocol limits and UI-friendly constraints.
|
|
518
|
-
*
|
|
519
|
-
* @remarks
|
|
520
|
-
* These are SDK constants (not fetched from chain). They should match the
|
|
521
|
-
* on-chain / backend limits enforced by the vault module.
|
|
522
|
-
*/
|
|
523
|
-
PerpetualsVault.constants = {
|
|
524
|
-
/**
|
|
525
|
-
* Maximum lock period in milliseconds.
|
|
526
|
-
*/
|
|
527
|
-
maxLockPeriodMs: 5184000000, // 2 months
|
|
528
|
-
/**
|
|
529
|
-
* Maximum period for force withdraw delay in milliseconds.
|
|
530
|
-
*/
|
|
531
|
-
maxForceWithdrawDelayMs: 86400000, // 1 day
|
|
532
|
-
/**
|
|
533
|
-
* Maximum vault fee (performance fee).
|
|
534
|
-
*/
|
|
535
|
-
maxPerformanceFeePercentage: 0.2, // 20%
|
|
536
|
-
/**
|
|
537
|
-
* Minimum USD value required for user deposits.
|
|
538
|
-
*/
|
|
539
|
-
minDepositUsd: 1,
|
|
540
|
-
/**
|
|
541
|
-
* Minimum USD value required to be locked by vault owner during vault creation.
|
|
542
|
-
*/
|
|
543
|
-
minOwnerLockUsd: 1,
|
|
544
|
-
/**
|
|
545
|
-
* The maximum number of distinct markets (`ClearingHouse`s) the vault can trade.
|
|
546
|
-
*/
|
|
547
|
-
maxMarketsInVault: 12,
|
|
548
|
-
/**
|
|
549
|
-
* The maximum number of pending orders allowed for a single position in the vault.
|
|
550
|
-
*/
|
|
551
|
-
maxPendingOrdersPerPosition: 70,
|
|
552
|
-
};
|
|
553
|
-
// =========================================================================
|
|
554
|
-
// Static
|
|
555
|
-
// =========================================================================
|
|
556
|
-
/**
|
|
557
|
-
* Checks if a string is a valid LP coin name.
|
|
558
|
-
*
|
|
559
|
-
* @param value - The string to check.
|
|
560
|
-
* @returns `true` if `value` can be used as a valid LP coin name, otherwise `false`.
|
|
561
|
-
*
|
|
562
|
-
* @remarks
|
|
563
|
-
* Current rule: ASCII-only. This aligns with many on-chain metadata constraints.
|
|
564
|
-
*/
|
|
565
|
-
PerpetualsVault.isValidLpCoinName = (value) => {
|
|
566
|
-
return /^[\x00-\x7F]+$/.test(value);
|
|
567
|
-
};
|
|
568
|
-
/**
|
|
569
|
-
* Checks if a string is a valid LP coin type symbol.
|
|
570
|
-
*
|
|
571
|
-
* @param value - The string to check.
|
|
572
|
-
* @returns `true` if `value` can be used as a valid LP coin type symbol, otherwise `false`.
|
|
573
|
-
*
|
|
574
|
-
* @remarks
|
|
575
|
-
* Current rule: uppercase A–Z plus underscore.
|
|
576
|
-
*/
|
|
577
|
-
PerpetualsVault.isValidLpCoinTypeSymbol = (value) => {
|
|
578
|
-
return /^[A-Z_]+$/.test(value);
|
|
579
|
-
};
|
|
580
|
-
// =========================================================================
|
|
581
|
-
// Calculations
|
|
582
|
-
// =========================================================================
|
|
583
|
-
/**
|
|
584
|
-
* Compute the implied slippage tolerance for a withdraw request.
|
|
585
|
-
*
|
|
586
|
-
* Defined as:
|
|
587
|
-
* ```text
|
|
588
|
-
* (lpAmountInUsd - minCollateralAmountOutUsd) / lpAmountInUsd
|
|
589
|
-
* ```
|
|
590
|
-
*
|
|
591
|
-
* @param inputs.withdrawRequest - Withdraw request to analyze.
|
|
592
|
-
* @returns Slippage fraction (0..1). Returns `0` if `lpAmountInUsd` is missing/zero.
|
|
593
|
-
*/
|
|
594
|
-
PerpetualsVault.calcWithdrawRequestSlippage = (inputs) => {
|
|
595
|
-
const { withdrawRequest } = inputs;
|
|
596
|
-
return withdrawRequest.lpAmountInUsd
|
|
597
|
-
? (withdrawRequest.lpAmountInUsd -
|
|
598
|
-
withdrawRequest.minCollateralAmountOutUsd) /
|
|
599
|
-
withdrawRequest.lpAmountInUsd
|
|
600
|
-
: 0;
|
|
601
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/packages/perpetuals/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./perpetualsOrderUtils"), exports);
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { PerpetualsOrderId, PerpetualsOrderSide } from "../../../types";
|
|
2
|
-
export declare class PerpetualsOrderUtils {
|
|
3
|
-
static orderId: (price: bigint, counter: bigint, side: PerpetualsOrderSide) => PerpetualsOrderId;
|
|
4
|
-
private static orderIdAsk;
|
|
5
|
-
private static orderIdBid;
|
|
6
|
-
static price: (orderId: PerpetualsOrderId) => bigint;
|
|
7
|
-
private static priceAsk;
|
|
8
|
-
private static priceBid;
|
|
9
|
-
static counter: (orderId: PerpetualsOrderId) => bigint;
|
|
10
|
-
static isAsk: (orderId: PerpetualsOrderId) => boolean;
|
|
11
|
-
}
|
|
12
|
-
//# sourceMappingURL=perpetualsOrderUtils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"perpetualsOrderUtils.d.ts","sourceRoot":"","sources":["../../../../src/packages/perpetuals/utils/perpetualsOrderUtils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAGxE,qBAAa,oBAAoB;IAEhC,OAAc,OAAO,GACpB,OAAO,MAAM,EACb,SAAS,MAAM,EACf,MAAM,mBAAmB,KACvB,iBAAiB,CAGlB;IAIF,OAAO,CAAC,MAAM,CAAC,UAAU,CAOvB;IAIF,OAAO,CAAC,MAAM,CAAC,UAAU,CAQvB;IAGF,OAAc,KAAK,GAAI,SAAS,iBAAiB,KAAG,MAAM,CAIxD;IAGF,OAAO,CAAC,MAAM,CAAC,QAAQ,CAGrB;IAGF,OAAO,CAAC,MAAM,CAAC,QAAQ,CAIrB;IAEF,OAAc,OAAO,GAAI,SAAS,iBAAiB,KAAG,MAAM,CAI1D;IAEF,OAAc,KAAK,GAAI,SAAS,iBAAiB,KAAG,OAAO,CAIzD;CACF"}
|