You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
1.6 KiB

  1. package types
  2. import (
  3. "fmt"
  4. )
  5. // Functions to generate eventId strings
  6. func EventStringAccInput(addr []byte) string { return fmt.Sprintf("Acc/%X/Input", addr) }
  7. func EventStringAccOutput(addr []byte) string { return fmt.Sprintf("Acc/%X/Output", addr) }
  8. func EventStringAccCall(addr []byte) string { return fmt.Sprintf("Acc/%X/Call", addr) }
  9. func EventStringLogEvent(addr []byte) string { return fmt.Sprintf("Log/%X", addr) }
  10. func EventStringPermissions(name string) string { return fmt.Sprintf("Permissions/%s", name) }
  11. func EventStringBond() string { return "Bond" }
  12. func EventStringUnbond() string { return "Unbond" }
  13. func EventStringRebond() string { return "Rebond" }
  14. func EventStringDupeout() string { return "Dupeout" }
  15. func EventStringNewBlock() string { return "NewBlock" }
  16. func EventStringFork() string { return "Fork" }
  17. // Most event messages are basic types (a block, a transaction)
  18. // but some (an input to a call tx or a receive) are more exotic:
  19. type EventMsgTx struct {
  20. Tx Tx `json:"tx"`
  21. Return []byte `json:"return"`
  22. Exception string `json:"exception"`
  23. }
  24. type CallData struct {
  25. Caller []byte `json:"caller"`
  26. Callee []byte `json:"callee"`
  27. Data []byte `json:"data"`
  28. Value int64 `json:"value"`
  29. Gas int64 `json:"gas"`
  30. }
  31. type EventMsgCall struct {
  32. CallData *CallData `json:"call_data"`
  33. Origin []byte `json:"origin"`
  34. TxID []byte `json:"tx_id"`
  35. Return []byte `json:"return"`
  36. Exception string `json:"exception"`
  37. }