wallet

package
v1.7.1 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2022 License: Apache-2.0, MIT Imports: 14 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCodeOverflow = errors.New("code over flow")
)
View Source
var MaxMsgEnumCode = len(MsgEnumPool) - 1
View Source
var MsgEnumPool = []struct {
	Code int
	Name string
}{
	{Code: MsgEnumCode(MEUnknown), Name: "unknown"},
	{Code: MsgEnumCode(MEChainMsg), Name: "chainMsg"},
	{Code: MsgEnumCode(MEBlock), Name: "block"},
	{Code: MsgEnumCode(MEDealProposal), Name: "dealProposal"},
	{Code: MsgEnumCode(MEDrawRandomParam), Name: "drawRandomParam"},
	{Code: MsgEnumCode(MESignedVoucher), Name: "signedVoucher"},
	{Code: MsgEnumCode(MEStorageAsk), Name: "storageAsk"},
	{Code: MsgEnumCode(MEAskResponse), Name: "askResponse"},
	{Code: MsgEnumCode(MENetWorkResponse), Name: "netWorkResponse"},
	{Code: MsgEnumCode(MEProviderDealState), Name: "providerDealState"},
	{Code: MsgEnumCode(MEClientDeal), Name: "clientDeal"},
}

Functions

func CheckMsgEnum

func CheckMsgEnum(me MsgEnum) error

func ContainMsgType

func ContainMsgType(multiME MsgEnum, mt types.MsgType) bool

func FindCode

func FindCode(enum MsgEnum) []int

func MsgEnumCode

func MsgEnumCode(me MsgEnum) int

Types

type AddressScope

type AddressScope struct {
	Root      bool              // is root auth,  true : can get all addresses in the wallet
	Addresses []address.Address // when root==false, should fill a scope of wallet addresses
}

type DrawRandomParams

type DrawRandomParams struct {
	Rbase   []byte
	Pers    crypto.DomainSeparationTag
	Round   abi.ChainEpoch
	Entropy []byte
}

func (*DrawRandomParams) MarshalCBOR

func (dr *DrawRandomParams) MarshalCBOR(w io.Writer) error

func (*DrawRandomParams) SignBytes

func (dr *DrawRandomParams) SignBytes() ([]byte, error)

return store.DrawRandomness(dr.Rbase, dr.Pers, dr.Round, dr.Entropy)

func (*DrawRandomParams) UnmarshalCBOR

func (dr *DrawRandomParams) UnmarshalCBOR(r io.Reader) error

type Group

type Group struct {
	GroupID uint
	Name    string
	// NOTE: not fill data when query groups
	KeyBinds []*KeyBind
}

Group multi KeyBind

type GroupAuth

type GroupAuth struct {
	Token    string
	GroupID  uint
	Name     string
	KeyBinds []*KeyBind
}

GroupAuth relation with Group and generate a token for external invocation

type KeyBind

type KeyBind struct {
	BindID  uint
	Name    string
	Address string
	// source from MsgTypeTemplate or temporary create
	MetaTypes MsgEnum
	// source from MethodTemplate
	Methods []MethodName
}

KeyBind bind wallet usage strategy allow designated rule to pass

func (*KeyBind) ContainMethod

func (kb *KeyBind) ContainMethod(m string) bool

func (*KeyBind) ContainMsgType

func (kb *KeyBind) ContainMsgType(m types.MsgType) bool

type KeyStrategy

type KeyStrategy struct {
	Address   address.Address // wallet address
	MetaTypes MsgEnum         // sum MsgEnum
	Methods   []MethodName    // msg method array
}

KeyStrategy a uint of wallet strategy

type MethodName

type MethodName = string

type MethodTemplate

type MethodTemplate struct {
	MTId uint
	Name string
	// method name join with ','
	Methods []MethodName
}

MethodTemplate to quickly create a private key usage strategy msg actor and methodNum agg to method name NOTE: routeType 4

type MsgEnum

type MsgEnum = uint32
const (
	MEUnknown MsgEnum = 1 << iota
	MEChainMsg
	MEBlock
	MEDealProposal
	MEDrawRandomParam
	MESignedVoucher
	MEStorageAsk
	MEAskResponse
	MENetWorkResponse
	MEProviderDealState
	MEClientDeal
	MEVerifyAddress
)

func AggregateMsgEnumCode

func AggregateMsgEnumCode(codes []int) (MsgEnum, error)

func MsgEnumFromInt

func MsgEnumFromInt(code int) (MsgEnum, error)

type MsgTypeTemplate

type MsgTypeTemplate struct {
	MTTId     uint
	Name      string
	MetaTypes MsgEnum
}

MsgTypeTemplate to quickly create a private key usage strategy

Jump to

Keyboard shortcuts

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