Solana and SVM Compatible Blockchains (beta) Actions

action

process_instructions

The svm::process_instructions action encodes instructions, adds them to a transaction, and signs & broadcasts the transaction.

Inputs

  • Name
    description
    Required
    optional
    Type
    string
    Description

    A description of the transaction.

  • Name
    instruction
    Required
    required
    Type
    map
    Description

    The instructions to add to the transaction. This is a map type containing the keys:

    • raw_bytes: The serialized instruction bytes. Use this field in place of the other instructions if direct instruction bytes would like to be used.
    • program_id: The SVM address of the program being invoked. If omitted, the program_id will be pulled from the idl.
    • program_idl: The IDL of the program being invoked.
    • instruction_name: The name of the instruction being invoked.
    • instruction_args: The arguments to the instruction being invoked.
  • Name
    signers
    Required
    required
    Type
    array[string]
    Description

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

  • Name
    commitment_level
    Required
    optional
    Type
    string
    Description

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

  • Name
    rpc_api_url
    Required
    required
    Type
    string
    Description

    The URL to use when making API requests.

  • Name
    rpc_api_auth_token
    Required
    optional
    Type
    string
    Description

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

  • Name
    pre_condition
    Required
    optional
    Type
    map
    Description

    Pre-conditions are assertions that are evaluated before a command is executed. They can be used to determine if the command should be executed or if a specific behavior should be executed based on the result of the assertion. This is a map type containing the keys:

    • behavior: The behavior if the pre-condition assertion does not pass. Possible values are:

      • halt (default): Throws an error and halts execution of the runbook
      • log: Logs a warning and continues execution of the runbook
      • skip: Skips execution of this command and all downstream commands
    • assertion: The assertion to check to determine if the pre-condition behavior should be executed. This value should evaluate to a boolean, or the std::assert_eq and other assertions from the standard library can be used.

  • Name
    post_condition
    Required
    optional
    Type
    map
    Description

    Post-conditions are assertions that are evaluated after a command is executed. They can be used to determine if the command should be re-executed or if a specific behavior should be executed based on the result of the assertion. This is a map type containing the keys:

    • retries: If the post-condition assertion fails, the number of times to re-execute the command before executing the post-condition behavior. The default is 0.

    • backoff_ms: If the post-condition assertion fails, the number of milliseconds to wait before re-executing the command. If not specified, the default is 1000 milliseconds (1 second).

    • behavior: The behavior if the post-condition assertion does not pass. Possible values are:

      • halt (default): Throws an error and halts execution of the runbook
      • log: Logs a warning and continues execution of the runbook
      • skip: Skips execution of this command and all downstream commands
      • continue: Continues execution without any action
    • assertion: The assertion to check to determine if the command should be re-executed or if the post-condition behavior should be executed. This value should evaluate to a boolean, or the std::assert_eq and other assertions from the standard library can be used.

Outputs

  • Name
    signature
    Type
    string
    Description

    The transaction computed signature.

Example using process_instructions

action "program_call" "svm::process_instructions" {
    description = "Invoke instructions"
    instruction {
        program_idl = variable.program.idl
        instruction_name = "initialize"
        instruction_args = [1]
        payer {
            public_key = signer.payer.public_key
        }
    }
    signers = [signer.caller]
}


action

deploy_program

svm::deploy_program deploys a Solana program to the specified SVM-compatible network.

Inputs

  • Name
    description
    Required
    optional
    Type
    string
    Description

    A description of the deployment action.

  • Name
    program
    Required
    required
    Type
    object
    Description

    The Solana program artifacts to deploy. This is an object type containing the keys:

    • idl: The program idl.
    • binary: The program binary.
    • keypair: The program keypair.
    • program_id: The program id.
  • Name
    payer
    Required
    optional
    Type
    string
    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
    Required
    required
    Type
    string
    Description

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

  • Name
    commitment_level
    Required
    optional
    Type
    string
    Description

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

  • Name
    auto_extend
    Required
    optional
    Type
    bool
    Description

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

  • Name
    instant_surfnet_deployment
    Required
    optional
    Type
    bool
    Description

    If set to true, deployments to a Surfnet will be instantaneous, deploying via a cheatcode to directly write to the program account, rather than sending transactions. Defaults to false.

  • Name
    ephemeral_authority_secret_key
    Required
    optional
    Type
    string
    Description

    An optional base-58 encoded keypair string to use as the temporary upgrade authority during deployment. If not provided, a new ephemeral keypair will be generated.

  • Name
    buffer_account_pubkey
    Required
    optional
    Type
    string
    Description

    The public key of the buffer account to use to continue a failed deployment.

  • Name
    pre_condition
    Required
    optional
    Type
    map
    Description

    Pre-conditions are assertions that are evaluated before a command is executed. They can be used to determine if the command should be executed or if a specific behavior should be executed based on the result of the assertion. This is a map type containing the keys:

    • behavior: The behavior if the pre-condition assertion does not pass. Possible values are:

      • halt (default): Throws an error and halts execution of the runbook
      • log: Logs a warning and continues execution of the runbook
      • skip: Skips execution of this command and all downstream commands
    • assertion: The assertion to check to determine if the pre-condition behavior should be executed. This value should evaluate to a boolean, or the std::assert_eq and other assertions from the standard library can be used.

  • Name
    post_condition
    Required
    optional
    Type
    map
    Description

    Post-conditions are assertions that are evaluated after a command is executed. They can be used to determine if the command should be re-executed or if a specific behavior should be executed based on the result of the assertion. This is a map type containing the keys:

    • retries: If the post-condition assertion fails, the number of times to re-execute the command before executing the post-condition behavior. The default is 0.

    • backoff_ms: If the post-condition assertion fails, the number of milliseconds to wait before re-executing the command. If not specified, the default is 1000 milliseconds (1 second).

    • behavior: The behavior if the post-condition assertion does not pass. Possible values are:

      • halt (default): Throws an error and halts execution of the runbook
      • log: Logs a warning and continues execution of the runbook
      • skip: Skips execution of this command and all downstream commands
      • continue: Continues execution without any action
    • assertion: The assertion to check to determine if the command should be re-executed or if the post-condition behavior should be executed. This value should evaluate to a boolean, or the std::assert_eq and other assertions from the standard library can be used.

Outputs

  • Name
    signatures
    Type
    object
    Description

    The computed transaction signatures, grouped by transaction type.

  • Name
    program_id
    Type
    string
    Description

    The program ID of the deployed program.

  • Name
    program_idl
    Type
    string
    Description

    The program ID of the deployed program.

  • Name
    slot
    Type
    integer
    Description

    The slot at which the program was deployed.

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
    Required
    optional
    Type
    string
    Description

    A description of the transaction.

  • Name
    amount
    Required
    required
    Type
    integer
    Description

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

  • Name
    recipient
    Required
    required
    Type
    string
    Description

    The SVM address of the recipient.

  • Name
    signer
    Required
    required
    Type
    array[string]
    Description

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

  • Name
    commitment_level
    Required
    optional
    Type
    string
    Description

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

  • Name
    rpc_api_url
    Required
    required
    Type
    string
    Description

    The URL to use when making API requests.

  • Name
    rpc_api_auth_token
    Required
    optional
    Type
    string
    Description

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

  • Name
    pre_condition
    Required
    optional
    Type
    map
    Description

    Pre-conditions are assertions that are evaluated before a command is executed. They can be used to determine if the command should be executed or if a specific behavior should be executed based on the result of the assertion. This is a map type containing the keys:

    • behavior: The behavior if the pre-condition assertion does not pass. Possible values are:

      • halt (default): Throws an error and halts execution of the runbook
      • log: Logs a warning and continues execution of the runbook
      • skip: Skips execution of this command and all downstream commands
    • assertion: The assertion to check to determine if the pre-condition behavior should be executed. This value should evaluate to a boolean, or the std::assert_eq and other assertions from the standard library can be used.

  • Name
    post_condition
    Required
    optional
    Type
    map
    Description

    Post-conditions are assertions that are evaluated after a command is executed. They can be used to determine if the command should be re-executed or if a specific behavior should be executed based on the result of the assertion. This is a map type containing the keys:

    • retries: If the post-condition assertion fails, the number of times to re-execute the command before executing the post-condition behavior. The default is 0.

    • backoff_ms: If the post-condition assertion fails, the number of milliseconds to wait before re-executing the command. If not specified, the default is 1000 milliseconds (1 second).

    • behavior: The behavior if the post-condition assertion does not pass. Possible values are:

      • halt (default): Throws an error and halts execution of the runbook
      • log: Logs a warning and continues execution of the runbook
      • skip: Skips execution of this command and all downstream commands
      • continue: Continues execution without any action
    • assertion: The assertion to check to determine if the command should be re-executed or if the post-condition behavior should be executed. This value should evaluate to a boolean, or the std::assert_eq and other assertions from the standard library can be used.

Outputs

  • Name
    signature
    Type
    string
    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
    Required
    optional
    Type
    string
    Description

    A description of the transaction.

  • Name
    amount
    Required
    required
    Type
    integer
    Description

    The amount of tokens to send, in base unit.

  • Name
    token
    Required
    required
    Type
    string
    Description

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

  • Name
    recipient
    Required
    required
    Type
    string
    Description

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

  • Name
    authority
    Required
    optional
    Type
    string
    Description

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

  • Name
    fund_recipient
    Required
    optional
    Type
    bool
    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
    Required
    required
    Type
    array[string]
    Description

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

  • Name
    commitment_level
    Required
    optional
    Type
    string
    Description

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

  • Name
    rpc_api_url
    Required
    required
    Type
    string
    Description

    The URL to use when making API requests.

  • Name
    rpc_api_auth_token
    Required
    optional
    Type
    string
    Description

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

  • Name
    pre_condition
    Required
    optional
    Type
    map
    Description

    Pre-conditions are assertions that are evaluated before a command is executed. They can be used to determine if the command should be executed or if a specific behavior should be executed based on the result of the assertion. This is a map type containing the keys:

    • behavior: The behavior if the pre-condition assertion does not pass. Possible values are:

      • halt (default): Throws an error and halts execution of the runbook
      • log: Logs a warning and continues execution of the runbook
      • skip: Skips execution of this command and all downstream commands
    • assertion: The assertion to check to determine if the pre-condition behavior should be executed. This value should evaluate to a boolean, or the std::assert_eq and other assertions from the standard library can be used.

  • Name
    post_condition
    Required
    optional
    Type
    map
    Description

    Post-conditions are assertions that are evaluated after a command is executed. They can be used to determine if the command should be re-executed or if a specific behavior should be executed based on the result of the assertion. This is a map type containing the keys:

    • retries: If the post-condition assertion fails, the number of times to re-execute the command before executing the post-condition behavior. The default is 0.

    • backoff_ms: If the post-condition assertion fails, the number of milliseconds to wait before re-executing the command. If not specified, the default is 1000 milliseconds (1 second).

    • behavior: The behavior if the post-condition assertion does not pass. Possible values are:

      • halt (default): Throws an error and halts execution of the runbook
      • log: Logs a warning and continues execution of the runbook
      • skip: Skips execution of this command and all downstream commands
      • continue: Continues execution without any action
    • assertion: The assertion to check to determine if the command should be re-executed or if the post-condition behavior should be executed. This value should evaluate to a boolean, or the std::assert_eq and other assertions from the standard library can be used.

Outputs

  • Name
    signature
    Type
    string
    Description

    The transaction computed signature.

  • Name
    recipient_token_address
    Type
    addon(svm::pubkey)
    Description

    The recipient token account address.

  • Name
    source_token_address
    Type
    addon(svm::pubkey)
    Description

    The source token account address.

  • Name
    token_mint_address
    Type
    addon(svm::pubkey)
    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
}

action

deploy_subgraph

svm::deploy_subgraph creates a live Graph QL database for your program.

This command takes a program ID to index, a block height to start indexing from, and a set of events to index. This data is encoded as a request and sent to your surfnet (when deploying to localhost) or to the Surfpool cloud services (when deploying to devnet or mainnet). When the request is received, the associated chain is indexed and the data is stored in a Graph QL database.

Inputs

  • Name
    description
    Required
    optional
    Type
    string
    Description

    A description of the subgraph.

  • Name
    subgraph_name
    Required
    optional
    Type
    string
    Description

    The name of the subgraph. This defaults to the event name.

  • Name
    program_id
    Required
    required
    Type
    string
    Description

    The ID of the program to index as a subgraph.

  • Name
    program_idl
    Required
    required
    Type
    string
    Description

    The IDL of the program, used to decode the data to be indexed.

  • Name
    slot
    Required
    optional
    Type
    integer
    Description

    The slot to start indexing from.

  • Name
    block_height
    Required
    optional
    Type
    integer
    Description

    Deprecated. Use slot instead.

  • Name
    event
    Required
    optional
    Type
    map
    Description

    A map of events to index in the subgraph. This is a map type containing the keys:

    • name: The name of the event, as indexed by the IDL, whose occurrences should be added to the subgraph.
    • field: A map of fields to index. This is a map type containing the keys:
      • name: The name of the field as it should appear in the subgraph.
      • description: A description of the field as it should appear in the subgraph schema.
      • idl_key: A key from the event's type in the IDL, indicating which argument from the IDL type to map to this field. By default, the field name is used.
      • indexed: Whether this field should be indexed in the subgraph. If true, the field will be indexed and can be used as a filter in the subgraph. The default is false.
    • intrinsic_fields: A map of intrinsic fields to index. For Event subgraphs, intrinsics are:
      • slot(indexed): The slot in which the event was emitted.
      • transactionSignature(indexed): The transaction signature in which the event was emitted.
  • Name
    pda
    Required
    optional
    Type
    map
    Description

    The PDA account to index in the subgraph This is a map type containing the keys:

    • type: The type field of the account, as indexed by the IDL. This type definition will be used to parse the PDA account data.
    • instruction: An instruction that contains the account to index in the subgraph. This is a map type containing the keys:
      • name: The name of the instruction that contains the account to index in the subgraph.
      • account_name: The name of the account in the instruction that contains the account to index in the subgraph.
    • field: A map of fields to index. This is a map type containing the keys:
      • name: The name of the field as it should appear in the subgraph.
      • description: A description of the field as it should appear in the subgraph schema.
      • idl_key: A key from the event's type in the IDL, indicating which argument from the IDL type to map to this field. By default, the field name is used.
      • indexed: Whether this field should be indexed in the subgraph. If true, the field will be indexed and can be used as a filter in the subgraph. The default is false.
    • intrinsic_fields: A map of intrinsic fields to index. For PDA subgraphs, intrinsics are:
      • slot(indexed): The slot in which the event was emitted.
      • pubkey(indexed): The public key of the account.
      • owner(not indexed): The owner of the account.
      • lamports(not indexed): The lamports of the account.
  • Name
    token_account
    Required
    optional
    Type
    map
    Description

    The token account to index in the subgraph This is a map type containing the keys:

    • instruction: An instruction that contains the account to index in the subgraph. This is a map type containing the keys:
      • name: The name of the instruction that contains the token account to index in the subgraph.
      • account_name: The name of the token account in the instruction.
    • intrinsic_fields: A map of fields to index that are intrinsic to token accounts. Token Account intrinsics are:
      • slot(indexed): The slot in which the instruction referencing the token account was invoked.
      • transactionSignature(indexed): The transaction signature in which the instruction referencing the token account was invoked.
      • pubkey(indexed): The public key of the token account (also known as the Associated Token Address).
      • owner(not indexed): The owner of the token account.
      • mint(not indexed): The mint of the token account.
      • tokenProgram(not indexed): The token program id.
      • amount(not indexed): A string representation of the amount of tokens in the account.
      • decimals(not indexed): The number of decimals for the token.
      • uiAmount(not indexed): The amount of tokens in the account, formatted as a number with the correct number of decimals.
      • uiAmountString(not indexed): The amount of tokens in the account, formatted as a string with the correct number of decimals.
      • lamports(not indexed): The lamports of the account.
  • Name
    pre_condition
    Required
    optional
    Type
    map
    Description

    Pre-conditions are assertions that are evaluated before a command is executed. They can be used to determine if the command should be executed or if a specific behavior should be executed based on the result of the assertion. This is a map type containing the keys:

    • behavior: The behavior if the pre-condition assertion does not pass. Possible values are:

      • halt (default): Throws an error and halts execution of the runbook
      • log: Logs a warning and continues execution of the runbook
      • skip: Skips execution of this command and all downstream commands
    • assertion: The assertion to check to determine if the pre-condition behavior should be executed. This value should evaluate to a boolean, or the std::assert_eq and other assertions from the standard library can be used.

  • Name
    post_condition
    Required
    optional
    Type
    map
    Description

    Post-conditions are assertions that are evaluated after a command is executed. They can be used to determine if the command should be re-executed or if a specific behavior should be executed based on the result of the assertion. This is a map type containing the keys:

    • retries: If the post-condition assertion fails, the number of times to re-execute the command before executing the post-condition behavior. The default is 0.

    • backoff_ms: If the post-condition assertion fails, the number of milliseconds to wait before re-executing the command. If not specified, the default is 1000 milliseconds (1 second).

    • behavior: The behavior if the post-condition assertion does not pass. Possible values are:

      • halt (default): Throws an error and halts execution of the runbook
      • log: Logs a warning and continues execution of the runbook
      • skip: Skips execution of this command and all downstream commands
      • continue: Continues execution without any action
    • assertion: The assertion to check to determine if the command should be re-executed or if the post-condition behavior should be executed. This value should evaluate to a boolean, or the std::assert_eq and other assertions from the standard library can be used.

Example using deploy_subgraph

action "transfer_event_subgraph" "svm::deploy_subgraph" {
    program_id = action.deploy.program_id
    program_idl = action.deploy.program_idl
    slot = action.deploy.slot
    event {
        name = "TransferEvent"
    }
}
action "account_index" "svm::deploy_subgraph" {
    program_id = action.deploy.program_id
    program_idl = action.deploy.program_idl
    slot = action.deploy.slot
    pda {
        type = "CustomAccount"
        instruction {
            name = "<instruction-using-this-account>"
            account_name = "<name-of-account-in-instruction>"
        }
        instruction {
            name = "<another-instruction-using-this-account>"
            account_name = "<name-of-account-in-instruction>"
        }
    }
}


action

setup_surfnet

svm::setup_surfnet can be used to configure a surfnet.

The following operations are supported:

  • set_account - used to set the lamports, owner, data, and executable fields of an account.
  • set_token_account - used to set the amount, delegate, delegated amount, and close authority for a token account.
  • clone_program_account - used to clone a program account from a source program id to a destination program id.
  • set_program_authority - used to set the authority of a program.
  • deploy_program - used to deploy a program (via a direct write to the account data rather than valid transactions) to the surfnet.
  • reset_account - used to reset an account on the surfnet, removing it from the local cache to be pulled again from the upstream.

Inputs

  • Name
    description
    Required
    optional
    Type
    string
    Description

    A description of the setup.

  • Name
    rpc_api_url
    Required
    required
    Type
    string
    Description

    The URL to use when making API requests.

  • Name
    set_account
    Required
    optional
    Type
    map
    Description

    The account data to set. This is a map type containing the keys:

    • public_key: The public key of the account to set.
    • lamports: The amount of lamports the account should be set to have.
    • data: The data to set in the account.
    • owner: The owner to set for the account.
    • executable: The executability state to set for the account.
    • rent_epoch: The epoch at which the account will be rent-exempt.
  • Name
    set_token_account
    Required
    optional
    Type
    map
    Description

    The token account data to set. This is a map type containing the keys:

    • public_key: The public key of the token owner account to update.
    • token: The token symbol or public key for the token.
    • token_program: The token program id. Valid values are token2020, token2022, or a public key.
    • amount: The amount of tokens to set.
    • delegate: The public key of the delegate to set.
    • delegated_amount: The amount of tokens to delegate.
    • close_authority: The public key of the close authority to set.
    • state: The state of the token account. Valid values are initialized, frozen, or uninitialized.
  • Name
    clone_program_account
    Required
    optional
    Type
    map
    Description

    The program clone data to set. This is a map type containing the keys:

    • source_program_id: The public key of the program to clone.
    • destination_program_id: The destination public key of the program.
  • Name
    set_program_authority
    Required
    optional
    Type
    map
    Description

    The program authority data to set. This is a map type containing the keys:

    • program_id: The public key of the program to set the authority for.
    • authority: The new authority for the program. If not provided, program's authority will be set to None.
  • Name
    deploy_program
    Required
    optional
    Type
    map
    Description

    The program deployment data to set. This is a map type containing the keys:

    • program_id: The public key of the program being deployed.
    • binary_path: The location of the program's .so file. (e.g. ./target/deploy/my_program.so)
    • authority: The public key of the authority over the program after it is deployed. If not provided, the program will have no authority.
    • idl_path: The location of the program's IDL file. (e.g. ./target/idl/my_program.json)
  • Name
    reset_account
    Required
    optional
    Type
    map
    Description

    The account reset data to set. This is a map type containing the keys:

    • public_key: The public key of the account to reset.
    • recursive: Whether to recursively delete all accounts owned by this account. Default is false.
  • Name
    pre_condition
    Required
    optional
    Type
    map
    Description

    Pre-conditions are assertions that are evaluated before a command is executed. They can be used to determine if the command should be executed or if a specific behavior should be executed based on the result of the assertion. This is a map type containing the keys:

    • behavior: The behavior if the pre-condition assertion does not pass. Possible values are:

      • halt (default): Throws an error and halts execution of the runbook
      • log: Logs a warning and continues execution of the runbook
      • skip: Skips execution of this command and all downstream commands
    • assertion: The assertion to check to determine if the pre-condition behavior should be executed. This value should evaluate to a boolean, or the std::assert_eq and other assertions from the standard library can be used.

  • Name
    post_condition
    Required
    optional
    Type
    map
    Description

    Post-conditions are assertions that are evaluated after a command is executed. They can be used to determine if the command should be re-executed or if a specific behavior should be executed based on the result of the assertion. This is a map type containing the keys:

    • retries: If the post-condition assertion fails, the number of times to re-execute the command before executing the post-condition behavior. The default is 0.

    • backoff_ms: If the post-condition assertion fails, the number of milliseconds to wait before re-executing the command. If not specified, the default is 1000 milliseconds (1 second).

    • behavior: The behavior if the post-condition assertion does not pass. Possible values are:

      • halt (default): Throws an error and halts execution of the runbook
      • log: Logs a warning and continues execution of the runbook
      • skip: Skips execution of this command and all downstream commands
      • continue: Continues execution without any action
    • assertion: The assertion to check to determine if the command should be re-executed or if the post-condition behavior should be executed. This value should evaluate to a boolean, or the std::assert_eq and other assertions from the standard library can be used.

Example using setup_surfnet

action "setup" "svm::setup_surfnet" {
    set_account {
        public_key = signer.caller.public_key
        lamports = 999999999
    }
    set_token_account {
        public_key = signer.caller.public_key
        token = "usdc"
        amount = 1000000
    }
    clone_program_account {
        source_program_id = "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v" // USDC program id
        destination_program_id = variable.my_program_id
    }
    set_program_authority {
        program_id = variable.my_program_id
        authority = signer.caller.public_key
    }
    deploy_program {
        program_id = variable.my_program_id
        binary_path = "./path/to/my_program.so"
    }
    reset_account {
        public_key = variable.some_pubkey
    }
}


action

create_class

The svm::create_class action is coming soon.

Inputs

  • Name
    description
    Required
    optional
    Type
    string
    Description

    A description of the record.

  • Name
    signer
    Required
    required
    Type
    array[string]
    Description

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

  • Name
    name
    Required
    required
    Type
    string
    Description

    The name of the class. This must be a valid UTF-8 string that is less than 256 bytes long.

  • Name
    metadata
    Required
    required
    Type
    string
    Description

    The metadata of the class. This must be a valid UTF-8 string.

  • Name
    is_permissioned
    Required
    optional
    Type
    bool
    Description

    Whether the class is permissioned. The default is true.

  • Name
    is_frozen
    Required
    optional
    Type
    bool
    Description

    Whether the class is frozen. The default is false.

  • Name
    rpc_api_url
    Required
    required
    Type
    string
    Description

    The URL to use when making API requests.

  • Name
    rpc_api_auth_token
    Required
    optional
    Type
    string
    Description

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

  • Name
    pre_condition
    Required
    optional
    Type
    map
    Description

    Pre-conditions are assertions that are evaluated before a command is executed. They can be used to determine if the command should be executed or if a specific behavior should be executed based on the result of the assertion. This is a map type containing the keys:

    • behavior: The behavior if the pre-condition assertion does not pass. Possible values are:

      • halt (default): Throws an error and halts execution of the runbook
      • log: Logs a warning and continues execution of the runbook
      • skip: Skips execution of this command and all downstream commands
    • assertion: The assertion to check to determine if the pre-condition behavior should be executed. This value should evaluate to a boolean, or the std::assert_eq and other assertions from the standard library can be used.

  • Name
    post_condition
    Required
    optional
    Type
    map
    Description

    Post-conditions are assertions that are evaluated after a command is executed. They can be used to determine if the command should be re-executed or if a specific behavior should be executed based on the result of the assertion. This is a map type containing the keys:

    • retries: If the post-condition assertion fails, the number of times to re-execute the command before executing the post-condition behavior. The default is 0.

    • backoff_ms: If the post-condition assertion fails, the number of milliseconds to wait before re-executing the command. If not specified, the default is 1000 milliseconds (1 second).

    • behavior: The behavior if the post-condition assertion does not pass. Possible values are:

      • halt (default): Throws an error and halts execution of the runbook
      • log: Logs a warning and continues execution of the runbook
      • skip: Skips execution of this command and all downstream commands
      • continue: Continues execution without any action
    • assertion: The assertion to check to determine if the command should be re-executed or if the post-condition behavior should be executed. This value should evaluate to a boolean, or the std::assert_eq and other assertions from the standard library can be used.

Outputs

  • Name
    signature
    Type
    string
    Description

    The transaction computed signature.

  • Name
    name
    Type
    string
    Description

    The name of the class.

  • Name
    metadata
    Type
    string
    Description

    The metadata of the class.

  • Name
    public_key
    Type
    string
    Description

    The public key of the created class.

Example using create_class

action "my_class" "svm::create_class" {
    name = "my_class"
    metadata = "metadata string"
    is_permissioned = true
    is_frozen = false
    signer = signer.creator
}


action

create_record

The svm::create_record action is coming soon.

Inputs

  • Name
    description
    Required
    optional
    Type
    string
    Description

    A description of the record.

  • Name
    owner
    Required
    required
    Type
    array[string]
    Description

    A reference to a signer construct, which will be used to sign the transaction and will be the owner of the record.

  • Name
    authority
    Required
    required
    Type
    array[string]
    Description

    An optional reference to a signer construct, which will be used to sign the transaction and will be the authority on the record.

  • Name
    class
    Required
    required
    Type
    string
    Description

    The public key of the class to which the record belongs.

  • Name
    name
    Required
    required
    Type
    string
    Description

    The name of the record. This must be a valid UTF-8 string that is less than 256 bytes long.

  • Name
    data
    Required
    required
    Type
    string
    Description

    The data of the record. This must be a valid UTF-8 string.

  • Name
    expiration
    Required
    optional
    Type
    integer
    Description

    The expiration time of the record, in seconds since the Unix epoch. If not provided, the record will not expire.

  • Name
    is_frozen
    Required
    optional
    Type
    bool
    Description

    Whether the record is frozen. The default is false.

  • Name
    rpc_api_url
    Required
    required
    Type
    string
    Description

    The URL to use when making API requests.

  • Name
    rpc_api_auth_token
    Required
    optional
    Type
    string
    Description

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

  • Name
    pre_condition
    Required
    optional
    Type
    map
    Description

    Pre-conditions are assertions that are evaluated before a command is executed. They can be used to determine if the command should be executed or if a specific behavior should be executed based on the result of the assertion. This is a map type containing the keys:

    • behavior: The behavior if the pre-condition assertion does not pass. Possible values are:

      • halt (default): Throws an error and halts execution of the runbook
      • log: Logs a warning and continues execution of the runbook
      • skip: Skips execution of this command and all downstream commands
    • assertion: The assertion to check to determine if the pre-condition behavior should be executed. This value should evaluate to a boolean, or the std::assert_eq and other assertions from the standard library can be used.

  • Name
    post_condition
    Required
    optional
    Type
    map
    Description

    Post-conditions are assertions that are evaluated after a command is executed. They can be used to determine if the command should be re-executed or if a specific behavior should be executed based on the result of the assertion. This is a map type containing the keys:

    • retries: If the post-condition assertion fails, the number of times to re-execute the command before executing the post-condition behavior. The default is 0.

    • backoff_ms: If the post-condition assertion fails, the number of milliseconds to wait before re-executing the command. If not specified, the default is 1000 milliseconds (1 second).

    • behavior: The behavior if the post-condition assertion does not pass. Possible values are:

      • halt (default): Throws an error and halts execution of the runbook
      • log: Logs a warning and continues execution of the runbook
      • skip: Skips execution of this command and all downstream commands
      • continue: Continues execution without any action
    • assertion: The assertion to check to determine if the command should be re-executed or if the post-condition behavior should be executed. This value should evaluate to a boolean, or the std::assert_eq and other assertions from the standard library can be used.

Outputs

  • Name
    signature
    Type
    string
    Description

    The transaction computed signature.

  • Name
    name
    Type
    string
    Description

    The name of the record.

  • Name
    data
    Type
    string
    Description

    The data of the record.

  • Name
    class
    Type
    string
    Description

    The public key of the associated class.

  • Name
    public_key
    Type
    string
    Description

    The public key of the created record.

Example using create_record

action "my_record" "svm::create_record" {
    name = "my_record"
    data = "data string"
    class = action.create_my_class.public_key
    owner = signer.owner
}


Was this page helpful?