@shapeshiftoss/swapper 6.0.1 → 6.2.1
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/api.d.ts +5 -4
- package/dist/api.js +1 -0
- package/dist/manager/SwapperManager.d.ts +2 -2
- package/dist/swappercli.js +3 -3
- package/dist/swappers/thorchain/ThorchainSwapper.d.ts +2 -2
- package/dist/swappers/thorchain/ThorchainSwapper.js +15 -2
- package/dist/swappers/thorchain/utils/getTradeRate/getTradeRate.d.ts +4 -0
- package/dist/swappers/thorchain/utils/getTradeRate/getTradeRate.js +57 -0
- package/dist/swappers/utils/test-data/assets.d.ts +1 -0
- package/dist/swappers/utils/test-data/assets.js +15 -1
- package/dist/swappers/zrx/ZrxApprovalNeeded/ZrxApprovalNeeded.js +1 -1
- package/dist/swappers/zrx/getZrxTradeQuote/getZrxTradeQuote.js +2 -2
- package/dist/swappers/zrx/utils/helpers/helpers.js +1 -1
- package/dist/swappers/zrx/utils/test-data/setupSwapQuote.d.ts +3 -3
- package/dist/swappers/zrx/utils/test-data/setupSwapQuote.js +5 -5
- package/dist/swappers/zrx/zrxBuildTrade/zrxBuildTrade.js +3 -3
- package/dist/swappers/zrx/zrxExecuteTrade/zrxExecuteTrade.js +1 -2
- package/package.json +1 -1
package/dist/api.d.ts
CHANGED
|
@@ -58,11 +58,11 @@ export declare type CommonTradeInput = {
|
|
|
58
58
|
buyAsset: Asset;
|
|
59
59
|
sellAmount: string;
|
|
60
60
|
sendMax: boolean;
|
|
61
|
-
|
|
61
|
+
sellAssetAccountNumber: number;
|
|
62
62
|
};
|
|
63
63
|
export declare type GetTradeQuoteInput = CommonTradeInput;
|
|
64
64
|
export declare type BuildTradeInput = CommonTradeInput & {
|
|
65
|
-
|
|
65
|
+
buyAssetAccountNumber: number;
|
|
66
66
|
slippage?: string;
|
|
67
67
|
wallet: HDWallet;
|
|
68
68
|
};
|
|
@@ -74,7 +74,7 @@ interface TradeBase<C extends SupportedChainIds> {
|
|
|
74
74
|
sources: Array<SwapSource>;
|
|
75
75
|
buyAsset: Asset;
|
|
76
76
|
sellAsset: Asset;
|
|
77
|
-
|
|
77
|
+
sellAssetAccountNumber: number;
|
|
78
78
|
}
|
|
79
79
|
export interface TradeQuote<C extends SupportedChainIds> extends TradeBase<C> {
|
|
80
80
|
allowanceContract: string;
|
|
@@ -155,7 +155,8 @@ export declare enum SwapErrorTypes {
|
|
|
155
155
|
UNSUPPORTED_CHAIN = "UNSUPPORTED_CHAIN",
|
|
156
156
|
VALIDATION_FAILED = "VALIDATION_FAILED",
|
|
157
157
|
MAKE_MEMO_FAILED = "MAKE_MEMO_FAILED",
|
|
158
|
-
PRICE_RATIO_FAILED = "PRICE_RATIO_FAILED"
|
|
158
|
+
PRICE_RATIO_FAILED = "PRICE_RATIO_FAILED",
|
|
159
|
+
POOL_NOT_FOUND = "POOL_NOT_FOUND"
|
|
159
160
|
}
|
|
160
161
|
export interface Swapper {
|
|
161
162
|
/** perform any necessary async initialization */
|
package/dist/api.js
CHANGED
|
@@ -31,4 +31,5 @@ var SwapErrorTypes;
|
|
|
31
31
|
SwapErrorTypes["VALIDATION_FAILED"] = "VALIDATION_FAILED";
|
|
32
32
|
SwapErrorTypes["MAKE_MEMO_FAILED"] = "MAKE_MEMO_FAILED";
|
|
33
33
|
SwapErrorTypes["PRICE_RATIO_FAILED"] = "PRICE_RATIO_FAILED";
|
|
34
|
+
SwapErrorTypes["POOL_NOT_FOUND"] = "POOL_NOT_FOUND";
|
|
34
35
|
})(SwapErrorTypes = exports.SwapErrorTypes || (exports.SwapErrorTypes = {}));
|
|
@@ -30,6 +30,6 @@ export declare class SwapperManager {
|
|
|
30
30
|
* @returns {SwapperType}
|
|
31
31
|
*/
|
|
32
32
|
getSwappersByPair(pair: ByPairInput): Swapper[];
|
|
33
|
-
getSupportedBuyAssetIdsFromSellId(args: BuyAssetBySellIdInput):
|
|
34
|
-
getSupportedSellableAssetIds(args: SupportedSellAssetsInput):
|
|
33
|
+
getSupportedBuyAssetIdsFromSellId(args: BuyAssetBySellIdInput): import("@shapeshiftoss/caip").AssetId[];
|
|
34
|
+
getSupportedSellableAssetIds(args: SupportedSellAssetsInput): import("@shapeshiftoss/caip").AssetId[];
|
|
35
35
|
}
|
package/dist/swappercli.js
CHANGED
|
@@ -95,7 +95,7 @@ const main = async () => {
|
|
|
95
95
|
sellAsset,
|
|
96
96
|
buyAsset,
|
|
97
97
|
sellAmount: sellAmountBase,
|
|
98
|
-
|
|
98
|
+
sellAssetAccountNumber: 0,
|
|
99
99
|
sendMax: false
|
|
100
100
|
});
|
|
101
101
|
}
|
|
@@ -115,8 +115,8 @@ const main = async () => {
|
|
|
115
115
|
sendMax: false,
|
|
116
116
|
sellAmount: sellAmountBase,
|
|
117
117
|
sellAsset,
|
|
118
|
-
|
|
119
|
-
|
|
118
|
+
sellAssetAccountNumber: 0,
|
|
119
|
+
buyAssetAccountNumber: 0
|
|
120
120
|
});
|
|
121
121
|
const txid = await swapper.executeTrade({ trade, wallet });
|
|
122
122
|
console.info('broadcast tx with id: ', txid);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AssetId } from '@shapeshiftoss/caip';
|
|
2
2
|
import { Asset, SupportedChainIds } from '@shapeshiftoss/types';
|
|
3
|
-
import { ApprovalNeededOutput, BuyAssetBySellIdInput, Swapper, SwapperType, Trade, TradeQuote, TradeResult, TradeTxs } from '../../api';
|
|
3
|
+
import { ApprovalNeededOutput, BuyAssetBySellIdInput, ExecuteTradeInput, Swapper, SwapperType, Trade, TradeQuote, TradeResult, TradeTxs } from '../../api';
|
|
4
4
|
import { ThorchainSwapperDeps } from './types';
|
|
5
5
|
export declare class ThorchainSwapper implements Swapper {
|
|
6
6
|
private swapSupportedChainIds;
|
|
@@ -16,6 +16,6 @@ export declare class ThorchainSwapper implements Swapper {
|
|
|
16
16
|
filterAssetIdsBySellable(): AssetId[];
|
|
17
17
|
buildTrade(): Promise<Trade<SupportedChainIds>>;
|
|
18
18
|
getTradeQuote(): Promise<TradeQuote<SupportedChainIds>>;
|
|
19
|
-
executeTrade(): Promise<TradeResult>;
|
|
19
|
+
executeTrade(args: ExecuteTradeInput<SupportedChainIds>): Promise<TradeResult>;
|
|
20
20
|
getTradeTxs(): Promise<TradeTxs>;
|
|
21
21
|
}
|
|
@@ -58,8 +58,21 @@ class ThorchainSwapper {
|
|
|
58
58
|
async getTradeQuote() {
|
|
59
59
|
throw new Error('ThorchainSwapper: getTradeQuote unimplemented');
|
|
60
60
|
}
|
|
61
|
-
async executeTrade() {
|
|
62
|
-
|
|
61
|
+
async executeTrade(args) {
|
|
62
|
+
const { trade, wallet } = args;
|
|
63
|
+
const adapter = await this.deps.adapterManager.byChainId(trade.sellAsset.chainId);
|
|
64
|
+
if (trade.sellAsset.chainId === 'eip155:1') {
|
|
65
|
+
const thorTradeEth = trade;
|
|
66
|
+
const signedTx = await adapter.signTransaction({ txToSign: thorTradeEth.txData, wallet });
|
|
67
|
+
const txid = await adapter.broadcastTransaction(signedTx);
|
|
68
|
+
return { tradeId: txid };
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
throw new api_1.SwapError('[executeTrade]: unsupported trade', {
|
|
72
|
+
code: api_1.SwapErrorTypes.SIGN_AND_BROADCAST_FAILED,
|
|
73
|
+
fn: 'executeTrade'
|
|
74
|
+
});
|
|
75
|
+
}
|
|
63
76
|
}
|
|
64
77
|
async getTradeTxs() {
|
|
65
78
|
throw new Error('ThorchainSwapper: executeTrade unimplemented');
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { AssetId } from '@shapeshiftoss/caip';
|
|
2
|
+
import { Asset } from '@shapeshiftoss/types';
|
|
3
|
+
import { ThorchainSwapperDeps } from '../../types';
|
|
4
|
+
export declare const getTradeRate: (sellAsset: Asset, buyAssetId: AssetId, sellAmount: string, deps: ThorchainSwapperDeps) => Promise<string>;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getTradeRate = void 0;
|
|
4
|
+
const caip_1 = require("@shapeshiftoss/caip");
|
|
5
|
+
const api_1 = require("../../../../api");
|
|
6
|
+
const bignumber_1 = require("../../../utils/bignumber");
|
|
7
|
+
const makeTradeTx_1 = require("../ethereum/makeTradeTx");
|
|
8
|
+
const thorService_1 = require("../thorService");
|
|
9
|
+
const THOR_PRECISION = 8;
|
|
10
|
+
const getSwapOutput = (inputAmount, poolData, toRune) => {
|
|
11
|
+
const x = inputAmount;
|
|
12
|
+
const X = toRune ? poolData.assetBalance : poolData.runeBalance;
|
|
13
|
+
const Y = toRune ? poolData.runeBalance : poolData.assetBalance;
|
|
14
|
+
const numerator = x.times(X).times(Y);
|
|
15
|
+
const denominator = x.plus(X).pow(2);
|
|
16
|
+
return numerator.div(denominator);
|
|
17
|
+
};
|
|
18
|
+
const getDoubleSwapOutput = (input, inputPool, outputPool) => {
|
|
19
|
+
const runeToOutput = getSwapOutput(input, inputPool, true);
|
|
20
|
+
return getSwapOutput(runeToOutput, outputPool, false);
|
|
21
|
+
};
|
|
22
|
+
// https://docs.thorchain.org/how-it-works/prices
|
|
23
|
+
// TODO this does not support swaps between native "RUNE"
|
|
24
|
+
// Rune swaps use a different calculation because its 1 hop between pools instead of 2
|
|
25
|
+
const getTradeRate = async (sellAsset, buyAssetId, sellAmount, deps) => {
|
|
26
|
+
const buyPoolId = caip_1.adapters.assetIdToPoolAssetId({ assetId: buyAssetId });
|
|
27
|
+
const sellPoolId = caip_1.adapters.assetIdToPoolAssetId({ assetId: sellAsset.assetId });
|
|
28
|
+
if (!buyPoolId || !sellPoolId)
|
|
29
|
+
throw new api_1.SwapError(`[getPriceRatio]: No thorchain pool found`, {
|
|
30
|
+
code: api_1.SwapErrorTypes.POOL_NOT_FOUND,
|
|
31
|
+
fn: 'getPriceRatio',
|
|
32
|
+
details: { buyPoolId, sellPoolId }
|
|
33
|
+
});
|
|
34
|
+
const { data: responseData } = await thorService_1.thorService.get(`${deps.midgardUrl}/pools`);
|
|
35
|
+
const buyPool = responseData.find((response) => response.asset === buyPoolId);
|
|
36
|
+
const sellPool = responseData.find((response) => response.asset === sellPoolId);
|
|
37
|
+
if (!buyPool || !sellPool)
|
|
38
|
+
throw new api_1.SwapError(`[getPriceRatio]: no pools found for`, {
|
|
39
|
+
code: api_1.SwapErrorTypes.POOL_NOT_FOUND,
|
|
40
|
+
fn: 'getPriceRatio',
|
|
41
|
+
details: { buyPoolId, sellPoolId }
|
|
42
|
+
});
|
|
43
|
+
// All thorchain pool amounts are base 8 regardless of token precision
|
|
44
|
+
const sellBaseAmount = (0, bignumber_1.bn)((0, makeTradeTx_1.toBaseUnit)((0, makeTradeTx_1.fromBaseUnit)(sellAmount, sellAsset.precision), THOR_PRECISION));
|
|
45
|
+
const sellAssetPoolData = {
|
|
46
|
+
assetBalance: (0, bignumber_1.bn)(sellPool.assetDepth),
|
|
47
|
+
runeBalance: (0, bignumber_1.bn)(sellPool.runeDepth)
|
|
48
|
+
};
|
|
49
|
+
const buyAssetPoolData = {
|
|
50
|
+
assetBalance: (0, bignumber_1.bn)(buyPool.assetDepth),
|
|
51
|
+
runeBalance: (0, bignumber_1.bn)(buyPool.runeDepth)
|
|
52
|
+
};
|
|
53
|
+
const outputAmountBase8 = getDoubleSwapOutput(sellBaseAmount, sellAssetPoolData, buyAssetPoolData);
|
|
54
|
+
const outputAmount = (0, makeTradeTx_1.fromBaseUnit)(outputAmountBase8, THOR_PRECISION);
|
|
55
|
+
return (0, bignumber_1.bn)(outputAmount).div((0, makeTradeTx_1.fromBaseUnit)(sellAmount, sellAsset.precision)).toString();
|
|
56
|
+
};
|
|
57
|
+
exports.getTradeRate = getTradeRate;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ETH = exports.WBTC = exports.FOX = exports.WETH = exports.BTC = void 0;
|
|
3
|
+
exports.UNSUPPORTED = exports.ETH = exports.WBTC = exports.FOX = exports.WETH = exports.BTC = void 0;
|
|
4
4
|
const types_1 = require("@shapeshiftoss/types");
|
|
5
5
|
exports.BTC = {
|
|
6
6
|
assetId: 'bip122:000000000019d6689c085ae165831e93/slip44:0',
|
|
@@ -72,3 +72,17 @@ exports.ETH = {
|
|
|
72
72
|
explorerTxLink: 'https://etherscan.io/tx/',
|
|
73
73
|
explorerAddressLink: 'https://etherscan.io/address/'
|
|
74
74
|
};
|
|
75
|
+
exports.UNSUPPORTED = {
|
|
76
|
+
assetId: 'eip155:1/slip44:420',
|
|
77
|
+
chainId: 'eip155:1',
|
|
78
|
+
chain: types_1.ChainTypes.Ethereum,
|
|
79
|
+
network: types_1.NetworkTypes.MAINNET,
|
|
80
|
+
symbol: 'ETH',
|
|
81
|
+
name: 'Ethereum',
|
|
82
|
+
precision: 18,
|
|
83
|
+
color: '#FFFFFF',
|
|
84
|
+
icon: 'https://assets.coincap.io/assets/icons/eth@2x.png',
|
|
85
|
+
explorer: 'https://etherscan.io',
|
|
86
|
+
explorerTxLink: 'https://etherscan.io/tx/',
|
|
87
|
+
explorerAddressLink: 'https://etherscan.io/address/'
|
|
88
|
+
};
|
|
@@ -21,7 +21,7 @@ async function ZrxApprovalNeeded({ adapterManager, web3 }, { quote, wallet }) {
|
|
|
21
21
|
if (sellAsset.assetId === (0, caip_1.getFeeAssetIdFromAssetId)(sellAsset.assetId)) {
|
|
22
22
|
return { approvalNeeded: false };
|
|
23
23
|
}
|
|
24
|
-
const accountNumber =
|
|
24
|
+
const accountNumber = quote.sellAssetAccountNumber;
|
|
25
25
|
const adapter = await adapterManager.byChainId(sellAsset.chainId);
|
|
26
26
|
const bip44Params = adapter.buildBIP44Params({ accountNumber });
|
|
27
27
|
const receiveAddress = await adapter.getAddress({ wallet, bip44Params });
|
|
@@ -11,7 +11,7 @@ const zrxService_1 = require("../utils/zrxService");
|
|
|
11
11
|
async function getZrxTradeQuote(input) {
|
|
12
12
|
var _a;
|
|
13
13
|
try {
|
|
14
|
-
const { sellAsset, buyAsset, sellAmount,
|
|
14
|
+
const { sellAsset, buyAsset, sellAmount, sellAssetAccountNumber } = input;
|
|
15
15
|
if (buyAsset.chainId !== 'eip155:1' || sellAsset.chainId !== 'eip155:1') {
|
|
16
16
|
throw new api_1.SwapError('[getZrxTradeQuote] - Both assets need to be on the Ethereum chain to use Zrx', {
|
|
17
17
|
code: api_1.SwapErrorTypes.UNSUPPORTED_PAIR,
|
|
@@ -65,7 +65,7 @@ async function getZrxTradeQuote(input) {
|
|
|
65
65
|
allowanceContract: data.allowanceTarget,
|
|
66
66
|
buyAsset,
|
|
67
67
|
sellAsset,
|
|
68
|
-
|
|
68
|
+
sellAssetAccountNumber
|
|
69
69
|
};
|
|
70
70
|
}
|
|
71
71
|
catch (e) {
|
|
@@ -99,7 +99,7 @@ const grantAllowance = async ({ quote, wallet, adapterManager, erc20Abi, web3 })
|
|
|
99
99
|
const approveTx = erc20Contract.methods
|
|
100
100
|
.approve(quote.allowanceContract, quote.sellAmount)
|
|
101
101
|
.encodeABI();
|
|
102
|
-
const accountNumber =
|
|
102
|
+
const accountNumber = quote.sellAssetAccountNumber;
|
|
103
103
|
const bip44Params = adapter.buildBIP44Params({ accountNumber });
|
|
104
104
|
const { txToSign } = await adapter.buildSendTransaction({
|
|
105
105
|
wallet,
|
|
@@ -21,8 +21,8 @@ export declare const setupBuildTrade: () => {
|
|
|
21
21
|
buyAmount: string;
|
|
22
22
|
buyAsset: Asset;
|
|
23
23
|
sendMax: boolean;
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
sellAssetAccountNumber: number;
|
|
25
|
+
buyAssetAccountNumber: number;
|
|
26
26
|
sellAsset: Asset;
|
|
27
27
|
};
|
|
28
28
|
buyAsset: Asset;
|
|
@@ -40,7 +40,7 @@ export declare const setupExecuteTrade: () => {
|
|
|
40
40
|
buyAsset: Asset;
|
|
41
41
|
sellAsset: Asset;
|
|
42
42
|
sendMax: boolean;
|
|
43
|
-
|
|
43
|
+
sellAssetAccountNumber: number;
|
|
44
44
|
txData: string;
|
|
45
45
|
depositAddress: string;
|
|
46
46
|
receiveAddress: string;
|
|
@@ -11,7 +11,7 @@ const setupQuote = () => {
|
|
|
11
11
|
sellAsset,
|
|
12
12
|
buyAsset,
|
|
13
13
|
allowanceContract: 'allowanceContractAddress',
|
|
14
|
-
|
|
14
|
+
sellAssetAccountNumber: 0,
|
|
15
15
|
minimum: '0',
|
|
16
16
|
maximum: '999999999999',
|
|
17
17
|
feeData: { fee: '0', tradeFee: '0', chainSpecific: {} },
|
|
@@ -22,7 +22,7 @@ const setupQuote = () => {
|
|
|
22
22
|
sellAmount: '1000000000000000000',
|
|
23
23
|
sellAsset,
|
|
24
24
|
buyAsset,
|
|
25
|
-
|
|
25
|
+
sellAssetAccountNumber: 0,
|
|
26
26
|
sendMax: false
|
|
27
27
|
};
|
|
28
28
|
return { quoteInput, tradeQuote, buyAsset, sellAsset };
|
|
@@ -56,8 +56,8 @@ const setupBuildTrade = () => {
|
|
|
56
56
|
buyAmount: '',
|
|
57
57
|
buyAsset,
|
|
58
58
|
sendMax: false,
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
sellAssetAccountNumber: 0,
|
|
60
|
+
buyAssetAccountNumber: 0,
|
|
61
61
|
sellAsset
|
|
62
62
|
};
|
|
63
63
|
return { buildTradeInput, buyAsset, sellAsset };
|
|
@@ -77,7 +77,7 @@ const setupExecuteTrade = () => {
|
|
|
77
77
|
buyAsset,
|
|
78
78
|
sellAsset,
|
|
79
79
|
sendMax: false,
|
|
80
|
-
|
|
80
|
+
sellAssetAccountNumber: 0,
|
|
81
81
|
txData: '0x0',
|
|
82
82
|
depositAddress: '0x0',
|
|
83
83
|
receiveAddress: '0x0',
|
|
@@ -35,7 +35,7 @@ const helpers_1 = require("../utils/helpers/helpers");
|
|
|
35
35
|
const zrxService_1 = require("../utils/zrxService");
|
|
36
36
|
async function zrxBuildTrade({ adapterManager, web3 }, input) {
|
|
37
37
|
var _a, _b, _c;
|
|
38
|
-
const { sellAsset, buyAsset, sellAmount, slippage,
|
|
38
|
+
const { sellAsset, buyAsset, sellAmount, slippage, sellAssetAccountNumber, buyAssetAccountNumber, wallet } = input;
|
|
39
39
|
try {
|
|
40
40
|
const { assetReference: buyAssetErc20Address, assetNamespace: buyAssetNamespace } = (0, caip_1.fromAssetId)(buyAsset.assetId);
|
|
41
41
|
const { assetReference: sellAssetErc20Address, assetNamespace: sellAssetNamespace } = (0, caip_1.fromAssetId)(sellAsset.assetId);
|
|
@@ -48,7 +48,7 @@ async function zrxBuildTrade({ adapterManager, web3 }, input) {
|
|
|
48
48
|
});
|
|
49
49
|
}
|
|
50
50
|
const adapter = await adapterManager.byChainId(buyAsset.chainId);
|
|
51
|
-
const bip44Params = adapter.buildBIP44Params({ accountNumber:
|
|
51
|
+
const bip44Params = adapter.buildBIP44Params({ accountNumber: buyAssetAccountNumber });
|
|
52
52
|
const receiveAddress = await adapter.getAddress({ wallet, bip44Params });
|
|
53
53
|
const slippagePercentage = slippage ? (0, bignumber_1.bnOrZero)(slippage).div(100).toString() : constants_1.DEFAULT_SLIPPAGE;
|
|
54
54
|
/**
|
|
@@ -92,7 +92,7 @@ async function zrxBuildTrade({ adapterManager, web3 }, input) {
|
|
|
92
92
|
const trade = {
|
|
93
93
|
sellAsset,
|
|
94
94
|
buyAsset,
|
|
95
|
-
|
|
95
|
+
sellAssetAccountNumber,
|
|
96
96
|
receiveAddress,
|
|
97
97
|
rate: data.price,
|
|
98
98
|
depositAddress: data.to,
|
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.zrxExecuteTrade = void 0;
|
|
4
4
|
const web3_utils_1 = require("web3-utils");
|
|
5
5
|
const api_1 = require("../../../api");
|
|
6
|
-
const bignumber_1 = require("../../utils/bignumber");
|
|
7
6
|
async function zrxExecuteTrade({ adapterManager }, { trade, wallet }) {
|
|
8
7
|
var _a, _b, _c, _d, _e, _f;
|
|
9
8
|
const zrxTrade = trade;
|
|
@@ -13,7 +12,7 @@ async function zrxExecuteTrade({ adapterManager }, { trade, wallet }) {
|
|
|
13
12
|
const value = sellAsset.assetId === 'eip155:1/slip44:60' ? trade.sellAmount : '0';
|
|
14
13
|
const adapter = await adapterManager.byChainId(sellAsset.chainId);
|
|
15
14
|
const bip44Params = adapter.buildBIP44Params({
|
|
16
|
-
accountNumber:
|
|
15
|
+
accountNumber: trade.sellAssetAccountNumber
|
|
17
16
|
});
|
|
18
17
|
const buildTxResponse = await adapter.buildSendTransaction({
|
|
19
18
|
value,
|