@7kprotocol/sdk-ts 3.6.0 → 3.6.1-beta.1
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/README.md +1 -11
- package/lib/cjs/config/fetchClient.js +1 -9
- package/lib/cjs/constants/_7k.js +13 -10
- package/lib/cjs/constants/apiEndpoints.js +1 -1
- package/lib/cjs/features/metaAg/common.js +2 -2
- package/lib/cjs/features/metaAg/error.js +0 -4
- package/lib/cjs/features/metaAg/index.js +3 -8
- package/lib/cjs/features/prices/index.js +51 -20
- package/lib/cjs/index.js +1 -35
- package/lib/cjs/types/config/fetchClient.d.ts.map +1 -1
- package/lib/cjs/types/constants/_7k.d.ts +0 -3
- package/lib/cjs/types/constants/_7k.d.ts.map +1 -1
- package/lib/cjs/types/features/metaAg/common.d.ts +1 -1
- package/lib/cjs/types/features/metaAg/error.d.ts +1 -7
- package/lib/cjs/types/features/metaAg/error.d.ts.map +1 -1
- package/lib/cjs/types/features/metaAg/index.d.ts +1 -1
- package/lib/cjs/types/features/metaAg/index.d.ts.map +1 -1
- package/lib/cjs/types/features/prices/index.d.ts +16 -2
- package/lib/cjs/types/features/prices/index.d.ts.map +1 -1
- package/lib/cjs/types/index.d.ts +1 -32
- package/lib/cjs/types/index.d.ts.map +1 -1
- package/lib/cjs/types/metaAg.js +1 -3
- package/lib/cjs/types/types/metaAg.d.ts +2 -14
- package/lib/cjs/types/types/metaAg.d.ts.map +1 -1
- package/lib/cjs/types/utils/sui.d.ts +0 -31
- package/lib/cjs/types/utils/sui.d.ts.map +1 -1
- package/lib/cjs/types/utils/swap.d.ts +15 -0
- package/lib/cjs/types/utils/swap.d.ts.map +1 -0
- package/lib/cjs/utils/sui.js +15 -154
- package/lib/cjs/utils/swap.js +37 -0
- package/lib/esm/config/fetchClient.js +1 -9
- package/lib/esm/constants/_7k.js +12 -9
- package/lib/esm/constants/apiEndpoints.js +1 -1
- package/lib/esm/features/metaAg/common.js +1 -1
- package/lib/esm/features/metaAg/error.js +0 -4
- package/lib/esm/features/metaAg/index.js +2 -7
- package/lib/esm/features/prices/index.js +52 -21
- package/lib/esm/index.mjs +3 -31
- package/lib/esm/types/config/fetchClient.d.ts.map +1 -1
- package/lib/esm/types/constants/_7k.d.ts +0 -3
- package/lib/esm/types/constants/_7k.d.ts.map +1 -1
- package/lib/esm/types/features/metaAg/common.d.ts +1 -1
- package/lib/esm/types/features/metaAg/error.d.ts +1 -7
- package/lib/esm/types/features/metaAg/error.d.ts.map +1 -1
- package/lib/esm/types/features/metaAg/index.d.ts +1 -1
- package/lib/esm/types/features/metaAg/index.d.ts.map +1 -1
- package/lib/esm/types/features/prices/index.d.ts +16 -2
- package/lib/esm/types/features/prices/index.d.ts.map +1 -1
- package/lib/esm/types/index.d.ts +1 -32
- package/lib/esm/types/index.d.ts.map +1 -1
- package/lib/esm/types/metaAg.js +1 -3
- package/lib/esm/types/types/metaAg.d.ts +2 -14
- package/lib/esm/types/types/metaAg.d.ts.map +1 -1
- package/lib/esm/types/utils/sui.d.ts +0 -31
- package/lib/esm/types/utils/sui.d.ts.map +1 -1
- package/lib/esm/types/utils/swap.d.ts +15 -0
- package/lib/esm/types/utils/swap.d.ts.map +1 -0
- package/lib/esm/utils/sui.js +17 -156
- package/lib/esm/utils/swap.js +33 -0
- package/package.json +1 -1
- package/lib/cjs/config/index.js +0 -67
- package/lib/cjs/features/metaAg/providers/bluefin7kLegacy.js +0 -68
- package/lib/cjs/features/swap/buildTx.js +0 -198
- package/lib/cjs/features/swap/buildTxV2.js +0 -229
- package/lib/cjs/features/swap/config.js +0 -154
- package/lib/cjs/features/swap/estimateGasFee.js +0 -44
- package/lib/cjs/features/swap/executeTx.js +0 -52
- package/lib/cjs/features/swap/getQuote.js +0 -95
- package/lib/cjs/features/swap/getSwapHistory.js +0 -21
- package/lib/cjs/features/swap/index.js +0 -22
- package/lib/cjs/libs/groupSwapRoutes.js +0 -60
- package/lib/cjs/libs/protocols/aftermath/index.js +0 -35
- package/lib/cjs/libs/protocols/base.js +0 -41
- package/lib/cjs/libs/protocols/bluefin/index.js +0 -38
- package/lib/cjs/libs/protocols/bluefinx/client.js +0 -41
- package/lib/cjs/libs/protocols/bluefinx/index.js +0 -48
- package/lib/cjs/libs/protocols/bluefinx/types.js +0 -10
- package/lib/cjs/libs/protocols/bluemove/index.js +0 -24
- package/lib/cjs/libs/protocols/cetus/index.js +0 -44
- package/lib/cjs/libs/protocols/cetus_dlmm.js +0 -48
- package/lib/cjs/libs/protocols/constants.js +0 -5
- package/lib/cjs/libs/protocols/deepbookV3/sponsored.js +0 -30
- package/lib/cjs/libs/protocols/ferra_clmm.js +0 -44
- package/lib/cjs/libs/protocols/ferra_dlmm.js +0 -30
- package/lib/cjs/libs/protocols/flowx/index.js +0 -18
- package/lib/cjs/libs/protocols/flowxV3/index.js +0 -36
- package/lib/cjs/libs/protocols/fullsail/index.js +0 -39
- package/lib/cjs/libs/protocols/haedal_pmm/index.js +0 -31
- package/lib/cjs/libs/protocols/index.js +0 -55
- package/lib/cjs/libs/protocols/kriya/index.js +0 -30
- package/lib/cjs/libs/protocols/kriyaV3/index.js +0 -65
- package/lib/cjs/libs/protocols/magma/index.js +0 -40
- package/lib/cjs/libs/protocols/momentum/index.js +0 -49
- package/lib/cjs/libs/protocols/obric/index.js +0 -28
- package/lib/cjs/libs/protocols/sevenk/index.js +0 -55
- package/lib/cjs/libs/protocols/springsui/index.js +0 -24
- package/lib/cjs/libs/protocols/steamm/index.js +0 -160
- package/lib/cjs/libs/protocols/stsui/index.js +0 -24
- package/lib/cjs/libs/protocols/suiswap/index.js +0 -34
- package/lib/cjs/libs/protocols/turbos/index.js +0 -36
- package/lib/cjs/libs/protocols/utils.js +0 -7
- package/lib/cjs/libs/swapWithRoute.js +0 -22
- package/lib/cjs/types/aggregator.js +0 -19
- package/lib/cjs/types/config/index.d.ts +0 -30
- package/lib/cjs/types/config/index.d.ts.map +0 -1
- package/lib/cjs/types/features/metaAg/providers/bluefin7kLegacy.d.ts +0 -11
- package/lib/cjs/types/features/metaAg/providers/bluefin7kLegacy.d.ts.map +0 -1
- package/lib/cjs/types/features/swap/buildTx.d.ts +0 -17
- package/lib/cjs/types/features/swap/buildTx.d.ts.map +0 -1
- package/lib/cjs/types/features/swap/buildTxV2.d.ts +0 -20
- package/lib/cjs/types/features/swap/buildTxV2.d.ts.map +0 -1
- package/lib/cjs/types/features/swap/config.d.ts +0 -4
- package/lib/cjs/types/features/swap/config.d.ts.map +0 -1
- package/lib/cjs/types/features/swap/estimateGasFee.d.ts +0 -3
- package/lib/cjs/types/features/swap/estimateGasFee.d.ts.map +0 -1
- package/lib/cjs/types/features/swap/executeTx.d.ts +0 -24
- package/lib/cjs/types/features/swap/executeTx.d.ts.map +0 -1
- package/lib/cjs/types/features/swap/getQuote.d.ts +0 -27
- package/lib/cjs/types/features/swap/getQuote.d.ts.map +0 -1
- package/lib/cjs/types/features/swap/getSwapHistory.d.ts +0 -22
- package/lib/cjs/types/features/swap/getSwapHistory.d.ts.map +0 -1
- package/lib/cjs/types/features/swap/index.d.ts +0 -7
- package/lib/cjs/types/features/swap/index.d.ts.map +0 -1
- package/lib/cjs/types/libs/groupSwapRoutes.d.ts +0 -3
- package/lib/cjs/types/libs/groupSwapRoutes.d.ts.map +0 -1
- package/lib/cjs/types/libs/protocols/aftermath/index.d.ts +0 -9
- package/lib/cjs/types/libs/protocols/aftermath/index.d.ts.map +0 -1
- package/lib/cjs/types/libs/protocols/base.d.ts +0 -24
- package/lib/cjs/types/libs/protocols/base.d.ts.map +0 -1
- package/lib/cjs/types/libs/protocols/bluefin/index.d.ts +0 -9
- package/lib/cjs/types/libs/protocols/bluefin/index.d.ts.map +0 -1
- package/lib/cjs/types/libs/protocols/bluefinx/client.d.ts +0 -13
- package/lib/cjs/types/libs/protocols/bluefinx/client.d.ts.map +0 -1
- package/lib/cjs/types/libs/protocols/bluefinx/index.d.ts +0 -17
- package/lib/cjs/types/libs/protocols/bluefinx/index.d.ts.map +0 -1
- package/lib/cjs/types/libs/protocols/bluefinx/types.d.ts +0 -34
- package/lib/cjs/types/libs/protocols/bluefinx/types.d.ts.map +0 -1
- package/lib/cjs/types/libs/protocols/bluemove/index.d.ts +0 -9
- package/lib/cjs/types/libs/protocols/bluemove/index.d.ts.map +0 -1
- package/lib/cjs/types/libs/protocols/cetus/index.d.ts +0 -9
- package/lib/cjs/types/libs/protocols/cetus/index.d.ts.map +0 -1
- package/lib/cjs/types/libs/protocols/cetus_dlmm.d.ts +0 -9
- package/lib/cjs/types/libs/protocols/cetus_dlmm.d.ts.map +0 -1
- package/lib/cjs/types/libs/protocols/constants.d.ts +0 -3
- package/lib/cjs/types/libs/protocols/constants.d.ts.map +0 -1
- package/lib/cjs/types/libs/protocols/deepbookV3/sponsored.d.ts +0 -7
- package/lib/cjs/types/libs/protocols/deepbookV3/sponsored.d.ts.map +0 -1
- package/lib/cjs/types/libs/protocols/ferra_clmm.d.ts +0 -9
- package/lib/cjs/types/libs/protocols/ferra_clmm.d.ts.map +0 -1
- package/lib/cjs/types/libs/protocols/ferra_dlmm.d.ts +0 -9
- package/lib/cjs/types/libs/protocols/ferra_dlmm.d.ts.map +0 -1
- package/lib/cjs/types/libs/protocols/flowx/index.d.ts +0 -9
- package/lib/cjs/types/libs/protocols/flowx/index.d.ts.map +0 -1
- package/lib/cjs/types/libs/protocols/flowxV3/index.d.ts +0 -9
- package/lib/cjs/types/libs/protocols/flowxV3/index.d.ts.map +0 -1
- package/lib/cjs/types/libs/protocols/fullsail/index.d.ts +0 -9
- package/lib/cjs/types/libs/protocols/fullsail/index.d.ts.map +0 -1
- package/lib/cjs/types/libs/protocols/haedal_pmm/index.d.ts +0 -14
- package/lib/cjs/types/libs/protocols/haedal_pmm/index.d.ts.map +0 -1
- package/lib/cjs/types/libs/protocols/index.d.ts +0 -53
- package/lib/cjs/types/libs/protocols/index.d.ts.map +0 -1
- package/lib/cjs/types/libs/protocols/kriya/index.d.ts +0 -9
- package/lib/cjs/types/libs/protocols/kriya/index.d.ts.map +0 -1
- package/lib/cjs/types/libs/protocols/kriyaV3/index.d.ts +0 -9
- package/lib/cjs/types/libs/protocols/kriyaV3/index.d.ts.map +0 -1
- package/lib/cjs/types/libs/protocols/magma/index.d.ts +0 -9
- package/lib/cjs/types/libs/protocols/magma/index.d.ts.map +0 -1
- package/lib/cjs/types/libs/protocols/momentum/index.d.ts +0 -9
- package/lib/cjs/types/libs/protocols/momentum/index.d.ts.map +0 -1
- package/lib/cjs/types/libs/protocols/obric/index.d.ts +0 -14
- package/lib/cjs/types/libs/protocols/obric/index.d.ts.map +0 -1
- package/lib/cjs/types/libs/protocols/sevenk/index.d.ts +0 -18
- package/lib/cjs/types/libs/protocols/sevenk/index.d.ts.map +0 -1
- package/lib/cjs/types/libs/protocols/springsui/index.d.ts +0 -9
- package/lib/cjs/types/libs/protocols/springsui/index.d.ts.map +0 -1
- package/lib/cjs/types/libs/protocols/steamm/index.d.ts +0 -28
- package/lib/cjs/types/libs/protocols/steamm/index.d.ts.map +0 -1
- package/lib/cjs/types/libs/protocols/stsui/index.d.ts +0 -9
- package/lib/cjs/types/libs/protocols/stsui/index.d.ts.map +0 -1
- package/lib/cjs/types/libs/protocols/suiswap/index.d.ts +0 -9
- package/lib/cjs/types/libs/protocols/suiswap/index.d.ts.map +0 -1
- package/lib/cjs/types/libs/protocols/turbos/index.d.ts +0 -9
- package/lib/cjs/types/libs/protocols/turbos/index.d.ts.map +0 -1
- package/lib/cjs/types/libs/protocols/utils.d.ts +0 -2
- package/lib/cjs/types/libs/protocols/utils.d.ts.map +0 -1
- package/lib/cjs/types/libs/swapWithRoute.d.ts +0 -12
- package/lib/cjs/types/libs/swapWithRoute.d.ts.map +0 -1
- package/lib/cjs/types/sui.js +0 -2
- package/lib/cjs/types/tx.js +0 -2
- package/lib/cjs/types/types/aggregator.d.ts +0 -173
- package/lib/cjs/types/types/aggregator.d.ts.map +0 -1
- package/lib/cjs/types/types/sui.d.ts +0 -4
- package/lib/cjs/types/types/sui.d.ts.map +0 -1
- package/lib/cjs/types/types/tx.d.ts +0 -67
- package/lib/cjs/types/types/tx.d.ts.map +0 -1
- package/lib/cjs/types/types/utilities.d.ts +0 -5
- package/lib/cjs/types/types/utilities.d.ts.map +0 -1
- package/lib/cjs/types/utilities.js +0 -2
- package/lib/cjs/types/utils/number.d.ts +0 -2
- package/lib/cjs/types/utils/number.d.ts.map +0 -1
- package/lib/cjs/utils/number.js +0 -9
- package/lib/esm/config/index.js +0 -64
- package/lib/esm/features/metaAg/providers/bluefin7kLegacy.js +0 -66
- package/lib/esm/features/swap/buildTx.js +0 -188
- package/lib/esm/features/swap/buildTxV2.js +0 -223
- package/lib/esm/features/swap/config.js +0 -150
- package/lib/esm/features/swap/estimateGasFee.js +0 -41
- package/lib/esm/features/swap/executeTx.js +0 -48
- package/lib/esm/features/swap/getQuote.js +0 -91
- package/lib/esm/features/swap/getSwapHistory.js +0 -18
- package/lib/esm/features/swap/index.js +0 -6
- package/lib/esm/libs/groupSwapRoutes.js +0 -57
- package/lib/esm/libs/protocols/aftermath/index.js +0 -31
- package/lib/esm/libs/protocols/base.js +0 -42
- package/lib/esm/libs/protocols/bluefin/index.js +0 -34
- package/lib/esm/libs/protocols/bluefinx/client.js +0 -36
- package/lib/esm/libs/protocols/bluefinx/index.js +0 -44
- package/lib/esm/libs/protocols/bluefinx/types.js +0 -8
- package/lib/esm/libs/protocols/bluemove/index.js +0 -20
- package/lib/esm/libs/protocols/cetus/index.js +0 -40
- package/lib/esm/libs/protocols/cetus_dlmm.js +0 -44
- package/lib/esm/libs/protocols/constants.js +0 -2
- package/lib/esm/libs/protocols/deepbookV3/sponsored.js +0 -26
- package/lib/esm/libs/protocols/ferra_clmm.js +0 -40
- package/lib/esm/libs/protocols/ferra_dlmm.js +0 -26
- package/lib/esm/libs/protocols/flowx/index.js +0 -14
- package/lib/esm/libs/protocols/flowxV3/index.js +0 -32
- package/lib/esm/libs/protocols/fullsail/index.js +0 -35
- package/lib/esm/libs/protocols/haedal_pmm/index.js +0 -27
- package/lib/esm/libs/protocols/index.js +0 -52
- package/lib/esm/libs/protocols/kriya/index.js +0 -26
- package/lib/esm/libs/protocols/kriyaV3/index.js +0 -61
- package/lib/esm/libs/protocols/magma/index.js +0 -36
- package/lib/esm/libs/protocols/momentum/index.js +0 -45
- package/lib/esm/libs/protocols/obric/index.js +0 -24
- package/lib/esm/libs/protocols/sevenk/index.js +0 -51
- package/lib/esm/libs/protocols/springsui/index.js +0 -20
- package/lib/esm/libs/protocols/steamm/index.js +0 -156
- package/lib/esm/libs/protocols/stsui/index.js +0 -20
- package/lib/esm/libs/protocols/suiswap/index.js +0 -30
- package/lib/esm/libs/protocols/turbos/index.js +0 -32
- package/lib/esm/libs/protocols/utils.js +0 -4
- package/lib/esm/libs/swapWithRoute.js +0 -19
- package/lib/esm/types/aggregator.js +0 -14
- package/lib/esm/types/config/index.d.ts +0 -30
- package/lib/esm/types/config/index.d.ts.map +0 -1
- package/lib/esm/types/features/metaAg/providers/bluefin7kLegacy.d.ts +0 -11
- package/lib/esm/types/features/metaAg/providers/bluefin7kLegacy.d.ts.map +0 -1
- package/lib/esm/types/features/swap/buildTx.d.ts +0 -17
- package/lib/esm/types/features/swap/buildTx.d.ts.map +0 -1
- package/lib/esm/types/features/swap/buildTxV2.d.ts +0 -20
- package/lib/esm/types/features/swap/buildTxV2.d.ts.map +0 -1
- package/lib/esm/types/features/swap/config.d.ts +0 -4
- package/lib/esm/types/features/swap/config.d.ts.map +0 -1
- package/lib/esm/types/features/swap/estimateGasFee.d.ts +0 -3
- package/lib/esm/types/features/swap/estimateGasFee.d.ts.map +0 -1
- package/lib/esm/types/features/swap/executeTx.d.ts +0 -24
- package/lib/esm/types/features/swap/executeTx.d.ts.map +0 -1
- package/lib/esm/types/features/swap/getQuote.d.ts +0 -27
- package/lib/esm/types/features/swap/getQuote.d.ts.map +0 -1
- package/lib/esm/types/features/swap/getSwapHistory.d.ts +0 -22
- package/lib/esm/types/features/swap/getSwapHistory.d.ts.map +0 -1
- package/lib/esm/types/features/swap/index.d.ts +0 -7
- package/lib/esm/types/features/swap/index.d.ts.map +0 -1
- package/lib/esm/types/libs/groupSwapRoutes.d.ts +0 -3
- package/lib/esm/types/libs/groupSwapRoutes.d.ts.map +0 -1
- package/lib/esm/types/libs/protocols/aftermath/index.d.ts +0 -9
- package/lib/esm/types/libs/protocols/aftermath/index.d.ts.map +0 -1
- package/lib/esm/types/libs/protocols/base.d.ts +0 -24
- package/lib/esm/types/libs/protocols/base.d.ts.map +0 -1
- package/lib/esm/types/libs/protocols/bluefin/index.d.ts +0 -9
- package/lib/esm/types/libs/protocols/bluefin/index.d.ts.map +0 -1
- package/lib/esm/types/libs/protocols/bluefinx/client.d.ts +0 -13
- package/lib/esm/types/libs/protocols/bluefinx/client.d.ts.map +0 -1
- package/lib/esm/types/libs/protocols/bluefinx/index.d.ts +0 -17
- package/lib/esm/types/libs/protocols/bluefinx/index.d.ts.map +0 -1
- package/lib/esm/types/libs/protocols/bluefinx/types.d.ts +0 -34
- package/lib/esm/types/libs/protocols/bluefinx/types.d.ts.map +0 -1
- package/lib/esm/types/libs/protocols/bluemove/index.d.ts +0 -9
- package/lib/esm/types/libs/protocols/bluemove/index.d.ts.map +0 -1
- package/lib/esm/types/libs/protocols/cetus/index.d.ts +0 -9
- package/lib/esm/types/libs/protocols/cetus/index.d.ts.map +0 -1
- package/lib/esm/types/libs/protocols/cetus_dlmm.d.ts +0 -9
- package/lib/esm/types/libs/protocols/cetus_dlmm.d.ts.map +0 -1
- package/lib/esm/types/libs/protocols/constants.d.ts +0 -3
- package/lib/esm/types/libs/protocols/constants.d.ts.map +0 -1
- package/lib/esm/types/libs/protocols/deepbookV3/sponsored.d.ts +0 -7
- package/lib/esm/types/libs/protocols/deepbookV3/sponsored.d.ts.map +0 -1
- package/lib/esm/types/libs/protocols/ferra_clmm.d.ts +0 -9
- package/lib/esm/types/libs/protocols/ferra_clmm.d.ts.map +0 -1
- package/lib/esm/types/libs/protocols/ferra_dlmm.d.ts +0 -9
- package/lib/esm/types/libs/protocols/ferra_dlmm.d.ts.map +0 -1
- package/lib/esm/types/libs/protocols/flowx/index.d.ts +0 -9
- package/lib/esm/types/libs/protocols/flowx/index.d.ts.map +0 -1
- package/lib/esm/types/libs/protocols/flowxV3/index.d.ts +0 -9
- package/lib/esm/types/libs/protocols/flowxV3/index.d.ts.map +0 -1
- package/lib/esm/types/libs/protocols/fullsail/index.d.ts +0 -9
- package/lib/esm/types/libs/protocols/fullsail/index.d.ts.map +0 -1
- package/lib/esm/types/libs/protocols/haedal_pmm/index.d.ts +0 -14
- package/lib/esm/types/libs/protocols/haedal_pmm/index.d.ts.map +0 -1
- package/lib/esm/types/libs/protocols/index.d.ts +0 -53
- package/lib/esm/types/libs/protocols/index.d.ts.map +0 -1
- package/lib/esm/types/libs/protocols/kriya/index.d.ts +0 -9
- package/lib/esm/types/libs/protocols/kriya/index.d.ts.map +0 -1
- package/lib/esm/types/libs/protocols/kriyaV3/index.d.ts +0 -9
- package/lib/esm/types/libs/protocols/kriyaV3/index.d.ts.map +0 -1
- package/lib/esm/types/libs/protocols/magma/index.d.ts +0 -9
- package/lib/esm/types/libs/protocols/magma/index.d.ts.map +0 -1
- package/lib/esm/types/libs/protocols/momentum/index.d.ts +0 -9
- package/lib/esm/types/libs/protocols/momentum/index.d.ts.map +0 -1
- package/lib/esm/types/libs/protocols/obric/index.d.ts +0 -14
- package/lib/esm/types/libs/protocols/obric/index.d.ts.map +0 -1
- package/lib/esm/types/libs/protocols/sevenk/index.d.ts +0 -18
- package/lib/esm/types/libs/protocols/sevenk/index.d.ts.map +0 -1
- package/lib/esm/types/libs/protocols/springsui/index.d.ts +0 -9
- package/lib/esm/types/libs/protocols/springsui/index.d.ts.map +0 -1
- package/lib/esm/types/libs/protocols/steamm/index.d.ts +0 -28
- package/lib/esm/types/libs/protocols/steamm/index.d.ts.map +0 -1
- package/lib/esm/types/libs/protocols/stsui/index.d.ts +0 -9
- package/lib/esm/types/libs/protocols/stsui/index.d.ts.map +0 -1
- package/lib/esm/types/libs/protocols/suiswap/index.d.ts +0 -9
- package/lib/esm/types/libs/protocols/suiswap/index.d.ts.map +0 -1
- package/lib/esm/types/libs/protocols/turbos/index.d.ts +0 -9
- package/lib/esm/types/libs/protocols/turbos/index.d.ts.map +0 -1
- package/lib/esm/types/libs/protocols/utils.d.ts +0 -2
- package/lib/esm/types/libs/protocols/utils.d.ts.map +0 -1
- package/lib/esm/types/libs/swapWithRoute.d.ts +0 -12
- package/lib/esm/types/libs/swapWithRoute.d.ts.map +0 -1
- package/lib/esm/types/sui.js +0 -1
- package/lib/esm/types/tx.js +0 -1
- package/lib/esm/types/types/aggregator.d.ts +0 -173
- package/lib/esm/types/types/aggregator.d.ts.map +0 -1
- package/lib/esm/types/types/sui.d.ts +0 -4
- package/lib/esm/types/types/sui.d.ts.map +0 -1
- package/lib/esm/types/types/tx.d.ts +0 -67
- package/lib/esm/types/types/tx.d.ts.map +0 -1
- package/lib/esm/types/types/utilities.d.ts +0 -5
- package/lib/esm/types/types/utilities.d.ts.map +0 -1
- package/lib/esm/types/utilities.js +0 -1
- package/lib/esm/types/utils/number.d.ts +0 -2
- package/lib/esm/types/utils/number.d.ts.map +0 -1
- package/lib/esm/utils/number.js +0 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../../../../src/features/metaAg/error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAE5E,oBAAY,eAAe;IACzB,OAAO,OAAO;IACd,OAAO,OAAO;IACd,kBAAkB,OAAO;IACzB,sBAAsB,OAAO;IAC7B,aAAa,OAAO;IACpB,eAAe,OAAO;IACtB,sBAAsB,OAAO;IAC7B,yBAAyB,OAAO;IAChC,iBAAiB,OAAO;IAExB,8BA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CAAC,iBAAiB,CAAC,EAAE;QAAE,KAAK,EAAE,iBAAiB,CAAC,OAAO,CAAC,CAAA;KAAE,CAAC;IAE3E,CAAC,eAAe,CAAC,8BAA8B,CAAC,EAAE;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC;CACzE,CAAC;AAEF,MAAM,MAAM,kBAAkB,CAAC,CAAC,SAAS,eAAe,IACtD,CAAC,SAAS,MAAM,qBAAqB,GAAG,qBAAqB,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC;AAE3E,qBAAa,WAAW,CAAC,CAAC,SAAS,eAAe,CAAE,SAAQ,KAAK;IAC/D,IAAI,EAAE,CAAC,CAAC;IACR,OAAO,CAAC,EAAE,kBAAkB,CAAC,CAAC,CAAC,CAAC;gBACpB,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,EAAE,kBAAkB,CAAC,CAAC,CAAC;IAOtE,MAAM,CAAC,MAAM,CAAC,CAAC,SAAS,eAAe,EACrC,SAAS,EAAE,GAAG,EACd,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,EACvB,IAAI,CAAC,EAAE,CAAC,EACR,OAAO,CAAC,EAAE,kBAAkB,CAAC,CAAC,CAAC,GAC9B,OAAO,CAAC,SAAS;CAKrB"}
|
|
@@ -21,7 +21,7 @@ export declare class MetaAg {
|
|
|
21
21
|
/**
|
|
22
22
|
* Build transaction from quote
|
|
23
23
|
* @info Use this function to build composable transaction (ie: add more commands after the swap, consume the coin out object)
|
|
24
|
-
* @warning Providers that build transaction on the fly (typically RFQ, Swap-API providers ie:
|
|
24
|
+
* @warning Providers that build transaction on the fly (typically RFQ, Swap-API providers ie: Okx, ...) are not supported, please use `fastSwap` instead
|
|
25
25
|
* @param options - build tx options
|
|
26
26
|
* @param slippageBps - slippage bps if not specified, fallback to global slippage bps, if none of them specified, default to 100
|
|
27
27
|
* @returns coin out object, you must consume it by transferObjects, or other sub sequence commands
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/metaAg/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,yBAAyB,EACzB,SAAS,EACT,2BAA2B,EAC5B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAGL,yBAAyB,EAC1B,MAAM,0BAA0B,CAAC;AAGlC,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/metaAg/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,yBAAyB,EACzB,SAAS,EACT,2BAA2B,EAC5B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAGL,yBAAyB,EAC1B,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EAOL,aAAa,EACb,mBAAmB,EACnB,SAAS,EACT,gBAAgB,EAChB,qBAAqB,EACrB,eAAe,EAGhB,MAAM,oBAAoB,CAAC;AAgB5B,qBAAa,MAAM;IACjB,MAAM,EAAE,SAAS,CAAC;IAClB,OAAO,CAAC,SAAS,CAAiD;IAClE,OAAO,CAAC,SAAS,CAAiB;IAClC,OAAO,CAAC,OAAO,CAA0B;gBAC7B,OAAO,CAAC,EAAE,aAAa;YAkBrB,YAAY;YA0DZ,SAAS;YAoCT,MAAM;YAqBN,SAAS;IA2BvB;;;;;OAKG;IACG,KAAK,CACT,OAAO,EAAE,gBAAgB,EACzB,UAAU,CAAC,EAAE,qBAAqB,GACjC,OAAO,CAAC,SAAS,EAAE,CAAC;IAsCvB;;;;;;;OAOG;IACG,IAAI,CACR,OAAO,EAAE,eAAe,EACxB,WAAW,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC,yBAAyB,CAAC;IAmCrC;;;;OAIG;IACG,QAAQ,CACZ,OAAO,EAAE,mBAAmB,EAC5B,yBAAyB,CAAC,EAAE,IAAI,CAAC,yBAAyB,EAAE,QAAQ,CAAC,GACpE,OAAO,CAAC,2BAA2B,CAAC;IAwBvC;;;OAGG;IACH,mBAAmB,CAAC,OAAO,EAAE,aAAa;CA4B3C"}
|
|
@@ -1,4 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Get price for a single token
|
|
3
|
+
* @param id - Token ID (coin type)
|
|
4
|
+
* @returns Token price, or 0 if not found or on error
|
|
5
|
+
*/
|
|
6
|
+
export declare function getTokenPrice(id: string): Promise<number>;
|
|
7
|
+
/**
|
|
8
|
+
* Get prices for multiple tokens
|
|
9
|
+
* @param ids - Array of token IDs (coin types)
|
|
10
|
+
* @returns Record mapping token IDs to their prices
|
|
11
|
+
*/
|
|
12
|
+
export declare function getTokenPrices(ids: string[]): Promise<Record<string, number>>;
|
|
13
|
+
/**
|
|
14
|
+
* Get the current SUI token price
|
|
15
|
+
* @returns SUI price, or 0 if not found or on error
|
|
16
|
+
*/
|
|
3
17
|
export declare function getSuiPrice(): Promise<number>;
|
|
4
18
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/prices/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/prices/index.ts"],"names":[],"mappings":"AAwCA;;;;GAIG;AACH,wBAAsB,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAQ/D;AAED;;;;GAIG;AACH,wBAAsB,cAAc,CAClC,GAAG,EAAE,MAAM,EAAE,GACZ,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CA2DjC;AAED;;;GAGG;AACH,wBAAsB,WAAW,IAAI,OAAO,CAAC,MAAM,CAAC,CAEnD"}
|
package/lib/esm/types/index.d.ts
CHANGED
|
@@ -1,43 +1,12 @@
|
|
|
1
|
-
export * from "./types/aggregator";
|
|
2
1
|
export * from "./types/metaAg";
|
|
3
|
-
import { Config } from "./config";
|
|
4
2
|
import { MetaAg } from "./features/metaAg";
|
|
5
3
|
import { getSuiPrice, getTokenPrice, getTokenPrices } from "./features/prices";
|
|
6
|
-
import { executeBluefinTx } from "./libs/protocols/bluefinx/client";
|
|
7
|
-
import { buildTx, buildTxV2, DEFAULT_SOURCES, estimateGasFee, executeTx, getQuote, getSwapHistory, multiSwap } from "./features/swap";
|
|
8
4
|
import { cancelDcaOrder, cancelLimitOrder, claimExpiredLimitOrder, getClosedDcaOrders, getClosedLimitOrders, getDcaOrderExecutions, getOpenDcaOrders, getOpenLimitOrders, placeDcaOrder, placeLimitOrder } from "./features/limitDca";
|
|
9
|
-
|
|
10
|
-
declare const setSuiClient: (client: import("@mysten/sui/dist/cjs/client").SuiClient) => void;
|
|
11
|
-
export { buildTx, buildTxV2, cancelDcaOrder, cancelLimitOrder, claimExpiredLimitOrder, Config, DEFAULT_SOURCES, estimateGasFee, executeBluefinTx, executeTx, getClosedDcaOrders, getClosedLimitOrders, getDcaOrderExecutions, getOpenDcaOrders, getOpenLimitOrders, getQuote, getSuiClient, getSuiPrice, getSwapHistory, getTokenPrice, getTokenPrices, MetaAg, multiSwap, placeDcaOrder, placeLimitOrder, setSuiClient, };
|
|
5
|
+
export { MetaAg, cancelDcaOrder, cancelLimitOrder, claimExpiredLimitOrder, getClosedDcaOrders, getClosedLimitOrders, getDcaOrderExecutions, getOpenDcaOrders, getOpenLimitOrders, getSuiPrice, getTokenPrice, getTokenPrices, placeDcaOrder, placeLimitOrder, };
|
|
12
6
|
declare const _default: {
|
|
13
|
-
Config: {
|
|
14
|
-
setApi: (url: string) => void;
|
|
15
|
-
getApi: () => string;
|
|
16
|
-
setApiKey: (key: string) => void;
|
|
17
|
-
getApiKey: () => string;
|
|
18
|
-
setBluefinXApiKey: (key: string) => void;
|
|
19
|
-
getBluefinXApiKey: () => string;
|
|
20
|
-
setSuiClient: (client: import("@mysten/sui/dist/cjs/client").SuiClient) => void;
|
|
21
|
-
getSuiClient: () => import("@mysten/sui/dist/cjs/client").SuiClient;
|
|
22
|
-
setPythClient: (client: import("@pythnetwork/pyth-sui-js").SuiPythClient) => void;
|
|
23
|
-
getPythClient: () => import("@pythnetwork/pyth-sui-js").SuiPythClient;
|
|
24
|
-
setPythConnection: (connection: import("@pythnetwork/pyth-sui-js").SuiPriceServiceConnection) => void;
|
|
25
|
-
getPythConnection: () => import("@pythnetwork/pyth-sui-js").SuiPriceServiceConnection;
|
|
26
|
-
};
|
|
27
|
-
getSuiClient: () => import("@mysten/sui/dist/cjs/client").SuiClient;
|
|
28
|
-
setSuiClient: (client: import("@mysten/sui/dist/cjs/client").SuiClient) => void;
|
|
29
7
|
getTokenPrice: typeof getTokenPrice;
|
|
30
8
|
getTokenPrices: typeof getTokenPrices;
|
|
31
9
|
getSuiPrice: typeof getSuiPrice;
|
|
32
|
-
getQuote: typeof getQuote;
|
|
33
|
-
estimateGasFee: typeof estimateGasFee;
|
|
34
|
-
buildTx: ({ quoteResponse, accountAddress, slippage, commission: __commission, devInspect, extendTx, isSponsored, }: import("./types/tx").BuildTxParams) => Promise<import("./types/aggregator").BuildTxResult>;
|
|
35
|
-
buildTxV2: (params: import("./types/tx").BuildTxParams) => Promise<import("./types/aggregator").BuildTxResult>;
|
|
36
|
-
multiSwap: ({ sender, slippageBps, swaps, tx, commission, }: import("./types/tx").MultiSwapParams) => Promise<Record<string, import("@mysten/sui/dist/cjs/transactions").TransactionObjectArgument>>;
|
|
37
|
-
getSwapHistory: typeof getSwapHistory;
|
|
38
|
-
executeTx: (tx: import("./types/aggregator").AggregatorTx, signature: string, signedTxBytes: string, options?: import("@mysten/sui/dist/cjs/client").SuiTransactionBlockResponseOptions) => Promise<import("@mysten/sui/dist/cjs/client").SuiTransactionBlockResponse>;
|
|
39
|
-
executeBluefinTx: (tx: import("./types/aggregator").BluefinXTx, signature: string) => Promise<import("./libs/protocols/bluefinx/types").SwapResponse>;
|
|
40
|
-
DEFAULT_SOURCES: import("./types/aggregator").SourceDex[];
|
|
41
10
|
placeLimitOrder: typeof placeLimitOrder;
|
|
42
11
|
getOpenLimitOrders: typeof getOpenLimitOrders;
|
|
43
12
|
cancelLimitOrder: typeof cancelLimitOrder;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAE/B,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAE/E,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,sBAAsB,EACtB,kBAAkB,EAClB,oBAAoB,EACpB,qBAAqB,EACrB,gBAAgB,EAChB,kBAAkB,EAClB,aAAa,EACb,eAAe,EAChB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,MAAM,EACN,cAAc,EACd,gBAAgB,EAChB,sBAAsB,EACtB,kBAAkB,EAClB,oBAAoB,EACpB,qBAAqB,EACrB,gBAAgB,EAChB,kBAAkB,EAElB,WAAW,EACX,aAAa,EACb,cAAc,EAEd,aAAa,EAEb,eAAe,GAChB,CAAC;;;;;;;;;;;;;;;;;AAEF,wBAsBE"}
|
package/lib/esm/types/metaAg.js
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
export var EProvider;
|
|
2
2
|
(function (EProvider) {
|
|
3
|
-
EProvider["BLUEFIN7K_LEGACY"] = "bluefin7k_legacy";
|
|
4
3
|
EProvider["BLUEFIN7K"] = "bluefin7k";
|
|
5
4
|
EProvider["CETUS"] = "cetus";
|
|
6
5
|
EProvider["FLOWX"] = "flowx";
|
|
7
6
|
EProvider["OKX"] = "okx";
|
|
8
7
|
})(EProvider || (EProvider = {}));
|
|
9
|
-
export const isAggregatorProvider = (provider) => provider.kind === EProvider.
|
|
10
|
-
provider.kind === EProvider.BLUEFIN7K ||
|
|
8
|
+
export const isAggregatorProvider = (provider) => provider.kind === EProvider.BLUEFIN7K ||
|
|
11
9
|
provider.kind === EProvider.CETUS ||
|
|
12
10
|
provider.kind === EProvider.FLOWX;
|
|
13
11
|
export const isSwapAPIProvider = (provider) => provider.kind === EProvider.OKX;
|
|
@@ -4,10 +4,8 @@ import type { AggregatorQuoter, Protocol } from "@flowx-finance/sdk";
|
|
|
4
4
|
import type { GasCostSummary } from "@mysten/sui/client";
|
|
5
5
|
import { SignatureWithBytes } from "@mysten/sui/cryptography";
|
|
6
6
|
import type { Transaction, TransactionObjectArgument } from "@mysten/sui/transactions";
|
|
7
|
-
import { QuoteResponse as LegacyQuoteResponse, SourceDex as LegacySourceDex } from "./aggregator";
|
|
8
7
|
import { OkxSwapResponseData } from "./okx";
|
|
9
8
|
export declare enum EProvider {
|
|
10
|
-
BLUEFIN7K_LEGACY = "bluefin7k_legacy",
|
|
11
9
|
BLUEFIN7K = "bluefin7k",
|
|
12
10
|
CETUS = "cetus",
|
|
13
11
|
FLOWX = "flowx",
|
|
@@ -18,12 +16,6 @@ type ProviderBaseOptions = {
|
|
|
18
16
|
apiKey?: string;
|
|
19
17
|
disabled?: boolean;
|
|
20
18
|
};
|
|
21
|
-
export type BluefinLegacyProviderOptions = ProviderBaseOptions & {
|
|
22
|
-
sources?: LegacySourceDex[];
|
|
23
|
-
maxPaths?: number;
|
|
24
|
-
excludedPools?: string[];
|
|
25
|
-
targetPools?: string[];
|
|
26
|
-
};
|
|
27
19
|
export type Bluefin7kProviderOptions = ProviderBaseOptions & {
|
|
28
20
|
sources?: SourceDex[];
|
|
29
21
|
excludedPools?: string[];
|
|
@@ -53,7 +45,6 @@ export type OkxProviderOptions = Required<Omit<ProviderBaseOptions, "api">> & {
|
|
|
53
45
|
export interface MetaAgOptions {
|
|
54
46
|
/**If not specified, all providers will be used */
|
|
55
47
|
providers?: {
|
|
56
|
-
[EProvider.BLUEFIN7K_LEGACY]?: BluefinLegacyProviderOptions;
|
|
57
48
|
[EProvider.BLUEFIN7K]?: Bluefin7kProviderOptions;
|
|
58
49
|
[EProvider.FLOWX]?: FlowxProviderOptions;
|
|
59
50
|
[EProvider.CETUS]?: CetusProviderOptions;
|
|
@@ -78,7 +69,7 @@ export interface MetaQuoteOptions {
|
|
|
78
69
|
coinTypeIn: string;
|
|
79
70
|
coinTypeOut: string;
|
|
80
71
|
amountIn: string;
|
|
81
|
-
/** Required for
|
|
72
|
+
/** Required for api-tx providers (ie: Okx) */
|
|
82
73
|
signer?: string;
|
|
83
74
|
/**
|
|
84
75
|
* Timeout for quote operation in milliseconds
|
|
@@ -127,9 +118,6 @@ export interface MetaSwapOptions {
|
|
|
127
118
|
}
|
|
128
119
|
export type FlowxQuoteResponse = Awaited<ReturnType<AggregatorQuoter["getRoutes"]>>;
|
|
129
120
|
export type MetaQuote = ({
|
|
130
|
-
provider: EProvider.BLUEFIN7K_LEGACY;
|
|
131
|
-
quote: LegacyQuoteResponse;
|
|
132
|
-
} | {
|
|
133
121
|
provider: EProvider.BLUEFIN7K;
|
|
134
122
|
quote: QuoteResponse;
|
|
135
123
|
} | {
|
|
@@ -168,7 +156,7 @@ export interface SwapAPIProvider extends QuoteProvider {
|
|
|
168
156
|
fastSwap(options: MetaFastSwapOptions): Promise<string>;
|
|
169
157
|
}
|
|
170
158
|
export interface AggregatorProvider extends QuoteProvider {
|
|
171
|
-
readonly kind: EProvider.
|
|
159
|
+
readonly kind: EProvider.BLUEFIN7K | EProvider.CETUS | EProvider.FLOWX;
|
|
172
160
|
swap(options: MetaSwapOptions): Promise<TransactionObjectArgument>;
|
|
173
161
|
}
|
|
174
162
|
export declare const isAggregatorProvider: (provider: QuoteProvider) => provider is AggregatorProvider;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metaAg.d.ts","sourceRoot":"","sources":["../../../../src/types/metaAg.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,a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CAAC,SAAS,GAAG,SAAS,CAAC,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC;IACvE,IAAI,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAAC;CACpE;AAED,eAAO,MAAM,oBAAoB,GAC/B,UAAU,aAAa,KACtB,QAAQ,IAAI,kBAGoB,CAAC;AAEpC,eAAO,MAAM,iBAAiB,GAC5B,UAAU,aAAa,KACtB,QAAQ,IAAI,eAAkD,CAAC"}
|
|
@@ -1,37 +1,7 @@
|
|
|
1
|
-
import { CoinStruct, SuiObjectResponseQuery } from "@mysten/sui/client";
|
|
2
1
|
import { Transaction, TransactionArgument } from "@mysten/sui/transactions";
|
|
3
|
-
type DataPage<T> = {
|
|
4
|
-
data: T[];
|
|
5
|
-
nextCursor?: any;
|
|
6
|
-
hasNextPage: boolean;
|
|
7
|
-
};
|
|
8
|
-
type PageQuery = {
|
|
9
|
-
cursor?: any;
|
|
10
|
-
limit?: number | null;
|
|
11
|
-
};
|
|
12
|
-
type PaginationArgs = "all" | PageQuery;
|
|
13
2
|
export declare const SuiUtils: {
|
|
14
3
|
getSuiCoin(amount: bigint | TransactionArgument, txb: Transaction): TransactionArgument;
|
|
15
|
-
mergeCoins(coinObjects: Array<string | TransactionArgument>, txb: Transaction): TransactionArgument | undefined;
|
|
16
4
|
getCoinValue(coinType: string, coinObject: string | TransactionArgument, txb: Transaction): TransactionArgument;
|
|
17
|
-
getExactCoinByAmount(coinType: string, coins: {
|
|
18
|
-
objectId: string;
|
|
19
|
-
balance: bigint;
|
|
20
|
-
}[], amount: bigint, txb: Transaction): {
|
|
21
|
-
$kind: "NestedResult";
|
|
22
|
-
NestedResult: [number, number];
|
|
23
|
-
};
|
|
24
|
-
mergeAllUserCoins(coinType: string, signerAddress: string): Promise<Transaction | undefined>;
|
|
25
|
-
mergeAllCoinsWithoutFetch(coins: CoinStruct[], coinType: string, txb: Transaction): void;
|
|
26
|
-
getAllUserCoins({ address, type }: {
|
|
27
|
-
type: string;
|
|
28
|
-
address: string;
|
|
29
|
-
}): Promise<CoinStruct[]>;
|
|
30
|
-
getCoinsGreaterThanAmount(amount: bigint, coins: {
|
|
31
|
-
objectId: string;
|
|
32
|
-
balance: bigint;
|
|
33
|
-
}[]): string[];
|
|
34
|
-
getOwnedObjectsByPage(owner: string, query: SuiObjectResponseQuery, paginationArgs?: PaginationArgs): Promise<DataPage<any>>;
|
|
35
5
|
isValidStructTag(value: string): boolean;
|
|
36
6
|
zeroBalance(tx: Transaction, coinType: string): {
|
|
37
7
|
$kind: "NestedResult";
|
|
@@ -54,5 +24,4 @@ export declare const SuiUtils: {
|
|
|
54
24
|
transferOrDestroyZeroCoin(tx: Transaction, coinType: string, coin: TransactionArgument, address: string): void;
|
|
55
25
|
};
|
|
56
26
|
export declare const isSystemAddress: (address: string) => boolean;
|
|
57
|
-
export {};
|
|
58
27
|
//# sourceMappingURL=sui.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sui.d.ts","sourceRoot":"","sources":["../../../../src/utils/sui.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sui.d.ts","sourceRoot":"","sources":["../../../../src/utils/sui.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAqB5E,eAAO,MAAM,QAAQ;uBAET,MAAM,GAAG,mBAAmB,OAC/B,WAAW,GACf,mBAAmB;2BAMV,MAAM,cACJ,MAAM,GAAG,mBAAmB,OACnC,WAAW,GACf,mBAAmB;4BAWE,MAAM;oBAQd,WAAW,YAAY,MAAM;;;;iBAQhC,WAAW,YAAY,MAAM;;;;wBASpC,WAAW,YACL,MAAM,cACJ,mBAAmB;;;;wBAU3B,WAAW,YACL,MAAM,WACP,mBAAmB;;;;2BAUxB,WAAW,YACL,MAAM,WACP,mBAAmB;oBASd,WAAW,YAAY,MAAM,QAAQ,mBAAmB;kCASlE,WAAW,YACL,MAAM,QACV,mBAAmB,WAChB,MAAM;CAQlB,CAAC;AAEF,eAAO,MAAM,eAAe,GAAI,SAAS,MAAM,YAiB9C,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Calculate expected return amount after applying slippage, commission, and tip
|
|
3
|
+
* @param returnAmount - The raw return amount (with decimals)
|
|
4
|
+
* @param slippageBps - Slippage in basis points (1 bps = 0.01%)
|
|
5
|
+
* @param commissionBps - Commission in basis points
|
|
6
|
+
* @param tipBps - Tip in basis points (default: 0)
|
|
7
|
+
* @returns Object containing tipAmount, minAmount, commissionAmount, and expectedAmount
|
|
8
|
+
*/
|
|
9
|
+
export declare const getExpectedReturn: (returnAmount: string, slippageBps: number, commissionBps: number, tipBps?: number) => {
|
|
10
|
+
tipAmount: bigint;
|
|
11
|
+
minAmount: bigint;
|
|
12
|
+
commissionAmount: bigint;
|
|
13
|
+
expectedAmount: string;
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=swap.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"swap.d.ts","sourceRoot":"","sources":["../../../../src/utils/swap.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB,GAC5B,cAAc,MAAM,EACpB,aAAa,MAAM,EACnB,eAAe,MAAM,EACrB,SAAQ,MAAU;;;;;CA8BnB,CAAC"}
|
package/lib/esm/utils/sui.js
CHANGED
|
@@ -1,31 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { MOVE_STDLIB_ADDRESS, normalizeSuiAddress, parseStructTag, SUI_CLOCK_OBJECT_ID, SUI_FRAMEWORK_ADDRESS, SUI_RANDOM_OBJECT_ID, SUI_SYSTEM_ADDRESS, } from "@mysten/sui/utils";
|
|
4
|
-
import { Config } from "../config";
|
|
5
|
-
import { _7K_CONFIG, _7K_PACKAGE_ID, _7K_VAULT } from "../constants/_7k";
|
|
6
|
-
import { checkIsSui } from "./token";
|
|
1
|
+
import { normalizeSuiAddress, parseStructTag } from "@mysten/sui/utils";
|
|
2
|
+
import { _7K_META_CONFIG, _7K_META_PACKAGE_ID, _7K_META_VAULT, } from "../constants/_7k";
|
|
7
3
|
export const SuiUtils = {
|
|
8
4
|
getSuiCoin(amount, txb) {
|
|
9
5
|
const [coin] = txb.splitCoins(txb.gas, [amount]);
|
|
10
6
|
return coin;
|
|
11
7
|
},
|
|
12
|
-
mergeCoins(coinObjects, txb) {
|
|
13
|
-
if (coinObjects.length == 1) {
|
|
14
|
-
return typeof coinObjects[0] == "string"
|
|
15
|
-
? txb.object(coinObjects[0])
|
|
16
|
-
: coinObjects[0];
|
|
17
|
-
}
|
|
18
|
-
const firstCoin = typeof coinObjects[0] == "string"
|
|
19
|
-
? txb.object(coinObjects[0])
|
|
20
|
-
: coinObjects[0];
|
|
21
|
-
txb.mergeCoins(
|
|
22
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
23
|
-
// @ts-ignore
|
|
24
|
-
firstCoin, coinObjects
|
|
25
|
-
.slice(1)
|
|
26
|
-
.map((coin) => (typeof coin == "string" ? txb.object(coin) : coin)));
|
|
27
|
-
return firstCoin;
|
|
28
|
-
},
|
|
29
8
|
getCoinValue(coinType, coinObject, txb) {
|
|
30
9
|
const inputCoinObject = typeof coinObject == "string" ? txb.object(coinObject) : coinObject;
|
|
31
10
|
const [value] = txb.moveCall({
|
|
@@ -35,128 +14,6 @@ export const SuiUtils = {
|
|
|
35
14
|
});
|
|
36
15
|
return value;
|
|
37
16
|
},
|
|
38
|
-
getExactCoinByAmount(coinType, coins, amount, txb) {
|
|
39
|
-
if (checkIsSui(coinType)) {
|
|
40
|
-
const [coinA] = txb.splitCoins(txb.gas, [amount]);
|
|
41
|
-
return coinA;
|
|
42
|
-
}
|
|
43
|
-
else {
|
|
44
|
-
const coinsX = SuiUtils.getCoinsGreaterThanAmount(amount, coins);
|
|
45
|
-
if (coinsX.length > 1) {
|
|
46
|
-
txb.mergeCoins(txb.object(coinsX[0]), coinsX.slice(1).map((coin) => txb.object(coin)));
|
|
47
|
-
}
|
|
48
|
-
const [coinA] = txb.splitCoins(txb.object(coinsX[0]), [amount]);
|
|
49
|
-
return coinA;
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
|
-
async mergeAllUserCoins(coinType, signerAddress) {
|
|
53
|
-
try {
|
|
54
|
-
const coins = await SuiUtils.getAllUserCoins({
|
|
55
|
-
address: signerAddress,
|
|
56
|
-
type: coinType,
|
|
57
|
-
});
|
|
58
|
-
let totalBalance = BigInt(0);
|
|
59
|
-
coins.forEach((coin) => {
|
|
60
|
-
totalBalance += BigInt(coin.balance);
|
|
61
|
-
});
|
|
62
|
-
const txb = new Transaction();
|
|
63
|
-
if (checkIsSui(coinType)) {
|
|
64
|
-
totalBalance = totalBalance - BigInt("1000");
|
|
65
|
-
txb.splitCoins(txb.gas, [totalBalance]);
|
|
66
|
-
}
|
|
67
|
-
const coinObjectsIds = coins.map((coin) => coin.coinObjectId);
|
|
68
|
-
if (coins.length > 1) {
|
|
69
|
-
txb.mergeCoins(txb.object(coinObjectsIds[0]), coinObjectsIds.slice(1).map((coin) => txb.object(coin)));
|
|
70
|
-
}
|
|
71
|
-
return txb;
|
|
72
|
-
}
|
|
73
|
-
catch (error) {
|
|
74
|
-
console.log(error);
|
|
75
|
-
}
|
|
76
|
-
},
|
|
77
|
-
mergeAllCoinsWithoutFetch(coins, coinType, txb) {
|
|
78
|
-
let totalBalance = BigInt(0);
|
|
79
|
-
coins.forEach((coin) => {
|
|
80
|
-
totalBalance += BigInt(coin.balance);
|
|
81
|
-
});
|
|
82
|
-
if (checkIsSui(coinType)) {
|
|
83
|
-
totalBalance = totalBalance - BigInt("1000");
|
|
84
|
-
txb.splitCoins(txb.gas, [totalBalance]);
|
|
85
|
-
}
|
|
86
|
-
const coinObjectsIds = coins.map((coin) => coin.coinObjectId);
|
|
87
|
-
if (coins.length > 1) {
|
|
88
|
-
txb.mergeCoins(txb.object(coinObjectsIds[0]), coinObjectsIds.slice(1).map((coin) => txb.object(coin)));
|
|
89
|
-
}
|
|
90
|
-
},
|
|
91
|
-
async getAllUserCoins({ address, type }) {
|
|
92
|
-
let cursor = undefined;
|
|
93
|
-
let coins = [];
|
|
94
|
-
let iter = 0;
|
|
95
|
-
do {
|
|
96
|
-
try {
|
|
97
|
-
const res = await Config.getSuiClient().getCoins({
|
|
98
|
-
owner: address,
|
|
99
|
-
coinType: type,
|
|
100
|
-
cursor: cursor,
|
|
101
|
-
limit: 50,
|
|
102
|
-
});
|
|
103
|
-
coins = coins.concat(res.data);
|
|
104
|
-
cursor = res.nextCursor;
|
|
105
|
-
if (!res.hasNextPage || iter === 8) {
|
|
106
|
-
cursor = null;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
catch (error) {
|
|
110
|
-
console.log(error);
|
|
111
|
-
cursor = null;
|
|
112
|
-
}
|
|
113
|
-
iter++;
|
|
114
|
-
} while (cursor !== null);
|
|
115
|
-
return coins;
|
|
116
|
-
},
|
|
117
|
-
getCoinsGreaterThanAmount(amount, coins) {
|
|
118
|
-
const coinsWithBalance = [];
|
|
119
|
-
let collectedAmount = BigInt(0);
|
|
120
|
-
for (const coin of coins) {
|
|
121
|
-
if (collectedAmount < amount &&
|
|
122
|
-
!coinsWithBalance.includes(coin.objectId)) {
|
|
123
|
-
coinsWithBalance.push(coin.objectId);
|
|
124
|
-
collectedAmount = collectedAmount + coin.balance;
|
|
125
|
-
}
|
|
126
|
-
if (coin.balance === BigInt(0) &&
|
|
127
|
-
!coinsWithBalance.includes(coin.objectId))
|
|
128
|
-
coinsWithBalance.push(coin.objectId);
|
|
129
|
-
}
|
|
130
|
-
if (collectedAmount >= amount) {
|
|
131
|
-
return coinsWithBalance;
|
|
132
|
-
}
|
|
133
|
-
else {
|
|
134
|
-
throw new Error("Insufficient balance");
|
|
135
|
-
}
|
|
136
|
-
},
|
|
137
|
-
async getOwnedObjectsByPage(owner, query, paginationArgs = "all") {
|
|
138
|
-
let result = [];
|
|
139
|
-
let hasNextPage = true;
|
|
140
|
-
const queryAll = paginationArgs === "all";
|
|
141
|
-
let nextCursor = queryAll ? null : paginationArgs.cursor;
|
|
142
|
-
do {
|
|
143
|
-
const res = await Config.getSuiClient().getOwnedObjects({
|
|
144
|
-
owner,
|
|
145
|
-
...query,
|
|
146
|
-
cursor: nextCursor,
|
|
147
|
-
limit: queryAll ? null : paginationArgs.limit,
|
|
148
|
-
});
|
|
149
|
-
if (res.data) {
|
|
150
|
-
result = [...result, ...res.data];
|
|
151
|
-
hasNextPage = res.hasNextPage;
|
|
152
|
-
nextCursor = res.nextCursor;
|
|
153
|
-
}
|
|
154
|
-
else {
|
|
155
|
-
hasNextPage = false;
|
|
156
|
-
}
|
|
157
|
-
} while (queryAll && hasNextPage);
|
|
158
|
-
return { data: result, nextCursor, hasNextPage };
|
|
159
|
-
},
|
|
160
17
|
isValidStructTag(value) {
|
|
161
18
|
try {
|
|
162
19
|
return !!parseStructTag(value);
|
|
@@ -202,14 +59,14 @@ export const SuiUtils = {
|
|
|
202
59
|
},
|
|
203
60
|
collectDust(tx, coinType, coin) {
|
|
204
61
|
tx.moveCall({
|
|
205
|
-
target: `${
|
|
62
|
+
target: `${_7K_META_PACKAGE_ID}::vault::collect_dust`,
|
|
206
63
|
typeArguments: [coinType],
|
|
207
|
-
arguments: [tx.object(
|
|
64
|
+
arguments: [tx.object(_7K_META_VAULT), tx.object(_7K_META_CONFIG), coin],
|
|
208
65
|
});
|
|
209
66
|
},
|
|
210
67
|
transferOrDestroyZeroCoin(tx, coinType, coin, address) {
|
|
211
68
|
tx.moveCall({
|
|
212
|
-
target: `${
|
|
69
|
+
target: `${_7K_META_PACKAGE_ID}::utils::transfer_or_destroy`,
|
|
213
70
|
typeArguments: [coinType],
|
|
214
71
|
arguments: [coin, tx.pure.address(address)],
|
|
215
72
|
});
|
|
@@ -218,14 +75,18 @@ export const SuiUtils = {
|
|
|
218
75
|
export const isSystemAddress = (address) => {
|
|
219
76
|
const addr = normalizeSuiAddress(address);
|
|
220
77
|
const addresses = [
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
"
|
|
78
|
+
"0x0", // zero
|
|
79
|
+
"0x1", // std
|
|
80
|
+
"0x2", // sui framework
|
|
81
|
+
"0x3", // unkown but we reserved to be safe
|
|
82
|
+
"0x4", // unknown but we reserved to be safe
|
|
83
|
+
"0x5", // system state
|
|
84
|
+
"0x6", // time
|
|
85
|
+
"0x7", // unknown but we reserved to be safe
|
|
86
|
+
"0x8", // random
|
|
87
|
+
"0x9", // unknown but we reserved to be safe
|
|
88
|
+
"0x403", // coin deny list
|
|
89
|
+
"0xc", // coin registry
|
|
228
90
|
].map((v) => normalizeSuiAddress(v));
|
|
229
91
|
return addresses.includes(addr);
|
|
230
92
|
};
|
|
231
|
-
console.log(isSystemAddress("0x0"));
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Calculate expected return amount after applying slippage, commission, and tip
|
|
3
|
+
* @param returnAmount - The raw return amount (with decimals)
|
|
4
|
+
* @param slippageBps - Slippage in basis points (1 bps = 0.01%)
|
|
5
|
+
* @param commissionBps - Commission in basis points
|
|
6
|
+
* @param tipBps - Tip in basis points (default: 0)
|
|
7
|
+
* @returns Object containing tipAmount, minAmount, commissionAmount, and expectedAmount
|
|
8
|
+
*/
|
|
9
|
+
export const getExpectedReturn = (returnAmount, slippageBps, commissionBps, tipBps = 0) => {
|
|
10
|
+
if (slippageBps > 10000) {
|
|
11
|
+
throw new Error("Slippage must be less than 100%");
|
|
12
|
+
}
|
|
13
|
+
if (commissionBps > 10000) {
|
|
14
|
+
throw new Error("Commission must be less than 100%");
|
|
15
|
+
}
|
|
16
|
+
if (tipBps > 10000) {
|
|
17
|
+
throw new Error("Tip must be less than 100%");
|
|
18
|
+
}
|
|
19
|
+
const returnAmountWithDecimal = BigInt(returnAmount);
|
|
20
|
+
const tipAmountWithDecimal = (returnAmountWithDecimal * BigInt(tipBps || 0)) / 10000n;
|
|
21
|
+
const commissionAmountWithDecimal = ((returnAmountWithDecimal - tipAmountWithDecimal) * BigInt(commissionBps)) /
|
|
22
|
+
10000n;
|
|
23
|
+
const expectedReturnWithDecimal = returnAmountWithDecimal -
|
|
24
|
+
tipAmountWithDecimal -
|
|
25
|
+
commissionAmountWithDecimal;
|
|
26
|
+
const minAmountWithDecimal = (expectedReturnWithDecimal * BigInt(1e4 - slippageBps)) / 10000n;
|
|
27
|
+
return {
|
|
28
|
+
tipAmount: tipAmountWithDecimal,
|
|
29
|
+
minAmount: minAmountWithDecimal,
|
|
30
|
+
commissionAmount: commissionAmountWithDecimal,
|
|
31
|
+
expectedAmount: expectedReturnWithDecimal.toString(10),
|
|
32
|
+
};
|
|
33
|
+
};
|
package/package.json
CHANGED
package/lib/cjs/config/index.js
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Config = void 0;
|
|
4
|
-
const client_1 = require("@mysten/sui/client");
|
|
5
|
-
const pyth_sui_js_1 = require("@pythnetwork/pyth-sui-js");
|
|
6
|
-
const HERMES_API = "https://hermes.pyth.network";
|
|
7
|
-
const WORMHOLE_STATE_ID = "0xaeab97f96cf9877fee2883315d459552b2b921edc16d7ceac6eab944dd88919c";
|
|
8
|
-
const PYTH_STATE_ID = "0x1f9310238ee9298fb703c3419030b35b22bb1cc37113e3bb5007c99aec79e5b8";
|
|
9
|
-
let api = "";
|
|
10
|
-
let apiKey = "";
|
|
11
|
-
let bluefinXApiKey = "";
|
|
12
|
-
let suiClient = new client_1.SuiClient({
|
|
13
|
-
url: (0, client_1.getFullnodeUrl)("mainnet"),
|
|
14
|
-
});
|
|
15
|
-
let pythClient = new pyth_sui_js_1.SuiPythClient(suiClient, PYTH_STATE_ID, WORMHOLE_STATE_ID);
|
|
16
|
-
let pythConnection = new pyth_sui_js_1.SuiPriceServiceConnection(HERMES_API);
|
|
17
|
-
function setApi(url) {
|
|
18
|
-
api = url;
|
|
19
|
-
}
|
|
20
|
-
function getApi() {
|
|
21
|
-
return api;
|
|
22
|
-
}
|
|
23
|
-
function setApiKey(key) {
|
|
24
|
-
apiKey = key;
|
|
25
|
-
}
|
|
26
|
-
function getApiKey() {
|
|
27
|
-
return apiKey;
|
|
28
|
-
}
|
|
29
|
-
function setBluefinXApiKey(key) {
|
|
30
|
-
bluefinXApiKey = key;
|
|
31
|
-
}
|
|
32
|
-
function getBluefinXApiKey() {
|
|
33
|
-
return bluefinXApiKey;
|
|
34
|
-
}
|
|
35
|
-
function getSuiClient() {
|
|
36
|
-
return suiClient;
|
|
37
|
-
}
|
|
38
|
-
function setSuiClient(client) {
|
|
39
|
-
suiClient = client;
|
|
40
|
-
}
|
|
41
|
-
function setPythClient(client) {
|
|
42
|
-
pythClient = client;
|
|
43
|
-
}
|
|
44
|
-
function getPythClient() {
|
|
45
|
-
return pythClient;
|
|
46
|
-
}
|
|
47
|
-
function setPythConnection(connection) {
|
|
48
|
-
pythConnection = connection;
|
|
49
|
-
}
|
|
50
|
-
function getPythConnection() {
|
|
51
|
-
return pythConnection;
|
|
52
|
-
}
|
|
53
|
-
const Config = {
|
|
54
|
-
setApi,
|
|
55
|
-
getApi,
|
|
56
|
-
setApiKey,
|
|
57
|
-
getApiKey,
|
|
58
|
-
setBluefinXApiKey,
|
|
59
|
-
getBluefinXApiKey,
|
|
60
|
-
setSuiClient,
|
|
61
|
-
getSuiClient,
|
|
62
|
-
setPythClient,
|
|
63
|
-
getPythClient,
|
|
64
|
-
setPythConnection,
|
|
65
|
-
getPythConnection,
|
|
66
|
-
};
|
|
67
|
-
exports.Config = Config;
|