Skip to content

Commit

Permalink
refactor: blockpi (#9788)
Browse files Browse the repository at this point in the history
  • Loading branch information
guanbinrui committed Jun 7, 2023
1 parent fb2a774 commit 8c27a0a
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 37 deletions.
1 change: 0 additions & 1 deletion cspell.json
Expand Up @@ -52,7 +52,6 @@
"blockhash",
"blockie",
"blockies",
"blockpi",
"bluebar",
"blurhash",
"boba",
Expand Down
3 changes: 0 additions & 3 deletions packages/flags/src/flags/index.ts
Expand Up @@ -42,9 +42,6 @@ export const flags = {
i18nTranslationHotUpdate: true,
sandboxedPluginRuntime: false,

// how many users should use blockpi rpc
blockpi_grayscale: 5,

/** The earliest version for the sentry to watch events and exceptions. */
sentry_earliest_version: process.env.VERSION,
sentry_sample_rate: 0.05,
Expand Down
25 changes: 0 additions & 25 deletions packages/web3-constants/evm/rpc.json
Expand Up @@ -94,31 +94,6 @@
"Conflux": ["https://evm.confluxrpc.com"],
"Astar": ["https://rpc.astar.network:8545"]
},
"RPC_BLOCKPI_URL": {
"Mainnet": "https://ethereum.blockpi.network/v1/rpc/dd38517e40d0deaaa69655a896b87a742d40610f",
"Ropsten": "",
"Rinkeby": "",
"Kovan": "",
"Gorli": "",
"BSC": "https://bsc.blockpi.network/v1/rpc/aa1df11ff5f5a52af5ae0bd6289f819b295d36f1",
"BSCT": "",
"Matic": "https://polygon.blockpi.network/v1/rpc/98175a60a725c6eb72c6db345af762021ec8f33c",
"Mumbai": "",
"Arbitrum": "https://arbitrum.blockpi.network/v1/rpc/3671ee3767ce54ddff136803eebd60ee8f75fe20",
"Arbitrum_Rinkeby": "",
"xDai": "https://gnosis.blockpi.network/v1/rpc/991faea7653840694ed44cbfa11b00dd18c42f4f",
"Optimism": "https://optimism.blockpi.network/v1/rpc/1994e3e802f3c4a5e1cd3072c9b5f787eca8e8a9",
"Optimism_Kovan": "",
"Optimism_Goerli": "",
"Avalanche": "https://avalanche.blockpi.network/v1/rpc/b5337bc985ff798ca15ea7e7d3f745a599fbab3f",
"Avalanche_Fuji": "",
"Celo": "",
"Fantom": "https://fantom.blockpi.network/v1/rpc/f34a9273d07b98fe3888b9ab69005ad67753748f",
"Aurora": "",
"Aurora_Testnet": "",
"Conflux": "",
"Astar": ""
},
"RPC_WEIGHTS": {
"Mainnet": [0, 1, 2, 3, 4],
"Ropsten": [0, 1, 2, 3, 4],
Expand Down
11 changes: 3 additions & 8 deletions packages/web3-shared/evm/src/libs/ProviderURL.ts
@@ -1,7 +1,6 @@
import { Flags } from '@masknet/flags'
import { getABTestSeed, joinsABTest } from '@masknet/web3-telemetry/helpers'
import { getABTestSeed } from '@masknet/web3-telemetry/helpers'
import { getRPCConstants } from '../constants/constants.js'
import { ChainId } from '../types/index.js'
import type { ChainId } from '../types/index.js'

export class ProviderURL {
/**
Expand All @@ -11,11 +10,7 @@ export class ProviderURL {
constructor() {}

static from(chainId: ChainId) {
const { RPC_URLS, RPC_WEIGHTS, RPC_BLOCKPI_URL } = getRPCConstants(chainId)

// a grayscale user will be served the blockpi API
if (chainId !== ChainId.Mainnet && RPC_BLOCKPI_URL && joinsABTest(Flags.blockpi_grayscale))
return RPC_BLOCKPI_URL
const { RPC_URLS, RPC_WEIGHTS } = getRPCConstants(chainId)

if (!RPC_URLS || !RPC_WEIGHTS) throw new Error(`No RPC presets at chainId: ${chainId}.`)

Expand Down

0 comments on commit 8c27a0a

Please sign in to comment.