@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,42 +0,0 @@
|
|
|
1
|
-
import { normalizeStructTag, parseStructTag, toHex } from "@mysten/sui/utils";
|
|
2
|
-
import { SuiUtils } from "../../utils/sui";
|
|
3
|
-
export class BaseContract {
|
|
4
|
-
swapInfo;
|
|
5
|
-
inputCoinObject;
|
|
6
|
-
currentAccount;
|
|
7
|
-
config;
|
|
8
|
-
pythMap;
|
|
9
|
-
constructor({ swapInfo, inputCoinObject, currentAccount, config, pythMap, }) {
|
|
10
|
-
this.swapInfo = swapInfo;
|
|
11
|
-
this.inputCoinObject = inputCoinObject;
|
|
12
|
-
this.currentAccount = currentAccount;
|
|
13
|
-
this.config = config;
|
|
14
|
-
this.pythMap = pythMap;
|
|
15
|
-
}
|
|
16
|
-
getInputCoinValue(tx) {
|
|
17
|
-
return SuiUtils.getCoinValue(this.swapInfo.assetIn, this.inputCoinObject, tx);
|
|
18
|
-
}
|
|
19
|
-
getTypeParams() {
|
|
20
|
-
return parseStructTag(this.swapInfo.extra?.poolStructTag || "").typeParams.map(normalizeStructTag);
|
|
21
|
-
}
|
|
22
|
-
get extra() {
|
|
23
|
-
const extra = this.swapInfo.extra;
|
|
24
|
-
if (!extra) {
|
|
25
|
-
throw new Error(`Invalid extra info for getExtra`);
|
|
26
|
-
}
|
|
27
|
-
return extra;
|
|
28
|
-
}
|
|
29
|
-
getPythPriceInfoId(oracle) {
|
|
30
|
-
// FIXME: deprecation price_identifier in the next version
|
|
31
|
-
const bytes = oracle?.Pyth?.bytes || oracle?.Pyth?.price_identifier?.bytes;
|
|
32
|
-
if (!bytes) {
|
|
33
|
-
throw new Error(`Invalid oracle info for getPythPriceInfoId`);
|
|
34
|
-
}
|
|
35
|
-
const feedId = "0x" + toHex(Uint8Array.from(bytes));
|
|
36
|
-
const id = this.pythMap[feedId];
|
|
37
|
-
if (!id) {
|
|
38
|
-
throw new Error(`Missing price info for oracle ${feedId}`);
|
|
39
|
-
}
|
|
40
|
-
return id;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { BaseContract } from "../base";
|
|
2
|
-
import { SUI_CLOCK_OBJECT_ID } from "@mysten/sui/utils";
|
|
3
|
-
import { getDefaultSqrtPriceLimit } from "../utils";
|
|
4
|
-
import { SuiUtils } from "../../../utils/sui";
|
|
5
|
-
export class BluefinContract extends BaseContract {
|
|
6
|
-
async swap(tx) {
|
|
7
|
-
const [coinX, coinY] = this.swapInfo.pool.allTokens;
|
|
8
|
-
const swapXtoY = this.swapInfo.swapXtoY;
|
|
9
|
-
const amountIn = this.getInputCoinValue(tx);
|
|
10
|
-
const coinInBalance = SuiUtils.coinIntoBalance(tx, this.swapInfo.assetIn, this.inputCoinObject);
|
|
11
|
-
const coinOutBalance = SuiUtils.zeroBalance(tx, this.swapInfo.assetOut);
|
|
12
|
-
const config = this.config.bluefin;
|
|
13
|
-
const [balanceOutX, balanceOutY] = tx.moveCall({
|
|
14
|
-
target: `${config.package}::pool::swap`,
|
|
15
|
-
typeArguments: [coinX.address, coinY.address],
|
|
16
|
-
arguments: [
|
|
17
|
-
tx.object(SUI_CLOCK_OBJECT_ID),
|
|
18
|
-
tx.object(config.globalConfig),
|
|
19
|
-
tx.object(this.swapInfo.poolId),
|
|
20
|
-
swapXtoY ? coinInBalance : coinOutBalance,
|
|
21
|
-
swapXtoY ? coinOutBalance : coinInBalance,
|
|
22
|
-
tx.pure.bool(swapXtoY),
|
|
23
|
-
tx.pure.bool(true),
|
|
24
|
-
amountIn,
|
|
25
|
-
tx.pure.u64(0),
|
|
26
|
-
tx.pure.u128(getDefaultSqrtPriceLimit(swapXtoY) + (swapXtoY ? 1n : -1n)),
|
|
27
|
-
],
|
|
28
|
-
});
|
|
29
|
-
const coinOutX = SuiUtils.coinFromBalance(tx, coinX.address, balanceOutX);
|
|
30
|
-
const coinOutY = SuiUtils.coinFromBalance(tx, coinY.address, balanceOutY);
|
|
31
|
-
SuiUtils.collectDust(tx, this.swapInfo.assetIn, swapXtoY ? coinOutX : coinOutY);
|
|
32
|
-
return swapXtoY ? coinOutY : coinOutX;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { Config } from "../../../config";
|
|
2
|
-
import { API_ENDPOINTS } from "../../../constants/apiEndpoints";
|
|
3
|
-
const request = async (path, body) => {
|
|
4
|
-
const headers = new Headers({
|
|
5
|
-
"Content-Type": "application/json",
|
|
6
|
-
});
|
|
7
|
-
const bluefinXApiKey = (Config.getBluefinXApiKey() || "").trim();
|
|
8
|
-
if (bluefinXApiKey) {
|
|
9
|
-
headers.set("Bluefin-X-API-Key", bluefinXApiKey);
|
|
10
|
-
}
|
|
11
|
-
const res = await fetch(`${Config.getApi() || API_ENDPOINTS.MAIN}/${path}`, {
|
|
12
|
-
method: "POST",
|
|
13
|
-
body: JSON.stringify(body),
|
|
14
|
-
headers,
|
|
15
|
-
});
|
|
16
|
-
return res.json();
|
|
17
|
-
};
|
|
18
|
-
export const sponsorBluefinX = async (body) => {
|
|
19
|
-
return await request("bluefinx/sponsor", body);
|
|
20
|
-
};
|
|
21
|
-
/**
|
|
22
|
-
* Request BluefinX for signing sponsored tx and execute it
|
|
23
|
-
*
|
|
24
|
-
* @Warning
|
|
25
|
-
* User must use this function to execute BluefinX tx, otherwise the tx will be rejected by BluefinX contract
|
|
26
|
-
* @param tx - BluefinX tx which is generated by `buildTx`
|
|
27
|
-
* @param signature - user signature after signing the transaction
|
|
28
|
-
* @returns `SwapResponse`
|
|
29
|
-
*/
|
|
30
|
-
export const executeBluefinTx = async (tx, signature) => {
|
|
31
|
-
return await request("bluefinx/swap", {
|
|
32
|
-
quoteId: tx.quoteId,
|
|
33
|
-
txBytes: tx.txBytes,
|
|
34
|
-
signature,
|
|
35
|
-
});
|
|
36
|
-
};
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { bcs } from "@mysten/sui/bcs";
|
|
2
|
-
import { fromBase64, normalizeStructTag, SUI_CLOCK_OBJECT_ID, } from "@mysten/sui/utils";
|
|
3
|
-
import { SuiUtils } from "../../../utils/sui";
|
|
4
|
-
import { BaseContract } from "../base";
|
|
5
|
-
const BcsQuote = bcs.struct("Quote", {
|
|
6
|
-
vault: bcs.Address,
|
|
7
|
-
id: bcs.string(),
|
|
8
|
-
taker: bcs.Address,
|
|
9
|
-
token_in_amount: bcs.u64(),
|
|
10
|
-
token_out_amount: bcs.u64(),
|
|
11
|
-
token_in_type: bcs.string(),
|
|
12
|
-
token_out_type: bcs.string(),
|
|
13
|
-
expires_at: bcs.u64(),
|
|
14
|
-
created_at: bcs.u64(),
|
|
15
|
-
});
|
|
16
|
-
export class BluefinXContract extends BaseContract {
|
|
17
|
-
async swap(tx) {
|
|
18
|
-
const extra = this.extra;
|
|
19
|
-
const quoteBytes = BcsQuote.serialize({
|
|
20
|
-
vault: extra.vault,
|
|
21
|
-
id: extra.quoteId,
|
|
22
|
-
taker: extra.taker,
|
|
23
|
-
token_in_amount: this.swapInfo.amount,
|
|
24
|
-
token_out_amount: this.swapInfo.returnAmount,
|
|
25
|
-
token_in_type: normalizeStructTag(this.swapInfo.assetIn).slice(2),
|
|
26
|
-
token_out_type: normalizeStructTag(this.swapInfo.assetOut).slice(2),
|
|
27
|
-
expires_at: extra.quoteExpiresAtUtcMillis,
|
|
28
|
-
created_at: extra.createdAtUtcMillis,
|
|
29
|
-
}).toBytes();
|
|
30
|
-
const [out] = tx.moveCall({
|
|
31
|
-
arguments: [
|
|
32
|
-
tx.object(SUI_CLOCK_OBJECT_ID),
|
|
33
|
-
tx.object(extra.vault),
|
|
34
|
-
tx.object(this.config.bluefinx.globalConfig),
|
|
35
|
-
tx.pure.vector("u8", Array.from(quoteBytes)),
|
|
36
|
-
tx.pure.vector("u8", Array.from(fromBase64(extra.signature))),
|
|
37
|
-
SuiUtils.coinIntoBalance(tx, this.swapInfo.assetIn, this.inputCoinObject),
|
|
38
|
-
],
|
|
39
|
-
target: `${this.config.bluefinx.package}::vault::swap`,
|
|
40
|
-
typeArguments: [this.swapInfo.assetIn, this.swapInfo.assetOut],
|
|
41
|
-
});
|
|
42
|
-
return SuiUtils.coinFromBalance(tx, this.swapInfo.assetOut, out);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { BaseContract } from "../base";
|
|
2
|
-
import { SuiUtils } from "../../../utils/sui";
|
|
3
|
-
export class BluemoveContract extends BaseContract {
|
|
4
|
-
async swap(tx) {
|
|
5
|
-
const config = this.config.bluemove;
|
|
6
|
-
const [coinOut] = tx.moveCall({
|
|
7
|
-
target: `${config.package}::router::swap_exact_input_`,
|
|
8
|
-
typeArguments: [this.swapInfo.assetIn, this.swapInfo.assetOut],
|
|
9
|
-
arguments: [
|
|
10
|
-
SuiUtils.getCoinValue(this.swapInfo.swapXtoY
|
|
11
|
-
? this.swapInfo.coinX.type
|
|
12
|
-
: this.swapInfo.coinY.type, this.inputCoinObject, tx), // input amount
|
|
13
|
-
this.inputCoinObject, // input coin
|
|
14
|
-
tx.pure.u64(0), // min output amount
|
|
15
|
-
tx.object(config.dexInfo),
|
|
16
|
-
],
|
|
17
|
-
});
|
|
18
|
-
return coinOut;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { BaseContract } from "../base";
|
|
2
|
-
import { SUI_CLOCK_OBJECT_ID } from "@mysten/sui/utils";
|
|
3
|
-
import { getDefaultSqrtPriceLimit } from "../utils";
|
|
4
|
-
import { SuiUtils } from "../../../utils/sui";
|
|
5
|
-
export class CetusContract extends BaseContract {
|
|
6
|
-
async swap(tx) {
|
|
7
|
-
const sqrtPriceLimit = getDefaultSqrtPriceLimit(this.swapInfo.swapXtoY);
|
|
8
|
-
const typeArguments = [this.swapInfo.coinX.type, this.swapInfo.coinY.type];
|
|
9
|
-
const [zeroOut] = tx.moveCall({
|
|
10
|
-
target: "0x2::coin::zero",
|
|
11
|
-
typeArguments: [
|
|
12
|
-
this.swapInfo.swapXtoY
|
|
13
|
-
? this.swapInfo.coinY.type
|
|
14
|
-
: this.swapInfo.coinX.type,
|
|
15
|
-
],
|
|
16
|
-
});
|
|
17
|
-
const amountIn = SuiUtils.getCoinValue(this.swapInfo.swapXtoY
|
|
18
|
-
? this.swapInfo.coinX.type
|
|
19
|
-
: this.swapInfo.coinY.type, this.inputCoinObject, tx);
|
|
20
|
-
const config = this.config.cetus;
|
|
21
|
-
const [receiveA, receiveB] = tx.moveCall({
|
|
22
|
-
target: `${config.package}::router::swap`,
|
|
23
|
-
typeArguments,
|
|
24
|
-
arguments: [
|
|
25
|
-
tx.object(config.globalConfig),
|
|
26
|
-
tx.object(this.swapInfo.poolId),
|
|
27
|
-
this.swapInfo.swapXtoY ? this.inputCoinObject : zeroOut, // coin A
|
|
28
|
-
this.swapInfo.swapXtoY ? zeroOut : this.inputCoinObject, // coin B
|
|
29
|
-
tx.pure.bool(this.swapInfo.swapXtoY), // a to b or b to a
|
|
30
|
-
tx.pure.bool(true), // exact in or out
|
|
31
|
-
amountIn, // swap amount
|
|
32
|
-
tx.pure.u128(sqrtPriceLimit.toString()), // sqrt price limit
|
|
33
|
-
tx.pure.bool(false),
|
|
34
|
-
tx.object(SUI_CLOCK_OBJECT_ID),
|
|
35
|
-
],
|
|
36
|
-
});
|
|
37
|
-
SuiUtils.collectDust(tx, this.swapInfo.assetIn, this.swapInfo.swapXtoY ? receiveA : receiveB);
|
|
38
|
-
return this.swapInfo.swapXtoY ? receiveB : receiveA;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { SUI_CLOCK_OBJECT_ID } from "@mysten/sui/utils";
|
|
2
|
-
import { SuiUtils } from "../../utils/sui";
|
|
3
|
-
import { BaseContract } from "./base";
|
|
4
|
-
export class CetusDLMMContract extends BaseContract {
|
|
5
|
-
async swap(tx) {
|
|
6
|
-
const config = this.config.cetus_dlmm;
|
|
7
|
-
const [x, y, receipt] = tx.moveCall({
|
|
8
|
-
target: `${config.package}::pool::flash_swap`,
|
|
9
|
-
typeArguments: [this.swapInfo.coinX.type, this.swapInfo.coinY.type],
|
|
10
|
-
arguments: [
|
|
11
|
-
tx.object(this.swapInfo.poolId),
|
|
12
|
-
tx.pure.bool(this.swapInfo.swapXtoY),
|
|
13
|
-
tx.pure.bool(true), // exact in
|
|
14
|
-
this.getInputCoinValue(tx),
|
|
15
|
-
tx.object(config.globalConfig),
|
|
16
|
-
tx.object(config.version),
|
|
17
|
-
tx.object(SUI_CLOCK_OBJECT_ID),
|
|
18
|
-
],
|
|
19
|
-
});
|
|
20
|
-
const debtX = this.swapInfo.swapXtoY
|
|
21
|
-
? SuiUtils.coinIntoBalance(tx, this.swapInfo.coinX.type, this.inputCoinObject)
|
|
22
|
-
: SuiUtils.zeroBalance(tx, this.swapInfo.coinX.type);
|
|
23
|
-
const debtY = this.swapInfo.swapXtoY
|
|
24
|
-
? SuiUtils.zeroBalance(tx, this.swapInfo.coinY.type)
|
|
25
|
-
: SuiUtils.coinIntoBalance(tx, this.swapInfo.coinY.type, this.inputCoinObject);
|
|
26
|
-
tx.moveCall({
|
|
27
|
-
target: `${config.package}::pool::repay_flash_swap`,
|
|
28
|
-
typeArguments: [this.swapInfo.coinX.type, this.swapInfo.coinY.type],
|
|
29
|
-
arguments: [
|
|
30
|
-
tx.object(this.swapInfo.poolId),
|
|
31
|
-
debtX,
|
|
32
|
-
debtY,
|
|
33
|
-
receipt,
|
|
34
|
-
tx.object(config.version),
|
|
35
|
-
],
|
|
36
|
-
});
|
|
37
|
-
const [destroyType, destroyCoin, outType, outBalance] = this.swapInfo
|
|
38
|
-
.swapXtoY
|
|
39
|
-
? [this.swapInfo.coinX.type, x, this.swapInfo.coinY.type, y]
|
|
40
|
-
: [this.swapInfo.coinY.type, y, this.swapInfo.coinX.type, x];
|
|
41
|
-
SuiUtils.balanceDestroyZero(tx, destroyType, destroyCoin);
|
|
42
|
-
return SuiUtils.coinFromBalance(tx, outType, outBalance);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { BaseContract } from "../base";
|
|
2
|
-
import { normalizeStructTag, SUI_CLOCK_OBJECT_ID } from "@mysten/sui/utils";
|
|
3
|
-
import { SuiUtils } from "../../../utils/sui";
|
|
4
|
-
export class SponsoredDeepBookV3Contract extends BaseContract {
|
|
5
|
-
async swap(tx) {
|
|
6
|
-
const [coinX] = this.swapInfo.pool.allTokens;
|
|
7
|
-
const swapXtoY = normalizeStructTag(coinX.address) ===
|
|
8
|
-
normalizeStructTag(this.swapInfo.assetIn);
|
|
9
|
-
const config = this.config.deepbook_v3;
|
|
10
|
-
const [base, quote] = tx.moveCall({
|
|
11
|
-
target: `${config.sponsor}::sponsored::${swapXtoY ? "swap_exact_base_for_quote" : "swap_exact_quote_for_base"}`,
|
|
12
|
-
typeArguments: this.getTypeParams(),
|
|
13
|
-
arguments: [
|
|
14
|
-
tx.object(config.sponsorFund),
|
|
15
|
-
tx.object(this.swapInfo.poolId),
|
|
16
|
-
this.inputCoinObject,
|
|
17
|
-
tx.pure.u64(0),
|
|
18
|
-
tx.object(SUI_CLOCK_OBJECT_ID),
|
|
19
|
-
],
|
|
20
|
-
});
|
|
21
|
-
const coinIn = swapXtoY ? base : quote;
|
|
22
|
-
const coinOut = swapXtoY ? quote : base;
|
|
23
|
-
SuiUtils.collectDust(tx, this.swapInfo.assetIn, coinIn);
|
|
24
|
-
return coinOut;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { SUI_CLOCK_OBJECT_ID } from "@mysten/sui/utils";
|
|
2
|
-
import { SuiUtils } from "../../utils/sui";
|
|
3
|
-
import { BaseContract } from "./base";
|
|
4
|
-
import { getDefaultSqrtPriceLimit } from "./utils";
|
|
5
|
-
export class FerraCLMMContract extends BaseContract {
|
|
6
|
-
async swap(tx) {
|
|
7
|
-
const sqrtPriceLimit = getDefaultSqrtPriceLimit(this.swapInfo.swapXtoY);
|
|
8
|
-
const typeArguments = [this.swapInfo.coinX.type, this.swapInfo.coinY.type];
|
|
9
|
-
const [zeroOut] = tx.moveCall({
|
|
10
|
-
target: "0x2::coin::zero",
|
|
11
|
-
typeArguments: [
|
|
12
|
-
this.swapInfo.swapXtoY
|
|
13
|
-
? this.swapInfo.coinY.type
|
|
14
|
-
: this.swapInfo.coinX.type,
|
|
15
|
-
],
|
|
16
|
-
});
|
|
17
|
-
const amountIn = SuiUtils.getCoinValue(this.swapInfo.swapXtoY
|
|
18
|
-
? this.swapInfo.coinX.type
|
|
19
|
-
: this.swapInfo.coinY.type, this.inputCoinObject, tx);
|
|
20
|
-
const config = this.config.ferra_clmm;
|
|
21
|
-
const [receiveA, receiveB] = tx.moveCall({
|
|
22
|
-
target: `${config.integrate}::router::swap`,
|
|
23
|
-
typeArguments,
|
|
24
|
-
arguments: [
|
|
25
|
-
tx.object(config.globalConfig),
|
|
26
|
-
tx.object(this.swapInfo.poolId),
|
|
27
|
-
this.swapInfo.swapXtoY ? this.inputCoinObject : zeroOut, // coin A
|
|
28
|
-
this.swapInfo.swapXtoY ? zeroOut : this.inputCoinObject, // coin B
|
|
29
|
-
tx.pure.bool(this.swapInfo.swapXtoY), // a to b or b to a
|
|
30
|
-
tx.pure.bool(true), // exact in or out
|
|
31
|
-
amountIn, // swap amount
|
|
32
|
-
tx.pure.u128(sqrtPriceLimit.toString()), // sqrt price limit
|
|
33
|
-
tx.pure.bool(false),
|
|
34
|
-
tx.object(SUI_CLOCK_OBJECT_ID),
|
|
35
|
-
],
|
|
36
|
-
});
|
|
37
|
-
SuiUtils.collectDust(tx, this.swapInfo.assetIn, this.swapInfo.swapXtoY ? receiveA : receiveB);
|
|
38
|
-
return this.swapInfo.swapXtoY ? receiveB : receiveA;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { SUI_CLOCK_OBJECT_ID } from "@mysten/sui/utils";
|
|
2
|
-
import { SuiUtils } from "../../utils/sui";
|
|
3
|
-
import { BaseContract } from "./base";
|
|
4
|
-
export class FerraDLMMContract extends BaseContract {
|
|
5
|
-
async swap(tx) {
|
|
6
|
-
const config = this.config.ferra_dlmm;
|
|
7
|
-
const [xIn, yIn] = this.swapInfo.swapXtoY
|
|
8
|
-
? [this.inputCoinObject, SuiUtils.zeroCoin(tx, this.swapInfo.coinY.type)]
|
|
9
|
-
: [SuiUtils.zeroCoin(tx, this.swapInfo.coinX.type), this.inputCoinObject];
|
|
10
|
-
const [x, y] = tx.moveCall({
|
|
11
|
-
target: `${config.package}::lb_pair::swap`,
|
|
12
|
-
typeArguments: [this.swapInfo.coinX.type, this.swapInfo.coinY.type],
|
|
13
|
-
arguments: [
|
|
14
|
-
tx.object(config.globalConfig),
|
|
15
|
-
tx.object(this.swapInfo.poolId),
|
|
16
|
-
tx.pure.bool(this.swapInfo.swapXtoY),
|
|
17
|
-
tx.pure.u64(0), // min output amount
|
|
18
|
-
xIn,
|
|
19
|
-
yIn,
|
|
20
|
-
tx.object(SUI_CLOCK_OBJECT_ID),
|
|
21
|
-
],
|
|
22
|
-
});
|
|
23
|
-
SuiUtils.transferOrDestroyZeroCoin(tx, this.swapInfo.assetIn, this.swapInfo.swapXtoY ? x : y, this.currentAccount);
|
|
24
|
-
return this.swapInfo.swapXtoY ? y : x;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { BaseContract } from "../base";
|
|
2
|
-
export class FlowXContract extends BaseContract {
|
|
3
|
-
async swap(tx) {
|
|
4
|
-
const coinInType = this.swapInfo.assetIn;
|
|
5
|
-
const coinOutType = this.swapInfo.assetOut;
|
|
6
|
-
const config = this.config.flowx;
|
|
7
|
-
const [tokenOut] = tx.moveCall({
|
|
8
|
-
target: `${config.package}::router::swap_exact_input_direct`,
|
|
9
|
-
typeArguments: [coinInType, coinOutType],
|
|
10
|
-
arguments: [tx.object(config.container), this.inputCoinObject],
|
|
11
|
-
});
|
|
12
|
-
return tokenOut;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { SUI_CLOCK_OBJECT_ID } from "@mysten/sui/utils";
|
|
2
|
-
import { BaseContract } from "../base";
|
|
3
|
-
import { getDefaultSqrtPriceLimit } from "../utils";
|
|
4
|
-
export class FlowxV3Contract extends BaseContract {
|
|
5
|
-
async swap(tx) {
|
|
6
|
-
const [coinX, coinY] = this.swapInfo.pool.allTokens;
|
|
7
|
-
const swapXtoY = this.swapInfo.swapXtoY;
|
|
8
|
-
const swapFeeRate = this.swapInfo.extra.swapFeeRate;
|
|
9
|
-
if (!swapFeeRate) {
|
|
10
|
-
throw new Error("swapFeeRate is required");
|
|
11
|
-
}
|
|
12
|
-
const config = this.config.flowx_v3;
|
|
13
|
-
const [coinOut] = tx.moveCall({
|
|
14
|
-
target: `${config.package}::swap_router::swap_exact_input`,
|
|
15
|
-
typeArguments: [
|
|
16
|
-
swapXtoY ? coinX.address : coinY.address,
|
|
17
|
-
swapXtoY ? coinY.address : coinX.address,
|
|
18
|
-
],
|
|
19
|
-
arguments: [
|
|
20
|
-
tx.object(config.registry),
|
|
21
|
-
tx.pure.u64(swapFeeRate), // swap fee rate to lookup pool in the registry
|
|
22
|
-
this.inputCoinObject,
|
|
23
|
-
tx.pure.u64(0), // min amount out
|
|
24
|
-
tx.pure.u128(getDefaultSqrtPriceLimit(swapXtoY) + (swapXtoY ? 1n : -1n)), // sqrt price limit
|
|
25
|
-
tx.pure.u64("18446744073709551615"), // u64 max value
|
|
26
|
-
tx.object(config.version),
|
|
27
|
-
tx.object(SUI_CLOCK_OBJECT_ID),
|
|
28
|
-
],
|
|
29
|
-
});
|
|
30
|
-
return coinOut;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { BaseContract } from "../base";
|
|
2
|
-
import { SUI_CLOCK_OBJECT_ID } from "@mysten/sui/utils";
|
|
3
|
-
import { SuiUtils } from "../../../utils/sui";
|
|
4
|
-
import { getDefaultSqrtPriceLimit } from "../utils";
|
|
5
|
-
export class FullsailContract extends BaseContract {
|
|
6
|
-
async swap(tx) {
|
|
7
|
-
const [coinX, coinY] = this.swapInfo.pool.allTokens;
|
|
8
|
-
const swapXtoY = this.swapInfo.swapXtoY;
|
|
9
|
-
const sqrtPriceLimit = getDefaultSqrtPriceLimit(swapXtoY);
|
|
10
|
-
const typeArguments = [coinX.address, coinY.address];
|
|
11
|
-
const zeroOut = SuiUtils.zeroCoin(tx, swapXtoY ? coinY.address : coinX.address);
|
|
12
|
-
const config = this.config.fullsail;
|
|
13
|
-
const [receiveA, receiveB] = tx.moveCall({
|
|
14
|
-
target: `${config.package}::router::swap`,
|
|
15
|
-
typeArguments,
|
|
16
|
-
arguments: [
|
|
17
|
-
tx.object(config.globalConfig),
|
|
18
|
-
tx.object(config.rewarderGlobalVault),
|
|
19
|
-
tx.object(this.swapInfo.poolId),
|
|
20
|
-
swapXtoY ? this.inputCoinObject : zeroOut, // coin A
|
|
21
|
-
swapXtoY ? zeroOut : this.inputCoinObject, // coin B
|
|
22
|
-
tx.pure.bool(swapXtoY), // a to b or b to a
|
|
23
|
-
tx.pure.bool(true), // exact in or out
|
|
24
|
-
this.getInputCoinValue(tx), // swap amount
|
|
25
|
-
tx.pure.u128(sqrtPriceLimit.toString()), // sqrt price limit
|
|
26
|
-
tx.pure.bool(false),
|
|
27
|
-
tx.object(config.stats),
|
|
28
|
-
tx.object(config.priceProvider),
|
|
29
|
-
tx.object(SUI_CLOCK_OBJECT_ID),
|
|
30
|
-
],
|
|
31
|
-
});
|
|
32
|
-
SuiUtils.collectDust(tx, this.swapInfo.assetIn, swapXtoY ? receiveA : receiveB);
|
|
33
|
-
return swapXtoY ? receiveB : receiveA;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { SUI_CLOCK_OBJECT_ID } from "@mysten/sui/utils";
|
|
2
|
-
import { SuiUtils } from "../../../utils/sui";
|
|
3
|
-
import { BaseContract } from "../base";
|
|
4
|
-
export class HaedalPMMContract extends BaseContract {
|
|
5
|
-
async swap(tx) {
|
|
6
|
-
const [coinX, coinY] = this.swapInfo.pool.allTokens;
|
|
7
|
-
const xToY = this.swapInfo.swapXtoY;
|
|
8
|
-
const oracleX = this.getPythPriceInfoId(this.extra.oracles?.[0]);
|
|
9
|
-
const oracleY = this.getPythPriceInfoId(this.extra.oracles?.[1]);
|
|
10
|
-
const config = this.config.haedal_pmm;
|
|
11
|
-
const [coinOut] = tx.moveCall({
|
|
12
|
-
target: `${config.package}::trader::${xToY ? "sell_base_coin" : "sell_quote_coin"}`,
|
|
13
|
-
typeArguments: [coinX.address, coinY.address],
|
|
14
|
-
arguments: [
|
|
15
|
-
tx.object(this.swapInfo.poolId),
|
|
16
|
-
tx.object(SUI_CLOCK_OBJECT_ID),
|
|
17
|
-
tx.object(oracleX), // pyth pricefeed for x
|
|
18
|
-
tx.object(oracleY), // pyth pricefeed for y
|
|
19
|
-
this.inputCoinObject, // mutable coin
|
|
20
|
-
this.getInputCoinValue(tx), // swap amount
|
|
21
|
-
tx.pure.u64(0), // min output amount
|
|
22
|
-
],
|
|
23
|
-
});
|
|
24
|
-
SuiUtils.collectDust(tx, this.swapInfo.assetIn, this.inputCoinObject);
|
|
25
|
-
return coinOut;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { AfterMathContract } from "./aftermath";
|
|
2
|
-
import { BluefinContract } from "./bluefin";
|
|
3
|
-
import { BluefinXContract } from "./bluefinx";
|
|
4
|
-
import { BluemoveContract } from "./bluemove";
|
|
5
|
-
import { CetusContract } from "./cetus";
|
|
6
|
-
import { CetusDLMMContract } from "./cetus_dlmm";
|
|
7
|
-
import { SponsoredDeepBookV3Contract } from "./deepbookV3/sponsored";
|
|
8
|
-
import { FerraCLMMContract } from "./ferra_clmm";
|
|
9
|
-
import { FerraDLMMContract } from "./ferra_dlmm";
|
|
10
|
-
import { FlowXContract } from "./flowx";
|
|
11
|
-
import { FlowxV3Contract } from "./flowxV3";
|
|
12
|
-
import { FullsailContract } from "./fullsail";
|
|
13
|
-
import { HaedalPMMContract } from "./haedal_pmm";
|
|
14
|
-
import { KriyaContract } from "./kriya";
|
|
15
|
-
import { KriyaV3Contract } from "./kriyaV3";
|
|
16
|
-
import { MagmaContract } from "./magma";
|
|
17
|
-
import { MomentumContract } from "./momentum";
|
|
18
|
-
import { ObricContract } from "./obric";
|
|
19
|
-
import { SevenKV1 } from "./sevenk";
|
|
20
|
-
import { SpringSuiContract } from "./springsui";
|
|
21
|
-
import { SteammContract } from "./steamm";
|
|
22
|
-
import { StSuiContract } from "./stsui";
|
|
23
|
-
import { SuiswapContract } from "./suiswap";
|
|
24
|
-
import { TurbosContract } from "./turbos";
|
|
25
|
-
export const ProtocolContract = {
|
|
26
|
-
cetus: CetusContract,
|
|
27
|
-
turbos: TurbosContract,
|
|
28
|
-
bluemove: BluemoveContract,
|
|
29
|
-
kriya: KriyaContract,
|
|
30
|
-
suiswap: SuiswapContract,
|
|
31
|
-
aftermath: AfterMathContract,
|
|
32
|
-
deepbook_v3: SponsoredDeepBookV3Contract,
|
|
33
|
-
flowx: FlowXContract,
|
|
34
|
-
flowx_v3: FlowxV3Contract,
|
|
35
|
-
kriya_v3: KriyaV3Contract,
|
|
36
|
-
bluefin: BluefinContract,
|
|
37
|
-
springsui: SpringSuiContract,
|
|
38
|
-
obric: ObricContract,
|
|
39
|
-
stsui: StSuiContract,
|
|
40
|
-
steamm: SteammContract,
|
|
41
|
-
steamm_oracle_quoter: SteammContract,
|
|
42
|
-
steamm_oracle_quoter_v2: SteammContract,
|
|
43
|
-
magma: MagmaContract,
|
|
44
|
-
haedal_pmm: HaedalPMMContract,
|
|
45
|
-
momentum: MomentumContract,
|
|
46
|
-
bluefinx: BluefinXContract,
|
|
47
|
-
sevenk_v1: SevenKV1,
|
|
48
|
-
fullsail: FullsailContract,
|
|
49
|
-
cetus_dlmm: CetusDLMMContract,
|
|
50
|
-
ferra_dlmm: FerraDLMMContract,
|
|
51
|
-
ferra_clmm: FerraCLMMContract,
|
|
52
|
-
};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { BaseContract } from "../base";
|
|
2
|
-
import { normalizeTokenType } from "../../../utils/token";
|
|
3
|
-
export class KriyaContract extends BaseContract {
|
|
4
|
-
async swap(tx) {
|
|
5
|
-
const swapXtoY = this.swapInfo.swapXtoY;
|
|
6
|
-
const coinInType = normalizeTokenType(this.swapInfo.assetIn);
|
|
7
|
-
const coinOutType = normalizeTokenType(this.swapInfo.assetOut);
|
|
8
|
-
const poolId = this.swapInfo.poolId;
|
|
9
|
-
const inputCoinObject = this.inputCoinObject;
|
|
10
|
-
const config = this.config.kriya;
|
|
11
|
-
const [tokenOut] = tx.moveCall({
|
|
12
|
-
target: `${config.package}::spot_dex::${swapXtoY ? "swap_token_x" : "swap_token_y"}`,
|
|
13
|
-
typeArguments: [
|
|
14
|
-
swapXtoY ? coinInType : coinOutType,
|
|
15
|
-
swapXtoY ? coinOutType : coinInType,
|
|
16
|
-
],
|
|
17
|
-
arguments: [
|
|
18
|
-
tx.object(poolId),
|
|
19
|
-
inputCoinObject,
|
|
20
|
-
this.getInputCoinValue(tx),
|
|
21
|
-
tx.pure.u64(0),
|
|
22
|
-
],
|
|
23
|
-
});
|
|
24
|
-
return tokenOut;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { BaseContract } from "../base";
|
|
2
|
-
import { SUI_CLOCK_OBJECT_ID } from "@mysten/sui/utils";
|
|
3
|
-
import { normalizeTokenType } from "../../../utils/token";
|
|
4
|
-
export class KriyaV3Contract extends BaseContract {
|
|
5
|
-
async swap(tx) {
|
|
6
|
-
const swapXtoY = this.swapInfo.swapXtoY;
|
|
7
|
-
const coinInType = normalizeTokenType(this.swapInfo.assetIn);
|
|
8
|
-
const coinOutType = normalizeTokenType(this.swapInfo.assetOut);
|
|
9
|
-
const poolId = this.swapInfo.poolId;
|
|
10
|
-
const LowLimitPrice = 4295048017;
|
|
11
|
-
const limitPrice = BigInt("79226673515401279992447579050");
|
|
12
|
-
const { package: PACKAGE_ID, version: VERSION_ID } = this.config.kriya_v3;
|
|
13
|
-
const [receive_a, receive_b, flash_receipt] = tx.moveCall({
|
|
14
|
-
target: `${PACKAGE_ID}::trade::flash_swap`,
|
|
15
|
-
typeArguments: this.getTypeParams(),
|
|
16
|
-
arguments: [
|
|
17
|
-
tx.object(poolId),
|
|
18
|
-
tx.pure.bool(swapXtoY),
|
|
19
|
-
tx.pure.bool(true),
|
|
20
|
-
this.getInputCoinValue(tx),
|
|
21
|
-
tx.pure.u128(swapXtoY ? LowLimitPrice : limitPrice),
|
|
22
|
-
tx.object(SUI_CLOCK_OBJECT_ID),
|
|
23
|
-
tx.object(VERSION_ID),
|
|
24
|
-
],
|
|
25
|
-
});
|
|
26
|
-
tx.moveCall({
|
|
27
|
-
target: `0x2::balance::destroy_zero`,
|
|
28
|
-
arguments: [swapXtoY ? receive_a : receive_b],
|
|
29
|
-
typeArguments: [coinInType],
|
|
30
|
-
});
|
|
31
|
-
const [zeroOutCoin] = tx.moveCall({
|
|
32
|
-
target: `0x2::balance::zero`,
|
|
33
|
-
arguments: [],
|
|
34
|
-
typeArguments: [coinOutType],
|
|
35
|
-
});
|
|
36
|
-
const inputCoinBalance = tx.moveCall({
|
|
37
|
-
target: `0x2::coin::into_balance`,
|
|
38
|
-
typeArguments: [coinInType],
|
|
39
|
-
arguments: [this.inputCoinObject],
|
|
40
|
-
});
|
|
41
|
-
const pay_coin_a = swapXtoY ? inputCoinBalance : zeroOutCoin;
|
|
42
|
-
const pay_coin_b = swapXtoY ? zeroOutCoin : inputCoinBalance;
|
|
43
|
-
tx.moveCall({
|
|
44
|
-
target: `${PACKAGE_ID}::trade::repay_flash_swap`,
|
|
45
|
-
typeArguments: this.getTypeParams(),
|
|
46
|
-
arguments: [
|
|
47
|
-
tx.object(poolId),
|
|
48
|
-
flash_receipt,
|
|
49
|
-
pay_coin_a,
|
|
50
|
-
pay_coin_b,
|
|
51
|
-
tx.object(VERSION_ID),
|
|
52
|
-
],
|
|
53
|
-
});
|
|
54
|
-
const [tokenOut] = tx.moveCall({
|
|
55
|
-
target: `0x2::coin::from_balance`,
|
|
56
|
-
typeArguments: [coinOutType],
|
|
57
|
-
arguments: [swapXtoY ? receive_b : receive_a],
|
|
58
|
-
});
|
|
59
|
-
return tokenOut;
|
|
60
|
-
}
|
|
61
|
-
}
|