@shapeshiftoss/swapper 2.3.0 → 3.0.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.
package/dist/api.d.ts CHANGED
@@ -23,11 +23,11 @@ export interface Swapper {
23
23
  /**
24
24
  * Get a Quote along with an unsigned transaction that can be signed and broadcast to execute the swap
25
25
  **/
26
- buildQuoteTx(args: BuildQuoteTxInput): Promise<Quote<ChainTypes, SwapperType>>;
26
+ buildQuoteTx(args: BuildQuoteTxInput): Promise<Quote<ChainTypes>>;
27
27
  /**
28
28
  * Get a basic quote (rate) for a trading pair
29
29
  */
30
- getQuote(input: GetQuoteInput, wallet?: HDWallet): Promise<Quote<ChainTypes, SwapperType>>;
30
+ getQuote(input: GetQuoteInput, wallet?: HDWallet): Promise<Quote<ChainTypes>>;
31
31
  /**
32
32
  * Get the usd rate from either the assets symbol or tokenId
33
33
  */
@@ -43,15 +43,15 @@ export interface Swapper {
43
43
  /**
44
44
  * Execute a quote built with buildQuoteTx by signing and broadcasting
45
45
  */
46
- executeQuote(args: ExecQuoteInput<ChainTypes, SwapperType>): Promise<ExecQuoteOutput>;
46
+ executeQuote(args: ExecQuoteInput<ChainTypes>): Promise<ExecQuoteOutput>;
47
47
  /**
48
48
  * Get a boolean if a quote needs approval
49
49
  */
50
- approvalNeeded(args: ApprovalNeededInput<ChainTypes, SwapperType>): Promise<ApprovalNeededOutput>;
50
+ approvalNeeded(args: ApprovalNeededInput<ChainTypes>): Promise<ApprovalNeededOutput>;
51
51
  /**
52
52
  * Get the txid of an approve infinite transaction
53
53
  */
54
- approveInfinite(args: ApproveInfiniteInput<ChainTypes, SwapperType>): Promise<string>;
54
+ approveInfinite(args: ApproveInfiniteInput<ChainTypes>): Promise<string>;
55
55
  /**
56
56
  * Get supported buyAssetId's by sellAssetId
57
57
  */
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,111 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const asset_service_1 = require("@shapeshiftoss/asset-service");
7
+ const chain_adapters_1 = require("@shapeshiftoss/chain-adapters");
8
+ const hdwallet_native_1 = require("@shapeshiftoss/hdwallet-native");
9
+ const types_1 = require("@shapeshiftoss/types");
10
+ const bignumber_js_1 = __importDefault(require("bignumber.js"));
11
+ const dotenv_1 = __importDefault(require("dotenv"));
12
+ const readline_sync_1 = __importDefault(require("readline-sync"));
13
+ const web3_1 = __importDefault(require("web3"));
14
+ const SwapperManager_1 = require("./manager/SwapperManager");
15
+ const ZrxSwapper_1 = require("./swappers/zrx/ZrxSwapper");
16
+ dotenv_1.default.config();
17
+ const { UNCHAINED_HTTP_API = 'http://localhost:31300', UNCHAINED_WS_API = 'wss://localhost:31300', ETH_NODE_URL = 'http://localhost:3000', DEVICE_ID = 'device123', MNEMONIC = 'salon adapt foil saddle orient make page zero cheese marble test catalog' } = process.env;
18
+ const toBaseUnit = (amount, precision) => {
19
+ return new bignumber_js_1.default(amount)
20
+ .multipliedBy(new bignumber_js_1.default(10).exponentiatedBy(new bignumber_js_1.default(precision)))
21
+ .toString();
22
+ };
23
+ const fromBaseUnit = (amount, precision) => {
24
+ return new bignumber_js_1.default(amount).times(new bignumber_js_1.default(10).exponentiatedBy(precision * -1)).toString();
25
+ };
26
+ const getWallet = async () => {
27
+ if (!MNEMONIC) {
28
+ throw new Error('Cannot init native wallet without mnemonic');
29
+ }
30
+ const nativeAdapterArgs = {
31
+ mnemonic: MNEMONIC,
32
+ deviceId: DEVICE_ID
33
+ };
34
+ const wallet = new hdwallet_native_1.NativeHDWallet(nativeAdapterArgs);
35
+ await wallet.initialize();
36
+ return wallet;
37
+ };
38
+ const main = async () => {
39
+ const [, , ...args] = process.argv;
40
+ const [sellSymbol, buySymbol, sellAmount] = args;
41
+ console.info(`sellSymbol: sell ${sellAmount} of ${sellSymbol} to ${buySymbol}`);
42
+ if (!sellAmount || !sellSymbol || !buySymbol) {
43
+ console.error(`
44
+ Usage:
45
+ swapcli [sellSymbol] [buySymbol] [sellAmount](denominated in sell asset, not wei)
46
+ `);
47
+ return;
48
+ }
49
+ const assetService = new asset_service_1.AssetService('');
50
+ await assetService.initialize();
51
+ const assets = assetService.byNetwork(types_1.NetworkTypes.MAINNET);
52
+ if (!assets) {
53
+ console.error('No assets found in asset service');
54
+ return;
55
+ }
56
+ const assetMap = assets.reduce((acc, val) => {
57
+ if (val) {
58
+ acc[val.symbol] = val;
59
+ }
60
+ return acc;
61
+ }, {});
62
+ const sellAsset = assetMap[sellSymbol];
63
+ const buyAsset = assetMap[buySymbol];
64
+ if (!sellAsset) {
65
+ console.error(`No asset ${sellSymbol} found in asset service`);
66
+ return;
67
+ }
68
+ if (!buyAsset) {
69
+ console.error(`No asset ${buySymbol} found in asset service`);
70
+ return;
71
+ }
72
+ // Swapper Deps
73
+ const wallet = await getWallet();
74
+ const unchainedUrls = {
75
+ [types_1.ChainTypes.Ethereum]: {
76
+ httpUrl: UNCHAINED_HTTP_API,
77
+ wsUrl: UNCHAINED_WS_API
78
+ }
79
+ };
80
+ const adapterManager = new chain_adapters_1.ChainAdapterManager(unchainedUrls);
81
+ const web3Provider = new web3_1.default.providers.HttpProvider(ETH_NODE_URL);
82
+ const web3 = new web3_1.default(web3Provider);
83
+ const zrxSwapperDeps = { wallet, adapterManager, web3 };
84
+ const manager = new SwapperManager_1.SwapperManager();
85
+ const zrxSwapper = new ZrxSwapper_1.ZrxSwapper(zrxSwapperDeps);
86
+ manager.addSwapper(types_1.SwapperType.Zrx, zrxSwapper);
87
+ const swapper = manager.getSwapper(types_1.SwapperType.Zrx);
88
+ const sellAmountBase = toBaseUnit(sellAmount, sellAsset.precision);
89
+ const quote = await swapper.buildQuoteTx({
90
+ input: {
91
+ sellAsset,
92
+ buyAsset,
93
+ sellAmount: sellAmountBase,
94
+ sellAssetAccountId: '0',
95
+ buyAssetAccountId: '0'
96
+ },
97
+ wallet
98
+ });
99
+ console.info('quote = ', JSON.stringify(quote));
100
+ if (!quote.success) {
101
+ console.error('Obtaining the quote failed: ', quote.statusReason);
102
+ return;
103
+ }
104
+ const buyAmount = fromBaseUnit(quote.buyAmount || '0', buyAsset.precision);
105
+ const answer = readline_sync_1.default.question(`Swap ${sellAmount} ${sellAsset.symbol} for ${buyAmount} ${buyAsset.symbol} on ${swapper.getType()}? (y/n): `);
106
+ if (answer === 'y') {
107
+ const txid = await swapper.executeQuote({ quote, wallet });
108
+ console.info('broadcast tx with id: ', txid);
109
+ }
110
+ };
111
+ main().then(() => console.info('Done'));
@@ -9,8 +9,8 @@ export declare class TestSwapper implements Swapper {
9
9
  supportAssets: string[];
10
10
  getType(): SwapperType;
11
11
  constructor();
12
- getQuote(): Promise<Quote<ChainTypes, SwapperType>>;
13
- buildQuoteTx(): Promise<Quote<ChainTypes, SwapperType>>;
12
+ getQuote(): Promise<Quote<ChainTypes>>;
13
+ buildQuoteTx(): Promise<Quote<ChainTypes>>;
14
14
  getUsdRate(input: Pick<Asset, 'symbol' | 'tokenId'>): Promise<string>;
15
15
  getMinMax(input: GetQuoteInput): Promise<MinMaxOutput>;
16
16
  executeQuote(): Promise<ExecQuoteOutput>;
@@ -3,8 +3,8 @@ import { ApprovalNeededOutput, Asset, ChainTypes, ExecQuoteOutput, GetQuoteInput
3
3
  import { Swapper } from '../../api';
4
4
  export declare class ThorchainSwapper implements Swapper {
5
5
  getType(): SwapperType;
6
- getQuote(): Promise<Quote<ChainTypes, SwapperType>>;
7
- buildQuoteTx(): Promise<Quote<ChainTypes, SwapperType>>;
6
+ getQuote(): Promise<Quote<ChainTypes>>;
7
+ buildQuoteTx(): Promise<Quote<ChainTypes>>;
8
8
  getUsdRate(input: Pick<Asset, 'symbol' | 'tokenId'>): Promise<string>;
9
9
  getMinMax(input: GetQuoteInput): Promise<MinMaxOutput>;
10
10
  executeQuote(): Promise<ExecQuoteOutput>;
@@ -1,3 +1,3 @@
1
- import { ApprovalNeededInput, ApprovalNeededOutput, ChainTypes, SwapperType } from '@shapeshiftoss/types';
1
+ import { ApprovalNeededInput, ApprovalNeededOutput, ChainTypes } from '@shapeshiftoss/types';
2
2
  import { ZrxSwapperDeps } from '../ZrxSwapper';
3
- export declare function ZrxApprovalNeeded({ adapterManager, web3 }: ZrxSwapperDeps, { quote, wallet }: ApprovalNeededInput<ChainTypes, SwapperType>): Promise<ApprovalNeededOutput>;
3
+ export declare function ZrxApprovalNeeded({ adapterManager, web3 }: ZrxSwapperDeps, { quote, wallet }: ApprovalNeededInput<ChainTypes>): Promise<ApprovalNeededOutput>;
@@ -7,8 +7,8 @@ const api_1 = require("../../../api");
7
7
  const erc20Allowance_abi_1 = require("../utils/abi/erc20Allowance-abi");
8
8
  const constants_1 = require("../utils/constants");
9
9
  const helpers_1 = require("../utils/helpers/helpers");
10
- const zrxService_1 = require("../utils/zrxService");
11
10
  async function ZrxApprovalNeeded({ adapterManager, web3 }, { quote, wallet }) {
11
+ var _a, _b;
12
12
  const { sellAsset } = quote;
13
13
  if (sellAsset.symbol === 'ETH') {
14
14
  return { approvalNeeded: false };
@@ -20,42 +20,21 @@ async function ZrxApprovalNeeded({ adapterManager, web3 }, { quote, wallet }) {
20
20
  const adapter = adapterManager.byChain(sellAsset.chain);
21
21
  const bip44Params = adapter.buildBIP44Params({ accountNumber });
22
22
  const receiveAddress = await adapter.getAddress({ wallet, bip44Params });
23
- /**
24
- * /swap/v1/quote
25
- * params: {
26
- * sellToken: contract address (or symbol) of token to sell
27
- * buyToken: contractAddress (or symbol) of token to buy
28
- * sellAmount?: integer string value of the smallest increment of the sell token
29
- * buyAmount?: integer string value of the smallest incremtent of the buy token
30
- * }
31
- */
32
- const quoteResponse = await zrxService_1.zrxService.get('/swap/v1/quote', {
33
- params: {
34
- buyToken: 'ETH',
35
- sellToken: quote.sellAsset.tokenId || quote.sellAsset.symbol || quote.sellAsset.chain,
36
- buyAmount: constants_1.APPROVAL_BUY_AMOUNT,
37
- takerAddress: receiveAddress,
38
- slippagePercentage: constants_1.DEFAULT_SLIPPAGE,
39
- skipValidation: true,
40
- affiliateAddress: constants_1.AFFILIATE_ADDRESS
41
- }
42
- });
43
- const { data } = quoteResponse;
44
- if (!quote.sellAsset.tokenId || !data.allowanceTarget) {
23
+ if (!quote.sellAsset.tokenId || !quote.allowanceContract) {
45
24
  throw new api_1.SwapError('ZrxApprovalNeeded - tokenId and allowanceTarget are required');
46
25
  }
47
26
  const allowanceResult = await (0, helpers_1.getERC20Allowance)({
48
27
  web3,
49
28
  erc20AllowanceAbi: erc20Allowance_abi_1.erc20AllowanceAbi,
50
29
  tokenId: quote.sellAsset.tokenId,
51
- spenderAddress: data.allowanceTarget,
30
+ spenderAddress: quote.allowanceContract,
52
31
  ownerAddress: receiveAddress
53
32
  });
54
33
  const allowanceOnChain = new bignumber_js_1.BigNumber(allowanceResult || '0');
55
34
  return {
56
35
  approvalNeeded: allowanceOnChain.lt(new bignumber_js_1.BigNumber(quote.sellAmount || 1)),
57
36
  gas: constants_1.APPROVAL_GAS_LIMIT,
58
- gasPrice: data.gasPrice
37
+ gasPrice: (_b = (_a = quote === null || quote === void 0 ? void 0 : quote.feeData) === null || _a === void 0 ? void 0 : _a.chainSpecific) === null || _b === void 0 ? void 0 : _b.gasPrice
59
38
  };
60
39
  }
61
40
  exports.ZrxApprovalNeeded = ZrxApprovalNeeded;
@@ -1,3 +1,3 @@
1
- import { ApproveInfiniteInput, ChainTypes, SwapperType } from '@shapeshiftoss/types';
1
+ import { ApproveInfiniteInput, ChainTypes } from '@shapeshiftoss/types';
2
2
  import { ZrxSwapperDeps } from '../ZrxSwapper';
3
- export declare function ZrxApproveInfinite({ adapterManager, web3 }: ZrxSwapperDeps, { quote, wallet }: ApproveInfiniteInput<ChainTypes, SwapperType>): Promise<string>;
3
+ export declare function ZrxApproveInfinite({ adapterManager, web3 }: ZrxSwapperDeps, { quote, wallet }: ApproveInfiniteInput<ChainTypes>): Promise<string>;
@@ -2,46 +2,15 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ZrxApproveInfinite = void 0;
4
4
  const types_1 = require("@shapeshiftoss/types");
5
- const api_1 = require("../../../api");
6
5
  const erc20_abi_1 = require("../utils/abi/erc20-abi");
7
- const bignumber_1 = require("../utils/bignumber");
8
6
  const constants_1 = require("../utils/constants");
9
7
  const helpers_1 = require("../utils/helpers/helpers");
10
- const zrxService_1 = require("../utils/zrxService");
11
8
  async function ZrxApproveInfinite({ adapterManager, web3 }, { quote, wallet }) {
12
9
  const adapter = adapterManager.byChain(types_1.ChainTypes.Ethereum);
13
- const bip44Params = adapter.buildBIP44Params({
14
- accountNumber: (0, bignumber_1.bnOrZero)(quote.sellAssetAccountId).toNumber()
15
- }); // TODO: Add account number
16
- const receiveAddress = await adapter.getAddress({ wallet, bip44Params });
17
- /**
18
- * /swap/v1/quote
19
- * params: {
20
- * sellToken: contract address (or symbol) of token to sell
21
- * buyToken: contractAddress (or symbol) of token to buy
22
- * sellAmount?: integer string value of the smallest increment of the sell token
23
- * buyAmount?: integer string value of the smallest incremtent of the buy token
24
- * }
25
- */
26
- const quoteResponse = await zrxService_1.zrxService.get('/swap/v1/quote', {
27
- params: {
28
- buyToken: 'ETH',
29
- sellToken: quote.sellAsset.tokenId || quote.sellAsset.symbol || quote.sellAsset.network,
30
- buyAmount: '100000000000000000',
31
- takerAddress: receiveAddress,
32
- slippagePercentage: constants_1.DEFAULT_SLIPPAGE,
33
- skipValidation: true,
34
- affiliateAddress: constants_1.AFFILIATE_ADDRESS
35
- }
36
- });
37
- const { data } = quoteResponse;
38
- if (!data.allowanceTarget) {
39
- throw new api_1.SwapError('approveInfinite - allowanceTarget is required');
40
- }
41
10
  const allowanceGrantRequired = await (0, helpers_1.grantAllowance)({
42
11
  quote: {
43
12
  ...quote,
44
- allowanceContract: data.allowanceTarget,
13
+ allowanceContract: quote.allowanceContract,
45
14
  sellAmount: constants_1.MAX_ALLOWANCE
46
15
  },
47
16
  wallet,
@@ -1,3 +1,3 @@
1
- import { BuildQuoteTxInput, ChainTypes, Quote, SwapperType } from '@shapeshiftoss/types';
1
+ import { BuildQuoteTxInput, ChainTypes, Quote } from '@shapeshiftoss/types';
2
2
  import { ZrxSwapperDeps } from '../ZrxSwapper';
3
- export declare function ZrxBuildQuoteTx({ adapterManager, web3 }: ZrxSwapperDeps, { input, wallet }: BuildQuoteTxInput): Promise<Quote<ChainTypes, SwapperType>>;
3
+ export declare function ZrxBuildQuoteTx({ adapterManager, web3 }: ZrxSwapperDeps, { input, wallet }: BuildQuoteTxInput): Promise<Quote<ChainTypes>>;
@@ -1,3 +1,3 @@
1
- import { ChainTypes, ExecQuoteInput, ExecQuoteOutput, SwapperType } from '@shapeshiftoss/types';
1
+ import { ChainTypes, ExecQuoteInput, ExecQuoteOutput } from '@shapeshiftoss/types';
2
2
  import { ZrxSwapperDeps } from '../ZrxSwapper';
3
- export declare function ZrxExecuteQuote({ adapterManager }: ZrxSwapperDeps, { quote, wallet }: ExecQuoteInput<ChainTypes.Ethereum, SwapperType>): Promise<ExecQuoteOutput>;
3
+ export declare function ZrxExecuteQuote({ adapterManager }: ZrxSwapperDeps, { quote, wallet }: ExecQuoteInput<ChainTypes.Ethereum>): Promise<ExecQuoteOutput>;
@@ -15,14 +15,14 @@ export declare class ZrxSwapper implements Swapper {
15
15
  deps: ZrxSwapperDeps;
16
16
  constructor(deps: ZrxSwapperDeps);
17
17
  getType(): SwapperType;
18
- buildQuoteTx(args: BuildQuoteTxInput): Promise<Quote<ChainTypes, SwapperType>>;
19
- getQuote(input: GetQuoteInput): Promise<Quote<ChainTypes, SwapperType>>;
18
+ buildQuoteTx(args: BuildQuoteTxInput): Promise<Quote<ChainTypes>>;
19
+ getQuote(input: GetQuoteInput): Promise<Quote<ChainTypes>>;
20
20
  getUsdRate(input: Pick<Asset, 'symbol' | 'tokenId'>): Promise<string>;
21
21
  getMinMax(input: GetQuoteInput): Promise<MinMaxOutput>;
22
22
  getDefaultPair(): [CAIP19, CAIP19];
23
- executeQuote(args: ExecQuoteInput<ChainTypes, SwapperType>): Promise<ExecQuoteOutput>;
24
- approvalNeeded(args: ApprovalNeededInput<ChainTypes, SwapperType>): Promise<ApprovalNeededOutput>;
25
- approveInfinite(args: ApproveInfiniteInput<ChainTypes, SwapperType>): Promise<string>;
23
+ executeQuote(args: ExecQuoteInput<ChainTypes>): Promise<ExecQuoteOutput>;
24
+ approvalNeeded(args: ApprovalNeededInput<ChainTypes>): Promise<ApprovalNeededOutput>;
25
+ approveInfinite(args: ApproveInfiniteInput<ChainTypes>): Promise<string>;
26
26
  filterBuyAssetsBySellAssetId(args: BuyAssetBySellIdInput): CAIP19[];
27
27
  filterAssetIdsBySellable(assetIds: CAIP19[]): CAIP19[];
28
28
  }
@@ -8,35 +8,19 @@ const types_1 = require("@shapeshiftoss/types");
8
8
  const bignumber_js_1 = __importDefault(require("bignumber.js"));
9
9
  const constants_1 = require("../utils/constants");
10
10
  const helpers_1 = require("../utils/helpers/helpers");
11
- const zrxService_1 = require("../utils/zrxService");
12
11
  const ZrxSwapper_1 = require("../ZrxSwapper");
13
12
  const getZrxMinMax = async (input) => {
14
- var _a;
15
13
  const { sellAsset, buyAsset } = input;
16
14
  if (sellAsset.chain !== types_1.ChainTypes.Ethereum || buyAsset.chain !== types_1.ChainTypes.Ethereum) {
17
15
  throw new ZrxSwapper_1.ZrxError('getZrxMinMax - must be eth assets');
18
16
  }
19
- const buyToken = buyAsset.tokenId || buyAsset.symbol;
20
- const sellToken = sellAsset.tokenId || sellAsset.symbol;
21
17
  const usdRate = await (0, helpers_1.getUsdRate)({
22
18
  symbol: sellAsset.symbol,
23
19
  tokenId: sellAsset.tokenId
24
20
  });
25
- const minimumWeiAmount = new bignumber_js_1.default(1)
26
- .dividedBy(new bignumber_js_1.default(usdRate))
27
- .times(new bignumber_js_1.default(10).exponentiatedBy(sellAsset.precision));
28
21
  const minimum = new bignumber_js_1.default(1).dividedBy(new bignumber_js_1.default(usdRate)).toString();
29
- const minimumPriceResult = await zrxService_1.zrxService.get('/swap/v1/price', {
30
- params: {
31
- sellToken,
32
- buyToken,
33
- sellAmount: (0, helpers_1.normalizeAmount)(minimumWeiAmount.toString())
34
- }
35
- });
36
- const minimumPrice = new bignumber_js_1.default((_a = minimumPriceResult === null || minimumPriceResult === void 0 ? void 0 : minimumPriceResult.data) === null || _a === void 0 ? void 0 : _a.price).toString();
37
22
  return {
38
23
  minimum,
39
- minimumPrice,
40
24
  maximum: constants_1.MAX_ZRX_TRADE
41
25
  };
42
26
  };
@@ -1,2 +1,2 @@
1
- import { ChainTypes, GetQuoteInput, Quote, SwapperType } from '@shapeshiftoss/types';
2
- export declare function getZrxQuote(input: GetQuoteInput): Promise<Quote<ChainTypes.Ethereum, SwapperType>>;
1
+ import { ChainTypes, GetQuoteInput, Quote } from '@shapeshiftoss/types';
2
+ export declare function getZrxQuote(input: GetQuoteInput): Promise<Quote<ChainTypes.Ethereum>>;
@@ -96,7 +96,8 @@ async function getZrxQuote(input) {
96
96
  sellAmount: data.sellAmount,
97
97
  buyAmount: data.buyAmount,
98
98
  guaranteedPrice: data.guaranteedPrice,
99
- sources: ((_a = data.sources) === null || _a === void 0 ? void 0 : _a.filter((s) => parseFloat(s.proportion) > 0)) || constants_1.DEFAULT_SOURCE
99
+ sources: ((_a = data.sources) === null || _a === void 0 ? void 0 : _a.filter((s) => parseFloat(s.proportion) > 0)) || constants_1.DEFAULT_SOURCE,
100
+ allowanceContract: data.allowanceTarget
100
101
  };
101
102
  }
102
103
  catch (e) {
@@ -1,11 +1,11 @@
1
1
  import { ChainAdapter } from '@shapeshiftoss/chain-adapters';
2
2
  import { HDWallet } from '@shapeshiftoss/hdwallet-core';
3
- import { Asset, ChainTypes, Quote, SwapperType } from '@shapeshiftoss/types';
3
+ import { Asset, ChainTypes, Quote } from '@shapeshiftoss/types';
4
4
  import BigNumber from 'bignumber.js';
5
5
  import Web3 from 'web3';
6
6
  import { AbiItem } from 'web3-utils';
7
7
  export declare type GetAllowanceRequiredArgs = {
8
- quote: Quote<ChainTypes, SwapperType>;
8
+ quote: Quote<ChainTypes>;
9
9
  web3: Web3;
10
10
  erc20AllowanceAbi: AbiItem[];
11
11
  };
@@ -17,7 +17,7 @@ export declare type GetERC20AllowanceArgs = {
17
17
  spenderAddress: string;
18
18
  };
19
19
  declare type GrantAllowanceArgs = {
20
- quote: Quote<ChainTypes, SwapperType>;
20
+ quote: Quote<ChainTypes>;
21
21
  wallet: HDWallet;
22
22
  adapter: ChainAdapter<ChainTypes.Ethereum>;
23
23
  erc20Abi: AbiItem[];
@@ -1,4 +1,3 @@
1
- /// <reference types="jest" />
2
1
  import { ChainAdapterManager } from '@shapeshiftoss/chain-adapters';
3
2
  import Web3 from 'web3';
4
3
  export declare const chainAdapterMockFuncs: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shapeshiftoss/swapper",
3
- "version": "2.3.0",
3
+ "version": "3.0.2",
4
4
  "description": "TODO: description",
5
5
  "repository": "https://github.com/shapeshift/lib",
6
6
  "license": "MIT",
@@ -13,11 +13,13 @@
13
13
  "access": "public"
14
14
  },
15
15
  "scripts": {
16
- "build": "yarn clean && tsc --project tsconfig.build.json",
16
+ "build": "yarn clean && yarn compile",
17
17
  "dev": "tsc --watch",
18
- "clean": "rm -rf dist",
18
+ "clean": "rm -rf dist && rm -rf tsconfig.build.tsbuildinfo",
19
+ "compile": "tsc -p tsconfig.build.json",
20
+ "prepare": "yarn build",
19
21
  "test": "jest test",
20
- "type-check": "tsc --project ./tsconfig.json --noEmit",
22
+ "type-check": "tsc --project ./tsconfig.build.json --noEmit",
21
23
  "swapcli": "yarn build && node ./dist/swappercli.js"
22
24
  },
23
25
  "dependencies": {
@@ -32,14 +34,14 @@
32
34
  "@shapeshiftoss/caip": "^2.0.0",
33
35
  "@shapeshiftoss/chain-adapters": "^2.0.0",
34
36
  "@shapeshiftoss/hdwallet-core": "1.20.0",
35
- "@shapeshiftoss/types": "^2.1.0"
37
+ "@shapeshiftoss/types": "^3.0.0"
36
38
  },
37
39
  "devDependencies": {
38
40
  "@shapeshiftoss/asset-service": "^2.0.0",
39
41
  "@shapeshiftoss/caip": "^2.0.0",
40
42
  "@shapeshiftoss/chain-adapters": "^2.0.0",
41
43
  "@shapeshiftoss/hdwallet-core": "^1.20.0",
42
- "@shapeshiftoss/types": "^2.1.0",
44
+ "@shapeshiftoss/types": "^3.0.0",
43
45
  "@types/readline-sync": "^1.4.4",
44
46
  "readline-sync": "^1.4.10",
45
47
  "web3-utils": "^1.5.2"