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.

60 lines
1.3 KiB

  1. package wire
  2. import (
  3. "github.com/tendermint/go-wire"
  4. )
  5. /*
  6. // Expose access to a global wire codec
  7. // TODO: maybe introduce some Context object
  8. // containing logger, config, codec that can
  9. // be threaded through everything to avoid this global
  10. var cdc *wire.Codec
  11. func init() {
  12. cdc = wire.NewCodec()
  13. crypto.RegisterWire(cdc)
  14. }
  15. */
  16. // Just a flow through to go-wire.
  17. // To be used later for the global codec
  18. func MarshalBinary(o interface{}) ([]byte, error) {
  19. return wire.MarshalBinary(o)
  20. }
  21. func UnmarshalBinary(bz []byte, ptr interface{}) error {
  22. return wire.UnmarshalBinary(bz, ptr)
  23. }
  24. func MarshalJSON(o interface{}) ([]byte, error) {
  25. return wire.MarshalJSON(o)
  26. }
  27. func UnmarshalJSON(jsonBz []byte, ptr interface{}) error {
  28. return wire.UnmarshalJSON(jsonBz, ptr)
  29. }
  30. type ConcreteType = wire.ConcreteType
  31. func RegisterInterface(o interface{}, ctypes ...ConcreteType) *wire.TypeInfo {
  32. return wire.RegisterInterface(o, ctypes...)
  33. }
  34. const RFC3339Millis = wire.RFC3339Millis
  35. /*
  36. func RegisterInterface(ptr interface{}, opts *wire.InterfaceOptions) {
  37. cdc.RegisterInterface(ptr, opts)
  38. }
  39. func RegisterConcrete(o interface{}, name string, opts *wire.ConcreteOptions) {
  40. cdc.RegisterConcrete(o, name, opts)
  41. }
  42. //-------------------------------
  43. const RFC3339Millis = wire.RFC3339Millis
  44. */