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.

72 lines
1.4 KiB

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