Documentation
¶
Index ¶
- Constants
- func ErrDuplicateTags(codespace sdk.CodespaceType) sdk.Error
- func ErrInvalidAuthor(codespace sdk.CodespaceType) sdk.Error
- func ErrInvalidBindingType(codespace sdk.CodespaceType, bindingType BindingType) sdk.Error
- func ErrInvalidChainId(codespace sdk.CodespaceType) sdk.Error
- func ErrInvalidDefChainId(codespace sdk.CodespaceType) sdk.Error
- func ErrInvalidExpiration(codespace sdk.CodespaceType, expiration int64) sdk.Error
- func ErrInvalidIDL(codespace sdk.CodespaceType, msg string) sdk.Error
- func ErrInvalidLevel(codespace sdk.CodespaceType, level Level) sdk.Error
- func ErrInvalidMessagingType(codespace sdk.CodespaceType, value MessagingType) sdk.Error
- func ErrInvalidMethodName(codespace sdk.CodespaceType) sdk.Error
- func ErrInvalidOutputCachedEnum(codespace sdk.CodespaceType, value string) sdk.Error
- func ErrInvalidOutputPrivacyEnum(codespace sdk.CodespaceType, value string) sdk.Error
- func ErrInvalidPriceCount(codespace sdk.CodespaceType, priceCount int, methodCount int) sdk.Error
- func ErrInvalidServiceName(codespace sdk.CodespaceType) sdk.Error
- func ErrInvalidUpdate(codespace sdk.CodespaceType, msg string) sdk.Error
- func ErrLtMinProviderDeposit(codespace sdk.CodespaceType, coins sdk.Coins) sdk.Error
- func ErrMoreTags(codespace sdk.CodespaceType, i int) sdk.Error
- func ErrRefundDeposit(codespace sdk.CodespaceType, msg string) sdk.Error
- func ErrSvcBindingExists(codespace sdk.CodespaceType) sdk.Error
- func ErrSvcBindingNotExists(codespace sdk.CodespaceType) sdk.Error
- func ErrSvcDefExists(codespace sdk.CodespaceType, defChainId, svcDefName string) sdk.Error
- func ErrSvcDefNotExists(codespace sdk.CodespaceType, defChainId, svcDefName string) sdk.Error
- func GetBindingsSubspaceKey(chainId, serviceName string) []byte
- func GetMethodPropertyKey(chainId, serviceName string, id int) []byte
- func GetMethodsSubspaceKey(chainId, serviceName string) []byte
- func GetServiceBindingKey(defChainId, name, bindChainId string, provider sdk.AccAddress) []byte
- func GetServiceDefinitionKey(chainId, name string) []byte
- func InitGenesis(ctx sdk.Context, data GenesisState)
- func NewError(codespace sdk.CodespaceType, code sdk.CodeType, msg string) sdk.Error
- func NewHandler(k Keeper) sdk.Handler
- func RegisterCodec(cdc *codec.Codec)
- func SortAddresses(addrs []sdk.AccAddress)
- func SortByteArrays(src [][]byte) [][]byte
- func SvcBindingEqual(bindingA, bindingB SvcBinding) bool
- type BindingType
- type GenesisState
- type Keeper
- func (k Keeper) AddMethods(ctx sdk.Context, svcDef SvcDef) sdk.Error
- func (k Keeper) AddServiceBinding(ctx sdk.Context, svcBinding SvcBinding) (sdk.Error, bool)
- func (k Keeper) AddServiceDefinition(ctx sdk.Context, svcDef SvcDef)
- func (k Keeper) Codespace() sdk.CodespaceType
- func (k Keeper) GetMethods(ctx sdk.Context, chainId, name string) sdk.Iterator
- func (k Keeper) GetServiceBinding(ctx sdk.Context, defChainID, defName, bindChainID string, ...) (svcBinding SvcBinding, found bool)
- func (k Keeper) GetServiceDefinition(ctx sdk.Context, chainId, name string) (svcDef SvcDef, found bool)
- func (k Keeper) RefundDeposit(ctx sdk.Context, defChainID, defName, bindChainID string, ...) (sdk.Error, bool)
- func (k Keeper) UpdateServiceBinding(ctx sdk.Context, svcBinding SvcBinding) (sdk.Error, bool)
- func (k Keeper) ValidateMethodPrices(ctx sdk.Context, svcBinding SvcBinding) sdk.Error
- type Level
- type MessagingType
- type MethodProperty
- type MsgSvcBind
- type MsgSvcBindingUpdate
- type MsgSvcDef
- type MsgSvcRefundDeposit
- type OutputCachedEnum
- type OutputPrivacyEnum
- type SvcBinding
- type SvcDef
Constants ¶
const ( DefaultCodespace sdk.CodespaceType = 6 CodeInvalidIDL sdk.CodeType = 100 CodeSvcDefExists sdk.CodeType = 101 CodeSvcDefNotExists sdk.CodeType = 102 CodeInvalidOutputPrivacyEnum sdk.CodeType = 103 CodeInvalidOutputCachedEnum sdk.CodeType = 104 CodeInvalidServiceName sdk.CodeType = 105 CodeInvalidChainId sdk.CodeType = 106 CodeInvalidAuthor sdk.CodeType = 107 CodeInvalidMethodName sdk.CodeType = 108 CodeInvalidMessagingType sdk.CodeType = 109 CodeMoreTags sdk.CodeType = 110 CodeDuplicateTags sdk.CodeType = 111 CodeSvcBindingExists sdk.CodeType = 112 CodeSvcBindingNotExists sdk.CodeType = 113 CodeInvalidDefChainId sdk.CodeType = 114 CodeInvalidBindingType sdk.CodeType = 115 CodeInvalidLevel sdk.CodeType = 116 CodeInvalidPriceCount sdk.CodeType = 117 CodeInvalidUpdate sdk.CodeType = 118 CodeRefundDeposit sdk.CodeType = 119 CodeInvalidExpiration sdk.CodeType = 120 )
const ( // name to idetify transaction types MsgType = "iservice" MaxTagsNum = 200 )
Variables ¶
This section is empty.
Functions ¶
func ErrDuplicateTags ¶
func ErrDuplicateTags(codespace sdk.CodespaceType) sdk.Error
func ErrInvalidAuthor ¶
func ErrInvalidAuthor(codespace sdk.CodespaceType) sdk.Error
func ErrInvalidBindingType ¶
func ErrInvalidBindingType(codespace sdk.CodespaceType, bindingType BindingType) sdk.Error
func ErrInvalidChainId ¶
func ErrInvalidChainId(codespace sdk.CodespaceType) sdk.Error
func ErrInvalidDefChainId ¶
func ErrInvalidDefChainId(codespace sdk.CodespaceType) sdk.Error
func ErrInvalidExpiration ¶
func ErrInvalidExpiration(codespace sdk.CodespaceType, expiration int64) sdk.Error
func ErrInvalidIDL ¶
func ErrInvalidIDL(codespace sdk.CodespaceType, msg string) sdk.Error
func ErrInvalidLevel ¶
func ErrInvalidLevel(codespace sdk.CodespaceType, level Level) sdk.Error
func ErrInvalidMessagingType ¶
func ErrInvalidMessagingType(codespace sdk.CodespaceType, value MessagingType) sdk.Error
func ErrInvalidMethodName ¶
func ErrInvalidMethodName(codespace sdk.CodespaceType) sdk.Error
func ErrInvalidOutputCachedEnum ¶
func ErrInvalidOutputCachedEnum(codespace sdk.CodespaceType, value string) sdk.Error
func ErrInvalidOutputPrivacyEnum ¶
func ErrInvalidOutputPrivacyEnum(codespace sdk.CodespaceType, value string) sdk.Error
func ErrInvalidPriceCount ¶
func ErrInvalidServiceName ¶
func ErrInvalidServiceName(codespace sdk.CodespaceType) sdk.Error
func ErrInvalidUpdate ¶
func ErrInvalidUpdate(codespace sdk.CodespaceType, msg string) sdk.Error
func ErrLtMinProviderDeposit ¶
func ErrMoreTags ¶
func ErrMoreTags(codespace sdk.CodespaceType, i int) sdk.Error
func ErrRefundDeposit ¶
func ErrRefundDeposit(codespace sdk.CodespaceType, msg string) sdk.Error
func ErrSvcBindingExists ¶
func ErrSvcBindingExists(codespace sdk.CodespaceType) sdk.Error
func ErrSvcBindingNotExists ¶
func ErrSvcBindingNotExists(codespace sdk.CodespaceType) sdk.Error
func ErrSvcDefExists ¶
func ErrSvcDefExists(codespace sdk.CodespaceType, defChainId, svcDefName string) sdk.Error
func ErrSvcDefNotExists ¶
func ErrSvcDefNotExists(codespace sdk.CodespaceType, defChainId, svcDefName string) sdk.Error
func GetBindingsSubspaceKey ¶
Key for getting all methods on a service from the store
func GetMethodPropertyKey ¶
id can not zero
func GetMethodsSubspaceKey ¶
Key for getting all methods on a service from the store
func GetServiceBindingKey ¶
func GetServiceBindingKey(defChainId, name, bindChainId string, provider sdk.AccAddress) []byte
func GetServiceDefinitionKey ¶
func InitGenesis ¶
func InitGenesis(ctx sdk.Context, data GenesisState)
InitGenesis - store genesis parameters
func SvcBindingEqual ¶
func SvcBindingEqual(bindingA, bindingB SvcBinding) bool
Types ¶
type BindingType ¶
type BindingType byte
const ( Global BindingType = 0x01 Local BindingType = 0x02 )
func BindingTypeFromString ¶
func BindingTypeFromString(str string) (BindingType, error)
String to BindingType byte, Returns ff if invalid.
func (BindingType) Format ¶
func (bt BindingType) Format(s fmt.State, verb rune)
For Printf / Sprintf, returns bech32 when using %s
func (BindingType) MarshalJSON ¶
func (bt BindingType) MarshalJSON() ([]byte, error)
Marshals to JSON using string
func (*BindingType) UnmarshalJSON ¶
func (bt *BindingType) UnmarshalJSON(data []byte) error
Unmarshals from JSON assuming Bech32 encoding
type GenesisState ¶
GenesisState - all service state that must be provided at genesis
func DefaultGenesisState ¶
func DefaultGenesisState() GenesisState
get raw genesis raw message for testing
func DefaultGenesisStateForTest ¶
func DefaultGenesisStateForTest() GenesisState
get raw genesis raw message for testing
func NewGenesisState ¶
func NewGenesisState(maxRequestTimeout int64, minProviderDeposit sdk.Coins) GenesisState
func WriteGenesis ¶
func WriteGenesis(ctx sdk.Context) GenesisState
WriteGenesis - output genesis parameters
type Keeper ¶
type Keeper struct {
// contains filtered or unexported fields
}
func (Keeper) AddServiceBinding ¶
func (Keeper) AddServiceDefinition ¶
func (Keeper) GetMethods ¶
Gets all the methods in a specific service
func (Keeper) GetServiceBinding ¶
func (k Keeper) GetServiceBinding(ctx sdk.Context, defChainID, defName, bindChainID string, provider sdk.AccAddress) (svcBinding SvcBinding, found bool)
func (Keeper) GetServiceDefinition ¶
func (Keeper) RefundDeposit ¶
func (Keeper) UpdateServiceBinding ¶
func (Keeper) ValidateMethodPrices ¶
type MessagingType ¶
type MessagingType byte
const ( Unicast MessagingType = 0x01 Multicast MessagingType = 0x02 )
func MessagingTypeFromString ¶
func MessagingTypeFromString(str string) (MessagingType, error)
String to messagingType byte, Returns ff if invalid.
func (MessagingType) Format ¶
func (mt MessagingType) Format(s fmt.State, verb rune)
For Printf / Sprintf, returns bech32 when using %s
func (MessagingType) MarshalJSON ¶
func (mt MessagingType) MarshalJSON() ([]byte, error)
Marshals to JSON using string
func (MessagingType) String ¶
func (mt MessagingType) String() string
Turns MessagingType byte to String
func (*MessagingType) UnmarshalJSON ¶
func (mt *MessagingType) UnmarshalJSON(data []byte) error
Unmarshals from JSON assuming Bech32 encoding
type MethodProperty ¶
type MethodProperty struct {
ID int `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
OutputPrivacy OutputPrivacyEnum `json:"output_privacy"`
OutputCached OutputCachedEnum `json:"output_cached"`
}
type MsgSvcBind ¶
type MsgSvcBind struct {
SvcBinding
}
MsgSvcBinding - struct for bind a service
func NewMsgSvcBind ¶
func NewMsgSvcBind(defChainID, defName, bindChainID string, provider sdk.AccAddress, bindingType BindingType, deposit sdk.Coins, prices []sdk.Coin, level Level, expiration int64) MsgSvcBind
func (MsgSvcBind) GetSignBytes ¶
func (msg MsgSvcBind) GetSignBytes() []byte
func (MsgSvcBind) GetSigners ¶
func (msg MsgSvcBind) GetSigners() []sdk.AccAddress
func (MsgSvcBind) Route ¶
func (msg MsgSvcBind) Route() string
func (MsgSvcBind) Type ¶
func (msg MsgSvcBind) Type() string
func (MsgSvcBind) ValidateBasic ¶
func (msg MsgSvcBind) ValidateBasic() sdk.Error
type MsgSvcBindingUpdate ¶
type MsgSvcBindingUpdate struct {
SvcBinding
}
MsgSvcBindingUpdate - struct for update a service binding
func NewMsgSvcBindingUpdate ¶
func NewMsgSvcBindingUpdate(defChainID, defName, bindChainID string, provider sdk.AccAddress, bindingType BindingType, deposit sdk.Coins, prices []sdk.Coin, level Level, expiration int64) MsgSvcBindingUpdate
func (MsgSvcBindingUpdate) GetSignBytes ¶
func (msg MsgSvcBindingUpdate) GetSignBytes() []byte
func (MsgSvcBindingUpdate) GetSigners ¶
func (msg MsgSvcBindingUpdate) GetSigners() []sdk.AccAddress
func (MsgSvcBindingUpdate) Route ¶
func (msg MsgSvcBindingUpdate) Route() string
func (MsgSvcBindingUpdate) Type ¶
func (msg MsgSvcBindingUpdate) Type() string
func (MsgSvcBindingUpdate) ValidateBasic ¶
func (msg MsgSvcBindingUpdate) ValidateBasic() sdk.Error
type MsgSvcDef ¶
type MsgSvcDef struct {
SvcDef
}
MsgSvcDef - struct for define a service
func NewMsgSvcDef ¶
func NewMsgSvcDef(name, chainId, description string, tags []string, author sdk.AccAddress, authorDescription, idlContent string, messaging MessagingType) MsgSvcDef
func (MsgSvcDef) GetSignBytes ¶
func (MsgSvcDef) GetSigners ¶
func (msg MsgSvcDef) GetSigners() []sdk.AccAddress
func (MsgSvcDef) ValidateBasic ¶
type MsgSvcRefundDeposit ¶
type MsgSvcRefundDeposit struct {
DefName string `json:"def_name"`
DefChainID string `json:"def_chain_id"`
BindChainID string `json:"bind_chain_id"`
Provider sdk.AccAddress `json:"provider"`
}
MsgSvcRefundDeposit - struct for refund deposit from a service binding
func NewMsgSvcRefundDeposit ¶
func NewMsgSvcRefundDeposit(defChainID, defName, bindChainID string, provider sdk.AccAddress) MsgSvcRefundDeposit
func (MsgSvcRefundDeposit) GetSignBytes ¶
func (msg MsgSvcRefundDeposit) GetSignBytes() []byte
func (MsgSvcRefundDeposit) GetSigners ¶
func (msg MsgSvcRefundDeposit) GetSigners() []sdk.AccAddress
func (MsgSvcRefundDeposit) Route ¶
func (msg MsgSvcRefundDeposit) Route() string
func (MsgSvcRefundDeposit) Type ¶
func (msg MsgSvcRefundDeposit) Type() string
func (MsgSvcRefundDeposit) ValidateBasic ¶
func (msg MsgSvcRefundDeposit) ValidateBasic() sdk.Error
type OutputCachedEnum ¶
type OutputCachedEnum byte
const ( OffChainCached OutputCachedEnum = 0x01 NoCached OutputCachedEnum = 0x02 )
func OutputCachedEnumFromString ¶
func OutputCachedEnumFromString(str string) (OutputCachedEnum, error)
String to outputCachedEnum byte, Returns ff if invalid.
func (OutputCachedEnum) Format ¶
func (oe OutputCachedEnum) Format(s fmt.State, verb rune)
For Printf / Sprintf, returns bech32 when using %s
func (OutputCachedEnum) MarshalJSON ¶
func (oe OutputCachedEnum) MarshalJSON() ([]byte, error)
Marshals to JSON using string
func (OutputCachedEnum) String ¶
func (oe OutputCachedEnum) String() string
Turns OutputCachedEnum byte to String
func (*OutputCachedEnum) UnmarshalJSON ¶
func (oe *OutputCachedEnum) UnmarshalJSON(data []byte) error
Unmarshals from JSON assuming Bech32 encoding
type OutputPrivacyEnum ¶
type OutputPrivacyEnum byte
const ( NoPrivacy OutputPrivacyEnum = 0x01 PubKeyEncryption OutputPrivacyEnum = 0x02 )
func OutputPrivacyEnumFromString ¶
func OutputPrivacyEnumFromString(str string) (OutputPrivacyEnum, error)
String to outputPrivacyEnum byte, Returns ff if invalid.
func (OutputPrivacyEnum) Format ¶
func (oe OutputPrivacyEnum) Format(s fmt.State, verb rune)
For Printf / Sprintf, returns bech32 when using %s
func (OutputPrivacyEnum) MarshalJSON ¶
func (oe OutputPrivacyEnum) MarshalJSON() ([]byte, error)
Marshals to JSON using string
func (OutputPrivacyEnum) String ¶
func (oe OutputPrivacyEnum) String() string
Turns OutputCachedEnum byte to String
func (*OutputPrivacyEnum) UnmarshalJSON ¶
func (oe *OutputPrivacyEnum) UnmarshalJSON(data []byte) error
Unmarshals from JSON assuming Bech32 encoding
type SvcBinding ¶
type SvcBinding struct {
DefName string `json:"def_name"`
DefChainID string `json:"def_chain_id"`
BindChainID string `json:"bind_chain_id"`
Provider sdk.AccAddress `json:"provider"`
BindingType BindingType `json:"binding_type"`
Deposit sdk.Coins `json:"deposit"`
Expiration int64 `json:"expiration"`
Prices []sdk.Coin `json:"price"`
Level Level `json:"level"`
}
func NewSvcBinding ¶
func NewSvcBinding(defChainID, defName, bindChainID string, provider sdk.AccAddress, bindingType BindingType, deposit sdk.Coins, prices []sdk.Coin, level Level, expiration int64) SvcBinding
NewSvcBinding returns a new SvcBinding with the provided values.
type SvcDef ¶
type SvcDef struct {
Name string `json:"name"`
ChainId string `json:"chain_id"`
Description string `json:"description"`
Tags []string `json:"tags"`
Author sdk.AccAddress `json:"author"`
AuthorDescription string `json:"author_description"`
IDLContent string `json:"idl_content"`
Messaging MessagingType `json:"messaging"`
}
func NewSvcDef ¶
func NewSvcDef(name, chainId, description string, tags []string, author sdk.AccAddress, authorDescription, idlContent string, messaging MessagingType) SvcDef