@shapeshiftoss/swapper 11.0.1 → 11.1.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.
- package/dist/api.d.ts +1 -1
- package/dist/swappers/cow/types.d.ts +1 -1
- package/dist/swappers/cow/utils/helpers/helpers.d.ts +1 -1
- package/dist/swappers/osmosis/utils/helpers.d.ts +1 -1
- package/dist/swappers/osmosis/utils/helpers.js +2 -2
- package/dist/swappers/thorchain/getThorTradeQuote/getTradeQuote.js +8 -1
- package/dist/swappers/utils/abi/erc20-abi.d.ts +1 -1
- package/dist/swappers/zrx/types.d.ts +1 -1
- package/package.json +8 -8
package/dist/api.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ export declare type CowSwapGetOrdersResponse = {
|
|
|
22
22
|
export declare type CowSwapGetTradesElement = {
|
|
23
23
|
txHash: string;
|
|
24
24
|
};
|
|
25
|
-
export declare type CowSwapGetTradesResponse =
|
|
25
|
+
export declare type CowSwapGetTradesResponse = CowSwapGetTradesElement[];
|
|
26
26
|
export interface CowTrade<C extends ChainId> extends Trade<C> {
|
|
27
27
|
feeAmountInSellToken: string;
|
|
28
28
|
sellAmountWithoutFee: string;
|
|
@@ -8,7 +8,7 @@ export declare const ORDER_TYPE_FIELDS: {
|
|
|
8
8
|
/**
|
|
9
9
|
* EIP-712 typed data type definitions.
|
|
10
10
|
*/
|
|
11
|
-
export declare type TypedDataTypes = Record<string,
|
|
11
|
+
export declare type TypedDataTypes = Record<string, TypedDataField[]>;
|
|
12
12
|
export declare type CowSwapOrder = {
|
|
13
13
|
sellToken: string;
|
|
14
14
|
buyToken: string;
|
|
@@ -189,7 +189,7 @@ const performIbcTransfer = async (input, adapter, wallet, blockBaseUrl, denom, s
|
|
|
189
189
|
],
|
|
190
190
|
gas,
|
|
191
191
|
},
|
|
192
|
-
signatures:
|
|
192
|
+
signatures: [],
|
|
193
193
|
msg: [
|
|
194
194
|
{
|
|
195
195
|
type: 'cosmos-sdk/MsgTransfer',
|
|
@@ -247,7 +247,7 @@ const buildTradeTx = async ({ osmoAddress, adapter, buyAssetDenom, sellAssetDeno
|
|
|
247
247
|
],
|
|
248
248
|
gas,
|
|
249
249
|
},
|
|
250
|
-
signatures:
|
|
250
|
+
signatures: [],
|
|
251
251
|
msg: [
|
|
252
252
|
{
|
|
253
253
|
type: 'osmosis/gamm/swap-exact-amount-in',
|
|
@@ -10,8 +10,10 @@ const constants_2 = require("../utils/constants");
|
|
|
10
10
|
const estimateTradeFee_1 = require("../utils/estimateTradeFee/estimateTradeFee");
|
|
11
11
|
const getThorTxData_2 = require("../utils/ethereum/utils/getThorTxData");
|
|
12
12
|
const getTradeRate_1 = require("../utils/getTradeRate/getTradeRate");
|
|
13
|
+
const getUsdRate_1 = require("../utils/getUsdRate/getUsdRate");
|
|
13
14
|
const getBtcTxFees_1 = require("../utils/txFeeHelpers/btcTxFees/getBtcTxFees");
|
|
14
15
|
const getEthTxFees_1 = require("../utils/txFeeHelpers/ethTxFees/getEthTxFees");
|
|
16
|
+
const MINIMUM_USD_TRADE_AMOUNT = (0, bignumber_1.bn)(1);
|
|
15
17
|
const getThorTradeQuote = async ({ deps, input }) => {
|
|
16
18
|
const { sellAsset, buyAsset, sellAmount, sellAssetAccountNumber, chainId, receiveAddress } = input;
|
|
17
19
|
try {
|
|
@@ -24,7 +26,12 @@ const getThorTradeQuote = async ({ deps, input }) => {
|
|
|
24
26
|
});
|
|
25
27
|
const rate = await (0, getTradeRate_1.getTradeRate)(sellAsset, buyAsset.assetId, sellAmount, deps);
|
|
26
28
|
const buyAmount = (0, bignumber_1.toBaseUnit)((0, bignumber_1.bnOrZero)((0, bignumber_1.fromBaseUnit)(sellAmount, sellAsset.precision)).times(rate), buyAsset.precision);
|
|
27
|
-
const
|
|
29
|
+
const estimatedTradeFee = await (0, estimateTradeFee_1.estimateTradeFee)(deps, buyAsset);
|
|
30
|
+
const buyAssetUsdRate = await (0, getUsdRate_1.getUsdRate)({ deps, input: { assetId: buyAsset.assetId } });
|
|
31
|
+
const minTradeFeeAmount = MINIMUM_USD_TRADE_AMOUNT.div(buyAssetUsdRate);
|
|
32
|
+
const tradeFee = minTradeFeeAmount.gt(estimatedTradeFee)
|
|
33
|
+
? minTradeFeeAmount.toString()
|
|
34
|
+
: estimatedTradeFee;
|
|
28
35
|
const sellAssetTradeFee = (0, bignumber_1.bnOrZero)(tradeFee).dividedBy((0, bignumber_1.bnOrZero)(rate));
|
|
29
36
|
// minimum is tradeFee padded by an amount to be sure they get something back
|
|
30
37
|
// usually it will be slightly more than the amount because sellAssetTradeFee is already a high estimate
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { AbiItem } from 'web3-utils';
|
|
2
|
-
export declare const erc20Abi:
|
|
2
|
+
export declare const erc20Abi: AbiItem[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shapeshiftoss/swapper",
|
|
3
|
-
"version": "11.0
|
|
3
|
+
"version": "11.1.0",
|
|
4
4
|
"description": "An interface and implementations to trade coins via various protocols",
|
|
5
5
|
"repository": "https://github.com/shapeshift/lib",
|
|
6
6
|
"license": "MIT",
|
|
@@ -30,23 +30,23 @@
|
|
|
30
30
|
"web3": "1.7.4"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
|
-
"@shapeshiftoss/asset-service": "^
|
|
33
|
+
"@shapeshiftoss/asset-service": "^8.0.1",
|
|
34
34
|
"@shapeshiftoss/caip": "^8.0.0",
|
|
35
|
-
"@shapeshiftoss/chain-adapters": "^
|
|
35
|
+
"@shapeshiftoss/chain-adapters": "^9.0.1",
|
|
36
36
|
"@shapeshiftoss/errors": "^1.1.2",
|
|
37
|
-
"@shapeshiftoss/hdwallet-core": "^1.
|
|
37
|
+
"@shapeshiftoss/hdwallet-core": "^1.31.0",
|
|
38
38
|
"@shapeshiftoss/types": "^8.1.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@shapeshiftoss/asset-service": "^
|
|
41
|
+
"@shapeshiftoss/asset-service": "^8.0.1",
|
|
42
42
|
"@shapeshiftoss/caip": "^8.0.0",
|
|
43
|
-
"@shapeshiftoss/chain-adapters": "^
|
|
43
|
+
"@shapeshiftoss/chain-adapters": "^9.0.1",
|
|
44
44
|
"@shapeshiftoss/errors": "^1.1.2",
|
|
45
|
-
"@shapeshiftoss/hdwallet-core": "^1.
|
|
45
|
+
"@shapeshiftoss/hdwallet-core": "^1.31.0",
|
|
46
46
|
"@shapeshiftoss/types": "^8.1.0",
|
|
47
47
|
"@types/readline-sync": "^1.4.4",
|
|
48
48
|
"readline-sync": "^1.4.10",
|
|
49
49
|
"web3-utils": "1.7.4",
|
|
50
|
-
"@shapeshiftoss/unchained-client": "^
|
|
50
|
+
"@shapeshiftoss/unchained-client": "^10.0.1"
|
|
51
51
|
}
|
|
52
52
|
}
|