text:
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: cosmos/bank/v1beta1/query.proto

package types

import (
	context "context"
	fmt "fmt"
	github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types"
	types "github.com/cosmos/cosmos-sdk/types"
	query "github.com/cosmos/cosmos-sdk/types/query"
	_ "github.com/gogo/protobuf/gogoproto"
	grpc1 "github.com/gogo/protobuf/grpc"
	proto "github.com/gogo/protobuf/proto"
	grpc "google.golang.org/grpc"
	codes "google.golang.org/grpc/codes"
	status "google.golang.org/grpc/status"
	io "io"
	math "math"
	math_bits "math/bits"
)

// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf

// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package

// QueryBalanceRequest is the request type for the Query/Balance RPC method.
type QueryBalanceRequest struct {
	// address is the address to query balances for.
	Address github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,opt,name=address,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"address,omitempty"`
	// denom is the coin denom to query balances for.
	Denom string `protobuf:"bytes,2,opt,name=denom,proto3" json:"denom,omitempty"`
}

func (m *QueryBalanceRequest) Reset()         { *m = QueryBalanceRequest{} }
func (m *QueryBalanceRequest) String() string { return proto.CompactTextString(m) }
func (*QueryBalanceRequest) ProtoMessage()    {}
func (*QueryBalanceRequest) Descriptor() ([]byte, []int) {
	return fileDescriptor_9c6fc1939682df13, []int{0}
}
func (m *QueryBalanceRequest) XXX_Unmarshal(b []byte) error {
	return m.Unmarshal(b)
}
func (m *QueryBalanceRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
	if deterministic {
		return xxx_messageInfo_QueryBalanceRequest.Marshal(b, m, deterministic)
	} else {
		b = b[:cap(b)]
		n, err := m.MarshalToSizedBuffer(b)
		if err != nil {
			return nil, err
		}
		return b[:n], nil
	}
}
func (m *QueryBalanceRequest) XXX_Merge(src proto.Message) {
	xxx_messageInfo_QueryBalanceRequest.Merge(m, src)
}
func (m *QueryBalanceRequest) XXX_Size() int {
	return m.Size()
}
func (m *QueryBalanceRequest) XXX_DiscardUnknown() {
	xxx_messageInfo_QueryBalanceRequest.DiscardUnknown(m)
}

var xxx_messageInfo_QueryBalanceRequest proto.InternalMessageInfo

func (m *QueryBalanceRequest) GetAddress() github_com_cosmos_cosmos_sdk_types.AccAddress {
	if m != nil {
		return m.Address
	}
	return nil
}

func (m *QueryBalanceRequest) GetDenom() string {
	if m != nil {
		return m.Denom
	}
	return ""
}

// QueryBalanceResponse is the response type for the Query/Balance RPC method.
type QueryBalanceResponse struct {
	// balance is the balance of the coin.
	Balance *types.Coin `protobuf:"bytes,1,opt,name=balance,proto3" json:"balance,omitempty"`
}

func (m *QueryBalanceResponse) Reset()         { *m = QueryBalanceResponse{} }
func (m *QueryBalanceResponse) String() string { return proto.CompactTextString(m) }
func (*QueryBalanceResponse) ProtoMessage()    {}
func (*QueryBalanceResponse) Descriptor() ([]byte, []int) {
	return fileDescriptor_9c6fc1939682df13, []int{1}
}
func (m *QueryBalanceResponse) XXX_Unmarshal(b []byte) error {
	return m.Unmarshal(b)
}
func (m *QueryBalanceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
	if deterministic {
		return xxx_messageInfo_QueryBalanceResponse.Marshal(b, m, deterministic)
	} else {
		b = b[:cap(b)]
		n, err := m.MarshalToSizedBuffer(b)
		if err != nil {
			return nil, err
		}
		return b[:n], nil
	}
}
func (m *QueryBalanceResponse) XXX_Merge(src proto.Message) {
	xxx_messageInfo_QueryBalanceResponse.Merge(m, src)
}
func (m *QueryBalanceResponse) XXX_Size() int {
	return m.Size()
}
func (m *QueryBalanceResponse) XXX_DiscardUnknown() {
	xxx_messageInfo_QueryBalanceResponse.DiscardUnknown(m)
}

var xxx_messageInfo_QueryBalanceResponse proto.InternalMessageInfo

func (m *QueryBalanceResponse) GetBalance() *types.Coin {
	if m != nil {
		return m.Balance
	}
	return nil
}

// QueryBalanceRequest is the request type for the Query/AllBalances RPC method.
type QueryAllBalancesRequest struct {
	// address is the address to query balances for.
	Address github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,opt,name=address,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"address,omitempty"`
	// pagination defines an optional pagination for the request.
	Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"`
}

func (m *QueryAllBalancesRequest) Reset()         { *m = QueryAllBalancesRequest{} }
func (m *QueryAllBalancesRequest) String() string { return proto.CompactTextString(m) }
func (*QueryAllBalancesRequest) ProtoMessage()    {}
func (*QueryAllBalancesRequest) Descriptor() ([]byte, []int) {
	return fileDescriptor_9c6fc1939682df13, []int{2}
}
func (m *QueryAllBalancesRequest) XXX_Unmarshal(b []byte) error {
	return m.Unmarshal(b)
}
func (m *QueryAllBalancesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
	if deterministic {
		return xxx_messageInfo_QueryAllBalancesRequest.Marshal(b, m, deterministic)
	} else {
		b = b[:cap(b)]
		n, err := m.MarshalToSizedBuffer(b)
		if err != nil {
			return nil, err
		}
		return b[:n], nil
	}
}
func (m *QueryAllBalancesRequest) XXX_Merge(src proto.Message) {
	xxx_messageInfo_QueryAllBalancesRequest.Merge(m, src)
}
func (m *QueryAllBalancesRequest) XXX_Size() int {
	return m.Size()
}
func (m *QueryAllBalancesRequest) XXX_DiscardUnknown() {
	xxx_messageInfo_QueryAllBalancesRequest.DiscardUnknown(m)
}

var xxx_messageInfo_QueryAllBalancesRequest proto.InternalMessageInfo

func (m *QueryAllBalancesRequest) GetAddress() github_com_cosmos_cosmos_sdk_types.AccAddress {
	if m != nil {
		return m.Address
	}
	return nil
}

func (m *QueryAllBalancesRequest) GetPagination() *query.PageRequest {
	if m != nil {
		return m.Pagination
	}
	return nil
}

// QueryAllBalancesResponse is the response type for the Query/AllBalances RPC method.
type QueryAllBalancesResponse struct {
	// balances is the balances of all the coins.
	Balances github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,1,rep,name=balances,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"balances"`
	// pagination defines the pagination in the response.
	Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"`
}

func (m *QueryAllBalancesResponse) Reset()         { *m = QueryAllBalancesResponse{} }
func (m *QueryAllBalancesResponse) String() string { return proto.CompactTextString(m) }
func (*QueryAllBalancesResponse) ProtoMessage()    {}
func (*QueryAllBalancesResponse) Descriptor() ([]byte, []int) {
	return fileDescriptor_9c6fc1939682df13, []int{3}
}
func (m *QueryAllBalancesResponse) XXX_Unmarshal(b []byte) error {
	return m.Unmarshal(b)
}
func (m *QueryAllBalancesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
	if deterministic {
		return xxx_messageInfo_QueryAllBalancesResponse.Marshal(b, m, deterministic)
	} else {
		b = b[:cap(b)]
		n, err := m.MarshalToSizedBuffer(b)
		if err != nil {
			return nil, err
		}
		return b[:n], nil
	}
}
func (m *QueryAllBalancesResponse) XXX_Merge(src proto.Message) {
	xxx_messageInfo_QueryAllBalancesResponse.Merge(m, src)
}
func (m *QueryAllBalancesResponse) XXX_Size() int {
	return m.Size()
}
func (m *QueryAllBalancesResponse) XXX_DiscardUnknown() {
	xxx_messageInfo_QueryAllBalancesResponse.DiscardUnknown(m)
}

var xxx_messageInfo_QueryAllBalancesResponse proto.InternalMessageInfo

func (m *QueryAllBalancesResponse) GetBalances() github_com_cosmos_cosmos_sdk_types.Coins {
	if m != nil {
		return m.Balances
	}
	return nil
}

func (m *QueryAllBalancesResponse) GetPagination() *query.PageResponse {
	if m != nil {
		return m.Pagination
	}
	return nil
}

// QueryTotalSupplyRequest is the request type for the Query/TotalSupply RPC method.
type QueryTotalSupplyRequest struct {
}

func (m *QueryTotalSupplyRequest) Reset()         { *m = QueryTotalSupplyRequest{} }
func (m *QueryTotalSupplyRequest) String() string { return proto.CompactTextString(m) }
func (*QueryTotalSupplyRequest) ProtoMessage()    {}
func (*QueryTotalSupplyRequest) Descriptor() ([]byte, []int) {
	return fileDescriptor_9c6fc1939682df13, []int{4}
}
func (m *QueryTotalSupplyRequest) XXX_Unmarshal(b []byte) error {
	return m.Unmarshal(b)
}
func (m *QueryTotalSupplyRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
	if deterministic {
		return xxx_messageInfo_QueryTotalSupplyRequest.Marshal(b, m, deterministic)
	} else {
		b = b[:cap(b)]
		n, err := m.MarshalToSizedBuffer(b)
		if err != nil {
			return nil, err
		}
		return b[:n], nil
	}
}
func (m *QueryTotalSupplyRequest) XXX_Merge(src proto.Message) {
	xxx_messageInfo_QueryTotalSupplyRequest.Merge(m, src)
}
func (m *QueryTotalSupplyRequest) XXX_Size() int {
	return m.Size()
}
func (m *QueryTotalSupplyRequest) XXX_DiscardUnknown() {
	xxx_messageInfo_QueryTotalSupplyRequest.DiscardUnknown(m)
}

var xxx_messageInfo_QueryTotalSupplyRequest proto.InternalMessageInfo

// QueryTotalSupplyResponse is the response type for the Query/TotalSupply RPC method
type QueryTotalSupplyResponse struct {
	// supply is the supply of the coins
	Supply github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,1,rep,name=supply,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"supply"`
}

func (m *QueryTotalSupplyResponse) Reset()         { *m = QueryTotalSupplyResponse{} }
func (m *QueryTotalSupplyResponse) String() string { return proto.CompactTextString(m) }
func (*QueryTotalSupplyResponse) ProtoMessage()    {}
func (*QueryTotalSupplyResponse) Descriptor() ([]byte, []int) {
	return fileDescriptor_9c6fc1939682df13, []int{5}
}
func (m *QueryTotalSupplyResponse) XXX_Unmarshal(b []byte) error {
	return m.Unmarshal(b)
}
func (m *QueryTotalSupplyResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
	if deterministic {
		return xxx_messageInfo_QueryTotalSupplyResponse.Marshal(b, m, deterministic)
	} else {
		b = b[:cap(b)]
		n, err := m.MarshalToSizedBuffer(b)
		if err != nil {
			return nil, err
		}
		return b[:n], nil
	}
}
func (m *QueryTotalSupplyResponse) XXX_Merge(src proto.Message) {
	xxx_messageInfo_QueryTotalSupplyResponse.Merge(m, src)
}
func (m *QueryTotalSupplyResponse) XXX_Size() int {
	return m.Size()
}
func (m *QueryTotalSupplyResponse) XXX_DiscardUnknown() {
	xxx_messageInfo_QueryTotalSupplyResponse.DiscardUnknown(m)
}

var xxx_messageInfo_QueryTotalSupplyResponse proto.InternalMessageInfo

func (m *QueryTotalSupplyResponse) GetSupply() github_com_cosmos_cosmos_sdk_types.Coins {
	if m != nil {
		return m.Supply
	}
	return nil
}

// QuerySupplyOfRequest is the request type for the Query/SupplyOf RPC method.
type QuerySupplyOfRequest struct {
	// denom is the coin denom to query balances for.
	Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"`
}

func (m *QuerySupplyOfRequest) Reset()         { *m = QuerySupplyOfRequest{} }
func (m *QuerySupplyOfRequest) String() string { return proto.CompactTextString(m) }
func (*QuerySupplyOfRequest) ProtoMessage()    {}
func (*QuerySupplyOfRequest) Descriptor() ([]byte, []int) {
	return fileDescriptor_9c6fc1939682df13, []int{6}
}
func (m *QuerySupplyOfRequest) XXX_Unmarshal(b []byte) error {
	return m.Unmarshal(b)
}
func (m *QuerySupplyOfRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
	if deterministic {
		return xxx_messageInfo_QuerySupplyOfRequest.Marshal(b, m, deterministic)
	} else {
		b = b[:cap(b)]
		n, err := m.MarshalToSizedBuffer(b)
		if err != nil {
			return nil, err
		}
		return b[:n], nil
	}
}
func (m *QuerySupplyOfRequest) XXX_Merge(src proto.Message) {
	xxx_messageInfo_QuerySupplyOfRequest.Merge(m, src)
}
func (m *QuerySupplyOfRequest) XXX_Size() int {
	return m.Size()
}
func (m *QuerySupplyOfRequest) XXX_DiscardUnknown() {
	xxx_messageInfo_QuerySupplyOfRequest.DiscardUnknown(m)
}

var xxx_messageInfo_QuerySupplyOfRequest proto.InternalMessageInfo

func (m *QuerySupplyOfRequest) GetDenom() string {
	if m != nil {
		return m.Denom
	}
	return ""
}

// QuerySupplyOfResponse is the response type for the Query/SupplyOf RPC method.
type QuerySupplyOfResponse struct {
	// amount is the supply of the coin.
	Amount github_com_cosmos_cosmos_sdk_types.Coin `protobuf:"bytes,1,opt,name=amount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Coin" json:"amount"`
}

func (m *QuerySupplyOfResponse) Reset()         { *m = QuerySupplyOfResponse{} }
func (m *QuerySupplyOfResponse) String() string { return proto.CompactTextString(m) }
func (*QuerySupplyOfResponse) ProtoMessage()    {}
func (*QuerySupplyOfResponse) Descriptor() ([]byte, []int) {
	return fileDescriptor_9c6fc1939682df13, []int{7}
}
func (m *QuerySupplyOfResponse) XXX_Unmarshal(b []byte) error {
	return m.Unmarshal(b)
}
func (m *QuerySupplyOfResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
	if deterministic {
		return xxx_messageInfo_QuerySupplyOfResponse.Marshal(b, m, deterministic)
	} else {
		b = b[:cap(b)]
		n, err := m.MarshalToSizedBuffer(b)
		if err != nil {
			return nil, err
		}
		return b[:n], nil
	}
}
func (m *QuerySupplyOfResponse) XXX_Merge(src proto.Message) {
	xxx_messageInfo_QuerySupplyOfResponse.Merge(m, src)
}
func (m *QuerySupplyOfResponse) XXX_Size() int {
	return m.Size()
}
func (m *QuerySupplyOfResponse) XXX_DiscardUnknown() {
	xxx_messageInfo_QuerySupplyOfResponse.DiscardUnknown(m)
}

var xxx_messageInfo_QuerySupplyOfResponse proto.InternalMessageInfo

func init() {
	proto.RegisterType((*QueryBalanceRequest)(nil), "cosmos.bank.v1beta1.QueryBalanceRequest")
	proto.RegisterType((*QueryBalanceResponse)(nil), "cosmos.bank.v1beta1.QueryBalanceResponse")
	proto.RegisterType((*QueryAllBalancesRequest)(nil), "cosmos.bank.v1beta1.QueryAllBalancesRequest")
	proto.RegisterType((*QueryAllBalancesResponse)(nil), "cosmos.bank.v1beta1.QueryAllBalancesResponse")
	proto.RegisterType((*QueryTotalSupplyRequest)(nil), "cosmos.bank.v1beta1.QueryTotalSupplyRequest")
	proto.RegisterType((*QueryTotalSupplyResponse)(nil), "cosmos.bank.v1beta1.QueryTotalSupplyResponse")
	proto.RegisterType((*QuerySupplyOfRequest)(nil), "cosmos.bank.v1beta1.QuerySupplyOfRequest")
	proto.RegisterType((*QuerySupplyOfResponse)(nil), "cosmos.bank.v1beta1.QuerySupplyOfResponse")
}

func init() { proto.RegisterFile("cosmos/bank/v1beta1/query.proto", fileDescriptor_9c6fc1939682df13) }

var fileDescriptor_9c6fc1939682df13 = []byte{
	// 544 bytes of a gzipped FileDescriptorProto
	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x55, 0x31, 0x72, 0xd3, 0x40,
	0x14, 0x95, 0xc8, 0xc4, 0x0e, 0xdf, 0x54, 0x1b, 0x33, 0x38, 0x2e, 0xa4, 0x8c, 0x0a, 0xe2, 0x64,
	0x62, 0x09, 0x3b, 0x27, 0xb0, 0x32, 0x03, 0x45, 0x0a, 0x40, 0x50, 0x51, 0xb1, 0x92, 0x17, 0xa1,
	0x89, 0xac, 0x55, 0xbc, 0x12, 0x13, 0x0f, 0x05, 0x57, 0xe0, 0x1c, 0x29, 0x38, 0x47, 0x0a, 0x8a,
	0x94, 0x0c, 0x85, 0x61, 0xec, 0x5b, 0x50, 0x31, 0xd2, 0xee, 0x0a, 0x39, 0x36, 0x8a, 0x9a, 0x54,
	0x96, 0xd7, 0xef, 0xbf, 0xff, 0xdf, 0xfb, 0x4f, 0x6b, 0xd0, 0x3d, 0xca, 0x26, 0x94, 0x59, 0x2e,
	0x8e, 0xce, 0xad, 0x4f, 0x03, 0x97, 0x24, 0x78, 0x60, 0x5d, 0xa4, 0x64, 0x3a, 0x33, 0xe3, 0x29,
	0x4d, 0x28, 0xda, 0xe5, 0x00, 0x33, 0x03, 0x98, 0x02, 0xd0, 0x3d, 0x2a, 0xaa, 0x18, 0xe1, 0xe8,
	0xa2, 0x36, 0xc6, 0x7e, 0x10, 0xe1, 0x24, 0xa0, 0x11, 0x27, 0xe8, 0xb6, 0x7d, 0xea, 0xd3, 0xfc,
	0xd1, 0xca, 0x9e, 0xc4, 0xa9, 0x56, 0x66, 0x90, 0xb5, 0x1e, 0x0d, 0x44, 0x95, 0x71, 0x09, 0xbb,
	0xaf, 0x33, 0x5e, 0x1b, 0x87, 0x38, 0xf2, 0x88, 0x43, 0x2e, 0x52, 0xc2, 0x12, 0x74, 0x06, 0x4d,
	0x3c, 0x1e, 0x4f, 0x09, 0x63, 0x1d, 0x75, 0x5f, 0xed, 0x3d, 0xb2, 0x07, 0x7f, 0xe6, 0x7a, 0xdf,
	0x0f, 0x92, 0x8f, 0xa9, 0x6b, 0x7a, 0x74, 0x62, 0x09, 0x5a, 0xfe, 0xd1, 0x67, 0xe3, 0x73, 0x2b,
	0x99, 0xc5, 0x84, 0x99, 0x23, 0xcf, 0x1b, 0xf1, 0x42, 0x47, 0x32, 0xa0, 0x36, 0x6c, 0x8f, 0x49,
	0x44, 0x27, 0x9d, 0x07, 0xfb, 0x6a, 0xef, 0xa1, 0xc3, 0xbf, 0x18, 0x67, 0xd0, 0x5e, 0xed, 0xcc,
	0x62, 0x1a, 0x31, 0x82, 0x4e, 0xa0, 0xe9, 0xf2, 0xa3, 0xbc, 0x75, 0x6b, 0xb8, 0x67, 0x16, 0xd6,
	0x30, 0x22, 0xad, 0x31, 0x4f, 0x69, 0x10, 0x39, 0x12, 0x69, 0x7c, 0x53, 0xe1, 0x49, 0xce, 0x36,
	0x0a, 0x43, 0x41, 0xc8, 0xee, 0x45, 0xcb, 0x73, 0x80, 0x7f, 0xce, 0xe7, 0x82, 0x5a, 0xc3, 0xa7,
	0x2b, 0x03, 0xf2, 0xa5, 0xca, 0x31, 0x5f, 0x61, 0x5f, 0x9a, 0xea, 0x94, 0x2a, 0x8d, 0xef, 0x2a,
	0x74, 0xd6, 0x07, 0x16, 0x16, 0xf8, 0xb0, 0x23, 0x84, 0x65, 0x23, 0x6f, 0x55, 0x7a, 0x60, 0x3f,
	0xbb, 0x9e, 0xeb, 0xca, 0xd5, 0x2f, 0xbd, 0x57, 0x43, 0x51, 0x56, 0xc0, 0x9c, 0x82, 0x1c, 0xbd,
	0xd8, 0xa0, 0xe6, 0xe0, 0x4e, 0x35, 0x7c, 0xca, 0x15, 0x39, 0x7b, 0xc2, 0xfe, 0xb7, 0x34, 0xc1,
	0xe1, 0x9b, 0x34, 0x8e, 0xc3, 0x99, 0x50, 0x6d, 0x7c, 0x11, 0x42, 0x57, 0x7e, 0x12, 0x42, 0x3d,
	0x68, 0xb0, 0xfc, 0xe4, 0x3e, 0x64, 0x0a, 0x6a, 0xe3, 0x58, 0x04, 0x8d, 0xf7, 0x7e, 0xf9, 0x41,
	0xe6, 0xa2, 0x88, 0xa5, 0x5a, 0x8e, 0xe5, 0x67, 0x78, 0x7c, 0x0b, 0x2d, 0x66, 0x75, 0xa1, 0x81,
	0x27, 0x34, 0x8d, 0x92, 0x3b, 0x63, 0x69, 0x5b, 0xd9, 0xac, 0x3f, 0xe7, 0xfa, 0x41, 0xcd, 0x59,
	0x1d, 0xc1, 0x3c, 0xbc, 0xda, 0x82, 0xed, 0xbc, 0x3b, 0x7a, 0x0f, 0x4d, 0x11, 0x0b, 0xd4, 0x33,
	0x37, 0x5c, 0x0d, 0xe6, 0x86, 0xb7, 0xb6, 0x7b, 0x58, 0x03, 0xc9, 0xd5, 0x18, 0x0a, 0x0a, 0xa1,
	0x55, 0xca, 0x1e, 0x3a, 0xfe, 0x7f, 0xed, 0xfa, 0x3b, 0xd5, 0xed, 0xd7, 0x44, 0x97, 0xbb, 0x95,
	0x02, 0x50, 0xd5, 0x6d, 0x3d, 0x42, 0x55, 0xdd, 0x36, 0xa4, 0xca, 0x50, 0x90, 0x07, 0x3b, 0x72,
	0x7f, 0xa8, 0xc2, 0x94, 0x5b, 0x89, 0xe8, 0x1e, 0xd5, 0x81, 0xca, 0x26, 0xf6, 0xe9, 0xf5, 0x42,
	0x53, 0x6f, 0x16, 0x9a, 0xfa, 0x7b, 0xa1, 0xa9, 0x5f, 0x97, 0x9a, 0x72, 0xb3, 0xd4, 0x94, 0x1f,
	0x4b, 0x4d, 0x79, 0x77, 0x58, 0xb9, 0xf7, 0x4b, 0xfe, 0x27, 0x90, 0xaf, 0xdf, 0x6d, 0xe4, 0xd7,
	0xf0, 0xc9, 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x74, 0xd8, 0x3c, 0x1b, 0x20, 0x06, 0x00, 0x00,
}

// Reference imports to suppress errors if they are not otherwise used.
var _ context.Context
var _ grpc.ClientConn

// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
const _ = grpc.SupportPackageIsVersion4

// 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.
type QueryClient interface {
	// Balance queries the balance of a single coin for a single account.
	Balance(ctx context.Context, in *QueryBalanceRequest, opts ...grpc.CallOption) (*QueryBalanceResponse, error)
	// AllBalances queries the balance of all coins for a single account.
	AllBalances(ctx context.Context, in *QueryAllBalancesRequest, opts ...grpc.CallOption) (*QueryAllBalancesResponse, error)
	// TotalSupply queries the total supply of all coins.
	TotalSupply(ctx context.Context, in *QueryTotalSupplyRequest, opts ...grpc.CallOption) (*QueryTotalSupplyResponse, error)
	// SupplyOf queries the supply of a single coin.
	SupplyOf(ctx context.Context, in *QuerySupplyOfRequest, opts ...grpc.CallOption) (*QuerySupplyOfResponse, error)
}

type queryClient struct {
	cc grpc1.ClientConn
}

func NewQueryClient(cc grpc1.ClientConn) QueryClient {
	return &queryClient{cc}
}

func (c *queryClient) Balance(ctx context.Context, in *QueryBalanceRequest, opts ...grpc.CallOption) (*QueryBalanceResponse, error) {
	out := new(QueryBalanceResponse)
	err := c.cc.Invoke(ctx, "/cosmos.bank.v1beta1.Query/Balance", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *queryClient) AllBalances(ctx context.Context, in *QueryAllBalancesRequest, opts ...grpc.CallOption) (*QueryAllBalancesResponse, error) {
	out := new(QueryAllBalancesResponse)
	err := c.cc.Invoke(ctx, "/cosmos.bank.v1beta1.Query/AllBalances", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *queryClient) TotalSupply(ctx context.Context, in *QueryTotalSupplyRequest, opts ...grpc.CallOption) (*QueryTotalSupplyResponse, error) {
	out := new(QueryTotalSupplyResponse)
	err := c.cc.Invoke(ctx, "/cosmos.bank.v1beta1.Query/TotalSupply", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *queryClient) SupplyOf(ctx context.Context, in *QuerySupplyOfRequest, opts ...grpc.CallOption) (*QuerySupplyOfResponse, error) {
	out := new(QuerySupplyOfResponse)
	err := c.cc.Invoke(ctx, "/cosmos.bank.v1beta1.Query/SupplyOf", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

// QueryServer is the server API for Query service.
type QueryServer interface {
	// Balance queries the balance of a single coin for a single account.
	Balance(context.Context, *QueryBalanceRequest) (*QueryBalanceResponse, error)
	// AllBalances queries the balance of all coins for a single account.
	AllBalances(context.Context, *QueryAllBalancesRequest) (*QueryAllBalancesResponse, error)
	// TotalSupply queries the total supply of all coins.
	TotalSupply(context.Context, *QueryTotalSupplyRequest) (*QueryTotalSupplyResponse, error)
	// SupplyOf queries the supply of a single coin.
	SupplyOf(context.Context, *QuerySupplyOfRequest) (*QuerySupplyOfResponse, error)
}

// UnimplementedQueryServer can be embedded to have forward compatible implementations.
type UnimplementedQueryServer struct {
}

func (*UnimplementedQueryServer) Balance(ctx context.Context, req *QueryBalanceRequest) (*QueryBalanceResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method Balance not implemented")
}
func (*UnimplementedQueryServer) AllBalances(ctx context.Context, req *QueryAllBalancesRequest) (*QueryAllBalancesResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method AllBalances not implemented")
}
func (*UnimplementedQueryServer) TotalSupply(ctx context.Context, req *QueryTotalSupplyRequest) (*QueryTotalSupplyResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method TotalSupply not implemented")
}
func (*UnimplementedQueryServer) SupplyOf(ctx context.Context, req *QuerySupplyOfRequest) (*QuerySupplyOfResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method SupplyOf not implemented")
}

func RegisterQueryServer(s grpc1.Server, srv QueryServer) {
	s.RegisterService(&_Query_serviceDesc, srv)
}

func _Query_Balance_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(QueryBalanceRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(QueryServer).Balance(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/cosmos.bank.v1beta1.Query/Balance",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(QueryServer).Balance(ctx, req.(*QueryBalanceRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _Query_AllBalances_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(QueryAllBalancesRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(QueryServer).AllBalances(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/cosmos.bank.v1beta1.Query/AllBalances",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(QueryServer).AllBalances(ctx, req.(*QueryAllBalancesRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _Query_TotalSupply_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(QueryTotalSupplyRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(QueryServer).TotalSupply(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/cosmos.bank.v1beta1.Query/TotalSupply",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(QueryServer).TotalSupply(ctx, req.(*QueryTotalSupplyRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _Query_SupplyOf_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(QuerySupplyOfRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(QueryServer).SupplyOf(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/cosmos.bank.v1beta1.Query/SupplyOf",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(QueryServer).SupplyOf(ctx, req.(*QuerySupplyOfRequest))
	}
	return interceptor(ctx, in, info, handler)
}

var _Query_serviceDesc = grpc.ServiceDesc{
	ServiceName: "cosmos.bank.v1beta1.Query",
	HandlerType: (*QueryServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Balance",
			Handler:    _Query_Balance_Handler,
		},
		{
			MethodName: "AllBalances",
			Handler:    _Query_AllBalances_Handler,
		},
		{
			MethodName: "TotalSupply",
			Handler:    _Query_TotalSupply_Handler,
		},
		{
			MethodName: "SupplyOf",
			Handler:    _Query_SupplyOf_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "cosmos/bank/v1beta1/query.proto",
}

func (m *QueryBalanceRequest) Marshal() (dAtA []byte, err error) {
	size := m.Size()
	dAtA = make([]byte, size)
	n, err := m.MarshalToSizedBuffer(dAtA[:size])
	if err != nil {
		return nil, err
	}
	return dAtA[:n], nil
}

func (m *QueryBalanceRequest) MarshalTo(dAtA []byte) (int, error) {
	size := m.Size()
	return m.MarshalToSizedBuffer(dAtA[:size])
}

func (m *QueryBalanceRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
	i := len(dAtA)
	_ = i
	var l int
	_ = l
	if len(m.Denom) > 0 {
		i -= len(m.Denom)
		copy(dAtA[i:], m.Denom)
		i = encodeVarintQuery(dAtA, i, uint64(len(m.Denom)))
		i--
		dAtA[i] = 0x12
	}
	if len(m.Address) > 0 {
		i -= len(m.Address)
		copy(dAtA[i:], m.Address)
		i = encodeVarintQuery(dAtA, i, uint64(len(m.Address)))
		i--
		dAtA[i] = 0xa
	}
	return len(dAtA) - i, nil
}

func (m *QueryBalanceResponse) Marshal() (dAtA []byte, err error) {
	size := m.Size()
	dAtA = make([]byte, size)
	n, err := m.MarshalToSizedBuffer(dAtA[:size])
	if err != nil {
		return nil, err
	}
	return dAtA[:n], nil
}

func (m *QueryBalanceResponse) MarshalTo(dAtA []byte) (int, error) {
	size := m.Size()
	return m.MarshalToSizedBuffer(dAtA[:size])
}

func (m *QueryBalanceResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
	i := len(dAtA)
	_ = i
	var l int
	_ = l
	if m.Balance != nil {
		{
			size, err := m.Balance.MarshalToSizedBuffer(dAtA[:i])
			if err != nil {
				return 0, err
			}
			i -= size
			i = encodeVarintQuery(dAtA, i, uint64(size))
		}
		i--
		dAtA[i] = 0xa
	}
	return len(dAtA) - i, nil
}

func (m *QueryAllBalancesRequest) Marshal() (dAtA []byte, err error) {
	size := m.Size()
	dAtA = make([]byte, size)
	n, err := m.MarshalToSizedBuffer(dAtA[:size])
	if err != nil {
		return nil, err
	}
	return dAtA[:n], nil
}

func (m *QueryAllBalancesRequest) MarshalTo(dAtA []byte) (int, error) {
	size := m.Size()
	return m.MarshalToSizedBuffer(dAtA[:size])
}

func (m *QueryAllBalancesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
	i := len(dAtA)
	_ = i
	var l int
	_ = l
	if m.Pagination != nil {
		{
			size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i])
			if err != nil {
				return 0, err
			}
			i -= size
			i = encodeVarintQuery(dAtA, i, uint64(size))
		}
		i--
		dAtA[i] = 0x12
	}
	if len(m.Address) > 0 {
		i -= len(m.Address)
		copy(dAtA[i:], m.Address)
		i = encodeVarintQuery(dAtA, i, uint64(len(m.Address)))
		i--
		dAtA[i] = 0xa
	}
	return len(dAtA) - i, nil
}

func (m *QueryAllBalancesResponse) Marshal() (dAtA []byte, err error) {
	size := m.Size()
	dAtA = make([]byte, size)
	n, err := m.MarshalToSizedBuffer(dAtA[:size])
	if err != nil {
		return nil, err
	}
	return dAtA[:n], nil
}

func (m *QueryAllBalancesResponse) MarshalTo(dAtA []byte) (int, error) {
	size := m.Size()
	return m.MarshalToSizedBuffer(dAtA[:size])
}

func (m *QueryAllBalancesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
	i := len(dAtA)
	_ = i
	var l int
	_ = l
	if m.Pagination != nil {
		{
			size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i])
			if err != nil {
				return 0, err
			}
			i -= size
			i = encodeVarintQuery(dAtA, i, uint64(size))
		}
		i--
		dAtA[i] = 0x12
	}
	if len(m.Balances) > 0 {
		for iNdEx := len(m.Balances) - 1; iNdEx >= 0; iNdEx-- {
			{
				size, err := m.Balances[iNdEx].MarshalToSizedBuffer(dAtA[:i])
				if err != nil {
					return 0, err
				}
				i -= size
				i = encodeVarintQuery(dAtA, i, uint64(size))
			}
			i--
			dAtA[i] = 0xa
		}
	}
	return len(dAtA) - i, nil
}

func (m *QueryTotalSupplyRequest) Marshal() (dAtA []byte, err error) {
	size := m.Size()
	dAtA = make([]byte, size)
	n, err := m.MarshalToSizedBuffer(dAtA[:size])
	if err != nil {
		return nil, err
	}
	return dAtA[:n], nil
}

func (m *QueryTotalSupplyRequest) MarshalTo(dAtA []byte) (int, error) {
	size := m.Size()
	return m.MarshalToSizedBuffer(dAtA[:size])
}

func (m *QueryTotalSupplyRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
	i := len(dAtA)
	_ = i
	var l int
	_ = l
	return len(dAtA) - i, nil
}

func (m *QueryTotalSupplyResponse) Marshal() (dAtA []byte, err error) {
	size := m.Size()
	dAtA = make([]byte, size)
	n, err := m.MarshalToSizedBuffer(dAtA[:size])
	if err != nil {
		return nil, err
	}
	return dAtA[:n], nil
}

func (m *QueryTotalSupplyResponse) MarshalTo(dAtA []byte) (int, error) {
	size := m.Size()
	return m.MarshalToSizedBuffer(dAtA[:size])
}

func (m *QueryTotalSupplyResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
	i := len(dAtA)
	_ = i
	var l int
	_ = l
	if len(m.Supply) > 0 {
		for iNdEx := len(m.Supply) - 1; iNdEx >= 0; iNdEx-- {
			{
				size, err := m.Supply[iNdEx].MarshalToSizedBuffer(dAtA[:i])
				if err != nil {
					return 0, err
				}
				i -= size
				i = encodeVarintQuery(dAtA, i, uint64(size))
			}
			i--
			dAtA[i] = 0xa
		}
	}
	return len(dAtA) - i, nil
}

func (m *QuerySupplyOfRequest) Marshal() (dAtA []byte, err error) {
	size := m.Size()
	dAtA = make([]byte, size)
	n, err := m.MarshalToSizedBuffer(dAtA[:size])
	if err != nil {
		return nil, err
	}
	return dAtA[:n], nil
}

func (m *QuerySupplyOfRequest) MarshalTo(dAtA []byte) (int, error) {
	size := m.Size()
	return m.MarshalToSizedBuffer(dAtA[:size])
}

func (m *QuerySupplyOfRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
	i := len(dAtA)
	_ = i
	var l int
	_ = l
	if len(m.Denom) > 0 {
		i -= len(m.Denom)
		copy(dAtA[i:], m.Denom)
		i = encodeVarintQuery(dAtA, i, uint64(len(m.Denom)))
		i--
		dAtA[i] = 0xa
	}
	return len(dAtA) - i, nil
}

func (m *QuerySupplyOfResponse) Marshal() (dAtA []byte, err error) {
	size := m.Size()
	dAtA = make([]byte, size)
	n, err := m.MarshalToSizedBuffer(dAtA[:size])
	if err != nil {
		return nil, err
	}
	return dAtA[:n], nil
}

func (m *QuerySupplyOfResponse) MarshalTo(dAtA []byte) (int, error) {
	size := m.Size()
	return m.MarshalToSizedBuffer(dAtA[:size])
}

func (m *QuerySupplyOfResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
	i := len(dAtA)
	_ = i
	var l int
	_ = l
	{
		size := m.Amount.Size()
		i -= size
		if _, err := m.Amount.MarshalTo(dAtA[i:]); err != nil {
			return 0, err
		}
		i = encodeVarintQuery(dAtA, i, uint64(size))
	}
	i--
	dAtA[i] = 0xa
	return len(dAtA) - i, nil
}

func encodeVarintQuery(dAtA []byte, offset int, v uint64) int {
	offset -= sovQuery(v)
	base := offset
	for v >= 1<<7 {
		dAtA[offset] = uint8(v&0x7f | 0x80)
		v >>= 7
		offset++
	}
	dAtA[offset] = uint8(v)
	return base
}
func (m *QueryBalanceRequest) Size() (n int) {
	if m == nil {
		return 0
	}
	var l int
	_ = l
	l = len(m.Address)
	if l > 0 {
		n += 1 + l + sovQuery(uint64(l))
	}
	l = len(m.Denom)
	if l > 0 {
		n += 1 + l + sovQuery(uint64(l))
	}
	return n
}

func (m *QueryBalanceResponse) Size() (n int) {
	if m == nil {
		return 0
	}
	var l int
	_ = l
	if m.Balance != nil {
		l = m.Balance.Size()
		n += 1 + l + sovQuery(uint64(l))
	}
	return n
}

func (m *QueryAllBalancesRequest) Size() (n int) {
	if m == nil {
		return 0
	}
	var l int
	_ = l
	l = len(m.Address)
	if l > 0 {
		n += 1 + l + sovQuery(uint64(l))
	}
	if m.Pagination != nil {
		l = m.Pagination.Size()
		n += 1 + l + sovQuery(uint64(l))
	}
	return n
}

func (m *QueryAllBalancesResponse) Size() (n int) {
	if m == nil {
		return 0
	}
	var l int
	_ = l
	if len(m.Balances) > 0 {
		for _, e := range m.Balances {
			l = e.Size()
			n += 1 + l + sovQuery(uint64(l))
		}
	}
	if m.Pagination != nil {
		l = m.Pagination.Size()
		n += 1 + l + sovQuery(uint64(l))
	}
	return n
}

func (m *QueryTotalSupplyRequest) Size() (n int) {
	if m == nil {
		return 0
	}
	var l int
	_ = l
	return n
}

func (m *QueryTotalSupplyResponse) Size() (n int) {
	if m == nil {
		return 0
	}
	var l int
	_ = l
	if len(m.Supply) > 0 {
		for _, e := range m.Supply {
			l = e.Size()
			n += 1 + l + sovQuery(uint64(l))
		}
	}
	return n
}

func (m *QuerySupplyOfRequest) Size() (n int) {
	if m == nil {
		return 0
	}
	var l int
	_ = l
	l = len(m.Denom)
	if l > 0 {
		n += 1 + l + sovQuery(uint64(l))
	}
	return n
}

func (m *QuerySupplyOfResponse) Size() (n int) {
	if m == nil {
		return 0
	}
	var l int
	_ = l
	l = m.Amount.Size()
	n += 1 + l + sovQuery(uint64(l))
	return n
}

func sovQuery(x uint64) (n int) {
	return (math_bits.Len64(x|1) + 6) / 7
}
func sozQuery(x uint64) (n int) {
	return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *QueryBalanceRequest) Unmarshal(dAtA []byte) error {
	l := len(dAtA)
	iNdEx := 0
	for iNdEx < l {
		preIndex := iNdEx
		var wire uint64
		for shift := uint(0); ; shift += 7 {
			if shift >= 64 {
				return ErrIntOverflowQuery
			}
			if iNdEx >= l {
				return io.ErrUnexpectedEOF
			}
			b := dAtA[iNdEx]
			iNdEx++
			wire |= uint64(b&0x7F) << shift
			if b < 0x80 {
				break
			}
		}
		fieldNum := int32(wire >> 3)
		wireType := int(wire & 0x7)
		if wireType == 4 {
			return fmt.Errorf("proto: QueryBalanceRequest: wiretype end group for non-group")
		}
		if fieldNum <= 0 {
			return fmt.Errorf("proto: QueryBalanceRequest: illegal tag %d (wire type %d)", fieldNum, wire)
		}
		switch fieldNum {
		case 1:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType)
			}
			var byteLen int
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return ErrIntOverflowQuery
				}
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				byteLen |= int(b&0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			if byteLen < 0 {
				return ErrInvalidLengthQuery
			}
			postIndex := iNdEx + byteLen
			if postIndex < 0 {
				return ErrInvalidLengthQuery
			}
			if postIndex > l {
				return io.ErrUnexpectedEOF
			}
			m.Address = append(m.Address[:0], dAtA[iNdEx:postIndex]...)
			if m.Address == nil {
				m.Address = []byte{}
			}
			iNdEx = postIndex
		case 2:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType)
			}
			var stringLen uint64
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return ErrIntOverflowQuery
				}
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				stringLen |= uint64(b&0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			intStringLen := int(stringLen)
			if intStringLen < 0 {
				return ErrInvalidLengthQuery
			}
			postIndex := iNdEx + intStringLen
			if postIndex < 0 {
				return ErrInvalidLengthQuery
			}
			if postIndex > l {
				return io.ErrUnexpectedEOF
			}
			m.Denom = string(dAtA[iNdEx:postIndex])
			iNdEx = postIndex
		default:
			iNdEx = preIndex
			skippy, err := skipQuery(dAtA[iNdEx:])
			if err != nil {
				return err
			}
			if skippy < 0 {
				return ErrInvalidLengthQuery
			}
			if (iNdEx + skippy) < 0 {
				return ErrInvalidLengthQuery
			}
			if (iNdEx + skippy) > l {
				return io.ErrUnexpectedEOF
			}
			iNdEx += skippy
		}
	}

	if iNdEx > l {
		return io.ErrUnexpectedEOF
	}
	return nil
}
func (m *QueryBalanceResponse) Unmarshal(dAtA []byte) error {
	l := len(dAtA)
	iNdEx := 0
	for iNdEx < l {
		preIndex := iNdEx
		var wire uint64
		for shift := uint(0); ; shift += 7 {
			if shift >= 64 {
				return ErrIntOverflowQuery
			}
			if iNdEx >= l {
				return io.ErrUnexpectedEOF
			}
			b := dAtA[iNdEx]
			iNdEx++
			wire |= uint64(b&0x7F) << shift
			if b < 0x80 {
				break
			}
		}
		fieldNum := int32(wire >> 3)
		wireType := int(wire & 0x7)
		if wireType == 4 {
			return fmt.Errorf("proto: QueryBalanceResponse: wiretype end group for non-group")
		}
		if fieldNum <= 0 {
			return fmt.Errorf("proto: QueryBalanceResponse: illegal tag %d (wire type %d)", fieldNum, wire)
		}
		switch fieldNum {
		case 1:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field Balance", wireType)
			}
			var msglen int
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return ErrIntOverflowQuery
				}
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				msglen |= int(b&0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			if msglen < 0 {
				return ErrInvalidLengthQuery
			}
			postIndex := iNdEx + msglen
			if postIndex < 0 {
				return ErrInvalidLengthQuery
			}
			if postIndex > l {
				return io.ErrUnexpectedEOF
			}
			if m.Balance == nil {
				m.Balance = &types.Coin{}
			}
			if err := m.Balance.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
				return err
			}
			iNdEx = postIndex
		default:
			iNdEx = preIndex
			skippy, err := skipQuery(dAtA[iNdEx:])
			if err != nil {
				return err
			}
			if skippy < 0 {
				return ErrInvalidLengthQuery
			}
			if (iNdEx + skippy) < 0 {
				return ErrInvalidLengthQuery
			}
			if (iNdEx + skippy) > l {
				return io.ErrUnexpectedEOF
			}
			iNdEx += skippy
		}
	}

	if iNdEx > l {
		return io.ErrUnexpectedEOF
	}
	return nil
}
func (m *QueryAllBalancesRequest) Unmarshal(dAtA []byte) error {
	l := len(dAtA)
	iNdEx := 0
	for iNdEx < l {
		preIndex := iNdEx
		var wire uint64
		for shift := uint(0); ; shift += 7 {
			if shift >= 64 {
				return ErrIntOverflowQuery
			}
			if iNdEx >= l {
				return io.ErrUnexpectedEOF
			}
			b := dAtA[iNdEx]
			iNdEx++
			wire |= uint64(b&0x7F) << shift
			if b < 0x80 {
				break
			}
		}
		fieldNum := int32(wire >> 3)
		wireType := int(wire & 0x7)
		if wireType == 4 {
			return fmt.Errorf("proto: QueryAllBalancesRequest: wiretype end group for non-group")
		}
		if fieldNum <= 0 {
			return fmt.Errorf("proto: QueryAllBalancesRequest: illegal tag %d (wire type %d)", fieldNum, wire)
		}
		switch fieldNum {
		case 1:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType)
			}
			var byteLen int
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return ErrIntOverflowQuery
				}
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				byteLen |= int(b&0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			if byteLen < 0 {
				return ErrInvalidLengthQuery
			}
			postIndex := iNdEx + byteLen
			if postIndex < 0 {
				return ErrInvalidLengthQuery
			}
			if postIndex > l {
				return io.ErrUnexpectedEOF
			}
			m.Address = append(m.Address[:0], dAtA[iNdEx:postIndex]...)
			if m.Address == nil {
				m.Address = []byte{}
			}
			iNdEx = postIndex
		case 2:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType)
			}
			var msglen int
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return ErrIntOverflowQuery
				}
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				msglen |= int(b&0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			if msglen < 0 {
				return ErrInvalidLengthQuery
			}
			postIndex := iNdEx + msglen
			if postIndex < 0 {
				return ErrInvalidLengthQuery
			}
			if postIndex > l {
				return io.ErrUnexpectedEOF
			}
			if m.Pagination == nil {
				m.Pagination = &query.PageRequest{}
			}
			if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
				return err
			}
			iNdEx = postIndex
		default:
			iNdEx = preIndex
			skippy, err := skipQuery(dAtA[iNdEx:])
			if err != nil {
				return err
			}
			if skippy < 0 {
				return ErrInvalidLengthQuery
			}
			if (iNdEx + skippy) < 0 {
				return ErrInvalidLengthQuery
			}
			if (iNdEx + skippy) > l {
				return io.ErrUnexpectedEOF
			}
			iNdEx += skippy
		}
	}

	if iNdEx > l {
		return io.ErrUnexpectedEOF
	}
	return nil
}
func (m *QueryAllBalancesResponse) Unmarshal(dAtA []byte) error {
	l := len(dAtA)
	iNdEx := 0
	for iNdEx < l {
		preIndex := iNdEx
		var wire uint64
		for shift := uint(0); ; shift += 7 {
			if shift >= 64 {
				return ErrIntOverflowQuery
			}
			if iNdEx >= l {
				return io.ErrUnexpectedEOF
			}
			b := dAtA[iNdEx]
			iNdEx++
			wire |= uint64(b&0x7F) << shift
			if b < 0x80 {
				break
			}
		}
		fieldNum := int32(wire >> 3)
		wireType := int(wire & 0x7)
		if wireType == 4 {
			return fmt.Errorf("proto: QueryAllBalancesResponse: wiretype end group for non-group")
		}
		if fieldNum <= 0 {
			return fmt.Errorf("proto: QueryAllBalancesResponse: illegal tag %d (wire type %d)", fieldNum, wire)
		}
		switch fieldNum {
		case 1:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field Balances", wireType)
			}
			var msglen int
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return ErrIntOverflowQuery
				}
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				msglen |= int(b&0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			if msglen < 0 {
				return ErrInvalidLengthQuery
			}
			postIndex := iNdEx + msglen
			if postIndex < 0 {
				return ErrInvalidLengthQuery
			}
			if postIndex > l {
				return io.ErrUnexpectedEOF
			}
			m.Balances = append(m.Balances, types.Coin{})
			if err := m.Balances[len(m.Balances)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
				return err
			}
			iNdEx = postIndex
		case 2:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType)
			}
			var msglen int
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return ErrIntOverflowQuery
				}
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				msglen |= int(b&0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			if msglen < 0 {
				return ErrInvalidLengthQuery
			}
			postIndex := iNdEx + msglen
			if postIndex < 0 {
				return ErrInvalidLengthQuery
			}
			if postIndex > l {
				return io.ErrUnexpectedEOF
			}
			if m.Pagination == nil {
				m.Pagination = &query.PageResponse{}
			}
			if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
				return err
			}
			iNdEx = postIndex
		default:
			iNdEx = preIndex
			skippy, err := skipQuery(dAtA[iNdEx:])
			if err != nil {
				return err
			}
			if skippy < 0 {
				return ErrInvalidLengthQuery
			}
			if (iNdEx + skippy) < 0 {
				return ErrInvalidLengthQuery
			}
			if (iNdEx + skippy) > l {
				return io.ErrUnexpectedEOF
			}
			iNdEx += skippy
		}
	}

	if iNdEx > l {
		return io.ErrUnexpectedEOF
	}
	return nil
}
func (m *QueryTotalSupplyRequest) Unmarshal(dAtA []byte) error {
	l := len(dAtA)
	iNdEx := 0
	for iNdEx < l {
		preIndex := iNdEx
		var wire uint64
		for shift := uint(0); ; shift += 7 {
			if shift >= 64 {
				return ErrIntOverflowQuery
			}
			if iNdEx >= l {
				return io.ErrUnexpectedEOF
			}
			b := dAtA[iNdEx]
			iNdEx++
			wire |= uint64(b&0x7F) << shift
			if b < 0x80 {
				break
			}
		}
		fieldNum := int32(wire >> 3)
		wireType := int(wire & 0x7)
		if wireType == 4 {
			return fmt.Errorf("proto: QueryTotalSupplyRequest: wiretype end group for non-group")
		}
		if fieldNum <= 0 {
			return fmt.Errorf("proto: QueryTotalSupplyRequest: illegal tag %d (wire type %d)", fieldNum, wire)
		}
		switch fieldNum {
		default:
			iNdEx = preIndex
			skippy, err := skipQuery(dAtA[iNdEx:])
			if err != nil {
				return err
			}
			if skippy < 0 {
				return ErrInvalidLengthQuery
			}
			if (iNdEx + skippy) < 0 {
				return ErrInvalidLengthQuery
			}
			if (iNdEx + skippy) > l {
				return io.ErrUnexpectedEOF
			}
			iNdEx += skippy
		}
	}

	if iNdEx > l {
		return io.ErrUnexpectedEOF
	}
	return nil
}
func (m *QueryTotalSupplyResponse) Unmarshal(dAtA []byte) error {
	l := len(dAtA)
	iNdEx := 0
	for iNdEx < l {
		preIndex := iNdEx
		var wire uint64
		for shift := uint(0); ; shift += 7 {
			if shift >= 64 {
				return ErrIntOverflowQuery
			}
			if iNdEx >= l {
				return io.ErrUnexpectedEOF
			}
			b := dAtA[iNdEx]
			iNdEx++
			wire |= uint64(b&0x7F) << shift
			if b < 0x80 {
				break
			}
		}
		fieldNum := int32(wire >> 3)
		wireType := int(wire & 0x7)
		if wireType == 4 {
			return fmt.Errorf("proto: QueryTotalSupplyResponse: wiretype end group for non-group")
		}
		if fieldNum <= 0 {
			return fmt.Errorf("proto: QueryTotalSupplyResponse: illegal tag %d (wire type %d)", fieldNum, wire)
		}
		switch fieldNum {
		case 1:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field Supply", wireType)
			}
			var msglen int
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return ErrIntOverflowQuery
				}
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				msglen |= int(b&0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			if msglen < 0 {
				return ErrInvalidLengthQuery
			}
			postIndex := iNdEx + msglen
			if postIndex < 0 {
				return ErrInvalidLengthQuery
			}
			if postIndex > l {
				return io.ErrUnexpectedEOF
			}
			m.Supply = append(m.Supply, types.Coin{})
			if err := m.Supply[len(m.Supply)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
				return err
			}
			iNdEx = postIndex
		default:
			iNdEx = preIndex
			skippy, err := skipQuery(dAtA[iNdEx:])
			if err != nil {
				return err
			}
			if skippy < 0 {
				return ErrInvalidLengthQuery
			}
			if (iNdEx + skippy) < 0 {
				return ErrInvalidLengthQuery
			}
			if (iNdEx + skippy) > l {
				return io.ErrUnexpectedEOF
			}
			iNdEx += skippy
		}
	}

	if iNdEx > l {
		return io.ErrUnexpectedEOF
	}
	return nil
}
func (m *QuerySupplyOfRequest) Unmarshal(dAtA []byte) error {
	l := len(dAtA)
	iNdEx := 0
	for iNdEx < l {
		preIndex := iNdEx
		var wire uint64
		for shift := uint(0); ; shift += 7 {
			if shift >= 64 {
				return ErrIntOverflowQuery
			}
			if iNdEx >= l {
				return io.ErrUnexpectedEOF
			}
			b := dAtA[iNdEx]
			iNdEx++
			wire |= uint64(b&0x7F) << shift
			if b < 0x80 {
				break
			}
		}
		fieldNum := int32(wire >> 3)
		wireType := int(wire & 0x7)
		if wireType == 4 {
			return fmt.Errorf("proto: QuerySupplyOfRequest: wiretype end group for non-group")
		}
		if fieldNum <= 0 {
			return fmt.Errorf("proto: QuerySupplyOfRequest: illegal tag %d (wire type %d)", fieldNum, wire)
		}
		switch fieldNum {
		case 1:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType)
			}
			var stringLen uint64
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return ErrIntOverflowQuery
				}
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				stringLen |= uint64(b&0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			intStringLen := int(stringLen)
			if intStringLen < 0 {
				return ErrInvalidLengthQuery
			}
			postIndex := iNdEx + intStringLen
			if postIndex < 0 {
				return ErrInvalidLengthQuery
			}
			if postIndex > l {
				return io.ErrUnexpectedEOF
			}
			m.Denom = string(dAtA[iNdEx:postIndex])
			iNdEx = postIndex
		default:
			iNdEx = preIndex
			skippy, err := skipQuery(dAtA[iNdEx:])
			if err != nil {
				return err
			}
			if skippy < 0 {
				return ErrInvalidLengthQuery
			}
			if (iNdEx + skippy) < 0 {
				return ErrInvalidLengthQuery
			}
			if (iNdEx + skippy) > l {
				return io.ErrUnexpectedEOF
			}
			iNdEx += skippy
		}
	}

	if iNdEx > l {
		return io.ErrUnexpectedEOF
	}
	return nil
}
func (m *QuerySupplyOfResponse) Unmarshal(dAtA []byte) error {
	l := len(dAtA)
	iNdEx := 0
	for iNdEx < l {
		preIndex := iNdEx
		var wire uint64
		for shift := uint(0); ; shift += 7 {
			if shift >= 64 {
				return ErrIntOverflowQuery
			}
			if iNdEx >= l {
				return io.ErrUnexpectedEOF
			}
			b := dAtA[iNdEx]
			iNdEx++
			wire |= uint64(b&0x7F) << shift
			if b < 0x80 {
				break
			}
		}
		fieldNum := int32(wire >> 3)
		wireType := int(wire & 0x7)
		if wireType == 4 {
			return fmt.Errorf("proto: QuerySupplyOfResponse: wiretype end group for non-group")
		}
		if fieldNum <= 0 {
			return fmt.Errorf("proto: QuerySupplyOfResponse: illegal tag %d (wire type %d)", fieldNum, wire)
		}
		switch fieldNum {
		case 1:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType)
			}
			var msglen int
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return ErrIntOverflowQuery
				}
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				msglen |= int(b&0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			if msglen < 0 {
				return ErrInvalidLengthQuery
			}
			postIndex := iNdEx + msglen
			if postIndex < 0 {
				return ErrInvalidLengthQuery
			}
			if postIndex > l {
				return io.ErrUnexpectedEOF
			}
			if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
				return err
			}
			iNdEx = postIndex
		default:
			iNdEx = preIndex
			skippy, err := skipQuery(dAtA[iNdEx:])
			if err != nil {
				return err
			}
			if skippy < 0 {
				return ErrInvalidLengthQuery
			}
			if (iNdEx + skippy) < 0 {
				return ErrInvalidLengthQuery
			}
			if (iNdEx + skippy) > l {
				return io.ErrUnexpectedEOF
			}
			iNdEx += skippy
		}
	}

	if iNdEx > l {
		return io.ErrUnexpectedEOF
	}
	return nil
}
func skipQuery(dAtA []byte) (n int, err error) {
	l := len(dAtA)
	iNdEx := 0
	depth := 0
	for iNdEx < l {
		var wire uint64
		for shift := uint(0); ; shift += 7 {
			if shift >= 64 {
				return 0, ErrIntOverflowQuery
			}
			if iNdEx >= l {
				return 0, io.ErrUnexpectedEOF
			}
			b := dAtA[iNdEx]
			iNdEx++
			wire |= (uint64(b) & 0x7F) << shift
			if b < 0x80 {
				break
			}
		}
		wireType := int(wire & 0x7)
		switch wireType {
		case 0:
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return 0, ErrIntOverflowQuery
				}
				if iNdEx >= l {
					return 0, io.ErrUnexpectedEOF
				}
				iNdEx++
				if dAtA[iNdEx-1] < 0x80 {
					break
				}
			}
		case 1:
			iNdEx += 8
		case 2:
			var length int
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return 0, ErrIntOverflowQuery
				}
				if iNdEx >= l {
					return 0, io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				length |= (int(b) & 0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			if length < 0 {
				return 0, ErrInvalidLengthQuery
			}
			iNdEx += length
		case 3:
			depth++
		case 4:
			if depth == 0 {
				return 0, ErrUnexpectedEndOfGroupQuery
			}
			depth--
		case 5:
			iNdEx += 4
		default:
			return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
		}
		if iNdEx < 0 {
			return 0, ErrInvalidLengthQuery
		}
		if depth == 0 {
			return iNdEx, nil
		}
	}
	return 0, io.ErrUnexpectedEOF
}

var (
	ErrInvalidLengthQuery        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowQuery          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group")
)

repository: fantasyup/cosmos-sdk

repo_name: fantasyup/cosmos-sdk


text:
package github

// StargazersSorter implements Sorter interface and sorts by stargazers count.
type StargazersSorter RepositoriesWithPR

func (r StargazersSorter) Len() int           { return len(r) }
func (r StargazersSorter) Swap(i, j int)      { r[i], r[j] = r[j], r[i] }
func (r StargazersSorter) Less(i, j int) bool { return r[i].StargazersCount > r[j].StargazersCount }

// ForksSorter implements Sorter interface and sorts by forks count.
type ForksSorter RepositoriesWithPR

func (r ForksSorter) Len() int           { return len(r) }
func (r ForksSorter) Swap(i, j int)      { r[i], r[j] = r[j], r[i] }
func (r ForksSorter) Less(i, j int) bool { return r[i].ForksCount > r[j].ForksCount }

func (r RepositoriesWithPR) Len() int           { return len(r) }
func (r RepositoriesWithPR) Swap(i, j int)      { r[i], r[j] = r[j], r[i] }
func (r RepositoriesWithPR) Less(i, j int) bool { return r[i].PRCount > r[j].PRCount }

// PRsSorter implements Sorter interface and sorts by PRs count.
type PRsSorter RepositoriesWithPR

func (r PRsSorter) Len() int           { return len(r) }
func (r PRsSorter) Swap(i, j int)      { r[i], r[j] = r[j], r[i] }
func (r PRsSorter) Less(i, j int) bool { return r[i].PRCount > r[j].PRCount }

// ContribSorter implements Sorter interface and sorts by PRs/forks count.
type ContribSorter RepositoriesWithPR

func (r ContribSorter) Len() int           { return len(r) }
func (r ContribSorter) Swap(i, j int)      { r[i], r[j] = r[j], r[i] }
func (r ContribSorter) Less(i, j int) bool { return r[i].Contrib() > r[j].Contrib() }

repository: uthark/github-cli

license_type: permissive

repo_name: uthark/github-cli

branch_name: refs/heads/master

extension: go


text:
package object

import (
	"github.com/trasa/watchmud-message/slot"
)

type Slots struct {
	slotMap map[slot.Location]*Instance
	dirty   bool
}

func NewSlots() *Slots {
	return &Slots{
		slotMap: make(map[slot.Location]*Instance),
	}
}

func (slots *Slots) GetAll() map[slot.Location]*Instance {
	m := make(map[slot.Location]*Instance)
	for k, v := range slots.slotMap {
		m[k] = v
	}
	return m
}

func (slots *Slots) Get(s slot.Location) *Instance {
	if s == slot.None {
		return nil
	}
	return slots.slotMap[s]
}

func (slots *Slots) Set(s slot.Location, obj *Instance) {
	slots.dirty = true
	slots.slotMap[s] = obj
}

func (slots *Slots) IsSlotInUse(s slot.Location) (result bool) {
	_, result = slots.slotMap[s]
	return
}

func (slots *Slots) IsItemInUse(obj *Instance) bool {
	for _, inst := range slots.slotMap {
		if inst == obj {
			return true
		}
	}
	return false
}

func (slots *Slots) ResetDirtyFlag() {
	slots.dirty = false
}

func (slots *Slots) IsDirty() bool {
	return slots.dirty
}

license: MIT

repository: trasa/watchmud

repo_name: trasa/watchmud

gha_license_id: MIT

gha_language: Go


text:
DESCRIPTION = "Linux kernel for Micrel KS8695(P) based devices"
SECTION = "kernel"
LICENSE = "GPL"
PR = "r0"

SRC_URI = "${KERNELORG_MIRROR}/pub/linux/kernel/v2.6/linux-${PV}.tar.bz2 \
           file://ks8695-headers-r0.patch;patch=1 \
           file://ks8695-base-r0.patch;patch=1 \
           file://defconfig-ks8695"

S = "${WORKDIR}/linux-${PV}"

COMPATIBLE_HOST = 'arm.*-linux'
COMPATIBLE_MACHINE = "ks8695"

inherit kernel
inherit package

ARCH = "arm"
CMDLINE = "ttyS0,115200n8 root=/dev/mtdblock2 init=/linuxrc"

do_configure_prepend() {
	install -m 0644 ${WORKDIR}/defconfig-${MACHINE} ${S}/.config
	echo "CONFIG_CMDLINE=\"${CMDLINE}\"" >> ${S}/.config
}

extension: bb


text:
package manager

import (
	"crypto/ecdsa"
	"crypto/elliptic"
	"crypto/rand"
	"crypto/x509"
	"errors"
	"fmt"
	"time"

	"github.com/spiffe/spire/pkg/agent/manager/cache"
	"github.com/spiffe/spire/pkg/common/util"
	"github.com/spiffe/spire/proto/api/node"
	"github.com/spiffe/spire/proto/common"
	proto "github.com/spiffe/spire/proto/common"
)

// synchronize hits the node api, checks for entries we haven't fetched yet, and fetches them.
func (m *manager) synchronize(spiffeID string) (err error) {
	var regEntries map[string]*proto.RegistrationEntry
	var cEntryRequests entryRequests

	regEntries, _, err = m.fetchUpdates(spiffeID, nil)
	if err != nil {
		return err
	}

	cEntryRequests, err = m.checkExpiredCacheEntries()
	if err != nil {
		return err
	}

	// While there are registration entries or cache entries to process...
	for len(regEntries) > 0 || len(cEntryRequests) > 0 {
		cEntryRequests, err = m.checkForNewCacheEntries(regEntries, cEntryRequests)
		if err != nil {
			return err
		}

		regEntries, err = m.processEntryRequests(cEntryRequests)
		if err != nil {
			return err
		}
		cEntryRequests = entryRequests{}
	}

	return nil
}

// entryRequest holds a CSR and a pre-built cache entry for the RegistrationEntry
// contained in the entry field.
type entryRequest struct {
	CSR   []byte
	entry *cache.Entry
}

// entryRequests is a map keyed by SPIFFEID where each value is a list
// of entryRequest that should be processed using the SVID and PrivateKey
// created for it.
type entryRequests map[string][]*entryRequest

func (m *manager) fetchUpdates(spiffeID string, entryRequests []*entryRequest) (map[string]*common.RegistrationEntry, map[string]*node.Svid, error) {
	client := m.syncClients.get(spiffeID)
	if client == nil {
		return nil, nil, fmt.Errorf("no client found for %s", spiffeID)
	}
	// Put all the CSRs in an array to make just one call with all the CSRs.
	csrs := [][]byte{}
	if entryRequests != nil {
		for _, entryRequest := range entryRequests {
			m.c.Log.Debugf("Requesting SVID for %v", entryRequest.entry.RegistrationEntry.SpiffeId)
			csrs = append(csrs, entryRequest.CSR)
		}
	}

	update, err := client.sendAndReceive(&node.FetchSVIDRequest{Csrs: csrs})
	if err != nil && err != ErrPartialResponse {
		return nil, nil, err
	}

	if update.lastBundle != nil {
		bundle, err := x509.ParseCertificates(update.lastBundle)
		if err != nil {
			return nil, nil, err
		}
		m.setBundle(bundle)
	}

	return update.regEntries, update.svids, nil
}

func (m *manager) processEntryRequests(entryRequests entryRequests) (map[string]*common.RegistrationEntry, error) {
	regEntries := map[string]*common.RegistrationEntry{}
	if len(entryRequests) == 0 {
		return regEntries, nil
	}

	for parentID, entryRequestsList := range entryRequests {
		re, svids, err := m.fetchUpdates(parentID, entryRequestsList)
		if err != nil {
			return nil, err
		}
		err = m.updateEntriesSVIDs(entryRequestsList, svids)
		if err != nil {
			return nil, err
		}
		// Collect registrations entries.
		for k, e := range re {
			regEntries[k] = e
		}
	}
	return regEntries, nil
}

func (m *manager) updateEntriesSVIDs(entryRequestsList []*entryRequest, svids map[string]*node.Svid) error {
	for _, entryRequest := range entryRequestsList {
		ce := entryRequest.entry
		svid, ok := svids[ce.RegistrationEntry.SpiffeId]
		if ok {
			cert, err := x509.ParseCertificate(svid.SvidCert)
			if err != nil {
				return err
			}
			// Complete the pre-built cache entry with the SVID and put it on the cache.
			ce.SVID = cert
			if m.isAgentAlias(ce.RegistrationEntry) {
				m.c.Log.Debugf("Agent alias detected: %s", ce.RegistrationEntry.SpiffeId)
				// Create a new client to be used when checking for new entries on behalf of this
				// agent's alias.
				err := m.newSyncClient([]string{ce.RegistrationEntry.SpiffeId}, ce.SVID, ce.PrivateKey)
				if err != nil {
					return err
				}
			}
			m.cache.SetEntry(ce)
		}
	}
	return nil
}

func (m *manager) checkExpiredCacheEntries() (entryRequests, error) {
	defer m.c.Tel.MeasureSince([]string{"cache_manager", "expiry_check_duration"}, time.Now())

	entryRequests := entryRequests{}
	for entry := range m.cache.Entries() {
		ttl := entry.SVID.NotAfter.Sub(time.Now())
		lifetime := entry.SVID.NotAfter.Sub(entry.SVID.NotBefore)
		// If the cached SVID has a remaining lifetime less than 50%, prepare a
		// new entryRequest.
		if ttl < lifetime/2 {
			m.c.Log.Debugf("cache entry ttl for spiffeId %s is less than a half its lifetime", entry.RegistrationEntry.SpiffeId)
			privateKey, csr, err := m.newCSR(entry.RegistrationEntry.SpiffeId)
			if err != nil {
				return nil, err
			}

			bundles := make(map[string][]byte) //TODO: walmav Populate Bundles
			cacheEntry := &cache.Entry{
				RegistrationEntry: entry.RegistrationEntry,
				SVID:              nil,
				PrivateKey:        privateKey,
				Bundles:           bundles,
			}
			parentID := entry.RegistrationEntry.ParentId
			entryRequests[parentID] = append(entryRequests[parentID], &entryRequest{csr, cacheEntry})
			// Cached SVID expired, remove entry from the cache.
			m.cache.DeleteEntry(entry.RegistrationEntry)
		}
	}

	m.c.Tel.AddSample([]string{"cache_manager", "expiring_svids"}, float32(len(entryRequests)))
	return entryRequests, nil
}

func (m *manager) checkForNewCacheEntries(regEntries map[string]*proto.RegistrationEntry, entryRequests entryRequests) (entryRequests, error) {
	for _, regEntry := range regEntries {
		if !m.isAlreadyCached(regEntry) && !m.isEntryRequestAlreadyCreated(regEntry, entryRequests) {
			privateKey, csr, err := m.newCSR(regEntry.SpiffeId)
			if err != nil {
				return nil, err
			}

			bundles := make(map[string][]byte) //TODO: walmav Populate Bundles
			cacheEntry := &cache.Entry{
				RegistrationEntry: regEntry,
				SVID:              nil,
				PrivateKey:        privateKey,
				Bundles:           bundles,
			}
			parentID := regEntry.ParentId
			entryRequests[parentID] = append(entryRequests[parentID], &entryRequest{csr, cacheEntry})
		} else {
			// This entry is a cached agent alias, we must synchronize updates on behalf of it.
			if m.isAgentAlias(regEntry) {
				err := m.synchronize(regEntry.SpiffeId)
				if err != nil {
					return nil, err
				}
			}
		}
	}

	return entryRequests, nil
}

func (m *manager) rotateSVID() error {
	svid, _ := m.getBaseSVIDEntry()
	ttl := svid.NotAfter.Sub(time.Now())
	lifetime := svid.NotAfter.Sub(svid.NotBefore)

	if ttl < lifetime/2 {
		m.c.Log.Debug("Rotating agent SVID")

		privateKey, csr, err := m.newCSR(m.spiffeID)
		if err != nil {
			return err
		}

		client := m.getRotationClient()
		update, err := client.sendAndReceive(&node.FetchSVIDRequest{Csrs: [][]byte{csr}})
		if err != nil && err != ErrPartialResponse {
			return err
		}

		if len(update.svids) == 0 {
			return errors.New("no SVID received when rotating BaseSVID")
		}

		svid, ok := update.svids[m.spiffeID]
		if !ok {
			return errors.New("it was not possible to get base SVID from FetchSVID response")
		}
		cert, err := x509.ParseCertificate(svid.SvidCert)
		if err != nil {
			return err
		}

		m.setBaseSVIDEntry(cert, privateKey)
		err = m.storeSVID()
		if err != nil {
			return err
		}

		err = m.renewRotatorClient()
		if err != nil {
			return fmt.Errorf("could not renew rotator client: %v", err)
		}
	}
	return nil
}

func (m *manager) newCSR(spiffeID string) (pk *ecdsa.PrivateKey, csr []byte, err error) {
	pk, err = ecdsa.GenerateKey(elliptic.P521(), rand.Reader)
	if err != nil {
		return
	}
	csr, err = util.MakeCSR(pk, spiffeID)
	if err != nil {
		return nil, nil, err
	}
	return
}

func (m *manager) isAgentAlias(re *common.RegistrationEntry) bool {
	if re.ParentId == m.serverSPIFFEID {
		return true
	}

	for _, s := range re.Selectors {
		if s.Type == "spiffe_id" && s.Value == m.spiffeID {
			return true
		}
	}

	return false
}

repository: sasanplus/spire

repo_name: sasanplus/spire


text:
# Simple petalinux initramfs image.
DESCRIPTION = "Small image capable of booting a device. The kernel includes \
the Minimal RAM-based Initial Root Filesystem (initramfs), which finds the \
first 'init' program more efficiently."

INITRAMFS_SCRIPTS ?= "initramfs-framework-base \
		initramfs-module-e2fs \
		initramfs-module-udhcpc \
		initramfs-module-searche2fs \
		"

INITRAMFS_SCRIPTS_append_k26 = " initramfs-module-exec"

INITRAMFS_PACKAGES ?= "${VIRTUAL-RUNTIME_base-utils} \
		base-passwd \
		e2fsprogs \
		${ROOTFS_BOOTSTRAP_INSTALL} \
		${MACHINE_ESSENTIAL_EXTRA_RDEPENDS} \
		"

BAD_RECOMMENDATIONS += "initramfs-module-rootfs"

PACKAGE_INSTALL ?= "packagegroup-core-boot ${INITRAMFS_PACKAGES} ${INITRAMFS_SCRIPTS}"

# Do not pollute the initrd image with rootfs features
IMAGE_FEATURES = ""

export IMAGE_BASENAME = "petalinux-initramfs-image"
IMAGE_LINGUAS = ""

LICENSE = "MIT"

IMAGE_FSTYPES = "${INITRAMFS_FSTYPES}"
inherit core-image

IMAGE_ROOTFS_SIZE = "8192"
IMAGE_ROOTFS_EXTRA_SPACE = "0"

rm_work_rootfs[noexec] = "1"
rm_work_rootfs[cleandirs] = ""
RM_WORK_EXCLUDE_ITEMS = "rootfs"

repository: fullstackfpga/meta-petalinux

repo_name: fullstackfpga/meta-petalinux


text:
package controller

import (
	"bufio"
	"errors"
	"fmt"
	"io"
	"sync/atomic"
	"time"

	"github.com/bogdanovich/siberite/queue"
	"github.com/bogdanovich/siberite/repository"
)

// Conn represents a connection interface
type Conn interface {
	io.Reader
	io.Writer
	SetDeadline(t time.Time) error
}

// Controller represents a connection controller
type Controller struct {
	conn           Conn
	rw             *bufio.ReadWriter
	repo           *repository.QueueRepository
	currentItem    *queue.Item
	currentCommand *Command
}

// Command represents a client command
type Command struct {
	Name       string
	QueueName  string
	SubCommand string
	DataSize   int
}

// NewSession creates and initializes new controller
func NewSession(conn Conn, repo *repository.QueueRepository) *Controller {
	atomic.AddUint64(&repo.Stats.TotalConnections, 1)
	atomic.AddUint64(&repo.Stats.CurrentConnections, 1)
	rw := bufio.NewReadWriter(bufio.NewReader(conn), bufio.NewWriter(conn))
	return &Controller{conn, rw, repo, nil, nil}
}

// FinishSession aborts unfinished transaction
func (c *Controller) FinishSession() {
	if c.currentItem != nil {
		c.abort(c.currentCommand)
	}
	atomic.AddUint64(&c.repo.Stats.CurrentConnections, ^uint64(0))
}

// ReadFirstMessage reads initial message from connection buffer
func (c *Controller) ReadFirstMessage() (string, error) {
	return c.rw.Reader.ReadString('\n')
}

// UnknownCommand reports an error
func (c *Controller) UnknownCommand() error {
	errorMessage := "ERROR Unknown command"
	c.SendError(errorMessage)
	return errors.New(errorMessage)
}

//SendError sends an error message to the client
func (c *Controller) SendError(errorMessage string) {
	fmt.Fprintf(c.rw.Writer, "%s\r\n", errorMessage)
	c.rw.Writer.Flush()
}

// Save current unconfirmed item
func (c *Controller) setCurrentState(cmd *Command, item *queue.Item) {
	c.currentCommand = cmd
	c.currentItem = item
}


text:
@book{hsu_multiple_1996,
	edition = {1},
	title = {Multiple Comparisons: Theory and Methods},
	isbn = {0412982811},
	shorttitle = {Multiple Comparisons},
	abstract = {Excerpt: "Multiple Comparisons covers all-pairwise comparisons, multiple comparisons with the best, and multiple comparisons with a control. Confidence intervals methods and stepwise methods are described. Abuses and misconceptions are exposed, and the reader is guided to the correct method for each problem. Connections with bioequivalence, drug stability, and toxicity studies are discussed. Applications are illustrated with real data, analyzed by computer packages. Extension to the General Linear Model is provided. "},
	publisher = {Chapman and Hall/{CRC}},
	author = {Hsu, Jason},
	date = {1996-02-01}
}

repository: pmean/build-website

repo_name: pmean/build-website

extension: bib


text:
/*
 *  Copyright Matus Chochlik.
 *  Distributed under the Boost Software License, Version 1.0.
 *  See accompanying file LICENSE_1_0.txt or copy at
 *   http://www.boost.org/LICENSE_1_0.txt
 */
// clang-format off
#include <oglplus/gl.hpp>
#include <oglplus/data_type.hpp>
#include <oglplus/enum/values.hpp>
#include <oglplus/enum/value_defs.inl>
#define BOOST_TEST_MODULE OGLPLUS_data_type
#include "../unit_test_begin.inl"

#include <cstring>
// clang-format on

BOOST_AUTO_TEST_SUITE(data_type_tests)

BOOST_AUTO_TEST_CASE(data_type_1) {
    using namespace oglplus;

    static const enum_values GL = {};

    BOOST_CHECK(get_data_type(identity<GLbyte>()) == GL.byte_);

    BOOST_CHECK(get_data_type(identity<GLubyte>()) == GL.unsigned_byte);

    BOOST_CHECK(get_data_type(identity<GLshort>()) == GL.short_);

    BOOST_CHECK(get_data_type(identity<GLushort>()) == GL.unsigned_short);

    BOOST_CHECK(get_data_type(identity<GLint>()) == GL.int_);

    BOOST_CHECK(get_data_type(identity<GLuint>()) == GL.unsigned_int);

    BOOST_CHECK(get_data_type(identity<GLfloat>()) == GL.float_);

#ifdef GL_DOUBLE
    BOOST_CHECK(get_data_type(identity<GLdouble>()) == GL.double_);
#endif
}

BOOST_AUTO_TEST_CASE(data_type_2) {
    using namespace oglplus;

    static const enum_values GL = {};

    BOOST_CHECK(get_data_type<GLbyte>() == GL.byte_);

    BOOST_CHECK(get_data_type<GLubyte>() == GL.unsigned_byte);

    BOOST_CHECK(get_data_type<GLshort>() == GL.short_);

    BOOST_CHECK(get_data_type<GLushort>() == GL.unsigned_short);

    BOOST_CHECK(get_data_type<GLint>() == GL.int_);

    BOOST_CHECK(get_data_type<GLuint>() == GL.unsigned_int);

    BOOST_CHECK(get_data_type<GLfloat>() == GL.float_);

#ifdef GL_DOUBLE
    BOOST_CHECK(get_data_type<GLdouble>() == GL.double_);
#endif
}

BOOST_AUTO_TEST_SUITE_END()

extension: cpp


text:
// Copyright Aeraki Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package watcher

import (
	"time"

	"github.com/aeraki-framework/double2istio/pkg/dubbo/common"
	"github.com/aeraki-framework/double2istio/pkg/dubbo/nacos/model"
	"github.com/nacos-group/nacos-sdk-go/clients/naming_client"
	nacosmodel "github.com/nacos-group/nacos-sdk-go/model"
	"github.com/nacos-group/nacos-sdk-go/vo"

	"istio.io/pkg/log"
)

// NamespaceWatcher contains the runtime configuration for a Nacos Namespace Watcher
type NamespaceWatcher struct {
	namespace          string
	nacosClient        naming_client.INamingClient
	subscribedServices map[string]bool
	notifyChan         chan<- []common.DubboServiceInstance
}

// NewNamespaceWatcher creates a Namespace Watcher
func NewNamespaceWatcher(nacosAddr, namespace string, notifyChan chan<- []common.DubboServiceInstance) (
	*NamespaceWatcher, error) {
	nacosClient, error := common.NewNacosClisent(nacosAddr, namespace)
	if error != nil {
		return nil, error
	}
	return &NamespaceWatcher{
		namespace:          namespace,
		nacosClient:        nacosClient,
		subscribedServices: make(map[string]bool),
		notifyChan:         notifyChan,
	}, nil
}

// Run until a signal is received, this function blocks
func (w *NamespaceWatcher) Run(stop <-chan struct{}) {
	ticker := time.NewTicker(10 * time.Second)
	for {
		select {
		case <-ticker.C:
			log.Infof("get catalog services of namespace %s ", w.namespace)
			catalogServiceList, err := w.nacosClient.GetCatalogServices(w.namespace)
			if err != nil {
				log.Errorf("failed to get catalog services of namespace %s : %v", w.namespace, err)
				continue
			}
			for _, catalogService := range catalogServiceList.ServiceList {
				if !w.subscribedServices[catalogService.Name+catalogService.GroupName] {
					err := w.nacosClient.Subscribe(&vo.SubscribeParam{
						ServiceName: catalogService.Name,
						GroupName:   catalogService.GroupName,
						Clusters:    []string{},
						SubscribeCallback: func(services []nacosmodel.SubscribeService, err error) {
							if err != nil {
								log.Errorf("failed to get notification: %v", err)
							}
							log.Infof("service %s changed: %v", catalogService.Name, len(services))
							erviceEntries, err := model.ConvertDubboServices(w.namespace,
								catalogService.GroupName,
								services)
							if err != nil {
								log.Errorf("failed to convert dubbo service: %v", err)
							}
							w.notifyChan <- erviceEntries
						},
					})
					if err != nil {
						log.Errorf("failed to subscribe to service: %s group: %s: %v", catalogService.Name,
							catalogService.GroupName,
							err)
					} else {
						log.Infof("subscribe to service: %s group: %s", catalogService.Name, catalogService.GroupName)
						w.subscribedServices[catalogService.Name+catalogService.GroupName] = true
					}
				}
			}
		case <-stop:
			return
		}
	}
}


text:
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/ui/views/feature_promos/new_tab_promo_bubble_view.h"

#include "base/strings/string_number_conversions.h"
#include "chrome/grit/generated_resources.h"
#include "components/variations/variations_associated_data.h"

// static
NewTabPromoBubbleView* NewTabPromoBubbleView::CreateOwned(
    const gfx::Rect& anchor_rect) {
  return new NewTabPromoBubbleView(anchor_rect);
}

NewTabPromoBubbleView::NewTabPromoBubbleView(const gfx::Rect& anchor_rect)
    : FeaturePromoBubbleView(anchor_rect,
                             views::BubbleBorder::LEFT_TOP,
                             GetStringSpecifier()) {}

NewTabPromoBubbleView::~NewTabPromoBubbleView() = default;

// static
int NewTabPromoBubbleView::GetStringSpecifier() {
  static constexpr int kTextIds[] = {IDS_NEWTAB_PROMO_0, IDS_NEWTAB_PROMO_1,
                                     IDS_NEWTAB_PROMO_2};
  const std::string& str = variations::GetVariationParamValue(
      "NewTabInProductHelp", "x_promo_string");
  size_t text_specifier;
  if (!base::StringToSizeT(str, &text_specifier) ||
      text_specifier >= arraysize(kTextIds)) {
    text_specifier = 0;
  }

  return kTextIds[text_specifier];
}

repository: lgsvl/chromium-src

repo_name: lgsvl/chromium-src

extension: cc


text:
package models

import "time"

type Commit struct {
	ID          string    `json:"id"`
	AuthorName  string    `json:"author_name"`
	AuthorEmail string    `json:"author_email"`
	Title       string    `json:"title"`
	Message     string    `json:"message"`
	CreatedAt   time.Time `json:"created_at"`
	ShortID     string    `json:"short_id"`
}

repository: TovarischSuhov/pipelines-manager

repo_name: TovarischSuhov/pipelines-manager

branch_name: refs/heads/main


text:
package cmd

import (
	"fmt"
	"strings"

	"github.com/mitchellh/cli"
	. "trellis-cli/templates"
	"trellis-cli/trellis"
)

type DotEnvCommand struct {
	UI      cli.Ui
	Trellis *trellis.Trellis
}

func (c *DotEnvCommand) Run(args []string) int {
	if err := c.Trellis.LoadProject(); err != nil {
		c.UI.Error(err.Error())
		return 1
	}

	var environment string

	switch len(args) {
	case 0:
		environment = "development"
	case 1:
		environment = args[0]
	default:
		c.UI.Error(fmt.Sprintf("Error: too many arguments (expected 0 or 1, got %d)\n", len(args)))
		c.UI.Output(c.Help())
		return 1
	}

	_, ok := c.Trellis.Environments[environment]
	if !ok {
		c.UI.Error(fmt.Sprintf("Error: %s is not a valid environment", environment))
		return 1
	}

	// Template playbook file from package to Trellis
	playbookPath := "dotenv.yml"
	writeFile(playbookPath, TrimSpace(DOTENV_YML))
	defer deleteFile(playbookPath)

	dotEnv := execCommand("ansible-playbook", "dotenv.yml", "-e", "env=" + environment)
	appendEnvironmentVariable(dotEnv, "ANSIBLE_RETRY_FILES_ENABLED=false")

	logCmd(dotEnv, c.UI, true)
	runErr := dotEnv.Run()

	if runErr != nil {
		c.UI.Error(fmt.Sprintf("Error running ansible-playbook: %s", runErr))
		return 1
	}

	return 0
}

func (c *DotEnvCommand) Synopsis() string {
	return "Template .env files to local system"
}

func (c *DotEnvCommand) Help() string {
	helpText := `
Usage: trellis dotenv [options] [ENVIRONMENT=development]

Template .env files to local system

Options:
  -h, --help  show this help
`

	return strings.TrimSpace(helpText)
}

repository: sjothen/trellis-cli

repo_name: sjothen/trellis-cli


text:
// +build experimental

package client

import (
	"golang.org/x/net/context"
)

// PluginDisable disables a plugin
func (cli *Client) PluginDisable(ctx context.Context, name string) error {
	resp, err := cli.post(ctx, "/plugins/"+name+"/disable", nil, nil, nil)
	ensureReaderClosed(resp)
	return err
}

repository: mesos/mr-redis

repo_name: mesos/mr-redis


text:
package handlers

import (
	"context"
	"encoding/hex"
	"encoding/json"
	"github.com/button-tech/logger"
	"github.com/button-tech/utils-node-tool/nodetools"
	b "github.com/button-tech/utils-node-tool/nodetools"
	"github.com/button-tech/utils-node-tool/nodetools/storage"
	"github.com/button-tech/utils-node-tool/types/requests"
	"github.com/button-tech/utils-node-tool/types/responses"
	"github.com/ethereum/go-ethereum/common"
	"github.com/ethereum/go-ethereum/core/types"
	"github.com/ethereum/go-ethereum/ethclient"
	"github.com/ethereum/go-ethereum/rlp"
	"github.com/onrik/ethrpc"
	"github.com/qiangxue/fasthttp-routing"
	"math"
	"os"
	"time"
)

func GetBalance(c *routing.Context) error {

	start := time.Now()

	address := c.Param("address")

	balance, err := b.GetEtherBalance(address)
	if err != nil {
		logger.HandlerError("GetBalance", err)
		return err
	}

	response := new(responses.BalanceResponse)

	response.Balance = balance

	if err := responses.JsonResponse(c, response); err != nil {
		return err
	}

	logger.LogRequest(time.Since(start), os.Getenv("BLOCKCHAIN"), "GetBalance", false)

	return nil
}

func GetTxFee(c *routing.Context) error {

	start := time.Now()

	ethClient := ethrpc.New(storage.EndpointForReq.Get())

	gasPrice, err := ethClient.EthGasPrice()
	if err != nil {
		logger.HandlerError("GetTxFee", err)
		return err
	}

	fee := float64(gasPrice.Int64()*21000) / math.Pow(10, 18)

	response := new(responses.TransactionFeeResponse)

	response.Fee = fee

	if err := responses.JsonResponse(c, response); err != nil {
		return err
	}

	logger.LogRequest(time.Since(start), os.Getenv("BLOCKCHAIN"), "GetTxFee", false)

	return nil
}

func GetGasPrice(c *routing.Context) error {

	start := time.Now()

	ethClient := ethrpc.New(storage.EndpointForReq.Get())

	gasPrice, err := ethClient.EthGasPrice()
	if err != nil {
		logger.HandlerError("GetGasPrice", err)
		return err
	}

	response := new(responses.GasPriceResponse)

	response.GasPrice = gasPrice.Int64()

	if err := responses.JsonResponse(c, response); err != nil {
		return err
	}

	logger.LogRequest(time.Since(start), os.Getenv("BLOCKCHAIN"), "GetGasPrice", false)

	return nil
}

func GetTokenBalance(c *routing.Context) error {

	start := time.Now()

	userAddress := c.Param("user-address")

	smartContractAddress := c.Param("smart-contract-address")

	balance, err := b.GetTokenBalance(userAddress, smartContractAddress)
	if err != nil {
		logger.HandlerError("GetTokenBalance", err)
		return err
	}

	response := new(responses.BalanceResponse)

	response.Balance = balance

	if err := responses.JsonResponse(c, response); err != nil {
		return err
	}

	logger.LogRequest(time.Since(start), os.Getenv("BLOCKCHAIN"), "GetTokenBalance", false)

	return nil
}

func GetEstimateGas(c *routing.Context) error {

	start := time.Now()

	var data requests.EthEstimateGasRequest

	if err := json.Unmarshal(c.PostBody(), &data); err != nil {
		return err
	}

	gasLimit, err := nodetools.GetEstimateGas(&data)
	if err != nil {
		logger.HandlerError("GetEstimateGas", err)
		return err
	}

	response := new(responses.GasLimitResponse)

	response.GasLimit = gasLimit

	if err := responses.JsonResponse(c, response); err != nil {
		return err
	}

	logger.LogRequest(time.Since(start), os.Getenv("BLOCKCHAIN"), "GetEstimateGas", false)

	return nil
}

func GetNonce(c *routing.Context) error {

	start := time.Now()

	userAddress := c.Param("address")

	client, err := ethclient.Dial(storage.EndpointForReq.Get())
	if err != nil {
		return err
	}

	nonce, err := client.PendingNonceAt(context.Background(), common.HexToAddress(userAddress))
	if err != nil {
		logger.HandlerError("GetNonce", err)
		return err
	}

	result := struct {
		Nonce uint64 `json:"nonce"`
	}{
		Nonce: nonce,
	}

	if err := responses.JsonResponse(c, result); err != nil {
		return err
	}

	logger.LogRequest(time.Since(start), os.Getenv("BLOCKCHAIN"), "GetNonce", false)

	return nil
}

func SendRawTx(c *routing.Context) error {
	start := time.Now()

	var (
		rawTx  requests.RawTransaction
		result responses.TransactionResult
	)

	if err := json.Unmarshal(c.PostBody(), &rawTx); err != nil {
		return err
	}

	ethClient, err := ethclient.Dial(storage.EndpointForReq.Get())
	if err != nil {
		logger.HandlerError("SendRawTx", err)
		return err
	}

	rawTxBytes, err := hex.DecodeString(rawTx.Data)
	if err != nil {
		logger.HandlerError("SendRawTx", err)
		return err
	}

	var tx types.Transaction

	if err = rlp.DecodeBytes(rawTxBytes, &tx); err != nil {
		logger.HandlerError("SendRawTx", err)
		return err
	}

	if err = ethClient.SendTransaction(context.Background(), &tx); err != nil {
		logger.HandlerError("SendRawTx", err)
		return err
	}

	result.Hash = tx.Hash().Hex()

	if err := responses.JsonResponse(c, result); err != nil {
		return err
	}

	logger.LogRequest(time.Since(start), os.Getenv("BLOCKCHAIN"), "SendRawTx", false)

	return nil
}

repository: prazd/utils-node-tool

repo_name: prazd/utils-node-tool


text:
SUMMARY = "File classification tool: python-magic"
DESCRIPTION = "File attempts to classify files depending \
on their contents and prints a description if a match is found."
HOMEPAGE = "http://www.darwinsys.com/file/"
SECTION = "console/utils"

# two clause BSD
LICENSE = "BSD"
LIC_FILES_CHKSUM = "file://setup.py;md5=1cf0577ca152455b257b815fcc8517de"

SRC_URI = "ftp://ftp.astron.com/pub/file/file-${PV}.tar.gz \
          "

SRC_URI[md5sum] = "8fb13e5259fe447e02c4a37bc7225add"
SRC_URI[sha256sum] = "c4e3a8e44cb888c5e4b476e738503e37fb9de3b25a38c143e214bfc12109fc0b"

S="${WORKDIR}/file-${PV}/python"

inherit setuptools python-dir

BBCLASSEXTEND = "native"

repository: toganlabs/meta-spdxscanner

repo_name: toganlabs/meta-spdxscanner