chain

package
v1.0.0-rc2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 21, 2023 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotSupported = errors.New("not supported")

Functions

func DecodeMessage

func DecodeMessage(msg *Message) (*types.Message, error)

func DecodeParams

func DecodeParams(params ParamsInfo) ([]byte, error)

func DecodeSignature

func DecodeSignature(signature string) (crypto.Signature, error)

func DecodeSignedMessage

func DecodeSignedMessage(signedMsg *SignedMessage) (*types.SignedMessage, error)

func EncodeSignature

func EncodeSignature(signature crypto.Signature) (string, error)

Types

type Message

type Message struct {
	Version    uint64     `json:"version"`
	To         string     `json:"to"`
	From       string     `json:"from"`
	Nonce      uint64     `json:"nonce"`
	Value      int64      `json:"value"`
	GasLimit   int64      `json:"gas_limit"`
	GasFeeCap  int64      `json:"gas_feecap"`
	GasPremium int64      `json:"gas_premium"`
	Method     uint64     `json:"method"`
	Params     ParamsInfo `json:"params"`
}

func EncodeMessage

func EncodeMessage(msg *types.Message, params interface{}) (*Message, error)

func (*Message) String

func (m *Message) String() string

type ParamsInfo

type ParamsInfo struct {
	Name   string `json:"name"`
	Params string `json:"params"`
}

func EncodeParams

func EncodeParams(params interface{}) (*ParamsInfo, error)

type SignedMessage

type SignedMessage struct {
	Message   Message `json:"message"`
	Signature string  `json:"signature"`
}

SignedMessage : Signature use CBOR encoding and conforms to lotus spec

  sign := crypto.Signature{
	   Type: crypto.SigTypeSecp256k1,
	   Data: []byte{1, 2, 3, 4},
  }

  var buf bytes.Buffer
  sign.MarshalCBOR(&buf)
  signedMsg := SignedMessage{
	   Signature: buf.String(),
  }

func BuildSignedMessage

func BuildSignedMessage(msg *Message, signature crypto.Signature) (*SignedMessage, error)

func (*SignedMessage) String

func (m *SignedMessage) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL