messages

package
v0.0.0-...-d3d27b2 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2024 License: Apache-2.0 Imports: 4 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"
	// MsgTypeQuery - perform a call against the blockchain, and return a result
	MsgTypeQuery = "Query"
	// MsgTypeTransactionSuccess - a transaction receipt where status is 1
	MsgTypeTransactionSuccess = "TransactionSuccess"
	// MsgTypeTransactionFailure - a transaction receipt where status is 0
	MsgTypeTransactionFailure = "TransactionFailure"
	// MsgTypeTransactionRedeliveryPrevented - idempotency check caught a redelivery of the message
	MsgTypeTransactionRedeliveryPrevented = "TransactionRedeliveryPrevented"
	// RecordHeaderAccessToken - record header name for passing JWT token over messaging
	RecordHeaderAccessToken = "fly-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

func (*AsyncSentMsg) RequestID

func (asm *AsyncSentMsg) RequestID() string

type CommonHeaders

type CommonHeaders struct {
	ID      string                 `json:"id,omitempty"`
	ABIID   string                 `json:"abiId,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             ethbinding.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"`
	ErrorCode        string `json:"errorCode,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 QueryTransaction

type QueryTransaction struct {
	SendTransaction
	BlockNumber string `json:"blockNumber,omitempty"`
}

QueryTransaction message performs a synchronous invocation call to the blockchain

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"`
	ReqABIID  string  `json:"requestABIId,omitempty"`
}

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     *ethbinding.ABIElementMarshaling `json:"method,omitempty"`
	MethodName string                           `json:"methodName,omitempty"`
}

SendTransaction message instructs the bridge to invoke a smart contract

type SyncQueryReply

type SyncQueryReply map[string]interface{}

SyncQueryReply payload is constructed by txn.CallMethod

func (SyncQueryReply) RequestID

func (sqr SyncQueryReply) RequestID() string

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"`
	AckType        string        `json:"acktype,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 TransactionInfo

type TransactionInfo struct {
	BlockHash           *ethbinding.Hash       `json:"blockHash,omitempty"`
	BlockNumberStr      string                 `json:"blockNumber,omitempty"`
	BlockNumberHex      *ethbinding.HexBigInt  `json:"blockNumberHex,omitempty"`
	From                *ethbinding.Address    `json:"from,omitempty"`
	To                  *ethbinding.Address    `json:"to,omitempty"`
	GasStr              string                 `json:"gas"`
	GasHex              *ethbinding.HexUint64  `json:"gasHex"`
	GasPriceStr         string                 `json:"gasPrice"`
	GasPriceHex         *ethbinding.HexBigInt  `json:"gasPriceHex"`
	Hash                *ethbinding.Hash       `json:"hash"`
	NonceStr            string                 `json:"nonce"`
	NonceHex            *ethbinding.HexUint64  `json:"nonceHex"`
	TransactionIndexStr string                 `json:"transactionIndex"`
	TransactionIndexHex *ethbinding.HexUint64  `json:"transactionIndexHex"`
	ValueStr            string                 `json:"value"`
	ValueHex            *ethbinding.HexBigInt  `json:"valueHex"`
	Input               *ethbinding.HexBytes   `json:"input"`
	InputArgs           map[string]interface{} `json:"inputArgs"`
}

TransactionInfo is the detailed transaction info returned by eth_getTransactionByXXXXX For the big numbers, we pass a simple string as well as a full ethereum hex encoding version

type TransactionReceipt

type TransactionReceipt struct {
	ReplyCommon
	BlockHash            *ethbinding.Hash      `json:"blockHash"`
	BlockNumberStr       string                `json:"blockNumber"`
	BlockNumberHex       *ethbinding.HexBigInt `json:"blockNumberHex,omitempty"`
	ContractSwagger      string                `json:"openapi,omitempty"`
	ContractUI           string                `json:"apiexerciser,omitempty"`
	ContractAddress      *ethbinding.Address   `json:"contractAddress,omitempty"`
	CumulativeGasUsedStr string                `json:"cumulativeGasUsed"`
	CumulativeGasUsedHex *ethbinding.HexBigInt `json:"cumulativeGasUsedHex,omitempty"`
	From                 *ethbinding.Address   `json:"from"`
	GasUsedStr           string                `json:"gasUsed"`
	GasUsedHex           *ethbinding.HexBigInt `json:"gasUsedHex,omitempty"`
	NonceStr             string                `json:"nonce"`
	NonceHex             *ethbinding.HexUint64 `json:"nonceHex,omitempty"`
	StatusStr            string                `json:"status"`
	StatusHex            *ethbinding.HexBigInt `json:"statusHex,omitempty"`
	To                   *ethbinding.Address   `json:"to"`
	TransactionHash      *ethbinding.Hash      `json:"transactionHash"`
	TransactionIndexStr  string                `json:"transactionIndex"`
	TransactionIndexHex  *ethbinding.HexUint   `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

type TransactionRedeliveryNotification

type TransactionRedeliveryNotification struct {
	ReplyCommon
	TransactionHash string `json:"transactionHash"`
}

TransactionRedeliveryNotification is sent on redelivery of a message, when the ackmode=receipt idempotency check is enabled. The REST API Gateway (or other consumer), should avoid overwriting any received receipt when it gets this.

type WebhookReply

type WebhookReply interface {
	RequestID() string
}

Jump to

Keyboard shortcuts

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