scenario

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// Sender is the sender and signer of a transaction.
	Sender = "{{ SENDER }}"

	// SenderValue is the amount the sender is paying.
	SenderValue = "{{ SENDER_VALUE }}"

	// Recipient is the recipient of the transaction.
	Recipient = "{{ RECIPIENT }}"

	// RecipientValue is the amount the recipient is
	// receiving from the sender. Note, this is distinct
	// from the SenderValue so that UTXO transfers
	// can be supported.
	RecipientValue = "{{ RECIPIENT_VALUE }}"

	// CoinIdentifier is the globally unique identifier
	// of a UTXO. This should be in the Operation.metadata
	// of any UTXO-based blockchain ("utxo_created" when
	// a new UTXO is created and "utxo_spent" when a
	// UTXO is spent).
	CoinIdentifier = "{{ COIN_IDENTIFIER }}"

	// ChangeAddress is the recipient of change in a
	// UTXO transaction (surplus above recipient value).
	// TODO: generalize this to allow for generic
	// one-to-many sends.
	ChangeAddress = "{{ CHANGE_ADDRESS }}"

	// ChangeValue is the amount to send to the change
	// address.
	ChangeValue = "{{ CHANGE_VALUE }}"
)

Variables

This section is empty.

Functions

func PopulateScenario

func PopulateScenario(
	ctx context.Context,
	scenarioContext *Context,
	scenario []*types.Operation,
) ([]*types.Operation, error)

PopulateScenario populates a provided scenario (slice of []*types.Operation) with the information in Context.

Types

type Context

type Context struct {
	Sender         string
	SenderValue    *big.Int
	Recipient      string
	RecipientValue *big.Int
	CoinIdentifier *types.CoinIdentifier
	Currency       *types.Currency
	ChangeAddress  string
	ChangeValue    *big.Int
}

Context is all information passed to PopulateScenario. As more exotic scenario testing is supported, this will likely be expanded.

Jump to

Keyboard shortcuts

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