smart-lookup/core/web3.ts
Georges KABBOUCHI ca94be0501 wip
2023-03-06 14:02:27 +02:00

50 lines
1.5 KiB
TypeScript

import { ethers } from "ethers";
export const networks: Record<string, string> = {
mainnet: "https://rpc.ankr.com/eth",
polygon: "https://rpc.ankr.com/polygon",
avalanche: "https://rpc.ankr.com/avalanche",
fantom: "https://rpc.ankr.com/fantom",
optimism: "https://rpc.ankr.com/optimism",
arbitrum: "https://rpc.ankr.com/arbitrum",
gnosis: "https://rpc.ankr.com/gnosis",
bsc: "https://rpc.ankr.com/bsc",
};
export const networkScanBaseUrl: Record<string, string> = {
mainnet: "https://etherscan.io/",
polygon: "https://polygonscan.com/",
avalanche: "https://snowtrace.io/",
fantom: "https://ftmscan.com/",
optimism: "https://optimistic.etherscan.io/",
arbitrum: "https://arbiscan.io/",
gnosis: "https://gnosisscan.io/",
bsc: "https://bscscan.com/",
};
export type Network = keyof typeof networks;
export const gnosisSafeAbi = [
{
inputs: [],
name: "getOwners",
outputs: [{ internalType: "address[]", name: "", type: "address[]" }],
stateMutability: "view",
type: "function",
},
{
inputs: [],
name: "getThreshold",
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
stateMutability: "view",
type: "function",
},
];
export const networkProviderMap = Object.keys(networks).reduce((acc, curr) => {
acc[curr] = new ethers.providers.JsonRpcProvider(networks[curr]);
return acc;
}, {} as Record<string, ethers.providers.JsonRpcProvider>);