types

package
v12.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2024 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Overview

Package types is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const (
	EventTypeSetContractPriviledge   = "set_privileged_contract"
	EventTypeUnsetContractPriviledge = "unset_privileged_contract"
)
View Source
const (
	// ModuleName defines the module name
	ModuleName = "cron"

	// StoreKey defines the primary module store key
	StoreKey = ModuleName

	// RouterKey defines the module's message routing key
	RouterKey = ModuleName

	// MemStoreKey defines the in-memory store key
	MemStoreKey = "mem_cron"
)
View Source
const DefaultIndex uint64 = 1

DefaultIndex is the default global index

Variables

View Source
var (
	ErrContractDoesNotExist    = sdkerrors.Register(ModuleName, 2, "contract does not exist to modify its privilege")
	ErrContractPrivilegeNotSet = sdkerrors.Register(ModuleName, 3, "contract does not have privilege set and therefore cannot unset its privilege")
)

x/cron module sentinel errors

View Source
var (
	ErrInvalidLengthGenesis        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowGenesis          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	ErrInvalidLengthParams        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowParams          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupParams = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	ErrInvalidLengthProposal        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowProposal          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupProposal = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	ErrInvalidLengthQuery        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowQuery          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group")
)

EnableAllProposals contains all twasm gov types as keys.

View Source
var PrivilegedContractsPrefix = []byte{0x01}

Functions

func ParamKeyTable

func ParamKeyTable() paramtypes.KeyTable

ParamKeyTable the param key table for launch module

func PrivilegedContractsKey

func PrivilegedContractsKey(contractAddr sdk.AccAddress) []byte

func RandomAddress

func RandomAddress(_ *testing.T) sdk.AccAddress

func RandomBech32Address

func RandomBech32Address(t *testing.T) string

func RegisterCodec

func RegisterCodec(_ *codec.LegacyAmino)

func RegisterInterfaces

func RegisterInterfaces(registry cdctypes.InterfaceRegistry)

func RegisterLegacyAminoCodec

func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino)

RegisterLegacyAminoCodec registers the account types and interface

func RegisterMsgServer

func RegisterMsgServer(s grpc1.Server, srv MsgServer)

func RegisterQueryHandler

func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterQueryHandler registers the http handlers for service Query to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterQueryHandlerClient

func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error

RegisterQueryHandlerClient registers the http handlers for service Query to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "QueryClient" to call the correct interceptors.

func RegisterQueryHandlerFromEndpoint

func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterQueryHandlerServer

func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error

RegisterQueryHandlerServer registers the http handlers for service Query to "mux". UnaryRPC :call QueryServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead.

func RegisterQueryServer

func RegisterQueryServer(s grpc1.Server, srv QueryServer)

Types

type DemotePrivilegedContractProposal

type DemotePrivilegedContractProposal struct {
	// Title is a short summary
	Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty" yaml:"title"`
	// Description is a human readable text
	Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty" yaml:"description"`
	// Contract is the bech32 address of the smart contract
	Contract string `protobuf:"bytes,3,opt,name=contract,proto3" json:"contract,omitempty" yaml:"contract"`
}

DemotePrivilegedContractProposal gov proposal content type to remove "privileges" from a contract

func DemoteProposalFixture

func DemoteProposalFixture(mutators ...func(proposal *DemotePrivilegedContractProposal)) *DemotePrivilegedContractProposal

func (*DemotePrivilegedContractProposal) Descriptor

func (*DemotePrivilegedContractProposal) Descriptor() ([]byte, []int)

func (*DemotePrivilegedContractProposal) GetContract

func (m *DemotePrivilegedContractProposal) GetContract() string

func (*DemotePrivilegedContractProposal) GetDescription

func (m *DemotePrivilegedContractProposal) GetDescription() string

func (*DemotePrivilegedContractProposal) GetTitle

func (*DemotePrivilegedContractProposal) Marshal

func (m *DemotePrivilegedContractProposal) Marshal() (dAtA []byte, err error)

func (*DemotePrivilegedContractProposal) MarshalTo

func (m *DemotePrivilegedContractProposal) MarshalTo(dAtA []byte) (int, error)

func (*DemotePrivilegedContractProposal) MarshalToSizedBuffer

func (m *DemotePrivilegedContractProposal) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (DemotePrivilegedContractProposal) MarshalYAML

func (p DemotePrivilegedContractProposal) MarshalYAML() (interface{}, error)

MarshalYAML pretty prints the wasm byte code

func (DemotePrivilegedContractProposal) ProposalRoute

func (p DemotePrivilegedContractProposal) ProposalRoute() string

ProposalRoute returns the routing key of a parameter change proposal.

func (DemotePrivilegedContractProposal) ProposalType

func (p DemotePrivilegedContractProposal) ProposalType() string

ProposalType returns the type

func (*DemotePrivilegedContractProposal) ProtoMessage

func (*DemotePrivilegedContractProposal) ProtoMessage()

func (*DemotePrivilegedContractProposal) Reset

func (*DemotePrivilegedContractProposal) Size

func (m *DemotePrivilegedContractProposal) Size() (n int)

func (*DemotePrivilegedContractProposal) String

func (*DemotePrivilegedContractProposal) Unmarshal

func (m *DemotePrivilegedContractProposal) Unmarshal(dAtA []byte) error

func (DemotePrivilegedContractProposal) ValidateBasic

func (p DemotePrivilegedContractProposal) ValidateBasic() error

ValidateBasic validates the proposal

func (*DemotePrivilegedContractProposal) XXX_DiscardUnknown

func (m *DemotePrivilegedContractProposal) XXX_DiscardUnknown()

func (*DemotePrivilegedContractProposal) XXX_Marshal

func (m *DemotePrivilegedContractProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*DemotePrivilegedContractProposal) XXX_Merge

func (*DemotePrivilegedContractProposal) XXX_Size

func (m *DemotePrivilegedContractProposal) XXX_Size() int

func (*DemotePrivilegedContractProposal) XXX_Unmarshal

func (m *DemotePrivilegedContractProposal) XXX_Unmarshal(b []byte) error

type GenesisState

type GenesisState struct {
	// List of all the contracts that have been given the privilege status via
	// governance. They can set up hooks to abci.EndBlocker
	PrivilegedContractAddresses []string `` /* 144-byte string literal not displayed */
}

GenesisState defines the cron module's genesis state.

func DefaultGenesis

func DefaultGenesis() *GenesisState

DefaultGenesis returns the default genesis state

func (*GenesisState) Descriptor

func (*GenesisState) Descriptor() ([]byte, []int)

func (*GenesisState) GetPrivilegedContractAddresses

func (m *GenesisState) GetPrivilegedContractAddresses() []string

func (*GenesisState) Marshal

func (m *GenesisState) Marshal() (dAtA []byte, err error)

func (*GenesisState) MarshalTo

func (m *GenesisState) MarshalTo(dAtA []byte) (int, error)

func (*GenesisState) MarshalToSizedBuffer

func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*GenesisState) ProtoMessage

func (*GenesisState) ProtoMessage()

func (*GenesisState) Reset

func (m *GenesisState) Reset()

func (*GenesisState) Size

func (m *GenesisState) Size() (n int)

func (*GenesisState) String

func (m *GenesisState) String() string

func (*GenesisState) Unmarshal

func (m *GenesisState) Unmarshal(dAtA []byte) error

func (GenesisState) Validate

func (gs GenesisState) Validate() error

Validate performs basic genesis state validation returning an error upon any failure.

func (*GenesisState) XXX_DiscardUnknown

func (m *GenesisState) XXX_DiscardUnknown()

func (*GenesisState) XXX_Marshal

func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*GenesisState) XXX_Merge

func (m *GenesisState) XXX_Merge(src proto.Message)

func (*GenesisState) XXX_Size

func (m *GenesisState) XXX_Size() int

func (*GenesisState) XXX_Unmarshal

func (m *GenesisState) XXX_Unmarshal(b []byte) error

type MsgClient

type MsgClient interface {
}

MsgClient is the client API for Msg service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewMsgClient

func NewMsgClient(cc grpc1.ClientConn) MsgClient

type MsgServer

type MsgServer interface {
}

MsgServer is the server API for Msg service.

type Params

type Params struct {
}

Params defines the parameters for the module.

func DefaultParams

func DefaultParams() Params

DefaultParams returns a default set of parameters

func NewParams

func NewParams() Params

NewParams creates a new Params instance

func (*Params) Descriptor

func (*Params) Descriptor() ([]byte, []int)

func (*Params) Marshal

func (m *Params) Marshal() (dAtA []byte, err error)

func (*Params) MarshalTo

func (m *Params) MarshalTo(dAtA []byte) (int, error)

func (*Params) MarshalToSizedBuffer

func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Params) ParamSetPairs

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

ParamSetPairs get the params.ParamSet

func (*Params) ProtoMessage

func (*Params) ProtoMessage()

func (*Params) Reset

func (m *Params) Reset()

func (*Params) Size

func (m *Params) Size() (n int)

func (Params) String

func (p Params) String() string

String implements the Stringer interface.

func (*Params) Unmarshal

func (m *Params) Unmarshal(dAtA []byte) error

func (Params) Validate

func (p Params) Validate() error

Validate validates the set of params

func (*Params) XXX_DiscardUnknown

func (m *Params) XXX_DiscardUnknown()

func (*Params) XXX_Marshal

func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Params) XXX_Merge

func (m *Params) XXX_Merge(src proto.Message)

func (*Params) XXX_Size

func (m *Params) XXX_Size() int

func (*Params) XXX_Unmarshal

func (m *Params) XXX_Unmarshal(b []byte) error

type PromoteToPrivilegedContractProposal

type PromoteToPrivilegedContractProposal struct {
	// Title is a short summary
	Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty" yaml:"title"`
	// Description is a human readable text
	Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty" yaml:"description"`
	// Contract is the bech32 address of the smart contract
	Contract string `protobuf:"bytes,3,opt,name=contract,proto3" json:"contract,omitempty" yaml:"contract"`
}

PromoteToPrivilegedContractProposal gov proposal content type to add "privileges" to a contract

func (*PromoteToPrivilegedContractProposal) Descriptor

func (*PromoteToPrivilegedContractProposal) Descriptor() ([]byte, []int)

func (*PromoteToPrivilegedContractProposal) GetContract

func (*PromoteToPrivilegedContractProposal) GetDescription

func (m *PromoteToPrivilegedContractProposal) GetDescription() string

func (*PromoteToPrivilegedContractProposal) GetTitle

func (*PromoteToPrivilegedContractProposal) Marshal

func (m *PromoteToPrivilegedContractProposal) Marshal() (dAtA []byte, err error)

func (*PromoteToPrivilegedContractProposal) MarshalTo

func (m *PromoteToPrivilegedContractProposal) MarshalTo(dAtA []byte) (int, error)

func (*PromoteToPrivilegedContractProposal) MarshalToSizedBuffer

func (m *PromoteToPrivilegedContractProposal) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (PromoteToPrivilegedContractProposal) MarshalYAML

func (p PromoteToPrivilegedContractProposal) MarshalYAML() (interface{}, error)

MarshalYAML pretty prints the wasm byte code

func (PromoteToPrivilegedContractProposal) ProposalRoute

func (p PromoteToPrivilegedContractProposal) ProposalRoute() string

ProposalRoute returns the routing key of a parameter change proposal.

func (PromoteToPrivilegedContractProposal) ProposalType

ProposalType returns the type

func (*PromoteToPrivilegedContractProposal) ProtoMessage

func (*PromoteToPrivilegedContractProposal) ProtoMessage()

func (*PromoteToPrivilegedContractProposal) Reset

func (*PromoteToPrivilegedContractProposal) Size

func (*PromoteToPrivilegedContractProposal) String

func (*PromoteToPrivilegedContractProposal) Unmarshal

func (m *PromoteToPrivilegedContractProposal) Unmarshal(dAtA []byte) error

func (PromoteToPrivilegedContractProposal) ValidateBasic

func (p PromoteToPrivilegedContractProposal) ValidateBasic() error

ValidateBasic validates the proposal

func (*PromoteToPrivilegedContractProposal) XXX_DiscardUnknown

func (m *PromoteToPrivilegedContractProposal) XXX_DiscardUnknown()

func (*PromoteToPrivilegedContractProposal) XXX_Marshal

func (m *PromoteToPrivilegedContractProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*PromoteToPrivilegedContractProposal) XXX_Merge

func (*PromoteToPrivilegedContractProposal) XXX_Size

func (*PromoteToPrivilegedContractProposal) XXX_Unmarshal

func (m *PromoteToPrivilegedContractProposal) XXX_Unmarshal(b []byte) error

type ProposalType

type ProposalType string
const (
	ProposalTypePromoteContract ProposalType = "PromoteToPrivilegedContract"
	ProposalTypeDemoteContract  ProposalType = "DemotePrivilegedContract"
)

type QueryClient

type QueryClient interface {
	// ListPrivileged queries the contracts which have the priviledge status
	ListPrivileged(ctx context.Context, in *QueryListPrivilegedRequest, opts ...grpc.CallOption) (*QueryListPrivilegedResponse, error)
}

QueryClient is the client API for Query service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewQueryClient

func NewQueryClient(cc grpc1.ClientConn) QueryClient

type QueryListPrivilegedRequest

type QueryListPrivilegedRequest struct {
}

QueryListPrivilegedRequest is request type for the Query/ListPrivileged RPC method.

func (*QueryListPrivilegedRequest) Descriptor

func (*QueryListPrivilegedRequest) Descriptor() ([]byte, []int)

func (*QueryListPrivilegedRequest) Marshal

func (m *QueryListPrivilegedRequest) Marshal() (dAtA []byte, err error)

func (*QueryListPrivilegedRequest) MarshalTo

func (m *QueryListPrivilegedRequest) MarshalTo(dAtA []byte) (int, error)

func (*QueryListPrivilegedRequest) MarshalToSizedBuffer

func (m *QueryListPrivilegedRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*QueryListPrivilegedRequest) ProtoMessage

func (*QueryListPrivilegedRequest) ProtoMessage()

func (*QueryListPrivilegedRequest) Reset

func (m *QueryListPrivilegedRequest) Reset()

func (*QueryListPrivilegedRequest) Size

func (m *QueryListPrivilegedRequest) Size() (n int)

func (*QueryListPrivilegedRequest) String

func (m *QueryListPrivilegedRequest) String() string

func (*QueryListPrivilegedRequest) Unmarshal

func (m *QueryListPrivilegedRequest) Unmarshal(dAtA []byte) error

func (*QueryListPrivilegedRequest) XXX_DiscardUnknown

func (m *QueryListPrivilegedRequest) XXX_DiscardUnknown()

func (*QueryListPrivilegedRequest) XXX_Marshal

func (m *QueryListPrivilegedRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*QueryListPrivilegedRequest) XXX_Merge

func (m *QueryListPrivilegedRequest) XXX_Merge(src proto.Message)

func (*QueryListPrivilegedRequest) XXX_Size

func (m *QueryListPrivilegedRequest) XXX_Size() int

func (*QueryListPrivilegedRequest) XXX_Unmarshal

func (m *QueryListPrivilegedRequest) XXX_Unmarshal(b []byte) error

type QueryListPrivilegedResponse

type QueryListPrivilegedResponse struct {
	// contract_addresses holds all the smart contract addresses which have
	// privilege status.
	ContractAddresses []string `protobuf:"bytes,1,rep,name=contract_addresses,json=contractAddresses,proto3" json:"privileged_contract_addresses,omitempty"`
}

QueryListPrivilegedResponse is response type for the Query/ListPrivileged RPC method.

func (*QueryListPrivilegedResponse) Descriptor

func (*QueryListPrivilegedResponse) Descriptor() ([]byte, []int)

func (*QueryListPrivilegedResponse) GetContractAddresses

func (m *QueryListPrivilegedResponse) GetContractAddresses() []string

func (*QueryListPrivilegedResponse) Marshal

func (m *QueryListPrivilegedResponse) Marshal() (dAtA []byte, err error)

func (*QueryListPrivilegedResponse) MarshalTo

func (m *QueryListPrivilegedResponse) MarshalTo(dAtA []byte) (int, error)

func (*QueryListPrivilegedResponse) MarshalToSizedBuffer

func (m *QueryListPrivilegedResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*QueryListPrivilegedResponse) ProtoMessage

func (*QueryListPrivilegedResponse) ProtoMessage()

func (*QueryListPrivilegedResponse) Reset

func (m *QueryListPrivilegedResponse) Reset()

func (*QueryListPrivilegedResponse) Size

func (m *QueryListPrivilegedResponse) Size() (n int)

func (*QueryListPrivilegedResponse) String

func (m *QueryListPrivilegedResponse) String() string

func (*QueryListPrivilegedResponse) Unmarshal

func (m *QueryListPrivilegedResponse) Unmarshal(dAtA []byte) error

func (*QueryListPrivilegedResponse) XXX_DiscardUnknown

func (m *QueryListPrivilegedResponse) XXX_DiscardUnknown()

func (*QueryListPrivilegedResponse) XXX_Marshal

func (m *QueryListPrivilegedResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*QueryListPrivilegedResponse) XXX_Merge

func (m *QueryListPrivilegedResponse) XXX_Merge(src proto.Message)

func (*QueryListPrivilegedResponse) XXX_Size

func (m *QueryListPrivilegedResponse) XXX_Size() int

func (*QueryListPrivilegedResponse) XXX_Unmarshal

func (m *QueryListPrivilegedResponse) XXX_Unmarshal(b []byte) error

type QueryServer

type QueryServer interface {
	// ListPrivileged queries the contracts which have the priviledge status
	ListPrivileged(context.Context, *QueryListPrivilegedRequest) (*QueryListPrivilegedResponse, error)
}

QueryServer is the server API for Query service.

type UnimplementedMsgServer

type UnimplementedMsgServer struct {
}

UnimplementedMsgServer can be embedded to have forward compatible implementations.

type UnimplementedQueryServer

type UnimplementedQueryServer struct {
}

UnimplementedQueryServer can be embedded to have forward compatible implementations.

func (*UnimplementedQueryServer) ListPrivileged

type WasmKeeper

type WasmKeeper interface {
	// HasContractInfo checks if a contract with given address exists
	HasContractInfo(ctx sdk.Context, contractAddr sdk.AccAddress) bool
	// Sudo allows priviledged access to a contract
	Sudo(ctx sdk.Context, contractAddress sdk.AccAddress, msg []byte) ([]byte, error)
}

WasmKeeper defines the expected interface needed to setup and execute privilege contracts.

Jump to

Keyboard shortcuts

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