@shapeshiftoss/swapper 8.6.1 → 8.7.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.
@@ -6,3 +6,4 @@ export declare const WBTC: Asset;
6
6
  export declare const ETH: Asset;
7
7
  export declare const UNSUPPORTED: Asset;
8
8
  export declare const USDC: Asset;
9
+ export declare const AVAX: Asset;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.USDC = exports.UNSUPPORTED = exports.ETH = exports.WBTC = exports.FOX = exports.WETH = exports.BTC = void 0;
3
+ exports.AVAX = exports.USDC = exports.UNSUPPORTED = exports.ETH = exports.WBTC = exports.FOX = exports.WETH = exports.BTC = void 0;
4
+ const caip_1 = require("@shapeshiftoss/caip");
4
5
  exports.BTC = {
5
6
  assetId: 'bip122:000000000019d6689c085ae165831e93/slip44:0',
6
7
  chainId: 'bip122:000000000019d6689c085ae165831e93',
@@ -15,7 +16,7 @@ exports.BTC = {
15
16
  };
16
17
  exports.WETH = {
17
18
  assetId: 'eip155:1/erc20:0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
18
- chainId: 'eip155:1',
19
+ chainId: caip_1.ethChainId,
19
20
  name: 'WETH',
20
21
  precision: 18,
21
22
  color: '#FFFFFF',
@@ -27,7 +28,7 @@ exports.WETH = {
27
28
  };
28
29
  exports.FOX = {
29
30
  assetId: 'eip155:1/erc20:0xc770eefad204b5180df6a14ee197d99d808ee52d',
30
- chainId: 'eip155:1',
31
+ chainId: caip_1.ethChainId,
31
32
  name: 'FOX',
32
33
  precision: 18,
33
34
  color: '#FFFFFF',
@@ -39,7 +40,7 @@ exports.FOX = {
39
40
  };
40
41
  exports.WBTC = {
41
42
  assetId: 'eip155:1/erc20:0x2260fac5e5542a773aa44fbcfedf7c193bc2c599',
42
- chainId: 'eip155:1',
43
+ chainId: caip_1.ethChainId,
43
44
  color: '#FFFFFF',
44
45
  explorer: 'https://etherscan.io',
45
46
  explorerAddressLink: 'https://etherscan.io/address/',
@@ -50,8 +51,8 @@ exports.WBTC = {
50
51
  symbol: 'WBTC'
51
52
  };
52
53
  exports.ETH = {
53
- assetId: 'eip155:1/slip44:60',
54
- chainId: 'eip155:1',
54
+ assetId: caip_1.ethAssetId,
55
+ chainId: caip_1.ethChainId,
55
56
  symbol: 'ETH',
56
57
  name: 'Ethereum',
57
58
  precision: 18,
@@ -63,7 +64,7 @@ exports.ETH = {
63
64
  };
64
65
  exports.UNSUPPORTED = {
65
66
  assetId: 'eip155:1/slip44:420',
66
- chainId: 'eip155:1',
67
+ chainId: caip_1.ethChainId,
67
68
  symbol: 'ETH',
68
69
  name: 'Ethereum',
69
70
  precision: 18,
@@ -75,7 +76,7 @@ exports.UNSUPPORTED = {
75
76
  };
76
77
  exports.USDC = {
77
78
  assetId: 'eip155:1/erc20:0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
78
- chainId: 'eip155:1',
79
+ chainId: caip_1.ethChainId,
79
80
  symbol: 'USDC',
80
81
  name: 'USD Coin',
81
82
  precision: 6,
@@ -85,3 +86,15 @@ exports.USDC = {
85
86
  explorerAddressLink: 'https://etherscan.io/address/',
86
87
  explorerTxLink: 'https://etherscan.io/tx/'
87
88
  };
89
+ exports.AVAX = {
90
+ assetId: caip_1.avalancheAssetId,
91
+ chainId: caip_1.avalancheChainId,
92
+ name: 'Avalanche',
93
+ symbol: 'AVAX',
94
+ precision: 18,
95
+ color: '#FFFFFF',
96
+ icon: 'https://rawcdn.githack.com/trustwallet/assets/32e51d582a890b3dd3135fe3ee7c20c2fd699a6d/blockchains/avalanchec/info/logo.png',
97
+ explorer: 'https://snowtrace.io',
98
+ explorerAddressLink: 'https://snowtrace.io/address/',
99
+ explorerTxLink: 'https://snowtrace.io/tx/'
100
+ };
@@ -1,13 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getZrxMinMax = void 0;
4
+ const chain_adapters_1 = require("@shapeshiftoss/chain-adapters");
4
5
  const api_1 = require("../../../api");
5
6
  const bignumber_1 = require("../../utils/bignumber");
6
7
  const constants_1 = require("../utils/constants");
7
8
  const helpers_1 = require("../utils/helpers/helpers");
8
9
  const getZrxMinMax = async (sellAsset, buyAsset) => {
9
10
  try {
10
- if (sellAsset.chainId !== 'eip155:1' || buyAsset.chainId !== 'eip155:1') {
11
+ if (!((0, chain_adapters_1.isEvmChainId)(sellAsset.chainId) &&
12
+ (0, chain_adapters_1.isEvmChainId)(buyAsset.chainId) &&
13
+ buyAsset.chainId === sellAsset.chainId)) {
11
14
  throw new api_1.SwapError('[getZrxMinMax]', { code: api_1.SwapErrorTypes.UNSUPPORTED_PAIR });
12
15
  }
13
16
  const usdRate = await (0, helpers_1.getUsdRate)({ ...sellAsset });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shapeshiftoss/swapper",
3
- "version": "8.6.1",
3
+ "version": "8.7.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",