@shapeshiftoss/swapper 5.1.1 → 5.1.2

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.
@@ -22,7 +22,7 @@ async function getZrxTradeQuote(input) {
22
22
  const sellToken = sellAsset.tokenId || sellAsset.symbol;
23
23
  const { minimum, maximum } = await (0, getZrxMinMax_1.getZrxMinMax)(sellAsset, buyAsset);
24
24
  const minQuoteSellAmount = (0, bignumber_1.bnOrZero)(minimum).times((0, bignumber_1.bn)(10).exponentiatedBy(sellAsset.precision));
25
- const normalizedSellAmount = (0, helpers_1.normalizeAmount)((0, bignumber_1.bnOrZero)(sellAmount).eq(0) ? minQuoteSellAmount.toString() : sellAmount);
25
+ const normalizedSellAmount = (0, helpers_1.normalizeAmount)((0, bignumber_1.bnOrZero)(sellAmount).eq(0) ? minQuoteSellAmount : sellAmount);
26
26
  /**
27
27
  * /swap/v1/price
28
28
  * params: {
@@ -35,7 +35,7 @@ declare type GrantAllowanceArgs = {
35
35
  * ETH or ERC20, we still keep 7 decimal places.
36
36
  * @param amount
37
37
  */
38
- export declare const normalizeAmount: (amount: string | undefined) => string | undefined;
38
+ export declare const normalizeAmount: (amount: string | number | BigNumber) => string;
39
39
  export declare const getERC20Allowance: ({ erc20AllowanceAbi, web3, tokenId, ownerAddress, spenderAddress }: GetERC20AllowanceArgs) => Promise<any>;
40
40
  export declare const getAllowanceRequired: ({ receiveAddress, allowanceContract, sellAsset, sellAmount, web3, erc20AllowanceAbi }: GetAllowanceRequiredArgs) => Promise<BigNumber>;
41
41
  export declare const getUsdRate: (input: Pick<Asset, 'symbol' | 'tokenId'>) => Promise<string>;
@@ -14,8 +14,6 @@ const zrxService_1 = require("../zrxService");
14
14
  * @param amount
15
15
  */
16
16
  const normalizeAmount = (amount) => {
17
- if (!amount)
18
- return;
19
17
  return (0, bignumber_1.bnOrZero)(amount).toNumber().toLocaleString('fullwide', { useGrouping: false });
20
18
  };
21
19
  exports.normalizeAmount = normalizeAmount;
@@ -77,7 +77,7 @@ async function zrxBuildTrade({ adapterManager, web3 }, input) {
77
77
  params: {
78
78
  buyToken,
79
79
  sellToken,
80
- sellAmount: (0, helpers_1.normalizeAmount)(sellAmount === null || sellAmount === void 0 ? void 0 : sellAmount.toString()),
80
+ sellAmount: (0, helpers_1.normalizeAmount)(sellAmount),
81
81
  takerAddress: receiveAddress,
82
82
  slippagePercentage,
83
83
  skipValidation: false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shapeshiftoss/swapper",
3
- "version": "5.1.1",
3
+ "version": "5.1.2",
4
4
  "description": "TODO: description",
5
5
  "repository": "https://github.com/shapeshift/lib",
6
6
  "license": "MIT",