txutils

package
v0.13.2-rc.3 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2024 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Overview

Copyright (C) 2022, Ava Labs, Inc. All rights reserved. See the file LICENSE for licensing terms.

Copyright (C) 2022, Ava Labs, Inc. All rights reserved. See the file LICENSE for licensing terms.

Copyright (C) 2022, Ava Labs, Inc. All rights reserved. See the file LICENSE for licensing terms.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAuthSigners

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

get all subnet auth addresses that are required to sign a given tx

  • get subnet control keys as string slice using P-Chain API (GetOwners)
  • get subnet auth indices from the tx, field tx.UnsignedTx.SubnetAuth
  • creates the string slice of required subnet auth addresses by applying the indices to the control keys slice

expect tx.Unsigned type to be in: - txs.CreateChainTx - txs.AddSubnetValidatorTx - txs.RemoveSubnetValidatorTx

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

func GetLedgerDisplayName

func GetLedgerDisplayName(tx *txs.Tx) string

func GetNetwork

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

get network model associated to tx

func GetOwners

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

func GetRemainingSigners

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

get subnet auth addresses that did not yet signed a given tx

  • get the string slice of auth signers for the tx (GetAuthSigners)
  • verifies that all creds in tx.Creds, except the last one, are fully signed (a cred is fully signed if all the signatures in cred.Sigs are non-empty)
  • computes remaining signers by iterating the last cred in tx.Creds, associated to subnet auth signing
  • for each sig in cred.Sig: if sig is empty, then add the associated auth signer address (obtained from authSigners by using the index) to the remaining signers list

if the tx is fully signed, returns empty slice expect tx.Unsigned type to be in [txs.AddSubnetValidatorTx, txs.CreateChainTx]

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

func GetSubnetID

func GetSubnetID(tx *txs.Tx) (ids.ID, error)

get subnet id associated to tx

func IsCreateChainTx

func IsCreateChainTx(tx *txs.Tx) bool

func IsTransferSubnetOwnershipTx

func IsTransferSubnetOwnershipTx(tx *txs.Tx) bool

func LoadFromDisk

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

loads a tx from [txPath]

func SaveToDisk

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

saves a given [tx] to [txPath]

Types

This section is empty.

Jump to

Keyboard shortcuts

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