update

package
v0.1.0-alpha.0...-0b1224c Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2019 License: Apache-2.0, Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	ID       string
	Balance  uint64
	Balances map[string]fsm.Balance
	Reserve  uint64
}

Account is the identity and balance of a Stellar account, for use in updates. TODO(debnil): Change Balance to NativeBalance later; will break front-end.

type Config

type Config struct {
	Username   string `json:",omitempty"`
	Password   string `json:",omitempty"` // always "[redacted]" if set
	HorizonURL string `json:",omitempty"`

	MaxRoundDurMins   int64      `json:",omitempty"`
	FinalityDelayMins int64      `json:",omitempty"`
	ChannelFeerate    xlm.Amount `json:",omitempty"`
	HostFeerate       xlm.Amount `json:",omitempty"`

	KeepAlive bool `json:",omitempty"`
}

Config has user-facing, primary options for the Starlight agent WARNING: this software is not compatible with Stellar mainnet.

type Type

type Type string

Type is the type of an update-type constant.

const (
	InitType      Type = "init"
	ConfigType    Type = "config"
	AccountType   Type = "account"
	ChannelType   Type = "channel"
	WarningType   Type = "warning"
	TxSuccessType Type = "tx_success"
	TxFailureType Type = "tx_failed"
)

Update-type constants.

type Update

type Update struct {
	// Type denotes what kind of state change this value represents.
	// If Type is Init or Config, field Config will be set.
	// along with one of the InputX fields.
	// If Type is Channel, field Channel will be set,
	// along with one of the InputX fields.
	// If Type is Warning, field Warning will be set.
	Type Type

	// UpdateNum is the number of this update.
	// Each update is assigned a number in a contiguous sequence:
	// 1, 2, 3, etc.
	UpdateNum uint64

	// Account describes the account ID this update affects and
	// the balance of the account. This field is set for every
	// update type.
	Account *Account

	Config *Config `json:",omitempty"`

	// Channel describes the result of a channel state transition.
	// It is set when Type is channel.
	Channel *fsm.Channel

	// The InputX fields describe input events handled by the channel.
	// When Type is channel or account, one of these fields will be set,
	// to show how the channel arrived at its new state.
	InputCommand    *fsm.Command
	InputMessage    *fsm.Message
	InputTx         *worizon.Tx
	InputLedgerTime time.Time

	// UpdateLedgerTime is the ledger time of this update.
	// Not to be confused with InputLedgerTime.
	UpdateLedgerTime time.Time

	// In some cases when InputTx is set, this field might be set to show
	// which particular operation was responsible for the state change.
	OpIndex int

	Warning string

	// if this update included an outgoing transaction from the wallet account,
	// this is its sequence number (as a string, so JS can read it)
	PendingSequence string
}

Update is a record of some state change in a Starlight agent that should be reflected to the user.

func (*Update) MarshalJSON

func (u *Update) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler. Required for genbolt.

func (*Update) UnmarshalJSON

func (u *Update) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler. Required for genbolt.

Jump to

Keyboard shortcuts

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