models

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2022 License: Apache-2.0 Imports: 2 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account added in v0.0.3

type Account struct {

	// Name eg: @username, must be globally unique
	Name string `json:"name"`

	// Signers list of public keys for an account
	Signers []string `json:"signers"`
}

Account for details about a destination account. An account can have a name like @treeder and the account details will have the list of signers and any other metadata.

type AddressRecord

type AddressRecord struct {
	TxID string `json:"txID,omitempty"`
}

AddressRecord is a mapping from a public address/key to it's most recent transaction To look up address data, get this tx_id value, then get the tx by ID (it's content hash).

type Broadcast

type Broadcast struct {
	FromTxID  string       `json:"fromTxID"`
	FromTx    *Transaction `json:"fromTx"`
	ToTxID    string       `json:"toTxID"`
	ToTx      *Transaction `json:"toTx"`
	FromState *State       `json:"fromState"`
	ToState   *State       `json:"toState"`
	CodeState []byte       `json:"codeState"`
}

type BroadcastMsg

type BroadcastMsg struct {
	PubKey string `json:"pubKey"`
	JWS    string `json:"jws"`
}

type CodeStateResponse

type CodeStateResponse struct {
	Message string      `json:"message"`
	State   interface{} `json:"state"`
}

type ObjectResponse

type ObjectResponse struct {
	Message string      `json:"message"`
	Object  interface{} `json:"object"`
}

type ServerTransaction

type ServerTransaction struct {
	FromTxID string // hash of transaction
	FromTx   *Transaction
	ToTxID   string // hash of transaction
	ToTx     *Transaction
}

type State

type State struct {
	Balance decimal.Decimal `json:"balance"`
	Nonce   int64           `json:"nonce"`

	// For contracts:
	// Code is the docker image to use, docker images start with `docker:`, webassembly can start with `wasm:`
	Code string `json:"code,omitempty"`
	// Contract state is arbitrary data state for the contract. This is the ID to that state.
	CodeStateID string `json:"codeStateID,omitempty"`
}

func NewState

func NewState() *State

type StateMessage

type StateMessage struct {
	State    *State       `json:"state"`
	LastTxID string       `json:"lastTxID"`
	LastTx   *Transaction `json:"lastTx"`
}

type Transaction

type Transaction struct {
	// Inputs:
	Nonce  int64           `json:"nonce"`
	From   string          `json:"from"`
	To     string          `json:"to"`
	Amount decimal.Decimal `json:"amount"`
	// Fee in EPIC. A transaction must include a fee. It can be in a wrapped transaction.
	Fee decimal.Decimal `json:"fee"`

	// Arguments for contracts
	Args []string `json:"args"`

	// ID is the transaction ID, this also it's CID on IPFS and therefore it's hash.
	// This is based on hashing all the other data EXCEPT this
	ID string `json:"id"`

	// Link to the current state document of this account
	StateID string `json:"stateID"`

	// RelatedTx is a link to a transaction when this user is the recipient
	// a tx is put into the recipients ledger with this field filled in which points to the senders transaction
	RelatedTxID string `json:"relatedTxID,omitempty"`

	// Contract stuff
	// Code is a reference to contract code. docker images must start with docker: and webassembly with wasm:
	Code string `json:"code,omitempty"`

	// chain bits
	CreatedAt time.Time `json:"createdAt"`
	// PreviousID is the previous transaction ID in the chain
	PreviousID string `json:"previousID"`

	// Wrapped is the next transaction in the chain, for instance a tx may be wrapped with a fee tx or an extra signature
	Wrapped    *Transaction `json:"wrapped"`
	WrappedJWS string       `json:"jws"`
}

Transaction From + Nonce make a globally unique ID

func NewTransaction

func NewTransaction() *Transaction

type TransactionInput

type TransactionInput struct {
	JWS string `json:"jws"`
}

type TransactionResponse

type TransactionResponse struct {
	Tx *Transaction `json:"tx"`
}

Jump to

Keyboard shortcuts

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