Skip to content
This repository was archived by the owner on Aug 30, 2022. It is now read-only.
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
2 changes: 1 addition & 1 deletion etc/sdk.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ export const ChainlinkVrf: Record<number, ChainlinkInfo>;
// Warning: (ae-internal-missing-underscore) The name "ChainOrRpc" should be prefixed with an underscore because the declaration is marked as @internal
//
// @internal (undocumented)
export type ChainOrRpc = "mumbai" | "polygon" | "rinkeby" | "goerli" | "mainnet" | "fantom" | "avalanche" | (string & {});
export type ChainOrRpc = "mumbai" | "polygon" | "matic" | "rinkeby" | "goerli" | "mainnet" | "ethereum" | "fantom" | "avalanche" | (string & {});

// Warning: (ae-internal-missing-underscore) The name "CidWithFileName" should be prefixed with an underscore because the declaration is marked as @internal
//
Expand Down
10 changes: 8 additions & 2 deletions src/constants/urls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,13 @@ export const PINATA_IPFS_URL = `https://api.pinata.cloud/pinning/pinFileToIPFS`;
export type ChainOrRpc =
| "mumbai"
| "polygon"
// common alias for `polygon`
| "matic"
| "rinkeby"
| "goerli"
| "mainnet"
// common alias for `mainnet`
| "ethereum"
| "fantom"
| "avalanche"
// ideally we could use `https://${string}` notation here, but doing that causes anything that is a generic string to throw a type error => not worth the hassle for now
Expand Down Expand Up @@ -58,15 +62,17 @@ export function getProviderForNetwork(network: ChainOrRpc | SignerOrProvider) {
case "goerli":
return `https://eth-goerli.g.alchemy.com/v2/${DEFAULT_API_KEY}`;
case "polygon":
case "matic":
return `https://polygon-mainnet.g.alchemy.com/v2/${DEFAULT_API_KEY}`;
case "mainnet" || "ethereum":
case "mainnet":
case "ethereum":
return `https://eth-mainnet.g.alchemy.com/v2/${DEFAULT_API_KEY}`;
case "fantom":
return "https://rpc.ftm.tools";
case "avalanche":
return "https://rpc.ankr.com/avalanche";
default:
if (network.startsWith("http")) {
if (network.startsWith("http") || network.startsWith("ws")) {
return network;
} else {
throw new Error(`Unrecognized chain name or RPC url: ${network}`);
Expand Down