Skip to content

Commit 18bf27e

Browse files
authored
feat: add linea, camino and scroll support (#132)
* feat: add linea, camino and scroll support * fix: test * fix: add missing chain support
1 parent 6878781 commit 18bf27e

File tree

4 files changed

+45
-9
lines changed

4 files changed

+45
-9
lines changed

packages/sdk/README.md

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,20 @@ yarn add @monerium/sdk
7474

7575
### Environments - Networks
7676

77-
| Environment | Chain | Network |
78-
| ----------- | -------- | ------- |
79-
| sandbox | ethereum | sepolia |
80-
| | polygon | mumbai |
81-
| | gnosis | chiado |
82-
| production | ethereum | mainnet |
83-
| | polygon | mainnet |
84-
| | gnosis | mainnet |
77+
| Environment | Chain | Name |
78+
| ----------- | -------- | -------- |
79+
| sandbox | ethereum | sepolia |
80+
| | polygon | mumbai |
81+
| | gnosis | chiado |
82+
| | linea | sepolia |
83+
| | scroll | sepolia |
84+
| | camino | columbus |
85+
| production | ethereum | mainnet |
86+
| | polygon | mainnet |
87+
| | gnosis | mainnet |
88+
| | linea | mainnet |
89+
| | scroll | mainnet |
90+
| | camino | mainnet |
8591

8692
## Usage Examples
8793

packages/sdk/src/types.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ export type SandboxChain =
1414
| 'amoy'
1515
| 'arbitrumsepolia'
1616
| 'lineasepolia'
17+
| 'scrollsepolia'
18+
| 'columbus'
1719
| 'grand';
1820

1921
export type ProductionChain =
@@ -22,6 +24,8 @@ export type ProductionChain =
2224
| 'polygon'
2325
| 'arbitrum'
2426
| 'linea'
27+
| 'scroll'
28+
| 'camino'
2529
| 'noble';
2630

2731
export type Chain = string | ProductionChain | SandboxChain;
@@ -32,12 +36,16 @@ export type EvmChainId =
3236
| 11155111 // ethereum sepolia
3337
| 100 // gnosis
3438
| 10200 // gnosis chiado
39+
| 500 // camino
40+
| 501 // camino columbus
3541
| 137 // polygon
3642
| 80002 // polygon amoy
3743
| 42161 // arbitrum
3844
| 421614 // arbitrum sepolia
3945
| 59141 // linea sepolia
40-
| 59144; // linea
46+
| 59144 // linea
47+
| 534352 // scroll
48+
| 534351; // scroll sepolia
4149

4250
export type ChainId = EvmChainId | CosmosChainId;
4351

packages/sdk/src/utils.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ const isValidEvmName = (chain: string) => {
7272
case 'arbitrumsepolia':
7373
case 'linea':
7474
case 'lineasepolia':
75+
case 'scroll':
76+
case 'scrollsepolia':
77+
case 'camino':
78+
case 'columbus':
7579
return true;
7680
default:
7781
return false;
@@ -243,6 +247,14 @@ export const getChain = (chainId: number): Chain => {
243247
return 'linea';
244248
case 59141:
245249
return 'lineasepolia';
250+
case 534352:
251+
return 'scroll';
252+
case 534351:
253+
return 'scrollsepolia';
254+
case 501:
255+
return 'columbus';
256+
case 500:
257+
return 'camino';
246258
default:
247259
throw new Error(`Chain not supported: ${chainId}`);
248260
}
@@ -287,6 +299,12 @@ const chainNameBackwardsCompatibility = (
287299
return 'chiado';
288300
case 'arbitrum':
289301
return 'arbitrumsepolia';
302+
case 'linea':
303+
return 'lineasepolia';
304+
case 'scroll':
305+
return 'scrollsepolia';
306+
case 'camino':
307+
return 'columbus';
290308
case 'noble':
291309
return 'grand';
292310
default:

packages/sdk/test/utils.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,10 @@ describe('parseChain', () => {
249249
it('chainIds to should be parsed to monerium chain identifier', () => {
250250
expect(parseChain(1)).toBe('ethereum');
251251
expect(parseChain(11155111)).toBe('sepolia');
252+
expect(parseChain(59144)).toBe('linea');
253+
expect(parseChain(534352)).toBe('scroll');
254+
expect(parseChain(501)).toBe('columbus');
255+
expect(parseChain(500)).toBe('camino');
252256
expect(parseChain(137)).toBe('polygon');
253257
expect(parseChain(80002)).toBe('amoy');
254258
expect(parseChain('ethereum')).toBe('ethereum');

0 commit comments

Comments
 (0)