@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
package/dist/cjs/thorchain-utils/getThresholdedAffiliateBps/getThresholdedAffiliateBps.test.js
CHANGED
|
@@ -26,18 +26,24 @@ vitest_1.vi.mock('../service', () => {
|
|
|
26
26
|
thorService: mockAxios.default.create(),
|
|
27
27
|
};
|
|
28
28
|
});
|
|
29
|
-
(0, vitest_1.describe)('
|
|
29
|
+
(0, vitest_1.describe)('getOutboundFeeSellAssetThorBaseUnit', () => {
|
|
30
30
|
(0, vitest_1.it)('should return 0.02 rune denominated in the target asset, in thor units', () => {
|
|
31
31
|
const assetPricePrecision = '4.00000'; // 1 token is 4x as valuable as 1 rune
|
|
32
|
-
(0, vitest_1.expect)((0, getThresholdedAffiliateBps_1.
|
|
32
|
+
(0, vitest_1.expect)((0, getThresholdedAffiliateBps_1.getOutboundFeeSellAssetThorBaseUnit)(assetPricePrecision, test_data_1.ETH.assetId, types_1.SwapperName.Thorchain).toNumber()).toEqual(Number(chain_adapters_1.thorchain.NATIVE_FEE) / 4);
|
|
33
|
+
});
|
|
34
|
+
(0, vitest_1.it)('should scale CACAO 10-dec native fee down to non-CACAO 8-dec sell asset precision on MAYA', () => {
|
|
35
|
+
// 1 eth = 100 cacao, NATIVE_FEE = 2e9 (10-dec CACAO = 0.2 CACAO)
|
|
36
|
+
// 0.2 CACAO / 100 (CACAO/ETH) = 0.002 ETH = 200_000 at 8-dec ETH
|
|
37
|
+
const assetPrice = '100';
|
|
38
|
+
(0, vitest_1.expect)((0, getThresholdedAffiliateBps_1.getOutboundFeeSellAssetThorBaseUnit)(assetPrice, test_data_1.ETH.assetId, types_1.SwapperName.Mayachain).toNumber()).toEqual(200_000);
|
|
33
39
|
});
|
|
34
40
|
});
|
|
35
|
-
(0, vitest_1.describe)('
|
|
41
|
+
(0, vitest_1.describe)('getExpectedAffiliateFeeSellAssetThorBaseUnit', () => {
|
|
36
42
|
(0, vitest_1.it)('should return the correct affiliate fee in thor base units', () => {
|
|
37
43
|
const sellAmountCryptoBaseUnit = '1000000000000000000'; // 1 eth
|
|
38
44
|
const affiliateBps = '35';
|
|
39
45
|
const sellAsset = test_data_1.ETH;
|
|
40
|
-
const result = (0, getThresholdedAffiliateBps_1.
|
|
46
|
+
const result = (0, getThresholdedAffiliateBps_1.getExpectedAffiliateFeeSellAssetThorBaseUnit)(sellAmountCryptoBaseUnit, sellAsset, affiliateBps, types_1.SwapperName.Thorchain);
|
|
41
47
|
const expectation = (0, utils_1.bn)('100000000').times('0.0035').toFixed(0);
|
|
42
48
|
(0, vitest_1.expect)(result.toFixed(0)).toEqual(expectation);
|
|
43
49
|
});
|
|
@@ -45,7 +51,7 @@ vitest_1.vi.mock('../service', () => {
|
|
|
45
51
|
const sellAmountCryptoBaseUnit = '1000000000000000000'; // 1 eth
|
|
46
52
|
const affiliateBps = '0';
|
|
47
53
|
const sellAsset = test_data_1.ETH;
|
|
48
|
-
const result = (0, getThresholdedAffiliateBps_1.
|
|
54
|
+
const result = (0, getThresholdedAffiliateBps_1.getExpectedAffiliateFeeSellAssetThorBaseUnit)(sellAmountCryptoBaseUnit, sellAsset, affiliateBps, types_1.SwapperName.Thorchain);
|
|
49
55
|
const expectation = '0';
|
|
50
56
|
(0, vitest_1.expect)(result.toFixed(0)).toEqual(expectation);
|
|
51
57
|
});
|
|
@@ -23,6 +23,7 @@ export declare const getDaemonUrl: (config: SwapperConfig, swapperName: SwapperN
|
|
|
23
23
|
export declare const getMidgardUrl: (config: SwapperConfig, swapperName: SwapperName) => string;
|
|
24
24
|
export declare const isNativeAsset: (assetId: AssetId, swapperName: SwapperName) => boolean;
|
|
25
25
|
export declare const getNativePrecision: (assetId: AssetId, swapperName: SwapperName) => 8 | 10;
|
|
26
|
+
export declare const getSwapperNativeAssetId: (swapperName: SwapperName) => AssetId;
|
|
26
27
|
export declare const getNativeFee: (swapperName: SwapperName) => "2000000" | "2000000000";
|
|
27
28
|
export declare const getAffiliate: (swapperName: SwapperName) => "ss" | "ssmaya";
|
|
28
29
|
export declare const getPoolAssetId: ({ assetId, swapperName, }: {
|
|
@@ -15,28 +15,18 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) ||
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
35
25
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
36
26
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
37
27
|
};
|
|
38
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.getSwapSource = exports.getPoolAssetId = exports.getAffiliate = exports.getNativeFee = exports.getNativePrecision = exports.isNativeAsset = exports.getMidgardUrl = exports.getDaemonUrl = exports.isThorTradeQuote = exports.isThorTradeRate = exports.getChainIdBySwapper = exports.utxo = exports.tron = exports.solana = exports.evm = exports.cosmossdk = void 0;
|
|
29
|
+
exports.getSwapSource = exports.getPoolAssetId = exports.getAffiliate = exports.getNativeFee = exports.getSwapperNativeAssetId = exports.getNativePrecision = exports.isNativeAsset = exports.getMidgardUrl = exports.getDaemonUrl = exports.isThorTradeQuote = exports.isThorTradeRate = exports.getChainIdBySwapper = exports.utxo = exports.tron = exports.solana = exports.evm = exports.cosmossdk = void 0;
|
|
40
30
|
const caip_1 = require("@shapeshiftoss/caip");
|
|
41
31
|
const adapters = __importStar(require("@shapeshiftoss/chain-adapters"));
|
|
42
32
|
const MayachainSwapper_1 = require("../swappers/MayachainSwapper");
|
|
@@ -115,6 +105,17 @@ const getNativePrecision = (assetId, swapperName) => {
|
|
|
115
105
|
}
|
|
116
106
|
};
|
|
117
107
|
exports.getNativePrecision = getNativePrecision;
|
|
108
|
+
const getSwapperNativeAssetId = (swapperName) => {
|
|
109
|
+
switch (swapperName) {
|
|
110
|
+
case types_1.SwapperName.Thorchain:
|
|
111
|
+
return caip_1.thorchainAssetId;
|
|
112
|
+
case types_1.SwapperName.Mayachain:
|
|
113
|
+
return caip_1.mayachainAssetId;
|
|
114
|
+
default:
|
|
115
|
+
throw new Error(`Invalid swapper: ${swapperName}`);
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
exports.getSwapperNativeAssetId = getSwapperNativeAssetId;
|
|
118
119
|
const getNativeFee = (swapperName) => {
|
|
119
120
|
switch (swapperName) {
|
|
120
121
|
case types_1.SwapperName.Thorchain:
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { ThorNodeTxSchema } from './types';
|
|
2
|
-
export declare const parseThorBuyTxHash: (sellTxId: string, latestOutTx: ThorNodeTxSchema | undefined, nativeChain:
|
|
2
|
+
export declare const parseThorBuyTxHash: (sellTxId: string, latestOutTx: ThorNodeTxSchema | undefined, nativeChain: 'THOR' | 'MAYA') => string | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const thorService: {
|
|
2
|
-
get: <T = any>(url: string, config?: import("axios").AxiosRequestConfig<any>) => Promise<import("@sniptt/monads").Result<import("axios").AxiosResponse<T>, import("..").SwapErrorRight>>;
|
|
3
|
-
post: <
|
|
4
|
-
delete: <
|
|
2
|
+
get: <T = any>(url: string, config?: import("axios").AxiosRequestConfig<any> | undefined) => Promise<import("@sniptt/monads").Result<import("axios").AxiosResponse<T, any, {}>, import("..").SwapErrorRight>>;
|
|
3
|
+
post: <T_1 = any>(url: string, data: any, config?: import("axios").AxiosRequestConfig<any> | undefined) => Promise<import("@sniptt/monads").Result<import("axios").AxiosResponse<T_1, any, {}>, import("..").SwapErrorRight>>;
|
|
4
|
+
delete: <T_2 = any>(url: string, data: any, config?: import("axios").AxiosRequestConfig<any> | undefined) => Promise<import("@sniptt/monads").Result<import("axios").AxiosResponse<T_2, any, {}>, import("..").SwapErrorRight>>;
|
|
5
5
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { GetUnsignedTronTransactionArgs } from '../types';
|
|
2
|
-
export declare const getTronTransactionFees: ({ tradeQuote, stepIndex, }: Pick<GetUnsignedTronTransactionArgs,
|
|
2
|
+
export declare const getTronTransactionFees: ({ tradeQuote, stepIndex, }: Pick<GetUnsignedTronTransactionArgs, 'tradeQuote' | 'stepIndex'>) => Promise<string>;
|
package/dist/cjs/types.d.ts
CHANGED
|
@@ -327,6 +327,12 @@ export type TradeQuoteStep = {
|
|
|
327
327
|
thorchainSpecific?: {
|
|
328
328
|
maxStreamingQuantity?: number;
|
|
329
329
|
};
|
|
330
|
+
thorchainTransactionMetadata?: {
|
|
331
|
+
to: string;
|
|
332
|
+
data?: string;
|
|
333
|
+
value?: string;
|
|
334
|
+
memo?: string;
|
|
335
|
+
};
|
|
330
336
|
relayTransactionMetadata?: RelayTransactionMetadata;
|
|
331
337
|
butterSwapTransactionMetadata?: {
|
|
332
338
|
to: string;
|
|
@@ -28,39 +28,39 @@ exports.getAllowanceStorageSlot = getAllowanceStorageSlot;
|
|
|
28
28
|
// USDC (BEP20 - BSC): balance at slot 1, allowance at slot 2
|
|
29
29
|
exports.KNOWN_BALANCE_SLOTS = {
|
|
30
30
|
// USDT - Native Tether deployment (custom slot 2)
|
|
31
|
-
'0xdac17f958d2ee523a2206206994597c13d831ec7': 2,
|
|
31
|
+
'0xdac17f958d2ee523a2206206994597c13d831ec7': 2,
|
|
32
32
|
// Slot 51 pattern (L2GatewayToken + ERC20Upgradeable + storage gaps)
|
|
33
33
|
// Various L2 tokens use this pattern with different implementations
|
|
34
|
-
'0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9': 51,
|
|
35
|
-
'0x912ce59144191c1204e64559fe8253a0e49e6548': 51,
|
|
36
|
-
'0x9702230a8ea53601f5cd2dc00fdbc13d4df4a8c7': 51,
|
|
37
|
-
'0x01bff41798a0bcf287b996046ca68b395dbc1071': 51,
|
|
34
|
+
'0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9': 51,
|
|
35
|
+
'0x912ce59144191c1204e64559fe8253a0e49e6548': 51,
|
|
36
|
+
'0x9702230a8ea53601f5cd2dc00fdbc13d4df4a8c7': 51,
|
|
37
|
+
'0x01bff41798a0bcf287b996046ca68b395dbc1071': 51,
|
|
38
38
|
// Wormhole bridge pattern (slot 5)
|
|
39
|
-
'0xca7dec8550f43a5e46e3dfb95801f64280e75b27': 5,
|
|
39
|
+
'0xca7dec8550f43a5e46e3dfb95801f64280e75b27': 5,
|
|
40
40
|
// USDT - BEP20 pattern (slot 1 - Binance-Peg token)
|
|
41
|
-
'0x55d398326f99059ff775485246999027b3197955': 1,
|
|
41
|
+
'0x55d398326f99059ff775485246999027b3197955': 1,
|
|
42
42
|
// USDT - xDai bridge pattern (slot 3)
|
|
43
|
-
'0x4ecaba5870353805a9f068101a40e0f32ed605c6': 3,
|
|
43
|
+
'0x4ecaba5870353805a9f068101a40e0f32ed605c6': 3,
|
|
44
44
|
// USDT - Standard ERC20 deployments (slot 0)
|
|
45
45
|
// Polygon confirmed, Optimism bridged USDT (0x94b008aa...) also uses slot 0
|
|
46
46
|
// USDC (Circle native deployments - all use slot 9)
|
|
47
|
-
'0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48': 9,
|
|
48
|
-
'0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e': 9,
|
|
49
|
-
'0x0b2c639c533813f4aa9d7837caf62653d097ff85': 9,
|
|
50
|
-
'0x3c499c542cef5e3811e1192ce70d8cc03d5c3359': 9,
|
|
51
|
-
'0xaf88d065e77c8cc2239327c5edb3a432268e5831': 9,
|
|
52
|
-
'0x833589fcd6edb6e08f4c7c32d4f71b54bda02913': 9,
|
|
47
|
+
'0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48': 9,
|
|
48
|
+
'0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e': 9,
|
|
49
|
+
'0x0b2c639c533813f4aa9d7837caf62653d097ff85': 9,
|
|
50
|
+
'0x3c499c542cef5e3811e1192ce70d8cc03d5c3359': 9,
|
|
51
|
+
'0xaf88d065e77c8cc2239327c5edb3a432268e5831': 9,
|
|
52
|
+
'0x833589fcd6edb6e08f4c7c32d4f71b54bda02913': 9,
|
|
53
53
|
// USDC (BEP20 pattern on BSC - slot 1)
|
|
54
54
|
'0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d': 1, // USDC BSC (BEP20)
|
|
55
55
|
};
|
|
56
56
|
exports.KNOWN_ALLOWANCE_SLOTS = {
|
|
57
57
|
// USDT allowance slots (explicit mapping for all non-standard implementations)
|
|
58
|
-
'0xdac17f958d2ee523a2206206994597c13d831ec7': 5,
|
|
59
|
-
'0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9': 52,
|
|
60
|
-
'0x9702230a8ea53601f5cd2dc00fdbc13d4df4a8c7': 52,
|
|
61
|
-
'0x01bff41798a0bcf287b996046ca68b395dbc1071': 52,
|
|
62
|
-
'0x55d398326f99059ff775485246999027b3197955': 2,
|
|
63
|
-
'0x4ecaba5870353805a9f068101a40e0f32ed605c6': 4,
|
|
58
|
+
'0xdac17f958d2ee523a2206206994597c13d831ec7': 5,
|
|
59
|
+
'0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9': 52,
|
|
60
|
+
'0x9702230a8ea53601f5cd2dc00fdbc13d4df4a8c7': 52,
|
|
61
|
+
'0x01bff41798a0bcf287b996046ca68b395dbc1071': 52,
|
|
62
|
+
'0x55d398326f99059ff775485246999027b3197955': 2,
|
|
63
|
+
'0x4ecaba5870353805a9f068101a40e0f32ed605c6': 4,
|
|
64
64
|
// Note: Polygon and Optimism standard bridged USDT (0x94b008aa...) use slot 1 (fallback)
|
|
65
65
|
// Note: SWEAT (slot 5) allowance auto-inferred to slot 6 via Wormhole pattern
|
|
66
66
|
// USDC allowance slots (BSC uses BEP20 pattern, not Circle FiatToken)
|
package/dist/cjs/utils.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export declare const makeSwapErrorRight: ({ details, cause, code, message, }: {
|
|
|
12
12
|
message: string;
|
|
13
13
|
details?: unknown;
|
|
14
14
|
cause?: unknown;
|
|
15
|
-
code?: TradeQuoteError;
|
|
15
|
+
code?: TradeQuoteError | undefined;
|
|
16
16
|
}) => SwapErrorRight;
|
|
17
17
|
export declare const createTradeAmountTooSmallErr: (details?: {
|
|
18
18
|
minAmountCryptoBaseUnit: string;
|
|
@@ -21,9 +21,9 @@ export declare const createTradeAmountTooSmallErr: (details?: {
|
|
|
21
21
|
export declare const createCache: (maxAge: number, cachedUrls: string[], axiosConfig: AxiosRequestConfig) => AxiosInstance;
|
|
22
22
|
export declare const AsyncResultOf: <T>(promise: Promise<T>) => Promise<Result<T, Error>>;
|
|
23
23
|
export declare const makeSwapperAxiosServiceMonadic: (service: AxiosInstance) => {
|
|
24
|
-
get: <T = any>(url: string, config?: AxiosRequestConfig<any>) => Promise<Result<AxiosResponse<T>, SwapErrorRight>>;
|
|
25
|
-
post: <
|
|
26
|
-
delete: <
|
|
24
|
+
get: <T = any>(url: string, config?: AxiosRequestConfig<any>) => Promise<Result<AxiosResponse<T, any, {}>, SwapErrorRight>>;
|
|
25
|
+
post: <T_1 = any>(url: string, data: any, config?: AxiosRequestConfig<any>) => Promise<Result<AxiosResponse<T_1, any, {}>, SwapErrorRight>>;
|
|
26
|
+
delete: <T_2 = any>(url: string, data: any, config?: AxiosRequestConfig<any>) => Promise<Result<AxiosResponse<T_2, any, {}>, SwapErrorRight>>;
|
|
27
27
|
};
|
|
28
28
|
export declare const getHopByIndex: (quote: TradeQuote | TradeRate | undefined, index: SupportedTradeQuoteStepIndex) => TradeQuoteStep | undefined;
|
|
29
29
|
export declare const executeEvmTransaction: (txToSign: SignTx<EvmChainId>, callbacks: EvmTransactionExecutionProps) => Promise<string>;
|