types

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2020 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// module name
	ModuleName = "subscribe"

	// StoreKey to be used when creating the KVStore
	StoreKey = ModuleName
)
View Source
const (
	QuerySubscription = "subscription"
	QueryRequest      = "request"
	QueryParameters   = "parameters"
)
View Source
const (
	// Default number of guards for guarding request
	DefaultRequestGuardCount uint64 = 3
)

subscribe params default values

View Source
const RouterKey = ModuleName // this was defined in your key.go file

Variables

View Source
var (
	SubscriptionKeyPrefix = []byte{0x01} // Key prefix for subscription

	RequestKeyPrefix  = []byte{0x21} // Key prefix for request
	RequestGuardIdKey = []byte{0x22} // Key for request guard id
)
View Source
var (
	KeyRequestGuardCount = []byte("RequestGuardCount")
	KeyRequestCost       = []byte("RequestCost")
)

nolint - Keys for parameter access

View Source
var (
	// Default cost per request
	DefaultRequestCost = sdk.NewInt(1000000000000000000)
)
View Source
var ModuleCdc = codec.New()

Functions

func GetRequestKey

func GetRequestKey(channelId []byte, peerFrom string) []byte

get request key from channelID

func GetSubscriptionKey

func GetSubscriptionKey(ethAddress string) []byte

get guardian key from eth address

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

RegisterCodec registers concrete types on the Amino codec

Types

type MsgGuardProof

type MsgGuardProof struct {
	ChannelId []byte         `json:"channelId"`
	PeerFrom  string         `json:"peerFrom"`
	TxHash    string         `json:"txHash"` // intendSettle tx to guard user's state proof
	Sender    sdk.AccAddress `json:"sender"`
}

MsgGuardProof defines a Subscribe message

func NewMsgGuardProof

func NewMsgGuardProof(channelId []byte, peerFrom string, txHash string, sender sdk.AccAddress) MsgGuardProof

NewMsgGuardProof is a constructor function for MsgGuardProof

func (MsgGuardProof) GetSignBytes

func (msg MsgGuardProof) GetSignBytes() []byte

GetSignBytes encodes the message for signing

func (MsgGuardProof) GetSigners

func (msg MsgGuardProof) GetSigners() []sdk.AccAddress

GetSigners defines whose signature is required

func (MsgGuardProof) Route

func (msg MsgGuardProof) Route() string

Route should return the name of the module

func (MsgGuardProof) Type

func (msg MsgGuardProof) Type() string

Type should return the action

func (MsgGuardProof) ValidateBasic

func (msg MsgGuardProof) ValidateBasic() sdk.Error

ValidateBasic runs stateless checks on the message

type MsgIntendSettle

type MsgIntendSettle struct {
	ChannelId []byte         `json:"channelId"`
	PeerFrom  string         `json:"peerFrom"`
	TxHash    string         `json:"txHash"` // intendSettle tx with lower sequence number
	Sender    sdk.AccAddress `json:"sender"`
}

MsgIntendSettle defines a Subscribe message

func NewMsgIntendSettle

func NewMsgIntendSettle(channelId []byte, peerFrom string, txHash string, sender sdk.AccAddress) MsgIntendSettle

NewMsgIntendSettle is a constructor function for MsgIntendSettle

func (MsgIntendSettle) GetSignBytes

func (msg MsgIntendSettle) GetSignBytes() []byte

GetSignBytes encodes the message for signing

func (MsgIntendSettle) GetSigners

func (msg MsgIntendSettle) GetSigners() []sdk.AccAddress

GetSigners defines whose signature is required

func (MsgIntendSettle) Route

func (msg MsgIntendSettle) Route() string

Route should return the name of the module

func (MsgIntendSettle) Type

func (msg MsgIntendSettle) Type() string

Type should return the action

func (MsgIntendSettle) ValidateBasic

func (msg MsgIntendSettle) ValidateBasic() sdk.Error

ValidateBasic runs stateless checks on the message

type MsgRequestGuard

type MsgRequestGuard struct {
	EthAddress              string         `json:"ethAddress"`
	SignedSimplexStateBytes []byte         `json:"signedSimplexStateBytes"`
	Sender                  sdk.AccAddress `json:"sender"`
}

func NewMsgRequestGuard

func NewMsgRequestGuard(ethAddress string, signedSimplexStateBytes []byte, sender sdk.AccAddress) MsgRequestGuard

NewMsgRequestGuard is a constructor function for MsgRequestGuard

func (MsgRequestGuard) GetSignBytes

func (msg MsgRequestGuard) GetSignBytes() []byte

GetSignBytes encodes the message for signing

func (MsgRequestGuard) GetSigners

func (msg MsgRequestGuard) GetSigners() []sdk.AccAddress

GetSigners defines whose signature is required

func (MsgRequestGuard) Route

func (msg MsgRequestGuard) Route() string

Route should return the name of the module

func (MsgRequestGuard) Type

func (msg MsgRequestGuard) Type() string

Type should return the action

func (MsgRequestGuard) ValidateBasic

func (msg MsgRequestGuard) ValidateBasic() sdk.Error

ValidateBasic runs stateless checks on the message

type MsgSubscribe

type MsgSubscribe struct {
	EthAddress string         `json:"ethAddress"`
	Sender     sdk.AccAddress `json:"sender"`
}

MsgSubscribe defines a Subscribe message

func NewMsgSubscribe

func NewMsgSubscribe(ethAddress string, sender sdk.AccAddress) MsgSubscribe

NewMsgSubscribe is a constructor function for MsgSubscribe

func (MsgSubscribe) GetSignBytes

func (msg MsgSubscribe) GetSignBytes() []byte

GetSignBytes encodes the message for signing

func (MsgSubscribe) GetSigners

func (msg MsgSubscribe) GetSigners() []sdk.AccAddress

GetSigners defines whose signature is required

func (MsgSubscribe) Route

func (msg MsgSubscribe) Route() string

Route should return the name of the module

func (MsgSubscribe) Type

func (msg MsgSubscribe) Type() string

Type should return the action

func (MsgSubscribe) ValidateBasic

func (msg MsgSubscribe) ValidateBasic() sdk.Error

ValidateBasic runs stateless checks on the message

type Params

type Params struct {
	RequestGuardCount uint64  `json:"requestGuardCount" yaml:"requestGuardCount"` // request guard count
	RequestCost       sdk.Int `json:"requestCost" yaml:"requestCost"`             // request limit per epoch
}

Params defines the high level settings for subscribe

func DefaultParams

func DefaultParams() Params

DefaultParams returns a default set of parameters.

func MustUnmarshalParams

func MustUnmarshalParams(cdc *codec.Codec, value []byte) Params

unmarshal the current subscribe params value from store key or panic

func NewParams

func NewParams(requestGuardCount uint64, requestCost sdk.Int) Params

NewParams creates a new Params instance

func UnmarshalParams

func UnmarshalParams(cdc *codec.Codec, value []byte) (params Params, err error)

unmarshal the current subscribe params value from store key

func (Params) Equal

func (p Params) Equal(p2 Params) bool

Equal returns a boolean determining if two Param types are identical.

func (*Params) ParamSetPairs

func (p *Params) ParamSetPairs() params.ParamSetPairs

Implements params.ParamSet

func (Params) String

func (p Params) String() string

String returns a human readable string representation of the parameters.

func (Params) Validate

func (p Params) Validate() error

validate a set of params

type QueryRequestParams

type QueryRequestParams struct {
	ChannelId []byte
	PeerFrom  string
}

func NewQueryRequestParams

func NewQueryRequestParams(channelId []byte, peerFrom string) QueryRequestParams

type QuerySubscriptionParams

type QuerySubscriptionParams struct {
	EthAddress string
}

func NewQuerySubscriptionParams

func NewQuerySubscriptionParams(addr string) QuerySubscriptionParams

type Request

type Request struct {
	ChannelId               []byte           `json:"channelId"`
	SeqNum                  uint64           `json:"seqNum"`
	PeerAddresses           []string         `json:"peerAddresses"`
	PeerFromIndex           uint8            `json:"peerFromIndex"`
	DisputeTimeout          uint64           `json:"disputeTimeout"`
	RequestGuards           []sdk.AccAddress `json:"requestGuards"`
	SignedSimplexStateBytes []byte           `json:"signedSimplexStateBytes"`
	TriggerTxHash           string           `json:"triggerTxHash"`
	GuardTxHash             string           `json:"guardTxHash"`
}

func NewRequest

func NewRequest(channelId []byte, seqNum uint64, peerAddresses []string, peerFromIndex uint8, disputeTimeout uint64) Request

func (Request) GetPeerAddress

func (r Request) GetPeerAddress() string

func (Request) String

func (r Request) String() string

implement fmt.Stringer

type Subscription

type Subscription struct {
	EthAddress string  `json:"ethAddress"`
	Deposit    sdk.Int `json:"deposit"`
	Spend      sdk.Int `json:"spend"`
}

func NewSubscription

func NewSubscription(ethAddress string) Subscription

func (Subscription) String

func (s Subscription) String() string

implement fmt.Stringer

Jump to

Keyboard shortcuts

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