@shapeshiftoss/swapper 9.16.2 → 9.17.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 CHANGED
@@ -79,7 +79,6 @@ declare type CommonTradeInput = {
79
79
  sellAmount: string;
80
80
  sendMax: boolean;
81
81
  sellAssetAccountNumber: number;
82
- wallet: HDWallet;
83
82
  receiveAddress: string;
84
83
  };
85
84
  export declare type EvmSupportedChainIds = KnownChainIds.EthereumMainnet | KnownChainIds.AvalancheMainnet;
@@ -97,7 +96,7 @@ export declare type GetUtxoTradeQuoteInput = CommonTradeInput & {
97
96
  chainId: UtxoSupportedChainIds;
98
97
  accountType: UtxoAccountType;
99
98
  bip44Params: BIP44Params;
100
- wallet: HDWallet;
99
+ xpub: string;
101
100
  };
102
101
  export declare type GetTradeQuoteInput = GetUtxoTradeQuoteInput | GetEvmTradeQuoteInput | GetCosmosSdkTradeQuoteInput;
103
102
  export declare type BuildTradeInput = GetTradeQuoteInput & {
@@ -116,7 +116,6 @@ const main = async () => {
116
116
  sellAssetAccountNumber: 0,
117
117
  sendMax: false,
118
118
  receiveAddress: '0xc770eefad204b5180df6a14ee197d99d808ee52d',
119
- wallet,
120
119
  });
121
120
  }
122
121
  catch (e) {
@@ -17,7 +17,7 @@ const helpers_2 = require("../utils/helpers/helpers");
17
17
  async function getCowSwapTradeQuote(deps, input) {
18
18
  var _a, _b;
19
19
  try {
20
- const { sellAsset, buyAsset, sellAmount, sellAssetAccountNumber, wallet } = input;
20
+ const { sellAsset, buyAsset, sellAmount, sellAssetAccountNumber, receiveAddress } = input;
21
21
  const { adapter, web3 } = deps;
22
22
  const { assetReference: sellAssetErc20Address, assetNamespace: sellAssetNamespace } = (0, caip_1.fromAssetId)(sellAsset.assetId);
23
23
  const { assetReference: buyAssetErc20Address, chainId: buyAssetChainId } = (0, caip_1.fromAssetId)(buyAsset.assetId);
@@ -68,7 +68,6 @@ async function getCowSwapTradeQuote(deps, input) {
68
68
  const buyCryptoAmount = (0, bignumber_1.bn)(quote.buyAmount).div((0, bignumber_1.bn)(10).exponentiatedBy(buyAsset.precision));
69
69
  const sellCryptoAmount = (0, bignumber_1.bn)(quote.sellAmount).div((0, bignumber_1.bn)(10).exponentiatedBy(sellAsset.precision));
70
70
  const rate = buyCryptoAmount.div(sellCryptoAmount).toString();
71
- const receiveAddress = wallet ? await adapter.getAddress({ wallet }) : constants_1.DEFAULT_ADDRESS;
72
71
  const data = (0, helpers_1.getApproveContractData)({
73
72
  web3,
74
73
  spenderAddress: constants_1.COW_SWAP_VAULT_RELAYER_ADDRESS,
@@ -55,9 +55,7 @@ const buildTrade = async ({ deps, input, }) => {
55
55
  sellAmount,
56
56
  slippageTolerance,
57
57
  destinationAddress,
58
- wallet,
59
- bip44Params: input.bip44Params,
60
- accountType: input.accountType,
58
+ xpub: input.xpub,
61
59
  tradeFee: quote.feeData.tradeFee,
62
60
  });
63
61
  const buildTxResponse = await sellAdapter.buildSendTransaction({
@@ -13,11 +13,7 @@ const getTradeRate_1 = require("../utils/getTradeRate/getTradeRate");
13
13
  const getBtcTxFees_1 = require("../utils/txFeeHelpers/btcTxFees/getBtcTxFees");
14
14
  const getEthTxFees_1 = require("../utils/txFeeHelpers/ethTxFees/getEthTxFees");
15
15
  const getThorTradeQuote = async ({ deps, input }) => {
16
- const { sellAsset, buyAsset, sellAmount, sellAssetAccountNumber, wallet, chainId, receiveAddress, } = input;
17
- if (!wallet)
18
- throw new api_1.SwapError('[getThorTradeQuote] - wallet is required', {
19
- code: api_1.SwapErrorTypes.VALIDATION_FAILED,
20
- });
16
+ const { sellAsset, buyAsset, sellAmount, sellAssetAccountNumber, chainId, receiveAddress } = input;
21
17
  try {
22
18
  const { assetReference: sellAssetErc20Address } = (0, caip_1.fromAssetId)(sellAsset.assetId);
23
19
  const sellAdapter = deps.adapterManager.get(chainId);
@@ -77,9 +73,7 @@ const getThorTradeQuote = async ({ deps, input }) => {
77
73
  sellAmount,
78
74
  slippageTolerance: constants_1.DEFAULT_SLIPPAGE,
79
75
  destinationAddress: receiveAddress,
80
- wallet,
81
- bip44Params: input.bip44Params,
82
- accountType: input.accountType,
76
+ xpub: input.xpub,
83
77
  tradeFee,
84
78
  });
85
79
  const feeData = await (0, getBtcTxFees_1.getBtcTxFees)({
@@ -1,6 +1,4 @@
1
1
  import { Asset } from '@shapeshiftoss/asset-service';
2
- import { HDWallet } from '@shapeshiftoss/hdwallet-core';
3
- import { BIP44Params, UtxoAccountType } from '@shapeshiftoss/types';
4
2
  import { ThorchainSwapperDeps } from '../../../types';
5
3
  declare type GetBtcThorTxInfoArgs = {
6
4
  deps: ThorchainSwapperDeps;
@@ -9,9 +7,7 @@ declare type GetBtcThorTxInfoArgs = {
9
7
  sellAmount: string;
10
8
  slippageTolerance: string;
11
9
  destinationAddress: string;
12
- wallet: HDWallet;
13
- bip44Params: BIP44Params;
14
- accountType: UtxoAccountType;
10
+ xpub: string;
15
11
  tradeFee: string;
16
12
  };
17
13
  declare type GetBtcThorTxInfoReturn = Promise<{
@@ -5,7 +5,7 @@ const api_1 = require("../../../../../api");
5
5
  const getLimit_1 = require("../../getLimit/getLimit");
6
6
  const makeSwapMemo_1 = require("../../makeSwapMemo/makeSwapMemo");
7
7
  const thorService_1 = require("../../thorService");
8
- const getThorTxInfo = async ({ deps, sellAsset, buyAsset, sellAmount, slippageTolerance, destinationAddress, wallet, bip44Params, accountType, tradeFee, }) => {
8
+ const getThorTxInfo = async ({ deps, sellAsset, buyAsset, sellAmount, slippageTolerance, destinationAddress, xpub, tradeFee, }) => {
9
9
  try {
10
10
  const { data: inboundAddresses } = await thorService_1.thorService.get(`${deps.midgardUrl}/thorchain/inbound_addresses`);
11
11
  const sellAssetInboundAddresses = inboundAddresses.find((inbound) => inbound.chain === sellAsset.symbol.toUpperCase());
@@ -30,12 +30,10 @@ const getThorTxInfo = async ({ deps, sellAsset, buyAsset, sellAmount, slippageTo
30
30
  destinationAddress,
31
31
  limit,
32
32
  });
33
- const adapter = deps.adapterManager.get(sellAsset.chainId);
34
- const pubkey = await adapter.getPublicKey(wallet, bip44Params, accountType);
35
33
  return {
36
34
  opReturnData: memo,
37
35
  vault,
38
- pubkey: pubkey.xpub,
36
+ pubkey: xpub,
39
37
  };
40
38
  }
41
39
  catch (e) {
@@ -15,7 +15,6 @@ export declare const setupBuildTrade: () => {
15
15
  sellAmount: string;
16
16
  sendMax: boolean;
17
17
  sellAssetAccountNumber: number;
18
- wallet: HDWallet;
19
18
  receiveAddress: string;
20
19
  } & {
21
20
  chainId: import("../../../api").EvmSupportedChainIds;
@@ -27,7 +27,6 @@ const setupQuote = () => {
27
27
  sellAssetAccountNumber: 0,
28
28
  sendMax: false,
29
29
  receiveAddress: '0xc770eefad204b5180df6a14ee197d99d808ee52d',
30
- wallet: {},
31
30
  };
32
31
  return { quoteInput, tradeQuote, buyAsset, sellAsset };
33
32
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shapeshiftoss/swapper",
3
- "version": "9.16.2",
3
+ "version": "9.17.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",