mintrpc

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2023 License: MIT Imports: 17 Imported by: 3

Documentation

Overview

Package mintrpc is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var (
	BatchState_name = map[int32]string{
		0: "BATCH_STATE_UNKNOWN",
		1: "BATCH_STATE_PEDNING",
		2: "BATCH_STATE_FROZEN",
		3: "BATCH_STATE_COMMITTED",
		4: "BATCH_STATE_BROADCAST",
		5: "BATCH_STATE_CONFIRMED",
		6: "BATCH_STATE_FINALIZED",
		7: "BATCH_STATE_SEEDLING_CANCELLED",
		8: "BATCH_STATE_SPROUT_CANCELLED",
	}
	BatchState_value = map[string]int32{
		"BATCH_STATE_UNKNOWN":            0,
		"BATCH_STATE_PEDNING":            1,
		"BATCH_STATE_FROZEN":             2,
		"BATCH_STATE_COMMITTED":          3,
		"BATCH_STATE_BROADCAST":          4,
		"BATCH_STATE_CONFIRMED":          5,
		"BATCH_STATE_FINALIZED":          6,
		"BATCH_STATE_SEEDLING_CANCELLED": 7,
		"BATCH_STATE_SPROUT_CANCELLED":   8,
	}
)

Enum value maps for BatchState.

View Source
var File_mintrpc_mint_proto protoreflect.FileDescriptor
View Source
var Mint_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "mintrpc.Mint",
	HandlerType: (*MintServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "MintAsset",
			Handler:    _Mint_MintAsset_Handler,
		},
		{
			MethodName: "FinalizeBatch",
			Handler:    _Mint_FinalizeBatch_Handler,
		},
		{
			MethodName: "CancelBatch",
			Handler:    _Mint_CancelBatch_Handler,
		},
		{
			MethodName: "ListBatches",
			Handler:    _Mint_ListBatches_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "mintrpc/mint.proto",
}

Mint_ServiceDesc is the grpc.ServiceDesc for Mint service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

Functions

func RegisterMintHandler

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

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

func RegisterMintHandlerClient

func RegisterMintHandlerClient(ctx context.Context, mux *runtime.ServeMux, client MintClient) error

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

func RegisterMintHandlerFromEndpoint

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

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

func RegisterMintHandlerServer

func RegisterMintHandlerServer(ctx context.Context, mux *runtime.ServeMux, server MintServer) error

RegisterMintHandlerServer registers the http handlers for service Mint to "mux". UnaryRPC :call MintServer 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 RegisterMintHandlerFromEndpoint instead.

func RegisterMintJSONCallbacks added in v0.2.1

func RegisterMintJSONCallbacks(registry map[string]func(ctx context.Context,
	conn *grpc.ClientConn, reqJSON string, callback func(string, error)))

func RegisterMintServer

func RegisterMintServer(s grpc.ServiceRegistrar, srv MintServer)

Types

type BatchState

type BatchState int32
const (
	BatchState_BATCH_STATE_UNKNOWN            BatchState = 0
	BatchState_BATCH_STATE_PEDNING            BatchState = 1
	BatchState_BATCH_STATE_FROZEN             BatchState = 2
	BatchState_BATCH_STATE_COMMITTED          BatchState = 3
	BatchState_BATCH_STATE_BROADCAST          BatchState = 4
	BatchState_BATCH_STATE_CONFIRMED          BatchState = 5
	BatchState_BATCH_STATE_FINALIZED          BatchState = 6
	BatchState_BATCH_STATE_SEEDLING_CANCELLED BatchState = 7
	BatchState_BATCH_STATE_SPROUT_CANCELLED   BatchState = 8
)

func (BatchState) Descriptor

func (BatchState) Descriptor() protoreflect.EnumDescriptor

func (BatchState) Enum

func (x BatchState) Enum() *BatchState

func (BatchState) EnumDescriptor deprecated

func (BatchState) EnumDescriptor() ([]byte, []int)

Deprecated: Use BatchState.Descriptor instead.

func (BatchState) Number

func (x BatchState) Number() protoreflect.EnumNumber

func (BatchState) String

func (x BatchState) String() string

func (BatchState) Type

type CancelBatchRequest

type CancelBatchRequest struct {
	// contains filtered or unexported fields
}

func (*CancelBatchRequest) Descriptor deprecated

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

Deprecated: Use CancelBatchRequest.ProtoReflect.Descriptor instead.

func (*CancelBatchRequest) ProtoMessage

func (*CancelBatchRequest) ProtoMessage()

func (*CancelBatchRequest) ProtoReflect

func (x *CancelBatchRequest) ProtoReflect() protoreflect.Message

func (*CancelBatchRequest) Reset

func (x *CancelBatchRequest) Reset()

func (*CancelBatchRequest) String

func (x *CancelBatchRequest) String() string

type CancelBatchResponse

type CancelBatchResponse struct {

	// The internal public key of the batch.
	BatchKey []byte `protobuf:"bytes,1,opt,name=batch_key,json=batchKey,proto3" json:"batch_key,omitempty"`
	// contains filtered or unexported fields
}

func (*CancelBatchResponse) Descriptor deprecated

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

Deprecated: Use CancelBatchResponse.ProtoReflect.Descriptor instead.

func (*CancelBatchResponse) GetBatchKey

func (x *CancelBatchResponse) GetBatchKey() []byte

func (*CancelBatchResponse) ProtoMessage

func (*CancelBatchResponse) ProtoMessage()

func (*CancelBatchResponse) ProtoReflect

func (x *CancelBatchResponse) ProtoReflect() protoreflect.Message

func (*CancelBatchResponse) Reset

func (x *CancelBatchResponse) Reset()

func (*CancelBatchResponse) String

func (x *CancelBatchResponse) String() string

type FinalizeBatchRequest

type FinalizeBatchRequest struct {
	// contains filtered or unexported fields
}

func (*FinalizeBatchRequest) Descriptor deprecated

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

Deprecated: Use FinalizeBatchRequest.ProtoReflect.Descriptor instead.

func (*FinalizeBatchRequest) ProtoMessage

func (*FinalizeBatchRequest) ProtoMessage()

func (*FinalizeBatchRequest) ProtoReflect

func (x *FinalizeBatchRequest) ProtoReflect() protoreflect.Message

func (*FinalizeBatchRequest) Reset

func (x *FinalizeBatchRequest) Reset()

func (*FinalizeBatchRequest) String

func (x *FinalizeBatchRequest) String() string

type FinalizeBatchResponse

type FinalizeBatchResponse struct {

	// The internal public key of the batch.
	BatchKey []byte `protobuf:"bytes,1,opt,name=batch_key,json=batchKey,proto3" json:"batch_key,omitempty"`
	// contains filtered or unexported fields
}

func (*FinalizeBatchResponse) Descriptor deprecated

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

Deprecated: Use FinalizeBatchResponse.ProtoReflect.Descriptor instead.

func (*FinalizeBatchResponse) GetBatchKey

func (x *FinalizeBatchResponse) GetBatchKey() []byte

func (*FinalizeBatchResponse) ProtoMessage

func (*FinalizeBatchResponse) ProtoMessage()

func (*FinalizeBatchResponse) ProtoReflect

func (x *FinalizeBatchResponse) ProtoReflect() protoreflect.Message

func (*FinalizeBatchResponse) Reset

func (x *FinalizeBatchResponse) Reset()

func (*FinalizeBatchResponse) String

func (x *FinalizeBatchResponse) String() string

type ListBatchRequest

type ListBatchRequest struct {

	// The optional batch key of the batch to list.
	//
	// Types that are assignable to Filter:
	//
	//	*ListBatchRequest_BatchKey
	//	*ListBatchRequest_BatchKeyStr
	Filter isListBatchRequest_Filter `protobuf_oneof:"filter"`
	// contains filtered or unexported fields
}

func (*ListBatchRequest) Descriptor deprecated

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

Deprecated: Use ListBatchRequest.ProtoReflect.Descriptor instead.

func (*ListBatchRequest) GetBatchKey

func (x *ListBatchRequest) GetBatchKey() []byte

func (*ListBatchRequest) GetBatchKeyStr added in v0.2.1

func (x *ListBatchRequest) GetBatchKeyStr() string

func (*ListBatchRequest) GetFilter added in v0.2.1

func (m *ListBatchRequest) GetFilter() isListBatchRequest_Filter

func (*ListBatchRequest) ProtoMessage

func (*ListBatchRequest) ProtoMessage()

func (*ListBatchRequest) ProtoReflect

func (x *ListBatchRequest) ProtoReflect() protoreflect.Message

func (*ListBatchRequest) Reset

func (x *ListBatchRequest) Reset()

func (*ListBatchRequest) String

func (x *ListBatchRequest) String() string

type ListBatchRequest_BatchKey added in v0.2.1

type ListBatchRequest_BatchKey struct {
	// The optional batch key of the batch to list, specified as raw bytes
	// (gRPC only).
	BatchKey []byte `protobuf:"bytes,1,opt,name=batch_key,json=batchKey,proto3,oneof"`
}

type ListBatchRequest_BatchKeyStr added in v0.2.1

type ListBatchRequest_BatchKeyStr struct {
	// The optional batch key of the batch to list, specified as a hex
	// encoded string (use this for REST).
	BatchKeyStr string `protobuf:"bytes,2,opt,name=batch_key_str,json=batchKeyStr,proto3,oneof"`
}

type ListBatchResponse

type ListBatchResponse struct {
	Batches []*MintingBatch `protobuf:"bytes,1,rep,name=batches,proto3" json:"batches,omitempty"`
	// contains filtered or unexported fields
}

func (*ListBatchResponse) Descriptor deprecated

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

Deprecated: Use ListBatchResponse.ProtoReflect.Descriptor instead.

func (*ListBatchResponse) GetBatches

func (x *ListBatchResponse) GetBatches() []*MintingBatch

func (*ListBatchResponse) ProtoMessage

func (*ListBatchResponse) ProtoMessage()

func (*ListBatchResponse) ProtoReflect

func (x *ListBatchResponse) ProtoReflect() protoreflect.Message

func (*ListBatchResponse) Reset

func (x *ListBatchResponse) Reset()

func (*ListBatchResponse) String

func (x *ListBatchResponse) String() string

type MintAsset

type MintAsset struct {

	// The type of the asset to be created.
	AssetType taprpc.AssetType `protobuf:"varint,1,opt,name=asset_type,json=assetType,proto3,enum=taprpc.AssetType" json:"asset_type,omitempty"`
	// The name, or "tag" of the asset. This will affect the final asset ID.
	Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
	// A blob that resents metadata related to the asset. This will affect the
	// final asset ID.
	AssetMeta *taprpc.AssetMeta `protobuf:"bytes,3,opt,name=asset_meta,json=assetMeta,proto3" json:"asset_meta,omitempty"`
	// The total amount of units of the new asset that should be created. If the
	// AssetType is Collectible, then this field cannot be set.
	Amount uint64 `protobuf:"varint,4,opt,name=amount,proto3" json:"amount,omitempty"`
	// The specific group key this asset should be minted with.
	GroupKey []byte `protobuf:"bytes,5,opt,name=group_key,json=groupKey,proto3" json:"group_key,omitempty"`
	// The name of the asset in the batch that will anchor a new asset group.
	// This asset will be minted with the same group key as the anchor asset.
	GroupAnchor string `protobuf:"bytes,6,opt,name=group_anchor,json=groupAnchor,proto3" json:"group_anchor,omitempty"`
	// contains filtered or unexported fields
}

func (*MintAsset) Descriptor deprecated

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

Deprecated: Use MintAsset.ProtoReflect.Descriptor instead.

func (*MintAsset) GetAmount

func (x *MintAsset) GetAmount() uint64

func (*MintAsset) GetAssetMeta

func (x *MintAsset) GetAssetMeta() *taprpc.AssetMeta

func (*MintAsset) GetAssetType

func (x *MintAsset) GetAssetType() taprpc.AssetType

func (*MintAsset) GetGroupAnchor

func (x *MintAsset) GetGroupAnchor() string

func (*MintAsset) GetGroupKey

func (x *MintAsset) GetGroupKey() []byte

func (*MintAsset) GetName

func (x *MintAsset) GetName() string

func (*MintAsset) ProtoMessage

func (*MintAsset) ProtoMessage()

func (*MintAsset) ProtoReflect

func (x *MintAsset) ProtoReflect() protoreflect.Message

func (*MintAsset) Reset

func (x *MintAsset) Reset()

func (*MintAsset) String

func (x *MintAsset) String() string

type MintAssetRequest

type MintAssetRequest struct {

	// The asset to be minted.
	Asset *MintAsset `protobuf:"bytes,1,opt,name=asset,proto3" json:"asset,omitempty"`
	// If true, then the asset will be created with a group key, which allows for
	// future asset issuance.
	EnableEmission bool `protobuf:"varint,2,opt,name=enable_emission,json=enableEmission,proto3" json:"enable_emission,omitempty"`
	// contains filtered or unexported fields
}

func (*MintAssetRequest) Descriptor deprecated

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

Deprecated: Use MintAssetRequest.ProtoReflect.Descriptor instead.

func (*MintAssetRequest) GetAsset

func (x *MintAssetRequest) GetAsset() *MintAsset

func (*MintAssetRequest) GetEnableEmission

func (x *MintAssetRequest) GetEnableEmission() bool

func (*MintAssetRequest) ProtoMessage

func (*MintAssetRequest) ProtoMessage()

func (*MintAssetRequest) ProtoReflect

func (x *MintAssetRequest) ProtoReflect() protoreflect.Message

func (*MintAssetRequest) Reset

func (x *MintAssetRequest) Reset()

func (*MintAssetRequest) String

func (x *MintAssetRequest) String() string

type MintAssetResponse

type MintAssetResponse struct {

	// A public key serialized in compressed format that can be used to uniquely
	// identify a pending minting batch. Responses that share the same key will be
	// batched into the same minting transaction.
	BatchKey []byte `protobuf:"bytes,1,opt,name=batch_key,json=batchKey,proto3" json:"batch_key,omitempty"`
	// contains filtered or unexported fields
}

func (*MintAssetResponse) Descriptor deprecated

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

Deprecated: Use MintAssetResponse.ProtoReflect.Descriptor instead.

func (*MintAssetResponse) GetBatchKey

func (x *MintAssetResponse) GetBatchKey() []byte

func (*MintAssetResponse) ProtoMessage

func (*MintAssetResponse) ProtoMessage()

func (*MintAssetResponse) ProtoReflect

func (x *MintAssetResponse) ProtoReflect() protoreflect.Message

func (*MintAssetResponse) Reset

func (x *MintAssetResponse) Reset()

func (*MintAssetResponse) String

func (x *MintAssetResponse) String() string

type MintClient

type MintClient interface {
	// tapcli: `assets mint`
	// MintAsset will attempt to mint the set of assets (async by default to
	// ensure proper batching) specified in the request.
	MintAsset(ctx context.Context, in *MintAssetRequest, opts ...grpc.CallOption) (*MintAssetResponse, error)
	// tapcli: `assets mint finalize`
	// FinalizeBatch will attempt to finalize the current pending batch.
	FinalizeBatch(ctx context.Context, in *FinalizeBatchRequest, opts ...grpc.CallOption) (*FinalizeBatchResponse, error)
	// tapcli: `assets mint cancel`
	// CancelBatch will attempt to cancel the current pending batch.
	CancelBatch(ctx context.Context, in *CancelBatchRequest, opts ...grpc.CallOption) (*CancelBatchResponse, error)
	// tapcli: `assets mint batches`
	// ListBatches lists the set of batches submitted to the daemon, including
	// pending and cancelled batches.
	ListBatches(ctx context.Context, in *ListBatchRequest, opts ...grpc.CallOption) (*ListBatchResponse, error)
}

MintClient is the client API for Mint service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

func NewMintClient

func NewMintClient(cc grpc.ClientConnInterface) MintClient

type MintServer

type MintServer interface {
	// tapcli: `assets mint`
	// MintAsset will attempt to mint the set of assets (async by default to
	// ensure proper batching) specified in the request.
	MintAsset(context.Context, *MintAssetRequest) (*MintAssetResponse, error)
	// tapcli: `assets mint finalize`
	// FinalizeBatch will attempt to finalize the current pending batch.
	FinalizeBatch(context.Context, *FinalizeBatchRequest) (*FinalizeBatchResponse, error)
	// tapcli: `assets mint cancel`
	// CancelBatch will attempt to cancel the current pending batch.
	CancelBatch(context.Context, *CancelBatchRequest) (*CancelBatchResponse, error)
	// tapcli: `assets mint batches`
	// ListBatches lists the set of batches submitted to the daemon, including
	// pending and cancelled batches.
	ListBatches(context.Context, *ListBatchRequest) (*ListBatchResponse, error)
	// contains filtered or unexported methods
}

MintServer is the server API for Mint service. All implementations must embed UnimplementedMintServer for forward compatibility

type MintingBatch

type MintingBatch struct {

	// The internal public key of the batch.
	BatchKey []byte `protobuf:"bytes,1,opt,name=batch_key,json=batchKey,proto3" json:"batch_key,omitempty"`
	// The assets that are part of the batch.
	Assets []*MintAsset `protobuf:"bytes,2,rep,name=assets,proto3" json:"assets,omitempty"`
	// The state of the batch.
	State BatchState `protobuf:"varint,3,opt,name=state,proto3,enum=mintrpc.BatchState" json:"state,omitempty"`
	// contains filtered or unexported fields
}

func (*MintingBatch) Descriptor deprecated

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

Deprecated: Use MintingBatch.ProtoReflect.Descriptor instead.

func (*MintingBatch) GetAssets

func (x *MintingBatch) GetAssets() []*MintAsset

func (*MintingBatch) GetBatchKey

func (x *MintingBatch) GetBatchKey() []byte

func (*MintingBatch) GetState

func (x *MintingBatch) GetState() BatchState

func (*MintingBatch) ProtoMessage

func (*MintingBatch) ProtoMessage()

func (*MintingBatch) ProtoReflect

func (x *MintingBatch) ProtoReflect() protoreflect.Message

func (*MintingBatch) Reset

func (x *MintingBatch) Reset()

func (*MintingBatch) String

func (x *MintingBatch) String() string

type UnimplementedMintServer

type UnimplementedMintServer struct {
}

UnimplementedMintServer must be embedded to have forward compatible implementations.

func (UnimplementedMintServer) CancelBatch

func (UnimplementedMintServer) FinalizeBatch

func (UnimplementedMintServer) ListBatches

func (UnimplementedMintServer) MintAsset

type UnsafeMintServer

type UnsafeMintServer interface {
	// contains filtered or unexported methods
}

UnsafeMintServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to MintServer will result in compilation errors.

Jump to

Keyboard shortcuts

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