Skip to content

Commit

Permalink
add sepolia to rpc support, remove unused sequence.app info
Browse files Browse the repository at this point in the history
  • Loading branch information
samepant committed Jul 16, 2024
1 parent 1c1d36d commit b552480
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 29 deletions.
3 changes: 3 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ BASE_RPC_PASSWORD=
OPTIMISM_RPC_USERNAME=
OPTIMISM_RPC_PASSWORD=

SEPOLIA_RPC_USERNAME=
SEPOLIA_RPC_PASSWORD=

MORALIS_API_KEY=

SUBGRAPH_STUDIO_API_KEY=
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ Airlock is Gnosis Guild's proxy server that masks our api keys.
- Avalanche
- Base

#### Testnets

- Sepolia

## Current Proxies

- `api/v1/:chainId/rpc` - proxies requests to our hosted rpc nodes
Expand Down
14 changes: 5 additions & 9 deletions src/lib/chains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,16 @@ import {
base,
optimism,
Chain,
sepolia,
} from "viem/chains";
import { RPCNode, rpcNodes } from "./rpc-nodes";
import { PublicClient } from "viem";
import { SequenceIndexerServices } from "./sequence-indexer";

type ChainInfo = {
[key: number]: {
chain: Chain;
rpcNode: RPCNode;
client?: PublicClient;
sequenceURL: string;
blockHeight?: bigint;
};
};
Expand All @@ -26,36 +25,33 @@ export const chains: ChainInfo = {
1: {
chain: mainnet,
rpcNode: rpcNodes[1],
sequenceURL: SequenceIndexerServices[1],
},
42161: {
chain: arbitrum,
rpcNode: rpcNodes[42161],
sequenceURL: SequenceIndexerServices[42161],
},
43114: {
chain: avalanche,
rpcNode: rpcNodes[43114],
sequenceURL: SequenceIndexerServices[43114],
},
10: {
chain: optimism,
rpcNode: rpcNodes[10],
sequenceURL: SequenceIndexerServices[10],
},
137: {
chain: polygon,
rpcNode: rpcNodes[137],
sequenceURL: SequenceIndexerServices[137],
},
8453: {
chain: base,
rpcNode: rpcNodes[8453],
sequenceURL: SequenceIndexerServices[8453],
},
100: {
chain: gnosis,
rpcNode: rpcNodes[100],
sequenceURL: SequenceIndexerServices[100],
},
11155111: {
chain: sepolia,
rpcNode: rpcNodes[11155111],
},
};
6 changes: 6 additions & 0 deletions src/lib/rpc-nodes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,10 @@ export const rpcNodes: RPCNodes = {
password: process.env.GNOSIS_RPC_PASSWORD,
url: "https://nd-696-263-600.p2pify.com",
},
11155111: {
//sepolia
username: process.env.SEPOLIA_RPC_USERNAME,
password: process.env.SEPOLIA_RPC_PASSWORD,
url: "https://ethereum-sepolia.core.chainstack.com",
},
};
17 changes: 0 additions & 17 deletions src/lib/sequence-indexer.ts

This file was deleted.

1 change: 0 additions & 1 deletion src/lib/simple-hash.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
const simpleHash = (str: string) => {
console.log("simpleHash", str);
let hash = 0;
for (let i = 0; i < str.length; i++) {
hash = ((hash << 5) - hash + str.charCodeAt(i)) | 0;
Expand Down
3 changes: 1 addition & 2 deletions src/routes/v1.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { chains } from "@/lib/chains";
import { Router, Request, Response } from "express";
import { Router } from "express";
import { createProxyMiddleware } from "http-proxy-middleware";
import apicache from "apicache";
import simpleHash from "@/lib/simple-hash";
import { toHex } from "viem";

const chainRouter = Router();
Expand Down

0 comments on commit b552480

Please sign in to comment.