Documentation
¶
Overview ¶
Package txutils provides transaction utilities for creating, signing, and managing transactions.
Package txutils provides utilities for transaction handling and processing.
Index ¶
- func GetAuthSigners(tx *txs.Tx, controlKeys []string) ([]string, error)
- func GetLedgerDisplayName(tx *txs.Tx) string
- func GetNetwork(tx *txs.Tx) (models.Network, error)
- func GetOwners(network models.Network, chainID ids.ID) (bool, []string, uint32, error)
- func GetRemainingSigners(tx *txs.Tx, controlKeys []string) ([]string, []string, error)
- func IsCreateChainTx(tx *txs.Tx) bool
- func LoadFromDisk(txPath string) (*txs.Tx, error)
- func SaveToDisk(tx *txs.Tx, txPath string, forceOverwrite bool) error
- type ChainOwners
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetAuthSigners ¶
GetAuthSigners returns all chain auth addresses that are required to sign a given tx. It gets chain control keys as string slice using P-Chain API (GetOwners), gets chain auth indices from the tx (field tx.UnsignedTx.ChainAuth), and creates the string slice of required chain auth addresses by applying the indices to the control keys slice.
Expected tx.Unsigned types: txs.CreateChainTx, txs.AddChainValidatorTx, txs.RemoveChainValidatorTx. controlKeys must be in the same order as in the chain creation tx (as obtained by GetOwners).
func GetLedgerDisplayName ¶
GetLedgerDisplayName returns the display name for a tx on the ledger.
func GetNetwork ¶
GetNetwork returns the network model associated with a tx. Expected tx.Unsigned types: txs.AddChainValidatorTx, txs.CreateChainTx, etc.
func GetOwners ¶
GetOwners returns ownership information in the legacy format (for backward compatibility)
func GetRemainingSigners ¶
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 ¶
IsCreateChainTx returns true if the tx is a CreateChainTx.
func LoadFromDisk ¶
LoadFromDisk loads a tx from the specified path.
Types ¶
type ChainOwners ¶ added in v1.22.9
ChainOwners contains the ownership information for a chain
func GetChainOwners ¶ added in v1.22.9
GetChainOwners retrieves ownership information for a chain