@shapeshiftoss/swapper 17.7.2 → 17.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/.tsbuildinfo +1 -1
- package/dist/cjs/constants.js +35 -26
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.js +8 -17
- package/dist/cjs/swappers/AcrossSwapper/utils/acrossService.d.ts +3 -3
- package/dist/cjs/swappers/AcrossSwapper/utils/getTrade.js +2 -1
- package/dist/cjs/swappers/ArbitrumBridgeSwapper/endpoints.d.ts +3 -3
- package/dist/cjs/swappers/ArbitrumBridgeSwapper/getTradeQuote/getTradeQuote.js +2 -2
- package/dist/cjs/swappers/ArbitrumBridgeSwapper/getTradeQuote/getTradeQuote.test.js +12 -4
- package/dist/cjs/swappers/ArbitrumBridgeSwapper/getTradeRate/getTradeRate.js +2 -1
- package/dist/cjs/swappers/ArbitrumBridgeSwapper/utils/fetchArbitrumBridgeSwap.d.ts +2 -2
- package/dist/cjs/swappers/AvnuSwapper/endpoints.js +2 -2
- package/dist/cjs/swappers/AvnuSwapper/utils/constants.d.ts +1 -1
- package/dist/cjs/swappers/BebopSwapper/getBebopSolanaTradeQuote/getBebopSolanaTradeQuote.js +2 -1
- package/dist/cjs/swappers/BebopSwapper/getBebopSolanaTradeRate/getBebopSolanaTradeRate.js +11 -6
- package/dist/cjs/swappers/BebopSwapper/getBebopTradeQuote/getBebopTradeQuote.js +4 -11
- package/dist/cjs/swappers/BebopSwapper/getBebopTradeRate/getBebopTradeRate.js +12 -15
- package/dist/cjs/swappers/BebopSwapper/types.d.ts +65 -79
- package/dist/cjs/swappers/BebopSwapper/utils/bebopService.d.ts +1 -1
- package/dist/cjs/swappers/BebopSwapper/utils/fetchFromBebop.d.ts +2 -18
- package/dist/cjs/swappers/BebopSwapper/utils/fetchFromBebop.js +49 -82
- package/dist/cjs/swappers/BebopSwapper/utils/helpers/helpers.d.ts +1 -2
- package/dist/cjs/swappers/BobGatewaySwapper/BobGatewaySwapper.d.ts +2 -0
- package/dist/cjs/swappers/BobGatewaySwapper/BobGatewaySwapper.js +8 -0
- package/dist/cjs/swappers/BobGatewaySwapper/endpoints.d.ts +2 -0
- package/dist/cjs/swappers/BobGatewaySwapper/endpoints.js +143 -0
- package/dist/cjs/swappers/BobGatewaySwapper/index.d.ts +3 -0
- package/dist/cjs/swappers/BobGatewaySwapper/index.js +22 -0
- package/dist/cjs/swappers/BobGatewaySwapper/swapperApi/getTradeQuote.d.ts +3 -0
- package/dist/cjs/swappers/BobGatewaySwapper/swapperApi/getTradeQuote.js +90 -0
- package/dist/cjs/swappers/BobGatewaySwapper/swapperApi/getTradeRate.d.ts +3 -0
- package/dist/cjs/swappers/BobGatewaySwapper/swapperApi/getTradeRate.js +73 -0
- package/dist/cjs/swappers/BobGatewaySwapper/types.d.ts +20 -0
- package/dist/cjs/swappers/BobGatewaySwapper/types.js +2 -0
- package/dist/cjs/swappers/BobGatewaySwapper/utils/constants.d.ts +13 -0
- package/dist/cjs/swappers/BobGatewaySwapper/utils/constants.js +31 -0
- package/dist/cjs/swappers/BobGatewaySwapper/utils/helpers.d.ts +49 -0
- package/dist/cjs/swappers/BobGatewaySwapper/utils/helpers.js +314 -0
- package/dist/cjs/swappers/ButterSwap/swapperApi/checkTradeStatus.test.js +9 -19
- package/dist/cjs/swappers/ButterSwap/swapperApi/getTradeQuote.js +1 -1
- package/dist/cjs/swappers/ButterSwap/test-data/routeQuote.js +4 -4
- package/dist/cjs/swappers/ButterSwap/utils/butterSwapHistoryService.d.ts +3 -3
- package/dist/cjs/swappers/ButterSwap/utils/butterSwapService.d.ts +3 -3
- package/dist/cjs/swappers/ButterSwap/xhr.js +4 -4
- package/dist/cjs/swappers/CetusSwapper/utils/constants.d.ts +1 -1
- package/dist/cjs/swappers/ChainflipSwapper/ChainflipSwapper.js +1 -0
- package/dist/cjs/swappers/ChainflipSwapper/constants.d.ts +1 -1
- package/dist/cjs/swappers/ChainflipSwapper/constants.js +3 -0
- package/dist/cjs/swappers/ChainflipSwapper/endpoints.js +20 -0
- package/dist/cjs/swappers/ChainflipSwapper/models/ChainflipBaasQuoteBoostQuote.js +5 -4
- package/dist/cjs/swappers/ChainflipSwapper/models/ChainflipBaasQuoteEstimatedDurationsSeconds.js +5 -4
- package/dist/cjs/swappers/ChainflipSwapper/models/ChainflipBaasQuoteQuote.js +5 -5
- package/dist/cjs/swappers/ChainflipSwapper/models/ChainflipBaasQuoteQuoteFee.js +5 -5
- package/dist/cjs/swappers/ChainflipSwapper/models/ChainflipBaasStatusChunkInfo.js +5 -4
- package/dist/cjs/swappers/ChainflipSwapper/models/ChainflipBaasStatusDca.js +5 -4
- package/dist/cjs/swappers/ChainflipSwapper/models/ChainflipBaasStatusEgress.js +5 -4
- package/dist/cjs/swappers/ChainflipSwapper/models/ChainflipBaasStatusSwap.js +5 -4
- package/dist/cjs/swappers/ChainflipSwapper/models/ChainflipBaasSwapDepositAddress.js +5 -4
- package/dist/cjs/swappers/ChainflipSwapper/types.d.ts +2 -1
- package/dist/cjs/swappers/ChainflipSwapper/types.js +1 -0
- package/dist/cjs/swappers/ChainflipSwapper/utils/chainflipService.d.ts +3 -3
- package/dist/cjs/swappers/ChainflipSwapper/utils/getQuoteOrRate.js +25 -5
- package/dist/cjs/swappers/ChainflipSwapper/utils/getUtxoTxFees.d.ts +1 -1
- package/dist/cjs/swappers/ChainflipSwapper/utils/helpers.d.ts +2 -3
- package/dist/cjs/swappers/ChainflipSwapper/utils/helpers.js +2 -1
- package/dist/cjs/swappers/CowSwapper/getCowSwapTradeQuote/getCowSwapTradeQuote.js +3 -2
- package/dist/cjs/swappers/CowSwapper/getCowSwapTradeQuote/getCowSwapTradeQuote.test.js +8 -8
- package/dist/cjs/swappers/CowSwapper/getCowSwapTradeRate/getCowSwapTradeRate.js +3 -2
- package/dist/cjs/swappers/CowSwapper/utils/cowService.d.ts +3 -3
- package/dist/cjs/swappers/CowSwapper/utils/helpers/helpers.test.js +3 -3
- package/dist/cjs/swappers/DebridgeSwapper/utils/debridgeService.d.ts +3 -3
- package/dist/cjs/swappers/DebridgeSwapper/utils/getTrade.js +2 -1
- package/dist/cjs/swappers/NearIntentsSwapper/constants.d.ts +1 -0
- package/dist/cjs/swappers/NearIntentsSwapper/constants.js +2 -1
- package/dist/cjs/swappers/NearIntentsSwapper/swapperApi/getTradeQuote.js +5 -2
- package/dist/cjs/swappers/NearIntentsSwapper/utils/helpers/helpers.d.ts +2 -2
- package/dist/cjs/swappers/NearIntentsSwapper/utils/helpers/helpers.js +5 -1
- package/dist/cjs/swappers/PortalsSwapper/getPortalsTradeQuote/getPortalsTradeQuote.js +2 -1
- package/dist/cjs/swappers/PortalsSwapper/getPortalsTradeRate/getPortalsTradeRate.js +4 -3
- package/dist/cjs/swappers/PortalsSwapper/utils/helpers.d.ts +1 -1
- package/dist/cjs/swappers/RelaySwapper/constant.d.ts +1 -39
- package/dist/cjs/swappers/RelaySwapper/constant.js +1 -1
- package/dist/cjs/swappers/RelaySwapper/utils/fetchRelayTrade.d.ts +1 -1
- package/dist/cjs/swappers/RelaySwapper/utils/getRelayPsbtRelayer.js +7 -17
- package/dist/cjs/swappers/RelaySwapper/utils/getTrade.js +2 -1
- package/dist/cjs/swappers/RelaySwapper/utils/relayService.d.ts +3 -3
- package/dist/cjs/swappers/SunioSwapper/endpoints.js +19 -36
- package/dist/cjs/swappers/SunioSwapper/utils/buildSwapContractCall.d.ts +6 -0
- package/dist/cjs/swappers/SunioSwapper/utils/buildSwapContractCall.js +33 -0
- package/dist/cjs/swappers/SunioSwapper/utils/buildSwapRouteParameters.js +6 -6
- package/dist/cjs/swappers/SunioSwapper/utils/constants.d.ts +2 -0
- package/dist/cjs/swappers/SunioSwapper/utils/constants.js +7 -1
- package/dist/cjs/swappers/SunioSwapper/utils/estimateSunioNetworkFee.d.ts +12 -0
- package/dist/cjs/swappers/SunioSwapper/utils/estimateSunioNetworkFee.js +78 -0
- package/dist/cjs/swappers/SunioSwapper/utils/getQuoteOrRate.js +18 -75
- package/dist/cjs/swappers/SunioSwapper/utils/getSunioTransactionFees.d.ts +2 -0
- package/dist/cjs/swappers/SunioSwapper/utils/getSunioTransactionFees.js +36 -0
- package/dist/cjs/swappers/SunioSwapper/utils/helpers/helpers.d.ts +1 -2
- package/dist/cjs/swappers/SunioSwapper/utils/sunioService.d.ts +3 -3
- package/dist/cjs/swappers/ThorchainSwapper/getTradeQuote/getTradeQuote.test.js +10 -0
- package/dist/cjs/swappers/ThorchainSwapper/utils/getL1ToLongtailQuote.js +8 -18
- package/dist/cjs/swappers/ThorchainSwapper/utils/getL1ToLongtailRate.js +8 -18
- package/dist/cjs/swappers/ThorchainSwapper/utils/getLongtailQuote.js +1 -1
- package/dist/cjs/swappers/ThorchainSwapper/utils/getLongtailRate.js +1 -1
- package/dist/cjs/swappers/ThorchainSwapper/utils/longTailHelpers.js +2 -2
- package/dist/cjs/swappers/ZrxSwapper/getZrxTradeQuote/getZrxTradeQuote.js +2 -1
- package/dist/cjs/swappers/ZrxSwapper/getZrxTradeQuote/getZrxTradeQuote.test.js +7 -17
- package/dist/cjs/swappers/ZrxSwapper/getZrxTradeRate/getZrxTradeRate.js +2 -1
- package/dist/cjs/swappers/ZrxSwapper/utils/fetchFromZrx.js +2 -2
- package/dist/cjs/swappers/ZrxSwapper/utils/helpers/helpers.d.ts +3 -2
- package/dist/cjs/swappers/ZrxSwapper/utils/zrxService.d.ts +1 -1
- package/dist/cjs/swappers/utils/helpers/helpers.js +1 -0
- package/dist/cjs/swappers/utils/test-data/cryptoMarketDataById.d.ts +1 -35
- package/dist/cjs/thorchain-utils/checkTradeStatus.js +8 -1
- package/dist/cjs/thorchain-utils/cosmossdk/getThorTxData.d.ts +12 -0
- package/dist/cjs/thorchain-utils/cosmossdk/getThorTxData.js +19 -0
- package/dist/cjs/thorchain-utils/cosmossdk/index.d.ts +1 -0
- package/dist/cjs/thorchain-utils/cosmossdk/index.js +1 -0
- package/dist/cjs/thorchain-utils/getCallDataFromQuote.d.ts +1 -1
- package/dist/cjs/thorchain-utils/getL1RateOrQuote.js +51 -33
- package/dist/cjs/thorchain-utils/getQuote.js +27 -29
- package/dist/cjs/thorchain-utils/index.d.ts +1 -0
- package/dist/cjs/thorchain-utils/index.js +19 -18
- package/dist/cjs/thorchain-utils/parseBuyTxHash.d.ts +1 -1
- package/dist/cjs/thorchain-utils/service.d.ts +3 -3
- package/dist/cjs/thorchain-utils/tron/getTronTransactionFees.js +8 -5
- package/dist/cjs/thorchain-utils/types.d.ts +1 -1
- package/dist/cjs/tron-utils/getTronTransactionFees.d.ts +1 -1
- package/dist/cjs/types.d.ts +16 -3
- package/dist/cjs/types.js +5 -0
- package/dist/cjs/utils/tenderly/storageSlots.js +20 -20
- package/dist/cjs/utils.d.ts +4 -4
- package/dist/esm/.tsbuildinfo +1 -1
- package/dist/esm/constants.js +9 -0
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/swappers/AcrossSwapper/utils/acrossService.d.ts +3 -3
- package/dist/esm/swappers/ArbitrumBridgeSwapper/endpoints.d.ts +3 -3
- package/dist/esm/swappers/ArbitrumBridgeSwapper/getTradeQuote/getTradeQuote.test.js +12 -4
- package/dist/esm/swappers/ArbitrumBridgeSwapper/utils/fetchArbitrumBridgeSwap.d.ts +2 -2
- package/dist/esm/swappers/AvnuSwapper/endpoints.js +2 -2
- package/dist/esm/swappers/AvnuSwapper/utils/constants.d.ts +1 -1
- package/dist/esm/swappers/BebopSwapper/getBebopSolanaTradeRate/getBebopSolanaTradeRate.js +10 -6
- package/dist/esm/swappers/BebopSwapper/getBebopTradeQuote/getBebopTradeQuote.js +2 -10
- package/dist/esm/swappers/BebopSwapper/getBebopTradeRate/getBebopTradeRate.js +11 -15
- package/dist/esm/swappers/BebopSwapper/types.d.ts +65 -79
- package/dist/esm/swappers/BebopSwapper/utils/bebopService.d.ts +1 -1
- package/dist/esm/swappers/BebopSwapper/utils/fetchFromBebop.d.ts +2 -18
- package/dist/esm/swappers/BebopSwapper/utils/fetchFromBebop.js +45 -76
- package/dist/esm/swappers/BebopSwapper/utils/helpers/helpers.d.ts +1 -2
- package/dist/esm/swappers/BobGatewaySwapper/BobGatewaySwapper.d.ts +2 -0
- package/dist/esm/swappers/BobGatewaySwapper/BobGatewaySwapper.js +5 -0
- package/dist/esm/swappers/BobGatewaySwapper/endpoints.d.ts +2 -0
- package/dist/esm/swappers/BobGatewaySwapper/endpoints.js +140 -0
- package/dist/esm/swappers/BobGatewaySwapper/index.d.ts +3 -0
- package/dist/esm/swappers/BobGatewaySwapper/index.js +3 -0
- package/dist/esm/swappers/BobGatewaySwapper/swapperApi/getTradeQuote.d.ts +3 -0
- package/dist/esm/swappers/BobGatewaySwapper/swapperApi/getTradeQuote.js +86 -0
- package/dist/esm/swappers/BobGatewaySwapper/swapperApi/getTradeRate.d.ts +3 -0
- package/dist/esm/swappers/BobGatewaySwapper/swapperApi/getTradeRate.js +69 -0
- package/dist/esm/swappers/BobGatewaySwapper/types.d.ts +20 -0
- package/dist/esm/swappers/BobGatewaySwapper/utils/constants.d.ts +13 -0
- package/dist/esm/swappers/BobGatewaySwapper/utils/constants.js +27 -0
- package/dist/esm/swappers/BobGatewaySwapper/utils/helpers.d.ts +49 -0
- package/dist/esm/swappers/BobGatewaySwapper/utils/helpers.js +299 -0
- package/dist/esm/swappers/ButterSwap/swapperApi/checkTradeStatus.test.js +2 -2
- package/dist/esm/swappers/ButterSwap/swapperApi/getTradeQuote.js +1 -1
- package/dist/esm/swappers/ButterSwap/test-data/routeQuote.js +4 -4
- package/dist/esm/swappers/ButterSwap/utils/butterSwapHistoryService.d.ts +3 -3
- package/dist/esm/swappers/ButterSwap/utils/butterSwapService.d.ts +3 -3
- package/dist/esm/swappers/CetusSwapper/utils/constants.d.ts +1 -1
- package/dist/esm/swappers/ChainflipSwapper/ChainflipSwapper.js +2 -1
- package/dist/esm/swappers/ChainflipSwapper/constants.d.ts +1 -1
- package/dist/esm/swappers/ChainflipSwapper/constants.js +4 -1
- package/dist/esm/swappers/ChainflipSwapper/endpoints.js +20 -0
- package/dist/esm/swappers/ChainflipSwapper/types.d.ts +2 -1
- package/dist/esm/swappers/ChainflipSwapper/types.js +1 -0
- package/dist/esm/swappers/ChainflipSwapper/utils/chainflipService.d.ts +3 -3
- package/dist/esm/swappers/ChainflipSwapper/utils/getQuoteOrRate.js +26 -6
- package/dist/esm/swappers/ChainflipSwapper/utils/getUtxoTxFees.d.ts +1 -1
- package/dist/esm/swappers/ChainflipSwapper/utils/helpers.d.ts +2 -3
- package/dist/esm/swappers/ChainflipSwapper/utils/helpers.js +2 -1
- package/dist/esm/swappers/CowSwapper/getCowSwapTradeQuote/getCowSwapTradeQuote.js +1 -1
- package/dist/esm/swappers/CowSwapper/getCowSwapTradeQuote/getCowSwapTradeQuote.test.js +8 -8
- package/dist/esm/swappers/CowSwapper/getCowSwapTradeRate/getCowSwapTradeRate.js +1 -1
- package/dist/esm/swappers/CowSwapper/utils/cowService.d.ts +3 -3
- package/dist/esm/swappers/CowSwapper/utils/helpers/helpers.test.js +3 -3
- package/dist/esm/swappers/DebridgeSwapper/utils/debridgeService.d.ts +3 -3
- package/dist/esm/swappers/NearIntentsSwapper/constants.d.ts +1 -0
- package/dist/esm/swappers/NearIntentsSwapper/constants.js +1 -0
- package/dist/esm/swappers/NearIntentsSwapper/swapperApi/getTradeQuote.js +7 -4
- package/dist/esm/swappers/NearIntentsSwapper/utils/helpers/helpers.d.ts +2 -2
- package/dist/esm/swappers/NearIntentsSwapper/utils/helpers/helpers.js +5 -1
- package/dist/esm/swappers/PortalsSwapper/getPortalsTradeRate/getPortalsTradeRate.js +2 -2
- package/dist/esm/swappers/PortalsSwapper/utils/helpers.d.ts +1 -1
- package/dist/esm/swappers/RelaySwapper/constant.d.ts +1 -39
- package/dist/esm/swappers/RelaySwapper/constant.js +1 -1
- package/dist/esm/swappers/RelaySwapper/utils/fetchRelayTrade.d.ts +1 -1
- package/dist/esm/swappers/RelaySwapper/utils/relayService.d.ts +3 -3
- package/dist/esm/swappers/SunioSwapper/endpoints.js +19 -36
- package/dist/esm/swappers/SunioSwapper/utils/buildSwapContractCall.d.ts +6 -0
- package/dist/esm/swappers/SunioSwapper/utils/buildSwapContractCall.js +29 -0
- package/dist/esm/swappers/SunioSwapper/utils/buildSwapRouteParameters.js +6 -6
- package/dist/esm/swappers/SunioSwapper/utils/constants.d.ts +2 -0
- package/dist/esm/swappers/SunioSwapper/utils/constants.js +6 -0
- package/dist/esm/swappers/SunioSwapper/utils/estimateSunioNetworkFee.d.ts +12 -0
- package/dist/esm/swappers/SunioSwapper/utils/estimateSunioNetworkFee.js +74 -0
- package/dist/esm/swappers/SunioSwapper/utils/getQuoteOrRate.js +16 -74
- package/dist/esm/swappers/SunioSwapper/utils/getSunioTransactionFees.d.ts +2 -0
- package/dist/esm/swappers/SunioSwapper/utils/getSunioTransactionFees.js +32 -0
- package/dist/esm/swappers/SunioSwapper/utils/helpers/helpers.d.ts +1 -2
- package/dist/esm/swappers/SunioSwapper/utils/sunioService.d.ts +3 -3
- package/dist/esm/swappers/ThorchainSwapper/getTradeQuote/getTradeQuote.test.js +10 -0
- package/dist/esm/swappers/ThorchainSwapper/utils/getL1ToLongtailQuote.js +1 -1
- package/dist/esm/swappers/ThorchainSwapper/utils/getL1ToLongtailRate.js +1 -1
- package/dist/esm/swappers/ThorchainSwapper/utils/getLongtailQuote.js +1 -1
- package/dist/esm/swappers/ThorchainSwapper/utils/getLongtailRate.js +1 -1
- package/dist/esm/swappers/ZrxSwapper/utils/fetchFromZrx.js +2 -2
- package/dist/esm/swappers/ZrxSwapper/utils/helpers/helpers.d.ts +3 -2
- package/dist/esm/swappers/ZrxSwapper/utils/zrxService.d.ts +1 -1
- package/dist/esm/swappers/utils/helpers/helpers.js +2 -1
- package/dist/esm/swappers/utils/test-data/cryptoMarketDataById.d.ts +1 -35
- package/dist/esm/thorchain-utils/checkTradeStatus.js +8 -1
- package/dist/esm/thorchain-utils/cosmossdk/getThorTxData.d.ts +12 -0
- package/dist/esm/thorchain-utils/cosmossdk/getThorTxData.js +15 -0
- package/dist/esm/thorchain-utils/cosmossdk/index.d.ts +1 -0
- package/dist/esm/thorchain-utils/cosmossdk/index.js +1 -0
- package/dist/esm/thorchain-utils/getCallDataFromQuote.d.ts +1 -1
- package/dist/esm/thorchain-utils/getL1RateOrQuote.js +44 -16
- package/dist/esm/thorchain-utils/getQuote.js +27 -29
- package/dist/esm/thorchain-utils/index.d.ts +1 -0
- package/dist/esm/thorchain-utils/index.js +11 -1
- package/dist/esm/thorchain-utils/parseBuyTxHash.d.ts +1 -1
- package/dist/esm/thorchain-utils/service.d.ts +3 -3
- package/dist/esm/thorchain-utils/tron/getTronTransactionFees.js +8 -5
- package/dist/esm/thorchain-utils/types.d.ts +1 -1
- package/dist/esm/tron-utils/getTronTransactionFees.d.ts +1 -1
- package/dist/esm/types.d.ts +16 -3
- package/dist/esm/types.js +5 -0
- package/dist/esm/utils/tenderly/storageSlots.js +20 -20
- package/dist/esm/utils.d.ts +4 -4
- package/package.json +8 -7
- package/dist/cjs/swappers/SunioSwapper/utils/buildSwapTransaction.d.ts +0 -11
- package/dist/cjs/swappers/SunioSwapper/utils/buildSwapTransaction.js +0 -57
- package/dist/cjs/thorchain-utils/getThresholdedAffiliateBps/getThresholdedAffiliateBps.d.ts +0 -11
- package/dist/cjs/thorchain-utils/getThresholdedAffiliateBps/getThresholdedAffiliateBps.js +0 -40
- package/dist/cjs/thorchain-utils/getThresholdedAffiliateBps/getThresholdedAffiliateBps.test.js +0 -94
- package/dist/esm/swappers/SunioSwapper/utils/buildSwapTransaction.d.ts +0 -11
- package/dist/esm/swappers/SunioSwapper/utils/buildSwapTransaction.js +0 -53
- package/dist/esm/thorchain-utils/getThresholdedAffiliateBps/getThresholdedAffiliateBps.d.ts +0 -11
- package/dist/esm/thorchain-utils/getThresholdedAffiliateBps/getThresholdedAffiliateBps.js +0 -34
- package/dist/esm/thorchain-utils/getThresholdedAffiliateBps/getThresholdedAffiliateBps.test.d.ts +0 -1
- package/dist/esm/thorchain-utils/getThresholdedAffiliateBps/getThresholdedAffiliateBps.test.js +0 -92
- /package/dist/{cjs/thorchain-utils/getThresholdedAffiliateBps/getThresholdedAffiliateBps.test.d.ts → esm/swappers/BobGatewaySwapper/types.js} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getCowSwapTradeQuote =
|
|
3
|
+
exports.getCowSwapTradeQuote = void 0;
|
|
4
4
|
const caip_1 = require("@shapeshiftoss/caip");
|
|
5
5
|
const types_1 = require("@shapeshiftoss/types");
|
|
6
6
|
const utils_1 = require("@shapeshiftoss/utils");
|
|
@@ -103,7 +103,7 @@ async function getCowSwapTradeQuote(input, config) {
|
|
|
103
103
|
allowanceContract: constants_2.COW_SWAP_VAULT_RELAYER_ADDRESS,
|
|
104
104
|
rate,
|
|
105
105
|
feeData: {
|
|
106
|
-
networkFeeCryptoBaseUnit: '0',
|
|
106
|
+
networkFeeCryptoBaseUnit: '0',
|
|
107
107
|
protocolFees: {
|
|
108
108
|
[sellAsset.assetId]: {
|
|
109
109
|
amountCryptoBaseUnit: feeAmountInSellTokenCryptoBaseUnit,
|
|
@@ -135,3 +135,4 @@ async function getCowSwapTradeQuote(input, config) {
|
|
|
135
135
|
};
|
|
136
136
|
return (0, monads_1.Ok)(quote);
|
|
137
137
|
}
|
|
138
|
+
exports.getCowSwapTradeQuote = getCowSwapTradeQuote;
|
|
@@ -308,8 +308,8 @@ const expectedTradeQuoteSmallAmountWethToFox = {
|
|
|
308
308
|
networkFeeCryptoBaseUnit: '0',
|
|
309
309
|
},
|
|
310
310
|
sellAmountIncludingProtocolFeesCryptoBaseUnit: '1000000000000',
|
|
311
|
-
buyAmountBeforeFeesCryptoBaseUnit: '166441655297153832879',
|
|
312
|
-
buyAmountAfterFeesCryptoBaseUnit: '144293027591563571150',
|
|
311
|
+
buyAmountBeforeFeesCryptoBaseUnit: '166441655297153832879',
|
|
312
|
+
buyAmountAfterFeesCryptoBaseUnit: '144293027591563571150',
|
|
313
313
|
source: types_2.SwapperName.CowSwap,
|
|
314
314
|
buyAsset: assets_1.FOX_MAINNET,
|
|
315
315
|
sellAsset: assets_1.WETH,
|
|
@@ -341,7 +341,7 @@ const expectedTradeQuoteSmallAmountWethToFox = {
|
|
|
341
341
|
affiliateBps: '0',
|
|
342
342
|
supportsEIP1559: false,
|
|
343
343
|
allowMultiHop: false,
|
|
344
|
-
slippageTolerancePercentageDecimal: '0.005',
|
|
344
|
+
slippageTolerancePercentageDecimal: '0.005',
|
|
345
345
|
quoteOrRate: 'quote',
|
|
346
346
|
};
|
|
347
347
|
const maybeTradeQuote = await (0, getCowSwapTradeQuote_1.getCowSwapTradeQuote)(input, MOCK_COWSWAP_CONFIG);
|
|
@@ -365,7 +365,7 @@ const expectedTradeQuoteSmallAmountWethToFox = {
|
|
|
365
365
|
affiliateBps: '0',
|
|
366
366
|
supportsEIP1559: false,
|
|
367
367
|
allowMultiHop: false,
|
|
368
|
-
slippageTolerancePercentageDecimal: '0.005',
|
|
368
|
+
slippageTolerancePercentageDecimal: '0.005',
|
|
369
369
|
quoteOrRate: 'quote',
|
|
370
370
|
};
|
|
371
371
|
mockedCowService.post.mockReturnValue(Promise.resolve((0, monads_1.Ok)({
|
|
@@ -398,7 +398,7 @@ const expectedTradeQuoteSmallAmountWethToFox = {
|
|
|
398
398
|
affiliateBps: '0',
|
|
399
399
|
supportsEIP1559: false,
|
|
400
400
|
allowMultiHop: false,
|
|
401
|
-
slippageTolerancePercentageDecimal: '0.005',
|
|
401
|
+
slippageTolerancePercentageDecimal: '0.005',
|
|
402
402
|
quoteOrRate: 'quote',
|
|
403
403
|
};
|
|
404
404
|
mockedCowService.post.mockReturnValue(Promise.resolve((0, monads_1.Ok)({
|
|
@@ -431,7 +431,7 @@ const expectedTradeQuoteSmallAmountWethToFox = {
|
|
|
431
431
|
affiliateBps: '0',
|
|
432
432
|
supportsEIP1559: false,
|
|
433
433
|
allowMultiHop: false,
|
|
434
|
-
slippageTolerancePercentageDecimal: '0.005',
|
|
434
|
+
slippageTolerancePercentageDecimal: '0.005',
|
|
435
435
|
quoteOrRate: 'quote',
|
|
436
436
|
};
|
|
437
437
|
mockedCowService.post.mockReturnValue(Promise.resolve((0, monads_1.Ok)({
|
|
@@ -464,7 +464,7 @@ const expectedTradeQuoteSmallAmountWethToFox = {
|
|
|
464
464
|
affiliateBps: '0',
|
|
465
465
|
supportsEIP1559: false,
|
|
466
466
|
allowMultiHop: false,
|
|
467
|
-
slippageTolerancePercentageDecimal: '0.005',
|
|
467
|
+
slippageTolerancePercentageDecimal: '0.005',
|
|
468
468
|
quoteOrRate: 'quote',
|
|
469
469
|
};
|
|
470
470
|
mockedCowService.post.mockReturnValue(Promise.resolve((0, monads_1.Ok)({
|
|
@@ -497,7 +497,7 @@ const expectedTradeQuoteSmallAmountWethToFox = {
|
|
|
497
497
|
affiliateBps: '0',
|
|
498
498
|
supportsEIP1559: false,
|
|
499
499
|
allowMultiHop: false,
|
|
500
|
-
slippageTolerancePercentageDecimal: '0.005',
|
|
500
|
+
slippageTolerancePercentageDecimal: '0.005',
|
|
501
501
|
quoteOrRate: 'quote',
|
|
502
502
|
};
|
|
503
503
|
mockedCowService.post.mockReturnValue(Promise.resolve((0, monads_1.Ok)({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getCowSwapTradeRate =
|
|
3
|
+
exports.getCowSwapTradeRate = void 0;
|
|
4
4
|
const caip_1 = require("@shapeshiftoss/caip");
|
|
5
5
|
const types_1 = require("@shapeshiftoss/types");
|
|
6
6
|
const utils_1 = require("@shapeshiftoss/utils");
|
|
@@ -103,7 +103,7 @@ async function getCowSwapTradeRate(input, config) {
|
|
|
103
103
|
allowanceContract: constants_2.COW_SWAP_VAULT_RELAYER_ADDRESS,
|
|
104
104
|
rate,
|
|
105
105
|
feeData: {
|
|
106
|
-
networkFeeCryptoBaseUnit: '0',
|
|
106
|
+
networkFeeCryptoBaseUnit: '0',
|
|
107
107
|
protocolFees: {
|
|
108
108
|
[sellAsset.assetId]: {
|
|
109
109
|
amountCryptoBaseUnit: feeAmountInSellTokenCryptoBaseUnit,
|
|
@@ -133,3 +133,4 @@ async function getCowSwapTradeRate(input, config) {
|
|
|
133
133
|
};
|
|
134
134
|
return (0, monads_1.Ok)(quote);
|
|
135
135
|
}
|
|
136
|
+
exports.getCowSwapTradeRate = getCowSwapTradeRate;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AxiosRequestConfig } from 'axios';
|
|
2
2
|
export declare const cowService: {
|
|
3
|
-
get: <T = any>(url: string, config?: AxiosRequestConfig<any>) => Promise<import("@sniptt/monads").Result<import("axios").AxiosResponse<T>, import("../../..").SwapErrorRight>>;
|
|
4
|
-
post: <
|
|
5
|
-
delete: <
|
|
3
|
+
get: <T = any>(url: string, config?: AxiosRequestConfig<any> | undefined) => Promise<import("@sniptt/monads").Result<import("axios").AxiosResponse<T, any, {}>, import("../../..").SwapErrorRight>>;
|
|
4
|
+
post: <T_1 = any>(url: string, data: any, config?: AxiosRequestConfig<any> | undefined) => Promise<import("@sniptt/monads").Result<import("axios").AxiosResponse<T_1, any, {}>, import("../../..").SwapErrorRight>>;
|
|
5
|
+
delete: <T_2 = any>(url: string, data: any, config?: AxiosRequestConfig<any> | undefined) => Promise<import("@sniptt/monads").Result<import("axios").AxiosResponse<T_2, any, {}>, import("../../..").SwapErrorRight>>;
|
|
6
6
|
};
|
|
@@ -15,9 +15,9 @@ vitest_1.vi.mock('../cowService', async () => {
|
|
|
15
15
|
const mockDay = '2020-12-31';
|
|
16
16
|
const mockTime = 'T23:59:59.000Z';
|
|
17
17
|
const mockDate = `${mockDay}${mockTime}`;
|
|
18
|
-
(0, vitest_1.beforeEach)(() =>
|
|
19
|
-
.useFakeTimers()
|
|
20
|
-
|
|
18
|
+
(0, vitest_1.beforeEach)(() => {
|
|
19
|
+
vitest_1.vi.useFakeTimers().setSystemTime(new Date(mockDate));
|
|
20
|
+
});
|
|
21
21
|
(0, vitest_1.afterEach)(() => {
|
|
22
22
|
vitest_1.vi.restoreAllMocks();
|
|
23
23
|
vitest_1.vi.useRealTimers();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const debridgeService: {
|
|
2
|
-
get: <T = any>(url: string, config?: import("axios").AxiosRequestConfig<any>) => Promise<import("@sniptt/monads").Result<import("axios").AxiosResponse<T>, import("../../..").SwapErrorRight>>;
|
|
3
|
-
post: <
|
|
4
|
-
delete: <
|
|
2
|
+
get: <T = any>(url: string, config?: import("axios").AxiosRequestConfig<any> | undefined) => Promise<import("@sniptt/monads").Result<import("axios").AxiosResponse<T, any, {}>, import("../../..").SwapErrorRight>>;
|
|
3
|
+
post: <T_1 = any>(url: string, data: any, config?: import("axios").AxiosRequestConfig<any> | undefined) => Promise<import("@sniptt/monads").Result<import("axios").AxiosResponse<T_1, any, {}>, import("../../..").SwapErrorRight>>;
|
|
4
|
+
delete: <T_2 = any>(url: string, data: any, config?: import("axios").AxiosRequestConfig<any> | undefined) => Promise<import("@sniptt/monads").Result<import("axios").AxiosResponse<T_2, any, {}>, import("../../..").SwapErrorRight>>;
|
|
5
5
|
};
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getTrade =
|
|
6
|
+
exports.getTrade = void 0;
|
|
7
7
|
const caip_1 = require("@shapeshiftoss/caip");
|
|
8
8
|
const chain_adapters_1 = require("@shapeshiftoss/chain-adapters");
|
|
9
9
|
const utils_1 = require("@shapeshiftoss/utils");
|
|
@@ -200,6 +200,7 @@ async function getTrade({ input, deps, }) {
|
|
|
200
200
|
};
|
|
201
201
|
return (0, monads_1.Ok)([tradeRate]);
|
|
202
202
|
}
|
|
203
|
+
exports.getTrade = getTrade;
|
|
203
204
|
function handleDebridgeError(error) {
|
|
204
205
|
if (!axios_1.default.isAxiosError(error.cause)) {
|
|
205
206
|
return (0, monads_1.Err)((0, utils_2.makeSwapErrorRight)({
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DEFAULT_QUOTE_DEADLINE_MS = exports.DEFAULT_SLIPPAGE_BPS = exports.ONE_CLICK_BASE_URL = void 0;
|
|
3
|
+
exports.BTC_QUOTE_DEADLINE_MS = exports.DEFAULT_QUOTE_DEADLINE_MS = exports.DEFAULT_SLIPPAGE_BPS = exports.ONE_CLICK_BASE_URL = void 0;
|
|
4
4
|
exports.ONE_CLICK_BASE_URL = 'https://1click.chaindefuser.com';
|
|
5
5
|
exports.DEFAULT_SLIPPAGE_BPS = 50;
|
|
6
6
|
exports.DEFAULT_QUOTE_DEADLINE_MS = 30 * 60 * 1000;
|
|
7
|
+
exports.BTC_QUOTE_DEADLINE_MS = 60 * 60 * 1000;
|
|
@@ -52,6 +52,9 @@ const getTradeQuote = async (input, deps) => {
|
|
|
52
52
|
message: `Asset ${buyAsset.symbol} on ${buyAsset.networkName || buyAsset.chainId} is not supported by NEAR Intents`,
|
|
53
53
|
}));
|
|
54
54
|
}
|
|
55
|
+
const quoteDeadline = sellAsset.chainId === caip_1.btcChainId || buyAsset.chainId === caip_1.btcChainId
|
|
56
|
+
? constants_2.BTC_QUOTE_DEADLINE_MS
|
|
57
|
+
: constants_2.DEFAULT_QUOTE_DEADLINE_MS;
|
|
55
58
|
const quoteRequest = {
|
|
56
59
|
dry: false,
|
|
57
60
|
swapType: types_2.QuoteRequest.swapType.EXACT_INPUT,
|
|
@@ -66,7 +69,7 @@ const getTradeQuote = async (input, deps) => {
|
|
|
66
69
|
refundType: types_2.QuoteRequest.refundType.ORIGIN_CHAIN,
|
|
67
70
|
recipient: receiveAddress,
|
|
68
71
|
recipientType: types_2.QuoteRequest.recipientType.DESTINATION_CHAIN,
|
|
69
|
-
deadline: new Date(Date.now() +
|
|
72
|
+
deadline: new Date(Date.now() + quoteDeadline).toISOString(),
|
|
70
73
|
referral: 'shapeshift',
|
|
71
74
|
appFees: [
|
|
72
75
|
{
|
|
@@ -259,7 +262,7 @@ const getTradeQuote = async (input, deps) => {
|
|
|
259
262
|
steps: [
|
|
260
263
|
{
|
|
261
264
|
accountNumber,
|
|
262
|
-
allowanceContract:
|
|
265
|
+
allowanceContract: '',
|
|
263
266
|
buyAmountBeforeFeesCryptoBaseUnit: quote.amountOut,
|
|
264
267
|
buyAmountAfterFeesCryptoBaseUnit: quote.amountOut,
|
|
265
268
|
buyAsset,
|
|
@@ -8,5 +8,5 @@ export declare const getNearIntentsAsset: ({ nearNetwork, contractAddress, }: {
|
|
|
8
8
|
contractAddress: string;
|
|
9
9
|
}) => string;
|
|
10
10
|
export declare const assetToNearIntentsAsset: (asset: Asset) => Promise<string | null>;
|
|
11
|
-
export declare const mapNearIntentsStatus: (status: GetExecutionStatusResponse[
|
|
12
|
-
export declare const getNearIntentsStatusMessage: (status: GetExecutionStatusResponse[
|
|
11
|
+
export declare const mapNearIntentsStatus: (status: GetExecutionStatusResponse['status']) => TxStatus;
|
|
12
|
+
export declare const getNearIntentsStatusMessage: (status: GetExecutionStatusResponse['status']) => string | undefined;
|
|
@@ -50,6 +50,7 @@ exports.getNearIntentsAsset = getNearIntentsAsset;
|
|
|
50
50
|
const NEP245_CHAINS = ['bsc', 'pol', 'avax', 'op', 'tron', 'monad', 'plasma'];
|
|
51
51
|
const TOKEN_LOOKUP_CHAINS = ['sui', 'starknet', 'ton'];
|
|
52
52
|
const NEAR_CHAIN = 'near';
|
|
53
|
+
const BTC_CHAIN = 'btc';
|
|
53
54
|
const WNEAR_CONTRACT_ADDRESS = 'wrap.near';
|
|
54
55
|
const isNep245Chain = (chain) => {
|
|
55
56
|
return NEP245_CHAINS.includes(chain);
|
|
@@ -61,6 +62,9 @@ const assetToNearIntentsAsset = async (asset) => {
|
|
|
61
62
|
const nearNetwork = types_1.chainIdToNearIntentsChain[asset.chainId];
|
|
62
63
|
if (!nearNetwork)
|
|
63
64
|
return null;
|
|
65
|
+
// https://partners.near-intents.org/omni-migration#partners
|
|
66
|
+
if (nearNetwork === BTC_CHAIN)
|
|
67
|
+
return `1cs_v1:btc:native:coin`;
|
|
64
68
|
// NEAR chain requires special handling
|
|
65
69
|
// Native NEAR maps to wNEAR (wrap.near)
|
|
66
70
|
if (nearNetwork === NEAR_CHAIN) {
|
|
@@ -96,7 +100,7 @@ const assetToNearIntentsAsset = async (asset) => {
|
|
|
96
100
|
}
|
|
97
101
|
return match.assetId;
|
|
98
102
|
}
|
|
99
|
-
// NEP-141 chains (ETH, ARB, BASE, GNOSIS,
|
|
103
|
+
// NEP-141 chains (ETH, ARB, BASE, GNOSIS, DOGE): use predictable format
|
|
100
104
|
const contractAddress = (0, utils_1.isToken)(asset.assetId)
|
|
101
105
|
? (0, caip_1.fromAssetId)(asset.assetId).assetReference
|
|
102
106
|
: viem_1.zeroAddress;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getPortalsTradeQuote =
|
|
3
|
+
exports.getPortalsTradeQuote = void 0;
|
|
4
4
|
const caip_1 = require("@shapeshiftoss/caip");
|
|
5
5
|
const chain_adapters_1 = require("@shapeshiftoss/chain-adapters");
|
|
6
6
|
const utils_1 = require("@shapeshiftoss/utils");
|
|
@@ -227,3 +227,4 @@ async function getPortalsTradeQuote(input, assertGetEvmChainAdapter, swapperConf
|
|
|
227
227
|
}));
|
|
228
228
|
}
|
|
229
229
|
}
|
|
230
|
+
exports.getPortalsTradeQuote = getPortalsTradeQuote;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getPortalsTradeRate =
|
|
3
|
+
exports.getPortalsTradeRate = void 0;
|
|
4
4
|
const caip_1 = require("@shapeshiftoss/caip");
|
|
5
5
|
const chain_adapters_1 = require("@shapeshiftoss/chain-adapters");
|
|
6
6
|
const utils_1 = require("@shapeshiftoss/utils");
|
|
@@ -82,14 +82,14 @@ async function getPortalsTradeRate(input, assertGetEvmChainAdapter, swapperConfi
|
|
|
82
82
|
// Use full quote endpoint (not estimate) to get transaction data for Tenderly simulation
|
|
83
83
|
// Skip validation since this is just a rate quote
|
|
84
84
|
const quoteResponse = await (0, fetchPortalsTradeOrder_1.fetchPortalsTradeOrder)({
|
|
85
|
-
sender: RATE_DUMMY_ADDRESS,
|
|
85
|
+
sender: RATE_DUMMY_ADDRESS,
|
|
86
86
|
inputToken,
|
|
87
87
|
outputToken,
|
|
88
88
|
inputAmount: sellAmountIncludingProtocolFeesCryptoBaseUnit,
|
|
89
89
|
slippageTolerancePercentage: userSlippageTolerancePercentageDecimalOrDefault,
|
|
90
90
|
partner: (0, helpers_1.getTreasuryAddressFromChainId)(chainId),
|
|
91
91
|
feePercentage: affiliateBpsPercentage,
|
|
92
|
-
validate: false,
|
|
92
|
+
validate: false,
|
|
93
93
|
swapperConfig,
|
|
94
94
|
});
|
|
95
95
|
if (!quoteResponse.tx) {
|
|
@@ -195,3 +195,4 @@ async function getPortalsTradeRate(input, assertGetEvmChainAdapter, swapperConfi
|
|
|
195
195
|
}));
|
|
196
196
|
}
|
|
197
197
|
}
|
|
198
|
+
exports.getPortalsTradeRate = getPortalsTradeRate;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { ChainId } from '@shapeshiftoss/caip';
|
|
2
2
|
import type { PortalsSupportedChainId } from '../types';
|
|
3
|
-
export declare const isSupportedChainId: (chainId: ChainId) => chainId is
|
|
3
|
+
export declare const isSupportedChainId: (chainId: ChainId) => chainId is import("@shapeshiftoss/types").KnownChainIds;
|
|
4
4
|
export declare const getPortalsRouterAddressByChainId: (chainId: PortalsSupportedChainId) => string;
|
|
@@ -1,45 +1,7 @@
|
|
|
1
|
-
import { abstractChainId, arbitrumChainId, avalancheChainId, baseChainId, berachainChainId, blastChainId, bobChainId, bscChainId, btcChainId, celoChainId, cronosChainId, ethChainId, etherealChainId, flowEvmChainId, gnosisChainId, hemiChainId, hyperEvmChainId, inkChainId, katanaChainId, lineaChainId, mantleChainId, megaethChainId, modeChainId, monadChainId, optimismChainId, plasmaChainId, plumeChainId, polygonChainId, scrollChainId, seiChainId, solanaChainId, soneiumChainId, sonicChainId, storyChainId, tronChainId, unichainChainId, worldChainChainId, zkSyncEraChainId } from '@shapeshiftoss/caip';
|
|
2
1
|
import { TradeQuoteError } from '../../types';
|
|
3
2
|
import { RelayErrorCode } from './utils/types';
|
|
4
3
|
export declare const chainIdToRelayChainId: {
|
|
5
|
-
[
|
|
6
|
-
[ethChainId]: 1;
|
|
7
|
-
[arbitrumChainId]: 42161;
|
|
8
|
-
[baseChainId]: 8453;
|
|
9
|
-
[optimismChainId]: 10;
|
|
10
|
-
[polygonChainId]: 137;
|
|
11
|
-
[solanaChainId]: number;
|
|
12
|
-
[gnosisChainId]: 100;
|
|
13
|
-
[avalancheChainId]: 43114;
|
|
14
|
-
[bscChainId]: 56;
|
|
15
|
-
[tronChainId]: number;
|
|
16
|
-
[monadChainId]: 143;
|
|
17
|
-
[hyperEvmChainId]: 999;
|
|
18
|
-
[mantleChainId]: 5000;
|
|
19
|
-
[inkChainId]: 57073;
|
|
20
|
-
[megaethChainId]: number;
|
|
21
|
-
[plasmaChainId]: 9745;
|
|
22
|
-
[katanaChainId]: 747474;
|
|
23
|
-
[etherealChainId]: number;
|
|
24
|
-
[celoChainId]: 42220;
|
|
25
|
-
[flowEvmChainId]: 747;
|
|
26
|
-
[plumeChainId]: 98866;
|
|
27
|
-
[storyChainId]: 1514;
|
|
28
|
-
[zkSyncEraChainId]: 324;
|
|
29
|
-
[blastChainId]: 81457;
|
|
30
|
-
[worldChainChainId]: 480;
|
|
31
|
-
[hemiChainId]: 43111;
|
|
32
|
-
[lineaChainId]: 59144;
|
|
33
|
-
[berachainChainId]: 80094;
|
|
34
|
-
[scrollChainId]: 534352;
|
|
35
|
-
[cronosChainId]: 25;
|
|
36
|
-
[sonicChainId]: 146;
|
|
37
|
-
[unichainChainId]: 130;
|
|
38
|
-
[bobChainId]: 60808;
|
|
39
|
-
[modeChainId]: 34443;
|
|
40
|
-
[soneiumChainId]: 1868;
|
|
41
|
-
[seiChainId]: 1329;
|
|
42
|
-
[abstractChainId]: number;
|
|
4
|
+
[x: string]: number;
|
|
43
5
|
};
|
|
44
6
|
export declare enum RelayStatusMessage {
|
|
45
7
|
WaitingForDeposit = "Waiting for deposit...",
|
|
@@ -74,7 +74,7 @@ exports.relayErrorCodeToTradeQuoteError = {
|
|
|
74
74
|
[types_2.RelayErrorCode.ChainDisabled]: types_1.TradeQuoteError.TradingHalted,
|
|
75
75
|
[types_2.RelayErrorCode.Erc20RouterAddressNotFound]: types_1.TradeQuoteError.UnsupportedTradePair,
|
|
76
76
|
[types_2.RelayErrorCode.ExtraTransactionsNotSupported]: types_1.TradeQuoteError.UnsupportedTradePair,
|
|
77
|
-
[types_2.RelayErrorCode.InsufficientFunds]: types_1.TradeQuoteError.
|
|
77
|
+
[types_2.RelayErrorCode.InsufficientFunds]: types_1.TradeQuoteError.InsufficientFunds,
|
|
78
78
|
[types_2.RelayErrorCode.InsufficientLiquidity]: types_1.TradeQuoteError.SellAmountBelowTradeFee,
|
|
79
79
|
[types_2.RelayErrorCode.InvalidAddress]: types_1.TradeQuoteError.UnsupportedTradePair,
|
|
80
80
|
[types_2.RelayErrorCode.InvalidExtraTransactions]: types_1.TradeQuoteError.UnsupportedTradePair,
|
|
@@ -2,4 +2,4 @@ import type { Result } from '@sniptt/monads';
|
|
|
2
2
|
import type { AxiosResponse } from 'axios';
|
|
3
3
|
import type { SwapErrorRight, SwapperConfig } from '../../../types';
|
|
4
4
|
import type { RelayFetchQuoteParams, RelayQuote } from './types';
|
|
5
|
-
export declare const fetchRelayTrade: <T extends "
|
|
5
|
+
export declare const fetchRelayTrade: <T extends "rate" | "quote">(params: RelayFetchQuoteParams<T>, config: SwapperConfig) => Promise<Result<AxiosResponse<RelayQuote, any>, SwapErrorRight>>;
|
|
@@ -15,23 +15,13 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) ||
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
35
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
26
|
exports.getRelayPsbtRelayer = void 0;
|
|
37
27
|
const bitcoin = __importStar(require("@shapeshiftoss/bitcoinjs-lib"));
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getTrade =
|
|
6
|
+
exports.getTrade = void 0;
|
|
7
7
|
const caip_1 = require("@shapeshiftoss/caip");
|
|
8
8
|
const chain_adapters_1 = require("@shapeshiftoss/chain-adapters");
|
|
9
9
|
const utils_1 = require("@shapeshiftoss/utils");
|
|
@@ -575,3 +575,4 @@ async function getTrade({ input, deps, relayChainMap, }) {
|
|
|
575
575
|
};
|
|
576
576
|
return (0, monads_1.Ok)([tradeRate]);
|
|
577
577
|
}
|
|
578
|
+
exports.getTrade = getTrade;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const relayService: {
|
|
2
|
-
get: <T = any>(url: string, config?: import("axios").AxiosRequestConfig<any>) => Promise<import("@sniptt/monads").Result<import("axios").AxiosResponse<T>, import("../../..").SwapErrorRight>>;
|
|
3
|
-
post: <
|
|
4
|
-
delete: <
|
|
2
|
+
get: <T = any>(url: string, config?: import("axios").AxiosRequestConfig<any> | undefined) => Promise<import("@sniptt/monads").Result<import("axios").AxiosResponse<T, any, {}>, import("../../..").SwapErrorRight>>;
|
|
3
|
+
post: <T_1 = any>(url: string, data: any, config?: import("axios").AxiosRequestConfig<any> | undefined) => Promise<import("@sniptt/monads").Result<import("axios").AxiosResponse<T_1, any, {}>, import("../../..").SwapErrorRight>>;
|
|
4
|
+
delete: <T_2 = any>(url: string, data: any, config?: import("axios").AxiosRequestConfig<any> | undefined) => Promise<import("@sniptt/monads").Result<import("axios").AxiosResponse<T_2, any, {}>, import("../../..").SwapErrorRight>>;
|
|
5
5
|
};
|
|
@@ -5,23 +5,14 @@ const caip_1 = require("@shapeshiftoss/caip");
|
|
|
5
5
|
const chain_adapters_1 = require("@shapeshiftoss/chain-adapters");
|
|
6
6
|
const unchained_client_1 = require("@shapeshiftoss/unchained-client");
|
|
7
7
|
const tronweb_1 = require("tronweb");
|
|
8
|
-
const getTronTransactionFees_1 = require("../../tron-utils/getTronTransactionFees");
|
|
9
8
|
const utils_1 = require("../../utils");
|
|
10
9
|
const getSunioTradeQuote_1 = require("./getSunioTradeQuote/getSunioTradeQuote");
|
|
11
10
|
const getSunioTradeRate_1 = require("./getSunioTradeRate/getSunioTradeRate");
|
|
11
|
+
const buildSwapContractCall_1 = require("./utils/buildSwapContractCall");
|
|
12
12
|
const buildSwapRouteParameters_1 = require("./utils/buildSwapRouteParameters");
|
|
13
13
|
const constants_1 = require("./utils/constants");
|
|
14
|
+
const getSunioTransactionFees_1 = require("./utils/getSunioTransactionFees");
|
|
14
15
|
const sleep = (ms) => new Promise(resolve => setTimeout(resolve, ms));
|
|
15
|
-
const convertAddressesToEvmFormat = (value) => {
|
|
16
|
-
if (Array.isArray(value)) {
|
|
17
|
-
return value.map(v => convertAddressesToEvmFormat(v));
|
|
18
|
-
}
|
|
19
|
-
if (typeof value === 'string' && value.startsWith('T') && tronweb_1.TronWeb.isAddress(value)) {
|
|
20
|
-
const hex = tronweb_1.TronWeb.address.toHex(value);
|
|
21
|
-
return hex.replace(/^41/, '0x');
|
|
22
|
-
}
|
|
23
|
-
return value;
|
|
24
|
-
};
|
|
25
16
|
exports.sunioApi = {
|
|
26
17
|
getTradeQuote: async (input, deps) => {
|
|
27
18
|
const maybeTradeQuote = await (0, getSunioTradeQuote_1.getSunioTradeQuote)(input, deps);
|
|
@@ -32,7 +23,7 @@ exports.sunioApi = {
|
|
|
32
23
|
return maybeTradeRate.map(rate => [rate]);
|
|
33
24
|
},
|
|
34
25
|
getUnsignedTronTransaction: async (args) => {
|
|
35
|
-
const { tradeQuote, stepIndex, from, slippageTolerancePercentageDecimal, assertGetTronChainAdapter, } = args;
|
|
26
|
+
const { tradeQuote, stepIndex, from, slippageTolerancePercentageDecimal, assertGetTronChainAdapter, config, } = args;
|
|
36
27
|
if (!(0, utils_1.isExecutableTradeQuote)(tradeQuote)) {
|
|
37
28
|
throw new Error('Unable to execute a trade rate quote');
|
|
38
29
|
}
|
|
@@ -45,24 +36,12 @@ exports.sunioApi = {
|
|
|
45
36
|
const rpcUrl = adapter.httpProvider.getRpcUrl();
|
|
46
37
|
const tronWeb = new tronweb_1.TronWeb({
|
|
47
38
|
fullHost: rpcUrl,
|
|
39
|
+
headers: config.VITE_TRON_GRID_API_KEY
|
|
40
|
+
? { 'TRON-PRO-API-KEY': config.VITE_TRON_GRID_API_KEY }
|
|
41
|
+
: {},
|
|
48
42
|
});
|
|
49
43
|
const routeParams = (0, buildSwapRouteParameters_1.buildSwapRouteParameters)(sunioMetadata.route, step.sellAmountIncludingProtocolFeesCryptoBaseUnit, step.buyAmountAfterFeesCryptoBaseUnit, tradeQuote.receiveAddress, slippageTolerancePercentageDecimal);
|
|
50
|
-
const parameters =
|
|
51
|
-
{ type: 'address[]', value: routeParams.path },
|
|
52
|
-
{ type: 'string[]', value: routeParams.poolVersion },
|
|
53
|
-
{ type: 'uint256[]', value: routeParams.versionLen },
|
|
54
|
-
{ type: 'uint24[]', value: routeParams.fees },
|
|
55
|
-
{
|
|
56
|
-
type: 'tuple(uint256,uint256,address,uint256)',
|
|
57
|
-
value: convertAddressesToEvmFormat([
|
|
58
|
-
routeParams.swapData.amountIn,
|
|
59
|
-
routeParams.swapData.amountOutMin,
|
|
60
|
-
routeParams.swapData.recipient,
|
|
61
|
-
routeParams.swapData.deadline,
|
|
62
|
-
]),
|
|
63
|
-
},
|
|
64
|
-
];
|
|
65
|
-
const functionSelector = 'swapExactInput(address[],string[],uint256[],uint24[],(uint256,uint256,address,uint256))';
|
|
44
|
+
const parameters = (0, buildSwapContractCall_1.buildSwapExactInputParameters)(routeParams);
|
|
66
45
|
const isSellingNativeTrx = step.sellAsset.assetId === caip_1.tronAssetId;
|
|
67
46
|
const callValue = isSellingNativeTrx
|
|
68
47
|
? Number(step.sellAmountIncludingProtocolFeesCryptoBaseUnit)
|
|
@@ -71,7 +50,7 @@ exports.sunioApi = {
|
|
|
71
50
|
feeLimit: 100_000_000,
|
|
72
51
|
callValue,
|
|
73
52
|
};
|
|
74
|
-
const txData = await tronWeb.transactionBuilder.triggerSmartContract(constants_1.SUNIO_SMART_ROUTER_CONTRACT,
|
|
53
|
+
const txData = await tronWeb.transactionBuilder.triggerSmartContract(constants_1.SUNIO_SMART_ROUTER_CONTRACT, buildSwapContractCall_1.SUNIO_SWAP_EXACT_INPUT_SELECTOR, options, parameters, from);
|
|
75
54
|
if (!txData.result || !txData.result.result) {
|
|
76
55
|
throw new Error('[Sun.io] Failed to build swap transaction');
|
|
77
56
|
}
|
|
@@ -100,7 +79,7 @@ exports.sunioApi = {
|
|
|
100
79
|
transaction,
|
|
101
80
|
};
|
|
102
81
|
},
|
|
103
|
-
getTronTransactionFees:
|
|
82
|
+
getTronTransactionFees: getSunioTransactionFees_1.getSunioTransactionFees,
|
|
104
83
|
checkTradeStatus: async ({ txHash, assertGetTronChainAdapter }) => {
|
|
105
84
|
try {
|
|
106
85
|
// Wait for TronGrid indexing to avoid false "REVERT"
|
|
@@ -111,12 +90,16 @@ exports.sunioApi = {
|
|
|
111
90
|
return (0, utils_1.createDefaultStatusResponse)(txHash);
|
|
112
91
|
}
|
|
113
92
|
const contractRet = tx.ret?.[0]?.contractRet;
|
|
114
|
-
//
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
93
|
+
// Tron reports many failure codes (REVERT, OUT_OF_ENERGY, OUT_OF_TIME, ...). A missing
|
|
94
|
+
// contractRet means it isn't mined yet; any non-SUCCESS value is a terminal failure.
|
|
95
|
+
const status = (() => {
|
|
96
|
+
if (!contractRet)
|
|
97
|
+
return unchained_client_1.TxStatus.Pending;
|
|
98
|
+
if (contractRet === 'SUCCESS') {
|
|
99
|
+
return tx.confirmations > 0 ? unchained_client_1.TxStatus.Confirmed : unchained_client_1.TxStatus.Pending;
|
|
100
|
+
}
|
|
101
|
+
return unchained_client_1.TxStatus.Failed;
|
|
102
|
+
})();
|
|
120
103
|
return {
|
|
121
104
|
status,
|
|
122
105
|
buyTxHash: txHash,
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { SwapRouteParameters } from './buildSwapRouteParameters';
|
|
2
|
+
export declare const SUNIO_SWAP_EXACT_INPUT_SELECTOR = "swapExactInput(address[],string[],uint256[],uint24[],(uint256,uint256,address,uint256))";
|
|
3
|
+
export declare const buildSwapExactInputParameters: (routeParams: SwapRouteParameters) => {
|
|
4
|
+
type: string;
|
|
5
|
+
value: unknown;
|
|
6
|
+
}[];
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildSwapExactInputParameters = exports.SUNIO_SWAP_EXACT_INPUT_SELECTOR = void 0;
|
|
4
|
+
const tronweb_1 = require("tronweb");
|
|
5
|
+
exports.SUNIO_SWAP_EXACT_INPUT_SELECTOR = 'swapExactInput(address[],string[],uint256[],uint24[],(uint256,uint256,address,uint256))';
|
|
6
|
+
const convertAddressesToEvmFormat = (value) => {
|
|
7
|
+
if (Array.isArray(value)) {
|
|
8
|
+
return value.map(v => convertAddressesToEvmFormat(v));
|
|
9
|
+
}
|
|
10
|
+
if (typeof value === 'string' && value.startsWith('T') && tronweb_1.TronWeb.isAddress(value)) {
|
|
11
|
+
const hex = tronweb_1.TronWeb.address.toHex(value);
|
|
12
|
+
return hex.replace(/^41/, '0x');
|
|
13
|
+
}
|
|
14
|
+
return value;
|
|
15
|
+
};
|
|
16
|
+
// Parameter list for the SmartExchangeRouter swapExactInput call, shared between fee
|
|
17
|
+
// estimation and execution so both encode the call identically.
|
|
18
|
+
const buildSwapExactInputParameters = (routeParams) => [
|
|
19
|
+
{ type: 'address[]', value: routeParams.path },
|
|
20
|
+
{ type: 'string[]', value: routeParams.poolVersion },
|
|
21
|
+
{ type: 'uint256[]', value: routeParams.versionLen },
|
|
22
|
+
{ type: 'uint24[]', value: routeParams.fees },
|
|
23
|
+
{
|
|
24
|
+
type: 'tuple(uint256,uint256,address,uint256)',
|
|
25
|
+
value: convertAddressesToEvmFormat([
|
|
26
|
+
routeParams.swapData.amountIn,
|
|
27
|
+
routeParams.swapData.amountOutMin,
|
|
28
|
+
routeParams.swapData.recipient,
|
|
29
|
+
routeParams.swapData.deadline,
|
|
30
|
+
]),
|
|
31
|
+
},
|
|
32
|
+
];
|
|
33
|
+
exports.buildSwapExactInputParameters = buildSwapExactInputParameters;
|
|
@@ -5,12 +5,12 @@ const utils_1 = require("@shapeshiftoss/utils");
|
|
|
5
5
|
const buildSwapRouteParameters = (route, sellAmountCryptoBaseUnit, minBuyAmountCryptoBaseUnit, recipient, slippageTolerancePercentageDecimal) => {
|
|
6
6
|
const path = route.tokens;
|
|
7
7
|
const poolVersion = route.poolVersions;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
// The SmartExchangeRouter expects sum(versionLen) === path.length: the first
|
|
9
|
+
// pool segment consumes 2 tokens (input + output) and each subsequent pool
|
|
10
|
+
// reuses the previous output, consuming 1 new token. This relies on the Sun.io
|
|
11
|
+
// API returning poolVersions per-hop (poolVersions.length === tokens.length - 1),
|
|
12
|
+
// which it does — the router also accepts this un-collapsed form for same-version hops.
|
|
13
|
+
const versionLen = poolVersion.map((_, index) => (index === 0 ? 2 : 1));
|
|
14
14
|
const fees = route.poolFees.map(fee => Number(fee));
|
|
15
15
|
const amountOutWithSlippage = (0, utils_1.bn)(minBuyAmountCryptoBaseUnit)
|
|
16
16
|
.times((0, utils_1.bn)(1).minus(slippageTolerancePercentageDecimal))
|
|
@@ -2,5 +2,7 @@ export declare const SUNIO_SUPPORTED_CHAIN_IDS: readonly [import("@shapeshiftoss
|
|
|
2
2
|
export declare const SUNIO_API_BASE_URL = "https://rot.endjgfsv.link";
|
|
3
3
|
export declare const SUNIO_SMART_ROUTER_CONTRACT: "TCFNp179Lg46D16zKoumd4Poa2WFFdtqYj";
|
|
4
4
|
export declare const DEFAULT_SLIPPAGE_PERCENTAGE = "0.005";
|
|
5
|
+
export declare const SUNIO_FALLBACK_SWAP_ENERGY_NATIVE = 215000;
|
|
6
|
+
export declare const SUNIO_FALLBACK_SWAP_ENERGY_TRC20 = 375000;
|
|
5
7
|
export declare const SUNIO_DEX_TYPES: "PSM,CURVE,CURVE_COMBINATION,WTRX,SUNSWAP_V1,SUNSWAP_V2,SUNSWAP_V3";
|
|
6
8
|
export declare const SUNIO_TRON_NATIVE_ADDRESS: "T9yD14Nj9j7xAB4dbGeiX9h8unkKHxuWwb";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SUNIO_TRON_NATIVE_ADDRESS = exports.SUNIO_DEX_TYPES = exports.DEFAULT_SLIPPAGE_PERCENTAGE = exports.SUNIO_SMART_ROUTER_CONTRACT = exports.SUNIO_API_BASE_URL = exports.SUNIO_SUPPORTED_CHAIN_IDS = void 0;
|
|
3
|
+
exports.SUNIO_TRON_NATIVE_ADDRESS = exports.SUNIO_DEX_TYPES = exports.SUNIO_FALLBACK_SWAP_ENERGY_TRC20 = exports.SUNIO_FALLBACK_SWAP_ENERGY_NATIVE = exports.DEFAULT_SLIPPAGE_PERCENTAGE = exports.SUNIO_SMART_ROUTER_CONTRACT = exports.SUNIO_API_BASE_URL = exports.SUNIO_SUPPORTED_CHAIN_IDS = void 0;
|
|
4
4
|
const caip_1 = require("@shapeshiftoss/caip");
|
|
5
5
|
exports.SUNIO_SUPPORTED_CHAIN_IDS = [caip_1.tronChainId];
|
|
6
6
|
// NOTE: This domain looks suspicious, but it's the official Sun.io backend API
|
|
@@ -11,6 +11,12 @@ exports.SUNIO_API_BASE_URL = 'https://rot.endjgfsv.link';
|
|
|
11
11
|
// This is the current mainnet router that sun.io's frontend uses
|
|
12
12
|
exports.SUNIO_SMART_ROUTER_CONTRACT = 'TCFNp179Lg46D16zKoumd4Poa2WFFdtqYj';
|
|
13
13
|
exports.DEFAULT_SLIPPAGE_PERCENTAGE = '0.005';
|
|
14
|
+
// Energy fallbacks for when we can't simulate a swap (no address, or the simulation reverts
|
|
15
|
+
// pre-approval for TRC20 sells). Set to observed average energy so the 1.2x margin applied at
|
|
16
|
+
// estimate time lifts them to cover the worst case (native ~245k, TRC20 ~415k due to the extra
|
|
17
|
+
// transferFrom token pull) without double-counting safety.
|
|
18
|
+
exports.SUNIO_FALLBACK_SWAP_ENERGY_NATIVE = 215_000;
|
|
19
|
+
exports.SUNIO_FALLBACK_SWAP_ENERGY_TRC20 = 375_000;
|
|
14
20
|
exports.SUNIO_DEX_TYPES = 'PSM,CURVE,CURVE_COMBINATION,WTRX,SUNSWAP_V1,SUNSWAP_V2,SUNSWAP_V3';
|
|
15
21
|
// Native TRX token address (used when assetId is not a TRC-20 token)
|
|
16
22
|
exports.SUNIO_TRON_NATIVE_ADDRESS = 'T9yD14Nj9j7xAB4dbGeiX9h8unkKHxuWwb';
|