tx

package
v0.0.0-...-e9d501d Latest Latest
Warning

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

Go to latest
Published: May 9, 2024 License: Apache-2.0 Imports: 34 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

DefaultSignModes are the default sign modes enabled for protobuf transactions.

Functions

func BuildCreateMetaNodeMsg

func BuildCreateMetaNodeMsg(p2pPubKey fwcryptotypes.PubKey, depositAmount txclienttypes.Coin,
	ownerAddress fwtypes.WalletAddress, beneficiaryAddress fwtypes.WalletAddress) (*registerv1.MsgCreateMetaNode, error)

func BuildCreateResourceNodeMsg

func BuildCreateResourceNodeMsg(nodeType msgtypes.NodeType, p2pPubKey fwcryptotypes.PubKey, depositAmount txclienttypes.Coin,
	ownerAddress fwtypes.WalletAddress) (*registerv1.MsgCreateResourceNode, error)

func BuildFileUploadMsg

func BuildFileUploadMsg(fileHash string, from fwtypes.WalletAddress, reporterAddress fwtypes.P2PAddress,
	uploaderAddress fwtypes.WalletAddress) *sdsv1.MsgFileUpload

func BuildKickMetaNodeVoteMsg

func BuildKickMetaNodeVoteMsg(targetNetworkAddress fwtypes.P2PAddress, opinion bool, voterNetworkAddress fwtypes.P2PAddress,
	voterOwnerAddress fwtypes.WalletAddress) *registerv1.MsgKickMetaNodeVote

func BuildMetaNodeRegistrationVoteMsg

func BuildMetaNodeRegistrationVoteMsg(candidateNetworkAddress fwtypes.P2PAddress, candidateOwnerAddress fwtypes.WalletAddress,
	voterNetworkAddress fwtypes.P2PAddress, voterOwnerAddress fwtypes.WalletAddress, voteOpinion bool,
) *registerv1.MsgMetaNodeRegistrationVote

func BuildPrepayMsg

func BuildPrepayMsg(senderAddress fwtypes.WalletAddress, beneficiaryAddress fwtypes.WalletAddress, amount txclienttypes.Coin,
) *sdsv1.MsgPrepay

func BuildRemoveMetaNodeMsg

func BuildRemoveMetaNodeMsg(nodeAddress fwtypes.P2PAddress, ownerAddress fwtypes.WalletAddress,
) *registerv1.MsgRemoveMetaNode

func BuildRemoveResourceNodeMsg

func BuildRemoveResourceNodeMsg(nodeAddress fwtypes.P2PAddress, ownerAddress fwtypes.WalletAddress,
) *registerv1.MsgRemoveResourceNode

func BuildSendMsg

func BuildSendMsg(senderAddress fwtypes.WalletAddress, toAddress fwtypes.WalletAddress, amount txclienttypes.Coin) *bankv1beta1.MsgSend

func BuildSlashingResourceNodeMsg

func BuildSlashingResourceNodeMsg(spP2pAddress []fwtypes.P2PAddress, spWalletAddress []fwtypes.WalletAddress,
	ppP2pAddress fwtypes.P2PAddress, ppWalletAddress fwtypes.WalletAddress, slashingAmount *big.Int, suspend bool,
) *potv1.MsgSlashingResourceNode

func BuildTxBytes

func BuildTxBytes(txConfig TxConfig, unsignedTx *txv1beta1.Tx, chainId string, unsignedMsgs []*types.UnsignedMsg) ([]byte, error)

func BuildUpdateEffectiveDepositMsg

func BuildUpdateEffectiveDepositMsg(spP2pAddress []fwtypes.P2PAddress, spWalletAddress []fwtypes.WalletAddress,
	ppP2pAddress fwtypes.P2PAddress, newEffectiveDeposit *big.Int) *registerv1.MsgUpdateEffectiveDeposit

func BuildUpdateMetaNodeDepositMsg

func BuildUpdateMetaNodeDepositMsg(networkAddr fwtypes.P2PAddress, ownerAddr fwtypes.WalletAddress,
	depositDelta txclienttypes.Coin) *registerv1.MsgUpdateMetaNodeDeposit

func BuildUpdateResourceNodeDepositMsg

func BuildUpdateResourceNodeDepositMsg(networkAddr fwtypes.P2PAddress, ownerAddr fwtypes.WalletAddress,
	depositDelta txclienttypes.Coin) *registerv1.MsgUpdateResourceNodeDeposit

func BuildVolumeReportMsg

func BuildVolumeReportMsg(traffic []*txclienttypes.Traffic, reporterAddress fwtypes.P2PAddress, reporterOwnerAddress fwtypes.WalletAddress, epoch uint64,
	reportReference string, blsTxDataHash, blsSignature []byte, blsPubKeys [][]byte) (*potv1.MsgVolumeReport, []byte, error)

func BuildWithdrawMsg

func BuildWithdrawMsg(amount txclienttypes.Coin, senderAddress fwtypes.WalletAddress, targetAddress fwtypes.WalletAddress,
) *potv1.MsgWithdraw

func CreateAndSimulateTx

func CreateAndSimulateTx(msg *anypb.Any, txFee types.TxFee, memo string,
	signatureKeys []*types.SignatureKey, chainId string, gasAdjustment float64) ([]byte, error)

func DirectSignBytes

func DirectSignBytes(bodyBytes, authInfoBytes []byte, chainID string, accnum uint64) ([]byte, error)

DirectSignBytes returns the SIGN_MODE_DIRECT sign bytes for the provided TxBody bytes, AuthInfo bytes, chain ID, account number and sequence.

func SetSignatures

func SetSignatures(tx *txv1beta1.Tx, signatures ...signing.SignatureV2) (*txv1beta1.Tx, error)

func SignWithPrivKey

func SignWithPrivKey(
	signMode signingv1beta1.SignMode, signerData authsigning.SignerData,
	tx *txv1beta1.Tx, priv fwcryptotypes.PrivKey, txConfig TxConfig,
	accSeq uint64,
) (txsigning.SignatureV2, error)

SignWithPrivKey signs a given tx with the given private key, and returns the corresponding SignatureV2 if the signing is successful.

Types

type TxConfig

type TxConfig interface {
	SignModeHandler() signing.SignModeHandler
}

TxConfig defines an interface a client can utilize to generate an application-defined concrete transaction type. The type returned must implement TxBuilder.

func CreateTxConfigAndTxBuilder

func CreateTxConfigAndTxBuilder() (TxConfig, *txv1beta1.Tx)

func NewTxConfig

func NewTxConfig(enabledSignModes []signingv1beta1.SignMode) TxConfig

NewTxConfig returns a new protobuf TxConfig using the provided ProtoCodec and sign modes. The first enabled sign mode will become the default sign mode. NOTE: Use NewTxConfigWithHandler to provide a custom signing handler in case the sign mode is not supported by default (eg: SignMode_SIGN_MODE_EIP_191).

func NewTxConfigWithHandler

func NewTxConfigWithHandler(handler authsigning.SignModeHandler) TxConfig

NewTxConfig returns a new protobuf TxConfig using the provided ProtoCodec and signing handler.

Jump to

Keyboard shortcuts

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