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,273 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var _a;
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.Casting = void 0;
|
|
5
|
-
const bcs_1 = require("@mysten/sui/bcs");
|
|
6
|
-
const suiFrensApiCasting_1 = require("../../packages/suiFrens/api/suiFrensApiCasting");
|
|
7
|
-
const faucetApiCasting_1 = require("../../packages/faucet/api/faucetApiCasting");
|
|
8
|
-
const nftAmmApiCasting_1 = require("../../packages/nftAmm/api/nftAmmApiCasting");
|
|
9
|
-
const poolsApiCasting_1 = require("../../packages/pools/api/poolsApiCasting");
|
|
10
|
-
const stakingApiCasting_1 = require("../../packages/staking/api/stakingApiCasting");
|
|
11
|
-
const routerApiCasting_1 = require("../../packages/router/api/routerApiCasting");
|
|
12
|
-
const fixedUtils_1 = require("./fixedUtils");
|
|
13
|
-
const iFixedUtils_1 = require("./iFixedUtils");
|
|
14
|
-
const perpetualsApiCasting_1 = require("../../packages/perpetuals/api/perpetualsApiCasting");
|
|
15
|
-
const farmsApiCasting_1 = require("../../packages/farms/api/farmsApiCasting");
|
|
16
|
-
const leveragedStakingApiCasting_1 = require("../../packages/leveragedStaking/api/leveragedStakingApiCasting");
|
|
17
|
-
const __1 = require("../..");
|
|
18
|
-
const nftsApiCasting_1 = require("../nfts/nftsApiCasting");
|
|
19
|
-
/**
|
|
20
|
-
* A central utility class for casting and conversion routines across
|
|
21
|
-
* different Aftermath modules. Provides both direct numeric transformations
|
|
22
|
-
* (e.g., fixed-point arithmetic) and advanced BCS-based object deserialization.
|
|
23
|
-
*/
|
|
24
|
-
class Casting {
|
|
25
|
-
// =========================================================================
|
|
26
|
-
// Percentage <-> Bps
|
|
27
|
-
// =========================================================================
|
|
28
|
-
/**
|
|
29
|
-
* Converts a decimal percentage into basis points (bps), returned as a bigint.
|
|
30
|
-
* For example, 0.05 => 500 bps.
|
|
31
|
-
*
|
|
32
|
-
* @param percentage - The decimal percentage to convert (e.g., 0.05 for 5%).
|
|
33
|
-
* @returns A bigint representing basis points.
|
|
34
|
-
*/
|
|
35
|
-
static percentageToBps(percentage) {
|
|
36
|
-
// Convert decimal percentage to basis points
|
|
37
|
-
const bps = percentage * 10000;
|
|
38
|
-
// Convert basis points to bigint
|
|
39
|
-
return BigInt(Math.round(bps));
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Converts a bigint basis points value back to a decimal percentage.
|
|
43
|
-
* For example, 500n => 0.05 (5%).
|
|
44
|
-
*
|
|
45
|
-
* @param bps - The bigint basis points to convert (e.g., 500n).
|
|
46
|
-
* @returns The decimal percentage (0.05).
|
|
47
|
-
*/
|
|
48
|
-
static bpsToPercentage(bps) {
|
|
49
|
-
// Convert bigint basis points to number
|
|
50
|
-
const bpsNumber = Number(bps);
|
|
51
|
-
// Convert basis points to decimal percentage
|
|
52
|
-
const percentage = bpsNumber / 10000;
|
|
53
|
-
return percentage;
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Extracts base64 BCS bytes from a `SuiObjectResponse` if present. Throws an error otherwise.
|
|
57
|
-
*
|
|
58
|
-
* @param suiObjectResponse - The Sui object response containing `bcsBytes`.
|
|
59
|
-
* @returns A base64 string representing the object's BCS data.
|
|
60
|
-
* @throws If the object response does not contain `bcsBytes`.
|
|
61
|
-
*/
|
|
62
|
-
static bcsBytesFromSuiObjectResponse(suiObjectResponse) {
|
|
63
|
-
var _b, _c;
|
|
64
|
-
const rawData = (_b = suiObjectResponse.data) === null || _b === void 0 ? void 0 : _b.bcs;
|
|
65
|
-
if (rawData && "bcsBytes" in rawData)
|
|
66
|
-
return rawData.bcsBytes;
|
|
67
|
-
throw new Error(`no bcs bytes found on object: ${(_c = suiObjectResponse.data) === null || _c === void 0 ? void 0 : _c.objectId}`);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
exports.Casting = Casting;
|
|
71
|
-
_a = Casting;
|
|
72
|
-
// =========================================================================
|
|
73
|
-
// Api Casting
|
|
74
|
-
// =========================================================================
|
|
75
|
-
/**
|
|
76
|
-
* Casting utilities for pools-related data (AMM pools, liquidity, etc.).
|
|
77
|
-
*/
|
|
78
|
-
Casting.pools = poolsApiCasting_1.PoolsApiCasting;
|
|
79
|
-
/**
|
|
80
|
-
* Casting utilities for SuiFrens-related data or objects.
|
|
81
|
-
*/
|
|
82
|
-
Casting.suiFrens = suiFrensApiCasting_1.SuiFrensApiCasting;
|
|
83
|
-
/**
|
|
84
|
-
* Casting utilities for faucet-related data, typically for devnet or testnet tokens.
|
|
85
|
-
*/
|
|
86
|
-
Casting.faucet = faucetApiCasting_1.FaucetApiCasting;
|
|
87
|
-
/**
|
|
88
|
-
* Casting utilities for staking-related data (positions, pools, etc.).
|
|
89
|
-
*/
|
|
90
|
-
Casting.staking = stakingApiCasting_1.StakingApiCasting;
|
|
91
|
-
/**
|
|
92
|
-
* Casting utilities for leveraged staking data structures.
|
|
93
|
-
*/
|
|
94
|
-
Casting.leveragedStaking = leveragedStakingApiCasting_1.LeveragedStakingApiCasting;
|
|
95
|
-
/**
|
|
96
|
-
* Casting utilities for NFT AMM objects and events.
|
|
97
|
-
*/
|
|
98
|
-
Casting.nftAmm = nftAmmApiCasting_1.NftAmmApiCasting;
|
|
99
|
-
/**
|
|
100
|
-
* Casting utilities for router-based data, such as trade routes and DEX interactions.
|
|
101
|
-
*/
|
|
102
|
-
Casting.router = routerApiCasting_1.RouterApiCasting;
|
|
103
|
-
/**
|
|
104
|
-
* Casting utilities for perpetuals/futures data.
|
|
105
|
-
*/
|
|
106
|
-
Casting.perpetuals = perpetualsApiCasting_1.PerpetualsApiCasting;
|
|
107
|
-
/**
|
|
108
|
-
* Casting utilities for farming data (yield farms, locked positions, etc.).
|
|
109
|
-
*/
|
|
110
|
-
Casting.farms = farmsApiCasting_1.FarmsApiCasting;
|
|
111
|
-
/**
|
|
112
|
-
* Casting utilities for NFT structures and data retrieval logic.
|
|
113
|
-
*/
|
|
114
|
-
Casting.nfts = nftsApiCasting_1.NftsApiCasting;
|
|
115
|
-
// =========================================================================
|
|
116
|
-
// Constants
|
|
117
|
-
// =========================================================================
|
|
118
|
-
/**
|
|
119
|
-
* Reference to the standard fixed-point arithmetic utilities (18 decimals).
|
|
120
|
-
*/
|
|
121
|
-
Casting.Fixed = fixedUtils_1.FixedUtils;
|
|
122
|
-
/**
|
|
123
|
-
* Reference to the intermediate fixed type (signed 18 decimals).
|
|
124
|
-
*/
|
|
125
|
-
Casting.IFixed = iFixedUtils_1.IFixedUtils;
|
|
126
|
-
/**
|
|
127
|
-
* The maximum unsigned 64-bit integer value as a bigint (0xFFFFFFFFFFFFFFFF).
|
|
128
|
-
*/
|
|
129
|
-
Casting.u64MaxBigInt = BigInt("0xFFFFFFFFFFFFFFFF");
|
|
130
|
-
/**
|
|
131
|
-
* The maximum signed 64-bit integer value as a bigint.
|
|
132
|
-
*/
|
|
133
|
-
Casting.i64MaxBigInt = BigInt("9223372036854775807");
|
|
134
|
-
// =========================================================================
|
|
135
|
-
// Functions
|
|
136
|
-
// =========================================================================
|
|
137
|
-
// =========================================================================
|
|
138
|
-
// Fixed / IFixed
|
|
139
|
-
// =========================================================================
|
|
140
|
-
/**
|
|
141
|
-
* Converts a floating-point number to a fixed bigint with 18 decimals.
|
|
142
|
-
* For example, `1.23` => `1230000000000000000n` if we consider 18 decimals.
|
|
143
|
-
*
|
|
144
|
-
* @param a - The number to convert.
|
|
145
|
-
* @returns A bigint representing the number in 18-decimal fixed format.
|
|
146
|
-
*/
|
|
147
|
-
Casting.numberToFixedBigInt = (a) => BigInt(Math.floor(a * _a.Fixed.fixedOneN));
|
|
148
|
-
/**
|
|
149
|
-
* Converts an 18-decimal fixed bigint to a floating-point number.
|
|
150
|
-
* For example, `1230000000000000000n` => `1.23`.
|
|
151
|
-
*
|
|
152
|
-
* @param a - The fixed bigint to convert.
|
|
153
|
-
* @returns A floating-point representation of the 18-decimal fixed value.
|
|
154
|
-
*/
|
|
155
|
-
Casting.bigIntToFixedNumber = (a) => Number(a) / _a.Fixed.fixedOneN;
|
|
156
|
-
/**
|
|
157
|
-
* Scales a bigint by a floating-point scalar. For instance, a scalar of 0.5
|
|
158
|
-
* and a bigint of 100 => 50n.
|
|
159
|
-
*
|
|
160
|
-
* @param scalar - The floating-point multiplier (e.g., 0.5).
|
|
161
|
-
* @param int - The bigint to be scaled.
|
|
162
|
-
* @returns A bigint result after scaling.
|
|
163
|
-
*/
|
|
164
|
-
Casting.scaleNumberByBigInt = (scalar, int) => BigInt(Math.floor(scalar * Number(int)));
|
|
165
|
-
// =========================================================================
|
|
166
|
-
// Bytes / BCS
|
|
167
|
-
// =========================================================================
|
|
168
|
-
/**
|
|
169
|
-
* Converts an array of bytes into a string by interpreting each byte as a character code.
|
|
170
|
-
*
|
|
171
|
-
* @param bytes - An array of bytes to convert.
|
|
172
|
-
* @returns The resulting ASCII string.
|
|
173
|
-
*/
|
|
174
|
-
Casting.stringFromBytes = (bytes) => String.fromCharCode.apply(null, bytes);
|
|
175
|
-
/**
|
|
176
|
-
* Interprets an array of bytes as a little-endian hex string, converting
|
|
177
|
-
* that string into a bigint. For example, `[0x01, 0x02]` => `0x0201` => `513n`.
|
|
178
|
-
*
|
|
179
|
-
* @param bytes - An array of bytes.
|
|
180
|
-
* @returns The resulting bigint from the hex.
|
|
181
|
-
*/
|
|
182
|
-
Casting.bigIntFromBytes = (bytes) => BigInt("0x" +
|
|
183
|
-
bytes
|
|
184
|
-
.reverse()
|
|
185
|
-
.map((byte) => byte.toString(16).padStart(2, "0"))
|
|
186
|
-
.join(""));
|
|
187
|
-
/**
|
|
188
|
-
* Converts BCS-encoded address bytes into a SuiAddress (0x...) string,
|
|
189
|
-
* preserving any needed leading zeroes.
|
|
190
|
-
*
|
|
191
|
-
* @param bytes - The address bytes in BCS-encoded form.
|
|
192
|
-
* @returns A normalized Sui address string (e.g., "0x000123...").
|
|
193
|
-
*/
|
|
194
|
-
Casting.addressFromBcsBytes = (bytes) => __1.Helpers.addLeadingZeroesToType(bcs_1.bcs.Address.parse(new Uint8Array(bytes)));
|
|
195
|
-
/**
|
|
196
|
-
* Converts an array of bytes directly to a Sui address string in "0x..." format,
|
|
197
|
-
* adding any leading zeros if needed.
|
|
198
|
-
*
|
|
199
|
-
* @param bytes - The raw bytes for the address.
|
|
200
|
-
* @returns A normalized Sui address.
|
|
201
|
-
*/
|
|
202
|
-
Casting.addressFromBytes = (bytes) => __1.Helpers.addLeadingZeroesToType("0x" +
|
|
203
|
-
bytes
|
|
204
|
-
.map((byte) => {
|
|
205
|
-
const hex = byte.toString(16);
|
|
206
|
-
return hex.length === 1 ? "0" + hex : hex;
|
|
207
|
-
})
|
|
208
|
-
.join(""));
|
|
209
|
-
/**
|
|
210
|
-
* Converts an array of hex string bytes into a Sui address. Each element of
|
|
211
|
-
* the array is a string representing a byte (e.g., `["255", "0", ...]`).
|
|
212
|
-
*
|
|
213
|
-
* @param bytes - An array of stringified bytes to convert.
|
|
214
|
-
* @returns A normalized Sui address.
|
|
215
|
-
*/
|
|
216
|
-
Casting.addressFromStringBytes = (bytes) => _a.addressFromBytes(_a.bytesFromStringBytes(bytes));
|
|
217
|
-
/**
|
|
218
|
-
* Converts an array of decimal-encoded string bytes (e.g., `["255", "0"]`)
|
|
219
|
-
* into a numeric `Byte[]` array.
|
|
220
|
-
*
|
|
221
|
-
* @param bytes - The string array representing decimal values.
|
|
222
|
-
* @returns A numeric array of bytes.
|
|
223
|
-
*/
|
|
224
|
-
Casting.bytesFromStringBytes = (bytes) => bytes.map((byte) => Number(byte));
|
|
225
|
-
/**
|
|
226
|
-
* Unwraps a deserialized "Option" type from the BCS, returning its contents
|
|
227
|
-
* if present, or `undefined` if not.
|
|
228
|
-
*
|
|
229
|
-
* @param deserializedData - The BCS-deserialized structure that might contain `{ Some: value }` or `{ None: true }`.
|
|
230
|
-
* @returns The unwrapped data if present, or `undefined`.
|
|
231
|
-
*/
|
|
232
|
-
Casting.unwrapDeserializedOption = (deserializedData) => {
|
|
233
|
-
return "Some" in deserializedData ? deserializedData.Some : undefined;
|
|
234
|
-
};
|
|
235
|
-
/**
|
|
236
|
-
* Encodes a JavaScript string into a UTF-8 `Uint8Array`, suitable for
|
|
237
|
-
* on-chain usage or hashing.
|
|
238
|
-
*
|
|
239
|
-
* @param str - The string to encode.
|
|
240
|
-
* @returns An array of numeric bytes representing the UTF-8 encoded string.
|
|
241
|
-
*/
|
|
242
|
-
Casting.u8VectorFromString = (str) => {
|
|
243
|
-
const textEncode = new TextEncoder();
|
|
244
|
-
const encodedStr = textEncode.encode(str);
|
|
245
|
-
const uint8s = [];
|
|
246
|
-
for (const uint8 of encodedStr.values()) {
|
|
247
|
-
uint8s.push(uint8);
|
|
248
|
-
}
|
|
249
|
-
return uint8s;
|
|
250
|
-
};
|
|
251
|
-
/**
|
|
252
|
-
* Normalizes a user-provided slippage tolerance from an integer percentage
|
|
253
|
-
* into a decimal fraction. E.g., `1 => 0.01`.
|
|
254
|
-
*
|
|
255
|
-
* @param slippageTolerance - The slippage in integer percent form (e.g., 1 for 1%).
|
|
256
|
-
* @returns A decimal fraction (e.g., 0.01).
|
|
257
|
-
*/
|
|
258
|
-
Casting.normalizeSlippageTolerance = (slippageTolerance) => {
|
|
259
|
-
return slippageTolerance / 100;
|
|
260
|
-
};
|
|
261
|
-
/**
|
|
262
|
-
* Deserializes a `SuiObjectResponse`'s BCS bytes into an object of type `T` using
|
|
263
|
-
* a specified `bcsType`. Typically used for on-chain object decoding.
|
|
264
|
-
*
|
|
265
|
-
* @param inputs - The inputs including `suiObjectResponse`, `bcsType`, and a `fromDeserialized` transform function.
|
|
266
|
-
* @returns The transformed object of type `T` after BCS deserialization.
|
|
267
|
-
* @throws If no BCS bytes are found in the object.
|
|
268
|
-
*/
|
|
269
|
-
Casting.castObjectBcs = (inputs) => {
|
|
270
|
-
const { suiObjectResponse, bcsType, fromDeserialized } = inputs;
|
|
271
|
-
const deserialized = bcsType.fromBase64(_a.bcsBytesFromSuiObjectResponse(suiObjectResponse));
|
|
272
|
-
return fromDeserialized(deserialized);
|
|
273
|
-
};
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import { Balance, DecimalsScalar, NormalizedBalance } from "../../types";
|
|
2
|
-
/**
|
|
3
|
-
* The `FixedUtils` class provides utilities for fixed-point arithmetic
|
|
4
|
-
* with a standard 18-decimal precision, along with some convenience
|
|
5
|
-
* methods for normalizing/un-normalizing amounts based on token decimals.
|
|
6
|
-
*/
|
|
7
|
-
export declare class FixedUtils {
|
|
8
|
-
/**
|
|
9
|
-
* Represents 1.0 in 18-decimal fixed math as a float: 1_000_000_000_000_000_000.
|
|
10
|
-
*/
|
|
11
|
-
static readonly fixedOneN: number;
|
|
12
|
-
/**
|
|
13
|
-
* Represents 1.0 in 18-decimal fixed math as a bigint: 1000000000000000000n.
|
|
14
|
-
*/
|
|
15
|
-
static readonly fixedOneB: bigint;
|
|
16
|
-
/**
|
|
17
|
-
* Represents 1.0 in 9-decimal fixed math as a float: 1_000_000_000.
|
|
18
|
-
*/
|
|
19
|
-
static readonly fixedOneN9 = 1000000000;
|
|
20
|
-
/**
|
|
21
|
-
* Represents 1.0 in 9-decimal fixed math as a bigint: 1000000000n.
|
|
22
|
-
*/
|
|
23
|
-
static readonly fixedOneB9: bigint;
|
|
24
|
-
/**
|
|
25
|
-
* Directly convert an on-chain `u64` (stored as a bigint) into a float, effectively no scaling.
|
|
26
|
-
*
|
|
27
|
-
* @param n - The on-chain number as a bigint.
|
|
28
|
-
* @returns The converted number as a float.
|
|
29
|
-
*/
|
|
30
|
-
static readonly convertFromInt: (n: OnChainNumber) => LocalNumber;
|
|
31
|
-
/**
|
|
32
|
-
* Convert a floating number back to an on-chain integer (bigint),
|
|
33
|
-
* truncating decimals.
|
|
34
|
-
*
|
|
35
|
-
* @param n - The local float.
|
|
36
|
-
* @returns The truncated bigint.
|
|
37
|
-
*/
|
|
38
|
-
static readonly convertToInt: (n: LocalNumber) => OnChainNumber;
|
|
39
|
-
/**
|
|
40
|
-
* Converts a fixed-18 on-chain number to a floating local number by dividing by `fixedOneN`.
|
|
41
|
-
*
|
|
42
|
-
* @param n - The on-chain 18-decimal fixed number (as a bigint).
|
|
43
|
-
* @returns A float representing the unscaled value.
|
|
44
|
-
*/
|
|
45
|
-
static readonly directCast: (n: OnChainNumber) => LocalNumber;
|
|
46
|
-
/**
|
|
47
|
-
* Converts a floating local number to an on-chain 18-decimal fixed bigint by multiplying by `fixedOneN`.
|
|
48
|
-
*
|
|
49
|
-
* @param n - The local float to be scaled.
|
|
50
|
-
* @returns The scaled 18-decimal fixed as a bigint.
|
|
51
|
-
*/
|
|
52
|
-
static readonly directUncast: (n: LocalNumber) => OnChainNumber;
|
|
53
|
-
/**
|
|
54
|
-
* Returns the complement of the number in `[0,1]`, i.e., `1 - n`.
|
|
55
|
-
* If `n` is negative, it's treated as zero; if `n` > 1, also treated as zero for the complement.
|
|
56
|
-
*
|
|
57
|
-
* @param n - The local float in [0,1].
|
|
58
|
-
* @returns The complement of `n` in [0,1].
|
|
59
|
-
*/
|
|
60
|
-
static readonly complement: (n: LocalNumber) => number;
|
|
61
|
-
/**
|
|
62
|
-
* Multiplies a raw integer `amount` by a `decimalsScalar` to produce
|
|
63
|
-
* a "normalized" form. E.g., if decimals = 9, we store it as 10^9 scale.
|
|
64
|
-
*
|
|
65
|
-
* @param decimalsScalar - The scale factor for the coin (e.g., 1e9).
|
|
66
|
-
* @param amount - The raw integer (balance) to be scaled.
|
|
67
|
-
* @returns The scaled (normalized) amount as a `number`.
|
|
68
|
-
*/
|
|
69
|
-
static readonly normalizeAmount: (decimalsScalar: DecimalsScalar, amount: Balance) => NormalizedBalance;
|
|
70
|
-
/**
|
|
71
|
-
* Divides a normalized amount by the `decimalsScalar` to get back the
|
|
72
|
-
* raw on-chain integer. This is typically used after floating computations.
|
|
73
|
-
*
|
|
74
|
-
* @param decimalsScalar - The scale factor for the coin (e.g., 1e9).
|
|
75
|
-
* @param normalizedAmount - The scaled amount to reduce.
|
|
76
|
-
* @returns The raw integer balance.
|
|
77
|
-
*/
|
|
78
|
-
static readonly unnormalizeAmount: (decimalsScalar: DecimalsScalar, normalizedAmount: NormalizedBalance) => Balance;
|
|
79
|
-
/**
|
|
80
|
-
* Directly cast a `Balance` to an 18-decimal float, factoring in token decimals.
|
|
81
|
-
*
|
|
82
|
-
* @param decimalsScalar - The token's decimal scale factor.
|
|
83
|
-
* @param amount - The raw integer `Balance`.
|
|
84
|
-
* @returns A float representing the 18-decimal scale cast.
|
|
85
|
-
*/
|
|
86
|
-
static readonly castAndNormalize: (decimalsScalar: DecimalsScalar, amount: Balance) => LocalNumber;
|
|
87
|
-
/**
|
|
88
|
-
* Reverse the cast of a normalized float back to a raw `Balance`,
|
|
89
|
-
* factoring in the token decimals.
|
|
90
|
-
*
|
|
91
|
-
* @param decimalsScalar - The token's decimal scale factor.
|
|
92
|
-
* @param normalizedAmount - A local float in 18-decimal domain.
|
|
93
|
-
* @returns A raw integer `Balance`.
|
|
94
|
-
*/
|
|
95
|
-
static readonly uncastAndUnnormalize: (decimalsScalar: DecimalsScalar, normalizedAmount: LocalNumber) => Balance;
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* A numeric type used on chain, typically fixed 18 decimals or direct u64.
|
|
99
|
-
*/
|
|
100
|
-
export type OnChainNumber = bigint;
|
|
101
|
-
/**
|
|
102
|
-
* A local floating value for user calculations or UI representation.
|
|
103
|
-
*/
|
|
104
|
-
export type LocalNumber = number;
|
|
105
|
-
/**
|
|
106
|
-
* A scalar is any fixed 18-point number. They are stored on chain as a u128 and are always directly cast.
|
|
107
|
-
*/
|
|
108
|
-
export type OnChainScalar = OnChainNumber;
|
|
109
|
-
//# sourceMappingURL=fixedUtils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fixedUtils.d.ts","sourceRoot":"","sources":["../../../src/general/utils/fixedUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEzE;;;;GAIG;AACH,qBAAa,UAAU;IACtB;;OAEG;IACH,gBAAuB,SAAS,EAAE,MAAM,CAA6B;IAErE;;OAEG;IACH,gBAAuB,SAAS,EAAE,MAAM,CAAiC;IAEzE;;OAEG;IACH,gBAAuB,UAAU,cAAiB;IAElD;;OAEG;IACH,gBAAuB,UAAU,SAAyB;IAI1D;;;;;OAKG;IACH,gBAAuB,cAAc,GAAI,GAAG,aAAa,KAAG,WAAW,CAC5D;IAEX;;;;;;OAMG;IACH,gBAAuB,YAAY,GAAI,GAAG,WAAW,KAAG,aAAa,CAC9C;IAEvB;;;;;OAKG;IACH,gBAAuB,UAAU,GAAI,GAAG,aAAa,KAAG,WAAW,CACjC;IAElC;;;;;OAKG;IACH,gBAAuB,YAAY,GAAI,GAAG,WAAW,KAAG,aAAa,CACvB;IAE9C;;;;;;OAMG;IACH,gBAAuB,UAAU,GAAI,GAAG,WAAW,YAClB;IAEjC;;;;;;;OAOG;IACH,gBAAuB,eAAe,GACrC,gBAAgB,cAAc,EAC9B,QAAQ,OAAO,KACb,iBAAiB,CAA4B;IAEhD;;;;;;;OAOG;IACH,gBAAuB,iBAAiB,GACvC,gBAAgB,cAAc,EAC9B,kBAAkB,iBAAiB,KACjC,OAAO,CAAsC;IAEhD;;;;;;OAMG;IACH,gBAAuB,gBAAgB,GACtC,gBAAgB,cAAc,EAC9B,QAAQ,OAAO,KACb,WAAW,CAGX;IAEH;;;;;;;OAOG;IACH,gBAAuB,oBAAoB,GAC1C,gBAAgB,cAAc,EAC9B,kBAAkB,WAAW,KAC3B,OAAO,CAIP;CACH;AAID;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC;AACnC;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC;AACjC;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,aAAa,CAAC"}
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FixedUtils = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* The `FixedUtils` class provides utilities for fixed-point arithmetic
|
|
6
|
-
* with a standard 18-decimal precision, along with some convenience
|
|
7
|
-
* methods for normalizing/un-normalizing amounts based on token decimals.
|
|
8
|
-
*/
|
|
9
|
-
class FixedUtils {
|
|
10
|
-
}
|
|
11
|
-
exports.FixedUtils = FixedUtils;
|
|
12
|
-
/**
|
|
13
|
-
* Represents 1.0 in 18-decimal fixed math as a float: 1_000_000_000_000_000_000.
|
|
14
|
-
*/
|
|
15
|
-
FixedUtils.fixedOneN = 1000000000000000000;
|
|
16
|
-
/**
|
|
17
|
-
* Represents 1.0 in 18-decimal fixed math as a bigint: 1000000000000000000n.
|
|
18
|
-
*/
|
|
19
|
-
FixedUtils.fixedOneB = BigInt("1000000000000000000");
|
|
20
|
-
/**
|
|
21
|
-
* Represents 1.0 in 9-decimal fixed math as a float: 1_000_000_000.
|
|
22
|
-
*/
|
|
23
|
-
FixedUtils.fixedOneN9 = 1000000000;
|
|
24
|
-
/**
|
|
25
|
-
* Represents 1.0 in 9-decimal fixed math as a bigint: 1000000000n.
|
|
26
|
-
*/
|
|
27
|
-
FixedUtils.fixedOneB9 = BigInt(1000000000);
|
|
28
|
-
// These methods relate to direct cast/un-cast logic for on-chain usage:
|
|
29
|
-
/**
|
|
30
|
-
* Directly convert an on-chain `u64` (stored as a bigint) into a float, effectively no scaling.
|
|
31
|
-
*
|
|
32
|
-
* @param n - The on-chain number as a bigint.
|
|
33
|
-
* @returns The converted number as a float.
|
|
34
|
-
*/
|
|
35
|
-
FixedUtils.convertFromInt = (n) => Number(n);
|
|
36
|
-
/**
|
|
37
|
-
* Convert a floating number back to an on-chain integer (bigint),
|
|
38
|
-
* truncating decimals.
|
|
39
|
-
*
|
|
40
|
-
* @param n - The local float.
|
|
41
|
-
* @returns The truncated bigint.
|
|
42
|
-
*/
|
|
43
|
-
FixedUtils.convertToInt = (n) => BigInt(Math.floor(n));
|
|
44
|
-
/**
|
|
45
|
-
* Converts a fixed-18 on-chain number to a floating local number by dividing by `fixedOneN`.
|
|
46
|
-
*
|
|
47
|
-
* @param n - The on-chain 18-decimal fixed number (as a bigint).
|
|
48
|
-
* @returns A float representing the unscaled value.
|
|
49
|
-
*/
|
|
50
|
-
FixedUtils.directCast = (n) => Number(n) / FixedUtils.fixedOneN;
|
|
51
|
-
/**
|
|
52
|
-
* Converts a floating local number to an on-chain 18-decimal fixed bigint by multiplying by `fixedOneN`.
|
|
53
|
-
*
|
|
54
|
-
* @param n - The local float to be scaled.
|
|
55
|
-
* @returns The scaled 18-decimal fixed as a bigint.
|
|
56
|
-
*/
|
|
57
|
-
FixedUtils.directUncast = (n) => BigInt(Math.floor(n * FixedUtils.fixedOneN));
|
|
58
|
-
/**
|
|
59
|
-
* Returns the complement of the number in `[0,1]`, i.e., `1 - n`.
|
|
60
|
-
* If `n` is negative, it's treated as zero; if `n` > 1, also treated as zero for the complement.
|
|
61
|
-
*
|
|
62
|
-
* @param n - The local float in [0,1].
|
|
63
|
-
* @returns The complement of `n` in [0,1].
|
|
64
|
-
*/
|
|
65
|
-
FixedUtils.complement = (n) => Math.max(0, 1 - Math.max(0, n));
|
|
66
|
-
/**
|
|
67
|
-
* Multiplies a raw integer `amount` by a `decimalsScalar` to produce
|
|
68
|
-
* a "normalized" form. E.g., if decimals = 9, we store it as 10^9 scale.
|
|
69
|
-
*
|
|
70
|
-
* @param decimalsScalar - The scale factor for the coin (e.g., 1e9).
|
|
71
|
-
* @param amount - The raw integer (balance) to be scaled.
|
|
72
|
-
* @returns The scaled (normalized) amount as a `number`.
|
|
73
|
-
*/
|
|
74
|
-
FixedUtils.normalizeAmount = (decimalsScalar, amount) => amount * decimalsScalar;
|
|
75
|
-
/**
|
|
76
|
-
* Divides a normalized amount by the `decimalsScalar` to get back the
|
|
77
|
-
* raw on-chain integer. This is typically used after floating computations.
|
|
78
|
-
*
|
|
79
|
-
* @param decimalsScalar - The scale factor for the coin (e.g., 1e9).
|
|
80
|
-
* @param normalizedAmount - The scaled amount to reduce.
|
|
81
|
-
* @returns The raw integer balance.
|
|
82
|
-
*/
|
|
83
|
-
FixedUtils.unnormalizeAmount = (decimalsScalar, normalizedAmount) => normalizedAmount / decimalsScalar;
|
|
84
|
-
/**
|
|
85
|
-
* Directly cast a `Balance` to an 18-decimal float, factoring in token decimals.
|
|
86
|
-
*
|
|
87
|
-
* @param decimalsScalar - The token's decimal scale factor.
|
|
88
|
-
* @param amount - The raw integer `Balance`.
|
|
89
|
-
* @returns A float representing the 18-decimal scale cast.
|
|
90
|
-
*/
|
|
91
|
-
FixedUtils.castAndNormalize = (decimalsScalar, amount) => FixedUtils.directCast(FixedUtils.normalizeAmount(decimalsScalar, amount));
|
|
92
|
-
/**
|
|
93
|
-
* Reverse the cast of a normalized float back to a raw `Balance`,
|
|
94
|
-
* factoring in the token decimals.
|
|
95
|
-
*
|
|
96
|
-
* @param decimalsScalar - The token's decimal scale factor.
|
|
97
|
-
* @param normalizedAmount - A local float in 18-decimal domain.
|
|
98
|
-
* @returns A raw integer `Balance`.
|
|
99
|
-
*/
|
|
100
|
-
FixedUtils.uncastAndUnnormalize = (decimalsScalar, normalizedAmount) => FixedUtils.unnormalizeAmount(decimalsScalar, FixedUtils.directUncast(normalizedAmount));
|