txutils

package
v0.0.0-...-d0c3903 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2023 License: BSD-3-Clause Imports: 10 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, network models.Network, subnetID ids.ID) ([]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.AddSubnetValidatorTx, txs.CreateChainTx]

func GetNetwork

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

get network model associated to tx expect tx.Unsigned type to be in [txs.AddSubnetValidatorTx, txs.CreateChainTx]

func GetRemainingSigners

func GetRemainingSigners(tx *txs.Tx, network models.Network, subnetID ids.ID) ([]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 remaning 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]

func IsCreateChainTx

func IsCreateChainTx(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