@7kprotocol/sdk-ts 3.5.4 → 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 +103 -0
- package/lib/cjs/features/metaAg/error.js +31 -0
- package/lib/cjs/features/metaAg/index.js +96 -117
- package/lib/cjs/features/metaAg/providers/bluefin7k.js +57 -0
- package/lib/cjs/features/metaAg/providers/cetus.js +7 -7
- package/lib/cjs/features/metaAg/providers/flowx.js +6 -6
- package/lib/cjs/features/metaAg/providers/okx.js +182 -0
- 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 +24 -0
- package/lib/cjs/types/features/metaAg/common.d.ts.map +1 -0
- package/lib/cjs/types/features/metaAg/error.d.ts +54 -0
- package/lib/cjs/types/features/metaAg/error.d.ts.map +1 -0
- package/lib/cjs/types/features/metaAg/index.d.ts +11 -2
- package/lib/cjs/types/features/metaAg/index.d.ts.map +1 -1
- package/lib/cjs/types/features/metaAg/providers/bluefin7k.d.ts +11 -0
- package/lib/cjs/types/features/metaAg/providers/bluefin7k.d.ts.map +1 -0
- package/lib/cjs/types/features/metaAg/providers/cetus.d.ts +4 -5
- package/lib/cjs/types/features/metaAg/providers/cetus.d.ts.map +1 -1
- package/lib/cjs/types/features/metaAg/providers/flowx.d.ts +3 -3
- package/lib/cjs/types/features/metaAg/providers/flowx.d.ts.map +1 -1
- package/lib/cjs/types/features/metaAg/providers/okx.d.ts +21 -0
- package/lib/cjs/types/features/metaAg/providers/okx.d.ts.map +1 -0
- 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 -30
- package/lib/cjs/types/index.d.ts.map +1 -1
- package/lib/cjs/types/metaAg.js +8 -4
- package/lib/cjs/types/okx.js +6 -0
- package/lib/cjs/types/types/metaAg.d.ts +50 -12
- package/lib/cjs/types/types/metaAg.d.ts.map +1 -1
- package/lib/cjs/types/types/okx.d.ts +206 -0
- package/lib/cjs/types/types/okx.d.ts.map +1 -0
- package/lib/cjs/types/utils/sui.d.ts +1 -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 +19 -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 +96 -0
- package/lib/esm/features/metaAg/error.js +29 -0
- package/lib/esm/features/metaAg/index.js +96 -117
- package/lib/esm/features/metaAg/providers/{bluefin.js → bluefin7k.js} +12 -23
- package/lib/esm/features/metaAg/providers/cetus.js +7 -7
- package/lib/esm/features/metaAg/providers/flowx.js +6 -6
- package/lib/esm/features/metaAg/providers/okx.js +147 -0
- 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 +24 -0
- package/lib/esm/types/features/metaAg/common.d.ts.map +1 -0
- package/lib/esm/types/features/metaAg/error.d.ts +54 -0
- package/lib/esm/types/features/metaAg/error.d.ts.map +1 -0
- package/lib/esm/types/features/metaAg/index.d.ts +11 -2
- package/lib/esm/types/features/metaAg/index.d.ts.map +1 -1
- package/lib/esm/types/features/metaAg/providers/bluefin7k.d.ts +11 -0
- package/lib/esm/types/features/metaAg/providers/bluefin7k.d.ts.map +1 -0
- package/lib/esm/types/features/metaAg/providers/cetus.d.ts +4 -5
- package/lib/esm/types/features/metaAg/providers/cetus.d.ts.map +1 -1
- package/lib/esm/types/features/metaAg/providers/flowx.d.ts +3 -3
- package/lib/esm/types/features/metaAg/providers/flowx.d.ts.map +1 -1
- package/lib/esm/types/features/metaAg/providers/okx.d.ts +21 -0
- package/lib/esm/types/features/metaAg/providers/okx.d.ts.map +1 -0
- 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 -30
- package/lib/esm/types/index.d.ts.map +1 -1
- package/lib/esm/types/metaAg.js +5 -2
- package/lib/esm/types/okx.js +5 -0
- package/lib/esm/types/types/metaAg.d.ts +50 -12
- package/lib/esm/types/types/metaAg.d.ts.map +1 -1
- package/lib/esm/types/types/okx.d.ts +206 -0
- package/lib/esm/types/types/okx.d.ts.map +1 -0
- package/lib/esm/types/utils/sui.d.ts +1 -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 +19 -147
- package/lib/esm/utils/swap.js +33 -0
- package/package.json +3 -1
- package/lib/cjs/config/index.js +0 -58
- package/lib/cjs/features/metaAg/providers/bluefin.js +0 -68
- package/lib/cjs/features/swap/buildTx.js +0 -195
- package/lib/cjs/features/swap/buildTxV2.js +0 -225
- package/lib/cjs/features/swap/config.js +0 -153
- 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 -94
- 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 -26
- package/lib/cjs/types/config/index.d.ts.map +0 -1
- package/lib/cjs/types/features/metaAg/providers/bluefin.d.ts +0 -11
- package/lib/cjs/types/features/metaAg/providers/bluefin.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 -29
- 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/condition.d.ts +0 -2
- package/lib/cjs/types/utils/condition.d.ts.map +0 -1
- 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/condition.js +0 -8
- package/lib/cjs/utils/number.js +0 -9
- package/lib/esm/config/index.js +0 -55
- package/lib/esm/features/swap/buildTx.js +0 -185
- package/lib/esm/features/swap/buildTxV2.js +0 -219
- package/lib/esm/features/swap/config.js +0 -149
- 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 -90
- 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 -26
- package/lib/esm/types/config/index.d.ts.map +0 -1
- package/lib/esm/types/features/metaAg/providers/bluefin.d.ts +0 -11
- package/lib/esm/types/features/metaAg/providers/bluefin.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 -29
- 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/condition.d.ts +0 -2
- package/lib/esm/types/utils/condition.d.ts.map +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/condition.js +0 -5
- package/lib/esm/utils/number.js +0 -6
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
import { Transaction, TransactionObjectArgument } from "@mysten/sui/transactions";
|
|
2
|
-
import { BluefinXTx } from "../libs/protocols/bluefinx/types";
|
|
3
|
-
export { BluefinXTx };
|
|
4
|
-
export type SourceDex = "suiswap" | "turbos" | "cetus" | "bluemove" | "kriya" | "kriya_v3" | "aftermath" | "deepbook_v3" | "flowx" | "flowx_v3" | "bluefin" | "bluefinx" | "springsui" | "obric" | "stsui" | "steamm" | "steamm_oracle_quoter" | "steamm_oracle_quoter_v2" | "magma" | "haedal_pmm" | "momentum" | "sevenk_v1" | "fullsail" | "cetus_dlmm" | "ferra_dlmm" | "ferra_clmm";
|
|
5
|
-
export type SorSwap = {
|
|
6
|
-
poolId: string;
|
|
7
|
-
assetInIndex: number;
|
|
8
|
-
assetOutIndex: number;
|
|
9
|
-
amount: string;
|
|
10
|
-
returnAmount: string;
|
|
11
|
-
assetIn: string;
|
|
12
|
-
assetOut: string;
|
|
13
|
-
functionName: string;
|
|
14
|
-
arguments: string[];
|
|
15
|
-
extra?: any;
|
|
16
|
-
};
|
|
17
|
-
export type SorPool = {
|
|
18
|
-
allTokens: Array<{
|
|
19
|
-
address: string;
|
|
20
|
-
decimal: number;
|
|
21
|
-
}>;
|
|
22
|
-
type: SourceDex;
|
|
23
|
-
};
|
|
24
|
-
export type SorHop = {
|
|
25
|
-
poolId: string;
|
|
26
|
-
tokenInAmount: string;
|
|
27
|
-
tokenOutAmount: string;
|
|
28
|
-
tokenIn: string;
|
|
29
|
-
tokenOut: string;
|
|
30
|
-
pool: SorPool;
|
|
31
|
-
};
|
|
32
|
-
export type SorRoute = {
|
|
33
|
-
hops: SorHop[];
|
|
34
|
-
share?: number;
|
|
35
|
-
tokenIn: string;
|
|
36
|
-
tokenInAmount: string;
|
|
37
|
-
tokenOut: string;
|
|
38
|
-
tokenOutAmount: string;
|
|
39
|
-
};
|
|
40
|
-
export type QuoteResponse = {
|
|
41
|
-
effectivePrice: number | null;
|
|
42
|
-
effectivePriceReserved: number | null;
|
|
43
|
-
priceImpact: number | null;
|
|
44
|
-
swapAmount: string;
|
|
45
|
-
returnAmount: string;
|
|
46
|
-
returnAmountWithDecimal: string;
|
|
47
|
-
returnAmountAfterCommission: string;
|
|
48
|
-
returnAmountAfterCommissionWithDecimal: string;
|
|
49
|
-
returnAmountConsiderGasFees?: string;
|
|
50
|
-
returnAmountWithoutSwapFees?: string;
|
|
51
|
-
swapAmountWithDecimal: string;
|
|
52
|
-
tokenAddresses: string[];
|
|
53
|
-
tokenIn: string;
|
|
54
|
-
tokenOut: string;
|
|
55
|
-
marketSp: string;
|
|
56
|
-
routes?: SorRoute[];
|
|
57
|
-
swaps: SorSwap[];
|
|
58
|
-
warning: string;
|
|
59
|
-
};
|
|
60
|
-
export interface Coin {
|
|
61
|
-
type: string;
|
|
62
|
-
decimals: number;
|
|
63
|
-
}
|
|
64
|
-
export interface TxSorSwap extends SorSwap {
|
|
65
|
-
pool: SorPool;
|
|
66
|
-
coinX: Coin;
|
|
67
|
-
coinY: Coin;
|
|
68
|
-
swapXtoY: boolean;
|
|
69
|
-
}
|
|
70
|
-
export interface Commission {
|
|
71
|
-
partner: string;
|
|
72
|
-
commissionBps: number;
|
|
73
|
-
}
|
|
74
|
-
export interface DexConfig {
|
|
75
|
-
package: string;
|
|
76
|
-
name: string;
|
|
77
|
-
url?: string;
|
|
78
|
-
image?: string;
|
|
79
|
-
}
|
|
80
|
-
export interface Config {
|
|
81
|
-
aftermath: DexConfig & {
|
|
82
|
-
poolRegistry: string;
|
|
83
|
-
protocolFeeVault: string;
|
|
84
|
-
treasury: string;
|
|
85
|
-
insuranceFund: string;
|
|
86
|
-
referralVault: string;
|
|
87
|
-
};
|
|
88
|
-
bluefin: DexConfig & {
|
|
89
|
-
globalConfig: string;
|
|
90
|
-
};
|
|
91
|
-
bluefinx: DexConfig & {
|
|
92
|
-
globalConfig: string;
|
|
93
|
-
};
|
|
94
|
-
bluemove: DexConfig & {
|
|
95
|
-
dexInfo: string;
|
|
96
|
-
};
|
|
97
|
-
cetus: DexConfig & {
|
|
98
|
-
globalConfig: string;
|
|
99
|
-
};
|
|
100
|
-
deepbook_v3: DexConfig & {
|
|
101
|
-
sponsor: string;
|
|
102
|
-
sponsorFund: string;
|
|
103
|
-
};
|
|
104
|
-
flowx: DexConfig & {
|
|
105
|
-
container: string;
|
|
106
|
-
};
|
|
107
|
-
flowx_v3: DexConfig & {
|
|
108
|
-
registry: string;
|
|
109
|
-
version: string;
|
|
110
|
-
};
|
|
111
|
-
kriya: DexConfig;
|
|
112
|
-
kriya_v3: DexConfig & {
|
|
113
|
-
version: string;
|
|
114
|
-
};
|
|
115
|
-
obric: DexConfig & {
|
|
116
|
-
pythState: string;
|
|
117
|
-
};
|
|
118
|
-
springsui: DexConfig;
|
|
119
|
-
stsui: DexConfig;
|
|
120
|
-
suiswap: DexConfig;
|
|
121
|
-
turbos: DexConfig & {
|
|
122
|
-
version: string;
|
|
123
|
-
};
|
|
124
|
-
steamm: DexConfig & {
|
|
125
|
-
script: string;
|
|
126
|
-
oracle: string;
|
|
127
|
-
};
|
|
128
|
-
magma: DexConfig & {
|
|
129
|
-
globalConfig: string;
|
|
130
|
-
};
|
|
131
|
-
haedal_pmm: DexConfig;
|
|
132
|
-
momentum: DexConfig & {
|
|
133
|
-
version: string;
|
|
134
|
-
};
|
|
135
|
-
sevenk_v1: DexConfig & {
|
|
136
|
-
oracle: string;
|
|
137
|
-
};
|
|
138
|
-
fullsail: DexConfig & {
|
|
139
|
-
globalConfig: string;
|
|
140
|
-
rewarderGlobalVault: string;
|
|
141
|
-
priceProvider: string;
|
|
142
|
-
stats: string;
|
|
143
|
-
};
|
|
144
|
-
cetus_dlmm: DexConfig & {
|
|
145
|
-
globalConfig: string;
|
|
146
|
-
version: string;
|
|
147
|
-
};
|
|
148
|
-
ferra_dlmm: DexConfig & {
|
|
149
|
-
globalConfig: string;
|
|
150
|
-
};
|
|
151
|
-
ferra_clmm: DexConfig & {
|
|
152
|
-
integrate: string;
|
|
153
|
-
globalConfig: string;
|
|
154
|
-
};
|
|
155
|
-
}
|
|
156
|
-
export type ExtraOracle = {
|
|
157
|
-
Pyth?: {
|
|
158
|
-
bytes: number[];
|
|
159
|
-
};
|
|
160
|
-
};
|
|
161
|
-
export type AggregatorTx = Transaction | BluefinXTx;
|
|
162
|
-
export declare const isSuiTransaction: (tx: AggregatorTx) => tx is Transaction;
|
|
163
|
-
/**
|
|
164
|
-
* Check if the sor response is a bluefinx routing
|
|
165
|
-
* @param sor
|
|
166
|
-
* @returns boolean
|
|
167
|
-
*/
|
|
168
|
-
export declare const isBluefinXRouting: (sor: QuoteResponse) => boolean;
|
|
169
|
-
export type BuildTxResult = {
|
|
170
|
-
tx: AggregatorTx;
|
|
171
|
-
coinOut?: TransactionObjectArgument;
|
|
172
|
-
};
|
|
173
|
-
//# sourceMappingURL=aggregator.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"aggregator.d.ts","sourceRoot":"","sources":["../../../../src/types/aggregator.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,yBAAyB,EAC1B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,CAAC;AAEtB,MAAM,MAAM,SAAS,GACjB,SAAS,GACT,QAAQ,GACR,OAAO,GACP,UAAU,GACV,OAAO,GACP,UAAU,GACV,WAAW,GACX,aAAa,GACb,OAAO,GACP,UAAU,GACV,SAAS,GACT,UAAU,GACV,WAAW,GACX,OAAO,GACP,OAAO,GACP,QAAQ,GACR,sBAAsB,GACtB,yBAAyB,GACzB,OAAO,GACP,YAAY,GACZ,UAAU,GACV,WAAW,GACX,UAAU,GACV,YAAY,GACZ,YAAY,GACZ,YAAY,CAAC;AAEjB,MAAM,MAAM,OAAO,GAAG;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,KAAK,CAAC,EAAE,GAAG,CAAC;CACb,CAAC;AA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,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAE,CAAC;CACrE;AAED,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,WAAW,GAAG,UAAU,CAAC;AAEpD,eAAO,MAAM,gBAAgB,GAAI,IAAI,YAAY,KAAG,EAAE,IAAI,WAC/B,CAAC;AAE5B;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,GAAI,KAAK,aAAa,YAMnD,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,EAAE,EAAE,YAAY,CAAC;IACjB,OAAO,CAAC,EAAE,yBAAyB,CAAC;CACrC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sui.d.ts","sourceRoot":"","sources":["../../../../src/types/sui.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,MAAM,MAAM,qBAAqB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC"}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { Transaction, TransactionObjectArgument } from "@mysten/sui/transactions";
|
|
2
|
-
import { Commission, QuoteResponse } from "./aggregator";
|
|
3
|
-
export interface CommonParams {
|
|
4
|
-
/** Quote response from 7k api */
|
|
5
|
-
quoteResponse: QuoteResponse;
|
|
6
|
-
/** User address */
|
|
7
|
-
accountAddress: string;
|
|
8
|
-
/** Slippage tolerance, ex: 0.01 (1%) */
|
|
9
|
-
slippage: number | string;
|
|
10
|
-
/** Commission for partner */
|
|
11
|
-
commission: Commission;
|
|
12
|
-
/**
|
|
13
|
-
* Give Flexibility to insert custom commands before or after swap
|
|
14
|
-
* @example
|
|
15
|
-
* ```typescript
|
|
16
|
-
* const rawTx = new Transaction();
|
|
17
|
-
* // Add custom commands to rawTx
|
|
18
|
-
* rawTx.moveCall({
|
|
19
|
-
* target: "0x2222222::example::claim",
|
|
20
|
-
* arguments: [],
|
|
21
|
-
* });
|
|
22
|
-
* const { tx, coinOut } = await buildTx({
|
|
23
|
-
* quoteResponse,
|
|
24
|
-
* accountAddress,
|
|
25
|
-
* slippage,
|
|
26
|
-
* commission,
|
|
27
|
-
* extendTx: {
|
|
28
|
-
* tx: rawTx,
|
|
29
|
-
* coinIn: rawTx.object(coinObjectId),
|
|
30
|
-
* },
|
|
31
|
-
* });
|
|
32
|
-
* // add more commands after the swap if needed, and remember to consume the coinOut object
|
|
33
|
-
* tx.transferObjects([coinOut], tx.pure.address(accountAddress));
|
|
34
|
-
* ```
|
|
35
|
-
*/
|
|
36
|
-
extendTx?: {
|
|
37
|
-
tx: Transaction;
|
|
38
|
-
coinIn?: TransactionObjectArgument;
|
|
39
|
-
};
|
|
40
|
-
/**
|
|
41
|
-
* If true, indicates that the transaction is sponsored and its gas object should not be modified.
|
|
42
|
-
* In this case, the gas object is expected to be already set up correctly for the sponsored transaction.
|
|
43
|
-
*/
|
|
44
|
-
isSponsored?: boolean;
|
|
45
|
-
}
|
|
46
|
-
export interface BuildTxParams extends CommonParams {
|
|
47
|
-
/** Developer inspection mode */
|
|
48
|
-
devInspect?: boolean;
|
|
49
|
-
}
|
|
50
|
-
export interface EstimateGasFeeParams extends CommonParams {
|
|
51
|
-
/** Sui price in usd for gas estimation */
|
|
52
|
-
suiPrice?: number;
|
|
53
|
-
}
|
|
54
|
-
export interface SwapInfo {
|
|
55
|
-
quote: QuoteResponse;
|
|
56
|
-
/** @warning this `coinIn` will be consumed completely, no `coinIn` left, user must pass the coinIn object with the balance required for the swap - ie in quote */
|
|
57
|
-
coinIn: TransactionObjectArgument;
|
|
58
|
-
}
|
|
59
|
-
export interface MultiSwapParams {
|
|
60
|
-
swaps: SwapInfo[];
|
|
61
|
-
sender: string;
|
|
62
|
-
slippageBps: number;
|
|
63
|
-
tx: Transaction;
|
|
64
|
-
/** Commission for partner */
|
|
65
|
-
commission: Commission;
|
|
66
|
-
}
|
|
67
|
-
//# sourceMappingURL=tx.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tx.d.ts","sourceRoot":"","sources":["../../../../src/types/tx.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,yBAAyB,EAC1B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAEzD,MAAM,WAAW,YAAY;IAC3B,iCAAiC;IACjC,aAAa,EAAE,aAAa,CAAC;IAC7B,mBAAmB;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,wCAAwC;IACxC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC;IAC1B,6BAA6B;IAC7B,UAAU,EAAE,UAAU,CAAC;IACvB;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,QAAQ,CAAC,EAAE;QACT,EAAE,EAAE,WAAW,CAAC;QAChB,MAAM,CAAC,EAAE,yBAAyB,CAAC;KACpC,CAAC;IACF;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,MAAM,WAAW,aAAc,SAAQ,YAAY;IACjD,gCAAgC;IAChC,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,oBAAqB,SAAQ,YAAY;IACxD,0CAA0C;IAC1C,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,aAAa,CAAC;IACrB,kKAAkK;IAClK,MAAM,EAAE,yBAAyB,CAAC;CACnC;AAED,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,EAAE,EAAE,WAAW,CAAC;IAChB,6BAA6B;IAC7B,UAAU,EAAE,UAAU,CAAC;CACxB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utilities.d.ts","sourceRoot":"","sources":["../../../../src/types/utilities.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;AACpC,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC;AAClC,MAAM,MAAM,OAAO,CAAC,CAAC,IAAI,CAAC,SAAS,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAC1D,MAAM,MAAM,MAAM,CAAC,CAAC,EAAE,CAAC,SAAS,OAAO,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"condition.d.ts","sourceRoot":"","sources":["../../../../src/utils/condition.ts"],"names":[],"mappings":"AAAA,wBAAgB,MAAM,CACpB,SAAS,EAAE,OAAO,EAClB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,GACtB,OAAO,CAAC,SAAS,CAInB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"number.d.ts","sourceRoot":"","sources":["../../../../src/utils/number.ts"],"names":[],"mappings":"AAAA,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,UAK9D"}
|
package/lib/cjs/utils/number.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.formatBalance = formatBalance;
|
|
4
|
-
function formatBalance(balance, decimals) {
|
|
5
|
-
const exp = BigInt(Math.pow(10, decimals));
|
|
6
|
-
const whole = balance / exp;
|
|
7
|
-
const remain = balance % exp;
|
|
8
|
-
return Number(whole) + Number(remain) / Number(exp);
|
|
9
|
-
}
|
package/lib/esm/config/index.js
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { SuiClient, getFullnodeUrl } from "@mysten/sui/client";
|
|
2
|
-
import { SuiPriceServiceConnection, SuiPythClient, } from "@pythnetwork/pyth-sui-js";
|
|
3
|
-
const HERMES_API = "https://hermes.pyth.network";
|
|
4
|
-
const WORMHOLE_STATE_ID = "0xaeab97f96cf9877fee2883315d459552b2b921edc16d7ceac6eab944dd88919c";
|
|
5
|
-
const PYTH_STATE_ID = "0x1f9310238ee9298fb703c3419030b35b22bb1cc37113e3bb5007c99aec79e5b8";
|
|
6
|
-
let apiKey = "";
|
|
7
|
-
let bluefinXApiKey = "";
|
|
8
|
-
let suiClient = new SuiClient({
|
|
9
|
-
url: getFullnodeUrl("mainnet"),
|
|
10
|
-
});
|
|
11
|
-
let pythClient = new SuiPythClient(suiClient, PYTH_STATE_ID, WORMHOLE_STATE_ID);
|
|
12
|
-
let pythConnection = new SuiPriceServiceConnection(HERMES_API);
|
|
13
|
-
function setApiKey(key) {
|
|
14
|
-
apiKey = key;
|
|
15
|
-
}
|
|
16
|
-
function getApiKey() {
|
|
17
|
-
return apiKey;
|
|
18
|
-
}
|
|
19
|
-
function setBluefinXApiKey(key) {
|
|
20
|
-
bluefinXApiKey = key;
|
|
21
|
-
}
|
|
22
|
-
function getBluefinXApiKey() {
|
|
23
|
-
return bluefinXApiKey;
|
|
24
|
-
}
|
|
25
|
-
function getSuiClient() {
|
|
26
|
-
return suiClient;
|
|
27
|
-
}
|
|
28
|
-
function setSuiClient(client) {
|
|
29
|
-
suiClient = client;
|
|
30
|
-
}
|
|
31
|
-
function setPythClient(client) {
|
|
32
|
-
pythClient = client;
|
|
33
|
-
}
|
|
34
|
-
function getPythClient() {
|
|
35
|
-
return pythClient;
|
|
36
|
-
}
|
|
37
|
-
function setPythConnection(connection) {
|
|
38
|
-
pythConnection = connection;
|
|
39
|
-
}
|
|
40
|
-
function getPythConnection() {
|
|
41
|
-
return pythConnection;
|
|
42
|
-
}
|
|
43
|
-
const Config = {
|
|
44
|
-
setApiKey,
|
|
45
|
-
getApiKey,
|
|
46
|
-
setBluefinXApiKey,
|
|
47
|
-
getBluefinXApiKey,
|
|
48
|
-
setSuiClient,
|
|
49
|
-
getSuiClient,
|
|
50
|
-
setPythClient,
|
|
51
|
-
getPythClient,
|
|
52
|
-
setPythConnection,
|
|
53
|
-
getPythConnection,
|
|
54
|
-
};
|
|
55
|
-
export { Config };
|
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
import { coinWithBalance, Transaction, } from "@mysten/sui/transactions";
|
|
2
|
-
import { isValidSuiAddress, toBase64, toHex } from "@mysten/sui/utils";
|
|
3
|
-
import { Config } from "../../config";
|
|
4
|
-
import { _7K_CONFIG, _7K_PACKAGE_ID, _7K_VAULT } from "../../constants/_7k";
|
|
5
|
-
import { groupSwapRoutes } from "../../libs/groupSwapRoutes";
|
|
6
|
-
import { sponsorBluefinX } from "../../libs/protocols/bluefinx/client";
|
|
7
|
-
import { BluefinXTx } from "../../libs/protocols/bluefinx/types";
|
|
8
|
-
import { swapWithRoute } from "../../libs/swapWithRoute";
|
|
9
|
-
import { isBluefinXRouting, } from "../../types/aggregator";
|
|
10
|
-
import { SuiUtils } from "../../utils/sui";
|
|
11
|
-
import { getConfig } from "./config";
|
|
12
|
-
import { ORACLE_BASED_SOURCES } from "./getQuote";
|
|
13
|
-
export const buildTx = async ({ quoteResponse, accountAddress, slippage, commission: __commission, devInspect, extendTx, isSponsored, }) => {
|
|
14
|
-
const isBluefinX = isBluefinXRouting(quoteResponse);
|
|
15
|
-
const _commission = {
|
|
16
|
-
...__commission,
|
|
17
|
-
// commission is ignored for bluefinx
|
|
18
|
-
commissionBps: isBluefinX ? 0 : __commission.commissionBps,
|
|
19
|
-
};
|
|
20
|
-
const { tx: _tx, coinIn: _coinIn } = extendTx || {};
|
|
21
|
-
let coinOut;
|
|
22
|
-
if (isBluefinX && devInspect) {
|
|
23
|
-
throw new Error("BluefinX tx is sponsored, skip devInspect");
|
|
24
|
-
}
|
|
25
|
-
if (!accountAddress) {
|
|
26
|
-
throw new Error("Sender address is required");
|
|
27
|
-
}
|
|
28
|
-
if (!quoteResponse.routes) {
|
|
29
|
-
throw new Error("Invalid quote response: 'routes' are required");
|
|
30
|
-
}
|
|
31
|
-
if (!isValidSuiAddress(_commission.partner)) {
|
|
32
|
-
throw new Error("Invalid commission partner address");
|
|
33
|
-
}
|
|
34
|
-
const tx = _tx || new Transaction();
|
|
35
|
-
const routes = groupSwapRoutes(quoteResponse);
|
|
36
|
-
validateRoutes(routes, isSponsored);
|
|
37
|
-
const splits = routes.map((group) => group[0]?.amount ?? "0");
|
|
38
|
-
const coinIn = _coinIn ||
|
|
39
|
-
tx.add(coinWithBalance({
|
|
40
|
-
type: quoteResponse.tokenIn,
|
|
41
|
-
balance: BigInt(quoteResponse.swapAmountWithDecimal),
|
|
42
|
-
useGasCoin: !isSponsored && !isBluefinX,
|
|
43
|
-
}));
|
|
44
|
-
const coinData = tx.splitCoins(coinIn, splits);
|
|
45
|
-
SuiUtils.transferOrDestroyZeroCoin(tx, quoteResponse.tokenIn, coinIn, accountAddress);
|
|
46
|
-
const pythMap = await updatePythPriceFeedsIfAny(tx, [quoteResponse]);
|
|
47
|
-
const coinObjects = [];
|
|
48
|
-
const config = await getConfig();
|
|
49
|
-
await Promise.all(routes.map(async (route, index) => {
|
|
50
|
-
const inputCoinObject = coinData[index];
|
|
51
|
-
const coinRes = await swapWithRoute({
|
|
52
|
-
route,
|
|
53
|
-
inputCoinObject,
|
|
54
|
-
currentAccount: accountAddress,
|
|
55
|
-
tx,
|
|
56
|
-
config,
|
|
57
|
-
pythMap,
|
|
58
|
-
});
|
|
59
|
-
if (coinRes) {
|
|
60
|
-
coinObjects.push(coinRes);
|
|
61
|
-
}
|
|
62
|
-
}));
|
|
63
|
-
if (coinObjects.length > 0) {
|
|
64
|
-
const mergedCoin = tx.add(settle(coinObjects, quoteResponse, Math.floor(+slippage * 10000), _commission));
|
|
65
|
-
if (!extendTx) {
|
|
66
|
-
tx.transferObjects([mergedCoin], tx.pure.address(accountAddress));
|
|
67
|
-
}
|
|
68
|
-
else {
|
|
69
|
-
coinOut = mergedCoin;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
if (isBluefinX) {
|
|
73
|
-
return {
|
|
74
|
-
tx: await buildBluefinXTx(tx, accountAddress, quoteResponse),
|
|
75
|
-
coinOut,
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
tx.setSenderIfNotSet(accountAddress);
|
|
79
|
-
return { tx, coinOut };
|
|
80
|
-
};
|
|
81
|
-
export const getPythPriceFeeds = (responses) => {
|
|
82
|
-
const ids = new Set();
|
|
83
|
-
for (const res of responses) {
|
|
84
|
-
for (const s of res.swaps) {
|
|
85
|
-
for (const o of s.extra?.oracles || []) {
|
|
86
|
-
const bytes = o.Pyth?.price_identifier?.bytes || o.Pyth?.bytes;
|
|
87
|
-
if (bytes) {
|
|
88
|
-
ids.add("0x" + toHex(Uint8Array.from(bytes)));
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
return Array.from(ids);
|
|
94
|
-
};
|
|
95
|
-
export const updatePythPriceFeedsIfAny = async (tx, quoteResponse) => {
|
|
96
|
-
// update oracles price if any
|
|
97
|
-
const pythMap = {};
|
|
98
|
-
const pythIds = getPythPriceFeeds(quoteResponse);
|
|
99
|
-
if (pythIds.length > 0) {
|
|
100
|
-
const prices = await Config.getPythConnection().getPriceFeedsUpdateData(pythIds);
|
|
101
|
-
const ids = await Config.getPythClient().updatePriceFeeds(tx, prices, pythIds);
|
|
102
|
-
pythIds.map((id, index) => {
|
|
103
|
-
pythMap[id] = ids[index];
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
return pythMap;
|
|
107
|
-
};
|
|
108
|
-
export const validateRoutes = (routes, isSponsored) => {
|
|
109
|
-
if (!isSponsored) {
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
|
-
const hasOracleBasedSource = routes.some((g) => g.some((s) => ORACLE_BASED_SOURCES.has(s.pool.type)));
|
|
113
|
-
if (hasOracleBasedSource) {
|
|
114
|
-
throw new Error("Oracle based sources are not supported for sponsored tx");
|
|
115
|
-
}
|
|
116
|
-
};
|
|
117
|
-
export const getExpectedReturn = (returnAmount, slippageBps, commissionBps, tipBps = 0) => {
|
|
118
|
-
if (slippageBps > 10000) {
|
|
119
|
-
throw new Error("Slippage must be less than 100%");
|
|
120
|
-
}
|
|
121
|
-
if (commissionBps > 10000) {
|
|
122
|
-
throw new Error("Commission must be less than 100%");
|
|
123
|
-
}
|
|
124
|
-
if (tipBps > 10000) {
|
|
125
|
-
throw new Error("Tip must be less than 100%");
|
|
126
|
-
}
|
|
127
|
-
const returnAmountWithDecimal = BigInt(returnAmount);
|
|
128
|
-
const tipAmountWithDecimal = (returnAmountWithDecimal * BigInt(tipBps || 0)) / 10000n;
|
|
129
|
-
const commissionAmountWithDecimal = ((returnAmountWithDecimal - tipAmountWithDecimal) * BigInt(commissionBps)) /
|
|
130
|
-
10000n;
|
|
131
|
-
const expectedReturnWithDecimal = returnAmountWithDecimal -
|
|
132
|
-
tipAmountWithDecimal -
|
|
133
|
-
commissionAmountWithDecimal;
|
|
134
|
-
const minAmountWithDecimal = (expectedReturnWithDecimal * BigInt(1e4 - slippageBps)) / 10000n;
|
|
135
|
-
return {
|
|
136
|
-
tipAmount: tipAmountWithDecimal,
|
|
137
|
-
minAmount: minAmountWithDecimal,
|
|
138
|
-
commissionAmount: commissionAmountWithDecimal,
|
|
139
|
-
expectedAmount: expectedReturnWithDecimal.toString(10),
|
|
140
|
-
};
|
|
141
|
-
};
|
|
142
|
-
export const settle = (coinObjects, quoteResponse, slippageBps, _commission) => {
|
|
143
|
-
return (tx) => {
|
|
144
|
-
const mergeCoin = coinObjects.length > 1
|
|
145
|
-
? (tx.mergeCoins(coinObjects[0], coinObjects.slice(1)), coinObjects[0])
|
|
146
|
-
: coinObjects[0];
|
|
147
|
-
const { minAmount, expectedAmount } = getExpectedReturn(quoteResponse.returnAmountWithDecimal, slippageBps, _commission.commissionBps);
|
|
148
|
-
tx.moveCall({
|
|
149
|
-
target: `${_7K_PACKAGE_ID}::settle::settle`,
|
|
150
|
-
typeArguments: [quoteResponse.tokenIn, quoteResponse.tokenOut],
|
|
151
|
-
arguments: [
|
|
152
|
-
tx.object(_7K_CONFIG),
|
|
153
|
-
tx.object(_7K_VAULT),
|
|
154
|
-
tx.pure.u64(quoteResponse.swapAmountWithDecimal),
|
|
155
|
-
mergeCoin,
|
|
156
|
-
tx.pure.u64(minAmount), // minimum received
|
|
157
|
-
tx.pure.u64(expectedAmount), // expected amount out
|
|
158
|
-
tx.pure.option("address", isValidSuiAddress(_commission.partner) ? _commission.partner : null),
|
|
159
|
-
tx.pure.u64(_commission.commissionBps),
|
|
160
|
-
tx.pure.u64(0),
|
|
161
|
-
],
|
|
162
|
-
});
|
|
163
|
-
return mergeCoin;
|
|
164
|
-
};
|
|
165
|
-
};
|
|
166
|
-
export const buildBluefinXTx = async (tx, accountAddress, quoteResponse) => {
|
|
167
|
-
const extra = quoteResponse.swaps[0].extra;
|
|
168
|
-
if (extra.quoteExpiresAtUtcMillis < Date.now()) {
|
|
169
|
-
throw new Error("Quote expired");
|
|
170
|
-
}
|
|
171
|
-
tx.setSenderIfNotSet(accountAddress);
|
|
172
|
-
const bytes = await tx.build({
|
|
173
|
-
client: Config.getSuiClient(),
|
|
174
|
-
onlyTransactionKind: true,
|
|
175
|
-
});
|
|
176
|
-
const res = await sponsorBluefinX({
|
|
177
|
-
quoteId: extra.quoteId,
|
|
178
|
-
txBytes: toBase64(bytes),
|
|
179
|
-
sender: accountAddress,
|
|
180
|
-
});
|
|
181
|
-
if (!res.success) {
|
|
182
|
-
throw new Error("Sponsor failed");
|
|
183
|
-
}
|
|
184
|
-
return new BluefinXTx(res.quoteId, res.data.txBytes);
|
|
185
|
-
};
|