safewallet

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2023 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const SafeWalletServicePathPrefix = "/twirp/github.com.pando.safewallet.SafeWalletService/"

SafeWalletServicePathPrefix is a convenience constant that may identify URL paths. Should be used with caution, it only matches routes generated by Twirp Go clients, with the default "/twirp" prefix and default CamelCase service and method names. More info: https://twitchtv.github.io/twirp/docs/routing.html

Variables

View Source
var (
	Transfer_Status_name = map[int32]string{
		0: "STATUS_NOT_SET",
		1: "PENDING",
		2: "ASSIGNED",
		3: "HANDLED",
	}
	Transfer_Status_value = map[string]int32{
		"STATUS_NOT_SET": 0,
		"PENDING":        1,
		"ASSIGNED":       2,
		"HANDLED":        3,
	}
)

Enum value maps for Transfer_Status.

View Source
var File_rpc_proto_wallet_proto protoreflect.FileDescriptor

Functions

func WriteError

func WriteError(resp http.ResponseWriter, err error)

WriteError writes an HTTP response with a valid Twirp error format (code, msg, meta). Useful outside of the Twirp server (e.g. http middleware), but does not trigger hooks. If err is not a twirp.Error, it will get wrapped with twirp.InternalErrorWith(err)

Types

type CreateTransferRequest

type CreateTransferRequest struct {
	TraceId   string   `protobuf:"bytes,1,opt,name=trace_id,json=traceId,proto3" json:"trace_id,omitempty"`
	AssetId   string   `protobuf:"bytes,2,opt,name=asset_id,json=assetId,proto3" json:"asset_id,omitempty"`
	Amount    string   `protobuf:"bytes,3,opt,name=amount,proto3" json:"amount,omitempty"`
	Memo      string   `protobuf:"bytes,4,opt,name=memo,proto3" json:"memo,omitempty"`
	Opponents []string `protobuf:"bytes,5,rep,name=opponents,proto3" json:"opponents,omitempty"`
	Threshold uint32   `protobuf:"varint,6,opt,name=threshold,proto3" json:"threshold,omitempty"`
	// contains filtered or unexported fields
}

func (*CreateTransferRequest) Descriptor deprecated

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

Deprecated: Use CreateTransferRequest.ProtoReflect.Descriptor instead.

func (*CreateTransferRequest) GetAmount

func (x *CreateTransferRequest) GetAmount() string

func (*CreateTransferRequest) GetAssetId

func (x *CreateTransferRequest) GetAssetId() string

func (*CreateTransferRequest) GetMemo

func (x *CreateTransferRequest) GetMemo() string

func (*CreateTransferRequest) GetOpponents

func (x *CreateTransferRequest) GetOpponents() []string

func (*CreateTransferRequest) GetThreshold

func (x *CreateTransferRequest) GetThreshold() uint32

func (*CreateTransferRequest) GetTraceId

func (x *CreateTransferRequest) GetTraceId() string

func (*CreateTransferRequest) ProtoMessage

func (*CreateTransferRequest) ProtoMessage()

func (*CreateTransferRequest) ProtoReflect

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

func (*CreateTransferRequest) Reset

func (x *CreateTransferRequest) Reset()

func (*CreateTransferRequest) String

func (x *CreateTransferRequest) String() string

type CreateTransferResponse

type CreateTransferResponse struct {
	Transfer *Transfer `protobuf:"bytes,1,opt,name=transfer,proto3" json:"transfer,omitempty"`
	// contains filtered or unexported fields
}

func (*CreateTransferResponse) Descriptor deprecated

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

Deprecated: Use CreateTransferResponse.ProtoReflect.Descriptor instead.

func (*CreateTransferResponse) GetTransfer

func (x *CreateTransferResponse) GetTransfer() *Transfer

func (*CreateTransferResponse) ProtoMessage

func (*CreateTransferResponse) ProtoMessage()

func (*CreateTransferResponse) ProtoReflect

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

func (*CreateTransferResponse) Reset

func (x *CreateTransferResponse) Reset()

func (*CreateTransferResponse) String

func (x *CreateTransferResponse) String() string

type FindTransferRequest

type FindTransferRequest struct {
	TraceId string `protobuf:"bytes,1,opt,name=trace_id,json=traceId,proto3" json:"trace_id,omitempty"`
	// contains filtered or unexported fields
}

func (*FindTransferRequest) Descriptor deprecated

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

Deprecated: Use FindTransferRequest.ProtoReflect.Descriptor instead.

func (*FindTransferRequest) GetTraceId

func (x *FindTransferRequest) GetTraceId() string

func (*FindTransferRequest) ProtoMessage

func (*FindTransferRequest) ProtoMessage()

func (*FindTransferRequest) ProtoReflect

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

func (*FindTransferRequest) Reset

func (x *FindTransferRequest) Reset()

func (*FindTransferRequest) String

func (x *FindTransferRequest) String() string

type FindTransferResponse

type FindTransferResponse struct {
	Transfer *Transfer `protobuf:"bytes,1,opt,name=transfer,proto3" json:"transfer,omitempty"`
	// contains filtered or unexported fields
}

func (*FindTransferResponse) Descriptor deprecated

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

Deprecated: Use FindTransferResponse.ProtoReflect.Descriptor instead.

func (*FindTransferResponse) GetTransfer

func (x *FindTransferResponse) GetTransfer() *Transfer

func (*FindTransferResponse) ProtoMessage

func (*FindTransferResponse) ProtoMessage()

func (*FindTransferResponse) ProtoReflect

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

func (*FindTransferResponse) Reset

func (x *FindTransferResponse) Reset()

func (*FindTransferResponse) String

func (x *FindTransferResponse) String() string

type HTTPClient

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

HTTPClient is the interface used by generated clients to send HTTP requests. It is fulfilled by *(net/http).Client, which is sufficient for most users. Users can provide their own implementation for special retry policies.

HTTPClient implementations should not follow redirects. Redirects are automatically disabled if *(net/http).Client is passed to client constructors. See the withoutRedirects function in this file for more details.

type SafeWalletService

type SafeWalletService interface {
	CreateTransfer(context.Context, *CreateTransferRequest) (*CreateTransferResponse, error)

	FindTransfer(context.Context, *FindTransferRequest) (*FindTransferResponse, error)
}

func NewSafeWalletServiceJSONClient

func NewSafeWalletServiceJSONClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) SafeWalletService

NewSafeWalletServiceJSONClient creates a JSON client that implements the SafeWalletService interface. It communicates using JSON and can be configured with a custom HTTPClient.

func NewSafeWalletServiceProtobufClient

func NewSafeWalletServiceProtobufClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) SafeWalletService

NewSafeWalletServiceProtobufClient creates a Protobuf client that implements the SafeWalletService interface. It communicates using Protobuf and can be configured with a custom HTTPClient.

type Transfer

type Transfer struct {
	TraceId   string                 `protobuf:"bytes,1,opt,name=trace_id,json=traceId,proto3" json:"trace_id,omitempty"`
	CreatedAt *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"`
	Status    Transfer_Status        `protobuf:"varint,3,opt,name=status,proto3,enum=github.com.pando.safewallet.Transfer_Status" json:"status,omitempty"`
	AssetId   string                 `protobuf:"bytes,4,opt,name=asset_id,json=assetId,proto3" json:"asset_id,omitempty"`
	Amount    string                 `protobuf:"bytes,5,opt,name=amount,proto3" json:"amount,omitempty"`
	Memo      string                 `protobuf:"bytes,6,opt,name=memo,proto3" json:"memo,omitempty"`
	Opponents []string               `protobuf:"bytes,7,rep,name=opponents,proto3" json:"opponents,omitempty"`
	Threshold uint32                 `protobuf:"varint,8,opt,name=threshold,proto3" json:"threshold,omitempty"`
	// contains filtered or unexported fields
}

func (*Transfer) Descriptor deprecated

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

Deprecated: Use Transfer.ProtoReflect.Descriptor instead.

func (*Transfer) GetAmount

func (x *Transfer) GetAmount() string

func (*Transfer) GetAssetId

func (x *Transfer) GetAssetId() string

func (*Transfer) GetCreatedAt

func (x *Transfer) GetCreatedAt() *timestamppb.Timestamp

func (*Transfer) GetMemo

func (x *Transfer) GetMemo() string

func (*Transfer) GetOpponents

func (x *Transfer) GetOpponents() []string

func (*Transfer) GetStatus

func (x *Transfer) GetStatus() Transfer_Status

func (*Transfer) GetThreshold

func (x *Transfer) GetThreshold() uint32

func (*Transfer) GetTraceId

func (x *Transfer) GetTraceId() string

func (*Transfer) ProtoMessage

func (*Transfer) ProtoMessage()

func (*Transfer) ProtoReflect

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

func (*Transfer) Reset

func (x *Transfer) Reset()

func (*Transfer) String

func (x *Transfer) String() string

type Transfer_Status

type Transfer_Status int32
const (
	Transfer_STATUS_NOT_SET Transfer_Status = 0
	Transfer_PENDING        Transfer_Status = 1
	Transfer_ASSIGNED       Transfer_Status = 2
	Transfer_HANDLED        Transfer_Status = 3
)

func (Transfer_Status) Descriptor

func (Transfer_Status) Enum

func (x Transfer_Status) Enum() *Transfer_Status

func (Transfer_Status) EnumDescriptor deprecated

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

Deprecated: Use Transfer_Status.Descriptor instead.

func (Transfer_Status) Number

func (Transfer_Status) String

func (x Transfer_Status) String() string

func (Transfer_Status) Type

type TwirpServer

type TwirpServer interface {
	http.Handler

	// ServiceDescriptor returns gzipped bytes describing the .proto file that
	// this service was generated from. Once unzipped, the bytes can be
	// unmarshalled as a
	// google.golang.org/protobuf/types/descriptorpb.FileDescriptorProto.
	//
	// The returned integer is the index of this particular service within that
	// FileDescriptorProto's 'Service' slice of ServiceDescriptorProtos. This is a
	// low-level field, expected to be used for reflection.
	ServiceDescriptor() ([]byte, int)

	// ProtocGenTwirpVersion is the semantic version string of the version of
	// twirp used to generate this file.
	ProtocGenTwirpVersion() string

	// PathPrefix returns the HTTP URL path prefix for all methods handled by this
	// service. This can be used with an HTTP mux to route Twirp requests.
	// The path prefix is in the form: "/<prefix>/<package>.<Service>/"
	// that is, everything in a Twirp route except for the <Method> at the end.
	PathPrefix() string
}

TwirpServer is the interface generated server structs will support: they're HTTP handlers with additional methods for accessing metadata about the service. Those accessors are a low-level API for building reflection tools. Most people can think of TwirpServers as just http.Handlers.

func NewSafeWalletServiceServer

func NewSafeWalletServiceServer(svc SafeWalletService, opts ...interface{}) TwirpServer

NewSafeWalletServiceServer builds a TwirpServer that can be used as an http.Handler to handle HTTP requests that are routed to the right method in the provided svc implementation. The opts are twirp.ServerOption modifiers, for example twirp.WithServerHooks(hooks).

Jump to

Keyboard shortcuts

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