Documentation ¶
Index ¶
- Constants
- Variables
- func GetCoinsReceived(receiver string, evts []LogMessageEvent) []string
- func GetCoinsSpent(spender string, evts []LogMessageEvent) []string
- func GetLastValueForAttribute(key string, evt *LogMessageEvent) string
- func GetNthValueForAttribute(key string, n int, evt *LogMessageEvent) string
- func GetValueForAttribute(key string, evt *LogMessageEvent) (string, error)
- func IsMessageActionEquals(msgType string, msg *LogMessage) bool
- type Attribute
- type AuthInfo
- type BlockData
- type BlockHeader
- type BlockID
- type BlockResponse
- type Body
- type CosmosMessage
- type Fee
- type FeeAmount
- type GetBlockByHeightResponse
- type GetLatestBlockResponse
- type GetTxByBlockHeightResponse
- type GetTxsEventResponseWrapper
- type IndexerTx
- type LogMessage
- type LogMessageEvent
- type MergedTx
- type Message
- type MessageLogFormatError
- type Pagination
- type PublicKey
- type Response
- type SignerInfo
- type TransferEvent
Constants ¶
const EventAttributeAmount = "amount"
Variables ¶
var ErrUnknownMessage = errors.New("no message handler for message type")
Functions ¶
func GetCoinsReceived ¶
func GetCoinsReceived(receiver string, evts []LogMessageEvent) []string
func GetCoinsSpent ¶
func GetCoinsSpent(spender string, evts []LogMessageEvent) []string
func GetLastValueForAttribute ¶
func GetLastValueForAttribute(key string, evt *LogMessageEvent) string
func GetNthValueForAttribute ¶
func GetNthValueForAttribute(key string, n int, evt *LogMessageEvent) string
Get the Nth value for the given key (starting at 1)
func GetValueForAttribute ¶
func GetValueForAttribute(key string, evt *LogMessageEvent) (string, error)
If order is reversed, the last attribute containing the given key will be returned otherwise the first attribute will be returned
func IsMessageActionEquals ¶
func IsMessageActionEquals(msgType string, msg *LogMessage) bool
Types ¶
type AuthInfo ¶
type AuthInfo struct { TxFee Fee `json:"fee"` TxSignerInfos []SignerInfo `json:"signer_infos"` // this is used in REST but not RPC parsers }
type BlockHeader ¶
type BlockHeader struct {
Height string `json:"height"`
}
type BlockResponse ¶
type BlockResponse struct { BlockData BlockData `json:"data"` BlockHeader BlockHeader `json:"header"` }
type CosmosMessage ¶
type CosmosMessage interface { HandleMsg(string, sdk.Msg, *LogMessage) error ParseRelevantData() []parsingTypes.MessageRelevantInformation GetType() string String() string }
CosmosMessage represents a Cosmos blockchain Message (part of a transaction). CosmUnmarshal() unmarshals the specific cosmos message type (e.g. MsgSend). First arg must always be the message type itself, as this won't be parsed in CosmUnmarshal.
type GetBlockByHeightResponse ¶
type GetBlockByHeightResponse struct { BlockID BlockID `json:"block_id"` Block BlockResponse `json:"block"` }
type GetLatestBlockResponse ¶
type GetLatestBlockResponse struct { BlockID BlockID `json:"block_id"` Block BlockResponse `json:"block"` }
type GetTxByBlockHeightResponse ¶
type GetTxByBlockHeightResponse struct { Txs []IndexerTx `json:"txs"` TxResponses []Response `json:"tx_responses"` Pagination Pagination `json:"pagination"` }
type GetTxsEventResponseWrapper ¶
type GetTxsEventResponseWrapper struct { CosmosGetTxsEventResponse *cosmTx.GetTxsEventResponse Height int64 }
type LogMessage ¶
type LogMessage struct { MessageIndex int `json:"msg_index"` Events []LogMessageEvent `json:"events"` }
TxLogMessage: Cosmos blockchains return Transactions with an array of "logs" e.g.
"logs": [
{ "msg_index": 0, "events": [ { "type": "coin_received", "attributes": [ { "key": "receiver", "value": "juno128taw6wkhfq29u83lmh5qyfv8nff6h0w577vsy" }, ... ] } ...
The individual log always has a msg_index corresponding to the Message from the Transaction. But the events are specific to each Message type, for example MsgSend might be different from any other message type.
This struct just parses the KNOWN fields and leaves the other fields as raw JSON. More specific type parsers for each message type can parse those fields if they choose to.
func GetMessageLogForIndex ¶
func GetMessageLogForIndex(logs []LogMessage, index int) *LogMessage
type LogMessageEvent ¶
type LogMessageEvent struct { Type string `json:"type"` Attributes []Attribute `json:"attributes"` }
func GetAllEventsWithType ¶
func GetAllEventsWithType(eventType string, msg *LogMessage) []LogMessageEvent
func GetEventWithType ¶
func GetEventWithType(eventType string, msg *LogMessage) *LogMessageEvent
func GetEventsWithType ¶
func GetEventsWithType(eventType string, msg *LogMessage) []LogMessageEvent
type MessageLogFormatError ¶
func (*MessageLogFormatError) Error ¶
func (e *MessageLogFormatError) Error() string
type Pagination ¶
type Response ¶
type Response struct { TxHash string `json:"txhash"` Height string `json:"height"` TimeStamp string `json:"timestamp"` Code uint32 `json:"code"` RawLog []byte `json:"raw_log"` Log []LogMessage `json:"logs"` GasUsed int64 `json:"gas_used"` GasWanted int64 `json:"gas_wanted"` Codespace string `json:"codespace"` Info string `json:"info"` Data string `json:"data"` }
type SignerInfo ¶
type SignerInfo struct {
PublicKey PublicKey `json:"public_key"`
}
type TransferEvent ¶
func ParseTransferEvent ¶
func ParseTransferEvent(evt LogMessageEvent) ([]TransferEvent, error)
Transfer events should have attributes in the order recipient, sender, amount.