Documentation ¶
Index ¶
- Constants
- 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 Body
- type Fee
- type FeeAmount
- type IndexerTx
- type LogMessage
- type LogMessageEvent
- type MergedTx
- type PublicKey
- type Response
- type SignerInfo
- type TransferEvent
Constants ¶
const EventAttributeAmount = "amount"
Variables ¶
This section is empty.
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 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 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.