Represents a connection to the Solana network.

Hierarchy

  • SolanaConnect

Constructors

Properties

accountStore: SolanaAccountsStore
connections: Record<"testnet" | "devnet" | "mainnet", Connection>
defaultConnection: "testnet" | "devnet" | "mainnet"
solanaConfig: SolanaConfig

Methods

  • Initiates a bridge operation to transfer tokens from the source network to the destination network.

    Method

    bridge

    Async

    Returns

    • A Promise that resolves to a string representing the transaction hash or identifier for the bridge operation.

    Parameters

    • sourceAddress: string

      The source address from which to transfer the tokens.

    • destinationAddress: string

      The destination address to receive the transferred tokens.

    • destinationNetwork: BridgeNetworks

      The destination network to bridge the tokens to.

    • tokenSymbol: string

      The symbol of the token to be bridged.

    • amount: bigint

      The amount of tokens to be bridged, represented as a bigint.

    Returns Promise<string>

  • Initiates a bridge transaction to transfer tokens from the source network to the destination network.

    Method

    bridgeTransaction

    Async

    Returns

    • A Promise that resolves to the transaction for the bridge operation.

    Parameters

    • sourceAddress: string

      The source address from which to transfer the tokens.

    • destinationAddress: string

      The destination address to receive the transferred tokens.

    • destinationNetwork: BridgeNetworks

      The destination network to bridge the tokens to.

    • tokenSymbol: string

      The symbol of the token to be bridged.

    • amount: bigint

      The amount of tokens to be bridged, represented as a bigint.

    Returns Promise<Transaction>

  • Retrieves the balance of a specific token for a given account.

    Method

    getBalance

    Async

    Returns

    • A Promise that resolves to an object containing the balance information for the specified token.

    Parameters

    • account: string

      The account for which to retrieve the balance.

    • tokenSymbol: string

      The symbol of the token for which to retrieve the balance.

    Returns Promise<{
        balanceBn: BigNumber;
        balanceHuman: BigNumber;
    }>

  • Retrieves the connection for a specific token based on its symbol.

    Method

    getConnection

    Returns

    • The connection object for the specified token.

    Parameters

    • tokenSymbol: string

      The symbol of the token for which to retrieve the connection.

    Returns Connection

  • Retrieves the configuration for a token based on its symbol.

    Method

    getToken

    Returns

    • The configuration for the token if found, or undefined if the token is not found.

    Parameters

    • tokenSymbol: string

      The symbol of the token for which to retrieve the configuration.

    Returns undefined | BridgeTokenConfig

  • Checks if a specific address has opted in to a token.

    Method

    isOptedIn

    Async

    Returns

    • A Promise that resolves to a boolean indicating whether the address has opted in to the token.

    Parameters

    • tokenSymbol: string

      The symbol of the token to check.

    • address: string

      The address to check for opt-in status.

    Returns Promise<boolean>

  • Initiates the opt-in process for a specific token by creating and sending an opt-in transaction.

    Method

    optin

    Async

    Returns

    • A Promise that resolves to a string representing the transaction hash or identifier for the opt-in transaction.

    Parameters

    • signerAddress: string

      The address of the account that will opt in to the token.

    • tokenSymbol: string

      The symbol of the token for which to initiate the opt-in process.

    Returns Promise<string>

  • Creates a transaction for opting in to a specific token.

    Method

    optinTransaction

    Async

    Returns

    • A Promise that resolves to the transaction for opting in to the token.

    Parameters

    • signerAddress: string

      The address of the account that will opt in to the token.

    • tokenSymbol: string

      The symbol of the token for which to create the opt-in transaction.

    Returns Promise<Transaction>

  • Sends a transaction to the Solana network using the provided connection and account.

    Method

    sendTransaction

    Async

    Returns

    • A Promise that resolves to a string representing the transaction hash or identifier.

    Parameters

    • connection: Connection

      The Solana connection object to use for sending the transaction.

    • transaction: Transaction

      The transaction to be sent.

    • account: SolanaAccount

      The Solana account to use for signing the transaction.

    Returns Promise<string>

  • Waits for the balance of a specific token for a given address to change to an expected amount within a specified timeout.

    Method

    waitForBalanceChange

    Async

    Returns

    • A Promise that resolves to the final balance after the change.

    Parameters

    • address: string

      The address for which to wait for the balance change.

    • tokenSymbol: string

      The symbol of the token for which to wait for the balance change.

    • expectedAmount: number

      The expected amount to which the balance should change.

    • Optional timeoutSeconds: number = 60

      The timeout duration in seconds (optional, defaults to 60 seconds).

    • Optional threshold: number = 0.001

      The threshold for considering the balance change significant (optional, defaults to 0.001).

    • Optional anybalance: boolean = false

      Set to true to consider any balance change as valid (optional, defaults to false).

    • Optional noBalance: boolean = false

      Set to true to wait for the balance to reach zero (optional, defaults to false).

    Returns Promise<number>

Generated using TypeDoc