Skip to content

Commit

Permalink
add network mapping and utility function for chain IDs (#696)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben-Rey authored Nov 4, 2024
1 parent afa381f commit 4e45a4a
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/utils/networks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,17 @@ export const CHAIN_ID = {
Buildnet: 77658366n,
}

export function getNetworkNameByChainId(
chainId: bigint
): NetworkName | undefined {
for (const [key, value] of Object.entries(CHAIN_ID)) {
if (value === chainId) {
return NetworkName[key as keyof typeof NetworkName]
}
}
return undefined
}

export type Network = {
name: NetworkName | string
chainId: bigint
Expand Down

2 comments on commit 4e45a4a

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage report for experimental massa-web3

St.❔
Category Percentage Covered / Total
🟑 Statements 64.59% 1169/1810
πŸ”΄ Branches 46.32% 195/421
πŸ”΄ Functions 47.54% 213/448
🟑 Lines 64.88% 1162/1791

Test suite run success

132 tests passing in 14 suites.

Report generated by πŸ§ͺjest coverage report action from 4e45a4a

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage report for experimental massa-web3

St.❔
Category Percentage Covered / Total
🟑 Statements 64.59% 1169/1810
πŸ”΄ Branches 46.32% 195/421
πŸ”΄ Functions 47.54% 213/448
🟑 Lines 64.88% 1162/1791

Test suite run success

132 tests passing in 14 suites.

Report generated by πŸ§ͺjest coverage report action from 4e45a4a

Please sign in to comment.