Represents a Solana account associated with a Neon EVM wallet.

This class provides utilities for managing a Solana account that interacts with the Neon EVM. It includes methods for retrieving balance addresses, handling key pairs, signing transactions, and creating balance accounts if they do not exist.

Constructors

  • Creates a SolanaNeonAccount instance.

    Parameters

    • solanaAddress: PublicKey

      The Solana public key associated with the account.

    • neonEvmProgram: PublicKey

      The public key of the Neon EVM program.

    • mint: PublicKey

      The token mint associated with the account.

    • chainId: number

      The chain ID for Neon EVM.

    • Optionalkeypair: Keypair

      Optional keypair for signing transactions.

    Returns SolanaNeonAccount

Properties

chainId: number

The Neon EVM chain ID.

neonEvmProgram: PublicKey

The public key of the Neon EVM program.

neonWallet: string

The Ethereum-style Neon wallet address derived from the Solana address.

publicKey: PublicKey

The public key of the Solana account.

tokenMint: PublicKey

The public key of the token mint associated with the account.

Accessors

  • get balanceAddress(): PublicKey
  • Retrieves the balance program address for the Neon wallet.

    Returns PublicKey

    The derived public key of the balance account.

  • get keypair(): Keypair
  • Retrieves the associated keypair, if initialized.

    Returns Keypair

    The keypair instance.

    If the keypair is not initialized.

  • get signer(): null | Signer
  • Retrieves the signer object from the keypair.

    Returns null | Signer

    A Signer object if the keypair exists, otherwise null.

Methods

  • Ensures the balance account exists, and if not, attempts to create it.

    If the account does not exist and a valid signer is available, a transaction is created and signed to create the balance account.

    Parameters

    • connection: Connection

      The Solana connection object.

    Returns Promise<null | AccountInfo<Buffer>>

    The balance account information if successful, otherwise null.

  • Extracts the nonce from a given account's balance data.

    Parameters

    • account: AccountInfo<Buffer>

      The Solana account information.

    Returns number

    The extracted nonce, or 0 if the account is not provided.

  • Creates a SolanaNeonAccount instance from a keypair.

    This method generates a new account using the given keypair and required parameters.

    Parameters

    • keypair: Keypair

      The Solana keypair.

    • neonEvmProgram: PublicKey

      The public key of the Neon EVM program.

    • mint: PublicKey

      The token mint associated with the account.

    • chainId: number

      The chain ID for Neon EVM.

    Returns SolanaNeonAccount

    A new instance of SolanaNeonAccount.

    const gasToken = tokenList.find(i => parseInt(i.tokenChainId, 16) === chainId);
    const mint = new PublicKey(gasToken.tokenMint);
    const account = SolanaNeonAccount.fromKeypair(keypair, neonEvmProgram, mint, chainId);
    console.log("Created Neon Account:", account);
MMNEPVFCICPMFPCPTTAAATR