hold

package
v1.19.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2024 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Overview

Package hold is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const (
	// ModuleName is the name of the hold module.
	ModuleName = "hold"

	// StoreKey is the store key string for the hold module.
	StoreKey = ModuleName
)

Variables

View Source
var (
	ErrInvalidLengthEvents        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowEvents          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupEvents = fmt.Errorf("proto: unexpected end of group")
)
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 (
	ErrInvalidLengthHold        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowHold          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupHold = 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")
)

Functions

func HasBypass

func HasBypass[C context.Context](ctx C) bool

HasBypass checks the context to see if the hold locked coins lookup should be skipped.

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)

func WithBypass

func WithBypass[C context.Context](ctx C) C

WithBypass returns a new context that will cause the hold locked coins lookup to be skipped.

func WithoutBypass

func WithoutBypass[C context.Context](ctx C) C

WithoutBypass returns a new context that will cause the hold locked coins lookup to not be skipped.

Types

type AccountHold

type AccountHold struct {
	// address is the account address that holds the funds on hold.
	Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"`
	// amount is the balances that are on hold for the address.
	Amount github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,2,rep,name=amount,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"amount"`
}

AccountHold associates an address with an amount on hold for that address.

func (*AccountHold) Descriptor

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

func (*AccountHold) GetAddress

func (m *AccountHold) GetAddress() string

func (*AccountHold) GetAmount

func (*AccountHold) Marshal

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

func (*AccountHold) MarshalTo

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

func (*AccountHold) MarshalToSizedBuffer

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

func (*AccountHold) ProtoMessage

func (*AccountHold) ProtoMessage()

func (*AccountHold) Reset

func (m *AccountHold) Reset()

func (*AccountHold) Size

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

func (*AccountHold) String

func (m *AccountHold) String() string

func (*AccountHold) Unmarshal

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

func (AccountHold) Validate

func (e AccountHold) Validate() error

func (*AccountHold) XXX_DiscardUnknown

func (m *AccountHold) XXX_DiscardUnknown()

func (*AccountHold) XXX_Marshal

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

func (*AccountHold) XXX_Merge

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

func (*AccountHold) XXX_Size

func (m *AccountHold) XXX_Size() int

func (*AccountHold) XXX_Unmarshal

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

type BankKeeper

type BankKeeper interface {
	AppendLockedCoinsGetter(getter banktypes.GetLockedCoinsFn)
	SpendableCoins(ctx context.Context, addr sdk.AccAddress) sdk.Coins
}

type EventHoldAdded

type EventHoldAdded struct {
	// address is the bech32 address string of the account with the funds.
	Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"`
	// amount is a Coins string of the funds placed on hold.
	Amount string `protobuf:"bytes,2,opt,name=amount,proto3" json:"amount,omitempty"`
	// reason is a human-readable indicator of why this hold was added.
	Reason string `protobuf:"bytes,3,opt,name=reason,proto3" json:"reason,omitempty"`
}

EventHoldAdded is an event indicating that some funds were placed on hold in an account.

func NewEventHoldAdded

func NewEventHoldAdded(addr sdk.AccAddress, amount sdk.Coins, reason string) *EventHoldAdded

func (*EventHoldAdded) Descriptor

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

func (*EventHoldAdded) GetAddress

func (m *EventHoldAdded) GetAddress() string

func (*EventHoldAdded) GetAmount

func (m *EventHoldAdded) GetAmount() string

func (*EventHoldAdded) GetReason

func (m *EventHoldAdded) GetReason() string

func (*EventHoldAdded) Marshal

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

func (*EventHoldAdded) MarshalTo

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

func (*EventHoldAdded) MarshalToSizedBuffer

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

func (*EventHoldAdded) ProtoMessage

func (*EventHoldAdded) ProtoMessage()

func (*EventHoldAdded) Reset

func (m *EventHoldAdded) Reset()

func (*EventHoldAdded) Size

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

func (*EventHoldAdded) String

func (m *EventHoldAdded) String() string

func (*EventHoldAdded) Unmarshal

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

func (*EventHoldAdded) XXX_DiscardUnknown

func (m *EventHoldAdded) XXX_DiscardUnknown()

func (*EventHoldAdded) XXX_Marshal

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

func (*EventHoldAdded) XXX_Merge

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

func (*EventHoldAdded) XXX_Size

func (m *EventHoldAdded) XXX_Size() int

func (*EventHoldAdded) XXX_Unmarshal

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

type EventHoldReleased

type EventHoldReleased struct {
	// address is the bech32 address string of the account with the funds.
	Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"`
	// amount is a Coins string of the funds released from hold.
	Amount string `protobuf:"bytes,2,opt,name=amount,proto3" json:"amount,omitempty"`
}

EventHoldReleased is an event indicating that some funds were released from hold for an account.

func NewEventHoldReleased

func NewEventHoldReleased(addr sdk.AccAddress, amount sdk.Coins) *EventHoldReleased

func (*EventHoldReleased) Descriptor

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

func (*EventHoldReleased) GetAddress

func (m *EventHoldReleased) GetAddress() string

func (*EventHoldReleased) GetAmount

func (m *EventHoldReleased) GetAmount() string

func (*EventHoldReleased) Marshal

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

func (*EventHoldReleased) MarshalTo

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

func (*EventHoldReleased) MarshalToSizedBuffer

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

func (*EventHoldReleased) ProtoMessage

func (*EventHoldReleased) ProtoMessage()

func (*EventHoldReleased) Reset

func (m *EventHoldReleased) Reset()

func (*EventHoldReleased) Size

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

func (*EventHoldReleased) String

func (m *EventHoldReleased) String() string

func (*EventHoldReleased) Unmarshal

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

func (*EventHoldReleased) XXX_DiscardUnknown

func (m *EventHoldReleased) XXX_DiscardUnknown()

func (*EventHoldReleased) XXX_Marshal

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

func (*EventHoldReleased) XXX_Merge

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

func (*EventHoldReleased) XXX_Size

func (m *EventHoldReleased) XXX_Size() int

func (*EventHoldReleased) XXX_Unmarshal

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

type GenesisState

type GenesisState struct {
	// holds defines the funds on hold at genesis.
	Holds []*AccountHold `protobuf:"bytes,1,rep,name=holds,proto3" json:"holds,omitempty"`
}

GenesisState defines the attribute module's genesis state.

func DefaultGenesisState

func DefaultGenesisState() *GenesisState

func (*GenesisState) Descriptor

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

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 (g GenesisState) Validate() error

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 GetAllHoldsRequest

type GetAllHoldsRequest struct {
	// pagination defines an optional pagination for the request.
	Pagination *query.PageRequest `protobuf:"bytes,99,opt,name=pagination,proto3" json:"pagination,omitempty"`
}

GetAllHoldsRequest is the request type for the Query/GetAllHolds query.

func (*GetAllHoldsRequest) Descriptor

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

func (*GetAllHoldsRequest) Marshal

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

func (*GetAllHoldsRequest) MarshalTo

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

func (*GetAllHoldsRequest) MarshalToSizedBuffer

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

func (*GetAllHoldsRequest) ProtoMessage

func (*GetAllHoldsRequest) ProtoMessage()

func (*GetAllHoldsRequest) Reset

func (m *GetAllHoldsRequest) Reset()

func (*GetAllHoldsRequest) Size

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

func (*GetAllHoldsRequest) String

func (m *GetAllHoldsRequest) String() string

func (*GetAllHoldsRequest) Unmarshal

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

func (*GetAllHoldsRequest) XXX_DiscardUnknown

func (m *GetAllHoldsRequest) XXX_DiscardUnknown()

func (*GetAllHoldsRequest) XXX_Marshal

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

func (*GetAllHoldsRequest) XXX_Merge

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

func (*GetAllHoldsRequest) XXX_Size

func (m *GetAllHoldsRequest) XXX_Size() int

func (*GetAllHoldsRequest) XXX_Unmarshal

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

type GetAllHoldsResponse

type GetAllHoldsResponse struct {
	// holds is a list of addresses with funds on hold and the amounts being held.
	Holds []*AccountHold `protobuf:"bytes,1,rep,name=holds,proto3" json:"holds,omitempty"`
	// pagination defines an optional pagination for the request.
	Pagination *query.PageResponse `protobuf:"bytes,99,opt,name=pagination,proto3" json:"pagination,omitempty"`
}

GetAllHoldsResponse is the response type for the Query/GetAllHolds query.

func (*GetAllHoldsResponse) Descriptor

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

func (*GetAllHoldsResponse) GetHolds

func (m *GetAllHoldsResponse) GetHolds() []*AccountHold

func (*GetAllHoldsResponse) GetPagination

func (m *GetAllHoldsResponse) GetPagination() *query.PageResponse

func (*GetAllHoldsResponse) Marshal

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

func (*GetAllHoldsResponse) MarshalTo

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

func (*GetAllHoldsResponse) MarshalToSizedBuffer

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

func (*GetAllHoldsResponse) ProtoMessage

func (*GetAllHoldsResponse) ProtoMessage()

func (*GetAllHoldsResponse) Reset

func (m *GetAllHoldsResponse) Reset()

func (*GetAllHoldsResponse) Size

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

func (*GetAllHoldsResponse) String

func (m *GetAllHoldsResponse) String() string

func (*GetAllHoldsResponse) Unmarshal

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

func (*GetAllHoldsResponse) XXX_DiscardUnknown

func (m *GetAllHoldsResponse) XXX_DiscardUnknown()

func (*GetAllHoldsResponse) XXX_Marshal

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

func (*GetAllHoldsResponse) XXX_Merge

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

func (*GetAllHoldsResponse) XXX_Size

func (m *GetAllHoldsResponse) XXX_Size() int

func (*GetAllHoldsResponse) XXX_Unmarshal

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

type GetHoldsRequest

type GetHoldsRequest struct {
	// address is the account address to get on-hold balances for.
	Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"`
}

GetHoldsRequest is the request type for the Query/GetHolds query.

func (*GetHoldsRequest) Descriptor

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

func (*GetHoldsRequest) Marshal

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

func (*GetHoldsRequest) MarshalTo

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

func (*GetHoldsRequest) MarshalToSizedBuffer

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

func (*GetHoldsRequest) ProtoMessage

func (*GetHoldsRequest) ProtoMessage()

func (*GetHoldsRequest) Reset

func (m *GetHoldsRequest) Reset()

func (*GetHoldsRequest) Size

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

func (*GetHoldsRequest) String

func (m *GetHoldsRequest) String() string

func (*GetHoldsRequest) Unmarshal

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

func (*GetHoldsRequest) XXX_DiscardUnknown

func (m *GetHoldsRequest) XXX_DiscardUnknown()

func (*GetHoldsRequest) XXX_Marshal

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

func (*GetHoldsRequest) XXX_Merge

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

func (*GetHoldsRequest) XXX_Size

func (m *GetHoldsRequest) XXX_Size() int

func (*GetHoldsRequest) XXX_Unmarshal

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

type GetHoldsResponse

type GetHoldsResponse struct {
	// amount is the total on hold for the requested address.
	Amount github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,1,rep,name=amount,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"amount"`
}

GetHoldsResponse is the response type for the Query/GetHolds query.

func (*GetHoldsResponse) Descriptor

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

func (*GetHoldsResponse) Marshal

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

func (*GetHoldsResponse) MarshalTo

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

func (*GetHoldsResponse) MarshalToSizedBuffer

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

func (*GetHoldsResponse) ProtoMessage

func (*GetHoldsResponse) ProtoMessage()

func (*GetHoldsResponse) Reset

func (m *GetHoldsResponse) Reset()

func (*GetHoldsResponse) Size

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

func (*GetHoldsResponse) String

func (m *GetHoldsResponse) String() string

func (*GetHoldsResponse) Unmarshal

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

func (*GetHoldsResponse) XXX_DiscardUnknown

func (m *GetHoldsResponse) XXX_DiscardUnknown()

func (*GetHoldsResponse) XXX_Marshal

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

func (*GetHoldsResponse) XXX_Merge

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

func (*GetHoldsResponse) XXX_Size

func (m *GetHoldsResponse) XXX_Size() int

func (*GetHoldsResponse) XXX_Unmarshal

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

type QueryClient

type QueryClient interface {
	// GetHolds looks up the funds that are on hold for an address.
	GetHolds(ctx context.Context, in *GetHoldsRequest, opts ...grpc.CallOption) (*GetHoldsResponse, error)
	// GetAllHolds returns all addresses with funds on hold, and the amount held.
	GetAllHolds(ctx context.Context, in *GetAllHoldsRequest, opts ...grpc.CallOption) (*GetAllHoldsResponse, 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 QueryServer

type QueryServer interface {
	// GetHolds looks up the funds that are on hold for an address.
	GetHolds(context.Context, *GetHoldsRequest) (*GetHoldsResponse, error)
	// GetAllHolds returns all addresses with funds on hold, and the amount held.
	GetAllHolds(context.Context, *GetAllHoldsRequest) (*GetAllHoldsResponse, error)
}

QueryServer is the server API for Query service.

type UnimplementedQueryServer

type UnimplementedQueryServer struct {
}

UnimplementedQueryServer can be embedded to have forward compatible implementations.

func (*UnimplementedQueryServer) GetAllHolds

func (*UnimplementedQueryServer) GetHolds

Directories

Path Synopsis
client
cli

Jump to

Keyboard shortcuts

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