Represents a store for Solana accounts.

Hierarchy

  • SolanaAccountsStore

Constructors

Properties

SOL_DECIMALS: number = 9
__accounts: Map<string, SolanaAccount>
__connection: Connection

Methods

  • Creates a new Solana account with a prefix and adds it to the store.

    Method

    createNewWithPrefix

    Async

    Returns

    • A Promise that resolves to the newly created Solana account with the specified prefix, or undefined if a unique account address could not be generated within the specified number of tries.

    Parameters

    • prefix: string

      The prefix to use for generating the account address.

    • Optional tries: number = 10000

      The maximum number of tries to generate a unique account address with the given prefix (optional, defaults to 10000).

    Returns Promise<undefined | SolanaAccount>

  • Retrieves a Solana account from the store based on the account address.

    Method

    get

    Returns

    • The retrieved Solana account, or undefined if the account is not found in the store.

    Parameters

    • account: string

      The account address for which to retrieve the Solana account.

    Returns undefined | SolanaAccount

  • Retrieves the SOL (Solana) token balance for a given account address.

    Method

    getSOLBalance

    Async

    Returns

    • A Promise that resolves to an object containing the SOL balance in both BigNumber and human-readable format.

    Parameters

    • accountAddress: string

      The account address for which to retrieve the SOL balance.

    • Optional connection: Connection

      The Solana connection object to use for retrieving the balance (optional, defaults to the class's connection).

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

  • Retrieves the SPL token balance for a given owner's account.

    Method

    getSPLTokenBalance

    Async

    Returns

    • A Promise that resolves to an object containing the SPL token balance in both BigNumber and human-readable format.

    Parameters

    • owner: string

      The owner's address for which to retrieve the SPL token balance.

    • tokenConfig: BridgeTokenConfig

      The configuration for the SPL token.

    • connection: Connection

      The Solana connection object to use for retrieving the balance.

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

  • Requests an airdrop of SOL tokens to a given account.

    Method

    requestAirDrop

    Async

    Returns

    • A Promise that resolves to the transaction signature of the airdrop request.

    Parameters

    • signer: SolanaAccount

      The Solana account requesting the airdrop.

    • Optional amount: number = 1_000_000_000

      The amount of SOL tokens to request for the airdrop (optional, defaults to 1,000,000,000).

    • connection: Connection

      The Solana connection object to use for requesting the airdrop.

    Returns Promise<string>

Generated using TypeDoc