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.

84 lines
1.6 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 EventStringBond() string {
  16. return "Bond"
  17. }
  18. func EventStringUnbond() string {
  19. return "Unbond"
  20. }
  21. func EventStringRebond() string {
  22. return "Rebond"
  23. }
  24. func EventStringDupeout() string {
  25. return "Dupeout"
  26. }
  27. func EventStringNewBlock() string {
  28. return "NewBlock"
  29. }
  30. func EventStringFork() string {
  31. return "Fork"
  32. }
  33. // Most event messages are basic types (a block, a transaction)
  34. // but some (an input to a call tx or a receive) are more exotic:
  35. type EventMsgCallTx struct {
  36. Tx Tx `json:"tx"`
  37. Return []byte `json:"return"`
  38. Exception string `json:"exception"`
  39. }
  40. type CallData struct {
  41. Caller []byte `json:"caller"`
  42. Callee []byte `json:"callee"`
  43. Data []byte `json:"data"`
  44. Value int64 `json:"value"`
  45. Gas int64 `json:"gas"`
  46. }
  47. type EventMsgCall struct {
  48. CallData *CallData `json:"call_data"`
  49. Origin []byte `json:"origin"`
  50. TxId []byte `json:"tx_id"`
  51. Return []byte `json:"return"`
  52. Exception string `json:"exception"`
  53. }
  54. /*
  55. Acc/XYZ/Input -> full tx or {full tx, return value, exception}
  56. Acc/XYZ/Output -> full tx
  57. Acc/XYZ/Receive -> full tx, return value, exception, (optionally?) calldata
  58. Bond -> full tx
  59. Unbond -> full tx
  60. Rebond -> full tx
  61. Dupeout -> full tx
  62. NewBlock -> full block
  63. Fork -> block A, block B
  64. Log -> Fuck this
  65. NewPeer -> peer
  66. Alert -> alert msg
  67. */