v1

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2023 License: Apache-2.0 Imports: 20 Imported by: 3

Documentation

Overview

Package v1 is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var File_coinbase_cloud_protocols_v1_protocols_proto protoreflect.FileDescriptor
View Source
var ProtocolService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "coinbase.cloud.protocols.v1.ProtocolService",
	HandlerType: (*ProtocolServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "ConstructTransaction",
			Handler:    _ProtocolService_ConstructTransaction_Handler,
		},
		{
			MethodName: "ConstructTransferTransaction",
			Handler:    _ProtocolService_ConstructTransferTransaction_Handler,
		},
		{
			MethodName: "BroadcastTransaction",
			Handler:    _ProtocolService_BroadcastTransaction_Handler,
		},
		{
			MethodName: "EstimateFee",
			Handler:    _ProtocolService_EstimateFee_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "coinbase/cloud/protocols/v1/protocols.proto",
}

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

Functions

func RegisterProtocolServiceHandler

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

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

func RegisterProtocolServiceHandlerClient

func RegisterProtocolServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ProtocolServiceClient) error

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

func RegisterProtocolServiceHandlerFromEndpoint

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

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

func RegisterProtocolServiceHandlerServer

func RegisterProtocolServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ProtocolServiceServer) error

RegisterProtocolServiceHandlerServer registers the http handlers for service ProtocolService to "mux". UnaryRPC :call ProtocolServiceServer 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 RegisterProtocolServiceHandlerFromEndpoint instead.

func RegisterProtocolServiceServer

func RegisterProtocolServiceServer(s grpc.ServiceRegistrar, srv ProtocolServiceServer)

Types

type BroadcastTransactionRequest

type BroadcastTransactionRequest struct {

	// The resource name of the Network.
	// Format: networks/{network_id}
	Network string `protobuf:"bytes,1,opt,name=network,proto3" json:"network,omitempty"`
	// The transaction to broadcast. For the broadcast to complete successfully, one of the following must be true:
	// 1. The raw_signed_transaction on the Transaction is populated. This is equivalent to the payload
	// used to broadcast transactions via block explorers such as Etherscan.
	// 2. The signature(s) in the required_signatures of the Transaction is populated.
	Transaction *v1.Transaction `protobuf:"bytes,2,opt,name=transaction,proto3" json:"transaction,omitempty"`
	// contains filtered or unexported fields
}

The request message for BroadcastTransaction. For the broadcast to complete successfully, one of the following must be true: 1. The raw_signed_transaction on the Transaction is populated. This is equivalent to the payload used to broadcast transactions via block explorers such as Etherscan. 2. The signature(s) in the required_signatures of the Transaction is populated. The TransactionInput itself is not required.

func (*BroadcastTransactionRequest) Descriptor deprecated

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

Deprecated: Use BroadcastTransactionRequest.ProtoReflect.Descriptor instead.

func (*BroadcastTransactionRequest) GetNetwork

func (x *BroadcastTransactionRequest) GetNetwork() string

func (*BroadcastTransactionRequest) GetTransaction

func (x *BroadcastTransactionRequest) GetTransaction() *v1.Transaction

func (*BroadcastTransactionRequest) ProtoMessage

func (*BroadcastTransactionRequest) ProtoMessage()

func (*BroadcastTransactionRequest) ProtoReflect

func (*BroadcastTransactionRequest) Reset

func (x *BroadcastTransactionRequest) Reset()

func (*BroadcastTransactionRequest) String

func (x *BroadcastTransactionRequest) String() string

type ConstructTransactionRequest

type ConstructTransactionRequest struct {

	// The resource name of the Network.
	// Format: networks/{network_id}
	Network string `protobuf:"bytes,1,opt,name=network,proto3" json:"network,omitempty"`
	// The input indicating the unsigned transaction to construct.
	Input *v1.TransactionInput `protobuf:"bytes,2,opt,name=input,proto3" json:"input,omitempty"`
	// contains filtered or unexported fields
}

The request message for ConstructTransaction.

func (*ConstructTransactionRequest) Descriptor deprecated

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

Deprecated: Use ConstructTransactionRequest.ProtoReflect.Descriptor instead.

func (*ConstructTransactionRequest) GetInput

func (*ConstructTransactionRequest) GetNetwork

func (x *ConstructTransactionRequest) GetNetwork() string

func (*ConstructTransactionRequest) ProtoMessage

func (*ConstructTransactionRequest) ProtoMessage()

func (*ConstructTransactionRequest) ProtoReflect

func (*ConstructTransactionRequest) Reset

func (x *ConstructTransactionRequest) Reset()

func (*ConstructTransactionRequest) String

func (x *ConstructTransactionRequest) String() string

type ConstructTransferTransactionRequest

type ConstructTransferTransactionRequest struct {

	// The resource name of the Network on which the transfer is happening.
	// Format: networks/{network_id}
	Network string `protobuf:"bytes,1,opt,name=network,proto3" json:"network,omitempty"`
	// The resource name of the Asset being transferred.
	// Format: networks/{network_id}/assets/{asset_id}.
	Asset string `protobuf:"bytes,2,opt,name=asset,proto3" json:"asset,omitempty"`
	// The address of the sender, e.g. as a 0x-prefixed hex string.
	Sender string `protobuf:"bytes,3,opt,name=sender,proto3" json:"sender,omitempty"`
	// The address of the recipient, e.g. as a 0x-prefixed hex string.
	Recipient string `protobuf:"bytes,4,opt,name=recipient,proto3" json:"recipient,omitempty"`
	// The amount of the asset to transfer, denominated in atomic units of the asset (e.g. Wei),
	// either as a "0x"-prefixed hex string or a base-10 number.
	Amount string `protobuf:"bytes,5,opt,name=amount,proto3" json:"amount,omitempty"`
	// The nonce of the from address to be used in transaction construction.
	// This is required only for Account-based networks (e.g. EVM).
	Nonce int64 `protobuf:"varint,6,opt,name=nonce,proto3" json:"nonce,omitempty"`
	// The fee to be paid for the transfer. If not provided, the API will default to a network-based fee estimate.
	Fee *v1.TransactionFee `protobuf:"bytes,7,opt,name=fee,proto3" json:"fee,omitempty"`
	// The Definition of the BlockchainService Asset for which the transfer transaction is being constructed.
	// Supplying an Asset Definition is not strictly necessary for constructing transfer transactions for a native Asset
	// or an ERC-20.
	// For an ERC-721, an Asset Definition with a sub_group_id must be provided to specify the token being transferred.
	// For an ERC-1155, an Asset Definition with a sub_group_id must be provided to specify the token being transferred.
	AssetDefinition *v11.Asset_Definition `protobuf:"bytes,8,opt,name=asset_definition,json=assetDefinition,proto3" json:"asset_definition,omitempty"`
	// contains filtered or unexported fields
}

The request message for ConstructTransferTransaction.

func (*ConstructTransferTransactionRequest) Descriptor deprecated

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

Deprecated: Use ConstructTransferTransactionRequest.ProtoReflect.Descriptor instead.

func (*ConstructTransferTransactionRequest) GetAmount

func (*ConstructTransferTransactionRequest) GetAsset

func (*ConstructTransferTransactionRequest) GetAssetDefinition

func (x *ConstructTransferTransactionRequest) GetAssetDefinition() *v11.Asset_Definition

func (*ConstructTransferTransactionRequest) GetFee

func (*ConstructTransferTransactionRequest) GetNetwork

func (*ConstructTransferTransactionRequest) GetNonce

func (*ConstructTransferTransactionRequest) GetRecipient

func (x *ConstructTransferTransactionRequest) GetRecipient() string

func (*ConstructTransferTransactionRequest) GetSender

func (*ConstructTransferTransactionRequest) ProtoMessage

func (*ConstructTransferTransactionRequest) ProtoMessage()

func (*ConstructTransferTransactionRequest) ProtoReflect

func (*ConstructTransferTransactionRequest) Reset

func (*ConstructTransferTransactionRequest) String

type EstimateFeeRequest

type EstimateFeeRequest struct {

	// The resource name of the Network.
	// Format: networks/{network_id}
	Network string `protobuf:"bytes,1,opt,name=network,proto3" json:"network,omitempty"`
	// contains filtered or unexported fields
}

The request message for EstimateFee.

func (*EstimateFeeRequest) Descriptor deprecated

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

Deprecated: Use EstimateFeeRequest.ProtoReflect.Descriptor instead.

func (*EstimateFeeRequest) GetNetwork

func (x *EstimateFeeRequest) GetNetwork() string

func (*EstimateFeeRequest) ProtoMessage

func (*EstimateFeeRequest) ProtoMessage()

func (*EstimateFeeRequest) ProtoReflect

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

func (*EstimateFeeRequest) Reset

func (x *EstimateFeeRequest) Reset()

func (*EstimateFeeRequest) String

func (x *EstimateFeeRequest) String() string

type EstimateFeeResponse

type EstimateFeeResponse struct {

	// The estimated fee for the given Network.
	//
	// Types that are assignable to NetworkFeeEstimate:
	//	*EstimateFeeResponse_EthereumFeeEstimate
	NetworkFeeEstimate isEstimateFeeResponse_NetworkFeeEstimate `protobuf_oneof:"network_fee_estimate"`
	// contains filtered or unexported fields
}

The response message for EstimateFee.

func (*EstimateFeeResponse) Descriptor deprecated

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

Deprecated: Use EstimateFeeResponse.ProtoReflect.Descriptor instead.

func (*EstimateFeeResponse) GetEthereumFeeEstimate

func (x *EstimateFeeResponse) GetEthereumFeeEstimate() *v12.FeeEstimate

func (*EstimateFeeResponse) GetNetworkFeeEstimate

func (m *EstimateFeeResponse) GetNetworkFeeEstimate() isEstimateFeeResponse_NetworkFeeEstimate

func (*EstimateFeeResponse) ProtoMessage

func (*EstimateFeeResponse) ProtoMessage()

func (*EstimateFeeResponse) ProtoReflect

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

func (*EstimateFeeResponse) Reset

func (x *EstimateFeeResponse) Reset()

func (*EstimateFeeResponse) String

func (x *EstimateFeeResponse) String() string

type EstimateFeeResponse_EthereumFeeEstimate

type EstimateFeeResponse_EthereumFeeEstimate struct {
	// The estimated network fee for the given EVM Network.
	EthereumFeeEstimate *v12.FeeEstimate `protobuf:"bytes,1,opt,name=ethereum_fee_estimate,json=ethereumFeeEstimate,proto3,oneof"`
}

type ProtocolServiceClient

type ProtocolServiceClient interface {
	// Constructs an unsigned transaction. The payloads in the required_signatures of the
	// returned Transaction must be signed before the Transaction is broadcast.
	ConstructTransaction(ctx context.Context, in *ConstructTransactionRequest, opts ...grpc.CallOption) (*v1.Transaction, error)
	// Constructs an unsigned transfer transaction. A transfer transaction is a transaction that
	// moves an Asset from one Address to another. The payloads in the required_signatures of the
	// returned Transaction must be signed before the Transaction is broadcast.
	ConstructTransferTransaction(ctx context.Context, in *ConstructTransferTransactionRequest, opts ...grpc.CallOption) (*v1.Transaction, error)
	// Broadcasts a transaction to a node in the Network. There are two ways of invoking this API:
	// 1. Set the raw_signed_transaction on the Transaction. This is equivalent to the payload used to broadcast transactions
	// via block explorers such as Etherscan. In this case, the TransactionInput does not need to be set on the Transaction.
	// 2. Set the signature(s) in the required_signatures of the Transaction. In this case, the TransactionInput must also be
	// set on the Transaction.
	// The Transaction returned will have the hash set on it.
	BroadcastTransaction(ctx context.Context, in *BroadcastTransactionRequest, opts ...grpc.CallOption) (*v1.Transaction, error)
	// Estimates the current network fee for the specified Network. For EVM Networks, this
	// corresponds to the gas_price, max_fee_per_gas, and max_priority_fee_per_gas.
	EstimateFee(ctx context.Context, in *EstimateFeeRequest, opts ...grpc.CallOption) (*EstimateFeeResponse, error)
}

ProtocolServiceClient is the client API for ProtocolService 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.

type ProtocolServiceServer

type ProtocolServiceServer interface {
	// Constructs an unsigned transaction. The payloads in the required_signatures of the
	// returned Transaction must be signed before the Transaction is broadcast.
	ConstructTransaction(context.Context, *ConstructTransactionRequest) (*v1.Transaction, error)
	// Constructs an unsigned transfer transaction. A transfer transaction is a transaction that
	// moves an Asset from one Address to another. The payloads in the required_signatures of the
	// returned Transaction must be signed before the Transaction is broadcast.
	ConstructTransferTransaction(context.Context, *ConstructTransferTransactionRequest) (*v1.Transaction, error)
	// Broadcasts a transaction to a node in the Network. There are two ways of invoking this API:
	// 1. Set the raw_signed_transaction on the Transaction. This is equivalent to the payload used to broadcast transactions
	// via block explorers such as Etherscan. In this case, the TransactionInput does not need to be set on the Transaction.
	// 2. Set the signature(s) in the required_signatures of the Transaction. In this case, the TransactionInput must also be
	// set on the Transaction.
	// The Transaction returned will have the hash set on it.
	BroadcastTransaction(context.Context, *BroadcastTransactionRequest) (*v1.Transaction, error)
	// Estimates the current network fee for the specified Network. For EVM Networks, this
	// corresponds to the gas_price, max_fee_per_gas, and max_priority_fee_per_gas.
	EstimateFee(context.Context, *EstimateFeeRequest) (*EstimateFeeResponse, error)
	// contains filtered or unexported methods
}

ProtocolServiceServer is the server API for ProtocolService service. All implementations must embed UnimplementedProtocolServiceServer for forward compatibility

type UnimplementedProtocolServiceServer

type UnimplementedProtocolServiceServer struct {
}

UnimplementedProtocolServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedProtocolServiceServer) BroadcastTransaction

func (UnimplementedProtocolServiceServer) ConstructTransaction

func (UnimplementedProtocolServiceServer) ConstructTransferTransaction

func (UnimplementedProtocolServiceServer) EstimateFee

type UnsafeProtocolServiceServer

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

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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