Skip to content

Commit

Permalink
add indexer
Browse files Browse the repository at this point in the history
  • Loading branch information
TiyoSheng committed Dec 6, 2023
1 parent 2edc6f1 commit 8cbd68e
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/client/.env
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
VITE_CHAIN_ID=31337
VITE_CHAIN_ID=33784
VITE_TEST_CHAIN_ID=31337
VITE_IS_OPEN=true
3 changes: 3 additions & 0 deletions packages/client/src/mud/getNetworkConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ export async function getNetworkConfig() {
throw new Error(`Chain ${chainId} not found`);
}

const indexerUrl = chain.indexerUrl;

/*
* Get the address of the World. If you want to use a
* different address than the one in worlds.json,
Expand Down Expand Up @@ -87,5 +89,6 @@ export async function getNetworkConfig() {
faucetServiceUrl: params.get("faucet") ?? chain.faucetUrl,
worldAddress,
initialBlockNumber,
indexerUrl,
};
}
1 change: 1 addition & 0 deletions packages/client/src/mud/setupNetwork.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ export async function setupNetwork() {
address: networkConfig.worldAddress as Hex,
publicClient,
startBlock: BigInt(networkConfig.initialBlockNumber),
indexerUrl: networkConfig.indexerUrl,
});

/*
Expand Down
41 changes: 40 additions & 1 deletion packages/client/src/mud/supportedChains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,48 @@
*/

import { MUDChain, latticeTestnet, mudFoundry } from "@latticexyz/common/chains";
import { sepolia, arbitrumGoerli } from 'viem/chains'

arbitrumGoerli.rpcUrls.default.http = ['https://arbitrum-goerli.infura.io/v3/5ca372516740427e97512d4dfefd9c47'];
arbitrumGoerli.rpcUrls.default.webSocket = [ 'wss://arbitrum-goerli.infura.io/ws/v3/5ca372516740427e97512d4dfefd9c47'];

const testnet = {
name: "Mississippi testnet",
id: 33784,
network: "mississippi-testnet",
nativeCurrency: { decimals: 18, name: "Ether", symbol: "ETH" },
rpcUrls: {
default: {
http: ["https://rpc1.0xmssp.xyz"],
webSocket: ["https://rpc1.0xmssp.xyz"],
},
public: {
http: ["https://rpc1.0xmssp.xyz"],
webSocket: ["https://rpc1.0xmssp.xyz"],
},
},
indexerUrl: "https://indexer.0xmssp.xyz/trpc",
}

const redstone = {
name: "Redstone testnet",
id: 17001,
network: "redstone-testnet",
nativeCurrency: { decimals: 18, name: "Ether", symbol: "ETH" },
rpcUrls: {
default: {
http: ["https://rpc.holesky.redstone.xyz"],
webSocket: ["https://rpc.holesky.redstone.xyz"],
},
public: {
http: ["https://rpc.holesky.redstone.xyz"],
webSocket: ["https://rpc.holesky.redstone.xyz"],
},
}
}

/*
* See https://mud.dev/tutorials/minimal/deploy#run-the-user-interface
* for instructions on how to add networks.
*/
export const supportedChains: MUDChain[] = [mudFoundry, latticeTestnet];
export const supportedChains: MUDChain[] = [mudFoundry, latticeTestnet, sepolia, arbitrumGoerli, testnet, redstone];
4 changes: 4 additions & 0 deletions packages/contracts/worlds.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{
"31337": {
"address": "0x97e55ad21ee5456964460c5465eac35861d2e797"
},
"33784": {
"address":"0xd5d9aad645671a285d1cadf8e68aef7d74a8a7d0",
"blockNumber": 91872
}
}

0 comments on commit 8cbd68e

Please sign in to comment.