@shapeshiftoss/swapper 7.4.0 → 7.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -2,7 +2,7 @@ import { ethereum } from '@shapeshiftoss/chain-adapters';
|
|
|
2
2
|
import { ETHSignTx, HDWallet } from '@shapeshiftoss/hdwallet-core';
|
|
3
3
|
import { Asset, BIP44Params } from '@shapeshiftoss/types';
|
|
4
4
|
import { ThorchainSwapperDeps } from '../../types';
|
|
5
|
-
export declare const makeTradeTx: ({ wallet, bip44Params, sellAmount, buyAsset, sellAsset, destinationAddress, adapter, maxFeePerGas, maxPriorityFeePerGas, slippageTolerance, deps, gasLimit }: {
|
|
5
|
+
export declare const makeTradeTx: ({ wallet, bip44Params, sellAmount, buyAsset, sellAsset, destinationAddress, adapter, maxFeePerGas, maxPriorityFeePerGas, gasPrice, slippageTolerance, deps, gasLimit }: {
|
|
6
6
|
wallet: HDWallet;
|
|
7
7
|
bip44Params: BIP44Params;
|
|
8
8
|
sellAmount: string;
|
|
@@ -10,11 +10,17 @@ export declare const makeTradeTx: ({ wallet, bip44Params, sellAmount, buyAsset,
|
|
|
10
10
|
sellAsset: Asset;
|
|
11
11
|
destinationAddress: string;
|
|
12
12
|
adapter: ethereum.ChainAdapter;
|
|
13
|
-
maxFeePerGas: string;
|
|
14
|
-
maxPriorityFeePerGas: string;
|
|
15
13
|
slippageTolerance: string;
|
|
16
14
|
deps: ThorchainSwapperDeps;
|
|
17
15
|
gasLimit: string;
|
|
18
|
-
}
|
|
16
|
+
} & ({
|
|
17
|
+
gasPrice: string;
|
|
18
|
+
maxFeePerGas?: undefined;
|
|
19
|
+
maxPriorityFeePerGas?: undefined;
|
|
20
|
+
} | {
|
|
21
|
+
gasPrice?: undefined;
|
|
22
|
+
maxFeePerGas: string;
|
|
23
|
+
maxPriorityFeePerGas: string;
|
|
24
|
+
})) => Promise<{
|
|
19
25
|
txToSign: ETHSignTx;
|
|
20
26
|
}>;
|
|
@@ -4,10 +4,10 @@ exports.makeTradeTx = void 0;
|
|
|
4
4
|
const caip_1 = require("@shapeshiftoss/caip");
|
|
5
5
|
const api_1 = require("../../../../api");
|
|
6
6
|
const getThorTxData_1 = require("../ethereum/utils/getThorTxData");
|
|
7
|
-
const makeTradeTx = async ({ wallet, bip44Params, sellAmount, buyAsset, sellAsset, destinationAddress, adapter, maxFeePerGas, maxPriorityFeePerGas, slippageTolerance, deps, gasLimit }) => {
|
|
7
|
+
const makeTradeTx = async ({ wallet, bip44Params, sellAmount, buyAsset, sellAsset, destinationAddress, adapter, maxFeePerGas, maxPriorityFeePerGas, gasPrice, slippageTolerance, deps, gasLimit }) => {
|
|
8
8
|
try {
|
|
9
|
-
const {
|
|
10
|
-
const isErc20Trade =
|
|
9
|
+
const { assetNamespace } = (0, caip_1.fromAssetId)(sellAsset.assetId);
|
|
10
|
+
const isErc20Trade = assetNamespace === 'erc20';
|
|
11
11
|
const { data, router } = await (0, getThorTxData_1.getThorTxInfo)({
|
|
12
12
|
deps,
|
|
13
13
|
sellAsset,
|
|
@@ -22,8 +22,14 @@ const makeTradeTx = async ({ wallet, bip44Params, sellAmount, buyAsset, sellAsse
|
|
|
22
22
|
bip44Params,
|
|
23
23
|
to: router,
|
|
24
24
|
gasLimit,
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
...(gasPrice !== undefined
|
|
26
|
+
? {
|
|
27
|
+
gasPrice
|
|
28
|
+
}
|
|
29
|
+
: {
|
|
30
|
+
maxFeePerGas,
|
|
31
|
+
maxPriorityFeePerGas
|
|
32
|
+
}),
|
|
27
33
|
value: isErc20Trade ? '0' : sellAmount,
|
|
28
34
|
data
|
|
29
35
|
});
|
package/package.json
CHANGED