@shapeshiftoss/caip 6.7.1 → 6.8.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/utils.d.ts CHANGED
@@ -1,11 +1,8 @@
1
1
  import { AccountId } from './accountId/accountId';
2
- import { AssetId } from './assetId/assetId';
3
2
  import { ChainId, ChainNamespace, ChainReference } from './chainId/chainId';
4
3
  export declare const parseAssetIdRegExp: RegExp;
5
- export declare const chainIdToAssetId: Record<ChainId, AssetId>;
6
4
  export declare const accountIdToChainId: (accountId: AccountId) => ChainId;
7
5
  export declare const accountIdToSpecifier: (accountId: AccountId) => string;
8
- export declare const getFeeAssetIdFromAssetId: (assetId: AssetId) => AssetId | undefined;
9
6
  export declare const isValidChainPartsPair: (chainNamespace: ChainNamespace, chainReference: ChainReference) => boolean;
10
7
  export declare const bitcoinAssetMap: {
11
8
  [x: string]: string;
package/dist/utils.js CHANGED
@@ -23,33 +23,15 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.osmosisAssetMap = exports.cosmosAssetMap = exports.litecoinAssetMap = exports.dogecoinAssetMap = exports.bitcoinAssetMap = exports.isValidChainPartsPair = exports.getFeeAssetIdFromAssetId = exports.accountIdToSpecifier = exports.accountIdToChainId = exports.chainIdToAssetId = exports.parseAssetIdRegExp = void 0;
26
+ exports.osmosisAssetMap = exports.cosmosAssetMap = exports.litecoinAssetMap = exports.dogecoinAssetMap = exports.bitcoinAssetMap = exports.isValidChainPartsPair = exports.accountIdToSpecifier = exports.accountIdToChainId = exports.parseAssetIdRegExp = void 0;
27
27
  const accountId_1 = require("./accountId/accountId");
28
- const assetId_1 = require("./assetId/assetId");
29
28
  const constants = __importStar(require("./constants"));
30
29
  // https://regex101.com/r/f0xGqP/2
31
30
  exports.parseAssetIdRegExp = /(?<chainNamespace>[-a-z\d]{3,8}):(?<chainReference>[-a-zA-Z\d]{1,32})\/(?<assetNamespace>[-a-z\d]{3,8}):(?<assetReference>[-a-zA-Z\d]+)/;
32
- // TODO(ryankk): this will be removed and replaced with something like `toAssetId(fromChainId(chainId))`
33
- // when `fromChainId` supports returning ChainNamespace and ChainReference.
34
- exports.chainIdToAssetId = {
35
- [constants.ethChainId]: constants.ethAssetId,
36
- [constants.btcChainId]: constants.btcAssetId,
37
- [constants.dogeChainId]: constants.dogeAssetId,
38
- [constants.cosmosChainId]: constants.cosmosAssetId,
39
- [constants.osmosisChainId]: constants.osmosisAssetId,
40
- [constants.avalancheChainId]: constants.avalancheAssetId
41
- };
42
31
  const accountIdToChainId = (accountId) => (0, accountId_1.fromAccountId)(accountId).chainId;
43
32
  exports.accountIdToChainId = accountIdToChainId;
44
33
  const accountIdToSpecifier = (accountId) => (0, accountId_1.fromAccountId)(accountId).account;
45
34
  exports.accountIdToSpecifier = accountIdToSpecifier;
46
- // We make the assumption here that the fee assetIds are in `chainIdToAssetId` for each
47
- // chain we support.
48
- const getFeeAssetIdFromAssetId = (assetId) => {
49
- const { chainId } = (0, assetId_1.fromAssetId)(assetId);
50
- return exports.chainIdToAssetId[chainId];
51
- };
52
- exports.getFeeAssetIdFromAssetId = getFeeAssetIdFromAssetId;
53
35
  const isValidChainPartsPair = (chainNamespace, chainReference) => { var _a; return ((_a = constants.VALID_CHAIN_IDS[chainNamespace]) === null || _a === void 0 ? void 0 : _a.includes(chainReference)) || false; };
54
36
  exports.isValidChainPartsPair = isValidChainPartsPair;
55
37
  exports.bitcoinAssetMap = { [constants.btcAssetId]: 'bitcoin' };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shapeshiftoss/caip",
3
- "version": "6.7.1",
3
+ "version": "6.8.0",
4
4
  "description": "CAIP Implementation",
5
5
  "homepage": "",
6
6
  "license": "MIT",