@shapeshiftoss/swapper 5.10.0 → 5.10.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 CHANGED
@@ -33,9 +33,14 @@ declare type ChainSpecificQuoteFeeData<T1> = ChainSpecific<T1, {
33
33
  approvalFee?: string;
34
34
  totalFee?: string;
35
35
  };
36
+ 'bip122:000000000019d6689c085ae165831e93': {
37
+ byteCount: string;
38
+ satsPerByte: string;
39
+ };
36
40
  }>;
37
41
  export declare type QuoteFeeData<T1 extends SupportedChainIds> = {
38
42
  fee: string;
43
+ tradeFee: string;
39
44
  } & ChainSpecificQuoteFeeData<T1>;
40
45
  export declare type ByPairInput = {
41
46
  sellAssetId: AssetId;
@@ -62,8 +67,6 @@ export declare type BuildTradeInput = CommonTradeInput & {
62
67
  wallet: HDWallet;
63
68
  };
64
69
  interface TradeBase<C extends SupportedChainIds> {
65
- success: boolean;
66
- statusReason: string;
67
70
  buyAmount: string;
68
71
  sellAmount: string;
69
72
  feeData: QuoteFeeData<C>;
@@ -106,10 +106,6 @@ const main = async () => {
106
106
  return;
107
107
  }
108
108
  console.info('quote = ', JSON.stringify(quote));
109
- if (!quote.success) {
110
- console.error('Obtaining the quote failed: ', quote.statusReason);
111
- return;
112
- }
113
109
  const buyAmount = fromBaseUnit(quote.buyAmount || '0', buyAsset.precision);
114
110
  const answer = readline_sync_1.default.question(`Swap ${sellAmount} ${sellAsset.symbol} for ${buyAmount} ${buyAsset.symbol} on ${swapper.getType()}? (y/n): `);
115
111
  if (answer === 'y') {
@@ -1,4 +1,3 @@
1
- import { SupportedChainIds } from '@shapeshiftoss/types';
2
1
  import { ApprovalNeededInput, ApprovalNeededOutput } from '../../../api';
3
2
  import { ZrxSwapperDeps } from '../ZrxSwapper';
4
- export declare function ZrxApprovalNeeded({ adapterManager, web3 }: ZrxSwapperDeps, { quote, wallet }: ApprovalNeededInput<SupportedChainIds>): Promise<ApprovalNeededOutput>;
3
+ export declare function ZrxApprovalNeeded({ adapterManager, web3 }: ZrxSwapperDeps, { quote, wallet }: ApprovalNeededInput<'eip155:1'>): Promise<ApprovalNeededOutput>;
@@ -16,8 +16,8 @@ export declare class ZrxSwapper implements Swapper {
16
16
  buildTrade(args: BuildTradeInput): Promise<ZrxTrade<SupportedChainIds>>;
17
17
  getTradeQuote(input: GetTradeQuoteInput): Promise<TradeQuote<SupportedChainIds>>;
18
18
  getUsdRate(input: Asset): Promise<string>;
19
- executeTrade(args: ExecuteTradeInput<SupportedChainIds>): Promise<TradeResult>;
20
- approvalNeeded(args: ApprovalNeededInput<SupportedChainIds>): Promise<ApprovalNeededOutput>;
19
+ executeTrade(args: ExecuteTradeInput<'eip155:1'>): Promise<TradeResult>;
20
+ approvalNeeded(args: ApprovalNeededInput<'eip155:1'>): Promise<ApprovalNeededOutput>;
21
21
  approveInfinite(args: ApproveInfiniteInput<SupportedChainIds>): Promise<string>;
22
22
  filterBuyAssetsBySellAssetId(args: BuyAssetBySellIdInput): AssetId[];
23
23
  filterAssetIdsBySellable(assetIds?: AssetId[]): AssetId[];
@@ -46,8 +46,6 @@ async function getZrxTradeQuote(input) {
46
46
  const estimatedGas = (0, bignumber_1.bnOrZero)(data.estimatedGas).times(1.5);
47
47
  const rate = useSellAmount ? data.price : (0, bignumber_1.bn)(1).div(data.price).toString();
48
48
  return {
49
- success: true,
50
- statusReason: '',
51
49
  rate,
52
50
  minimum,
53
51
  maximum,
@@ -58,7 +56,8 @@ async function getZrxTradeQuote(input) {
58
56
  gasPrice: data.gasPrice,
59
57
  approvalFee: sellAssetErc20Address &&
60
58
  (0, bignumber_1.bnOrZero)(constants_1.APPROVAL_GAS_LIMIT).multipliedBy((0, bignumber_1.bnOrZero)(data.gasPrice)).toString()
61
- }
59
+ },
60
+ tradeFee: '0'
62
61
  },
63
62
  sellAmount: data.sellAmount,
64
63
  buyAmount: data.buyAmount,
@@ -3,7 +3,7 @@ import { TradeQuote } from '../../../../api';
3
3
  import { ZrxQuoteResponse } from '../../types';
4
4
  export declare const setupQuote: () => {
5
5
  quoteInput: import("../../../../api").CommonTradeInput;
6
- tradeQuote: TradeQuote<"eip155:1" | "bip122:000000000019d6689c085ae165831e93" | "cosmos:cosmoshub-4" | "cosmos:osmosis-1">;
6
+ tradeQuote: TradeQuote<"eip155:1">;
7
7
  buyAsset: Asset;
8
8
  sellAsset: Asset;
9
9
  };
@@ -44,11 +44,10 @@ export declare const setupExecuteTrade: () => {
44
44
  txData: string;
45
45
  depositAddress: string;
46
46
  receiveAddress: string;
47
- success: boolean;
48
- statusReason: string;
49
47
  feeData: {
50
48
  fee: string;
51
49
  chainSpecific: {};
50
+ tradeFee: string;
52
51
  };
53
52
  rate: string;
54
53
  allowanceContract: string;
@@ -6,8 +6,6 @@ const setupQuote = () => {
6
6
  const sellAsset = { ...assets_1.FOX };
7
7
  const buyAsset = { ...assets_1.WETH };
8
8
  const tradeQuote = {
9
- success: true,
10
- statusReason: '',
11
9
  buyAmount: '',
12
10
  sellAmount: '1000000000000000000',
13
11
  sellAsset,
@@ -16,7 +14,7 @@ const setupQuote = () => {
16
14
  sellAssetAccountId: '0',
17
15
  minimum: '0',
18
16
  maximum: '999999999999',
19
- feeData: { fee: '0' },
17
+ feeData: { fee: '0', tradeFee: '0', chainSpecific: {} },
20
18
  rate: '1',
21
19
  sources: []
22
20
  };
@@ -83,9 +81,7 @@ const setupExecuteTrade = () => {
83
81
  txData: '0x0',
84
82
  depositAddress: '0x0',
85
83
  receiveAddress: '0x0',
86
- success: true,
87
- statusReason: '',
88
- feeData: { fee: '0', chainSpecific: {} },
84
+ feeData: { fee: '0', chainSpecific: {}, tradeFee: '0' },
89
85
  rate: '0',
90
86
  allowanceContract: '0x0',
91
87
  sources: []
@@ -92,8 +92,6 @@ async function zrxBuildTrade({ adapterManager, web3 }, input) {
92
92
  const trade = {
93
93
  sellAsset,
94
94
  buyAsset,
95
- success: true,
96
- statusReason: '',
97
95
  sellAssetAccountId,
98
96
  receiveAddress,
99
97
  rate: data.price,
@@ -103,7 +101,8 @@ async function zrxBuildTrade({ adapterManager, web3 }, input) {
103
101
  chainSpecific: {
104
102
  estimatedGas: estimatedGas.toString(),
105
103
  gasPrice: data.gasPrice
106
- }
104
+ },
105
+ tradeFee: '0'
107
106
  },
108
107
  txData: data.data,
109
108
  sellAmount: data.sellAmount,
@@ -125,7 +124,8 @@ async function zrxBuildTrade({ adapterManager, web3 }, input) {
125
124
  chainSpecific: {
126
125
  ...(_c = trade.feeData) === null || _c === void 0 ? void 0 : _c.chainSpecific,
127
126
  approvalFee: (0, bignumber_1.bnOrZero)(constants_1.APPROVAL_GAS_LIMIT).multipliedBy((0, bignumber_1.bnOrZero)(data.gasPrice)).toString()
128
- }
127
+ },
128
+ tradeFee: '0'
129
129
  };
130
130
  }
131
131
  return trade;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shapeshiftoss/swapper",
3
- "version": "5.10.0",
3
+ "version": "5.10.1",
4
4
  "description": "TODO: description",
5
5
  "repository": "https://github.com/shapeshift/lib",
6
6
  "license": "MIT",