@cfxlabsinc/b2b-services
    Preparing search index...

    Alchemy's JSON-RPC, https://<host>.g.alchemy.com/v2/<key>, for the EVM networks in EVM_CHAIN_IDS. Every method returns ALCHEMY_ERROR for a 4xx and throws for a fault, a JSON-RPC error included.

    Index
    testnet: boolean

    The stage's networks: testnets on dev, mainnets on prod.

    instance: (...args: []) => AlchemyRpcClient = ...

    The process client: ALCHEMY_API_KEY is read at each call, on testnets unless the process key ENVIRONMENT is prod.

    • One page of the transfers alchemy_getAssetTransfers lists sent from or received by address, oldest first; pageKey is null after the last.

      Parameters

      • __namedParameters: {
            address: string;
            categories: TransferCategory[];
            direction: "from" | "to";
            network:
                | "ethereum"
                | "base"
                | "polygon"
                | "arbitrum"
                | "optimism"
                | "avalanche-c-chain"
                | "bnb-smart-chain"
                | "unichain"
                | "robinhood-chain"
                | "celo"
                | "berachain"
                | "gnosis"
                | "monad"
                | "sonic"
                | "zksync";
            pageKey?: string;
        }

      Returns Promise<
          | { error: AlchemyError; ok: false }
          | {
              ok: true;
              value: { pageKey: string | null; transfers: AssetTransfer[] };
          },
      >

    • The lowercased hashes of the block's transactions, or null while the node does not hold the block.

      Parameters

      • __namedParameters: {
            block: number;
            network:
                | "ethereum"
                | "base"
                | "polygon"
                | "arbitrum"
                | "optimism"
                | "avalanche-c-chain"
                | "bnb-smart-chain"
                | "unichain"
                | "robinhood-chain"
                | "celo"
                | "berachain"
                | "gnosis"
                | "monad"
                | "sonic"
                | "zksync";
        }

      Returns Promise<
          | { error: AlchemyError; ok: false }
          | { ok: true; value: string[] | null },
      >

    • The block's transactions by lowercased sender and nonce, or null while the node does not hold the block.

      Parameters

      • __namedParameters: {
            block: number;
            network:
                | "ethereum"
                | "base"
                | "polygon"
                | "arbitrum"
                | "optimism"
                | "avalanche-c-chain"
                | "bnb-smart-chain"
                | "unichain"
                | "robinhood-chain"
                | "celo"
                | "berachain"
                | "gnosis"
                | "monad"
                | "sonic"
                | "zksync";
        }

      Returns Promise<
          | { error: AlchemyError; ok: false }
          | { ok: true; value: BlockTransaction[] | null },
      >

    • The code at address at the latest block, 0x for an account with none.

      Parameters

      • __namedParameters: {
            address: string;
            network:
                | "ethereum"
                | "base"
                | "polygon"
                | "arbitrum"
                | "optimism"
                | "avalanche-c-chain"
                | "bnb-smart-chain"
                | "unichain"
                | "robinhood-chain"
                | "celo"
                | "berachain"
                | "gnosis"
                | "monad"
                | "sonic"
                | "zksync";
        }

      Returns Promise<{ error: AlchemyError; ok: false } | { ok: true; value: string }>

    • The number of the network's finalized block.

      Parameters

      • __namedParameters: {
            network:
                | "ethereum"
                | "base"
                | "polygon"
                | "arbitrum"
                | "optimism"
                | "avalanche-c-chain"
                | "bnb-smart-chain"
                | "unichain"
                | "robinhood-chain"
                | "celo"
                | "berachain"
                | "gnosis"
                | "monad"
                | "sonic"
                | "zksync";
        }

      Returns Promise<{ error: AlchemyError; ok: false } | { ok: true; value: number }>

    • The number of the network's latest block.

      Parameters

      • __namedParameters: {
            network:
                | "ethereum"
                | "base"
                | "polygon"
                | "arbitrum"
                | "optimism"
                | "avalanche-c-chain"
                | "bnb-smart-chain"
                | "unichain"
                | "robinhood-chain"
                | "celo"
                | "berachain"
                | "gnosis"
                | "monad"
                | "sonic"
                | "zksync";
        }

      Returns Promise<{ error: AlchemyError; ok: false } | { ok: true; value: number }>

    • The native balance in wei, as a decimal string, at the latest block.

      Parameters

      • __namedParameters: {
            address: string;
            network:
                | "ethereum"
                | "base"
                | "polygon"
                | "arbitrum"
                | "optimism"
                | "avalanche-c-chain"
                | "bnb-smart-chain"
                | "unichain"
                | "robinhood-chain"
                | "celo"
                | "berachain"
                | "gnosis"
                | "monad"
                | "sonic"
                | "zksync";
        }

      Returns Promise<{ error: AlchemyError; ok: false } | { ok: true; value: string }>

    • How many transactions address had sent by the end of block.

      Parameters

      • __namedParameters: {
            address: string;
            block: number;
            network:
                | "ethereum"
                | "base"
                | "polygon"
                | "arbitrum"
                | "optimism"
                | "avalanche-c-chain"
                | "bnb-smart-chain"
                | "unichain"
                | "robinhood-chain"
                | "celo"
                | "berachain"
                | "gnosis"
                | "monad"
                | "sonic"
                | "zksync";
        }

      Returns Promise<{ error: AlchemyError; ok: false } | { ok: true; value: number }>

    • ERC-20 balances in base units by lowercased contract: those of contracts (zero included), or every token held when it is left out, paged. A token Alchemy could not read (a reverting contract) is left out of balances and named in unread: unread, never zero.

      Parameters

      • __namedParameters: {
            address: string;
            contracts?: string[];
            network:
                | "ethereum"
                | "base"
                | "polygon"
                | "arbitrum"
                | "optimism"
                | "avalanche-c-chain"
                | "bnb-smart-chain"
                | "unichain"
                | "robinhood-chain"
                | "celo"
                | "berachain"
                | "gnosis"
                | "monad"
                | "sonic"
                | "zksync";
        }

      Returns Promise<
          | {
              ok: true;
              value: {
                  balances: Map<string, string>;
                  unread: { contract: string; error: string }[];
              };
          }
          | { error: HoldingsError; ok: false },
      >

    • A fungible token's name, symbol and decimals; null when Alchemy cannot describe it.

      Parameters

      • __namedParameters: {
            address: string;
            network:
                | "ethereum"
                | "base"
                | "polygon"
                | "arbitrum"
                | "optimism"
                | "avalanche-c-chain"
                | "bnb-smart-chain"
                | "unichain"
                | "robinhood-chain"
                | "celo"
                | "berachain"
                | "gnosis"
                | "monad"
                | "sonic"
                | "zksync";
        }

      Returns Promise<
          | { error: AlchemyError; ok: false }
          | {
              ok: true;
              value: { decimals: number; name: string; symbol: string } | null;
          },
      >

    • One page of the traces trace_filter finds sent to address from block 0 to toBlock, by offset; next is null after a short page.

      Parameters

      • __namedParameters: {
            address: string;
            after: number;
            count: number;
            network:
                | "ethereum"
                | "base"
                | "polygon"
                | "arbitrum"
                | "optimism"
                | "avalanche-c-chain"
                | "bnb-smart-chain"
                | "unichain"
                | "robinhood-chain"
                | "celo"
                | "berachain"
                | "gnosis"
                | "monad"
                | "sonic"
                | "zksync";
            toBlock: number;
        }

      Returns Promise<
          | { error: AlchemyError; ok: false }
          | {
              ok: true;
              value: {
                  next: number | null;
                  traces: { block: number; txHash: string }[];
              };
          },
      >

    • The transaction by hash with its receipt, block time and the internal transfers touching address, or null while the node holds it in no block or has no receipt. A transaction with a receipt the node cannot trace yet throws a transient fault: it is mined, never reorged out.

      Parameters

      • __namedParameters: {
            address: string;
            network:
                | "ethereum"
                | "base"
                | "polygon"
                | "arbitrum"
                | "optimism"
                | "avalanche-c-chain"
                | "bnb-smart-chain"
                | "unichain"
                | "robinhood-chain"
                | "celo"
                | "berachain"
                | "gnosis"
                | "monad"
                | "sonic"
                | "zksync";
            txHash: string;
        }

      Returns Promise<
          | { error: AlchemyError; ok: false }
          | { ok: true; value: EvmTransaction | null },
      >