@revoke.cash/chains 22.0.0 → 23.0.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/index.d.ts CHANGED
@@ -1 +1 @@
1
- export { default as chains, Chain, ChainId, ChainName, NativeCurrency, Explorer, Parent } from './src';
1
+ export { getChain, getChainById, getChainByName, allChains, Chain, ChainId, ChainName, NativeCurrency, Explorer, Parent } from './src';
package/dist/index.js CHANGED
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.ChainName = exports.ChainId = exports.chains = void 0;
3
+ exports.ChainName = exports.ChainId = exports.allChains = exports.getChainByName = exports.getChainById = exports.getChain = void 0;
7
4
  var src_1 = require("./src");
8
- Object.defineProperty(exports, "chains", { enumerable: true, get: function () { return __importDefault(src_1).default; } });
5
+ Object.defineProperty(exports, "getChain", { enumerable: true, get: function () { return src_1.getChain; } });
6
+ Object.defineProperty(exports, "getChainById", { enumerable: true, get: function () { return src_1.getChainById; } });
7
+ Object.defineProperty(exports, "getChainByName", { enumerable: true, get: function () { return src_1.getChainByName; } });
8
+ Object.defineProperty(exports, "allChains", { enumerable: true, get: function () { return src_1.allChains; } });
9
9
  Object.defineProperty(exports, "ChainId", { enumerable: true, get: function () { return src_1.ChainId; } });
10
10
  Object.defineProperty(exports, "ChainName", { enumerable: true, get: function () { return src_1.ChainName; } });
@@ -1,12 +1,27 @@
1
1
  import { Chain, Chains } from './types';
2
- import { chains } from './chains';
3
2
  export { NativeCurrency, Explorer, Parent } from './types';
4
3
  export { ChainName, ChainId } from './enums';
5
- export { chains, Chain, Chains };
6
- declare const _default: {
7
- getById: (id: number) => Chain | undefined;
8
- getByName: (name: string) => Chain | undefined;
9
- get: (idOrName: string | number) => Chain | undefined;
10
- all: () => Chains;
11
- };
12
- export default _default;
4
+ export { Chain, Chains };
5
+ /**
6
+ * Get a chain by its `id`.
7
+ * @param id - The `id` of the chain
8
+ * @returns The `Chain` object associated with the chain `id`
9
+ */
10
+ export declare const getChainById: (id: number) => Chain | undefined;
11
+ /**
12
+ * Get a chain by its `name`.
13
+ * @param name - The `name` of the chain
14
+ * @returns The `Chain` object associated with the chain `name`
15
+ */
16
+ export declare const getChainByName: (name: string) => Chain | undefined;
17
+ /**
18
+ * Get a chain by its `id` or by its `name`.
19
+ * @param idOrName - The name or id of the chain
20
+ * @returns The `Chain` object associated with the `id` or `name`
21
+ */
22
+ export declare const getChain: (idOrName: string | number) => Chain | undefined;
23
+ /**
24
+ * Gets the entire `chains` object
25
+ * @returns An object containing all chains
26
+ */
27
+ export declare const allChains: () => Chains;
package/dist/src/index.js CHANGED
@@ -1,8 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.chains = exports.ChainId = exports.ChainName = void 0;
3
+ exports.allChains = exports.getChain = exports.getChainByName = exports.getChainById = exports.ChainId = exports.ChainName = void 0;
4
4
  var chains_1 = require("./chains");
5
- Object.defineProperty(exports, "chains", { enumerable: true, get: function () { return chains_1.chains; } });
6
5
  var enums_1 = require("./enums");
7
6
  Object.defineProperty(exports, "ChainName", { enumerable: true, get: function () { return enums_1.ChainName; } });
8
7
  Object.defineProperty(exports, "ChainId", { enumerable: true, get: function () { return enums_1.ChainId; } });
@@ -11,26 +10,29 @@ Object.defineProperty(exports, "ChainId", { enumerable: true, get: function () {
11
10
  * @param id - The `id` of the chain
12
11
  * @returns The `Chain` object associated with the chain `id`
13
12
  */
14
- var getById = function (id) { return chains_1.chains[id]; };
13
+ var getChainById = function (id) { return chains_1.chains[id]; };
14
+ exports.getChainById = getChainById;
15
15
  /**
16
16
  * Get a chain by its `name`.
17
17
  * @param name - The `name` of the chain
18
18
  * @returns The `Chain` object associated with the chain `name`
19
19
  */
20
- var getByName = function (name) {
20
+ var getChainByName = function (name) {
21
21
  return Object.values(chains_1.chains).find(function (chain) { return chain.name === name; }) || {};
22
22
  };
23
+ exports.getChainByName = getChainByName;
23
24
  /**
24
25
  * Get a chain by its `id` or by its `name`.
25
26
  * @param idOrName - The name or id of the chain
26
27
  * @returns The `Chain` object associated with the `id` or `name`
27
28
  */
28
- var get = function (idOrName) {
29
- return typeof idOrName === 'number' ? getById(idOrName) : getByName(idOrName);
29
+ var getChain = function (idOrName) {
30
+ return typeof idOrName === 'number' ? exports.getChainById(idOrName) : exports.getChainByName(idOrName);
30
31
  };
32
+ exports.getChain = getChain;
31
33
  /**
32
34
  * Gets the entire `chains` object
33
35
  * @returns An object containing all chains
34
36
  */
35
- var all = function () { return chains_1.chains; };
36
- exports.default = { getById: getById, getByName: getByName, get: get, all: all };
37
+ var allChains = function () { return chains_1.chains; };
38
+ exports.allChains = allChains;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@revoke.cash/chains",
3
- "version": "22.0.0",
3
+ "version": "23.0.0",
4
4
  "description": "Helper module for getting EVM chains info.",
5
5
  "author": "Revoke.cash",
6
6
  "contributors": [