action

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2018 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Overview

Copyright 2017-2018 OneLedger

An incoming transaction, send, swap, ready, verification, etc.

An incoming transaction, send, swap, ready, verification, etc.

An incoming transaction, send, swap, ready, verification, etc.

An incoming transaction, send, swap, ready, verification, etc.

An incoming transaction, send, swap, ready, verification, etc.

Handle arbitrary, but lossely typed parameters to the function calls

Parse the incoming transactions

TODO: switch from individual wire calls, to reading/writing directly to structs

Easy Access to Persistent App Data, if the persistent data isn't avoid stop immediately

An incoming transaction, send, swap, ready, verification, etc.

An incoming transaction, send, publish, ready, verification, etc.

Register this identity with the other nodes. As an externl identity

An incoming transaction, send, swap, ready, verification, etc.

An incoming transaction, send, swap, ready, verification, etc.

Declare basic types used by the Application

If a type requires functions or a few types are intertwinded, then should be in their own file.

An incoming transaction, send, swap, ready, verification, etc.

Index

Constants

View Source
const (
	NOSTAGE swapStageType = iota
	SWAP_MATCHING
	SWAP_MATCHED
	INITIATOR_INITIATE
	PARTICIPANT_PARTICIPATE
	INITIATOR_REDEEM
	PARTICIPANT_REDEEM
	WAIT_FOR_CHAIN
	SWAP_REFUND
	SWAP_FINISH
)

Variables

This section is empty.

Functions

func BroadcastTransaction

func BroadcastTransaction(ttype Type, transaction Transaction, sync bool)

Send out the transaction as an async broadcast

func CheckAmounts

func CheckAmounts(app interface{}, inputs []SendInput, outputs []SendOutput) bool

func CheckBalance

func CheckBalance(app interface{}, accountKey id.AccountKey, amount data.Coin) bool

func DelayedTransaction

func DelayedTransaction(ttype Type, transaction Transaction, waitTime time.Duration)

Execute a transaction after a specific delay. TODO: The node delays in a separate goroutine, but this should really be handled by the consensus engine, so that the delay is in the mempool.

func DeleteContract added in v0.7.0

func DeleteContract(app interface{}, contractKey []byte, nonce int64)

func DeleteSwap added in v0.7.0

func DeleteSwap(app interface{}, key id.AccountKey)

func FindContract added in v0.5.2

func FindContract(app interface{}, contractKey []byte, nonce int64) []byte

func FindEvent added in v0.5.2

func FindEvent(app interface{}, eventKey Event) bool

func GetAccount

func GetAccount(app interface{}, accountKey id.AccountKey) id.Account

func GetAccountKey

func GetAccountKey(value FunctionValue) id.AccountKey

func GetAccounts

func GetAccounts(app interface{}) *id.Accounts

func GetAdmin

func GetAdmin(app interface{}) data.Datastore

func GetAmount

func GetAmount(value FunctionValue) btcutil.Amount

func GetBool added in v0.7.0

func GetBool(value FunctionValue) *bool

func GetByte32 added in v0.5.0

func GetByte32(value FunctionValue) [32]byte

func GetBytes

func GetBytes(value FunctionValue) []byte

func GetChain added in v0.7.0

func GetChain(value FunctionValue) data.ChainType

func GetChainAccount

func GetChainAccount(app interface{}, name string, chain data.ChainType) id.Account

Map the identity to a specific account on a chain

func GetChainID added in v0.5.0

func GetChainID(app interface{}) string

func GetCoin

func GetCoin(value FunctionValue) data.Coin

func GetContract added in v0.5.2

func GetContract(value FunctionValue) common.Contract
func GetETHContract(value FunctionValue) *ethereum.HTLContract {
	switch value.(type) {
	case *ethereum.HTLContract:
		return value.(*ethereum.HTLContract)
	default:
		log.Fatal("Bad Type Cast in Function Parameter", "value", value)
	}
	return nil
}
func GetBTCContract(value FunctionValue) *bitcoin.HTLContract {
	switch value.(type) {
	case *bitcoin.HTLContract:
		return value.(*bitcoin.HTLContract)
	default:
		log.Fatal("Bad Type Cast in Function Parameter", "value", value)
	}
	return nil
}
func GetType(value FunctionValue) Type {
	switch value.(type) {
	case Type:
		return value.(Type)
	default:
		log.Fatal("Bad Type Cast in FUnction Parameter", "value", value)
	}
	return INVALID
}

func GetContracts added in v0.7.0

func GetContracts(app interface{}) data.Datastore

func GetEvent added in v0.5.2

func GetEvent(app interface{}) data.Datastore

func GetHeight added in v0.5.2

func GetHeight(app interface{}) int64

func GetIdentities

func GetIdentities(app interface{}) *id.Identities

func GetInt

func GetInt(value FunctionValue) int

func GetInt64

func GetInt64(value FunctionValue) int64

func GetNodeAccount added in v0.5.2

func GetNodeAccount(app interface{}) id.Account

func GetSigners added in v0.7.0

func GetSigners(owner []byte) []id.PublicKey

GetSigners will return the public keys of the signers

func GetStatus

func GetStatus(app interface{}) data.Datastore

func GetString

func GetString(value FunctionValue) string

func GetUtxo

func GetUtxo(app interface{}) *data.ChainState

func PackRequest

func PackRequest(request SignedTransaction) []byte

Pack a request into a transferable format (wire)

func SaveContract added in v0.5.2

func SaveContract(app interface{}, contractKey []byte, nonce int64, contract []byte)

func SaveEvent added in v0.5.2

func SaveEvent(app interface{}, eventKey Event, status bool)

func SaveSwap

func SaveSwap(app interface{}, swapKey []byte, transaction SwapInit)

func SignAndPack

func SignAndPack(transaction Transaction) []byte

func ValidateSignature added in v0.7.0

func ValidateSignature(transaction SignedTransaction) bool

Types

type Base

type Base struct {
	Type    Type   `json:"type"`
	ChainId string `json:"chain_id"`

	Owner  id.AccountKey `json:"owner"`
	Target id.AccountKey `json:"target"`

	Signers []PublicKey `json:"signers"`

	Sequence int64 `json:"sequence"`
	Delay    int64 `json:"delay"` // Pause the transaction in the mempool
}

Base Data for each type

type BoxLocker

type BoxLocker struct {
	Signature *btcec.Signature
	PubKey    *btcec.PublicKey
}

General BoxLocker struct to act as locker for any information exchange box of transactions, if verify valid then the lock can be release, otherwise box modified somehow

func (*BoxLocker) Sign

func (bl *BoxLocker) Sign(preImage []byte, nonce []byte, message Message) error

Sign the locker with preImage and nonce for message passed, the message should be the full information of Transaction. The nonce is used to preventing the 3rd party from get the message even through he get the preImage, where nonce should only be known by the participants of the message sharing

func (*BoxLocker) Verify

func (bl *BoxLocker) Verify(message Message) bool

Verify the pubKey with the signature for the message got.

type Command

type Command struct {
	// contains filtered or unexported fields
}

A command to execute again a chain, needs to be polymorphic

func (Command) Execute

func (command Command) Execute(app interface{}) (bool, FunctionValues)

type CommandType

type CommandType int
const (
	NOOP CommandType = iota
)

Set of possible commands that can be driven from a transaction

type Commands

type Commands []Command

func (Commands) Count

func (commands Commands) Count() int

func (Commands) Execute added in v0.7.0

func (cs Commands) Execute(app interface{}) status.Code

type Commit

type Commit struct {
	Base

	Target string `json:"target"`
}

TODO: This needs to be filled out properly, need a model for other-chain actions...

func (*Commit) ProcessCheck

func (transaction *Commit) ProcessCheck(app interface{}) status.Code

func (*Commit) ProcessDeliver

func (transaction *Commit) ProcessDeliver(app interface{}) status.Code

func (*Commit) Resolve

func (transaction *Commit) Resolve(app interface{}) Commands

func (*Commit) ShouldProcess

func (transaction *Commit) ShouldProcess(app interface{}) bool

func (*Commit) TransactionType added in v0.7.0

func (transaction *Commit) TransactionType() Type

func (*Commit) Validate

func (transaction *Commit) Validate() status.Code

type Event added in v0.5.2

type Event struct {
	Type        Type   `json:"type"`
	SwapKeyHash []byte `json:"swapkeyhash"`
	Step        int    `json:"step"`
}

func (Event) ToKey added in v0.5.2

func (e Event) ToKey() []byte

type ExternalLock

type ExternalLock struct {
	Base

	Gas     data.Coin    `json:"gas"`
	Fee     data.Coin    `json:"fee"`
	Inputs  []SendInput  `json:"inputs"`
	Outputs []SendOutput `json:"outputs"`
}

Synchronize a swap between two users

func (*ExternalLock) ProcessCheck

func (transaction *ExternalLock) ProcessCheck(app interface{}) status.Code

func (*ExternalLock) ProcessDeliver

func (transaction *ExternalLock) ProcessDeliver(app interface{}) status.Code

func (*ExternalLock) Resolve

func (transaction *ExternalLock) Resolve(app interface{}) Commands

func (*ExternalLock) ShouldProcess

func (transaction *ExternalLock) ShouldProcess(app interface{}) bool

func (*ExternalLock) TransactionType added in v0.7.0

func (transaction *ExternalLock) TransactionType() Type

func (*ExternalLock) Validate

func (transaction *ExternalLock) Validate() status.Code

type ExternalSend

type ExternalSend struct {
	Base

	Gas     data.Coin    `json:"gas"`
	Fee     data.Coin    `json:"fee"`
	Inputs  []SendInput  `json:"inputs"`
	Outputs []SendOutput `json:"outputs"`
}

Synchronize a swap between two users

func (*ExternalSend) ProcessCheck

func (transaction *ExternalSend) ProcessCheck(app interface{}) status.Code

func (*ExternalSend) ProcessDeliver

func (transaction *ExternalSend) ProcessDeliver(app interface{}) status.Code

func (*ExternalSend) Resolve

func (transaction *ExternalSend) Resolve(app interface{}) Commands

func (*ExternalSend) ShouldProcess

func (transaction *ExternalSend) ShouldProcess(app interface{}) bool

func (*ExternalSend) TransactionType added in v0.7.0

func (transaction *ExternalSend) TransactionType() Type

func (*ExternalSend) Validate

func (transaction *ExternalSend) Validate() status.Code

type Forget

type Forget struct {
	Base

	Target string `json:"target"`
}

func (*Forget) ProcessCheck

func (transaction *Forget) ProcessCheck(app interface{}) status.Code

func (*Forget) ProcessDeliver

func (transaction *Forget) ProcessDeliver(app interface{}) status.Code

func (*Forget) Resolve

func (transaction *Forget) Resolve(app interface{}) Commands

func (*Forget) ShouldProcess

func (transaction *Forget) ShouldProcess(app interface{}) bool

func (*Forget) TransactionType added in v0.7.0

func (transaction *Forget) TransactionType() Type

func (*Forget) Validate

func (transaction *Forget) Validate() status.Code

type FunctionValue

type FunctionValue interface{}

type FunctionValues added in v0.7.0

type FunctionValues map[Parameter]FunctionValue

func AuditContract

func AuditContract(app interface{}, chain data.ChainType, context FunctionValues, tx Transaction) (bool, FunctionValues)

func AuditContractBTC added in v0.5.0

func AuditContractBTC(app interface{}, context FunctionValues, tx Transaction) (bool, FunctionValues)

func AuditContractETH added in v0.5.0

func AuditContractETH(app interface{}, context FunctionValues, tx Transaction) (bool, FunctionValues)

func AuditContractOLT added in v0.5.0

func AuditContractOLT(app interface{}, context FunctionValues, tx Transaction) (bool, FunctionValues)

func ClearEvent added in v0.7.0

func ClearEvent(app interface{}, chain data.ChainType, context FunctionValues, tx Transaction) (bool, FunctionValues)

func CreateCheckEvent added in v0.7.0

func CreateCheckEvent(app interface{}, chain data.ChainType, context FunctionValues, tx Transaction) (bool, FunctionValues)

func CreateContractBTC

func CreateContractBTC(app interface{}, context FunctionValues, tx Transaction) (bool, FunctionValues)

func CreateContractETH

func CreateContractETH(app interface{}, context FunctionValues, tx Transaction) (bool, FunctionValues)

func CreateContractOLT

func CreateContractOLT(app interface{}, context FunctionValues, tx Transaction) (bool, FunctionValues)

func ExtractSecret

func ExtractSecret(app interface{}, chain data.ChainType, context FunctionValues, tx Transaction) (bool, FunctionValues)

func ExtractSecretBTC added in v0.5.0

func ExtractSecretBTC(app interface{}, context FunctionValues, tx Transaction) (bool, FunctionValues)

func ExtractSecretETH added in v0.5.0

func ExtractSecretETH(app interface{}, context FunctionValues, tx Transaction) (bool, FunctionValues)

func ExtractSecretOLT added in v0.5.0

func ExtractSecretOLT(app interface{}, context FunctionValues, tx Transaction) (bool, FunctionValues)

func FinalizeSwap added in v0.7.0

func FinalizeSwap(app interface{}, chain data.ChainType, context FunctionValues, tx Transaction) (bool, FunctionValues)

func Initiate

func Initiate(app interface{}, chain data.ChainType, context FunctionValues, tx Transaction) (bool, FunctionValues)

func NextStage added in v0.7.0

func NextStage(app interface{}, chain data.ChainType, context FunctionValues, tx Transaction) (bool, FunctionValues)

get the next stage from the current stage

func Noop

func Noop(app interface{}, chain data.ChainType, context FunctionValues) (bool, FunctionValues)

func Participate

func Participate(app interface{}, chain data.ChainType, context FunctionValues, tx Transaction) (bool, FunctionValues)

func ParticipateBTC added in v0.5.0

func ParticipateBTC(app interface{}, context FunctionValues, tx Transaction) (bool, FunctionValues)

func ParticipateETH

func ParticipateETH(app interface{}, context FunctionValues, tx Transaction) (bool, FunctionValues)

func ParticipateOLT added in v0.5.0

func ParticipateOLT(app interface{}, context FunctionValues, tx Transaction) (bool, FunctionValues)

func Redeem

func Redeem(app interface{}, chain data.ChainType, context FunctionValues, tx Transaction) (bool, FunctionValues)

func RedeemBTC added in v0.5.0

func RedeemBTC(app interface{}, context FunctionValues, tx Transaction) (bool, FunctionValues)

func RedeemETH

func RedeemETH(app interface{}, context FunctionValues, tx Transaction) (bool, FunctionValues)

func RedeemOLT added in v0.5.0

func RedeemOLT(app interface{}, context FunctionValues, tx Transaction) (bool, FunctionValues)

func Refund

func Refund(app interface{}, chain data.ChainType, context FunctionValues, tx Transaction) (bool, FunctionValues)

func RefundBTC added in v0.5.0

func RefundBTC(app interface{}, context FunctionValues, tx Transaction) (bool, FunctionValues)

func RefundETH

func RefundETH(app interface{}, context FunctionValues, tx Transaction) (bool, FunctionValues)

func RefundOLT added in v0.5.0

func RefundOLT(app interface{}, context FunctionValues, tx Transaction) (bool, FunctionValues)

func VerifySwap added in v0.7.0

func VerifySwap(app interface{}, chain data.ChainType, context FunctionValues, tx Transaction) (bool, FunctionValues)

type HtlContract added in v0.5.3

type HtlContract struct {
	Transaction     Transaction `json:"transaction"`
	Secrethash      [32]byte    `json:"secrethash"`
	LockHeight      int64       `json:"lockheight"`
	StartFromHeight int64       `json:"startfromheight"`
}

func CreateHtlContract added in v0.5.3

func CreateHtlContract(app interface{}, transaction Transaction, scrhash [32]byte, lock time.Duration) *HtlContract

type Message

type Message = []byte // Contents of a transaction

type MultiSigBox added in v0.5.3

type MultiSigBox struct {
	Lockers []BoxLocker `json:"lockers"`
	M       int         `json:"m"`
	N       int         `json:"n"`
	// contains filtered or unexported fields
}

func NewMultiSigBox added in v0.5.3

func NewMultiSigBox(m int, n int, message Message) *MultiSigBox

func (MultiSigBox) Sign added in v0.5.3

func (msb MultiSigBox) Sign(locker *BoxLocker) error

func (MultiSigBox) Unlock added in v0.5.3

func (msb MultiSigBox) Unlock(signs []BoxLocker) *Message

type Parameter

type Parameter byte
const (
	ROLE Parameter = iota
	PREIMAGE
	PASSWORD
	CONTRACT

	LOCKTIME
	DELAYTIME
	CHAIN
	NEXTCHAINNAME
	SWAPMESSAGE
	STOREKEY
	STAGE
	NEXTSTAGE
	OWNER
	TARGET
	PREVIOUS
	FINISHED
)

TODO: Move to parameter.go

type Party

type Party struct {
	Key      id.AccountKey             `json:"key"`
	Accounts map[data.ChainType][]byte `json:"accounts"`
}

func GetParty

func GetParty(value FunctionValue) Party

type Prepare

type Prepare struct {
	Base

	Target string `json:"target"`
}

TODO: This needs to be filled out properly, need a model for other-chain actions...

func (*Prepare) ProcessCheck

func (transaction *Prepare) ProcessCheck(app interface{}) status.Code

func (*Prepare) ProcessDeliver

func (transaction *Prepare) ProcessDeliver(app interface{}) status.Code

func (*Prepare) Resolve

func (transaction *Prepare) Resolve(app interface{}) Commands

func (*Prepare) ShouldProcess

func (transaction *Prepare) ShouldProcess(app interface{}) bool

func (*Prepare) TransactionType added in v0.7.0

func (transaction *Prepare) TransactionType() Type

func (*Prepare) Validate

func (transaction *Prepare) Validate() status.Code

type PublicKey

type PublicKey = id.PublicKey

type Publish added in v0.5.0

type Publish struct {
	Base

	Target     id.AccountKey `json:"target"`
	Contract   Message       `json:"message"` //message converted from HTLContract
	SecretHash [32]byte      `json:"secrethash"`
	Count      int           `json:"count"`
}

Synchronize a publish between two users

func (*Publish) ProcessCheck added in v0.5.0

func (publish *Publish) ProcessCheck(app interface{}) status.Code

func (*Publish) ProcessDeliver added in v0.5.0

func (publish *Publish) ProcessDeliver(app interface{}) status.Code

Start the publish

func (*Publish) Resolve added in v0.5.0

func (publish *Publish) Resolve(app interface{}) Commands

Plug in data from the rest of a system into a set of commands

func (*Publish) ShouldProcess added in v0.5.0

func (publish *Publish) ShouldProcess(app interface{}) bool

Is this node one of the partipants in the publish

func (*Publish) TransactionType added in v0.7.0

func (transaction *Publish) TransactionType() Type

func (*Publish) Validate added in v0.5.0

func (publish *Publish) Validate() status.Code

Ensure that all of the base values are at least reasonable.

type Register

type Register struct {
	Base

	Identity          string
	NodeName          string
	AccountKey        id.AccountKey
	TendermintAddress string
	TendermintPubKey  string
}

Register an identity with the chain

func CreateRegisterRequest added in v0.7.0

func CreateRegisterRequest(identity string, chainId string, sequence int64, nodeName string, signers []PublicKey, accountKey id.AccountKey) *Register

func (Register) ProcessCheck

func (transaction Register) ProcessCheck(app interface{}) status.Code

Test to see if the identity already exists

func (Register) ProcessDeliver

func (transaction Register) ProcessDeliver(app interface{}) status.Code

Add the identity into the database as external, don't overwrite a local identity

func (*Register) Resolve

func (transaction *Register) Resolve(app interface{}) Commands

func (Register) ShouldProcess

func (transaction Register) ShouldProcess(app interface{}) bool

func (*Register) TransactionType added in v0.7.0

func (transaction *Register) TransactionType() Type

func (Register) Validate

func (transaction Register) Validate() status.Code

Check the fields to make sure they have valid values.

type Role

type Role int
const (
	ALL         Role = iota
	INITIATOR        // Register a new identity with the chain
	PARTICIPANT      // Do a normal send transaction on local chain
	NONE
)

func GetRole

func GetRole(value FunctionValue) Role

type Send

type Send struct {
	Base

	Inputs  []SendInput  `json:"inputs"`
	Outputs []SendOutput `json:"outputs"`

	Gas data.Coin `json:"gas"`
	Fee data.Coin `json:"fee"`
}

Synchronize a swap between two users

func (*Send) ProcessCheck

func (transaction *Send) ProcessCheck(app interface{}) status.Code

func (*Send) ProcessDeliver

func (transaction *Send) ProcessDeliver(app interface{}) status.Code

func (*Send) Resolve

func (transaction *Send) Resolve(app interface{}) Commands

func (*Send) ShouldProcess

func (transaction *Send) ShouldProcess(app interface{}) bool

func (*Send) TransactionType added in v0.7.0

func (transaction *Send) TransactionType() Type

func (*Send) Validate

func (transaction *Send) Validate() status.Code

type SendInput

type SendInput struct {
	AccountKey id.AccountKey `json:"account_key"`
	PubKey     PublicKey     `json:"pub_key"`
	Signature  id.Signature  `json:"signature"`

	Amount data.Coin `json:"coin"`

	// TODO: Is sequence needed per input?
	Sequence int `json:"sequence"`
}

inputs into a send transaction (similar to Bitcoin)

func NewSendInput

func NewSendInput(accountKey id.AccountKey, amount data.Coin) SendInput

type SendOutput

type SendOutput struct {
	AccountKey id.AccountKey `json:"account_key"`
	Amount     data.Coin     `json:"coin"`
}

outputs for a send transaction (similar to Bitcoin)

func NewSendOutput

func NewSendOutput(accountKey id.AccountKey, amount data.Coin) SendOutput

type SignedTransaction added in v0.7.0

type SignedTransaction struct {
	Transaction
	Signatures []TransactionSignature
}

func Parse

func Parse(message Message) (SignedTransaction, status.Code)

Parse a message into the appropriate transaction

func SignTransaction

func SignTransaction(transaction Transaction) SignedTransaction

SignTransaction with the local keys

type Swap

type Swap struct {
	Base
	SwapMessage SwapMessage   `json:"swapmessage"`
	Stage       swapStageType `json:"stage"`
}

Synchronize a swap between two users

func (*Swap) CommandExecute added in v0.7.0

func (swap *Swap) CommandExecute(app interface{}, commands Commands, c chan status.Code)

func (*Swap) ProcessCheck

func (transaction *Swap) ProcessCheck(app interface{}) status.Code

func (*Swap) ProcessDeliver

func (transaction *Swap) ProcessDeliver(app interface{}) status.Code

Start the swap

func (*Swap) Resolve

func (swap *Swap) Resolve(app interface{}) Commands

Plug in data from the rest of a system into a set of commands

func (*Swap) ShouldProcess

func (transaction *Swap) ShouldProcess(app interface{}) bool

Is this node one of the partipants in the swap

func (*Swap) TransactionType added in v0.7.0

func (transaction *Swap) TransactionType() Type

func (*Swap) Validate

func (transaction *Swap) Validate() status.Code

Ensure that all of the base values are at least reasonable.

type SwapExchange added in v0.7.0

type SwapExchange struct {
	Contract    common.Contract `json:"message"`
	SwapKeyHash []byte          `json:"swapkeyhash"`
	Chain       data.ChainType  `json:"chain"`
	PreviousTx  []byte          `json:"previoustx"`
}

type SwapInit added in v0.7.0

type SwapInit struct {
	Party        Party     `json:"party"`
	CounterParty Party     `json:"counter_party"`
	Amount       data.Coin `json:"amount"`
	Exchange     data.Coin `json:"exchange"`
	Fee          data.Coin `json:"fee"`
	Gas          data.Coin `json:"fee"`
	Nonce        int64     `json:"nonce"`
	Preimage     []byte    `json:"preimage"`
}

func FindSwap

func FindSwap(app interface{}, key []byte) *SwapInit

type SwapKey added in v0.7.0

type SwapKey struct {
	Initiator   id.AccountKey `json:"initiator"`
	Participant id.AccountKey `json:"participant"`
	Amount      data.Coin     `json:"amount"`
	Exchange    data.Coin     `json:"exchange"`
	Nonce       int64         `json:"nonce"`
}

type SwapMessage added in v0.7.0

type SwapMessage interface {
	// contains filtered or unexported methods
}

func GetSwapMessage added in v0.7.0

func GetSwapMessage(value FunctionValue) SwapMessage

type SwapVerify added in v0.7.0

type SwapVerify struct {
	Event Event `json:"event"`
}

type Transaction

type Transaction interface {
	TransactionType() Type
	Validate() status.Code
	ProcessCheck(interface{}) status.Code
	ShouldProcess(interface{}) bool
	ProcessDeliver(interface{}) status.Code
	Resolve(interface{}) Commands
}

Polymorphism and Serializable

type TransactionSignature added in v0.7.0

type TransactionSignature struct {
	Signature []byte
}

type Type

type Type int

ENUM for type

const (
	INVALID       Type = iota
	REGISTER           // Register a new identity with the chain
	SEND               // Do a normal send transaction on local chain
	EXTERNAL_SEND      // Do send on external chain
	EXTERNAL_LOCK      // Lock some data on external chain
	SWAP               // Start a swap between chains
	VERIFY             // Verify if a transaction finished
	PUBLISH            // Exchange data on a chain
	READ               // Read a specific transaction on a chain
	PREPARE            // Do everything, except commit
	COMMIT             // Commit to doing the work
	FORGET             // Rollback and forget that this happened
)

type Verify

type Verify struct {
	Base

	Target  id.AccountKey `json:"target"`
	Event   Event         `json:"event"`
	Message Message       `json:"Message"`
}

instead of a model for other-chain actions, we make this available by event, when a action (external/internal) is done, a event related to other chain is stored with status(false/true, representing finished or not), this verify just check the event status.

func (Verify) ProcessCheck

func (transaction Verify) ProcessCheck(app interface{}) status.Code

func (Verify) ProcessDeliver

func (transaction Verify) ProcessDeliver(app interface{}) status.Code

func (Verify) Resolve

func (transaction Verify) Resolve(app interface{}) Commands

func (Verify) ShouldProcess

func (transaction Verify) ShouldProcess(app interface{}) bool

func (*Verify) TransactionType added in v0.7.0

func (transaction *Verify) TransactionType() Type

func (Verify) Validate

func (transaction Verify) Validate() status.Code

Jump to

Keyboard shortcuts

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