@7kprotocol/sdk-ts 3.6.0 → 3.6.1-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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 +3 -146
- 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 +4 -147
- 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,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FlowXContract = void 0;
|
|
4
|
-
const base_1 = require("../base");
|
|
5
|
-
class FlowXContract extends base_1.BaseContract {
|
|
6
|
-
async swap(tx) {
|
|
7
|
-
const coinInType = this.swapInfo.assetIn;
|
|
8
|
-
const coinOutType = this.swapInfo.assetOut;
|
|
9
|
-
const config = this.config.flowx;
|
|
10
|
-
const [tokenOut] = tx.moveCall({
|
|
11
|
-
target: `${config.package}::router::swap_exact_input_direct`,
|
|
12
|
-
typeArguments: [coinInType, coinOutType],
|
|
13
|
-
arguments: [tx.object(config.container), this.inputCoinObject],
|
|
14
|
-
});
|
|
15
|
-
return tokenOut;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
exports.FlowXContract = FlowXContract;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FlowxV3Contract = void 0;
|
|
4
|
-
const utils_1 = require("@mysten/sui/utils");
|
|
5
|
-
const base_1 = require("../base");
|
|
6
|
-
const utils_2 = require("../utils");
|
|
7
|
-
class FlowxV3Contract extends base_1.BaseContract {
|
|
8
|
-
async swap(tx) {
|
|
9
|
-
const [coinX, coinY] = this.swapInfo.pool.allTokens;
|
|
10
|
-
const swapXtoY = this.swapInfo.swapXtoY;
|
|
11
|
-
const swapFeeRate = this.swapInfo.extra.swapFeeRate;
|
|
12
|
-
if (!swapFeeRate) {
|
|
13
|
-
throw new Error("swapFeeRate is required");
|
|
14
|
-
}
|
|
15
|
-
const config = this.config.flowx_v3;
|
|
16
|
-
const [coinOut] = tx.moveCall({
|
|
17
|
-
target: `${config.package}::swap_router::swap_exact_input`,
|
|
18
|
-
typeArguments: [
|
|
19
|
-
swapXtoY ? coinX.address : coinY.address,
|
|
20
|
-
swapXtoY ? coinY.address : coinX.address,
|
|
21
|
-
],
|
|
22
|
-
arguments: [
|
|
23
|
-
tx.object(config.registry),
|
|
24
|
-
tx.pure.u64(swapFeeRate), // swap fee rate to lookup pool in the registry
|
|
25
|
-
this.inputCoinObject,
|
|
26
|
-
tx.pure.u64(0), // min amount out
|
|
27
|
-
tx.pure.u128((0, utils_2.getDefaultSqrtPriceLimit)(swapXtoY) + (swapXtoY ? 1n : -1n)), // sqrt price limit
|
|
28
|
-
tx.pure.u64("18446744073709551615"), // u64 max value
|
|
29
|
-
tx.object(config.version),
|
|
30
|
-
tx.object(utils_1.SUI_CLOCK_OBJECT_ID),
|
|
31
|
-
],
|
|
32
|
-
});
|
|
33
|
-
return coinOut;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
exports.FlowxV3Contract = FlowxV3Contract;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FullsailContract = void 0;
|
|
4
|
-
const base_1 = require("../base");
|
|
5
|
-
const utils_1 = require("@mysten/sui/utils");
|
|
6
|
-
const sui_1 = require("../../../utils/sui");
|
|
7
|
-
const utils_2 = require("../utils");
|
|
8
|
-
class FullsailContract extends base_1.BaseContract {
|
|
9
|
-
async swap(tx) {
|
|
10
|
-
const [coinX, coinY] = this.swapInfo.pool.allTokens;
|
|
11
|
-
const swapXtoY = this.swapInfo.swapXtoY;
|
|
12
|
-
const sqrtPriceLimit = (0, utils_2.getDefaultSqrtPriceLimit)(swapXtoY);
|
|
13
|
-
const typeArguments = [coinX.address, coinY.address];
|
|
14
|
-
const zeroOut = sui_1.SuiUtils.zeroCoin(tx, swapXtoY ? coinY.address : coinX.address);
|
|
15
|
-
const config = this.config.fullsail;
|
|
16
|
-
const [receiveA, receiveB] = tx.moveCall({
|
|
17
|
-
target: `${config.package}::router::swap`,
|
|
18
|
-
typeArguments,
|
|
19
|
-
arguments: [
|
|
20
|
-
tx.object(config.globalConfig),
|
|
21
|
-
tx.object(config.rewarderGlobalVault),
|
|
22
|
-
tx.object(this.swapInfo.poolId),
|
|
23
|
-
swapXtoY ? this.inputCoinObject : zeroOut, // coin A
|
|
24
|
-
swapXtoY ? zeroOut : this.inputCoinObject, // coin B
|
|
25
|
-
tx.pure.bool(swapXtoY), // a to b or b to a
|
|
26
|
-
tx.pure.bool(true), // exact in or out
|
|
27
|
-
this.getInputCoinValue(tx), // swap amount
|
|
28
|
-
tx.pure.u128(sqrtPriceLimit.toString()), // sqrt price limit
|
|
29
|
-
tx.pure.bool(false),
|
|
30
|
-
tx.object(config.stats),
|
|
31
|
-
tx.object(config.priceProvider),
|
|
32
|
-
tx.object(utils_1.SUI_CLOCK_OBJECT_ID),
|
|
33
|
-
],
|
|
34
|
-
});
|
|
35
|
-
sui_1.SuiUtils.collectDust(tx, this.swapInfo.assetIn, swapXtoY ? receiveA : receiveB);
|
|
36
|
-
return swapXtoY ? receiveB : receiveA;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
exports.FullsailContract = FullsailContract;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.HaedalPMMContract = void 0;
|
|
4
|
-
const utils_1 = require("@mysten/sui/utils");
|
|
5
|
-
const sui_1 = require("../../../utils/sui");
|
|
6
|
-
const base_1 = require("../base");
|
|
7
|
-
class HaedalPMMContract extends base_1.BaseContract {
|
|
8
|
-
async swap(tx) {
|
|
9
|
-
const [coinX, coinY] = this.swapInfo.pool.allTokens;
|
|
10
|
-
const xToY = this.swapInfo.swapXtoY;
|
|
11
|
-
const oracleX = this.getPythPriceInfoId(this.extra.oracles?.[0]);
|
|
12
|
-
const oracleY = this.getPythPriceInfoId(this.extra.oracles?.[1]);
|
|
13
|
-
const config = this.config.haedal_pmm;
|
|
14
|
-
const [coinOut] = tx.moveCall({
|
|
15
|
-
target: `${config.package}::trader::${xToY ? "sell_base_coin" : "sell_quote_coin"}`,
|
|
16
|
-
typeArguments: [coinX.address, coinY.address],
|
|
17
|
-
arguments: [
|
|
18
|
-
tx.object(this.swapInfo.poolId),
|
|
19
|
-
tx.object(utils_1.SUI_CLOCK_OBJECT_ID),
|
|
20
|
-
tx.object(oracleX), // pyth pricefeed for x
|
|
21
|
-
tx.object(oracleY), // pyth pricefeed for y
|
|
22
|
-
this.inputCoinObject, // mutable coin
|
|
23
|
-
this.getInputCoinValue(tx), // swap amount
|
|
24
|
-
tx.pure.u64(0), // min output amount
|
|
25
|
-
],
|
|
26
|
-
});
|
|
27
|
-
sui_1.SuiUtils.collectDust(tx, this.swapInfo.assetIn, this.inputCoinObject);
|
|
28
|
-
return coinOut;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
exports.HaedalPMMContract = HaedalPMMContract;
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ProtocolContract = void 0;
|
|
4
|
-
const aftermath_1 = require("./aftermath");
|
|
5
|
-
const bluefin_1 = require("./bluefin");
|
|
6
|
-
const bluefinx_1 = require("./bluefinx");
|
|
7
|
-
const bluemove_1 = require("./bluemove");
|
|
8
|
-
const cetus_1 = require("./cetus");
|
|
9
|
-
const cetus_dlmm_1 = require("./cetus_dlmm");
|
|
10
|
-
const sponsored_1 = require("./deepbookV3/sponsored");
|
|
11
|
-
const ferra_clmm_1 = require("./ferra_clmm");
|
|
12
|
-
const ferra_dlmm_1 = require("./ferra_dlmm");
|
|
13
|
-
const flowx_1 = require("./flowx");
|
|
14
|
-
const flowxV3_1 = require("./flowxV3");
|
|
15
|
-
const fullsail_1 = require("./fullsail");
|
|
16
|
-
const haedal_pmm_1 = require("./haedal_pmm");
|
|
17
|
-
const kriya_1 = require("./kriya");
|
|
18
|
-
const kriyaV3_1 = require("./kriyaV3");
|
|
19
|
-
const magma_1 = require("./magma");
|
|
20
|
-
const momentum_1 = require("./momentum");
|
|
21
|
-
const obric_1 = require("./obric");
|
|
22
|
-
const sevenk_1 = require("./sevenk");
|
|
23
|
-
const springsui_1 = require("./springsui");
|
|
24
|
-
const steamm_1 = require("./steamm");
|
|
25
|
-
const stsui_1 = require("./stsui");
|
|
26
|
-
const suiswap_1 = require("./suiswap");
|
|
27
|
-
const turbos_1 = require("./turbos");
|
|
28
|
-
exports.ProtocolContract = {
|
|
29
|
-
cetus: cetus_1.CetusContract,
|
|
30
|
-
turbos: turbos_1.TurbosContract,
|
|
31
|
-
bluemove: bluemove_1.BluemoveContract,
|
|
32
|
-
kriya: kriya_1.KriyaContract,
|
|
33
|
-
suiswap: suiswap_1.SuiswapContract,
|
|
34
|
-
aftermath: aftermath_1.AfterMathContract,
|
|
35
|
-
deepbook_v3: sponsored_1.SponsoredDeepBookV3Contract,
|
|
36
|
-
flowx: flowx_1.FlowXContract,
|
|
37
|
-
flowx_v3: flowxV3_1.FlowxV3Contract,
|
|
38
|
-
kriya_v3: kriyaV3_1.KriyaV3Contract,
|
|
39
|
-
bluefin: bluefin_1.BluefinContract,
|
|
40
|
-
springsui: springsui_1.SpringSuiContract,
|
|
41
|
-
obric: obric_1.ObricContract,
|
|
42
|
-
stsui: stsui_1.StSuiContract,
|
|
43
|
-
steamm: steamm_1.SteammContract,
|
|
44
|
-
steamm_oracle_quoter: steamm_1.SteammContract,
|
|
45
|
-
steamm_oracle_quoter_v2: steamm_1.SteammContract,
|
|
46
|
-
magma: magma_1.MagmaContract,
|
|
47
|
-
haedal_pmm: haedal_pmm_1.HaedalPMMContract,
|
|
48
|
-
momentum: momentum_1.MomentumContract,
|
|
49
|
-
bluefinx: bluefinx_1.BluefinXContract,
|
|
50
|
-
sevenk_v1: sevenk_1.SevenKV1,
|
|
51
|
-
fullsail: fullsail_1.FullsailContract,
|
|
52
|
-
cetus_dlmm: cetus_dlmm_1.CetusDLMMContract,
|
|
53
|
-
ferra_dlmm: ferra_dlmm_1.FerraDLMMContract,
|
|
54
|
-
ferra_clmm: ferra_clmm_1.FerraCLMMContract,
|
|
55
|
-
};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.KriyaContract = void 0;
|
|
4
|
-
const base_1 = require("../base");
|
|
5
|
-
const token_1 = require("../../../utils/token");
|
|
6
|
-
class KriyaContract extends base_1.BaseContract {
|
|
7
|
-
async swap(tx) {
|
|
8
|
-
const swapXtoY = this.swapInfo.swapXtoY;
|
|
9
|
-
const coinInType = (0, token_1.normalizeTokenType)(this.swapInfo.assetIn);
|
|
10
|
-
const coinOutType = (0, token_1.normalizeTokenType)(this.swapInfo.assetOut);
|
|
11
|
-
const poolId = this.swapInfo.poolId;
|
|
12
|
-
const inputCoinObject = this.inputCoinObject;
|
|
13
|
-
const config = this.config.kriya;
|
|
14
|
-
const [tokenOut] = tx.moveCall({
|
|
15
|
-
target: `${config.package}::spot_dex::${swapXtoY ? "swap_token_x" : "swap_token_y"}`,
|
|
16
|
-
typeArguments: [
|
|
17
|
-
swapXtoY ? coinInType : coinOutType,
|
|
18
|
-
swapXtoY ? coinOutType : coinInType,
|
|
19
|
-
],
|
|
20
|
-
arguments: [
|
|
21
|
-
tx.object(poolId),
|
|
22
|
-
inputCoinObject,
|
|
23
|
-
this.getInputCoinValue(tx),
|
|
24
|
-
tx.pure.u64(0),
|
|
25
|
-
],
|
|
26
|
-
});
|
|
27
|
-
return tokenOut;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
exports.KriyaContract = KriyaContract;
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.KriyaV3Contract = void 0;
|
|
4
|
-
const base_1 = require("../base");
|
|
5
|
-
const utils_1 = require("@mysten/sui/utils");
|
|
6
|
-
const token_1 = require("../../../utils/token");
|
|
7
|
-
class KriyaV3Contract extends base_1.BaseContract {
|
|
8
|
-
async swap(tx) {
|
|
9
|
-
const swapXtoY = this.swapInfo.swapXtoY;
|
|
10
|
-
const coinInType = (0, token_1.normalizeTokenType)(this.swapInfo.assetIn);
|
|
11
|
-
const coinOutType = (0, token_1.normalizeTokenType)(this.swapInfo.assetOut);
|
|
12
|
-
const poolId = this.swapInfo.poolId;
|
|
13
|
-
const LowLimitPrice = 4295048017;
|
|
14
|
-
const limitPrice = BigInt("79226673515401279992447579050");
|
|
15
|
-
const { package: PACKAGE_ID, version: VERSION_ID } = this.config.kriya_v3;
|
|
16
|
-
const [receive_a, receive_b, flash_receipt] = tx.moveCall({
|
|
17
|
-
target: `${PACKAGE_ID}::trade::flash_swap`,
|
|
18
|
-
typeArguments: this.getTypeParams(),
|
|
19
|
-
arguments: [
|
|
20
|
-
tx.object(poolId),
|
|
21
|
-
tx.pure.bool(swapXtoY),
|
|
22
|
-
tx.pure.bool(true),
|
|
23
|
-
this.getInputCoinValue(tx),
|
|
24
|
-
tx.pure.u128(swapXtoY ? LowLimitPrice : limitPrice),
|
|
25
|
-
tx.object(utils_1.SUI_CLOCK_OBJECT_ID),
|
|
26
|
-
tx.object(VERSION_ID),
|
|
27
|
-
],
|
|
28
|
-
});
|
|
29
|
-
tx.moveCall({
|
|
30
|
-
target: `0x2::balance::destroy_zero`,
|
|
31
|
-
arguments: [swapXtoY ? receive_a : receive_b],
|
|
32
|
-
typeArguments: [coinInType],
|
|
33
|
-
});
|
|
34
|
-
const [zeroOutCoin] = tx.moveCall({
|
|
35
|
-
target: `0x2::balance::zero`,
|
|
36
|
-
arguments: [],
|
|
37
|
-
typeArguments: [coinOutType],
|
|
38
|
-
});
|
|
39
|
-
const inputCoinBalance = tx.moveCall({
|
|
40
|
-
target: `0x2::coin::into_balance`,
|
|
41
|
-
typeArguments: [coinInType],
|
|
42
|
-
arguments: [this.inputCoinObject],
|
|
43
|
-
});
|
|
44
|
-
const pay_coin_a = swapXtoY ? inputCoinBalance : zeroOutCoin;
|
|
45
|
-
const pay_coin_b = swapXtoY ? zeroOutCoin : inputCoinBalance;
|
|
46
|
-
tx.moveCall({
|
|
47
|
-
target: `${PACKAGE_ID}::trade::repay_flash_swap`,
|
|
48
|
-
typeArguments: this.getTypeParams(),
|
|
49
|
-
arguments: [
|
|
50
|
-
tx.object(poolId),
|
|
51
|
-
flash_receipt,
|
|
52
|
-
pay_coin_a,
|
|
53
|
-
pay_coin_b,
|
|
54
|
-
tx.object(VERSION_ID),
|
|
55
|
-
],
|
|
56
|
-
});
|
|
57
|
-
const [tokenOut] = tx.moveCall({
|
|
58
|
-
target: `0x2::coin::from_balance`,
|
|
59
|
-
typeArguments: [coinOutType],
|
|
60
|
-
arguments: [swapXtoY ? receive_b : receive_a],
|
|
61
|
-
});
|
|
62
|
-
return tokenOut;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
exports.KriyaV3Contract = KriyaV3Contract;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MagmaContract = void 0;
|
|
4
|
-
const base_1 = require("../base");
|
|
5
|
-
const utils_1 = require("@mysten/sui/utils");
|
|
6
|
-
const utils_2 = require("../utils");
|
|
7
|
-
const sui_1 = require("../../../utils/sui");
|
|
8
|
-
class MagmaContract extends base_1.BaseContract {
|
|
9
|
-
async swap(tx) {
|
|
10
|
-
const [coinX, coinY] = this.swapInfo.pool.allTokens;
|
|
11
|
-
const swapXtoY = this.swapInfo.swapXtoY;
|
|
12
|
-
const sqrtPriceLimit = (0, utils_2.getDefaultSqrtPriceLimit)(swapXtoY);
|
|
13
|
-
const typeArguments = [coinX.address, coinY.address];
|
|
14
|
-
const [zeroOut] = tx.moveCall({
|
|
15
|
-
target: "0x2::coin::zero",
|
|
16
|
-
typeArguments: [swapXtoY ? coinY.address : coinX.address],
|
|
17
|
-
});
|
|
18
|
-
const amountIn = sui_1.SuiUtils.getCoinValue(swapXtoY ? coinX.address : coinY.address, this.inputCoinObject, tx);
|
|
19
|
-
const config = this.config.magma;
|
|
20
|
-
const [receiveA, receiveB] = tx.moveCall({
|
|
21
|
-
target: `${config.package}::router::swap`,
|
|
22
|
-
typeArguments,
|
|
23
|
-
arguments: [
|
|
24
|
-
tx.object(config.globalConfig),
|
|
25
|
-
tx.object(this.swapInfo.poolId),
|
|
26
|
-
swapXtoY ? this.inputCoinObject : zeroOut, // coin A
|
|
27
|
-
swapXtoY ? zeroOut : this.inputCoinObject, // coin B
|
|
28
|
-
tx.pure.bool(swapXtoY), // a to b or b to a
|
|
29
|
-
tx.pure.bool(true), // exact in or out
|
|
30
|
-
amountIn, // swap amount
|
|
31
|
-
tx.pure.u128(sqrtPriceLimit.toString()), // sqrt price limit
|
|
32
|
-
tx.pure.bool(false),
|
|
33
|
-
tx.object(utils_1.SUI_CLOCK_OBJECT_ID),
|
|
34
|
-
],
|
|
35
|
-
});
|
|
36
|
-
sui_1.SuiUtils.collectDust(tx, this.swapInfo.assetIn, swapXtoY ? receiveA : receiveB);
|
|
37
|
-
return swapXtoY ? receiveB : receiveA;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
exports.MagmaContract = MagmaContract;
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MomentumContract = void 0;
|
|
4
|
-
const base_1 = require("../base");
|
|
5
|
-
const utils_1 = require("@mysten/sui/utils");
|
|
6
|
-
const utils_2 = require("../utils");
|
|
7
|
-
const sui_1 = require("../../../utils/sui");
|
|
8
|
-
class MomentumContract extends base_1.BaseContract {
|
|
9
|
-
async swap(tx) {
|
|
10
|
-
const [coinX, coinY] = this.swapInfo.pool.allTokens;
|
|
11
|
-
const swapXtoY = this.swapInfo.swapXtoY;
|
|
12
|
-
const sqrtPriceLimit = (0, utils_2.getDefaultSqrtPriceLimit)(swapXtoY);
|
|
13
|
-
const typeArguments = [coinX.address, coinY.address];
|
|
14
|
-
const { package: packageId, version } = this.config.momentum;
|
|
15
|
-
const [receiveA, receiveB, debt] = tx.moveCall({
|
|
16
|
-
target: `${packageId}::trade::flash_swap`,
|
|
17
|
-
typeArguments,
|
|
18
|
-
arguments: [
|
|
19
|
-
tx.object(this.swapInfo.poolId),
|
|
20
|
-
tx.pure.bool(swapXtoY), // a2b
|
|
21
|
-
tx.pure.bool(true), // exact in
|
|
22
|
-
this.getInputCoinValue(tx),
|
|
23
|
-
tx.pure.u128(sqrtPriceLimit.toString()), // sqrt price limit
|
|
24
|
-
tx.object(utils_1.SUI_CLOCK_OBJECT_ID),
|
|
25
|
-
tx.object(version),
|
|
26
|
-
],
|
|
27
|
-
});
|
|
28
|
-
tx.moveCall({
|
|
29
|
-
target: `${packageId}::trade::repay_flash_swap`,
|
|
30
|
-
typeArguments,
|
|
31
|
-
arguments: [
|
|
32
|
-
tx.object(this.swapInfo.poolId),
|
|
33
|
-
debt,
|
|
34
|
-
swapXtoY
|
|
35
|
-
? sui_1.SuiUtils.coinIntoBalance(tx, coinX.address, this.inputCoinObject)
|
|
36
|
-
: sui_1.SuiUtils.zeroBalance(tx, coinX.address),
|
|
37
|
-
swapXtoY
|
|
38
|
-
? sui_1.SuiUtils.zeroBalance(tx, coinY.address)
|
|
39
|
-
: sui_1.SuiUtils.coinIntoBalance(tx, coinY.address, this.inputCoinObject),
|
|
40
|
-
tx.object(version),
|
|
41
|
-
],
|
|
42
|
-
});
|
|
43
|
-
const receiveACoin = sui_1.SuiUtils.coinFromBalance(tx, coinX.address, receiveA);
|
|
44
|
-
const receiveBCoin = sui_1.SuiUtils.coinFromBalance(tx, coinY.address, receiveB);
|
|
45
|
-
sui_1.SuiUtils.collectDust(tx, this.swapInfo.assetIn, swapXtoY ? receiveACoin : receiveBCoin);
|
|
46
|
-
return swapXtoY ? receiveBCoin : receiveACoin;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
exports.MomentumContract = MomentumContract;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ObricContract = void 0;
|
|
4
|
-
const utils_1 = require("@mysten/sui/utils");
|
|
5
|
-
const base_1 = require("../base");
|
|
6
|
-
class ObricContract extends base_1.BaseContract {
|
|
7
|
-
async swap(tx) {
|
|
8
|
-
const [coinX, coinY] = this.swapInfo.pool.allTokens;
|
|
9
|
-
const xToY = this.swapInfo.swapXtoY;
|
|
10
|
-
const oracleX = this.getPythPriceInfoId(this.extra.oracles?.[0]);
|
|
11
|
-
const oracleY = this.getPythPriceInfoId(this.extra.oracles?.[1]);
|
|
12
|
-
const { package: PACKAGE_ID, pythState: PYTH_STATE } = this.config.obric;
|
|
13
|
-
const [coinOut] = tx.moveCall({
|
|
14
|
-
target: `${PACKAGE_ID}::v2::${xToY ? "swap_x_to_y" : "swap_y_to_x"}`,
|
|
15
|
-
typeArguments: [coinX.address, coinY.address],
|
|
16
|
-
arguments: [
|
|
17
|
-
tx.object(this.swapInfo.poolId),
|
|
18
|
-
tx.object(utils_1.SUI_CLOCK_OBJECT_ID),
|
|
19
|
-
tx.object(PYTH_STATE),
|
|
20
|
-
tx.object(oracleX), // pyth pricefeed for x
|
|
21
|
-
tx.object(oracleY), // pyth pricefeed for y
|
|
22
|
-
this.inputCoinObject,
|
|
23
|
-
],
|
|
24
|
-
});
|
|
25
|
-
return coinOut;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
exports.ObricContract = ObricContract;
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SevenKV1 = void 0;
|
|
4
|
-
const utils_1 = require("@mysten/sui/utils");
|
|
5
|
-
const base_1 = require("../base");
|
|
6
|
-
class SevenKV1 extends base_1.BaseContract {
|
|
7
|
-
async swap(tx) {
|
|
8
|
-
const x2y = this.swapInfo.swapXtoY;
|
|
9
|
-
const config = this.config.sevenk_v1;
|
|
10
|
-
const [coinOut] = tx.moveCall({
|
|
11
|
-
target: `${config.package}::pool_v1::${x2y ? "swap_x_to_y" : "swap_y_to_x"}`,
|
|
12
|
-
typeArguments: (0, utils_1.parseStructTag)(this.extra.poolStructTag).typeParams.map(utils_1.normalizeStructTag),
|
|
13
|
-
arguments: [
|
|
14
|
-
tx.object(this.swapInfo.poolId),
|
|
15
|
-
this.getOraclePriceUpdate(tx),
|
|
16
|
-
this.inputCoinObject,
|
|
17
|
-
tx.pure.u64(0),
|
|
18
|
-
],
|
|
19
|
-
});
|
|
20
|
-
return coinOut;
|
|
21
|
-
}
|
|
22
|
-
getOraclePriceUpdate(tx) {
|
|
23
|
-
const oracleX = this.extra.oracles?.[0]?.Pyth?.bytes;
|
|
24
|
-
const oracleY = this.extra.oracles?.[1]?.Pyth?.bytes;
|
|
25
|
-
if (!oracleX ||
|
|
26
|
-
!oracleY ||
|
|
27
|
-
!this.extra.oracleConfigX ||
|
|
28
|
-
!this.extra.oracleConfigY) {
|
|
29
|
-
throw new Error(`Invalid oracle info for getOraclePriceUpdate`);
|
|
30
|
-
}
|
|
31
|
-
const [holder] = tx.moveCall({
|
|
32
|
-
target: `${this.config.sevenk_v1.oracle}::oracle::new_holder`,
|
|
33
|
-
});
|
|
34
|
-
tx.moveCall({
|
|
35
|
-
target: `${this.config.sevenk_v1.oracle}::pyth::get_price`,
|
|
36
|
-
arguments: [
|
|
37
|
-
tx.object(this.extra.oracleConfigX),
|
|
38
|
-
holder,
|
|
39
|
-
tx.object(this.pythMap["0x" + (0, utils_1.toHex)(Uint8Array.from(oracleX))]),
|
|
40
|
-
tx.object(utils_1.SUI_CLOCK_OBJECT_ID),
|
|
41
|
-
],
|
|
42
|
-
});
|
|
43
|
-
tx.moveCall({
|
|
44
|
-
target: `${this.config.sevenk_v1.oracle}::pyth::get_price`,
|
|
45
|
-
arguments: [
|
|
46
|
-
tx.object(this.extra.oracleConfigY),
|
|
47
|
-
holder,
|
|
48
|
-
tx.object(this.pythMap["0x" + (0, utils_1.toHex)(Uint8Array.from(oracleY))]),
|
|
49
|
-
tx.object(utils_1.SUI_CLOCK_OBJECT_ID),
|
|
50
|
-
],
|
|
51
|
-
});
|
|
52
|
-
return holder;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
exports.SevenKV1 = SevenKV1;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SpringSuiContract = void 0;
|
|
4
|
-
const utils_1 = require("@mysten/sui/utils");
|
|
5
|
-
const base_1 = require("../base");
|
|
6
|
-
class SpringSuiContract extends base_1.BaseContract {
|
|
7
|
-
async swap(tx) {
|
|
8
|
-
// coinX is always SUI
|
|
9
|
-
const coinY = this.swapInfo.pool.allTokens[1];
|
|
10
|
-
const isStake = this.swapInfo.swapXtoY;
|
|
11
|
-
const { package: PACKAGE_ID } = this.config.springsui;
|
|
12
|
-
const [coinOut] = tx.moveCall({
|
|
13
|
-
target: `${PACKAGE_ID}::liquid_staking::${isStake ? "mint" : "redeem"}`,
|
|
14
|
-
typeArguments: [coinY.address],
|
|
15
|
-
arguments: [
|
|
16
|
-
tx.object(this.swapInfo.poolId),
|
|
17
|
-
isStake ? tx.object(utils_1.SUI_SYSTEM_STATE_OBJECT_ID) : this.inputCoinObject,
|
|
18
|
-
isStake ? this.inputCoinObject : tx.object(utils_1.SUI_SYSTEM_STATE_OBJECT_ID),
|
|
19
|
-
],
|
|
20
|
-
});
|
|
21
|
-
return coinOut;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
exports.SpringSuiContract = SpringSuiContract;
|
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SteammContract = void 0;
|
|
4
|
-
const utils_1 = require("@mysten/sui/utils");
|
|
5
|
-
const sui_1 = require("../../../utils/sui");
|
|
6
|
-
const base_1 = require("../base");
|
|
7
|
-
class SteammContract extends base_1.BaseContract {
|
|
8
|
-
async swap(tx) {
|
|
9
|
-
if (this.extra.poolStructTag.includes("omm::OracleQuoter")) {
|
|
10
|
-
return this.ommSwap(tx, "v1");
|
|
11
|
-
}
|
|
12
|
-
else if (this.extra.poolStructTag.includes("omm_v2::OracleQuoterV2")) {
|
|
13
|
-
return this.ommSwap(tx, "v2");
|
|
14
|
-
}
|
|
15
|
-
else if (this.extra.poolStructTag.includes("cpmm::CpQuoter")) {
|
|
16
|
-
return this.cpmmSwap(tx);
|
|
17
|
-
}
|
|
18
|
-
throw new Error(`Unsupported pool type: ${this.extra.poolStructTag}`);
|
|
19
|
-
}
|
|
20
|
-
cpmmSwap(tx) {
|
|
21
|
-
const extra = this.extra;
|
|
22
|
-
if (!extra ||
|
|
23
|
-
!extra.bankAStructTag ||
|
|
24
|
-
!extra.bankBStructTag ||
|
|
25
|
-
!extra.poolStructTag ||
|
|
26
|
-
!extra.bankA ||
|
|
27
|
-
!extra.bankB ||
|
|
28
|
-
!extra.lendingMarketA ||
|
|
29
|
-
!extra.lendingMarketB) {
|
|
30
|
-
throw new Error(`Invalid extra info for cpmmSwap`);
|
|
31
|
-
}
|
|
32
|
-
// the pool script v1 only support same lending market
|
|
33
|
-
if (extra.lendingMarketA !== extra.lendingMarketB) {
|
|
34
|
-
throw new Error(`Invalid lending market for cpmmSwap`);
|
|
35
|
-
}
|
|
36
|
-
const [btokenA, bTokenB, _quoter, lp] = (0, utils_1.parseStructTag)(extra.poolStructTag).typeParams;
|
|
37
|
-
const [lendingMarket, coinTypeA, _bTokenA] = (0, utils_1.parseStructTag)(extra.bankAStructTag).typeParams;
|
|
38
|
-
const [_lendingMarket, coinTypeB, _bTokenB] = (0, utils_1.parseStructTag)(extra.bankBStructTag).typeParams;
|
|
39
|
-
const xToY = this.swapInfo.swapXtoY;
|
|
40
|
-
const coinA = xToY
|
|
41
|
-
? this.inputCoinObject
|
|
42
|
-
: sui_1.SuiUtils.zeroCoin(tx, (0, utils_1.normalizeStructTag)(coinTypeA));
|
|
43
|
-
const coinB = !xToY
|
|
44
|
-
? this.inputCoinObject
|
|
45
|
-
: sui_1.SuiUtils.zeroCoin(tx, (0, utils_1.normalizeStructTag)(coinTypeB));
|
|
46
|
-
tx.moveCall({
|
|
47
|
-
target: `${this.config.steamm.script}::pool_script::cpmm_swap`,
|
|
48
|
-
typeArguments: [
|
|
49
|
-
lendingMarket,
|
|
50
|
-
coinTypeA,
|
|
51
|
-
coinTypeB,
|
|
52
|
-
btokenA,
|
|
53
|
-
bTokenB,
|
|
54
|
-
lp,
|
|
55
|
-
].map(utils_1.normalizeStructTag),
|
|
56
|
-
arguments: [
|
|
57
|
-
tx.object(this.swapInfo.poolId),
|
|
58
|
-
tx.object(extra.bankA),
|
|
59
|
-
tx.object(extra.bankB),
|
|
60
|
-
tx.object(extra.lendingMarketA),
|
|
61
|
-
coinA,
|
|
62
|
-
coinB,
|
|
63
|
-
tx.pure.bool(xToY),
|
|
64
|
-
this.getInputCoinValue(tx),
|
|
65
|
-
tx.pure.u64(0),
|
|
66
|
-
tx.object(utils_1.SUI_CLOCK_OBJECT_ID),
|
|
67
|
-
],
|
|
68
|
-
});
|
|
69
|
-
const coinIn = xToY ? coinA : coinB;
|
|
70
|
-
const coinOut = xToY ? coinB : coinA;
|
|
71
|
-
sui_1.SuiUtils.collectDust(tx, this.swapInfo.assetIn, coinIn);
|
|
72
|
-
return coinOut;
|
|
73
|
-
}
|
|
74
|
-
ommSwap(tx, version) {
|
|
75
|
-
const extra = this.swapInfo.extra;
|
|
76
|
-
if (!extra ||
|
|
77
|
-
!extra.bankAStructTag ||
|
|
78
|
-
!extra.bankBStructTag ||
|
|
79
|
-
!extra.poolStructTag ||
|
|
80
|
-
!extra.bankA ||
|
|
81
|
-
!extra.bankB ||
|
|
82
|
-
!extra.lendingMarketA ||
|
|
83
|
-
!extra.lendingMarketB) {
|
|
84
|
-
throw new Error(`Invalid extra info for cpmmSwap`);
|
|
85
|
-
}
|
|
86
|
-
// the pool script v1 only support same lending market
|
|
87
|
-
if (extra.lendingMarketA !== extra.lendingMarketB) {
|
|
88
|
-
throw new Error(`Invalid lending market for ommSwap`);
|
|
89
|
-
}
|
|
90
|
-
const [btokenA, bTokenB, _quoter, lp] = (0, utils_1.parseStructTag)(extra.poolStructTag).typeParams;
|
|
91
|
-
const [lendingMarket, coinTypeA, _bTokenA] = (0, utils_1.parseStructTag)(extra.bankAStructTag).typeParams;
|
|
92
|
-
const [_lendingMarket, coinTypeB, _bTokenB] = (0, utils_1.parseStructTag)(extra.bankBStructTag).typeParams;
|
|
93
|
-
const xToY = this.swapInfo.swapXtoY;
|
|
94
|
-
const coinA = xToY
|
|
95
|
-
? this.inputCoinObject
|
|
96
|
-
: sui_1.SuiUtils.zeroCoin(tx, (0, utils_1.normalizeStructTag)(coinTypeA));
|
|
97
|
-
const coinB = !xToY
|
|
98
|
-
? this.inputCoinObject
|
|
99
|
-
: sui_1.SuiUtils.zeroCoin(tx, (0, utils_1.normalizeStructTag)(coinTypeB));
|
|
100
|
-
const [priceA, priceB] = this.getOraclePriceUpdate(tx);
|
|
101
|
-
tx.moveCall({
|
|
102
|
-
target: `${this.config.steamm.script}::pool_script_v2::${version === "v1" ? "omm_swap" : "omm_v2_swap"}`,
|
|
103
|
-
typeArguments: [
|
|
104
|
-
lendingMarket,
|
|
105
|
-
coinTypeA,
|
|
106
|
-
coinTypeB,
|
|
107
|
-
btokenA,
|
|
108
|
-
bTokenB,
|
|
109
|
-
lp,
|
|
110
|
-
].map(utils_1.normalizeStructTag),
|
|
111
|
-
arguments: [
|
|
112
|
-
tx.object(this.swapInfo.poolId),
|
|
113
|
-
tx.object(extra.bankA),
|
|
114
|
-
tx.object(extra.bankB),
|
|
115
|
-
tx.object(extra.lendingMarketA),
|
|
116
|
-
priceA,
|
|
117
|
-
priceB,
|
|
118
|
-
coinA,
|
|
119
|
-
coinB,
|
|
120
|
-
tx.pure.bool(xToY),
|
|
121
|
-
this.getInputCoinValue(tx),
|
|
122
|
-
tx.pure.u64(0),
|
|
123
|
-
tx.object(utils_1.SUI_CLOCK_OBJECT_ID),
|
|
124
|
-
],
|
|
125
|
-
});
|
|
126
|
-
const coinIn = xToY ? coinA : coinB;
|
|
127
|
-
const coinOut = xToY ? coinB : coinA;
|
|
128
|
-
sui_1.SuiUtils.collectDust(tx, this.swapInfo.assetIn, coinIn);
|
|
129
|
-
return coinOut;
|
|
130
|
-
}
|
|
131
|
-
getOraclePriceUpdate(tx) {
|
|
132
|
-
const oracleA = this.getPythPriceInfoId(this.extra.oracles?.[0]);
|
|
133
|
-
const oracleB = this.getPythPriceInfoId(this.extra.oracles?.[1]);
|
|
134
|
-
const registry = this.extra.oracleRegistry;
|
|
135
|
-
const indexes = this.extra.oracleIndexes;
|
|
136
|
-
if (!registry || indexes?.length !== 2) {
|
|
137
|
-
throw new Error(`Invalid oracle info for getOraclePriceUpdate`);
|
|
138
|
-
}
|
|
139
|
-
const [a] = tx.moveCall({
|
|
140
|
-
target: `${this.config.steamm.oracle}::oracles::get_pyth_price`,
|
|
141
|
-
arguments: [
|
|
142
|
-
tx.object(registry),
|
|
143
|
-
tx.object(oracleA),
|
|
144
|
-
tx.pure.u64(indexes[0]),
|
|
145
|
-
tx.object(utils_1.SUI_CLOCK_OBJECT_ID),
|
|
146
|
-
],
|
|
147
|
-
});
|
|
148
|
-
const [b] = tx.moveCall({
|
|
149
|
-
target: `${this.config.steamm.oracle}::oracles::get_pyth_price`,
|
|
150
|
-
arguments: [
|
|
151
|
-
tx.object(registry),
|
|
152
|
-
tx.object(oracleB),
|
|
153
|
-
tx.pure.u64(indexes[1]),
|
|
154
|
-
tx.object(utils_1.SUI_CLOCK_OBJECT_ID),
|
|
155
|
-
],
|
|
156
|
-
});
|
|
157
|
-
return [a, b];
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
exports.SteammContract = SteammContract;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.StSuiContract = void 0;
|
|
4
|
-
const utils_1 = require("@mysten/sui/utils");
|
|
5
|
-
const base_1 = require("../base");
|
|
6
|
-
class StSuiContract extends base_1.BaseContract {
|
|
7
|
-
async swap(tx) {
|
|
8
|
-
// coinX is always SUI
|
|
9
|
-
const coinY = this.swapInfo.pool.allTokens[1];
|
|
10
|
-
const isStake = this.swapInfo.swapXtoY;
|
|
11
|
-
const { package: PACKAGE_ID } = this.config.stsui;
|
|
12
|
-
const [coinOut] = tx.moveCall({
|
|
13
|
-
target: `${PACKAGE_ID}::liquid_staking::${isStake ? "mint" : "redeem"}`,
|
|
14
|
-
typeArguments: [coinY.address],
|
|
15
|
-
arguments: [
|
|
16
|
-
tx.object(this.swapInfo.poolId),
|
|
17
|
-
isStake ? tx.object(utils_1.SUI_SYSTEM_STATE_OBJECT_ID) : this.inputCoinObject,
|
|
18
|
-
isStake ? this.inputCoinObject : tx.object(utils_1.SUI_SYSTEM_STATE_OBJECT_ID),
|
|
19
|
-
],
|
|
20
|
-
});
|
|
21
|
-
return coinOut;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
exports.StSuiContract = StSuiContract;
|