Skip to content

refactor(utils): update RPC URLs and remove unnecessary code #2337

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

Merged
merged 1 commit into from
Feb 21, 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
54 changes: 10 additions & 44 deletions packages/chains/test/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,22 @@ import {
const MAINNET_FALLBACK_HTTP_RPCS = [
"https://api.mycryptoapi.com/eth",
"https://cloudflare-eth.com",
"https://ethereum.publicnode.com",
"https://ethereum-rpc.publicnode.com",
"https://mainnet.gateway.tenderly.co",
"https://rpc.blocknative.com/boost",
"https://rpc.flashbots.net/fast",
"https://rpc.mevblocker.io/fullprivacy",
];

const MAINNET_FALLBACK_WS_RPCS = [
"wss://ethereum.publicnode.com",
"wss://ethereum-rpc.publicnode.com",
"wss://mainnet.gateway.tenderly.co",
];

const CHAIN_RPC_TEST_CASES: [ChainRPCOptions, string[]][] = [
[
{ thirdwebApiKey: "SAMPLE_KEY" },
[
"https://ethereum.rpc.thirdweb.com/SAMPLE_KEY",
"https://1.rpc.thirdweb.com/SAMPLE_KEY",
...MAINNET_FALLBACK_HTTP_RPCS,
],
["https://1.rpc.thirdweb.com/SAMPLE_KEY", ...MAINNET_FALLBACK_HTTP_RPCS],
],
[
{ alchemyApiKey: "SAMPLE_KEY" },
Expand Down Expand Up @@ -63,26 +59,17 @@ describe("chains/utils", () => {
[
undefined,
undefined,
[
"https://ethereum.rpc.thirdweb.com/",
"https://1.rpc.thirdweb.com/",
...MAINNET_FALLBACK_HTTP_RPCS,
],
["https://1.rpc.thirdweb.com/", ...MAINNET_FALLBACK_HTTP_RPCS],
],
[
undefined,
"http",
[
"https://ethereum.rpc.thirdweb.com/",
"https://1.rpc.thirdweb.com/",
...MAINNET_FALLBACK_HTTP_RPCS,
],
["https://1.rpc.thirdweb.com/", ...MAINNET_FALLBACK_HTTP_RPCS],
],
[
"SAMPLE_CLIENT_KEY",
undefined,
[
"https://ethereum.rpc.thirdweb.com/SAMPLE_CLIENT_KEY",
"https://1.rpc.thirdweb.com/SAMPLE_CLIENT_KEY",
...MAINNET_FALLBACK_HTTP_RPCS,
],
Expand All @@ -91,7 +78,6 @@ describe("chains/utils", () => {
"SAMPLE_CLIENT_KEY",
"http",
[
"https://ethereum.rpc.thirdweb.com/SAMPLE_CLIENT_KEY",
"https://1.rpc.thirdweb.com/SAMPLE_CLIENT_KEY",
...MAINNET_FALLBACK_HTTP_RPCS,
],
Expand All @@ -117,7 +103,7 @@ describe("chains/utils", () => {
width: 512,
format: "png",
},
rpc: ["https://ethereum.rpc.thirdweb.com/${THIRDWEB_API_KEY}"],
rpc: ["https://1.rpc.thirdweb.com/${THIRDWEB_API_KEY}"],
nativeCurrency: {
name: "Ether",
symbol: "ETH",
Expand Down Expand Up @@ -153,11 +139,7 @@ describe("chains/utils", () => {
undefined,
{
...Ethereum,
rpc: [
"https://ethereum.rpc.thirdweb.com/",
"https://1.rpc.thirdweb.com/",
...MAINNET_FALLBACK_HTTP_RPCS,
],
rpc: ["https://1.rpc.thirdweb.com/", ...MAINNET_FALLBACK_HTTP_RPCS],
},
],
[
Expand All @@ -166,7 +148,6 @@ describe("chains/utils", () => {
{
...Ethereum,
rpc: [
"https://ethereum.rpc.thirdweb.com/SAMPLE_CLIENT_KEY",
"https://1.rpc.thirdweb.com/SAMPLE_CLIENT_KEY",
...MAINNET_FALLBACK_HTTP_RPCS,
],
Expand All @@ -187,26 +168,17 @@ describe("chains/utils with APP_BUNDLE_ID", () => {
[
undefined,
undefined,
[
"https://ethereum.rpc.thirdweb.com/",
"https://1.rpc.thirdweb.com/",
...MAINNET_FALLBACK_HTTP_RPCS,
],
["https://1.rpc.thirdweb.com/", ...MAINNET_FALLBACK_HTTP_RPCS],
],
[
undefined,
"http",
[
"https://ethereum.rpc.thirdweb.com/",
"https://1.rpc.thirdweb.com/",
...MAINNET_FALLBACK_HTTP_RPCS,
],
["https://1.rpc.thirdweb.com/", ...MAINNET_FALLBACK_HTTP_RPCS],
],
[
"SAMPLE_CLIENT_KEY",
undefined,
[
"https://ethereum.rpc.thirdweb.com/SAMPLE_CLIENT_KEY/?bundleId=com.thirdweb.rpc",
"https://1.rpc.thirdweb.com/SAMPLE_CLIENT_KEY/?bundleId=com.thirdweb.rpc",
...MAINNET_FALLBACK_HTTP_RPCS,
],
Expand All @@ -215,7 +187,6 @@ describe("chains/utils with APP_BUNDLE_ID", () => {
"SAMPLE_CLIENT_KEY",
"http",
[
"https://ethereum.rpc.thirdweb.com/SAMPLE_CLIENT_KEY/?bundleId=com.thirdweb.rpc",
"https://1.rpc.thirdweb.com/SAMPLE_CLIENT_KEY/?bundleId=com.thirdweb.rpc",
...MAINNET_FALLBACK_HTTP_RPCS,
],
Expand All @@ -230,11 +201,7 @@ describe("chains/utils with APP_BUNDLE_ID", () => {
undefined,
{
...Ethereum,
rpc: [
"https://ethereum.rpc.thirdweb.com/",
"https://1.rpc.thirdweb.com/",
...MAINNET_FALLBACK_HTTP_RPCS,
],
rpc: ["https://1.rpc.thirdweb.com/", ...MAINNET_FALLBACK_HTTP_RPCS],
},
],
[
Expand All @@ -243,7 +210,6 @@ describe("chains/utils with APP_BUNDLE_ID", () => {
{
...Ethereum,
rpc: [
"https://ethereum.rpc.thirdweb.com/SAMPLE_CLIENT_KEY/?bundleId=com.thirdweb.rpc",
"https://1.rpc.thirdweb.com/SAMPLE_CLIENT_KEY/?bundleId=com.thirdweb.rpc",
...MAINNET_FALLBACK_HTTP_RPCS,
],
Expand Down
1 change: 1 addition & 0 deletions pnpm-lock.yaml

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