@shapeshiftoss/swapper 17.7.2 → 17.7.3
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/index.js +7 -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/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 +2 -1
- package/dist/cjs/swappers/BebopSwapper/getBebopTradeQuote/getBebopTradeQuote.js +3 -2
- package/dist/cjs/swappers/BebopSwapper/getBebopTradeRate/getBebopTradeRate.js +3 -2
- package/dist/cjs/swappers/BebopSwapper/types.d.ts +1 -1
- package/dist/cjs/swappers/BebopSwapper/utils/bebopService.d.ts +1 -1
- package/dist/cjs/swappers/BebopSwapper/utils/fetchFromBebop.d.ts +4 -4
- package/dist/cjs/swappers/BebopSwapper/utils/helpers/helpers.d.ts +1 -2
- 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/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/utils/chainflipService.d.ts +3 -3
- package/dist/cjs/swappers/ChainflipSwapper/utils/getQuoteOrRate.js +2 -2
- 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/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/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/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/utils/getQuoteOrRate.js +2 -1
- 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/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 +46 -31
- package/dist/cjs/thorchain-utils/getThresholdedAffiliateBps/getThresholdedAffiliateBps.d.ts +3 -2
- package/dist/cjs/thorchain-utils/getThresholdedAffiliateBps/getThresholdedAffiliateBps.js +21 -14
- package/dist/cjs/thorchain-utils/getThresholdedAffiliateBps/getThresholdedAffiliateBps.test.js +11 -5
- 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/tron-utils/getTronTransactionFees.d.ts +1 -1
- package/dist/cjs/types.d.ts +6 -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/swappers/AcrossSwapper/utils/acrossService.d.ts +3 -3
- package/dist/esm/swappers/ArbitrumBridgeSwapper/endpoints.d.ts +3 -3
- 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/getBebopTradeQuote/getBebopTradeQuote.js +1 -1
- package/dist/esm/swappers/BebopSwapper/getBebopTradeRate/getBebopTradeRate.js +1 -1
- package/dist/esm/swappers/BebopSwapper/types.d.ts +1 -1
- package/dist/esm/swappers/BebopSwapper/utils/bebopService.d.ts +1 -1
- package/dist/esm/swappers/BebopSwapper/utils/fetchFromBebop.d.ts +4 -4
- package/dist/esm/swappers/BebopSwapper/utils/helpers/helpers.d.ts +1 -2
- 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/utils/chainflipService.d.ts +3 -3
- package/dist/esm/swappers/ChainflipSwapper/utils/getQuoteOrRate.js +2 -2
- 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/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/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/utils/fetchRelayTrade.d.ts +1 -1
- package/dist/esm/swappers/RelaySwapper/utils/relayService.d.ts +3 -3
- 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/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 +39 -14
- package/dist/esm/thorchain-utils/getThresholdedAffiliateBps/getThresholdedAffiliateBps.d.ts +3 -2
- package/dist/esm/thorchain-utils/getThresholdedAffiliateBps/getThresholdedAffiliateBps.js +20 -13
- package/dist/esm/thorchain-utils/getThresholdedAffiliateBps/getThresholdedAffiliateBps.test.js +12 -6
- 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/tron-utils/getTronTransactionFees.d.ts +1 -1
- package/dist/esm/types.d.ts +6 -0
- package/dist/esm/utils/tenderly/storageSlots.js +20 -20
- package/dist/esm/utils.d.ts +4 -4
- package/package.json +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const acrossService: {
|
|
2
|
-
get: <T = any>(url: string, config?: import("axios").AxiosRequestConfig<any>) => Promise<import("@sniptt/monads").Result<import("axios").AxiosResponse<T>, import("../../../index.js").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("../../../index.js").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("../../../index.js").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("../../../index.js").SwapErrorRight>>;
|
|
5
5
|
};
|
|
@@ -5,9 +5,9 @@ export declare const getParentToChildMessageDataFromParentTxHash: ({ depositTxId
|
|
|
5
5
|
depositTxId: string;
|
|
6
6
|
parentProvider: ethersv5.providers.JsonRpcProvider;
|
|
7
7
|
childProvider: ethersv5.providers.JsonRpcProvider;
|
|
8
|
-
isClassic?: boolean;
|
|
8
|
+
isClassic?: boolean | undefined;
|
|
9
9
|
}) => Promise<{
|
|
10
|
-
isClassic?: boolean;
|
|
11
|
-
parentToChildMsg?: ParentToChildMessageReaderClassic | ParentToChildMessageReader;
|
|
10
|
+
isClassic?: boolean | undefined;
|
|
11
|
+
parentToChildMsg?: ParentToChildMessageReaderClassic | ParentToChildMessageReader | undefined;
|
|
12
12
|
} | undefined>;
|
|
13
13
|
export declare const arbitrumBridgeApi: SwapperApi;
|
|
@@ -23,12 +23,12 @@ export type FetchArbitrumBridgeQuoteInput = {
|
|
|
23
23
|
assertGetEvmChainAdapter: (chainId: ChainId) => EvmChainAdapter;
|
|
24
24
|
};
|
|
25
25
|
export declare const fetchArbitrumBridgePrice: (args: FetchArbitrumBridgePriceInput) => Promise<{
|
|
26
|
-
request: Omit<ParentToChildTransactionRequest | ChildToParentTransactionRequest,
|
|
26
|
+
request: Omit<ParentToChildTransactionRequest | ChildToParentTransactionRequest, 'retryableData'> | undefined;
|
|
27
27
|
allowanceContract: string;
|
|
28
28
|
networkFeeCryptoBaseUnit: string;
|
|
29
29
|
}>;
|
|
30
30
|
export declare const fetchArbitrumBridgeQuote: (args: FetchArbitrumBridgeQuoteInput) => Promise<{
|
|
31
|
-
request: Omit<ParentToChildTransactionRequest | ChildToParentTransactionRequest,
|
|
31
|
+
request: Omit<ParentToChildTransactionRequest | ChildToParentTransactionRequest, 'retryableData'> | undefined;
|
|
32
32
|
allowanceContract: string;
|
|
33
33
|
networkFeeCryptoBaseUnit: string;
|
|
34
34
|
}>;
|
|
@@ -145,8 +145,8 @@ export const avnuApi = {
|
|
|
145
145
|
compiledCalldata: formattedCalldata,
|
|
146
146
|
chainId: chainIdHex,
|
|
147
147
|
nonce,
|
|
148
|
-
nonceDataAvailabilityMode: 0,
|
|
149
|
-
feeDataAvailabilityMode: 0,
|
|
148
|
+
nonceDataAvailabilityMode: 0,
|
|
149
|
+
feeDataAvailabilityMode: 0,
|
|
150
150
|
resourceBounds: {
|
|
151
151
|
l1_gas: {
|
|
152
152
|
max_amount: resourceBounds.l1_gas.max_amount,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ChainId } from '@shapeshiftoss/caip';
|
|
2
2
|
export declare const AVNU_SUPPORTED_CHAIN_IDS: readonly ChainId[];
|
|
3
|
-
export declare const isSupportedChainId: (chainId: ChainId) => chainId is
|
|
3
|
+
export declare const isSupportedChainId: (chainId: ChainId) => chainId is ChainId;
|
|
4
4
|
export declare const DEFAULT_SLIPPAGE_PERCENTAGE = "0.005";
|
|
5
5
|
export declare const AVNU_API_BASE_URL = "https://starknet.api.avnu.fi";
|
|
@@ -92,7 +92,7 @@ export async function getBebopTradeQuote(input, assertGetEvmChainAdapter, _asset
|
|
|
92
92
|
accountNumber,
|
|
93
93
|
rate,
|
|
94
94
|
feeData: {
|
|
95
|
-
protocolFees: {},
|
|
95
|
+
protocolFees: {},
|
|
96
96
|
networkFeeCryptoBaseUnit,
|
|
97
97
|
},
|
|
98
98
|
buyAmountBeforeFeesCryptoBaseUnit,
|
|
@@ -76,7 +76,7 @@ export async function getBebopTradeRate(input, assertGetEvmChainAdapter, _assets
|
|
|
76
76
|
accountNumber,
|
|
77
77
|
rate,
|
|
78
78
|
feeData: {
|
|
79
|
-
protocolFees: {},
|
|
79
|
+
protocolFees: {},
|
|
80
80
|
networkFeeCryptoBaseUnit,
|
|
81
81
|
},
|
|
82
82
|
buyAmountBeforeFeesCryptoBaseUnit,
|
|
@@ -87,7 +87,7 @@ export type BebopQuoteResponse = {
|
|
|
87
87
|
};
|
|
88
88
|
export declare const chainIdToBebopChain: Record<BebopSupportedChainId, string>;
|
|
89
89
|
export declare const BEBOP_NATIVE_MARKER = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
|
|
90
|
-
export declare const BEBOP_DUMMY_ADDRESS:
|
|
90
|
+
export declare const BEBOP_DUMMY_ADDRESS: `0x${string}`;
|
|
91
91
|
export declare const BEBOP_SOLANA_DUMMY_ADDRESS = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
|
|
92
92
|
export type BebopSolanaQuoteResponse = {
|
|
93
93
|
requestId: string;
|
|
@@ -4,6 +4,6 @@ import type { MonadicSwapperAxiosService } from '../../../types.js';
|
|
|
4
4
|
type AxiosInstanceHoF = (instance: AxiosInstance, options?: Omit<RetryConfig, 'instance'>) => AxiosInstance;
|
|
5
5
|
export declare const bebopServiceFactory: ({ apiKey, wrapper, }: {
|
|
6
6
|
apiKey: string;
|
|
7
|
-
wrapper?: AxiosInstanceHoF;
|
|
7
|
+
wrapper?: AxiosInstanceHoF | undefined;
|
|
8
8
|
}) => MonadicSwapperAxiosService;
|
|
9
9
|
export {};
|
|
@@ -10,7 +10,7 @@ export declare const fetchBebopQuote: ({ buyAsset, sellAsset, sellAmountIncludin
|
|
|
10
10
|
takerAddress: Address;
|
|
11
11
|
receiverAddress: Address;
|
|
12
12
|
slippageTolerancePercentageDecimal: string;
|
|
13
|
-
affiliateBps?: string;
|
|
13
|
+
affiliateBps?: string | undefined;
|
|
14
14
|
apiKey: string;
|
|
15
15
|
}) => Promise<Result<BebopQuoteResponse, SwapErrorRight>>;
|
|
16
16
|
export declare const fetchBebopPrice: ({ buyAsset, sellAsset, sellAmountIncludingProtocolFeesCryptoBaseUnit, receiveAddress, affiliateBps, apiKey, }: {
|
|
@@ -18,7 +18,7 @@ export declare const fetchBebopPrice: ({ buyAsset, sellAsset, sellAmountIncludin
|
|
|
18
18
|
sellAsset: Asset;
|
|
19
19
|
sellAmountIncludingProtocolFeesCryptoBaseUnit: string;
|
|
20
20
|
receiveAddress: string | undefined;
|
|
21
|
-
affiliateBps?: string;
|
|
21
|
+
affiliateBps?: string | undefined;
|
|
22
22
|
apiKey: string;
|
|
23
23
|
}) => Promise<Result<BebopQuoteResponse, SwapErrorRight>>;
|
|
24
24
|
export declare const fetchBebopSolanaQuote: ({ buyAsset, sellAsset, sellAmountIncludingProtocolFeesCryptoBaseUnit, takerAddress, receiverAddress, slippageTolerancePercentageDecimal, affiliateBps, apiKey, }: {
|
|
@@ -28,7 +28,7 @@ export declare const fetchBebopSolanaQuote: ({ buyAsset, sellAsset, sellAmountIn
|
|
|
28
28
|
takerAddress: string;
|
|
29
29
|
receiverAddress: string;
|
|
30
30
|
slippageTolerancePercentageDecimal: string;
|
|
31
|
-
affiliateBps?: string;
|
|
31
|
+
affiliateBps?: string | undefined;
|
|
32
32
|
apiKey: string;
|
|
33
33
|
}) => Promise<Result<BebopSolanaQuoteResponse, SwapErrorRight>>;
|
|
34
34
|
export declare const fetchBebopSolanaPrice: ({ buyAsset, sellAsset, sellAmountIncludingProtocolFeesCryptoBaseUnit, receiveAddress, affiliateBps, apiKey, }: {
|
|
@@ -36,6 +36,6 @@ export declare const fetchBebopSolanaPrice: ({ buyAsset, sellAsset, sellAmountIn
|
|
|
36
36
|
sellAsset: Asset;
|
|
37
37
|
sellAmountIncludingProtocolFeesCryptoBaseUnit: string;
|
|
38
38
|
receiveAddress: string | undefined;
|
|
39
|
-
affiliateBps?: string;
|
|
39
|
+
affiliateBps?: string | undefined;
|
|
40
40
|
apiKey: string;
|
|
41
41
|
}) => Promise<Result<BebopSolanaQuoteResponse, SwapErrorRight>>;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import type { AssetId, ChainId } from '@shapeshiftoss/caip';
|
|
2
2
|
import type { Asset } from '@shapeshiftoss/types';
|
|
3
|
-
import type { BebopSupportedChainId } from '../../types.js';
|
|
4
3
|
export declare const isSolanaChainId: (chainId: ChainId) => boolean;
|
|
5
4
|
export declare const assetIdToBebopToken: (assetId: AssetId) => string;
|
|
6
5
|
export declare const assetIdToBebopSolanaToken: (assetId: AssetId) => string;
|
|
7
|
-
export declare const isSupportedChainId: (chainId: ChainId) => chainId is
|
|
6
|
+
export declare const isSupportedChainId: (chainId: ChainId) => chainId is import("@shapeshiftoss/types").KnownChainIds.EthereumMainnet | import("@shapeshiftoss/types").KnownChainIds.AvalancheMainnet | import("@shapeshiftoss/types").KnownChainIds.OptimismMainnet | import("@shapeshiftoss/types").KnownChainIds.BnbSmartChainMainnet | import("@shapeshiftoss/types").KnownChainIds.PolygonMainnet | import("@shapeshiftoss/types").KnownChainIds.ArbitrumMainnet | import("@shapeshiftoss/types").KnownChainIds.BaseMainnet | import("@shapeshiftoss/types").KnownChainIds.SolanaMainnet;
|
|
8
7
|
export declare const assertValidTrade: ({ buyAsset, sellAsset, }: {
|
|
9
8
|
buyAsset: Asset;
|
|
10
9
|
sellAsset: Asset;
|
|
@@ -120,7 +120,7 @@ describe('checkTradeStatus same-chain short-circuit', () => {
|
|
|
120
120
|
it('should proceed to bridge polling for cross-chain swaps', async () => {
|
|
121
121
|
const mockBridgeInfo = {
|
|
122
122
|
id: 12345,
|
|
123
|
-
state: 1,
|
|
123
|
+
state: 1,
|
|
124
124
|
toHash: 'dest-tx',
|
|
125
125
|
relayerHash: 'relayer-tx',
|
|
126
126
|
relayerChain: { scanUrl: 'https://scan.url' },
|
|
@@ -164,7 +164,7 @@ describe('checkTradeStatus same-chain short-circuit', () => {
|
|
|
164
164
|
txHash: mockTxHash,
|
|
165
165
|
chainId: mockEvmChainId,
|
|
166
166
|
address: mockAddress,
|
|
167
|
-
swap: undefined,
|
|
167
|
+
swap: undefined,
|
|
168
168
|
assertGetEvmChainAdapter: mockAssertGetEvmChainAdapter,
|
|
169
169
|
assertGetSolanaChainAdapter: mockAssertGetSolanaChainAdapter,
|
|
170
170
|
fetchIsSmartContractAddressQuery: mockFetchIsSmartContractAddressQuery,
|
|
@@ -71,7 +71,7 @@ export const getTradeQuote = async (input, _deps) => {
|
|
|
71
71
|
const buildTxResult = await fetchTxData({
|
|
72
72
|
hash: route.hash,
|
|
73
73
|
slippage,
|
|
74
|
-
from: sendAddress,
|
|
74
|
+
from: sendAddress,
|
|
75
75
|
receiver: receiveAddress, // receiver (destination chain address)
|
|
76
76
|
});
|
|
77
77
|
if (buildTxResult.isErr())
|
|
@@ -14,12 +14,12 @@ export const ROUTE_QUOTE = {
|
|
|
14
14
|
},
|
|
15
15
|
tradeType: 0,
|
|
16
16
|
gasFee: {
|
|
17
|
-
amount: '0.001333043669759539',
|
|
17
|
+
amount: '0.001333043669759539',
|
|
18
18
|
symbol: 'ETH',
|
|
19
19
|
inUSD: '3.0629382849310107',
|
|
20
20
|
},
|
|
21
21
|
swapFee: {
|
|
22
|
-
nativeFee: '0.0',
|
|
22
|
+
nativeFee: '0.0',
|
|
23
23
|
tokenFee: '0.001', // human units
|
|
24
24
|
},
|
|
25
25
|
feeConfig: {
|
|
@@ -50,8 +50,8 @@ export const ROUTE_QUOTE = {
|
|
|
50
50
|
symbol: 'USDC',
|
|
51
51
|
icon: 'https://s3.amazonaws.com/map-static-file/mapSwap/ethereum/0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48/logo.png',
|
|
52
52
|
},
|
|
53
|
-
totalAmountIn: '0.999',
|
|
54
|
-
totalAmountOut: '2296.409699',
|
|
53
|
+
totalAmountIn: '0.999',
|
|
54
|
+
totalAmountOut: '2296.409699',
|
|
55
55
|
route: [
|
|
56
56
|
{
|
|
57
57
|
amountIn: '0.999',
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AxiosRequestConfig } from 'axios';
|
|
2
2
|
export declare const butterHistoryService: {
|
|
3
|
-
get: <T = any>(url: string, config?: AxiosRequestConfig<any>) => Promise<import("@sniptt/monads").Result<import("axios").AxiosResponse<T>, import("../../../index.js").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("../../../index.js").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("../../../index.js").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("../../../index.js").SwapErrorRight>>;
|
|
6
6
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AxiosRequestConfig } from 'axios';
|
|
2
2
|
export declare const butterService: {
|
|
3
|
-
get: <T = any>(url: string, config?: AxiosRequestConfig<any>) => Promise<import("@sniptt/monads").Result<import("axios").AxiosResponse<T>, import("../../../index.js").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("../../../index.js").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("../../../index.js").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("../../../index.js").SwapErrorRight>>;
|
|
6
6
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { ChainId } from '@shapeshiftoss/caip';
|
|
2
2
|
export declare const SUPPORTED_CETUS_CHAIN_IDS: readonly ChainId[];
|
|
3
|
-
export declare const isSupportedChainId: (chainId: ChainId) => chainId is
|
|
3
|
+
export declare const isSupportedChainId: (chainId: ChainId) => chainId is ChainId;
|
|
4
4
|
export declare const PYTH_DEPENDENT_PROVIDERS: string[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const chainflipService: {
|
|
2
|
-
get: <T = any>(url: string, config?: import("axios").AxiosRequestConfig<any>) => Promise<import("@sniptt/monads").Result<import("axios").AxiosResponse<T>, import("../../../index.js").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("../../../index.js").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("../../../index.js").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("../../../index.js").SwapErrorRight>>;
|
|
5
5
|
};
|
|
@@ -228,7 +228,7 @@ export const getQuoteOrRate = async (input, deps) => {
|
|
|
228
228
|
buyAsset,
|
|
229
229
|
sellAsset,
|
|
230
230
|
accountNumber,
|
|
231
|
-
allowanceContract: '0x0',
|
|
231
|
+
allowanceContract: '0x0',
|
|
232
232
|
estimatedExecutionTimeMs: (singleQuoteResponse.boostQuote.estimatedDurationsSeconds?.deposit ?? 0) +
|
|
233
233
|
(singleQuoteResponse.boostQuote.estimatedDurationsSeconds?.swap ?? 0) * 1000,
|
|
234
234
|
chainflipSpecific: {
|
|
@@ -286,7 +286,7 @@ export const getQuoteOrRate = async (input, deps) => {
|
|
|
286
286
|
buyAsset,
|
|
287
287
|
sellAsset,
|
|
288
288
|
accountNumber,
|
|
289
|
-
allowanceContract: '0x0',
|
|
289
|
+
allowanceContract: '0x0',
|
|
290
290
|
estimatedExecutionTimeMs: ((singleQuoteResponse.estimatedDurationsSeconds?.deposit ?? 0) +
|
|
291
291
|
(singleQuoteResponse.estimatedDurationsSeconds?.swap ?? 0)) *
|
|
292
292
|
1000,
|
|
@@ -5,5 +5,5 @@ type GetUtxoTxFeesInput = {
|
|
|
5
5
|
sellAdapter: UtxoChainAdapter;
|
|
6
6
|
pubKey: string | undefined;
|
|
7
7
|
};
|
|
8
|
-
export declare const getUtxoTxFees: ({ sellAmountCryptoBaseUnit, sellAdapter, pubKey, }: GetUtxoTxFeesInput) => Promise<Omit<QuoteFeeData,
|
|
8
|
+
export declare const getUtxoTxFees: ({ sellAmountCryptoBaseUnit, sellAdapter, pubKey, }: GetUtxoTxFeesInput) => Promise<Omit<QuoteFeeData, 'protocolFees'>>;
|
|
9
9
|
export {};
|
|
@@ -3,7 +3,6 @@ import type { Asset } from '@shapeshiftoss/types';
|
|
|
3
3
|
import type { Result } from '@sniptt/monads';
|
|
4
4
|
import type { AxiosResponse } from 'axios';
|
|
5
5
|
import type { SwapErrorRight } from '../../../types.js';
|
|
6
|
-
import type { ChainflipSupportedChainId } from '../constants.js';
|
|
7
6
|
import type { ChainflipBaasSwapDepositAddress } from '../models/index.js';
|
|
8
7
|
type ChainFlipBrokerBaseArgs = {
|
|
9
8
|
brokerUrl: string;
|
|
@@ -21,8 +20,8 @@ type GetChainFlipSwapArgs = ChainFlipBrokerBaseArgs & {
|
|
|
21
20
|
numberOfChunks?: number;
|
|
22
21
|
chunkIntervalBlocks?: number;
|
|
23
22
|
};
|
|
24
|
-
export declare const isSupportedChainId: (chainId: ChainId) => chainId is
|
|
25
|
-
export declare const isSupportedAssetId: (chainId: ChainId, assetId: AssetId) => chainId is
|
|
23
|
+
export declare const isSupportedChainId: (chainId: ChainId) => chainId is import("@shapeshiftoss/types").KnownChainIds.EthereumMainnet | import("@shapeshiftoss/types").KnownChainIds.ArbitrumMainnet | import("@shapeshiftoss/types").KnownChainIds.BitcoinMainnet | import("@shapeshiftoss/types").KnownChainIds.SolanaMainnet;
|
|
24
|
+
export declare const isSupportedAssetId: (chainId: ChainId, assetId: AssetId) => chainId is import("@shapeshiftoss/types").KnownChainIds.EthereumMainnet | import("@shapeshiftoss/types").KnownChainIds.ArbitrumMainnet | import("@shapeshiftoss/types").KnownChainIds.BitcoinMainnet | import("@shapeshiftoss/types").KnownChainIds.SolanaMainnet;
|
|
26
25
|
export declare const calculateChainflipMinPrice: ({ sellAmountIncludingProtocolFeesCryptoBaseUnit, buyAmountAfterFeesCryptoBaseUnit, slippageTolerancePercentageDecimal, sellAsset, buyAsset, }: {
|
|
27
26
|
sellAmountIncludingProtocolFeesCryptoBaseUnit: string;
|
|
28
27
|
buyAmountAfterFeesCryptoBaseUnit: string;
|
|
@@ -100,7 +100,7 @@ export async function getCowSwapTradeQuote(input, config) {
|
|
|
100
100
|
allowanceContract: COW_SWAP_VAULT_RELAYER_ADDRESS,
|
|
101
101
|
rate,
|
|
102
102
|
feeData: {
|
|
103
|
-
networkFeeCryptoBaseUnit: '0',
|
|
103
|
+
networkFeeCryptoBaseUnit: '0',
|
|
104
104
|
protocolFees: {
|
|
105
105
|
[sellAsset.assetId]: {
|
|
106
106
|
amountCryptoBaseUnit: feeAmountInSellTokenCryptoBaseUnit,
|
|
@@ -306,8 +306,8 @@ const expectedTradeQuoteSmallAmountWethToFox = {
|
|
|
306
306
|
networkFeeCryptoBaseUnit: '0',
|
|
307
307
|
},
|
|
308
308
|
sellAmountIncludingProtocolFeesCryptoBaseUnit: '1000000000000',
|
|
309
|
-
buyAmountBeforeFeesCryptoBaseUnit: '166441655297153832879',
|
|
310
|
-
buyAmountAfterFeesCryptoBaseUnit: '144293027591563571150',
|
|
309
|
+
buyAmountBeforeFeesCryptoBaseUnit: '166441655297153832879',
|
|
310
|
+
buyAmountAfterFeesCryptoBaseUnit: '144293027591563571150',
|
|
311
311
|
source: SwapperName.CowSwap,
|
|
312
312
|
buyAsset: FOX_MAINNET,
|
|
313
313
|
sellAsset: WETH,
|
|
@@ -339,7 +339,7 @@ describe('getCowSwapTradeQuote', () => {
|
|
|
339
339
|
affiliateBps: '0',
|
|
340
340
|
supportsEIP1559: false,
|
|
341
341
|
allowMultiHop: false,
|
|
342
|
-
slippageTolerancePercentageDecimal: '0.005',
|
|
342
|
+
slippageTolerancePercentageDecimal: '0.005',
|
|
343
343
|
quoteOrRate: 'quote',
|
|
344
344
|
};
|
|
345
345
|
const maybeTradeQuote = await getCowSwapTradeQuote(input, MOCK_COWSWAP_CONFIG);
|
|
@@ -363,7 +363,7 @@ describe('getCowSwapTradeQuote', () => {
|
|
|
363
363
|
affiliateBps: '0',
|
|
364
364
|
supportsEIP1559: false,
|
|
365
365
|
allowMultiHop: false,
|
|
366
|
-
slippageTolerancePercentageDecimal: '0.005',
|
|
366
|
+
slippageTolerancePercentageDecimal: '0.005',
|
|
367
367
|
quoteOrRate: 'quote',
|
|
368
368
|
};
|
|
369
369
|
mockedCowService.post.mockReturnValue(Promise.resolve(Ok({
|
|
@@ -396,7 +396,7 @@ describe('getCowSwapTradeQuote', () => {
|
|
|
396
396
|
affiliateBps: '0',
|
|
397
397
|
supportsEIP1559: false,
|
|
398
398
|
allowMultiHop: false,
|
|
399
|
-
slippageTolerancePercentageDecimal: '0.005',
|
|
399
|
+
slippageTolerancePercentageDecimal: '0.005',
|
|
400
400
|
quoteOrRate: 'quote',
|
|
401
401
|
};
|
|
402
402
|
mockedCowService.post.mockReturnValue(Promise.resolve(Ok({
|
|
@@ -429,7 +429,7 @@ describe('getCowSwapTradeQuote', () => {
|
|
|
429
429
|
affiliateBps: '0',
|
|
430
430
|
supportsEIP1559: false,
|
|
431
431
|
allowMultiHop: false,
|
|
432
|
-
slippageTolerancePercentageDecimal: '0.005',
|
|
432
|
+
slippageTolerancePercentageDecimal: '0.005',
|
|
433
433
|
quoteOrRate: 'quote',
|
|
434
434
|
};
|
|
435
435
|
mockedCowService.post.mockReturnValue(Promise.resolve(Ok({
|
|
@@ -462,7 +462,7 @@ describe('getCowSwapTradeQuote', () => {
|
|
|
462
462
|
affiliateBps: '0',
|
|
463
463
|
supportsEIP1559: false,
|
|
464
464
|
allowMultiHop: false,
|
|
465
|
-
slippageTolerancePercentageDecimal: '0.005',
|
|
465
|
+
slippageTolerancePercentageDecimal: '0.005',
|
|
466
466
|
quoteOrRate: 'quote',
|
|
467
467
|
};
|
|
468
468
|
mockedCowService.post.mockReturnValue(Promise.resolve(Ok({
|
|
@@ -495,7 +495,7 @@ describe('getCowSwapTradeQuote', () => {
|
|
|
495
495
|
affiliateBps: '0',
|
|
496
496
|
supportsEIP1559: false,
|
|
497
497
|
allowMultiHop: false,
|
|
498
|
-
slippageTolerancePercentageDecimal: '0.005',
|
|
498
|
+
slippageTolerancePercentageDecimal: '0.005',
|
|
499
499
|
quoteOrRate: 'quote',
|
|
500
500
|
};
|
|
501
501
|
mockedCowService.post.mockReturnValue(Promise.resolve(Ok({
|
|
@@ -100,7 +100,7 @@ export async function getCowSwapTradeRate(input, config) {
|
|
|
100
100
|
allowanceContract: COW_SWAP_VAULT_RELAYER_ADDRESS,
|
|
101
101
|
rate,
|
|
102
102
|
feeData: {
|
|
103
|
-
networkFeeCryptoBaseUnit: '0',
|
|
103
|
+
networkFeeCryptoBaseUnit: '0',
|
|
104
104
|
protocolFees: {
|
|
105
105
|
[sellAsset.assetId]: {
|
|
106
106
|
amountCryptoBaseUnit: feeAmountInSellTokenCryptoBaseUnit,
|
|
@@ -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("../../../index.js").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("../../../index.js").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("../../../index.js").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("../../../index.js").SwapErrorRight>>;
|
|
6
6
|
};
|
|
@@ -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("../../../index.js").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("../../../index.js").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("../../../index.js").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("../../../index.js").SwapErrorRight>>;
|
|
5
5
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CHAIN_NAMESPACE, fromAssetId, nearChainId } from '@shapeshiftoss/caip';
|
|
1
|
+
import { btcChainId, CHAIN_NAMESPACE, fromAssetId, nearChainId } from '@shapeshiftoss/caip';
|
|
2
2
|
import { evm } from '@shapeshiftoss/chain-adapters';
|
|
3
3
|
import { bn, bnOrZero, chainIdToFeeAssetId, contractAddressOrUndefined, DAO_TREASURY_NEAR, isToken, } from '@shapeshiftoss/utils';
|
|
4
4
|
import { Err, Ok } from '@sniptt/monads';
|
|
@@ -8,7 +8,7 @@ import { SwapperName, TradeQuoteError } from '../../../types.js';
|
|
|
8
8
|
import { createTradeAmountTooSmallErr, getInputOutputRate, makeSwapErrorRight, } from '../../../utils.js';
|
|
9
9
|
import { buildAffiliateFee } from '../../utils/affiliateFee.js';
|
|
10
10
|
import { isNativeEvmAsset } from '../../utils/helpers/helpers.js';
|
|
11
|
-
import { DEFAULT_QUOTE_DEADLINE_MS, DEFAULT_SLIPPAGE_BPS } from '../constants.js';
|
|
11
|
+
import { BTC_QUOTE_DEADLINE_MS, DEFAULT_QUOTE_DEADLINE_MS, DEFAULT_SLIPPAGE_BPS, } from '../constants.js';
|
|
12
12
|
import { QuoteRequest } from '../types.js';
|
|
13
13
|
import { assetToNearIntentsAsset, calculateAccountCreationCosts } from '../utils/helpers/helpers.js';
|
|
14
14
|
import { ApiError, initializeOneClickService, OneClickService } from '../utils/oneClickService.js';
|
|
@@ -49,6 +49,9 @@ export const getTradeQuote = async (input, deps) => {
|
|
|
49
49
|
message: `Asset ${buyAsset.symbol} on ${buyAsset.networkName || buyAsset.chainId} is not supported by NEAR Intents`,
|
|
50
50
|
}));
|
|
51
51
|
}
|
|
52
|
+
const quoteDeadline = sellAsset.chainId === btcChainId || buyAsset.chainId === btcChainId
|
|
53
|
+
? BTC_QUOTE_DEADLINE_MS
|
|
54
|
+
: DEFAULT_QUOTE_DEADLINE_MS;
|
|
52
55
|
const quoteRequest = {
|
|
53
56
|
dry: false,
|
|
54
57
|
swapType: QuoteRequest.swapType.EXACT_INPUT,
|
|
@@ -63,7 +66,7 @@ export const getTradeQuote = async (input, deps) => {
|
|
|
63
66
|
refundType: QuoteRequest.refundType.ORIGIN_CHAIN,
|
|
64
67
|
recipient: receiveAddress,
|
|
65
68
|
recipientType: QuoteRequest.recipientType.DESTINATION_CHAIN,
|
|
66
|
-
deadline: new Date(Date.now() +
|
|
69
|
+
deadline: new Date(Date.now() + quoteDeadline).toISOString(),
|
|
67
70
|
referral: 'shapeshift',
|
|
68
71
|
appFees: [
|
|
69
72
|
{
|
|
@@ -256,7 +259,7 @@ export const getTradeQuote = async (input, deps) => {
|
|
|
256
259
|
steps: [
|
|
257
260
|
{
|
|
258
261
|
accountNumber,
|
|
259
|
-
allowanceContract:
|
|
262
|
+
allowanceContract: '',
|
|
260
263
|
buyAmountBeforeFeesCryptoBaseUnit: quote.amountOut,
|
|
261
264
|
buyAmountAfterFeesCryptoBaseUnit: quote.amountOut,
|
|
262
265
|
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;
|
|
@@ -45,6 +45,7 @@ export const getNearIntentsAsset = ({ nearNetwork, contractAddress, }) => {
|
|
|
45
45
|
const NEP245_CHAINS = ['bsc', 'pol', 'avax', 'op', 'tron', 'monad', 'plasma'];
|
|
46
46
|
const TOKEN_LOOKUP_CHAINS = ['sui', 'starknet', 'ton'];
|
|
47
47
|
const NEAR_CHAIN = 'near';
|
|
48
|
+
const BTC_CHAIN = 'btc';
|
|
48
49
|
const WNEAR_CONTRACT_ADDRESS = 'wrap.near';
|
|
49
50
|
const isNep245Chain = (chain) => {
|
|
50
51
|
return NEP245_CHAINS.includes(chain);
|
|
@@ -56,6 +57,9 @@ export const assetToNearIntentsAsset = async (asset) => {
|
|
|
56
57
|
const nearNetwork = chainIdToNearIntentsChain[asset.chainId];
|
|
57
58
|
if (!nearNetwork)
|
|
58
59
|
return null;
|
|
60
|
+
// https://partners.near-intents.org/omni-migration#partners
|
|
61
|
+
if (nearNetwork === BTC_CHAIN)
|
|
62
|
+
return `1cs_v1:btc:native:coin`;
|
|
59
63
|
// NEAR chain requires special handling
|
|
60
64
|
// Native NEAR maps to wNEAR (wrap.near)
|
|
61
65
|
if (nearNetwork === NEAR_CHAIN) {
|
|
@@ -91,7 +95,7 @@ export const assetToNearIntentsAsset = async (asset) => {
|
|
|
91
95
|
}
|
|
92
96
|
return match.assetId;
|
|
93
97
|
}
|
|
94
|
-
// NEP-141 chains (ETH, ARB, BASE, GNOSIS,
|
|
98
|
+
// NEP-141 chains (ETH, ARB, BASE, GNOSIS, DOGE): use predictable format
|
|
95
99
|
const contractAddress = isToken(asset.assetId)
|
|
96
100
|
? fromAssetId(asset.assetId).assetReference
|
|
97
101
|
: zeroAddress;
|
|
@@ -79,14 +79,14 @@ export async function getPortalsTradeRate(input, assertGetEvmChainAdapter, swapp
|
|
|
79
79
|
// Use full quote endpoint (not estimate) to get transaction data for Tenderly simulation
|
|
80
80
|
// Skip validation since this is just a rate quote
|
|
81
81
|
const quoteResponse = await fetchPortalsTradeOrder({
|
|
82
|
-
sender: RATE_DUMMY_ADDRESS,
|
|
82
|
+
sender: RATE_DUMMY_ADDRESS,
|
|
83
83
|
inputToken,
|
|
84
84
|
outputToken,
|
|
85
85
|
inputAmount: sellAmountIncludingProtocolFeesCryptoBaseUnit,
|
|
86
86
|
slippageTolerancePercentage: userSlippageTolerancePercentageDecimalOrDefault,
|
|
87
87
|
partner: getTreasuryAddressFromChainId(chainId),
|
|
88
88
|
feePercentage: affiliateBpsPercentage,
|
|
89
|
-
validate: false,
|
|
89
|
+
validate: false,
|
|
90
90
|
swapperConfig,
|
|
91
91
|
});
|
|
92
92
|
if (!quoteResponse.tx) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { ChainId } from '@shapeshiftoss/caip';
|
|
2
2
|
import type { PortalsSupportedChainId } from '../types.js';
|
|
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.js';
|
|
3
2
|
import { RelayErrorCode } from './utils/types.js';
|
|
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...",
|
|
@@ -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.js';
|
|
4
4
|
import type { RelayFetchQuoteParams, RelayQuote } from './types.js';
|
|
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>>;
|
|
@@ -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("../../../index.js").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("../../../index.js").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("../../../index.js").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("../../../index.js").SwapErrorRight>>;
|
|
5
5
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { AssetId } from '@shapeshiftoss/caip';
|
|
2
|
-
import { tronChainId } from '@shapeshiftoss/caip';
|
|
3
2
|
export declare const isSupportedChainId: (chainId: string) => boolean;
|
|
4
3
|
export declare const assetIdToTronToken: (assetId: AssetId) => string;
|
|
5
|
-
export declare const isTronChainId: (chainId: string) => chainId is
|
|
4
|
+
export declare const isTronChainId: (chainId: string) => chainId is import("@shapeshiftoss/caip").ChainId;
|