@shapeshiftoss/swapper 17.6.9 → 17.6.11
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/LICENSE.md +21 -0
- package/dist/cjs/.tsbuildinfo +1 -1
- package/dist/cjs/constants.js +72 -43
- package/dist/cjs/cowswap-utils/constants.js +3 -0
- package/dist/cjs/cowswap-utils/index.js +6 -0
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/swappers/AcrossSwapper/AcrossSwapper.d.ts +2 -0
- package/dist/cjs/swappers/AcrossSwapper/AcrossSwapper.js +8 -0
- package/dist/cjs/swappers/AcrossSwapper/constant.d.ts +9 -0
- package/dist/cjs/swappers/AcrossSwapper/constant.js +50 -0
- package/dist/cjs/swappers/AcrossSwapper/endpoints.d.ts +2 -0
- package/dist/cjs/swappers/AcrossSwapper/endpoints.js +113 -0
- package/dist/cjs/swappers/AcrossSwapper/getTradeQuote/getTradeQuote.d.ts +3 -0
- package/dist/cjs/swappers/AcrossSwapper/getTradeQuote/getTradeQuote.js +31 -0
- package/dist/cjs/swappers/AcrossSwapper/getTradeRate/getTradeRate.d.ts +3 -0
- package/dist/cjs/swappers/AcrossSwapper/getTradeRate/getTradeRate.js +19 -0
- package/dist/cjs/swappers/AcrossSwapper/index.d.ts +1 -0
- package/dist/cjs/swappers/AcrossSwapper/index.js +5 -0
- package/dist/cjs/swappers/AcrossSwapper/utils/acrossService.d.ts +5 -0
- package/dist/cjs/swappers/AcrossSwapper/utils/acrossService.js +17 -0
- package/dist/cjs/swappers/AcrossSwapper/utils/fetchAcrossTrade.d.ts +19 -0
- package/dist/cjs/swappers/AcrossSwapper/utils/fetchAcrossTrade.js +27 -0
- package/dist/cjs/swappers/AcrossSwapper/utils/getTrade.d.ts +11 -0
- package/dist/cjs/swappers/AcrossSwapper/utils/getTrade.js +349 -0
- package/dist/cjs/swappers/AcrossSwapper/utils/types.d.ts +177 -0
- package/dist/cjs/swappers/AcrossSwapper/utils/types.js +17 -0
- package/dist/cjs/swappers/AvnuSwapper/endpoints.js +42 -14
- package/dist/cjs/swappers/AvnuSwapper/swapperApi/getTradeQuote.js +19 -5
- package/dist/cjs/swappers/AvnuSwapper/swapperApi/getTradeRate.js +17 -4
- package/dist/cjs/swappers/BebopSwapper/BebopSwapper.js +2 -0
- package/dist/cjs/swappers/BebopSwapper/endpoints.js +35 -2
- package/dist/cjs/swappers/BebopSwapper/executeSolanaMessage.d.ts +2 -0
- package/dist/cjs/swappers/BebopSwapper/executeSolanaMessage.js +47 -0
- package/dist/cjs/swappers/BebopSwapper/getBebopSolanaTradeQuote/getBebopSolanaTradeQuote.d.ts +4 -0
- package/dist/cjs/swappers/BebopSwapper/getBebopSolanaTradeQuote/getBebopSolanaTradeQuote.js +91 -0
- package/dist/cjs/swappers/BebopSwapper/getBebopSolanaTradeRate/getBebopSolanaTradeRate.d.ts +4 -0
- package/dist/cjs/swappers/BebopSwapper/getBebopSolanaTradeRate/getBebopSolanaTradeRate.js +88 -0
- package/dist/cjs/swappers/BebopSwapper/getBebopTradeQuote/getBebopTradeQuote.js +10 -0
- package/dist/cjs/swappers/BebopSwapper/getBebopTradeRate/getBebopTradeRate.js +10 -0
- package/dist/cjs/swappers/BebopSwapper/types.d.ts +49 -1
- package/dist/cjs/swappers/BebopSwapper/types.js +9 -2
- package/dist/cjs/swappers/BebopSwapper/utils/fetchFromBebop.d.ts +19 -1
- package/dist/cjs/swappers/BebopSwapper/utils/fetchFromBebop.js +86 -1
- package/dist/cjs/swappers/BebopSwapper/utils/helpers/helpers.d.ts +14 -2
- package/dist/cjs/swappers/BebopSwapper/utils/helpers/helpers.js +47 -1
- package/dist/cjs/swappers/ButterSwap/ButterSwap.js +1 -0
- package/dist/cjs/swappers/ButterSwap/endpoints.js +56 -0
- package/dist/cjs/swappers/ButterSwap/swapperApi/checkTradeStatus.js +19 -0
- package/dist/cjs/swappers/ButterSwap/swapperApi/getTradeQuote.js +44 -15
- package/dist/cjs/swappers/ButterSwap/swapperApi/getTradeQuote.test.js +1 -0
- package/dist/cjs/swappers/ButterSwap/swapperApi/getTradeRate.js +33 -16
- package/dist/cjs/swappers/ButterSwap/swapperApi/getTradeRate.test.js +2 -0
- package/dist/cjs/swappers/ButterSwap/types.d.ts +1 -0
- package/dist/cjs/swappers/ButterSwap/utils/helpers.js +1 -0
- package/dist/cjs/swappers/ButterSwap/xhr.d.ts +2 -2
- package/dist/cjs/swappers/ButterSwap/xhr.js +7 -2
- package/dist/cjs/swappers/CetusSwapper/endpoints.js +3 -8
- package/dist/cjs/swappers/CetusSwapper/swapperApi/getTradeQuote.js +11 -1
- package/dist/cjs/swappers/CetusSwapper/swapperApi/getTradeRate.js +11 -1
- package/dist/cjs/swappers/CetusSwapper/utils/helpers.d.ts +1 -1
- package/dist/cjs/swappers/CetusSwapper/utils/helpers.js +1 -1
- package/dist/cjs/swappers/ChainflipSwapper/constants.js +7 -3
- package/dist/cjs/swappers/ChainflipSwapper/utils/getQuoteOrRate.js +28 -5
- package/dist/cjs/swappers/ChainflipSwapper/utils/helpers.js +8 -2
- package/dist/cjs/swappers/CowSwapper/CowSwapper.js +1 -1
- package/dist/cjs/swappers/CowSwapper/getCowSwapTradeQuote/getCowSwapTradeQuote.js +11 -1
- package/dist/cjs/swappers/CowSwapper/getCowSwapTradeQuote/getCowSwapTradeQuote.test.js +5 -5
- package/dist/cjs/swappers/CowSwapper/getCowSwapTradeRate/getCowSwapTradeRate.js +10 -1
- package/dist/cjs/swappers/CowSwapper/utils/helpers/helpers.js +8 -2
- package/dist/cjs/swappers/DebridgeSwapper/DebridgeSwapper.d.ts +2 -0
- package/dist/cjs/swappers/DebridgeSwapper/DebridgeSwapper.js +7 -0
- package/dist/cjs/swappers/DebridgeSwapper/constant.d.ts +5 -0
- package/dist/cjs/swappers/DebridgeSwapper/constant.js +36 -0
- package/dist/cjs/swappers/DebridgeSwapper/endpoints.d.ts +2 -0
- package/dist/cjs/swappers/DebridgeSwapper/endpoints.js +217 -0
- package/dist/cjs/swappers/DebridgeSwapper/getTradeQuote/getTradeQuote.d.ts +3 -0
- package/dist/cjs/swappers/DebridgeSwapper/getTradeQuote/getTradeQuote.js +31 -0
- package/dist/cjs/swappers/DebridgeSwapper/getTradeRate/getTradeRate.d.ts +3 -0
- package/dist/cjs/swappers/DebridgeSwapper/getTradeRate/getTradeRate.js +19 -0
- package/dist/cjs/swappers/DebridgeSwapper/index.d.ts +1 -0
- package/dist/cjs/swappers/DebridgeSwapper/index.js +5 -0
- package/dist/cjs/swappers/DebridgeSwapper/utils/debridgeService.d.ts +5 -0
- package/dist/cjs/swappers/DebridgeSwapper/utils/debridgeService.js +17 -0
- package/dist/cjs/swappers/DebridgeSwapper/utils/fetchDebridgeSingleChainTrade.d.ts +16 -0
- package/dist/cjs/swappers/DebridgeSwapper/utils/fetchDebridgeSingleChainTrade.js +23 -0
- package/dist/cjs/swappers/DebridgeSwapper/utils/fetchDebridgeTrade.d.ts +20 -0
- package/dist/cjs/swappers/DebridgeSwapper/utils/fetchDebridgeTrade.js +29 -0
- package/dist/cjs/swappers/DebridgeSwapper/utils/getTrade.d.ts +11 -0
- package/dist/cjs/swappers/DebridgeSwapper/utils/getTrade.js +369 -0
- package/dist/cjs/swappers/DebridgeSwapper/utils/types.d.ts +155 -0
- package/dist/cjs/swappers/DebridgeSwapper/utils/types.js +9 -0
- package/dist/cjs/swappers/JupiterSwapper/swapperApi/getTradeQuote.js +32 -0
- package/dist/cjs/swappers/JupiterSwapper/swapperApi/getTradeRate.js +9 -0
- package/dist/cjs/swappers/MayachainSwapper/utils/poolAssetHelpers/poolAssetHelpers.js +1 -1
- package/dist/cjs/swappers/NearIntentsSwapper/NearIntentsSwapper.js +1 -0
- package/dist/cjs/swappers/NearIntentsSwapper/endpoints.js +31 -0
- package/dist/cjs/swappers/NearIntentsSwapper/swapperApi/getTradeQuote.js +48 -1
- package/dist/cjs/swappers/NearIntentsSwapper/swapperApi/getTradeRate.js +73 -1
- package/dist/cjs/swappers/NearIntentsSwapper/types.d.ts +1 -1
- package/dist/cjs/swappers/NearIntentsSwapper/types.js +6 -0
- package/dist/cjs/swappers/NearIntentsSwapper/utils/helpers/helpers.js +23 -4
- package/dist/cjs/swappers/PortalsSwapper/getPortalsTradeQuote/getPortalsTradeQuote.js +10 -0
- package/dist/cjs/swappers/PortalsSwapper/getPortalsTradeRate/getPortalsTradeRate.js +8 -3
- package/dist/cjs/swappers/RelaySwapper/constant.js +27 -1
- package/dist/cjs/swappers/RelaySwapper/utils/getRelayDefaultUserAddress.d.ts +1 -1
- package/dist/cjs/swappers/RelaySwapper/utils/getTrade.js +57 -7
- package/dist/cjs/swappers/RelaySwapper/utils/relayTokenToAssetId.js +110 -0
- package/dist/cjs/swappers/RelaySwapper/utils/types.d.ts +15 -0
- package/dist/cjs/swappers/StonfiSwapper/StonfiSwapper.d.ts +2 -0
- package/dist/cjs/swappers/StonfiSwapper/StonfiSwapper.js +8 -0
- package/dist/cjs/swappers/StonfiSwapper/endpoints.d.ts +2 -0
- package/dist/cjs/swappers/StonfiSwapper/endpoints.js +227 -0
- package/dist/cjs/swappers/StonfiSwapper/index.d.ts +4 -0
- package/dist/cjs/swappers/StonfiSwapper/index.js +25 -0
- package/dist/cjs/swappers/StonfiSwapper/swapperApi/getTradeQuote.d.ts +2 -0
- package/dist/cjs/swappers/StonfiSwapper/swapperApi/getTradeQuote.js +129 -0
- package/dist/cjs/swappers/StonfiSwapper/swapperApi/getTradeRate.d.ts +2 -0
- package/dist/cjs/swappers/StonfiSwapper/swapperApi/getTradeRate.js +115 -0
- package/dist/cjs/swappers/StonfiSwapper/types.d.ts +60 -0
- package/dist/cjs/swappers/StonfiSwapper/types.js +5 -0
- package/dist/cjs/swappers/StonfiSwapper/utils/constants.d.ts +5 -0
- package/dist/cjs/swappers/StonfiSwapper/utils/constants.js +8 -0
- package/dist/cjs/swappers/StonfiSwapper/utils/helpers.d.ts +11 -0
- package/dist/cjs/swappers/StonfiSwapper/utils/helpers.js +135 -0
- package/dist/cjs/swappers/StonfiSwapper/utils/omnistonManager.d.ts +5 -0
- package/dist/cjs/swappers/StonfiSwapper/utils/omnistonManager.js +20 -0
- package/dist/cjs/swappers/SunioSwapper/endpoints.js +1 -1
- package/dist/cjs/swappers/SunioSwapper/utils/getQuoteOrRate.js +14 -3
- package/dist/cjs/swappers/ThorchainSwapper/ThorchainSwapper.js +3 -0
- package/dist/cjs/swappers/ThorchainSwapper/endpoints.js +2 -0
- package/dist/cjs/swappers/ThorchainSwapper/generated/generatedTradableAssetMap.json +1 -0
- package/dist/cjs/swappers/ThorchainSwapper/utils/poolAssetHelpers/poolAssetHelpers.d.ts +1 -1
- package/dist/cjs/swappers/ThorchainSwapper/utils/poolAssetHelpers/poolAssetHelpers.js +2 -1
- package/dist/cjs/swappers/ThorchainSwapper/utils/poolAssetHelpers/poolAssetHelpers.test.js +10 -0
- package/dist/cjs/swappers/ZrxSwapper/getZrxTradeQuote/getZrxTradeQuote.js +9 -0
- package/dist/cjs/swappers/ZrxSwapper/getZrxTradeRate/getZrxTradeRate.js +9 -0
- package/dist/cjs/swappers/ZrxSwapper/utils/helpers/helpers.d.ts +1 -1
- package/dist/cjs/swappers/utils/affiliateFee.d.ts +17 -0
- package/dist/cjs/swappers/utils/affiliateFee.js +43 -0
- package/dist/cjs/swappers/utils/filterBuyAssetsBySellAssetId/filterBuyAssetsBySellAssetId.js +2 -5
- package/dist/cjs/swappers/utils/helpers/helpers.js +3 -0
- package/dist/cjs/thorchain-utils/getCallDataFromQuote.d.ts +1 -1
- package/dist/cjs/thorchain-utils/getL1RateOrQuote.js +87 -9
- package/dist/cjs/thorchain-utils/getQuote.js +8 -2
- package/dist/cjs/thorchain-utils/index.d.ts +2 -1
- package/dist/cjs/thorchain-utils/index.js +2 -1
- package/dist/cjs/thorchain-utils/solana/constants.d.ts +1 -0
- package/dist/cjs/thorchain-utils/solana/constants.js +6 -0
- package/dist/cjs/thorchain-utils/solana/getSolanaTransactionFees.d.ts +2 -0
- package/dist/cjs/thorchain-utils/solana/getSolanaTransactionFees.js +41 -0
- package/dist/cjs/thorchain-utils/solana/getThorTxData.d.ts +12 -0
- package/dist/cjs/thorchain-utils/solana/getThorTxData.js +14 -0
- package/dist/cjs/thorchain-utils/solana/getUnsignedSolanaTransaction.d.ts +3 -0
- package/dist/cjs/thorchain-utils/solana/getUnsignedSolanaTransaction.js +64 -0
- package/dist/cjs/thorchain-utils/solana/index.d.ts +3 -0
- package/dist/cjs/thorchain-utils/solana/index.js +19 -0
- package/dist/cjs/tron-utils/getUnsignedTronTransaction.js +22 -2
- package/dist/cjs/types.d.ts +118 -8
- package/dist/cjs/types.js +3 -0
- package/dist/cjs/utils.d.ts +4 -3
- package/dist/cjs/utils.js +35 -7
- package/dist/esm/.tsbuildinfo +1 -1
- package/dist/esm/constants.js +42 -13
- package/dist/esm/cowswap-utils/constants.js +3 -0
- package/dist/esm/cowswap-utils/index.js +6 -0
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/swappers/AcrossSwapper/AcrossSwapper.d.ts +2 -0
- package/dist/esm/swappers/AcrossSwapper/AcrossSwapper.js +5 -0
- package/dist/esm/swappers/AcrossSwapper/constant.d.ts +9 -0
- package/dist/esm/swappers/AcrossSwapper/constant.js +44 -0
- package/dist/esm/swappers/AcrossSwapper/endpoints.d.ts +2 -0
- package/dist/esm/swappers/AcrossSwapper/endpoints.js +107 -0
- package/dist/esm/swappers/AcrossSwapper/getTradeQuote/getTradeQuote.d.ts +3 -0
- package/dist/esm/swappers/AcrossSwapper/getTradeQuote/getTradeQuote.js +27 -0
- package/dist/esm/swappers/AcrossSwapper/getTradeRate/getTradeRate.d.ts +3 -0
- package/dist/esm/swappers/AcrossSwapper/getTradeRate/getTradeRate.js +15 -0
- package/dist/esm/swappers/AcrossSwapper/index.d.ts +1 -0
- package/dist/esm/swappers/AcrossSwapper/index.js +1 -0
- package/dist/esm/swappers/AcrossSwapper/utils/acrossService.d.ts +5 -0
- package/dist/esm/swappers/AcrossSwapper/utils/acrossService.js +11 -0
- package/dist/esm/swappers/AcrossSwapper/utils/fetchAcrossTrade.d.ts +19 -0
- package/dist/esm/swappers/AcrossSwapper/utils/fetchAcrossTrade.js +23 -0
- package/dist/esm/swappers/AcrossSwapper/utils/getTrade.d.ts +11 -0
- package/dist/esm/swappers/AcrossSwapper/utils/getTrade.js +342 -0
- package/dist/esm/swappers/AcrossSwapper/utils/types.d.ts +177 -0
- package/dist/esm/swappers/AcrossSwapper/utils/types.js +13 -0
- package/dist/esm/swappers/AvnuSwapper/endpoints.js +43 -15
- package/dist/esm/swappers/AvnuSwapper/swapperApi/getTradeQuote.js +19 -5
- package/dist/esm/swappers/AvnuSwapper/swapperApi/getTradeRate.js +17 -4
- package/dist/esm/swappers/BebopSwapper/BebopSwapper.js +2 -0
- package/dist/esm/swappers/BebopSwapper/endpoints.js +36 -3
- package/dist/esm/swappers/BebopSwapper/executeSolanaMessage.d.ts +2 -0
- package/dist/esm/swappers/BebopSwapper/executeSolanaMessage.js +40 -0
- package/dist/esm/swappers/BebopSwapper/getBebopSolanaTradeQuote/getBebopSolanaTradeQuote.d.ts +4 -0
- package/dist/esm/swappers/BebopSwapper/getBebopSolanaTradeQuote/getBebopSolanaTradeQuote.js +87 -0
- package/dist/esm/swappers/BebopSwapper/getBebopSolanaTradeRate/getBebopSolanaTradeRate.d.ts +4 -0
- package/dist/esm/swappers/BebopSwapper/getBebopSolanaTradeRate/getBebopSolanaTradeRate.js +84 -0
- package/dist/esm/swappers/BebopSwapper/getBebopTradeQuote/getBebopTradeQuote.js +10 -0
- package/dist/esm/swappers/BebopSwapper/getBebopTradeRate/getBebopTradeRate.js +10 -0
- package/dist/esm/swappers/BebopSwapper/types.d.ts +49 -1
- package/dist/esm/swappers/BebopSwapper/types.js +8 -1
- package/dist/esm/swappers/BebopSwapper/utils/fetchFromBebop.d.ts +19 -1
- package/dist/esm/swappers/BebopSwapper/utils/fetchFromBebop.js +85 -2
- package/dist/esm/swappers/BebopSwapper/utils/helpers/helpers.d.ts +14 -2
- package/dist/esm/swappers/BebopSwapper/utils/helpers/helpers.js +44 -1
- package/dist/esm/swappers/ButterSwap/ButterSwap.js +2 -1
- package/dist/esm/swappers/ButterSwap/endpoints.js +56 -0
- package/dist/esm/swappers/ButterSwap/swapperApi/checkTradeStatus.js +20 -1
- package/dist/esm/swappers/ButterSwap/swapperApi/getTradeQuote.js +46 -17
- package/dist/esm/swappers/ButterSwap/swapperApi/getTradeQuote.test.js +1 -0
- package/dist/esm/swappers/ButterSwap/swapperApi/getTradeRate.js +35 -18
- package/dist/esm/swappers/ButterSwap/swapperApi/getTradeRate.test.js +2 -0
- package/dist/esm/swappers/ButterSwap/types.d.ts +1 -0
- package/dist/esm/swappers/ButterSwap/utils/helpers.js +1 -0
- package/dist/esm/swappers/ButterSwap/xhr.d.ts +2 -2
- package/dist/esm/swappers/ButterSwap/xhr.js +8 -3
- package/dist/esm/swappers/CetusSwapper/endpoints.js +3 -8
- package/dist/esm/swappers/CetusSwapper/swapperApi/getTradeQuote.js +11 -1
- package/dist/esm/swappers/CetusSwapper/swapperApi/getTradeRate.js +11 -1
- package/dist/esm/swappers/CetusSwapper/utils/helpers.d.ts +1 -1
- package/dist/esm/swappers/CetusSwapper/utils/helpers.js +1 -1
- package/dist/esm/swappers/ChainflipSwapper/constants.js +8 -4
- package/dist/esm/swappers/ChainflipSwapper/utils/getQuoteOrRate.js +29 -6
- package/dist/esm/swappers/ChainflipSwapper/utils/helpers.js +9 -3
- package/dist/esm/swappers/CowSwapper/CowSwapper.js +1 -1
- package/dist/esm/swappers/CowSwapper/getCowSwapTradeQuote/getCowSwapTradeQuote.js +11 -1
- package/dist/esm/swappers/CowSwapper/getCowSwapTradeQuote/getCowSwapTradeQuote.test.js +5 -5
- package/dist/esm/swappers/CowSwapper/getCowSwapTradeRate/getCowSwapTradeRate.js +10 -1
- package/dist/esm/swappers/CowSwapper/utils/helpers/helpers.js +9 -3
- package/dist/esm/swappers/DebridgeSwapper/DebridgeSwapper.d.ts +2 -0
- package/dist/esm/swappers/DebridgeSwapper/DebridgeSwapper.js +4 -0
- package/dist/esm/swappers/DebridgeSwapper/constant.d.ts +5 -0
- package/dist/esm/swappers/DebridgeSwapper/constant.js +30 -0
- package/dist/esm/swappers/DebridgeSwapper/endpoints.d.ts +2 -0
- package/dist/esm/swappers/DebridgeSwapper/endpoints.js +211 -0
- package/dist/esm/swappers/DebridgeSwapper/getTradeQuote/getTradeQuote.d.ts +3 -0
- package/dist/esm/swappers/DebridgeSwapper/getTradeQuote/getTradeQuote.js +27 -0
- package/dist/esm/swappers/DebridgeSwapper/getTradeRate/getTradeRate.d.ts +3 -0
- package/dist/esm/swappers/DebridgeSwapper/getTradeRate/getTradeRate.js +15 -0
- package/dist/esm/swappers/DebridgeSwapper/index.d.ts +1 -0
- package/dist/esm/swappers/DebridgeSwapper/index.js +1 -0
- package/dist/esm/swappers/DebridgeSwapper/utils/debridgeService.d.ts +5 -0
- package/dist/esm/swappers/DebridgeSwapper/utils/debridgeService.js +11 -0
- package/dist/esm/swappers/DebridgeSwapper/utils/fetchDebridgeSingleChainTrade.d.ts +16 -0
- package/dist/esm/swappers/DebridgeSwapper/utils/fetchDebridgeSingleChainTrade.js +19 -0
- package/dist/esm/swappers/DebridgeSwapper/utils/fetchDebridgeTrade.d.ts +20 -0
- package/dist/esm/swappers/DebridgeSwapper/utils/fetchDebridgeTrade.js +25 -0
- package/dist/esm/swappers/DebridgeSwapper/utils/getTrade.d.ts +11 -0
- package/dist/esm/swappers/DebridgeSwapper/utils/getTrade.js +362 -0
- package/dist/esm/swappers/DebridgeSwapper/utils/types.d.ts +155 -0
- package/dist/esm/swappers/DebridgeSwapper/utils/types.js +5 -0
- package/dist/esm/swappers/JupiterSwapper/swapperApi/getTradeQuote.js +33 -1
- package/dist/esm/swappers/JupiterSwapper/swapperApi/getTradeRate.js +9 -0
- package/dist/esm/swappers/MayachainSwapper/utils/poolAssetHelpers/poolAssetHelpers.js +1 -1
- package/dist/esm/swappers/NearIntentsSwapper/NearIntentsSwapper.js +2 -1
- package/dist/esm/swappers/NearIntentsSwapper/endpoints.js +31 -0
- package/dist/esm/swappers/NearIntentsSwapper/swapperApi/getTradeQuote.js +50 -3
- package/dist/esm/swappers/NearIntentsSwapper/swapperApi/getTradeRate.js +75 -3
- package/dist/esm/swappers/NearIntentsSwapper/types.d.ts +1 -1
- package/dist/esm/swappers/NearIntentsSwapper/types.js +6 -0
- package/dist/esm/swappers/NearIntentsSwapper/utils/helpers/helpers.js +23 -4
- package/dist/esm/swappers/PortalsSwapper/getPortalsTradeQuote/getPortalsTradeQuote.js +10 -0
- package/dist/esm/swappers/PortalsSwapper/getPortalsTradeRate/getPortalsTradeRate.js +8 -3
- package/dist/esm/swappers/RelaySwapper/constant.js +29 -3
- package/dist/esm/swappers/RelaySwapper/utils/getRelayDefaultUserAddress.d.ts +1 -1
- package/dist/esm/swappers/RelaySwapper/utils/getTrade.js +60 -10
- package/dist/esm/swappers/RelaySwapper/utils/relayTokenToAssetId.js +110 -0
- package/dist/esm/swappers/RelaySwapper/utils/types.d.ts +15 -0
- package/dist/esm/swappers/StonfiSwapper/StonfiSwapper.d.ts +2 -0
- package/dist/esm/swappers/StonfiSwapper/StonfiSwapper.js +5 -0
- package/dist/esm/swappers/StonfiSwapper/endpoints.d.ts +2 -0
- package/dist/esm/swappers/StonfiSwapper/endpoints.js +224 -0
- package/dist/esm/swappers/StonfiSwapper/index.d.ts +4 -0
- package/dist/esm/swappers/StonfiSwapper/index.js +4 -0
- package/dist/esm/swappers/StonfiSwapper/swapperApi/getTradeQuote.d.ts +2 -0
- package/dist/esm/swappers/StonfiSwapper/swapperApi/getTradeQuote.js +125 -0
- package/dist/esm/swappers/StonfiSwapper/swapperApi/getTradeRate.d.ts +2 -0
- package/dist/esm/swappers/StonfiSwapper/swapperApi/getTradeRate.js +111 -0
- package/dist/esm/swappers/StonfiSwapper/types.d.ts +60 -0
- package/dist/esm/swappers/StonfiSwapper/types.js +2 -0
- package/dist/esm/swappers/StonfiSwapper/utils/constants.d.ts +5 -0
- package/dist/esm/swappers/StonfiSwapper/utils/constants.js +5 -0
- package/dist/esm/swappers/StonfiSwapper/utils/helpers.d.ts +11 -0
- package/dist/esm/swappers/StonfiSwapper/utils/helpers.js +124 -0
- package/dist/esm/swappers/StonfiSwapper/utils/omnistonManager.d.ts +5 -0
- package/dist/esm/swappers/StonfiSwapper/utils/omnistonManager.js +17 -0
- package/dist/esm/swappers/SunioSwapper/endpoints.js +1 -1
- package/dist/esm/swappers/SunioSwapper/utils/getQuoteOrRate.js +15 -4
- package/dist/esm/swappers/ThorchainSwapper/ThorchainSwapper.js +3 -0
- package/dist/esm/swappers/ThorchainSwapper/endpoints.js +3 -1
- package/dist/esm/swappers/ThorchainSwapper/generated/generatedTradableAssetMap.json +1 -0
- package/dist/esm/swappers/ThorchainSwapper/utils/poolAssetHelpers/poolAssetHelpers.d.ts +1 -1
- package/dist/esm/swappers/ThorchainSwapper/utils/poolAssetHelpers/poolAssetHelpers.js +2 -1
- package/dist/esm/swappers/ThorchainSwapper/utils/poolAssetHelpers/poolAssetHelpers.test.js +11 -1
- package/dist/esm/swappers/ZrxSwapper/getZrxTradeQuote/getZrxTradeQuote.js +9 -0
- package/dist/esm/swappers/ZrxSwapper/getZrxTradeRate/getZrxTradeRate.js +9 -0
- package/dist/esm/swappers/ZrxSwapper/utils/helpers/helpers.d.ts +1 -1
- package/dist/esm/swappers/utils/affiliateFee.d.ts +17 -0
- package/dist/esm/swappers/utils/affiliateFee.js +39 -0
- package/dist/esm/swappers/utils/filterBuyAssetsBySellAssetId/filterBuyAssetsBySellAssetId.js +2 -5
- package/dist/esm/swappers/utils/helpers/helpers.js +4 -1
- package/dist/esm/thorchain-utils/getCallDataFromQuote.d.ts +1 -1
- package/dist/esm/thorchain-utils/getL1RateOrQuote.js +88 -10
- package/dist/esm/thorchain-utils/getQuote.js +9 -3
- package/dist/esm/thorchain-utils/index.d.ts +2 -1
- package/dist/esm/thorchain-utils/index.js +1 -0
- package/dist/esm/thorchain-utils/solana/constants.d.ts +1 -0
- package/dist/esm/thorchain-utils/solana/constants.js +3 -0
- package/dist/esm/thorchain-utils/solana/getSolanaTransactionFees.d.ts +2 -0
- package/dist/esm/thorchain-utils/solana/getSolanaTransactionFees.js +37 -0
- package/dist/esm/thorchain-utils/solana/getThorTxData.d.ts +12 -0
- package/dist/esm/thorchain-utils/solana/getThorTxData.js +10 -0
- package/dist/esm/thorchain-utils/solana/getUnsignedSolanaTransaction.d.ts +3 -0
- package/dist/esm/thorchain-utils/solana/getUnsignedSolanaTransaction.js +60 -0
- package/dist/esm/thorchain-utils/solana/index.d.ts +3 -0
- package/dist/esm/thorchain-utils/solana/index.js +3 -0
- package/dist/esm/tron-utils/getUnsignedTronTransaction.js +22 -2
- package/dist/esm/types.d.ts +118 -8
- package/dist/esm/types.js +3 -0
- package/dist/esm/utils.d.ts +4 -3
- package/dist/esm/utils.js +34 -7
- package/package.json +27 -24
package/dist/cjs/types.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { QuoteResponse } from '@jup-ag/api';
|
|
2
2
|
import type { AccountId, AssetId, ChainId, Nominal } from '@shapeshiftoss/caip';
|
|
3
|
-
import type { ChainAdapter, CosmosSdkChainAdapter, EvmChainAdapter, near, SignTx, solana, starknet, sui, tron, UtxoChainAdapter } from '@shapeshiftoss/chain-adapters';
|
|
3
|
+
import type { ChainAdapter, CosmosSdkChainAdapter, EvmChainAdapter, near, SignTx, solana, starknet, sui, ton, tron, UtxoChainAdapter } from '@shapeshiftoss/chain-adapters';
|
|
4
4
|
import type { HDWallet, SolanaSignTx, StarknetSignTx, SuiSignTx } from '@shapeshiftoss/hdwallet-core';
|
|
5
|
-
import type { AccountMetadata, Asset, AssetsByIdPartial, CosmosSdkChainId, EvmChainId, KnownChainIds, NearChainId, OrderQuoteResponse, PartialRecord, TronChainId, UtxoAccountType, UtxoChainId } from '@shapeshiftoss/types';
|
|
5
|
+
import type { AccountMetadata, Asset, AssetsByIdPartial, CosmosSdkChainId, EvmChainId, KnownChainIds, NearChainId, OrderQuoteResponse, PartialRecord, SolanaChainId, TonChainId, TronChainId, UtxoAccountType, UtxoChainId } from '@shapeshiftoss/types';
|
|
6
6
|
import type { TxStatus } from '@shapeshiftoss/unchained-client';
|
|
7
7
|
import type { Result } from '@sniptt/monads';
|
|
8
8
|
import type { TransactionInstruction } from '@solana/web3.js';
|
|
@@ -11,7 +11,9 @@ import type { Mixpanel } from 'mixpanel-browser';
|
|
|
11
11
|
import type Polyglot from 'node-polyglot';
|
|
12
12
|
import type { InterpolationOptions } from 'node-polyglot';
|
|
13
13
|
import type { Address, Hex } from 'viem';
|
|
14
|
+
import type { AcrossTransactionMetadata } from './swappers/AcrossSwapper/utils/types';
|
|
14
15
|
import type { CowMessageToSign } from './swappers/CowSwapper/types';
|
|
16
|
+
import type { DebridgeTransactionMetadata } from './swappers/DebridgeSwapper/utils/types';
|
|
15
17
|
import type { RelayTransactionMetadata } from './swappers/RelaySwapper/utils/types';
|
|
16
18
|
import type { makeSwapperAxiosServiceMonadic } from './utils';
|
|
17
19
|
export type SwapperConfig = {
|
|
@@ -47,6 +49,9 @@ export type SwapperConfig = {
|
|
|
47
49
|
VITE_TENDERLY_ACCOUNT_SLUG: string;
|
|
48
50
|
VITE_TENDERLY_PROJECT_SLUG: string;
|
|
49
51
|
VITE_SUI_NODE_URL: string;
|
|
52
|
+
VITE_ACROSS_API_URL: string;
|
|
53
|
+
VITE_ACROSS_INTEGRATOR_ID: string;
|
|
54
|
+
VITE_DEBRIDGE_API_URL: string;
|
|
50
55
|
};
|
|
51
56
|
export declare enum SwapperName {
|
|
52
57
|
Thorchain = "THORChain",
|
|
@@ -64,7 +69,10 @@ export declare enum SwapperName {
|
|
|
64
69
|
NearIntents = "NEAR Intents",
|
|
65
70
|
Cetus = "Cetus",
|
|
66
71
|
Sunio = "Sun.io",
|
|
67
|
-
Avnu = "AVNU"
|
|
72
|
+
Avnu = "AVNU",
|
|
73
|
+
Stonfi = "STON.fi",
|
|
74
|
+
Across = "Across",
|
|
75
|
+
Debridge = "deBridge"
|
|
68
76
|
}
|
|
69
77
|
export type SwapSource = SwapperName | `${SwapperName} • ${string}`;
|
|
70
78
|
export type SwapErrorRight = {
|
|
@@ -128,6 +136,7 @@ type CommonTradeInputBase = {
|
|
|
128
136
|
buyAsset: Asset;
|
|
129
137
|
sellAmountIncludingProtocolFeesCryptoBaseUnit: string;
|
|
130
138
|
affiliateBps: string;
|
|
139
|
+
affiliateAddress?: string;
|
|
131
140
|
allowMultiHop: boolean;
|
|
132
141
|
slippageTolerancePercentageDecimal?: string;
|
|
133
142
|
};
|
|
@@ -183,6 +192,24 @@ export type GetNearTradeQuoteInput = CommonTradeInput & {
|
|
|
183
192
|
export type GetNearTradeRateInput = CommonTradeRateInput & {
|
|
184
193
|
chainId: NearChainId;
|
|
185
194
|
};
|
|
195
|
+
export type GetTonTradeQuoteInputBase = CommonTradeInput & {
|
|
196
|
+
chainId: TonChainId;
|
|
197
|
+
};
|
|
198
|
+
export type GetTonTradeQuoteInput = CommonTradeInput & {
|
|
199
|
+
chainId: TonChainId;
|
|
200
|
+
};
|
|
201
|
+
export type GetTonTradeRateInput = CommonTradeRateInput & {
|
|
202
|
+
chainId: TonChainId;
|
|
203
|
+
};
|
|
204
|
+
export type GetSolanaTradeQuoteInputBase = CommonTradeInput & {
|
|
205
|
+
chainId: SolanaChainId;
|
|
206
|
+
};
|
|
207
|
+
export type GetSolanaTradeQuoteInput = CommonTradeInput & {
|
|
208
|
+
chainId: SolanaChainId;
|
|
209
|
+
};
|
|
210
|
+
export type GetSolanaTradeRateInput = CommonTradeRateInput & {
|
|
211
|
+
chainId: SolanaChainId;
|
|
212
|
+
};
|
|
186
213
|
type GetUtxoTradeQuoteWithWallet = CommonTradeQuoteInput & {
|
|
187
214
|
chainId: UtxoChainId;
|
|
188
215
|
accountType: UtxoAccountType;
|
|
@@ -196,9 +223,9 @@ export type GetUtxoTradeRateInput = CommonTradeRateInput & {
|
|
|
196
223
|
xpub: string | undefined;
|
|
197
224
|
};
|
|
198
225
|
export type GetUtxoTradeQuoteInput = GetUtxoTradeQuoteWithWallet;
|
|
199
|
-
export type GetTradeQuoteInput = GetUtxoTradeQuoteInput | GetEvmTradeQuoteInput | GetCosmosSdkTradeQuoteInput | GetTronTradeQuoteInput | GetNearTradeQuoteInput;
|
|
200
|
-
export type GetTradeRateInput = GetEvmTradeRateInput | GetCosmosSdkTradeRateInput | GetUtxoTradeRateInput | GetTronTradeRateInput | GetNearTradeRateInput;
|
|
201
|
-
export type GetTradeQuoteInputWithWallet = GetUtxoTradeQuoteWithWallet | GetEvmTradeQuoteInputBase | GetCosmosSdkTradeQuoteInputBase | GetTronTradeQuoteInputBase | GetNearTradeQuoteInputBase;
|
|
226
|
+
export type GetTradeQuoteInput = GetUtxoTradeQuoteInput | GetEvmTradeQuoteInput | GetCosmosSdkTradeQuoteInput | GetTronTradeQuoteInput | GetNearTradeQuoteInput | GetTonTradeQuoteInput | GetSolanaTradeQuoteInput;
|
|
227
|
+
export type GetTradeRateInput = GetEvmTradeRateInput | GetCosmosSdkTradeRateInput | GetUtxoTradeRateInput | GetTronTradeRateInput | GetNearTradeRateInput | GetTonTradeRateInput | GetSolanaTradeRateInput;
|
|
228
|
+
export type GetTradeQuoteInputWithWallet = GetUtxoTradeQuoteWithWallet | GetEvmTradeQuoteInputBase | GetCosmosSdkTradeQuoteInputBase | GetTronTradeQuoteInputBase | GetNearTradeQuoteInputBase | GetTonTradeQuoteInputBase | GetSolanaTradeQuoteInputBase;
|
|
202
229
|
export type EvmSwapperDeps = {
|
|
203
230
|
assertGetEvmChainAdapter: (chainId: ChainId) => EvmChainAdapter;
|
|
204
231
|
fetchIsSmartContractAddressQuery: (userAddress: string, chainId: ChainId) => Promise<boolean>;
|
|
@@ -224,12 +251,21 @@ export type NearSwapperDeps = {
|
|
|
224
251
|
export type StarknetSwapperDeps = {
|
|
225
252
|
assertGetStarknetChainAdapter: (chainId: ChainId) => starknet.ChainAdapter;
|
|
226
253
|
};
|
|
254
|
+
export type TonSwapperDeps = {
|
|
255
|
+
assertGetTonChainAdapter: (chainId: ChainId) => ton.ChainAdapter;
|
|
256
|
+
};
|
|
227
257
|
export type SwapperDeps = {
|
|
228
258
|
assetsById: AssetsByIdPartial;
|
|
229
259
|
config: SwapperConfig;
|
|
230
260
|
mixPanel: Mixpanel | undefined;
|
|
231
261
|
assertGetChainAdapter: (chainId: ChainId) => ChainAdapter<KnownChainIds>;
|
|
232
|
-
} & EvmSwapperDeps & UtxoSwapperDeps & CosmosSdkSwapperDeps & SolanaSwapperDeps & TronSwapperDeps & SuiSwapperDeps & NearSwapperDeps & StarknetSwapperDeps;
|
|
262
|
+
} & EvmSwapperDeps & UtxoSwapperDeps & CosmosSdkSwapperDeps & SolanaSwapperDeps & TronSwapperDeps & SuiSwapperDeps & NearSwapperDeps & StarknetSwapperDeps & TonSwapperDeps;
|
|
263
|
+
export type AffiliateFee = {
|
|
264
|
+
assetId: AssetId;
|
|
265
|
+
amountCryptoBaseUnit: string;
|
|
266
|
+
asset: Asset;
|
|
267
|
+
isEstimate?: boolean;
|
|
268
|
+
};
|
|
233
269
|
export type TradeQuoteStep = {
|
|
234
270
|
buyAmountBeforeFeesCryptoBaseUnit: string;
|
|
235
271
|
buyAmountAfterFeesCryptoBaseUnit: string;
|
|
@@ -269,10 +305,14 @@ export type TradeQuoteStep = {
|
|
|
269
305
|
value: Hex;
|
|
270
306
|
gas?: string;
|
|
271
307
|
};
|
|
308
|
+
bebopSolanaSerializedTx?: string;
|
|
309
|
+
bebopQuoteId?: string;
|
|
272
310
|
jupiterQuoteResponse?: QuoteResponse;
|
|
273
311
|
solanaTransactionMetadata?: {
|
|
274
312
|
addressLookupTableAddresses: string[];
|
|
275
313
|
instructions?: TransactionInstruction[];
|
|
314
|
+
/** True when the serialized tx exceeds the 1232-byte Solana limit and needs Jito bundle splitting */
|
|
315
|
+
isOversized?: boolean;
|
|
276
316
|
};
|
|
277
317
|
cowswapQuoteResponse?: OrderQuoteResponse;
|
|
278
318
|
chainflipSpecific?: {
|
|
@@ -297,6 +337,13 @@ export type TradeQuoteStep = {
|
|
|
297
337
|
data: string;
|
|
298
338
|
value: Hex;
|
|
299
339
|
gasLimit: string;
|
|
340
|
+
method?: string;
|
|
341
|
+
args?: {
|
|
342
|
+
type: string;
|
|
343
|
+
value: unknown;
|
|
344
|
+
}[];
|
|
345
|
+
memo?: string;
|
|
346
|
+
serializedSolanaTransaction?: string;
|
|
300
347
|
};
|
|
301
348
|
sunioTransactionMetadata?: {
|
|
302
349
|
route: {
|
|
@@ -317,6 +364,43 @@ export type TradeQuoteStep = {
|
|
|
317
364
|
quoteId: string;
|
|
318
365
|
routes: any[];
|
|
319
366
|
};
|
|
367
|
+
stonfiSpecific?: {
|
|
368
|
+
quoteId: string;
|
|
369
|
+
resolverId: string;
|
|
370
|
+
resolverName: string;
|
|
371
|
+
tradeStartDeadline: number;
|
|
372
|
+
gasBudget: string;
|
|
373
|
+
bidAssetAddress: {
|
|
374
|
+
blockchain: number;
|
|
375
|
+
address: string;
|
|
376
|
+
};
|
|
377
|
+
askAssetAddress: {
|
|
378
|
+
blockchain: number;
|
|
379
|
+
address: string;
|
|
380
|
+
};
|
|
381
|
+
bidUnits: string;
|
|
382
|
+
askUnits: string;
|
|
383
|
+
referrerAddress?: {
|
|
384
|
+
blockchain: number;
|
|
385
|
+
address: string;
|
|
386
|
+
};
|
|
387
|
+
referrerFeeAsset?: {
|
|
388
|
+
blockchain: number;
|
|
389
|
+
address: string;
|
|
390
|
+
};
|
|
391
|
+
referrerFeeUnits: string;
|
|
392
|
+
protocolFeeAsset?: {
|
|
393
|
+
blockchain: number;
|
|
394
|
+
address: string;
|
|
395
|
+
};
|
|
396
|
+
protocolFeeUnits: string;
|
|
397
|
+
quoteTimestamp: number;
|
|
398
|
+
estimatedGasConsumption: string;
|
|
399
|
+
params?: unknown;
|
|
400
|
+
};
|
|
401
|
+
acrossTransactionMetadata?: AcrossTransactionMetadata;
|
|
402
|
+
debridgeTransactionMetadata?: DebridgeTransactionMetadata;
|
|
403
|
+
affiliateFee?: AffiliateFee;
|
|
320
404
|
};
|
|
321
405
|
export type TradeRateStep = Omit<TradeQuoteStep, 'accountNumber'> & {
|
|
322
406
|
accountNumber: undefined;
|
|
@@ -370,6 +454,8 @@ export type SwapperSpecificMetadata = {
|
|
|
370
454
|
deadline: string;
|
|
371
455
|
};
|
|
372
456
|
relayTransactionMetadata: RelayTransactionMetadata | undefined;
|
|
457
|
+
acrossTransactionMetadata: AcrossTransactionMetadata | undefined;
|
|
458
|
+
debridgeTransactionMetadata: DebridgeTransactionMetadata | undefined;
|
|
373
459
|
relayerExplorerTxLink: string | undefined;
|
|
374
460
|
relayerTxHash: string | undefined;
|
|
375
461
|
stepIndex: SupportedTradeQuoteStepIndex;
|
|
@@ -462,6 +548,15 @@ export type CosmosSdkTransactionExecutionProps = {
|
|
|
462
548
|
};
|
|
463
549
|
export type SolanaTransactionExecutionProps = {
|
|
464
550
|
signAndBroadcastTransaction: (txToSign: SolanaSignTx) => Promise<string>;
|
|
551
|
+
/** Sign-only callback for Jito bundle flow (sign without broadcasting) */
|
|
552
|
+
signTransaction?: (txToSign: SolanaSignTx) => Promise<string>;
|
|
553
|
+
};
|
|
554
|
+
export type SolanaMessageToSign = {
|
|
555
|
+
serializedTx: string;
|
|
556
|
+
quoteId: string;
|
|
557
|
+
};
|
|
558
|
+
export type SolanaMessageExecutionProps = {
|
|
559
|
+
signSerializedTransaction: (serializedTx: string) => Promise<string[]>;
|
|
465
560
|
};
|
|
466
561
|
export type TronTransactionExecutionProps = {
|
|
467
562
|
signAndBroadcastTransaction: (txToSign: tron.TronSignTx) => Promise<string>;
|
|
@@ -475,6 +570,9 @@ export type NearTransactionExecutionProps = {
|
|
|
475
570
|
export type StarknetTransactionExecutionProps = {
|
|
476
571
|
signAndBroadcastTransaction: (txToSign: StarknetSignTx) => Promise<string>;
|
|
477
572
|
};
|
|
573
|
+
export type TonTransactionExecutionProps = {
|
|
574
|
+
signAndBroadcastTransaction: (txToSign: ton.TonSignTx) => Promise<string>;
|
|
575
|
+
};
|
|
478
576
|
type EvmAccountMetadata = {
|
|
479
577
|
from: string;
|
|
480
578
|
};
|
|
@@ -517,7 +615,12 @@ export type GetUnsignedTronTransactionArgs = CommonGetUnsignedTransactionArgs &
|
|
|
517
615
|
export type GetUnsignedSuiTransactionArgs = CommonGetUnsignedTransactionArgs & SuiAccountMetadata & SuiSwapperDeps;
|
|
518
616
|
export type GetUnsignedNearTransactionArgs = CommonGetUnsignedTransactionArgs & NearAccountMetadata & NearSwapperDeps;
|
|
519
617
|
export type GetUnsignedStarknetTransactionArgs = CommonGetUnsignedTransactionArgs & StarknetAccountMetadata & StarknetSwapperDeps;
|
|
618
|
+
type TonAccountMetadata = {
|
|
619
|
+
from: string;
|
|
620
|
+
};
|
|
621
|
+
export type GetUnsignedTonTransactionArgs = CommonGetUnsignedTransactionArgs & TonAccountMetadata & TonSwapperDeps;
|
|
520
622
|
export type GetUnsignedEvmMessageArgs = CommonGetUnsignedTransactionArgs & EvmAccountMetadata & Omit<EvmSwapperDeps, 'fetchIsSmartContractAddressQuery'>;
|
|
623
|
+
export type GetUnsignedSolanaMessageArgs = CommonGetUnsignedTransactionArgs;
|
|
521
624
|
export type GetUnsignedUtxoTransactionArgs = CommonGetUnsignedTransactionArgs & UtxoAccountMetadata & UtxoSwapperDeps;
|
|
522
625
|
export type GetUnsignedCosmosSdkTransactionArgs = CommonGetUnsignedTransactionArgs & CosmosSdkAccountMetadata & CosmosSdkSwapperDeps;
|
|
523
626
|
export type UnsignedTx = Nominal<Record<string, any>, 'UnsignedTx'>;
|
|
@@ -535,7 +638,7 @@ export type CheckTradeStatusInput = {
|
|
|
535
638
|
stepIndex: SupportedTradeQuoteStepIndex;
|
|
536
639
|
config: SwapperConfig;
|
|
537
640
|
swap: Swap | undefined;
|
|
538
|
-
} & EvmSwapperDeps & UtxoSwapperDeps & CosmosSdkSwapperDeps & SolanaSwapperDeps & TronSwapperDeps & SuiSwapperDeps & NearSwapperDeps & StarknetSwapperDeps;
|
|
641
|
+
} & EvmSwapperDeps & UtxoSwapperDeps & CosmosSdkSwapperDeps & SolanaSwapperDeps & TronSwapperDeps & SuiSwapperDeps & NearSwapperDeps & StarknetSwapperDeps & TonSwapperDeps;
|
|
539
642
|
export type TradeStatus = {
|
|
540
643
|
status: TxStatus;
|
|
541
644
|
buyTxHash: string | undefined;
|
|
@@ -554,10 +657,12 @@ export type Swapper = {
|
|
|
554
657
|
executeUtxoTransaction?: (txToSign: SignTx<UtxoChainId>, callbacks: UtxoTransactionExecutionProps) => Promise<string>;
|
|
555
658
|
executeCosmosSdkTransaction?: (txToSign: SignTx<CosmosSdkChainId>, callbacks: CosmosSdkTransactionExecutionProps) => Promise<string>;
|
|
556
659
|
executeSolanaTransaction?: (txToSign: SolanaSignTx, callbacks: SolanaTransactionExecutionProps) => Promise<string>;
|
|
660
|
+
executeSolanaMessage?: (messageData: SolanaMessageToSign, callbacks: SolanaMessageExecutionProps, config: SwapperConfig) => Promise<string>;
|
|
557
661
|
executeTronTransaction?: (txToSign: tron.TronSignTx, callbacks: TronTransactionExecutionProps) => Promise<string>;
|
|
558
662
|
executeSuiTransaction?: (txToSign: SuiSignTx, callbacks: SuiTransactionExecutionProps) => Promise<string>;
|
|
559
663
|
executeNearTransaction?: (txToSign: near.NearSignTx, callbacks: NearTransactionExecutionProps) => Promise<string>;
|
|
560
664
|
executeStarknetTransaction?: (txToSign: StarknetSignTx, callbacks: StarknetTransactionExecutionProps) => Promise<string>;
|
|
665
|
+
executeTonTransaction?: (txToSign: ton.TonSignTx, callbacks: TonTransactionExecutionProps) => Promise<string>;
|
|
561
666
|
};
|
|
562
667
|
export type SwapperApi = {
|
|
563
668
|
checkTradeStatus: (input: CheckTradeStatusInput) => Promise<TradeStatus>;
|
|
@@ -569,10 +674,12 @@ export type SwapperApi = {
|
|
|
569
674
|
getUnsignedUtxoTransaction?: (input: GetUnsignedUtxoTransactionArgs) => Promise<SignTx<UtxoChainId>>;
|
|
570
675
|
getUnsignedCosmosSdkTransaction?: (input: GetUnsignedCosmosSdkTransactionArgs) => Promise<SignTx<CosmosSdkChainId>>;
|
|
571
676
|
getUnsignedSolanaTransaction?: (input: GetUnsignedSolanaTransactionArgs) => Promise<SolanaSignTx>;
|
|
677
|
+
getUnsignedSolanaMessage?: (input: GetUnsignedSolanaMessageArgs) => Promise<SolanaMessageToSign>;
|
|
572
678
|
getUnsignedTronTransaction?: (input: GetUnsignedTronTransactionArgs) => Promise<tron.TronSignTx>;
|
|
573
679
|
getUnsignedSuiTransaction?: (input: GetUnsignedSuiTransactionArgs) => Promise<SuiSignTx>;
|
|
574
680
|
getUnsignedNearTransaction?: (input: GetUnsignedNearTransactionArgs) => Promise<near.NearSignTx>;
|
|
575
681
|
getUnsignedStarknetTransaction?: (input: GetUnsignedStarknetTransactionArgs) => Promise<StarknetSignTx>;
|
|
682
|
+
getUnsignedTonTransaction?: (input: GetUnsignedTonTransactionArgs) => Promise<ton.TonSignTx>;
|
|
576
683
|
getEvmTransactionFees?: (input: GetUnsignedEvmTransactionArgs) => Promise<string>;
|
|
577
684
|
getSolanaTransactionFees?: (input: GetUnsignedSolanaTransactionArgs) => Promise<string>;
|
|
578
685
|
getSuiTransactionFees?: (input: GetUnsignedSuiTransactionArgs) => Promise<string>;
|
|
@@ -581,6 +688,7 @@ export type SwapperApi = {
|
|
|
581
688
|
getTronTransactionFees?: (input: GetUnsignedTronTransactionArgs) => Promise<string>;
|
|
582
689
|
getNearTransactionFees?: (input: GetUnsignedNearTransactionArgs) => Promise<string>;
|
|
583
690
|
getStarknetTransactionFees?: (input: GetUnsignedStarknetTransactionArgs) => Promise<string>;
|
|
691
|
+
getTonTransactionFees?: (input: GetUnsignedTonTransactionArgs) => Promise<string>;
|
|
584
692
|
};
|
|
585
693
|
export type QuoteResult = Result<TradeQuote[], SwapErrorRight> & {
|
|
586
694
|
swapperName: SwapperName;
|
|
@@ -603,10 +711,12 @@ export type EvmMessageExecutionInput = CommonTradeExecutionInput & EvmMessageExe
|
|
|
603
711
|
export type UtxoTransactionExecutionInput = CommonTradeExecutionInput & UtxoTransactionExecutionProps & UtxoAccountMetadata;
|
|
604
712
|
export type CosmosSdkTransactionExecutionInput = CommonTradeExecutionInput & CosmosSdkTransactionExecutionProps & CosmosSdkAccountMetadata;
|
|
605
713
|
export type SolanaTransactionExecutionInput = CommonTradeExecutionInput & SolanaTransactionExecutionProps & SolanaAccountMetadata;
|
|
714
|
+
export type SolanaMessageExecutionInput = CommonTradeExecutionInput & SolanaMessageExecutionProps;
|
|
606
715
|
export type TronTransactionExecutionInput = CommonTradeExecutionInput & TronTransactionExecutionProps & TronAccountMetadata;
|
|
607
716
|
export type SuiTransactionExecutionInput = CommonTradeExecutionInput & SuiTransactionExecutionProps & SuiAccountMetadata;
|
|
608
717
|
export type NearTransactionExecutionInput = CommonTradeExecutionInput & NearTransactionExecutionProps & NearAccountMetadata;
|
|
609
718
|
export type StarknetTransactionExecutionInput = CommonTradeExecutionInput & StarknetTransactionExecutionProps & StarknetAccountMetadata;
|
|
719
|
+
export type TonTransactionExecutionInput = CommonTradeExecutionInput & TonTransactionExecutionProps & TonAccountMetadata;
|
|
610
720
|
export declare enum TradeExecutionEvent {
|
|
611
721
|
SellTxHash = "sellTxHash",
|
|
612
722
|
RelayerTxHash = "relayerTxHash",
|
package/dist/cjs/types.js
CHANGED
|
@@ -19,6 +19,9 @@ var SwapperName;
|
|
|
19
19
|
SwapperName["Cetus"] = "Cetus";
|
|
20
20
|
SwapperName["Sunio"] = "Sun.io";
|
|
21
21
|
SwapperName["Avnu"] = "AVNU";
|
|
22
|
+
SwapperName["Stonfi"] = "STON.fi";
|
|
23
|
+
SwapperName["Across"] = "Across";
|
|
24
|
+
SwapperName["Debridge"] = "deBridge";
|
|
22
25
|
})(SwapperName || (exports.SwapperName = SwapperName = {}));
|
|
23
26
|
var TradeQuoteError;
|
|
24
27
|
(function (TradeQuoteError) {
|
package/dist/cjs/utils.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { AssetId, ChainId } from '@shapeshiftoss/caip';
|
|
2
|
-
import type { EvmChainAdapter, near, SignTx, solana, starknet, sui } from '@shapeshiftoss/chain-adapters';
|
|
2
|
+
import type { EvmChainAdapter, near, SignTx, solana, starknet, sui, ton } from '@shapeshiftoss/chain-adapters';
|
|
3
|
+
import type { TronSignTx } from '@shapeshiftoss/chain-adapters/src/tron/types';
|
|
3
4
|
import type { SolanaSignTx, StarknetSignTx, SuiSignTx } from '@shapeshiftoss/hdwallet-core';
|
|
4
5
|
import type { Asset, EvmChainId } from '@shapeshiftoss/types';
|
|
5
6
|
import { TxStatus } from '@shapeshiftoss/unchained-client';
|
|
6
7
|
import type { Result } from '@sniptt/monads';
|
|
7
8
|
import type { AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios';
|
|
8
|
-
import type {
|
|
9
|
-
import type { EvmTransactionExecutionProps, ExecutableTradeStep, NearTransactionExecutionProps, SolanaTransactionExecutionProps, StarknetTransactionExecutionProps, SuiTransactionExecutionProps, SupportedTradeQuoteStepIndex, SwapErrorRight, TradeQuote, TradeQuoteStep, TradeRate, TradeStatus, TronTransactionExecutionProps } from './types';
|
|
9
|
+
import type { EvmTransactionExecutionProps, ExecutableTradeStep, NearTransactionExecutionProps, SolanaTransactionExecutionProps, StarknetTransactionExecutionProps, SuiTransactionExecutionProps, SupportedTradeQuoteStepIndex, SwapErrorRight, TonTransactionExecutionProps, TradeQuote, TradeQuoteStep, TradeRate, TradeStatus, TronTransactionExecutionProps } from './types';
|
|
10
10
|
import { TradeQuoteError } from './types';
|
|
11
11
|
export declare const makeSwapErrorRight: ({ details, cause, code, message, }: {
|
|
12
12
|
message: string;
|
|
@@ -32,6 +32,7 @@ export declare const executeTronTransaction: (txToSign: TronSignTx, callbacks: T
|
|
|
32
32
|
export declare const executeSuiTransaction: (txToSign: SuiSignTx, callbacks: SuiTransactionExecutionProps) => Promise<string>;
|
|
33
33
|
export declare const executeNearTransaction: (txToSign: near.NearSignTx, callbacks: NearTransactionExecutionProps) => Promise<string>;
|
|
34
34
|
export declare const executeStarknetTransaction: (txToSign: StarknetSignTx, callbacks: StarknetTransactionExecutionProps) => Promise<string>;
|
|
35
|
+
export declare const executeTonTransaction: (txToSign: ton.TonSignTx, callbacks: TonTransactionExecutionProps) => Promise<string>;
|
|
35
36
|
export declare const createDefaultStatusResponse: (buyTxHash?: string) => {
|
|
36
37
|
status: TxStatus;
|
|
37
38
|
buyTxHash: string | undefined;
|
package/dist/cjs/utils.js
CHANGED
|
@@ -3,8 +3,9 @@ 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.checkStarknetSwapStatus = exports.checkSuiSwapStatus = exports.checkSolanaSwapStatus = exports.getExecutableTradeStep = exports.isExecutableTradeStep = exports.isExecutableTradeQuote = exports.getInputOutputRate = exports.checkEvmSwapStatus = exports.checkSafeTransactionStatus = exports.createDefaultStatusResponse = exports.executeStarknetTransaction = exports.executeNearTransaction = exports.executeSuiTransaction = exports.executeTronTransaction = exports.executeSolanaTransaction = exports.executeEvmTransaction = exports.getHopByIndex = exports.makeSwapperAxiosServiceMonadic = exports.AsyncResultOf = exports.createCache = exports.createTradeAmountTooSmallErr = exports.makeSwapErrorRight = void 0;
|
|
6
|
+
exports.checkStarknetSwapStatus = exports.checkSuiSwapStatus = exports.checkSolanaSwapStatus = exports.getExecutableTradeStep = exports.isExecutableTradeStep = exports.isExecutableTradeQuote = exports.getInputOutputRate = exports.checkEvmSwapStatus = exports.checkSafeTransactionStatus = exports.createDefaultStatusResponse = exports.executeTonTransaction = exports.executeStarknetTransaction = exports.executeNearTransaction = exports.executeSuiTransaction = exports.executeTronTransaction = exports.executeSolanaTransaction = exports.executeEvmTransaction = exports.getHopByIndex = exports.makeSwapperAxiosServiceMonadic = exports.AsyncResultOf = exports.createCache = exports.createTradeAmountTooSmallErr = exports.makeSwapErrorRight = void 0;
|
|
7
7
|
const caip_1 = require("@shapeshiftoss/caip");
|
|
8
|
+
const chain_adapters_1 = require("@shapeshiftoss/chain-adapters");
|
|
8
9
|
const unchained_client_1 = require("@shapeshiftoss/unchained-client");
|
|
9
10
|
const utils_1 = require("@shapeshiftoss/utils");
|
|
10
11
|
const monads_1 = require("@sniptt/monads");
|
|
@@ -113,6 +114,10 @@ const executeStarknetTransaction = (txToSign, callbacks) => {
|
|
|
113
114
|
return callbacks.signAndBroadcastTransaction(txToSign);
|
|
114
115
|
};
|
|
115
116
|
exports.executeStarknetTransaction = executeStarknetTransaction;
|
|
117
|
+
const executeTonTransaction = (txToSign, callbacks) => {
|
|
118
|
+
return callbacks.signAndBroadcastTransaction(txToSign);
|
|
119
|
+
};
|
|
120
|
+
exports.executeTonTransaction = executeTonTransaction;
|
|
116
121
|
const createDefaultStatusResponse = (buyTxHash) => ({
|
|
117
122
|
status: unchained_client_1.TxStatus.Unknown,
|
|
118
123
|
buyTxHash,
|
|
@@ -145,7 +150,9 @@ const checkSafeTransactionStatus = async ({ address, txHash, chainId, assertGetE
|
|
|
145
150
|
// Transaction executed on-chain
|
|
146
151
|
if (isExecutedSafeTx) {
|
|
147
152
|
const adapter = assertGetEvmChainAdapter(chainId);
|
|
148
|
-
const tx = await adapter.httpProvider.getTransaction({
|
|
153
|
+
const tx = await adapter.httpProvider.getTransaction({
|
|
154
|
+
txid: transaction.transactionHash,
|
|
155
|
+
});
|
|
149
156
|
const status = unchained_client_1.evm.getTxStatus(tx);
|
|
150
157
|
return {
|
|
151
158
|
status,
|
|
@@ -157,6 +164,15 @@ const checkSafeTransactionStatus = async ({ address, txHash, chainId, assertGetE
|
|
|
157
164
|
exports.checkSafeTransactionStatus = checkSafeTransactionStatus;
|
|
158
165
|
const checkEvmSwapStatus = async ({ txHash, chainId, address, assertGetEvmChainAdapter, fetchIsSmartContractAddressQuery, }) => {
|
|
159
166
|
try {
|
|
167
|
+
const adapter = assertGetEvmChainAdapter(chainId);
|
|
168
|
+
if ((0, chain_adapters_1.isSecondClassEvmAdapter)(adapter)) {
|
|
169
|
+
const status = await adapter.getTransactionStatus(txHash);
|
|
170
|
+
return {
|
|
171
|
+
status,
|
|
172
|
+
buyTxHash: txHash,
|
|
173
|
+
message: undefined,
|
|
174
|
+
};
|
|
175
|
+
}
|
|
160
176
|
const maybeSafeTransactionStatus = await (0, exports.checkSafeTransactionStatus)({
|
|
161
177
|
address,
|
|
162
178
|
txHash,
|
|
@@ -166,7 +182,6 @@ const checkEvmSwapStatus = async ({ txHash, chainId, address, assertGetEvmChainA
|
|
|
166
182
|
});
|
|
167
183
|
if (maybeSafeTransactionStatus)
|
|
168
184
|
return maybeSafeTransactionStatus;
|
|
169
|
-
const adapter = assertGetEvmChainAdapter(chainId);
|
|
170
185
|
const tx = await adapter.httpProvider.getTransaction({ txid: txHash });
|
|
171
186
|
const status = unchained_client_1.evm.getTxStatus(tx);
|
|
172
187
|
return {
|
|
@@ -182,8 +197,14 @@ const checkEvmSwapStatus = async ({ txHash, chainId, address, assertGetEvmChainA
|
|
|
182
197
|
};
|
|
183
198
|
exports.checkEvmSwapStatus = checkEvmSwapStatus;
|
|
184
199
|
const getInputOutputRate = ({ sellAmountCryptoBaseUnit, buyAmountCryptoBaseUnit, sellAsset, buyAsset, }) => {
|
|
185
|
-
const sellAmountCryptoHuman =
|
|
186
|
-
|
|
200
|
+
const sellAmountCryptoHuman = utils_1.BigAmount.fromBaseUnit({
|
|
201
|
+
value: sellAmountCryptoBaseUnit,
|
|
202
|
+
precision: sellAsset.precision,
|
|
203
|
+
}).toPrecision();
|
|
204
|
+
const buyAmountCryptoHuman = utils_1.BigAmount.fromBaseUnit({
|
|
205
|
+
value: buyAmountCryptoBaseUnit,
|
|
206
|
+
precision: buyAsset.precision,
|
|
207
|
+
}).toPrecision();
|
|
187
208
|
return (0, utils_1.bn)(buyAmountCryptoHuman).div(sellAmountCryptoHuman).toFixed();
|
|
188
209
|
};
|
|
189
210
|
exports.getInputOutputRate = getInputOutputRate;
|
|
@@ -270,7 +291,14 @@ const checkStarknetSwapStatus = async ({ txHash, assertGetStarknetChainAdapter,
|
|
|
270
291
|
try {
|
|
271
292
|
const adapter = assertGetStarknetChainAdapter(caip_1.starknetChainId);
|
|
272
293
|
const provider = adapter.getStarknetProvider();
|
|
273
|
-
|
|
294
|
+
// Use raw RPC call for better compatibility with various RPC providers
|
|
295
|
+
const response = await provider.fetch('starknet_getTransactionReceipt', [txHash]);
|
|
296
|
+
const result = await response.json();
|
|
297
|
+
// If there's an error or no result, transaction might still be pending
|
|
298
|
+
if (result.error || !result.result) {
|
|
299
|
+
return (0, exports.createDefaultStatusResponse)(txHash);
|
|
300
|
+
}
|
|
301
|
+
const receipt = result.result;
|
|
274
302
|
const status = receipt.execution_status === 'SUCCEEDED'
|
|
275
303
|
? unchained_client_1.TxStatus.Confirmed
|
|
276
304
|
: receipt.execution_status === 'REVERTED'
|
|
@@ -283,7 +311,7 @@ const checkStarknetSwapStatus = async ({ txHash, assertGetStarknetChainAdapter,
|
|
|
283
311
|
};
|
|
284
312
|
}
|
|
285
313
|
catch (e) {
|
|
286
|
-
|
|
314
|
+
// Don't log expected errors during status polling (tx might still be pending)
|
|
287
315
|
return (0, exports.createDefaultStatusResponse)(txHash);
|
|
288
316
|
}
|
|
289
317
|
};
|