Sigil documentation
ReferenceRust referencesigil-sdk

sigil-sdk · builder

Source declarations, signatures and documentation for builder.

Source: sigil/node/sigil-sdk/src/builder.rs. SHA-256: 379aa782af61eef3c41239de2ed9306df19c7f29975ba0aaf3ce6f6b71d8af73.

This reference follows declared source modules, retains conditional attributes, and includes public declarations and implementation methods. Private-module re-exports and trait resolution require the compiler; this is a source reference, not a claim that every listed item is a root import. Function bodies and constant values are omitted.

builder::sign_transaction

Sign an unsigned [Transaction] with an Ed25519 signing key.

Produces a [SignedTransaction] containing a real 64-byte Ed25519 signature over BLAKE3(TX_DOMAIN_TAG || serde_json::to_vec(&tx)) and the corresponding 32-byte compressed verifying key.

This is the canonical way to prepare a transaction for submission to a Sigil node via sigil_sendTransaction.

Errors

Returns [SdkError::TransactionBuildError] if the transaction cannot be serialized for signing.

Example

use ed25519_dalek::SigningKey;
use sigil_sdk::builder::{TransactionBuilder, sign_transaction};

let key = SigningKey::generate(&mut rand::rngs::OsRng);
let tx = TransactionBuilder::new("sigil-mainnet-1", "did:oas:prod:hmr:alice")
    .nonce(1)
    .unstake(5_000);
let signed = sign_transaction(tx, &key).expect("sign");
pub fn sign_transaction(
    tx: Transaction,
    signing_key: &SigningKey,
) -> Result<SignedTransaction, SdkError>;

Source line: 46.

builder::TransactionBuilder

A fluent builder for constructing unsigned Sigil transactions.

#[derive(Debug, Clone)]
pub struct TransactionBuilder {

}

Source line: 62.

builder::TransactionBuilder::new

Create a new builder for the given chain and sender.

pub fn new(chain_id: &str, sender_did: &str) -> Self;

Source line: 72.

builder::TransactionBuilder::nonce

Set the transaction nonce.

pub fn nonce(mut self, n: u64) -> Self;

Source line: 83.

builder::TransactionBuilder::gas_limit

Set the gas limit.

pub fn gas_limit(mut self, g: u64) -> Self;

Source line: 89.

builder::TransactionBuilder::gas_price

Set the gas price in micro-MINT.

pub fn gas_price(mut self, p: u64) -> Self;

Source line: 95.

builder::TransactionBuilder::register_identity

Build an identity registration transaction.

pub fn register_identity(
        self,
        did: &str,
        document: serde_json::Value,
        conformance_level: &str,
    ) -> Transaction;

Source line: 103.

builder::TransactionBuilder::stake

Build a stake transaction.

Errors

Returns [SdkError::TransactionBuildError] if the mode string is not "producer" or "validator".

pub fn stake(self, amount: u64, mode: &str) -> Result<Transaction, SdkError>;

Source line: 124.

builder::TransactionBuilder::unstake

Build an unstake transaction.

pub fn unstake(self, amount: u64) -> Transaction;

Source line: 141.

builder::TransactionBuilder::delegate

Build a delegation transaction.

pub fn delegate(self, validator_did: &str, amount: u64) -> Transaction;

Source line: 146.

builder::TransactionBuilder::undelegate

Build an undelegation transaction.

pub fn undelegate(self, validator_did: &str, shares: u64) -> Transaction;

Source line: 154.

builder::TransactionBuilder::claim_rewards

Build a claim-rewards transaction.

pub fn claim_rewards(self) -> Transaction;

Source line: 162.

builder::TransactionBuilder::propose

Build a governance proposal transaction.

pub fn propose(
        self,
        title: &str,
        description: &str,
        proposal_type: ProposalType,
        payload: serde_json::Value,
        deposit: u64,
    ) -> Transaction;

Source line: 172.

builder::TransactionBuilder::vote

Build a governance vote transaction.

Errors

Returns [SdkError::TransactionBuildError] if the choice string is not one of "yes", "no", "abstain", or "no_with_veto".

pub fn vote(self, proposal_id: &str, choice: &str) -> Result<Transaction, SdkError>;

Source line: 195.

builder::TransactionBuilder::register_contract_code

Build a public contract-code registration transaction.

pub fn register_contract_code(
        self,
        code: Vec<u8>,
        license_metadata: ContractLicenseMetadata,
    ) -> Transaction;

Source line: 218.

builder::TransactionBuilder::deploy_contract

Build a deployment transaction for code that was previously registered by RegisterContractCode or installed at genesis.

pub fn deploy_contract(
        self,
        contract_did: &str,
        controller_did: &str,
        code_hash: &str,
        zone_id: Option<String>,
    ) -> Transaction;

Source line: 235.

builder::TransactionBuilder::sponsored_setup

Build a setup-only sponsored transaction envelope.

The builder sender is the sponsor DID and pays the fee. The inner setup_tx_type must be one of the allowlisted setup actions enforced by the node executor.

pub fn sponsored_setup(
        self,
        subject_did: &str,
        setup_scope: SponsoredSetupScope,
        idempotency_key: &str,
        setup_tx_type: TransactionType,
        subject_public_key: Vec<u8>,
        subject_signature: Vec<u8>,
    ) -> Transaction;

Source line: 269.

builder::TransactionBuilder::initial_device_anchor

Build a setup-only initial device anchor transaction.

pub fn initial_device_anchor(self, data: InitialDeviceAnchorData) -> Transaction;

Source line: 291.

On this page