Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add/update for supported networks #50

Merged
merged 1 commit into from
Mar 19, 2024
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
62 changes: 0 additions & 62 deletions dist/Client/customChains.d.ts
Original file line number Diff line number Diff line change
@@ -1,62 +0,0 @@
export declare const pgn: {
readonly id: 424;
readonly name: "Public Goods Network";
readonly network: "pgn";
readonly nativeCurrency: {
readonly decimals: 18;
readonly name: "ETH";
readonly symbol: "ETH";
};
readonly rpcUrls: {
readonly default: {
readonly http: readonly ["https://rpc.publicgoods.network"];
};
readonly public: {
readonly http: readonly ["https://rpc.publicgoods.network"];
};
};
readonly blockExplorers: {
readonly default: {
readonly name: "Explorer";
readonly url: "https://explorer.publicgoods.network";
};
};
readonly contracts: {
readonly multicall3: {
readonly address: "0x42c27071b47AE8E6669891487dC6394112748331";
readonly blockCreated: 1623104;
};
};
readonly testnet: false;
};
export declare const pgnSepolia: {
readonly id: 58008;
readonly name: "PGN Sepolia Testnet";
readonly network: "pgn-sepolia";
readonly nativeCurrency: {
readonly decimals: 18;
readonly name: "ETH";
readonly symbol: "ETH";
};
readonly rpcUrls: {
readonly default: {
readonly http: readonly ["https://sepolia.publicgoods.network"];
};
readonly public: {
readonly http: readonly ["https://sepolia.publicgoods.network"];
};
};
readonly blockExplorers: {
readonly default: {
readonly name: "Explorer";
readonly url: "https://explorer.sepolia.publicgoods.network";
};
};
readonly contracts: {
readonly multicall3: {
readonly address: "0xA541E4e79Df59B94B1Db85e997c94E43C685f856";
readonly blockCreated: 3312423;
};
};
readonly testnet: true;
};
67 changes: 2 additions & 65 deletions dist/Client/customChains.js
Original file line number Diff line number Diff line change
@@ -1,66 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.pgnSepolia = exports.pgn = void 0;
// custom chains
exports.pgn = {
id: 424,
name: "Public Goods Network",
network: "pgn",
nativeCurrency: {
decimals: 18,
name: "ETH",
symbol: "ETH",
},
rpcUrls: {
default: {
http: ["https://rpc.publicgoods.network"],
},
public: {
http: ["https://rpc.publicgoods.network"],
},
},
blockExplorers: {
default: {
name: "Explorer",
url: "https://explorer.publicgoods.network",
},
},
contracts: {
multicall3: {
address: "0x42c27071b47AE8E6669891487dC6394112748331",
blockCreated: 1623104,
},
},
testnet: false,
};
exports.pgnSepolia = {
id: 58008,
name: "PGN Sepolia Testnet",
network: "pgn-sepolia",
nativeCurrency: {
decimals: 18,
name: "ETH",
symbol: "ETH",
},
rpcUrls: {
default: {
http: ["https://sepolia.publicgoods.network"],
},
public: {
http: ["https://sepolia.publicgoods.network"],
},
},
blockExplorers: {
default: {
name: "Explorer",
url: "https://explorer.sepolia.publicgoods.network",
},
},
contracts: {
multicall3: {
address: "0xA541E4e79Df59B94B1Db85e997c94E43C685f856",
blockCreated: 3312423,
},
},
testnet: true,
};
// import { Chain } from "viem";
// Add your custom chains here
19 changes: 10 additions & 9 deletions dist/chains.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,19 @@ const devChain1 = {
},
};
exports.supportedChains = [
chains_1.arbitrum,
chains_1.arbitrumGoerli,
chains_1.arbitrumSepolia,
chains_1.base,
chains_1.celoAlfajores,
chains_1.celo,
chains_1.goerli,
chains_1.sepolia,
chains_1.mainnet,
chains_1.optimism,
chains_1.arbitrum,
chains_1.polygon,
chains_1.polygonMumbai,
chains_1.scroll,
chains_1.base,
chains_1.avalanche,
chains_1.fantom,
chains_1.sepolia,
chains_1.optimismSepolia,
chains_1.arbitrumSepolia,
chains_1.polygonMumbai,
chains_1.avalancheFuji,
chains_1.fantomTestnet,
devChain1,
];
4 changes: 2 additions & 2 deletions package-lock.json

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

15 changes: 9 additions & 6 deletions src/Client/Client.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
import { Chain, PublicClient, Transport, createPublicClient, http } from "viem";

/**
*
*
* Returns a PublicClient instance that can be used to interact with the Allo v2 contracts.
*
*
* @remarks
* This is a wrapper around the viem PublicClient class that sets the correct chain ID and transport.
*
*
* @param chain - The chain ID to connect to (this is a Chain type from viem)
* @param rpc - The url of the RPC endpoint
* @returns - A PublicClient instance
*
*
* @beta
*/
export const create = (chain: Chain, rpc?: string): PublicClient<Transport, Chain> => {
export const create = (
chain: Chain,
rpc?: string
): PublicClient<Transport, Chain> => {
const client = createPublicClient({
chain: chain,
transport: http(rpc ?? ""),
});

return client;
};
};
67 changes: 2 additions & 65 deletions src/Client/customChains.ts
Original file line number Diff line number Diff line change
@@ -1,66 +1,3 @@
import { Chain } from "viem";
// import { Chain } from "viem";

// custom chains
export const pgn = {
id: 424,
name: "Public Goods Network",
network: "pgn",
nativeCurrency: {
decimals: 18,
name: "ETH",
symbol: "ETH",
},
rpcUrls: {
default: {
http: ["https://rpc.publicgoods.network"],
},
public: {
http: ["https://rpc.publicgoods.network"],
},
},
blockExplorers: {
default: {
name: "Explorer",
url: "https://explorer.publicgoods.network",
},
},
contracts: {
multicall3: {
address: "0x42c27071b47AE8E6669891487dC6394112748331",
blockCreated: 1623104,
},
},
testnet: false,
} as const satisfies Chain;

export const pgnSepolia = {
id: 58008,
name: "PGN Sepolia Testnet",
network: "pgn-sepolia",
nativeCurrency: {
decimals: 18,
name: "ETH",
symbol: "ETH",
},
rpcUrls: {
default: {
http: ["https://sepolia.publicgoods.network"],
},
public: {
http: ["https://sepolia.publicgoods.network"],
},
},
blockExplorers: {
default: {
name: "Explorer",
url: "https://explorer.sepolia.publicgoods.network",
},
},
contracts: {
multicall3: {
address: "0xA541E4e79Df59B94B1Db85e997c94E43C685f856",
blockCreated: 3312423,
},
},
testnet: true,
} as const satisfies Chain;
// Add your custom chains here
30 changes: 17 additions & 13 deletions src/chains.config.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
import { Chain } from "viem";
import {
arbitrum,
arbitrumGoerli,
arbitrumSepolia,
base,
celoAlfajores,
celo,
goerli,
sepolia,
mainnet,
optimism,
polygon,
polygonMumbai,
optimismSepolia,
avalanche,
fantom,
scroll,
avalancheFuji,
fantomTestnet,
} from "viem/chains";

/** Local development chain support */
const devChain1: Chain = {
id: 1337,
name: "Development 1",
Expand All @@ -36,19 +38,21 @@ const devChain1: Chain = {
},
};

/** Reference for supported chains: https://github.com/gitcoinco/grants-stack/issues/3107 */
export const supportedChains: Chain[] = [
arbitrum,
arbitrumGoerli,
arbitrumSepolia,
base,
celoAlfajores,
celo,
goerli,
sepolia,
mainnet,
optimism,
arbitrum,
polygon,
polygonMumbai,
scroll,
base,
avalanche,
fantom,
sepolia,
optimismSepolia,
arbitrumSepolia,
polygonMumbai,
avalancheFuji,
fantomTestnet,
devChain1,
];
Loading