gen

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: May 23, 2024 License: Apache-2.0 Imports: 12 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	NilInputGetterError      = fmt.Errorf("error nil input getter")
	NotEnoughValueError      = fmt.Errorf("error unable to find enough value to spend")
	NotEnoughTokenValueError = fmt.Errorf("error unable to find enough token value to spend")
	BelowDustLimitError      = fmt.Errorf("error output below dust limit")
)

Functions

func AttachSignatureToInput

func AttachSignatureToInput(in *wire.TxIn, sig []byte, pkData []byte) error

func CreateWireTx

func CreateWireTx(inputs []memo.UTXO, outputs []*memo.Output) (*wire.MsgTx, error)

func FaucetTx

func FaucetTx(pkHash []byte, faucetGetter InputGetter, faucetKey wallet.PrivateKey) (*memo.Tx, memo.UTXO, error)

func GetAddressOutput

func GetAddressOutput(address wallet.Address, quantity int64) *memo.Output

func GetMemoTx

func GetMemoTx(tx *wire.MsgTx, utxos []memo.UTXO, outputs []*memo.Output) *memo.Tx

func GetNonPointerTxInputs

func GetNonPointerTxInputs(pointerTxInputs []*memo.TxInput) []memo.TxInput

func InputSignature

func InputSignature(tx *wire.MsgTx, index int, keyRing wallet.KeyRing, spendOuts []memo.TxInput) ([]byte, error)

func InputSignatureSingle

func InputSignatureSingle(tx *wire.MsgTx, index int, privateKey wallet.PrivateKey, prevOut memo.Out) ([]byte, error)

func Multi

func Multi(request MultiRequest) ([]*memo.Tx, error)

func Sign

func Sign(msg *wire.MsgTx, inputs []memo.TxInput, keyRing wallet.KeyRing) error

func Tx

func Tx(request TxRequest) (*memo.Tx, error)

func TxUnsigned

func TxUnsigned(request TxRequest) (*memo.Tx, error)

Types

type Create

type Create struct {
	Request         TxRequest
	PotentialInputs []memo.UTXO
	InputsToUse     []memo.UTXO
	Outputs         []*memo.Output
}

func (*Create) Build

func (c *Create) Build() (*wire.MsgTx, error)

func (Create) CheckOutputs

func (c Create) CheckOutputs() error

func (Create) GetQuickMemoTx

func (c Create) GetQuickMemoTx() *memo.Tx

func (*Create) Sign

func (c *Create) Sign(msg *wire.MsgTx, keyRing wallet.KeyRing) error

type FaucetSaver

type FaucetSaver interface {
	Save(userPkHash []byte, faucetPkHash []byte, fundTxHash []byte, memoTxHash []byte) error
	IsFreeTx([]*memo.Output) bool
	GetKey() wallet.PrivateKey
}

type InputGetter

type InputGetter interface {
	SetPkHashesToUse([][]byte)
	GetUTXOs(*memo.UTXORequest) ([]memo.UTXO, error)
	MarkUTXOsUsed([]memo.UTXO)
	AddChangeUTXO(memo.UTXO)
	NewTx()
}

func GetWrapper

func GetWrapper(getter InputGetterOld, pkHash []byte) InputGetter

func GetWrapperMultiKey

func GetWrapperMultiKey(getter InputGetterOld, pkHashes [][]byte) InputGetter

type InputGetterOld

type InputGetterOld interface {
	SetPkHashesToUse([][]byte)
	GetUTXOsOld(*memo.UTXORequest) ([]memo.UTXO, error)
}

type InputGetterWrapper

type InputGetterWrapper struct {
	Old      InputGetterOld
	PkHashes [][]byte
	UTXOs    []memo.UTXO
	Used     []memo.UTXO
	// contains filtered or unexported fields
}

func (*InputGetterWrapper) AddChangeUTXO

func (w *InputGetterWrapper) AddChangeUTXO(utxo memo.UTXO)

func (InputGetterWrapper) GetPkHashes

func (w InputGetterWrapper) GetPkHashes() [][]byte

func (*InputGetterWrapper) GetUTXOs

func (w *InputGetterWrapper) GetUTXOs(request *memo.UTXORequest) ([]memo.UTXO, error)

func (*InputGetterWrapper) MarkUTXOsUsed

func (w *InputGetterWrapper) MarkUTXOsUsed(utxos []memo.UTXO)

func (*InputGetterWrapper) NewTx

func (w *InputGetterWrapper) NewTx()

func (*InputGetterWrapper) SetPkHashesToUse

func (w *InputGetterWrapper) SetPkHashesToUse(pkHashes [][]byte)

type MultiRequest

type MultiRequest struct {
	Outputs      []*memo.Output
	Getter       InputGetter
	FaucetGetter InputGetter
	FaucetSaver  FaucetSaver
	InputsToUse  []memo.UTXO
	KeyRing      wallet.KeyRing
	Change       wallet.Change
}

type TxRequest

type TxRequest struct {
	Getter      InputGetter
	InputsToUse []memo.UTXO
	Outputs     []*memo.Output
	Change      wallet.Change
	KeyRing     wallet.KeyRing
}

func (TxRequest) GetTokenHash

func (r TxRequest) GetTokenHash() []byte

func (TxRequest) GetTokenSendOutput

func (r TxRequest) GetTokenSendOutput() *script.TokenSend

Jump to

Keyboard shortcuts

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