Solana and SVM Compatible Blockchains (beta) Actions

action

sign_transaction

The svm::send_transaction is used to sign a transaction and broadcast it to the specified SVM-compatible network.

Inputs

  • Name
    description
    Type
    optional
    Description

    A description of the transaction.

  • Name
    transaction_bytes
    Type
    required
    Description

    The transaction bytes to sign.

  • Name
    signers
    Type
    optional
    Description

    A set of references to a signer construct, which will be used to sign the transaction.

  • Name
    signer
    Type
    optional
    Description

    A reference to a signer construct, which will be used to sign the transaction.

Outputs

  • Name
    signed_transaction_bytes
    Description

    The signed transaction bytes.

Example using sign_transaction

// Coming soon


action

process_instructions

The svm::process_instructions action encodes instructions that are added to a transaction that is signed and broadcasted to the network.

Inputs

  • Name
    description
    Type
    optional
    Description

    A description of the transaction.

  • Name
    instruction
    Type
    required
    Description

    The instructions to add to the transaction.

  • Name
    signers
    Type
    required
    Description

    A set of references to a signer construct, which will be used to sign the transaction.

  • Name
    commitment_level
    Type
    optional
    Description

    The commitment level expected for considering this action as done ('processed', 'confirmed', 'finalized'). The default is 'confirmed'.

  • Name
    rpc_api_url
    Type
    required
    Description

    The URL to use when making API requests.

  • Name
    rpc_api_auth_token
    Type
    optional
    Description

    The HTTP authentication token to include in the headers when making API requests.

Outputs

  • Name
    signature
    Description

    The transaction computed signature.

Example using process_instructions


action "program_call" "svm::process_instructions" {
    description = "Invoke instructions"
    instruction {
        program_id = variable.program
        account {
            public_key = signer.caller.address
            is_signer = true
            is_writable = true
    }
        data = svm::get_instruction_data_from_idl(variable.program.idl, "my_instruction", ["arg1", "arg2"])
    }
    signers = [signer.caller]
}


action

deploy_program

svm::deploy_program deploys an anchor program to the specified SVM-compatible network.

Inputs

  • Name
    description
    Type
    optional
    Description

    A description of the deployment action.

  • Name
    program
    Type
    required
    Description

    The Solana program artifacts to deploy.

  • Name
    payer
    Type
    optional
    Description

    A reference to a signer construct, which will be used to sign transactions that pay for the program deployment. If omitted, the authority will be used.

  • Name
    authority
    Type
    required
    Description

    A reference to a signer construct, which will be the final authority for the deployed program.

  • Name
    commitment_level
    Type
    optional
    Description

    The commitment level expected for considering this action as done ('processed', 'confirmed', 'finalized'). The default is 'confirmed'.

  • Name
    auto_extend
    Type
    optional
    Description

    Whether to auto extend the program account for program upgrades. Defaults to true.

Outputs

  • Name
    signatures
    Description

    The computed transaction signatures, grouped by transaction type.

  • Name
    program_id
    Description

    The program ID of the deployed program.

Example using deploy_program

action "deploy" "svm::deploy_program" {
    description = "Deploy hello world program"
    program = svm::get_program_from_anchor_project("hello_world") 
    authority = signer.authority
    payer = signer.payer  # Optional, defaults to authority
}


action

send_sol

The svm::send_sol action encodes a transaction which sends SOL, signs it, and broadcasts it to the network.

Inputs

  • Name
    description
    Type
    optional
    Description

    A description of the transaction.

  • Name
    amount
    Type
    required
    Description

    The amount to send, in lamports (1 SOL = 10^9 lamports).

  • Name
    recipient
    Type
    required
    Description

    The SVM address of the recipient.

  • Name
    signer
    Type
    required
    Description

    A reference to a signer construct, which will be used to sign the transaction.

  • Name
    commitment_level
    Type
    optional
    Description

    The commitment level expected for considering this action as done ('processed', 'confirmed', 'finalized'). The default is 'confirmed'.

  • Name
    rpc_api_url
    Type
    required
    Description

    The URL to use when making API requests.

  • Name
    rpc_api_auth_token
    Type
    optional
    Description

    The HTTP authentication token to include in the headers when making API requests.

Outputs

  • Name
    signature
    Description

    The transaction computed signature.

Example using send_sol

action "send_sol" "svm::send_sol" {
    description = "Send some SOL"
    amount = svm::sol_to_lamports(1)
    signer = signer.caller
    recipient = "zbBjhHwuqyKMmz8ber5oUtJJ3ZV4B6ePmANfGyKzVGV"
}

action

send_token

The svm::send_token action encodes a transaction which sends the specified token, signs it, and broadcasts it to the network.

Inputs

  • Name
    description
    Type
    optional
    Description

    A description of the transaction.

  • Name
    amount
    Type
    required
    Description

    The amount of tokens to send, in base unit.

  • Name
    token
    Type
    required
    Description

    The program address for the token being sent. This is also known as the 'token mint account'.

  • Name
    recipient
    Type
    required
    Description

    The SVM address of the recipient. The associated token account will be computed from this address and the token address.

  • Name
    authority
    Type
    optional
    Description

    The pubkey of the authority account for the token source. If omitted, the first signer will be used.

  • Name
    fund_recipient
    Type
    optional
    Description

    If set to true and the recipient token account does not exist, the action will create the account and fund it, using the signer to fund the account. The default is false.

  • Name
    signers
    Type
    required
    Description

    A set of references to a signer construct, which will be used to sign the transaction.

  • Name
    commitment_level
    Type
    optional
    Description

    The commitment level expected for considering this action as done ('processed', 'confirmed', 'finalized'). The default is 'confirmed'.

  • Name
    rpc_api_url
    Type
    required
    Description

    The URL to use when making API requests.

  • Name
    rpc_api_auth_token
    Type
    optional
    Description

    The HTTP authentication token to include in the headers when making API requests.

Outputs

  • Name
    signature
    Description

    The transaction computed signature.

  • Name
    recipient_token_address
    Description

    The recipient token account address.

  • Name
    source_token_address
    Description

    The source token account address.

  • Name
    token_mint_address
    Description

    The token mint address.

Example using send_token

action "send_sol" "svm::send_token" {
    description = "Send some SOL"
    amount = svm::sol_to_lamports(1)
    signers = [signer.caller]
    recipient = "zbBjhHwuqyKMmz8ber5oUtJJ3ZV4B6ePmANfGyKzVGV"
    token = "3bv3j4GvMPjvvBX9QdoX27pVoWhDSXpwKZipFF1QiVr6"
    fund_recipient = true
}

Was this page helpful?