maidenlanedmessages

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MsgTypeError - an error
	MsgTypeError = "Error"
	// MsgTypeDeployContract - deploy a contract
	MsgTypeDeployContract = "DeployContract"
	// MsgTypeSendTransaction - send a transaction
	MsgTypeSendTransaction = "SendTransaction"
	// MsgTypeTransactionSuccess - a transaction receipt where status is 1
	MsgTypeTransactionSuccess = "TransactionSuccess"
	// MsgTypeTransactionFailure - a transaction receipt where status is 0
	MsgTypeTransactionFailure = "TransactionFailure"
	// RecordHeaderAccessToken - record header name for passing JWT token over messaging
	RecordHeaderAccessToken = "maidenlaned-accesstoken"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AsyncSentMsg

type AsyncSentMsg struct {
	Sent    bool   `json:"sent"`
	Request string `json:"id"`
	Msg     string `json:"msg,omitempty"`
}

AsyncSentMsg is a standard response for async requests

type CommonHeaders

type CommonHeaders struct {
	ID      string                 `json:"id,omitempty"`
	MsgType string                 `json:"type"`
	Account string                 `json:"account,omitempty"`
	Context map[string]interface{} `json:"ctx,omitempty"`
}

CommonHeaders are common to all messages

type DeployContract

type DeployContract struct {
	TransactionCommon
	Solidity        string                        `json:"solidity,omitempty"`
	CompilerVersion string                        `json:"compilerVersion,omitempty"`
	EVMVersion      string                        `json:"evmVersion,omitempty"`
	ABI             maidenlanedbind.ABIMarshaling `json:"abi,omitempty"`
	DevDoc          string                        `json:"devDocs,omitempty"`
	Compiled        []byte                        `json:"compiled,omitempty"`
	ContractName    string                        `json:"contractName,omitempty"`
	Description     string                        `json:"description,omitempty"`
	RegisterAs      string                        `json:"registerAs,omitempty"`
}

DeployContract message instructs the bridge to install a contract

type ErrorReply

type ErrorReply struct {
	ReplyCommon
	ErrorMessage     string `json:"errorMessage,omitempty"`
	OriginalMessage  string `json:"requestPayload,omitempty"`
	TXHash           string `json:"transactionHash,omitempty"`
	GapFillTxHash    string `json:"gapFillTxHash,omitempty"`
	GapFillSucceeded *bool  `json:"gapFillSucceeded,omitempty"`
}

ErrorReply is

func NewErrorReply

func NewErrorReply(err error, origMsg interface{}) *ErrorReply

NewErrorReply is a helper to construct an error message

type ReplyCommon

type ReplyCommon struct {
	Headers ReplyHeaders `json:"headers"`
}

ReplyCommon is a common interface to all replies

func (*ReplyCommon) IsReceipt

func (r *ReplyCommon) IsReceipt() *TransactionReceipt

IsReceipt default is nil

func (*ReplyCommon) ReplyHeaders

func (r *ReplyCommon) ReplyHeaders() *ReplyHeaders

ReplyHeaders returns the reply headers

type ReplyHeaders

type ReplyHeaders struct {
	CommonHeaders
	Received  string  `json:"timeReceived"`
	Elapsed   float64 `json:"timeElapsed"`
	ReqOffset string  `json:"requestOffset"`
	ReqID     string  `json:"requestId"`
}

ReplyHeaders are common to all replies

type ReplyWithHeaders

type ReplyWithHeaders interface {
	ReplyHeaders() *ReplyHeaders
	IsReceipt() *TransactionReceipt
}

ReplyWithHeaders gives common access the reply headers

type RequestCommon

type RequestCommon struct {
	Headers RequestHeaders `json:"headers"`
}

RequestCommon is a common interface to all requests

type RequestHeaders

type RequestHeaders struct {
	CommonHeaders
}

RequestHeaders are common to all replies

type SendTransaction

type SendTransaction struct {
	TransactionCommon
	To         string                                `json:"to"`
	Method     *maidenlanedbind.ABIElementMarshaling `json:"method,omitempty"`
	MethodName string                                `json:"methodName,omitempty"`
}

SendTransaction message instructs the bridge to install a contract

type TimeSortable

type TimeSortable interface {
	IsLessThan(TimeSortable, TimeSortable) bool
	GetISO8601() string
	GetID() string
}

TimeSortable interface can be implemented by embedding TimeSorted and adding getID

type TimeSorted

type TimeSorted struct {
	CreatedISO8601 string `json:"created"`
}

TimeSorted base structure for time sortable things

func (*TimeSorted) GetISO8601

func (i *TimeSorted) GetISO8601() string

GetISO8601 returns an ISO8601 string

func (*TimeSorted) IsLessThan

func (*TimeSorted) IsLessThan(i TimeSortable, j TimeSortable) bool

IsLessThan performs reverse sorting by age, then forward sorting by ID

type TransactionCommon

type TransactionCommon struct {
	RequestCommon
	Nonce          json.Number   `json:"nonce,omitempty"`
	From           string        `json:"from"`
	Value          json.Number   `json:"value"`
	Gas            json.Number   `json:"gas"`
	GasPrice       json.Number   `json:"gasPrice"`
	Parameters     []interface{} `json:"params"`
	PrivateFrom    string        `json:"privateFrom,omitempty"`
	PrivateFor     []string      `json:"privateFor,omitempty"`
	PrivacyGroupID string        `json:"privacyGroupId,omitempty"`
}

TransactionCommon is the common fields from https://github.com/ethereum/wiki/wiki/JavaScript-API#web3ethsendtransaction for sending either contract call or creation transactions, with eea extensions for private transactions from https://entethalliance.github.io/client-spec/spec.html#sec-eea-sendTransaction TODO - do Orion/Tessera support "unrestricted" private transactions?

type TransactionReceipt

type TransactionReceipt struct {
	ReplyCommon
	BlockHash            *common.Hash    `json:"blockHash"`
	BlockNumberStr       string          `json:"blockNumber"`
	BlockNumberHex       *hexutil.Big    `json:"blockNumberHex,omitempty"`
	ContractSwagger      string          `json:"openapi,omitempty"`
	ContractUI           string          `json:"apiexerciser,omitempty"`
	ContractAddress      *common.Address `json:"contractAddress,omitempty"`
	CumulativeGasUsedStr string          `json:"cumulativeGasUsed"`
	CumulativeGasUsedHex *hexutil.Big    `json:"cumulativeGasUsedHex,omitempty"`
	From                 *common.Address `json:"from"`
	GasUsedStr           string          `json:"gasUsed"`
	GasUsedHex           *hexutil.Big    `json:"gasUsedHex,omitempty"`
	NonceStr             string          `json:"nonce"`
	NonceHex             *hexutil.Uint64 `json:"nonceHex,omitempty"`
	StatusStr            string          `json:"status"`
	StatusHex            *hexutil.Big    `json:"statusHex,omitempty"`
	To                   *common.Address `json:"to"`
	TransactionHash      *common.Hash    `json:"transactionHash"`
	TransactionIndexStr  string          `json:"transactionIndex"`
	TransactionIndexHex  *hexutil.Uint   `json:"transactionIndexHex,omitempty"`
	RegisterAs           string          `json:"registerAs,omitempty"`
}

TransactionReceipt is sent when a transaction has been successfully mined For the big numbers, we pass a simple string as well as a full ethereum hex encoding version

func (*TransactionReceipt) IsReceipt

func (r *TransactionReceipt) IsReceipt() *TransactionReceipt

IsReceipt returns as receipt

Jump to

Keyboard shortcuts

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