txutils

package
v1.102.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 30, 2026 License: BSD-3-Clause Imports: 15 Imported by: 0

Documentation

Overview

Package txutils provides transaction utilities for creating, signing, and managing transactions.

Package txutils provides utilities for transaction handling and processing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAuthSigners

func GetAuthSigners(tx *txs.Tx, controlKeys []string) ([]string, error)

GetAuthSigners returns all network/chain auth addresses required to sign a tx. It reads the auth-indices on the tx and resolves them against controlKeys (the network's or chain's owner key set, as returned by GetOwners).

Expected tx.Unsigned types are the chain-owner-authorized forms: CreateChainTx, ConvertNetworkToL1Tx, plus the legacy AddChainValidatorTx and RemoveChainValidatorTx (kept here for one release cycle while the sovereign-L1 model phases in; new validator adds use AddValidatorTx which is NOT chain-owner-authorized and therefore never appears here). controlKeys must be in the same order as in the owning tx (per GetOwners).

func GetLedgerDisplayName

func GetLedgerDisplayName(tx *txs.Tx) string

GetLedgerDisplayName returns the display name for a tx on the ledger.

func GetNetwork

func GetNetwork(tx *txs.Tx) (models.Network, error)

GetNetwork returns the network model associated with a tx. Handles the chain-owner-authorized forms (CreateChainTx, ConvertNetworkToL1Tx) and the legacy AddChainValidatorTx / RemoveChainValidatorTx — kept here for one release cycle while the sovereign-L1 model phases in.

func GetOwners

func GetOwners(network models.Network, chainID ids.ID) (bool, []string, uint32, error)

GetOwners returns ownership information in the legacy format (for backward compatibility)

func GetRemainingSigners

func GetRemainingSigners(tx *txs.Tx, controlKeys []string) ([]string, []string, error)

GetRemainingSigners returns chain auth addresses that have not yet signed a given tx. It verifies that all creds in tx.Creds (except the last one) are fully signed, and computes remaining signers by iterating the last cred in tx.Creds. If the tx is fully signed, returns empty slice.

controlKeys must be in the same order as in the chain creation tx (as obtained by GetOwners).

func IsCreateChainTx

func IsCreateChainTx(tx *txs.Tx) bool

IsCreateChainTx returns true if the tx is a CreateChainTx.

func LoadFromDisk

func LoadFromDisk(txPath string) (*txs.Tx, error)

LoadFromDisk loads a tx from the specified path.

func SaveToDisk

func SaveToDisk(tx *txs.Tx, txPath string, forceOverwrite bool) error

SaveToDisk saves a given tx to the specified path.

Types

type ChainOwners added in v1.13.7

type ChainOwners struct {
	IsPermissioned bool
	ControlKeys    []string
	Threshold      uint32
}

ChainOwners contains the ownership information for a chain

func GetChainOwners added in v1.13.7

func GetChainOwners(network models.Network, chainID ids.ID) (*ChainOwners, error)

GetChainOwners retrieves ownership information for a chain

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL