Class representing the Evm connection.

Hierarchy

  • EvmConnect

Constructors

  • Create an instance of the class.

    Parameters

    • network: BridgeEvmNetworks

      The network for the instance.

    • config: {
          bridge: string;
          chainId: number;
          circleTreasury: string;
          depositWallet: string;
          releaseWallet: string;
          rpcUrl: string;
          tokenBridge: string;
          tokens: BridgeTokenConfig[];
      }

      The configuration object for the EVM network.

      • bridge: string
      • chainId: number
      • circleTreasury: string
      • depositWallet: string
      • releaseWallet: string
      • rpcUrl: string
      • tokenBridge: string
      • tokens: BridgeTokenConfig[]
    • Optional bridgeV2Tokens: Token2ChainConfig[]

      The list of bridge V2 tokens (optional).

    Returns EvmConnect

Properties

__config: {
    bridge: string;
    chainId: number;
    circleTreasury: string;
    depositWallet: string;
    releaseWallet: string;
    rpcUrl: string;
    tokenBridge: string;
    tokens: BridgeTokenConfig[];
}

Type declaration

  • bridge: string
  • chainId: number
  • circleTreasury: string
  • depositWallet: string
  • releaseWallet: string
  • rpcUrl: string
  • tokenBridge: string
  • tokens: BridgeTokenConfig[]
__providers: Connection

Accessors

  • get config(): {
        bridge: string;
        chainId: number;
        circleTreasury: string;
        depositWallet: string;
        releaseWallet: string;
        rpcUrl: string;
        tokenBridge: string;
        tokens: BridgeTokenConfig[];
    }
  • Retrieves the EVM network configuration for the instance.

    Returns

    • The EVM network configuration for the instance.

    Returns {
        bridge: string;
        chainId: number;
        circleTreasury: string;
        depositWallet: string;
        releaseWallet: string;
        rpcUrl: string;
        tokenBridge: string;
        tokens: BridgeTokenConfig[];
    }

    • bridge: string
    • chainId: number
    • circleTreasury: string
    • depositWallet: string
    • releaseWallet: string
    • rpcUrl: string
    • tokenBridge: string
    • tokens: BridgeTokenConfig[]

Methods

  • Approves tokens to be used by the bridge.

    Returns

    • A promise that resolves with the approval transaction.

    Parameters

    • tokenSymbol: string

      The symbol of the token to approve.

    • amount: string | BigNumber

      The amount of tokens to approve.

    • signer: Signer

      The signer to use for the approval transaction.

    Returns Promise<ContractTransaction>

  • Bridge tokens to another supported chain

    Returns

    returns the transaction response

    Parameters

    • destinationWallet: string | default | PublicKey

      receiver address on destination chain

    • destination: BridgeNetworks

      destination chain

    • tokenSymbol: string

      only USDC for now

    • amount: string | BigNumber

      in base units e.g 1_000_000 for 1USDC

    • signer: Signer

      to sign transaction

    • Optional v2: boolean

      is this a bridge v2 deposit?

    • Optional protocolId: number

      for deposit processed by partners, protocolId allows the process of fee sharing

    Returns Promise<ContractTransaction>

  • Retrieves the current allowance of tokens for the bridge.

    Returns

    • A promise that resolves with the current token allowance for the bridge.

    Parameters

    • tokenSymbol: string

      The symbol of the token.

    • signer: Signer

      The signer to use for the operation.

    Returns Promise<BigNumber>

  • Private

    Creates connection objects based on the provided RPC URL and configuration.

    Returns

    • The created connection object.

    Parameters

    • rpcUrl: string

      The RPC URL for the connection.

    • config: {
          bridge: string;
          chainId: number;
          circleTreasury: string;
          depositWallet: string;
          releaseWallet: string;
          rpcUrl: string;
          tokenBridge: string;
          tokens: BridgeTokenConfig[];
      }

      The configuration object for the EVM network.

      • bridge: string
      • chainId: number
      • circleTreasury: string
      • depositWallet: string
      • releaseWallet: string
      • rpcUrl: string
      • tokenBridge: string
      • tokens: BridgeTokenConfig[]
    • Optional bridgeV2Tokens: Token2ChainConfig[]

      Tokens for bridgeV2 configuration.

    Returns Connection

  • Private

    Deposits tokens using the bridge V2.

    Returns

    • A promise that resolves with the deposit transaction.

    Parameters

    • options: {
          amount: string | BigNumber;
          destination: BridgeEvmNetworks;
          protocolId?: number;
          signer: Signer;
          targetWallet: Buffer;
          tokenSymbol: string;
      }

      The options for the deposit.

      • amount: string | BigNumber

        The amount of tokens to deposit.

      • destination: BridgeEvmNetworks

        The destination EVM network.

      • Optional protocolId?: number

        The protocol ID for the deposit (optional).

      • signer: Signer

        The signer to use for the deposit transaction.

      • targetWallet: Buffer

        The target wallet address.

      • tokenSymbol: string

        The symbol of the token to deposit.

    Returns Promise<ContractTransaction>

  • Provide address of bridge component

    Returns

    returns the address for the given entity

    Parameters

    • entity: "tokens" | "bridge" | "depositWallet" | "releaseWallet" | "tokenBridge" | "circleTreasury"

      The type of address to provide

    • Optional tokenSymbol: string

      only USDC for now

    Returns string

  • Retrieves the block number of a transaction.

    Returns

    • A promise that resolves with the block number of the transaction.

    Parameters

    • txHash: string

      The transaction hash.

    Returns Promise<number>

  • Retrieves the timestamp of a transaction.

    Returns

    • A promise that resolves with the timestamp of the transaction.

    Parameters

    • txHash: string

      The transaction hash.

    Returns Promise<number>

  • Retrieves the timestamp from a block number.

    Returns

    • A promise that resolves with the timestamp of the block.

    Parameters

    • blockNumber: number

      The block number.

    Returns Promise<number>

  • Retrieves the token configuration (V1)for a given token symbol.

    Parameters

    • tokenSymbol: string

      The symbol of the token.

    Returns undefined | BridgeTokenConfig | {
        address?: string;
        asset_id?: number;
        chain?: string;
        decimals?: number;
        isNative?: boolean;
        min_transfer?: number;
        name?: string;
        supportedDestination: BridgeNetworks[];
        symbol?: string;
        vault_address?: string;
        vault_id?: number;
        vault_type?: string;
    }

  • Parameters

    • tokenSymbol: string
    • address: string

    Returns Promise<BigNumber>

  • Retrieves the hashed transaction ID.

    Returns

    • The hashed transaction ID.

    Parameters

    • txnID: string

      The transaction ID.

    Returns string

  • Retrieves the token balance of a specified token symbol for a given address on the network.

    Returns

    • A promise that resolves with the token balance as an ethers.BigNumber.

    Parameters

    • address: string

      The address for which to retrieve the token balance.

    • tokenSymbol: string

      The symbol of the token.

    Returns Promise<BigNumber>

  • Parameters

    • tokenSymbol: string

    Returns {
        address?: string;
        asset_id?: number;
        chain?: string;
        decimals?: number;
        isNative?: boolean;
        min_transfer?: number;
        name?: string;
        supportedDestination: BridgeNetworks[];
        symbol?: string;
        vault_address?: string;
        vault_id?: number;
        vault_type?: string;
    }

    • Optional address?: string
    • Optional asset_id?: number
    • Optional chain?: string
    • Optional decimals?: number
    • Optional isNative?: boolean
    • Optional min_transfer?: number
    • Optional name?: string
    • supportedDestination: BridgeNetworks[]
    • Optional symbol?: string
    • Optional vault_address?: string
    • Optional vault_id?: number
    • Optional vault_type?: string
  • Private

    Checks if the signer is connected to the correct chain.

    Returns

    • A promise that resolves with a boolean indicating if the signer is connected to the correct chain.

    Parameters

    • signer: Signer

      The signer to check.

    Returns Promise<boolean>

  • Private

    Checks if a token symbol is valid.

    Returns

    • Returns true if the token symbol is valid, otherwise false.

    Parameters

    • tokenSymbol: string

      The symbol of the token.

    Returns boolean

  • Parameters

    • __namedParameters: {
          amount: string | BigNumber;
          signer: Signer;
          tokenSymbol: string;
      }
      • amount: string | BigNumber
      • signer: Signer
      • tokenSymbol: string

    Returns Promise<ContractTransaction>

Generated using TypeDoc