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,289 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.Auth = void 0;
|
|
13
|
-
const caller_1 = require("../../general/utils/caller");
|
|
14
|
-
const utils_1 = require("../../general/utils");
|
|
15
|
-
/**
|
|
16
|
-
* The `Auth` class manages creation and refreshing of access tokens
|
|
17
|
-
* to obtain higher rate limits on the Aftermath API. It includes methods
|
|
18
|
-
* to initialize authorization either by a direct callback-based approach
|
|
19
|
-
* or by importing a local Sui keystore. Optionally, administrative functions
|
|
20
|
-
* are provided for creating specialized auth accounts.
|
|
21
|
-
*
|
|
22
|
-
* @example
|
|
23
|
-
* ```typescript
|
|
24
|
-
* const auth = new Auth();
|
|
25
|
-
* const stopAuth = await auth.init({
|
|
26
|
-
* walletAddress: "0x<address>",
|
|
27
|
-
* signMessageCallback: async ({ message }) => {
|
|
28
|
-
* // sign message
|
|
29
|
-
* },
|
|
30
|
-
* });
|
|
31
|
-
* // ... make authenticated requests ...
|
|
32
|
-
* stopAuth(); // stop auto refresh
|
|
33
|
-
* ```
|
|
34
|
-
*/
|
|
35
|
-
class Auth extends caller_1.Caller {
|
|
36
|
-
// =========================================================================
|
|
37
|
-
// Constructor
|
|
38
|
-
// =========================================================================
|
|
39
|
-
/**
|
|
40
|
-
* Creates a new `Auth` instance for token-based rate limit increases.
|
|
41
|
-
*
|
|
42
|
-
* @param config - Optional caller configuration, including network and access token.
|
|
43
|
-
*/
|
|
44
|
-
constructor(config) {
|
|
45
|
-
super(config, "auth");
|
|
46
|
-
// =========================================================================
|
|
47
|
-
// Private Class Members
|
|
48
|
-
// =========================================================================
|
|
49
|
-
/**
|
|
50
|
-
* Holds the timer reference for scheduled token refreshes.
|
|
51
|
-
*/
|
|
52
|
-
this.refreshTimer = null;
|
|
53
|
-
/**
|
|
54
|
-
* Indicates whether the user has canceled auto token refresh.
|
|
55
|
-
*/
|
|
56
|
-
this.isCanceled = false;
|
|
57
|
-
}
|
|
58
|
-
// =========================================================================
|
|
59
|
-
// User-Facing
|
|
60
|
-
// =========================================================================
|
|
61
|
-
/**
|
|
62
|
-
* Initializes the auth system by fetching an access token for the provided wallet address.
|
|
63
|
-
* After obtaining the token, it automatically schedules periodic refresh calls until stopped.
|
|
64
|
-
*
|
|
65
|
-
* @param inputs - An object containing the user's `walletAddress` and a `signMessageCallback` function
|
|
66
|
-
* for cryptographically signing messages.
|
|
67
|
-
*
|
|
68
|
-
* @returns A function that, when called, cancels further token refresh attempts.
|
|
69
|
-
*
|
|
70
|
-
* @example
|
|
71
|
-
* ```typescript
|
|
72
|
-
* const auth = new Auth();
|
|
73
|
-
* const stopAuth = await auth.init({
|
|
74
|
-
* walletAddress: "0x<address>",
|
|
75
|
-
* signMessageCallback: async ({ message }) => {
|
|
76
|
-
* // sign the message with your private key / keypair
|
|
77
|
-
* },
|
|
78
|
-
* });
|
|
79
|
-
*
|
|
80
|
-
* // ... make authorized calls ...
|
|
81
|
-
*
|
|
82
|
-
* stopAuth(); // Cancel further token refreshes
|
|
83
|
-
* ```
|
|
84
|
-
*/
|
|
85
|
-
init(inputs) {
|
|
86
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
87
|
-
this.isCanceled = false; // Mark as active
|
|
88
|
-
const startRefresh = () => __awaiter(this, void 0, void 0, function* () {
|
|
89
|
-
if (this.isCanceled)
|
|
90
|
-
return; // No-op if canceled
|
|
91
|
-
const { accessToken, expirationTimestamp } = yield this.getAccessToken(inputs);
|
|
92
|
-
this.setAccessToken(accessToken);
|
|
93
|
-
if (this.isCanceled)
|
|
94
|
-
return; // Double-check after token fetch
|
|
95
|
-
// Provide a margin by refreshing before actual expiration
|
|
96
|
-
const TIMEOUT_REDUCTION_RATIO = 0.9;
|
|
97
|
-
const interval = (expirationTimestamp - Date.now()) * TIMEOUT_REDUCTION_RATIO;
|
|
98
|
-
// Schedule next refresh
|
|
99
|
-
this.refreshTimer = setTimeout(startRefresh, interval);
|
|
100
|
-
});
|
|
101
|
-
// Kick off first refresh
|
|
102
|
-
yield startRefresh();
|
|
103
|
-
// Return cancellation function
|
|
104
|
-
return () => {
|
|
105
|
-
this.isCanceled = true;
|
|
106
|
-
if (this.refreshTimer) {
|
|
107
|
-
clearTimeout(this.refreshTimer);
|
|
108
|
-
}
|
|
109
|
-
};
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* Initializes the auth system by reading a local Sui keystore file (on the server side),
|
|
114
|
-
* using the private keys matching a provided address to sign messages for token creation.
|
|
115
|
-
* After the token is obtained, it automatically schedules periodic refresh calls until stopped.
|
|
116
|
-
*
|
|
117
|
-
* @param inputs - An object containing the target `walletAddress` and an optional path to the `.keystore`.
|
|
118
|
-
* If `path` is not provided, it defaults to `~/.sui/sui_config/sui.keystore`.
|
|
119
|
-
* @returns A function that, when called, cancels further token refresh attempts.
|
|
120
|
-
*
|
|
121
|
-
* @throws If this method is called in a browser environment (client-side).
|
|
122
|
-
*
|
|
123
|
-
* @example
|
|
124
|
-
* ```typescript
|
|
125
|
-
* // On server:
|
|
126
|
-
* const stopAuth = await auth.initFromSuiKeystore({
|
|
127
|
-
* walletAddress: "0x<address>",
|
|
128
|
-
* path: "/custom/path/to/keystore.json",
|
|
129
|
-
* });
|
|
130
|
-
* // authorized calls...
|
|
131
|
-
* stopAuth();
|
|
132
|
-
* ```
|
|
133
|
-
*/
|
|
134
|
-
// public async initFromSuiKeystore(inputs: {
|
|
135
|
-
// walletAddress: SuiAddress;
|
|
136
|
-
// path?: string;
|
|
137
|
-
// }): Promise<() => void> {
|
|
138
|
-
// const { walletAddress, path: pathStr } = inputs;
|
|
139
|
-
// if (typeof window === "undefined") {
|
|
140
|
-
// // Node environment, proceed with reading a keystore
|
|
141
|
-
// const fs = require("fs");
|
|
142
|
-
// const path = require("path");
|
|
143
|
-
// const os = require("os");
|
|
144
|
-
// const keystorePath = pathStr
|
|
145
|
-
// ? path.join(pathStr)
|
|
146
|
-
// : (() => {
|
|
147
|
-
// // Default to ~/.sui/sui_config/sui.keystore
|
|
148
|
-
// const homeDir = os.homedir();
|
|
149
|
-
// if (!homeDir) {
|
|
150
|
-
// throw new Error(
|
|
151
|
-
// "cannot obtain home directory path"
|
|
152
|
-
// );
|
|
153
|
-
// }
|
|
154
|
-
// return path.join(
|
|
155
|
-
// homeDir,
|
|
156
|
-
// ".sui",
|
|
157
|
-
// "sui_config",
|
|
158
|
-
// "sui.keystore"
|
|
159
|
-
// );
|
|
160
|
-
// })();
|
|
161
|
-
// // Read JSON with an array of private keys
|
|
162
|
-
// let privateKeys: string[];
|
|
163
|
-
// try {
|
|
164
|
-
// const fileContent = fs.readFileSync(keystorePath, "utf-8");
|
|
165
|
-
// privateKeys = JSON.parse(fileContent);
|
|
166
|
-
// if (!Array.isArray(privateKeys)) {
|
|
167
|
-
// throw new Error(
|
|
168
|
-
// "Invalid keystore format: Expected an array of private keys"
|
|
169
|
-
// );
|
|
170
|
-
// }
|
|
171
|
-
// } catch (error) {
|
|
172
|
-
// throw new Error(`Failed to read keystore file: ${error}`);
|
|
173
|
-
// }
|
|
174
|
-
// if (privateKeys.length <= 0) {
|
|
175
|
-
// throw new Error(`Empty keystore file`);
|
|
176
|
-
// }
|
|
177
|
-
// // Find the matching key for the requested walletAddress
|
|
178
|
-
// const foundKeypair = privateKeys
|
|
179
|
-
// .map((privateKey) => Helpers.keypairFromPrivateKey(privateKey))
|
|
180
|
-
// .find(
|
|
181
|
-
// (keypair) =>
|
|
182
|
-
// Helpers.addLeadingZeroesToType(
|
|
183
|
-
// keypair.toSuiAddress()
|
|
184
|
-
// ) === Helpers.addLeadingZeroesToType(walletAddress)
|
|
185
|
-
// );
|
|
186
|
-
// if (!foundKeypair) {
|
|
187
|
-
// throw new Error(
|
|
188
|
-
// `No private key found in keystore file for ${walletAddress}`
|
|
189
|
-
// );
|
|
190
|
-
// }
|
|
191
|
-
// // Initialize with sign callback
|
|
192
|
-
// return this.init({
|
|
193
|
-
// walletAddress,
|
|
194
|
-
// signMessageCallback: async ({ message }) =>
|
|
195
|
-
// foundKeypair.signPersonalMessage(message),
|
|
196
|
-
// });
|
|
197
|
-
// }
|
|
198
|
-
// throw new Error("`initFromSuiKeystore` must be called on server-side");
|
|
199
|
-
// }
|
|
200
|
-
// =========================================================================
|
|
201
|
-
// Admin
|
|
202
|
-
// =========================================================================
|
|
203
|
-
/**
|
|
204
|
-
* **Admin-only**: Creates a new auth account with specific rate limits for a given
|
|
205
|
-
* `accountWalletAddress`. The `walletAddress` performing this action must have
|
|
206
|
-
* admin privileges, or the call will fail. Use this to create custom sub-accounts
|
|
207
|
-
* with limited scope or usage rates.
|
|
208
|
-
*
|
|
209
|
-
* @param inputs - Contains:
|
|
210
|
-
* - `walletAddress`: The admin's wallet address
|
|
211
|
-
* - `signMessageCallback`: The admin's signing callback
|
|
212
|
-
* - `accountName`: A short name or identifier for the account
|
|
213
|
-
* - `accountWalletAddress`: The Sui address representing this sub-account
|
|
214
|
-
* - `rateLimits`: An array specifying the rate limits (method-based) for the sub-account
|
|
215
|
-
* @returns A promise resolving to `true` if successful, otherwise throws or returns `false`.
|
|
216
|
-
*/
|
|
217
|
-
adminCreateAuthAccount(inputs) {
|
|
218
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
219
|
-
const { walletAddress, signMessageCallback, accountName, accountWalletAddress, rateLimits, } = inputs;
|
|
220
|
-
// Prepare the data to sign
|
|
221
|
-
const serializedJson = Auth.createSerializedJson("AccountCreate", {
|
|
222
|
-
sub: accountName,
|
|
223
|
-
wallet_address: utils_1.Helpers.addLeadingZeroesToType(accountWalletAddress),
|
|
224
|
-
rate_limits: rateLimits,
|
|
225
|
-
});
|
|
226
|
-
const message = new TextEncoder().encode(serializedJson);
|
|
227
|
-
const { signature } = yield signMessageCallback({ message });
|
|
228
|
-
return this.fetchApi("create-account", {
|
|
229
|
-
signature,
|
|
230
|
-
serializedJson,
|
|
231
|
-
walletAddress: utils_1.Helpers.addLeadingZeroesToType(walletAddress),
|
|
232
|
-
});
|
|
233
|
-
});
|
|
234
|
-
}
|
|
235
|
-
// =========================================================================
|
|
236
|
-
// Private
|
|
237
|
-
// =========================================================================
|
|
238
|
-
/**
|
|
239
|
-
* Requests a new access token from the API by sending a signed message
|
|
240
|
-
* indicating the user wants a token.
|
|
241
|
-
*
|
|
242
|
-
* @param inputs - Contains the user's `walletAddress` and `signMessageCallback`.
|
|
243
|
-
* @returns A response object that includes the `accessToken` and an `expirationTimestamp`.
|
|
244
|
-
*/
|
|
245
|
-
getAccessToken(inputs) {
|
|
246
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
247
|
-
const { walletAddress, signMessageCallback } = inputs;
|
|
248
|
-
// Prepare signable data
|
|
249
|
-
const serializedJson = Auth.createSerializedJson("GetAccessToken", {});
|
|
250
|
-
const message = new TextEncoder().encode(serializedJson);
|
|
251
|
-
const { signature } = yield signMessageCallback({ message });
|
|
252
|
-
return this.fetchApi("access-token", {
|
|
253
|
-
signature,
|
|
254
|
-
serializedJson,
|
|
255
|
-
walletAddress: utils_1.Helpers.addLeadingZeroesToType(walletAddress),
|
|
256
|
-
});
|
|
257
|
-
});
|
|
258
|
-
}
|
|
259
|
-
// =========================================================================
|
|
260
|
-
// Private Static
|
|
261
|
-
// =========================================================================
|
|
262
|
-
/**
|
|
263
|
-
* Creates a JSON string with a standard format:
|
|
264
|
-
* ```json
|
|
265
|
-
* {
|
|
266
|
-
* "date": <epoch-seconds>,
|
|
267
|
-
* "nonce": <random_number>,
|
|
268
|
-
* "method": <method_string>,
|
|
269
|
-
* "value": <passed_value>
|
|
270
|
-
* }
|
|
271
|
-
* ```
|
|
272
|
-
*
|
|
273
|
-
* @param method - A short method name describing the action ("GetAccessToken", "AccountCreate", etc.).
|
|
274
|
-
* @param value - The data object to embed under the `value` field.
|
|
275
|
-
* @returns A JSON-serialized string for signing.
|
|
276
|
-
*/
|
|
277
|
-
static createSerializedJson(method, value) {
|
|
278
|
-
const timestampSeconds = Math.floor(Date.now() / 1000);
|
|
279
|
-
const random = Math.floor(Math.random() * 1024 * 1024);
|
|
280
|
-
const data = {
|
|
281
|
-
date: timestampSeconds,
|
|
282
|
-
nonce: random,
|
|
283
|
-
method,
|
|
284
|
-
value,
|
|
285
|
-
};
|
|
286
|
-
return JSON.stringify(data);
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
exports.Auth = Auth;
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import { SuiAddress, Timestamp } from "../../types";
|
|
2
|
-
/**
|
|
3
|
-
* Interface specifying allowable rate limits for an auth account.
|
|
4
|
-
* The `p` field indicates the path or endpoint (e.g., "/pools"),
|
|
5
|
-
* while `m` indicates the method-based limits (GET or POST, or both).
|
|
6
|
-
*/
|
|
7
|
-
export interface RateLimit {
|
|
8
|
-
/**
|
|
9
|
-
* The path or endpoint to be rate-limited, e.g. "/pools" or "/router/trade".
|
|
10
|
-
*/
|
|
11
|
-
p: string;
|
|
12
|
-
/**
|
|
13
|
-
* The method-based limit specification.
|
|
14
|
-
* For example:
|
|
15
|
-
* ```
|
|
16
|
-
* { GET: { l: 100 } }
|
|
17
|
-
* { POST: { l: 50 } }
|
|
18
|
-
* { GET: { l: 100 }, POST: { l: 100 } }
|
|
19
|
-
* ```
|
|
20
|
-
*/
|
|
21
|
-
m: {
|
|
22
|
-
GET: {
|
|
23
|
-
l: number;
|
|
24
|
-
};
|
|
25
|
-
} | {
|
|
26
|
-
POST: {
|
|
27
|
-
l: number;
|
|
28
|
-
};
|
|
29
|
-
} | {
|
|
30
|
-
GET: {
|
|
31
|
-
l: number;
|
|
32
|
-
};
|
|
33
|
-
POST: {
|
|
34
|
-
l: number;
|
|
35
|
-
};
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* The request body for creating a new auth account, typically
|
|
40
|
-
* reserved for admin usage. The admin signs a JSON containing
|
|
41
|
-
* an "AccountCreate" `method` plus desired sub-account data.
|
|
42
|
-
*/
|
|
43
|
-
export interface ApiCreateAuthAccountBody {
|
|
44
|
-
/**
|
|
45
|
-
* The admin's Sui address, zero-padded if necessary.
|
|
46
|
-
*/
|
|
47
|
-
walletAddress: SuiAddress;
|
|
48
|
-
/**
|
|
49
|
-
* The signature of the serialized JSON data, from the admin's private key.
|
|
50
|
-
*/
|
|
51
|
-
signature: string;
|
|
52
|
-
/**
|
|
53
|
-
* The JSON string that was signed, containing the method and sub-account details.
|
|
54
|
-
*/
|
|
55
|
-
serializedJson: string;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* The request body for obtaining or refreshing an access token. The user signs
|
|
59
|
-
* a "GetAccessToken" method message plus any relevant fields.
|
|
60
|
-
*/
|
|
61
|
-
export interface ApiGetAccessTokenBody {
|
|
62
|
-
/**
|
|
63
|
-
* The user's Sui address, zero-padded if needed.
|
|
64
|
-
*/
|
|
65
|
-
walletAddress: SuiAddress;
|
|
66
|
-
/**
|
|
67
|
-
* The signature over the JSON-serialized request data (nonce, date, etc.).
|
|
68
|
-
*/
|
|
69
|
-
signature: string;
|
|
70
|
-
/**
|
|
71
|
-
* The actual JSON string that was signed, e.g.:
|
|
72
|
-
* ```
|
|
73
|
-
* {
|
|
74
|
-
* "date": 1234567890,
|
|
75
|
-
* "nonce": 512,
|
|
76
|
-
* "method": "GetAccessToken",
|
|
77
|
-
* "value": {}
|
|
78
|
-
* }
|
|
79
|
-
* ```
|
|
80
|
-
*/
|
|
81
|
-
serializedJson: string;
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* The response returned when a user obtains or refreshes an access token,
|
|
85
|
-
* containing the token string, the HTTP header name (usually "Authorization"),
|
|
86
|
-
* and the token's expiration timestamp in milliseconds.
|
|
87
|
-
*/
|
|
88
|
-
export interface ApiGetAccessTokenResponse {
|
|
89
|
-
/**
|
|
90
|
-
* The newly issued access token to be used in `Authorization` headers.
|
|
91
|
-
*/
|
|
92
|
-
accessToken: string;
|
|
93
|
-
/**
|
|
94
|
-
* The header key that should contain `accessToken` (e.g., "Authorization").
|
|
95
|
-
*/
|
|
96
|
-
header: string;
|
|
97
|
-
/**
|
|
98
|
-
* The UNIX timestamp (milliseconds) after which the token is invalid.
|
|
99
|
-
*/
|
|
100
|
-
expirationTimestamp: Timestamp;
|
|
101
|
-
}
|
|
102
|
-
//# sourceMappingURL=authTypes.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"authTypes.d.ts","sourceRoot":"","sources":["../../../src/packages/auth/authTypes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAEpD;;;;GAIG;AACH,MAAM,WAAW,SAAS;IACzB;;OAEG;IACH,CAAC,EAAE,MAAM,CAAC;IACV;;;;;;;;OAQG;IACH,CAAC,EACE;QAAE,GAAG,EAAE;YAAE,CAAC,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,GACtB;QAAE,IAAI,EAAE;YAAE,CAAC,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,GACvB;QAAE,GAAG,EAAE;YAAE,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC;QAAC,IAAI,EAAE;YAAE,CAAC,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,CAAC;CAC/C;AAMD;;;;GAIG;AACH,MAAM,WAAW,wBAAwB;IACxC;;OAEG;IACH,aAAa,EAAE,UAAU,CAAC;IAC1B;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;CACvB;AAED;;;GAGG;AACH,MAAM,WAAW,qBAAqB;IACrC;;OAEG;IACH,aAAa,EAAE,UAAU,CAAC;IAC1B;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;;;;;;;;;OAUG;IACH,cAAc,EAAE,MAAM,CAAC;CACvB;AAMD;;;;GAIG;AACH,MAAM,WAAW,yBAAyB;IACzC;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,mBAAmB,EAAE,SAAS,CAAC;CAC/B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/packages/auth/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,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("./auth"), exports);
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { Transaction, TransactionObjectArgument } from "@mysten/sui/transactions";
|
|
2
|
-
import { AftermathApi } from "../../../general/providers/aftermathApi";
|
|
3
|
-
import { Balance, CoinType, SuiAddress } from "../../../types";
|
|
4
|
-
import { CoinStruct } from "@mysten/sui/client";
|
|
5
|
-
export declare class CoinApi {
|
|
6
|
-
private readonly Provider;
|
|
7
|
-
constructor(Provider: AftermathApi);
|
|
8
|
-
fetchCoinWithAmountTx: (inputs: {
|
|
9
|
-
tx: Transaction;
|
|
10
|
-
walletAddress: SuiAddress;
|
|
11
|
-
coinType: CoinType;
|
|
12
|
-
coinAmount: Balance;
|
|
13
|
-
isSponsoredTx?: boolean;
|
|
14
|
-
}) => Promise<TransactionObjectArgument>;
|
|
15
|
-
fetchCoinsWithAmountTx: (inputs: {
|
|
16
|
-
tx: Transaction;
|
|
17
|
-
walletAddress: SuiAddress;
|
|
18
|
-
coinTypes: CoinType[];
|
|
19
|
-
coinAmounts: Balance[];
|
|
20
|
-
isSponsoredTx?: boolean;
|
|
21
|
-
}) => Promise<TransactionObjectArgument[]>;
|
|
22
|
-
fetchCoinsWithAtLeastAmount: (inputs: {
|
|
23
|
-
walletAddress: SuiAddress;
|
|
24
|
-
coinType: CoinType;
|
|
25
|
-
coinAmount: Balance;
|
|
26
|
-
}) => Promise<CoinStruct[]>;
|
|
27
|
-
fetchAllCoins: (inputs: {
|
|
28
|
-
walletAddress: SuiAddress;
|
|
29
|
-
coinType: CoinType;
|
|
30
|
-
}) => Promise<CoinStruct[]>;
|
|
31
|
-
private static coinWithAmountTx;
|
|
32
|
-
}
|
|
33
|
-
//# sourceMappingURL=coinApi.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"coinApi.d.ts","sourceRoot":"","sources":["../../../../src/packages/coin/api/coinApi.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,WAAW,EACX,yBAAyB,EACzB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AACvE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAY,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEzE,OAAO,EAAE,UAAU,EAAkB,MAAM,oBAAoB,CAAC;AAIhE,qBAAa,OAAO;IAKP,OAAO,CAAC,QAAQ,CAAC,QAAQ;gBAAR,QAAQ,EAAE,YAAY;IAM5C,qBAAqB,GAAU,QAAQ;QAC7C,EAAE,EAAE,WAAW,CAAC;QAChB,aAAa,EAAE,UAAU,CAAC;QAC1B,QAAQ,EAAE,QAAQ,CAAC;QACnB,UAAU,EAAE,OAAO,CAAC;QACpB,aAAa,CAAC,EAAE,OAAO,CAAC;KACxB,KAAG,OAAO,CAAC,yBAAyB,CAAC,CAcpC;IAEK,sBAAsB,GAAU,QAAQ;QAC9C,EAAE,EAAE,WAAW,CAAC;QAChB,aAAa,EAAE,UAAU,CAAC;QAC1B,SAAS,EAAE,QAAQ,EAAE,CAAC;QACtB,WAAW,EAAE,OAAO,EAAE,CAAC;QACvB,aAAa,CAAC,EAAE,OAAO,CAAC;KACxB,KAAG,OAAO,CAAC,yBAAyB,EAAE,CAAC,CA8BtC;IAEK,2BAA2B,GAAU,QAAQ;QACnD,aAAa,EAAE,UAAU,CAAC;QAC1B,QAAQ,EAAE,QAAQ,CAAC;QACnB,UAAU,EAAE,OAAO,CAAC;KACpB,KAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CAsCvB;IAGK,aAAa,GAAU,QAAQ;QACrC,aAAa,EAAE,UAAU,CAAC;QAC1B,QAAQ,EAAE,QAAQ,CAAC;KAEnB,KAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CAiCvB;IAMF,OAAO,CAAC,MAAM,CAAC,gBAAgB,CA+E7B;CACF"}
|
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.CoinApi = void 0;
|
|
13
|
-
const coin_1 = require("../coin");
|
|
14
|
-
const helpers_1 = require("../../../general/utils/helpers");
|
|
15
|
-
const transactionsApiHelpers_1 = require("../../../general/apiHelpers/transactionsApiHelpers");
|
|
16
|
-
// import { ethers, Networkish } from "ethers";
|
|
17
|
-
class CoinApi {
|
|
18
|
-
// =========================================================================
|
|
19
|
-
// Constructor
|
|
20
|
-
// =========================================================================
|
|
21
|
-
constructor(Provider) {
|
|
22
|
-
this.Provider = Provider;
|
|
23
|
-
// =========================================================================
|
|
24
|
-
// Transaction Builders
|
|
25
|
-
// =========================================================================
|
|
26
|
-
this.fetchCoinWithAmountTx = (inputs) => __awaiter(this, void 0, void 0, function* () {
|
|
27
|
-
const { tx, walletAddress, coinType, coinAmount, isSponsoredTx } = inputs;
|
|
28
|
-
tx.setSender(walletAddress);
|
|
29
|
-
const coinData = yield this.fetchCoinsWithAtLeastAmount(inputs);
|
|
30
|
-
return CoinApi.coinWithAmountTx({
|
|
31
|
-
tx,
|
|
32
|
-
coinData,
|
|
33
|
-
coinAmount,
|
|
34
|
-
coinType,
|
|
35
|
-
isSponsoredTx,
|
|
36
|
-
});
|
|
37
|
-
});
|
|
38
|
-
this.fetchCoinsWithAmountTx = (inputs) => __awaiter(this, void 0, void 0, function* () {
|
|
39
|
-
const { tx, walletAddress, coinTypes, coinAmounts, isSponsoredTx } = inputs;
|
|
40
|
-
tx.setSender(walletAddress);
|
|
41
|
-
const allCoinsData = yield Promise.all(coinTypes.map((coinType, index) => __awaiter(this, void 0, void 0, function* () {
|
|
42
|
-
return this.fetchCoinsWithAtLeastAmount(Object.assign(Object.assign({}, inputs), { coinAmount: coinAmounts[index], coinType }));
|
|
43
|
-
})));
|
|
44
|
-
let coinArgs = [];
|
|
45
|
-
for (const [index, coinData] of allCoinsData.entries()) {
|
|
46
|
-
const coinArg = CoinApi.coinWithAmountTx({
|
|
47
|
-
tx,
|
|
48
|
-
coinData,
|
|
49
|
-
coinAmount: coinAmounts[index],
|
|
50
|
-
coinType: coinTypes[index],
|
|
51
|
-
isSponsoredTx,
|
|
52
|
-
});
|
|
53
|
-
coinArgs = [...coinArgs, coinArg];
|
|
54
|
-
}
|
|
55
|
-
return coinArgs;
|
|
56
|
-
});
|
|
57
|
-
this.fetchCoinsWithAtLeastAmount = (inputs) => __awaiter(this, void 0, void 0, function* () {
|
|
58
|
-
let allCoinData = [];
|
|
59
|
-
let cursor = undefined;
|
|
60
|
-
do {
|
|
61
|
-
const paginatedCoins = yield this.Provider.provider.getCoins(Object.assign(Object.assign({}, inputs), { owner: inputs.walletAddress, cursor }));
|
|
62
|
-
const coinData = paginatedCoins.data;
|
|
63
|
-
allCoinData = [...allCoinData, ...coinData];
|
|
64
|
-
if (paginatedCoins.data.length === 0 ||
|
|
65
|
-
!paginatedCoins.hasNextPage ||
|
|
66
|
-
!paginatedCoins.nextCursor) {
|
|
67
|
-
allCoinData.sort((b, a) => Number(BigInt(a.balance) - BigInt(b.balance)));
|
|
68
|
-
let coinDatas = [];
|
|
69
|
-
let sum = BigInt(0);
|
|
70
|
-
for (const coinData of allCoinData) {
|
|
71
|
-
coinDatas.push(coinData);
|
|
72
|
-
sum += BigInt(coinData.balance);
|
|
73
|
-
if (sum >= inputs.coinAmount)
|
|
74
|
-
return coinDatas;
|
|
75
|
-
}
|
|
76
|
-
throw new Error("wallet does not have coins of sufficient balance");
|
|
77
|
-
}
|
|
78
|
-
cursor = paginatedCoins.nextCursor;
|
|
79
|
-
} while (true);
|
|
80
|
-
});
|
|
81
|
-
// fetchCoinsUntilAmountReachedOrEnd
|
|
82
|
-
this.fetchAllCoins = (inputs) => __awaiter(this, void 0, void 0, function* () {
|
|
83
|
-
let allCoinData = [];
|
|
84
|
-
let cursor = undefined;
|
|
85
|
-
do {
|
|
86
|
-
const paginatedCoins = yield this.Provider.provider.getCoins(Object.assign(Object.assign({}, inputs), { owner: inputs.walletAddress, cursor }));
|
|
87
|
-
// const coinData = paginatedCoins.data.filter(
|
|
88
|
-
// (data) => BigInt(data.balance) > BigInt(0)
|
|
89
|
-
// );
|
|
90
|
-
const coinData = paginatedCoins.data;
|
|
91
|
-
allCoinData = [...allCoinData, ...coinData];
|
|
92
|
-
// const totalAmount = Helpers.sumBigInt(
|
|
93
|
-
// allCoinData.map((data) => BigInt(data.balance))
|
|
94
|
-
// );
|
|
95
|
-
// if (totalAmount >= inputs.coinAmount) return allCoinData;
|
|
96
|
-
if (paginatedCoins.data.length === 0 ||
|
|
97
|
-
!paginatedCoins.hasNextPage ||
|
|
98
|
-
!paginatedCoins.nextCursor)
|
|
99
|
-
return allCoinData.sort((b, a) => Number(BigInt(b.coinObjectId) - BigInt(a.coinObjectId)));
|
|
100
|
-
cursor = paginatedCoins.nextCursor;
|
|
101
|
-
} while (true);
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
exports.CoinApi = CoinApi;
|
|
106
|
-
// =========================================================================
|
|
107
|
-
// Private Static Methods
|
|
108
|
-
// =========================================================================
|
|
109
|
-
CoinApi.coinWithAmountTx = (inputs) => {
|
|
110
|
-
const { tx, coinData, coinAmount, coinType, isSponsoredTx } = inputs;
|
|
111
|
-
if (coinData.length <= 0)
|
|
112
|
-
throw new Error("wallet does not have coins of sufficient balance");
|
|
113
|
-
const isSuiCoin = coin_1.Coin.isSuiCoin(coinData[0].coinType);
|
|
114
|
-
const totalCoinBalance = helpers_1.Helpers.sumBigInt(coinData.map((data) => BigInt(data.balance)));
|
|
115
|
-
if (totalCoinBalance < coinAmount)
|
|
116
|
-
throw new Error("wallet does not have coins of sufficient balance");
|
|
117
|
-
if (!isSponsoredTx && isSuiCoin) {
|
|
118
|
-
tx.setGasPayment(coinData.map((obj) => {
|
|
119
|
-
return Object.assign(Object.assign({}, obj), { objectId: obj.coinObjectId });
|
|
120
|
-
}));
|
|
121
|
-
return tx.splitCoins(tx.gas, [coinAmount]);
|
|
122
|
-
// return Helpers.transactions.splitCoinsTx({
|
|
123
|
-
// tx,
|
|
124
|
-
// coinId: tx.gas,
|
|
125
|
-
// amounts: [coinAmount],
|
|
126
|
-
// coinType,
|
|
127
|
-
// });
|
|
128
|
-
}
|
|
129
|
-
const coinObjectIds = coinData.map((data) => data.coinObjectId);
|
|
130
|
-
const mergedCoinObjectId = coinObjectIds[0];
|
|
131
|
-
if (coinObjectIds.length > 1) {
|
|
132
|
-
// TODO: fix this (v1)
|
|
133
|
-
if (isSponsoredTx) {
|
|
134
|
-
tx.add({
|
|
135
|
-
$kind: "MergeCoins",
|
|
136
|
-
MergeCoins: {
|
|
137
|
-
destination: tx.object(mergedCoinObjectId),
|
|
138
|
-
sources: [
|
|
139
|
-
...coinObjectIds
|
|
140
|
-
.slice(1)
|
|
141
|
-
.map((coinId) => tx.object(coinId)),
|
|
142
|
-
],
|
|
143
|
-
},
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
else {
|
|
147
|
-
tx.mergeCoins(tx.object(mergedCoinObjectId), [
|
|
148
|
-
...coinObjectIds
|
|
149
|
-
.slice(1)
|
|
150
|
-
.map((coinId) => tx.object(coinId)),
|
|
151
|
-
]);
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
// return tx.add({
|
|
155
|
-
// kind: "SplitCoins",
|
|
156
|
-
// coin: tx.object(mergedCoinObjectId),
|
|
157
|
-
// amounts: [tx.pure(coinAmount)],
|
|
158
|
-
// });
|
|
159
|
-
return isSponsoredTx
|
|
160
|
-
? transactionsApiHelpers_1.TransactionsApiHelpers.splitCoinTx({
|
|
161
|
-
tx,
|
|
162
|
-
coinId: mergedCoinObjectId,
|
|
163
|
-
amount: coinAmount,
|
|
164
|
-
coinType,
|
|
165
|
-
})
|
|
166
|
-
: tx.splitCoins(mergedCoinObjectId, [coinAmount]);
|
|
167
|
-
};
|