Skip to content

Commit 8e47f6b

Browse files
committed
Small (breaking) compatibility changes and bump version to v23.0.0
1 parent fa887c5 commit 8e47f6b

File tree

3 files changed

+11
-10
lines changed

3 files changed

+11
-10
lines changed

index.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
export {
2-
default as chains,
2+
getChain,
3+
getChainById,
4+
getChainByName,
5+
allChains,
36
Chain,
47
ChainId,
58
ChainName,

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@revoke.cash/chains",
3-
"version": "22.0.0",
3+
"version": "23.0.0",
44
"description": "Helper module for getting EVM chains info.",
55
"author": "Revoke.cash",
66
"contributors": [

src/index.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,35 @@
11
import { Chain, Chains } from './types'
22
import { chains } from './chains'
3-
import { ChainId } from './enums'
43
export { NativeCurrency, Explorer, Parent } from './types'
54
export { ChainName, ChainId } from './enums'
6-
export { chains, Chain, Chains }
5+
export { Chain, Chains }
76

87
/**
98
* Get a chain by its `id`.
109
* @param id - The `id` of the chain
1110
* @returns The `Chain` object associated with the chain `id`
1211
*/
13-
const getById = (id: number): Chain | undefined => chains[id]
12+
export const getChainById = (id: number): Chain | undefined => chains[id]
1413

1514
/**
1615
* Get a chain by its `name`.
1716
* @param name - The `name` of the chain
1817
* @returns The `Chain` object associated with the chain `name`
1918
*/
20-
const getByName = (name: string): Chain | undefined =>
19+
export const getChainByName = (name: string): Chain | undefined =>
2120
Object.values(chains).find(chain => chain.name === name) || {}
2221

2322
/**
2423
* Get a chain by its `id` or by its `name`.
2524
* @param idOrName - The name or id of the chain
2625
* @returns The `Chain` object associated with the `id` or `name`
2726
*/
28-
const get = (idOrName: string | number): Chain | undefined =>
29-
typeof idOrName === 'number' ? getById(idOrName) : getByName(idOrName)
27+
export const getChain = (idOrName: string | number): Chain | undefined =>
28+
typeof idOrName === 'number' ? getChainById(idOrName) : getChainByName(idOrName)
3029

3130
/**
3231
* Gets the entire `chains` object
3332
* @returns An object containing all chains
3433
*/
35-
const all = (): Chains => chains
34+
export const allChains = (): Chains => chains
3635

37-
export default { getById, getByName, get, all }

0 commit comments

Comments
 (0)