@shapeshiftoss/swapper 7.5.1 → 7.6.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
@@ -1,6 +1,6 @@
1
1
  import { AssetId, ChainId } from '@shapeshiftoss/caip';
2
2
  import { BTCSignTx, ETHSignTx, HDWallet } from '@shapeshiftoss/hdwallet-core';
3
- import { Asset, ChainSpecific, KnownChainIds } from '@shapeshiftoss/types';
3
+ import { Asset, BIP44Params, ChainSpecific, KnownChainIds, UtxoAccountType } from '@shapeshiftoss/types';
4
4
  export declare const SwapError: {
5
5
  new <V extends {
6
6
  cause?: unknown;
@@ -58,8 +58,17 @@ export declare type CommonTradeInput = {
58
58
  sellAssetAccountNumber: number;
59
59
  wallet?: HDWallet;
60
60
  };
61
- export declare type GetTradeQuoteInput = CommonTradeInput;
62
- export declare type BuildTradeInput = CommonTradeInput & {
61
+ export declare type GetEthTradeQuoteInput = CommonTradeInput & {
62
+ chainId: 'eip155:1';
63
+ };
64
+ export declare type GetBtcTradeQuoteInput = CommonTradeInput & {
65
+ chainId: 'bip122:000000000019d6689c085ae165831e93';
66
+ accountType: UtxoAccountType;
67
+ bip44Params: BIP44Params;
68
+ wallet: HDWallet;
69
+ };
70
+ export declare type GetTradeQuoteInput = GetEthTradeQuoteInput | GetBtcTradeQuoteInput;
71
+ export declare type BuildTradeInput = GetTradeQuoteInput & {
63
72
  buyAssetAccountNumber: number;
64
73
  slippage?: string;
65
74
  wallet: HDWallet;
@@ -109,11 +109,11 @@ const main = async () => {
109
109
  let quote;
110
110
  try {
111
111
  quote = await swapper.getTradeQuote({
112
+ chainId: 'eip155:1',
112
113
  sellAsset,
113
114
  buyAsset,
114
115
  sellAmount: sellAmountBase,
115
116
  sellAssetAccountNumber: 0,
116
- wallet,
117
117
  sendMax: false
118
118
  });
119
119
  }
@@ -128,6 +128,7 @@ const main = async () => {
128
128
  const answer = readline_sync_1.default.question(`Swap ${sellAmount} ${sellAsset.symbol} for ${buyAmount} ${buyAsset.symbol} on ${swapper.getType()}? (y/n): `);
129
129
  if (answer === 'y') {
130
130
  const trade = await swapper.buildTrade({
131
+ chainId: 'eip155:1',
131
132
  wallet,
132
133
  buyAsset,
133
134
  sendMax: false,
@@ -1,7 +1,7 @@
1
1
  import { Asset } from '@shapeshiftoss/types';
2
2
  import { TradeQuote } from '../../../api';
3
3
  export declare const setupQuote: () => {
4
- quoteInput: import("../../../api").CommonTradeInput;
4
+ quoteInput: import("../../../api").GetEthTradeQuoteInput;
5
5
  tradeQuote: TradeQuote<"eip155:1">;
6
6
  buyAsset: Asset;
7
7
  sellAsset: Asset;
@@ -19,6 +19,7 @@ const setupQuote = () => {
19
19
  sources: []
20
20
  };
21
21
  const quoteInput = {
22
+ chainId: 'eip155:1',
22
23
  sellAmount: '1000000000000000000',
23
24
  sellAsset,
24
25
  buyAsset,
@@ -1,3 +1,4 @@
1
+ import { HDWallet } from '@shapeshiftoss/hdwallet-core';
1
2
  import { Asset } from '@shapeshiftoss/types';
2
3
  import { ZrxQuoteResponse } from '../../types';
3
4
  export declare const setupZrxTradeQuoteResponse: () => {
@@ -6,17 +7,12 @@ export declare const setupZrxTradeQuoteResponse: () => {
6
7
  sellAsset: Asset;
7
8
  };
8
9
  export declare const setupBuildTrade: () => {
9
- buildTradeInput: {
10
- sellAmount: string;
11
- allowanceTarget: string;
12
- price: string;
13
- to: string;
14
- buyAmount: string;
15
- buyAsset: Asset;
16
- sendMax: boolean;
17
- sellAssetAccountNumber: number;
10
+ buildTradeInput: import("../../../../api").CommonTradeInput & {
11
+ chainId: "eip155:1";
12
+ } & {
18
13
  buyAssetAccountNumber: number;
19
- sellAsset: Asset;
14
+ slippage?: string | undefined;
15
+ wallet: HDWallet;
20
16
  };
21
17
  buyAsset: Asset;
22
18
  sellAsset: Asset;
@@ -23,16 +23,14 @@ const setupBuildTrade = () => {
23
23
  const sellAsset = { ...assets_1.FOX };
24
24
  const buyAsset = { ...assets_1.WETH };
25
25
  const buildTradeInput = {
26
+ chainId: 'eip155:1',
26
27
  sellAmount: '1000000000000000000',
27
- allowanceTarget: 'allowanceTargetAddress',
28
- price: '1',
29
- to: '0x123',
30
- buyAmount: '',
31
28
  buyAsset,
32
29
  sendMax: false,
33
30
  sellAssetAccountNumber: 0,
34
31
  buyAssetAccountNumber: 0,
35
- sellAsset
32
+ sellAsset,
33
+ wallet: {}
36
34
  };
37
35
  return { buildTradeInput, buyAsset, sellAsset };
38
36
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shapeshiftoss/swapper",
3
- "version": "7.5.1",
3
+ "version": "7.6.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",