@shapeshiftoss/caip 6.2.1 → 6.4.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.
@@ -5,4 +5,5 @@ export * from './osmosis';
5
5
  export * from './gem';
6
6
  export * from './banxa';
7
7
  export * from './coinbase';
8
+ export * from './junopay';
8
9
  export * from './thortrading';
@@ -21,4 +21,5 @@ __exportStar(require("./osmosis"), exports);
21
21
  __exportStar(require("./gem"), exports);
22
22
  __exportStar(require("./banxa"), exports);
23
23
  __exportStar(require("./coinbase"), exports);
24
+ __exportStar(require("./junopay"), exports);
24
25
  __exportStar(require("./thortrading"), exports);
@@ -0,0 +1,7 @@
1
+ import { AssetId } from '../../assetId/assetId';
2
+ export declare const junoPayTickerToAssetId: (id: string) => AssetId | undefined;
3
+ export declare const assetIdToJunoPayTicker: (assetId: string) => string | undefined;
4
+ export declare const getSupportedJunoPayAssets: () => {
5
+ assetId: string;
6
+ ticker: string;
7
+ }[];
@@ -0,0 +1,52 @@
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
+ exports.getSupportedJunoPayAssets = exports.assetIdToJunoPayTicker = exports.junoPayTickerToAssetId = void 0;
7
+ const entries_1 = __importDefault(require("lodash/entries"));
8
+ const invert_1 = __importDefault(require("lodash/invert"));
9
+ const toLower_1 = __importDefault(require("lodash/toLower"));
10
+ const constants_1 = require("../../constants");
11
+ // source data https://docs.juno.finance/developers/reference/onjuno-pay/onjuno-pay-integration-guide
12
+ const assetIdToJunoPayTickerMap = {
13
+ [constants_1.avalancheAssetId]: 'avax',
14
+ [constants_1.btcAssetId]: 'btc',
15
+ [constants_1.cosmosAssetId]: 'atom',
16
+ [constants_1.ethAssetId]: 'eth',
17
+ 'eip155:1/erc20:0x7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9': 'aave',
18
+ 'eip155:1/erc20:0xbb0e17ef65f82ab018d8edd776e8dd940327b28b': 'axs',
19
+ 'eip155:1/erc20:0x4d224452801aced8b2f0aebe155379bb5d594381': 'ape',
20
+ 'eip155:1/erc20:0x0d8775f648430679a709e98d2b0cb6250d2887ef': 'bat',
21
+ 'eip155:1/erc20:0x4fabb145d64652a948d72533023f6e7a623c7c53': 'busd',
22
+ 'eip155:1/erc20:0x3506424f91fd33084466f402d5d97f05f8e3b4af': 'chz',
23
+ 'eip155:1/erc20:0x41e5560054824ea6b0732e656e3ad64e20e94e45': 'cvc',
24
+ 'eip155:1/erc20:0xc00e94cb662c3520282e6f5717214004a7f26888': 'comp',
25
+ 'eip155:1/erc20:0x6b175474e89094c44da98b954eedeac495271d0f': 'dai',
26
+ 'eip155:1/erc20:0xf629cbd94d3791c9250152bd8dfbdf380e2a3b9c': 'enj',
27
+ 'eip155:1/erc20:0x4e15361fd6b4bb609fa63c81a2be19d873717870': 'ftm',
28
+ 'eip155:1/erc20:0x165440036ce972c5f8ebef667086707e48b2623e': 'grt',
29
+ 'eip155:1/erc20:0xf57e7e7c23978c3caec3c3548e3d615c346e79ff': 'imx',
30
+ 'eip155:1/erc20:0x514910771af9ca656af840dff83e8264ecf986ca': 'link',
31
+ 'eip155:1/erc20:0x9f8f72aa9304c8b593d555f12ef6589cc3a579a2': 'mkr',
32
+ 'eip155:1/erc20:0x0f5d2fb29fb7d3cfee444a200298f468908cc942': 'mana',
33
+ 'eip155:1/erc20:0xd26114cd6ee289accf82350c8d8487fedb8a0c07': 'omg',
34
+ 'eip155:1/erc20:0x57ab1ec28d129707052df4df418d58a2d46d5f51': 'susd',
35
+ 'eip155:1/erc20:0x6b3595068778dd592e39a122f4f5a5cf09c90fe2': 'sushi',
36
+ 'eip155:1/erc20:0xc011a73ee8576fb46f5e1c5751ca3b9fe0af2a6f': 'snx',
37
+ 'eip155:1/erc20:0x1f9840a85d5af5bf1d1762f925bdaddc4201f984': 'uni',
38
+ 'eip155:1/erc20:0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48': 'usdc',
39
+ 'eip155:1/erc20:0x8e870d67f660d95d5be530380d0ec0bd388289e1': 'usdp',
40
+ 'eip155:1/erc20:0xdac17f958d2ee523a2206206994597c13d831ec7': 'usdt',
41
+ 'eip155:1/erc20:0x2260fac5e5542a773aa44fbcfedf7c193bc2c599': 'wbtc'
42
+ };
43
+ const junoPayTickerToAssetIdMap = (0, invert_1.default)(assetIdToJunoPayTickerMap);
44
+ const junoPayTickerToAssetId = (id) => junoPayTickerToAssetIdMap[id];
45
+ exports.junoPayTickerToAssetId = junoPayTickerToAssetId;
46
+ const assetIdToJunoPayTicker = (assetId) => assetIdToJunoPayTickerMap[(0, toLower_1.default)(assetId)];
47
+ exports.assetIdToJunoPayTicker = assetIdToJunoPayTicker;
48
+ const getSupportedJunoPayAssets = () => (0, entries_1.default)(assetIdToJunoPayTickerMap).map(([assetId, ticker]) => ({
49
+ assetId,
50
+ ticker
51
+ }));
52
+ exports.getSupportedJunoPayAssets = getSupportedJunoPayAssets;
package/dist/utils.js CHANGED
@@ -12,7 +12,8 @@ exports.chainIdToAssetId = {
12
12
  [constants_1.ethChainId]: constants_1.ethAssetId,
13
13
  [constants_1.btcChainId]: constants_1.btcAssetId,
14
14
  [constants_1.cosmosChainId]: constants_1.cosmosAssetId,
15
- [constants_1.osmosisChainId]: constants_1.osmosisAssetId
15
+ [constants_1.osmosisChainId]: constants_1.osmosisAssetId,
16
+ [constants_1.avalancheChainId]: constants_1.avalancheAssetId
16
17
  };
17
18
  const accountIdToChainId = (accountId) => (0, accountId_1.fromAccountId)(accountId).chainId;
18
19
  exports.accountIdToChainId = accountIdToChainId;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shapeshiftoss/caip",
3
- "version": "6.2.1",
3
+ "version": "6.4.0",
4
4
  "description": "CAIP Implementation",
5
5
  "homepage": "",
6
6
  "license": "MIT",
@@ -31,10 +31,10 @@
31
31
  "type-check": "tsc --project ./tsconfig.build.json --noEmit"
32
32
  },
33
33
  "peerDependencies": {
34
- "@shapeshiftoss/types": "^6.2.0"
34
+ "@shapeshiftoss/types": "^7.0.0"
35
35
  },
36
36
  "devDependencies": {
37
- "@shapeshiftoss/types": "^6.2.0",
37
+ "@shapeshiftoss/types": "^7.0.0",
38
38
  "@yfi/sdk": "^1.0.30",
39
39
  "axios": "^0.26.1",
40
40
  "ts-node": "^10.7.0"