Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
},
"dependencies": {
"@erc7730/sdk": "^0.1.3",
"@openscan/network-connectors": "1.3.2",
"@openscan/network-connectors": "1.4.0",
"@rainbow-me/rainbowkit": "^2.2.8",
"@react-native-async-storage/async-storage": "^1.24.0",
"@tanstack/react-query": "^5.90.21",
Expand Down
29 changes: 29 additions & 0 deletions src/config/networks.json
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,35 @@
}
]
},
{
"type": "evm",
"networkId": "eip155:43114",
"slug": "avax",
"name": "Avalanche C-Chain",
"shortName": "Avalanche",
"description": "EVM-compatible smart contract platform with high throughput",
"currency": "AVAX",
"color": "#E84142",
"isTestnet": false,
"logo": "assets/networks/43114.svg",
"links": [
{
"name": "Website",
"url": "https://www.avax.network",
"description": "Official Avalanche website"
},
{
"name": "Docs",
"url": "https://docs.avax.network",
"description": "Developer documentation"
},
{
"name": "Bridge",
"url": "https://core.app/bridge",
"description": "Bridge assets to Avalanche"
}
]
},
{
"type": "evm",
"networkId": "eip155:11155111",
Expand Down
5 changes: 3 additions & 2 deletions src/services/adapters/EVMAdapter/EVMAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import {

import { normalizeBlockNumber } from "../shared/normalizeBlockNumber";
import { mergeMetadata } from "../shared/mergeMetadata";
import type { EthereumClient, SupportedChainId } from "@openscan/network-connectors";
import type { EthereumClient } from "@openscan/network-connectors";
import type { AppChainId } from "../../../types";
import { getRethClient, NONCE_LOOKUP_CHAIN_ID } from "../../../config/rethProviders";
import { NonceLookupService } from "../../NonceLookupService";

Expand All @@ -22,7 +23,7 @@ import { NonceLookupService } from "../../NonceLookupService";
export class EVMAdapter extends NetworkAdapter {
private client: EthereumClient;

constructor(networkId: SupportedChainId | 11155111 | 97 | 31337, client: EthereumClient) {
constructor(networkId: AppChainId, client: EthereumClient) {
super(networkId);
this.client = client;

Expand Down
5 changes: 3 additions & 2 deletions src/services/adapters/NetworkAdapter.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { SupportedChainId, EthereumClient } from "@openscan/network-connectors";
import type { EthereumClient } from "@openscan/network-connectors";
import type {
AppChainId,
Block,
Transaction,
Address,
Expand Down Expand Up @@ -51,7 +52,7 @@ export abstract class NetworkAdapter {
isLocalHost: boolean;
protected txSearch: AddressTransactionSearch | null = null;

constructor(networkId: SupportedChainId | 31337 | 11155111 | 97) {
constructor(networkId: AppChainId) {
this.networkId = networkId;
this.isLocalHost = networkId === 31337;
}
Expand Down
7 changes: 5 additions & 2 deletions src/services/adapters/adaptersFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { ArbitrumAdapter } from "./ArbitrumAdapter/ArbitrumAdapter";
import { BitcoinAdapter } from "./BitcoinAdapter/BitcoinAdapter";
import type {
ArbitrumClient,
AvalancheClient,
AztecClient,
BaseClient,
BitcoinClient,
Expand All @@ -24,21 +25,23 @@ export class AdapterFactory {
* Create an EVM network adapter
*/
static createAdapter(
networkId: SupportedChainId | 11155111 | 97 | 31337,
networkId: SupportedChainId,
client:
| EthereumClient
| OptimismClient
| BNBClient
| PolygonClient
| BaseClient
| ArbitrumClient
| AvalancheClient
| AztecClient,
): NetworkAdapter {
switch (networkId) {
case 1:
case 11155111:
case 31337:
return new EVMAdapter(networkId, client as EthereumClient);
case 43114:
return new EVMAdapter(networkId, client as unknown as EthereumClient);
case 10:
return new OptimismAdapter(networkId, client as OptimismClient);
case 56:
Expand Down
9 changes: 8 additions & 1 deletion src/types/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { EthLog } from "@openscan/network-connectors";
import type { EthLog, SupportedChainId } from "@openscan/network-connectors";
import type React from "react";

// ==================== NETWORK TYPES ====================
Expand All @@ -8,6 +8,13 @@ import type React from "react";
*/
export type NetworkType = "evm" | "bitcoin";

/**
* All EVM chain IDs supported by the app.
* Maps directly to the connector library's SupportedChainId.
* When adding a new EVM network, add its chain ID to network-connectors first.
*/
export type AppChainId = SupportedChainId;

// ==================== CORE DOMAIN TYPES ====================

export interface NetworkStats {
Expand Down
Loading