@shapeshiftoss/swapper 5.1.5 → 5.2.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
@@ -122,6 +122,8 @@ export declare enum SwapErrorTypes {
122
122
  VALIDATION_FAILED = "VALIDATION_FAILED"
123
123
  }
124
124
  export interface Swapper {
125
+ /** perform any necessary async initialization */
126
+ initialize(): Promise<void>;
125
127
  /** Returns the swapper type */
126
128
  getType(): SwapperType;
127
129
  /**
@@ -7,6 +7,7 @@ import { BuyAssetBySellIdInput, Swapper, Trade, TradeQuote } from '../../api';
7
7
  */
8
8
  export declare class TestSwapper implements Swapper {
9
9
  supportAssets: string[];
10
+ initialize(): Promise<void>;
10
11
  getType(): SwapperType;
11
12
  constructor();
12
13
  getUsdRate(input: Pick<Asset, 'symbol' | 'assetId'>): Promise<string>;
@@ -14,6 +14,9 @@ class TestSwapper {
14
14
  'eip155:1/erc20:0xc770eefad204b5180df6a14ee197d99d808ee52d'
15
15
  ];
16
16
  }
17
+ // noop for test
18
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
19
+ async initialize() { }
17
20
  getType() {
18
21
  return types_1.SwapperType.Test;
19
22
  }
@@ -3,6 +3,7 @@ import { ApprovalNeededOutput, Asset, ExecQuoteOutput, GetMinMaxInput, MinMaxOut
3
3
  import { Swapper, Trade, TradeQuote } from '../../api';
4
4
  export declare class ThorchainSwapper implements Swapper {
5
5
  getType(): SwapperType;
6
+ initialize(): Promise<void>;
6
7
  getUsdRate(input: Pick<Asset, 'symbol' | 'assetId'>): Promise<string>;
7
8
  getMinMax(input: GetMinMaxInput): Promise<MinMaxOutput>;
8
9
  approvalNeeded(): Promise<ApprovalNeededOutput>;
@@ -6,6 +6,9 @@ class ThorchainSwapper {
6
6
  getType() {
7
7
  return types_1.SwapperType.Thorchain;
8
8
  }
9
+ // TODO populate supported assets from midgard
10
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
11
+ async initialize() { }
9
12
  getUsdRate(input) {
10
13
  console.info(input);
11
14
  throw new Error('ThorchainSwapper: getUsdRate unimplemented');
@@ -11,6 +11,7 @@ export declare class ZrxSwapper implements Swapper {
11
11
  static swapperName: string;
12
12
  deps: ZrxSwapperDeps;
13
13
  constructor(deps: ZrxSwapperDeps);
14
+ initialize(): Promise<void>;
14
15
  getType(): SwapperType;
15
16
  buildTrade(args: BuildTradeInput): Promise<ZrxTrade<SupportedChainIds>>;
16
17
  getTradeQuote(input: GetTradeQuoteInput): Promise<TradeQuote<SupportedChainIds>>;
@@ -14,6 +14,9 @@ class ZrxSwapper {
14
14
  constructor(deps) {
15
15
  this.deps = deps;
16
16
  }
17
+ // noop for zrx
18
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
19
+ async initialize() { }
17
20
  getType() {
18
21
  return types_1.SwapperType.Zrx;
19
22
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shapeshiftoss/swapper",
3
- "version": "5.1.5",
3
+ "version": "5.2.0",
4
4
  "description": "TODO: description",
5
5
  "repository": "https://github.com/shapeshift/lib",
6
6
  "license": "MIT",
@@ -30,19 +30,19 @@
30
30
  "web3": "^1.6.1"
31
31
  },
32
32
  "peerDependencies": {
33
- "@shapeshiftoss/asset-service": "^3.0.0",
33
+ "@shapeshiftoss/asset-service": "^4.2.4",
34
34
  "@shapeshiftoss/caip": "^5.0.0",
35
- "@shapeshiftoss/chain-adapters": "^4.0.0",
35
+ "@shapeshiftoss/chain-adapters": "^4.3.3",
36
36
  "@shapeshiftoss/hdwallet-core": "1.20.0",
37
- "@shapeshiftoss/types": "^4.0.0",
37
+ "@shapeshiftoss/types": "^4.3.1",
38
38
  "@shapeshiftoss/errors": "^1.1.0"
39
39
  },
40
40
  "devDependencies": {
41
- "@shapeshiftoss/asset-service": "^3.0.0",
41
+ "@shapeshiftoss/asset-service": "^4.2.4",
42
42
  "@shapeshiftoss/caip": "^5.0.0",
43
- "@shapeshiftoss/chain-adapters": "^4.0.0",
43
+ "@shapeshiftoss/chain-adapters": "^4.3.3",
44
44
  "@shapeshiftoss/hdwallet-core": "^1.20.0",
45
- "@shapeshiftoss/types": "^4.1.0",
45
+ "@shapeshiftoss/types": "^4.3.1",
46
46
  "@shapeshiftoss/errors": "^1.1.0",
47
47
  "@types/readline-sync": "^1.4.4",
48
48
  "readline-sync": "^1.4.10",