Documentation
¶
Index ¶
- Variables
- func MakeChangeWalletPinEndpoint(s Service) endpoint.Endpoint
- func MakeDeleteWalletEndpoint(s Service) endpoint.Endpoint
- func MakeExportWalletEndpoint(s Service) endpoint.Endpoint
- func MakeGenerateWalletEndpoint(s Service) endpoint.Endpoint
- func MakeGetWalletEndpoint(s Service) endpoint.Endpoint
- func MakeHTTPHandler(e Endpoints, log logger) http.Handler
- func MakeSignAndSendTransactionEndpoint(s Service) endpoint.Endpoint
- func MakeSignMessageEndpoint(s Service) endpoint.Endpoint
- func MakeSignTransactionEndpoint(s Service) endpoint.Endpoint
- func MakeStoreWalletEndpoint(s Service) endpoint.Endpoint
- func MakeUpdateWalletNameEndpoint(s Service) endpoint.Endpoint
- type ChangeWalletPinRequest
- type DeleteWalletRequest
- type Endpoints
- type ExportWalletRequest
- type Service
- type SignAndSendTransactionRequest
- type SignAndSendTransactionResponse
- type SignMessageRequest
- type SignMessageResponse
- type SignTransactionRequest
- type StoreWalletRequest
- type UpdateWalletNameRequest
- type Wallet
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidParameter = errors.New("invalid parameter") ErrNotFound = errors.New("not found") ErrInvalidPIN = errors.New("invalid pin code") ErrForbidden = errors.New("forbidden") )
Predefined package errors
Functions ¶
func MakeChangeWalletPinEndpoint ¶
MakeChangeWalletPinEndpoint returns an endpoint function for the ChangeWalletPin method.
func MakeDeleteWalletEndpoint ¶
MakeDeleteWalletEndpoint returns an endpoint function for the DeleteWallet method.
func MakeExportWalletEndpoint ¶
MakeExportWalletEndpoint returns an endpoint function for the ExportWallet method.
func MakeGenerateWalletEndpoint ¶
MakeGenerateWalletEndpoint returns an endpoint function for the GenerateWallet method.
func MakeGetWalletEndpoint ¶
MakeGetWalletEndpoint returns an endpoint function for the GetWallet method.
func MakeHTTPHandler ¶
MakeHTTPHandler ...
func MakeSignAndSendTransactionEndpoint ¶
MakeSignAndSendTransactionEndpoint returns an endpoint function for the SignAndSendTransaction method.
func MakeSignMessageEndpoint ¶
MakeSignMessageEndpoint returns an endpoint function for the SignMessage method.
func MakeSignTransactionEndpoint ¶
MakeSignTransactionEndpoint returns an endpoint function for the SignTransaction method.
func MakeStoreWalletEndpoint ¶
MakeStoreWalletEndpoint returns an endpoint function for the StoreWallet method.
func MakeUpdateWalletNameEndpoint ¶
MakeUpdateWalletNameEndpoint returns an endpoint function for the UpdateWalletName method.
Types ¶
type ChangeWalletPinRequest ¶
type ChangeWalletPinRequest struct { Pin string `json:"pin" validate:"required" label:"PIN Code"` NewPin string `json:"new_pin" validate:"required|minLen:4|maxLen:50" label:"New PIN Code"` }
ChangeWalletPinRequest is a request for ChangeWalletPin method
type DeleteWalletRequest ¶
type DeleteWalletRequest struct {
Pin string `json:"pin" validate:"required" label:"PIN Code"`
}
DeleteWalletRequest is a request for DeleteWallet method
type Endpoints ¶
type Endpoints struct { GenerateWallet endpoint.Endpoint StoreWallet endpoint.Endpoint GetWallet endpoint.Endpoint DeleteWallet endpoint.Endpoint UpdateWalletName endpoint.Endpoint ChangeWalletPin endpoint.Endpoint ExportWallet endpoint.Endpoint SignTransaction endpoint.Endpoint SignMessage endpoint.Endpoint SignAndSendTransaction endpoint.Endpoint }
Endpoints collection of profile Service
func MakeEndpoints ¶
func MakeEndpoints(s Service, m ...endpoint.Middleware) Endpoints
Init endpoints
type ExportWalletRequest ¶
type ExportWalletRequest struct {
Pin string `json:"pin" validate:"required" label:"PIN Code"`
}
ExportWalletRequest is a request for ExportWallet method
type Service ¶
type Service interface { // Generate new wallet GenerateWallet(ctx context.Context) (Wallet, error) // Store wallet StoreWallet(ctx context.Context, uid, pin, mnemonic, name string) error // Get wallet by user id GetWallet(ctx context.Context, uid string) (Wallet, error) // Delete wallet by user id DeleteWallet(ctx context.Context, uid string, pin string) error // Update wallet name UpdateWalletName(ctx context.Context, uid string, pin string, name string) error // Change wallet pin ChangeWalletPin(ctx context.Context, uid string, pin string, newPin string) error // Export wallet ExportWallet(ctx context.Context, uid string, pin string) (Wallet, error) // Sign transaction and return signed transaction as base64 string SignTransaction(ctx context.Context, uid string, pin string, base64Tx string) (string, error) // Sign message and return signed message as base64 string SignMessage(ctx context.Context, uid string, pin string, base64Msg string) (msg, signature string, err error) // Sign and send transaction, return transaction signature SignAndSendTransaction(ctx context.Context, uid string, pin string, base64Tx string) (string, error) }
Service interface
func NewService ¶
func NewService(repo walletRepository, wallet solanaWallet, solana solanaClient) Service
NewService is a factory function, returns a new instance of the Service interface implementation
type SignAndSendTransactionRequest ¶
type SignAndSendTransactionRequest struct { Pin string `json:"pin" validate:"required" label:"PIN Code"` Tx string `json:"tx" validate:"required" label:"Base64 encoded transaction"` }
SignAndSendTransactionRequest is a request for SignAndSendTransaction method
type SignAndSendTransactionResponse ¶
type SignAndSendTransactionResponse struct {
TxSignature string `json:"tx_signature" label:"Transaction signature"`
}
SignAndSendTransactionResponse is a response for SignAndSendTransaction method
type SignMessageRequest ¶
type SignMessageRequest struct { Pin string `json:"pin" validate:"required" label:"PIN Code"` Msg string `json:"msg" validate:"required" label:"Message"` }
SignMessageRequest is a request for SignMessage method
type SignMessageResponse ¶
type SignMessageResponse struct { Signature string `json:"signature" label:"Signature"` Msg string `json:"msg" label:"Message"` }
SignMessageResponse is a response for SignMessage method
type SignTransactionRequest ¶
type SignTransactionRequest struct { Pin string `json:"pin" validate:"required" label:"PIN Code"` Tx string `json:"tx" validate:"required" label:"Base64 encoded transaction"` }
SignTransactionRequest is a request for SignTransaction method
type StoreWalletRequest ¶
type StoreWalletRequest struct { Name string `json:"name" validate:"required|minLen:3|maxLen:50" label:"Name"` Pin string `json:"pin" validate:"required|minLen:4|maxLen:50" label:"PIN Code"` Mnemonic string `json:"mnemonic" validate:"required" label:"Mnemonic"` }
StoreWalletRequest is a request for StoreWallet method
type UpdateWalletNameRequest ¶
type UpdateWalletNameRequest struct { Pin string `json:"pin" validate:"required" label:"PIN Code"` Name string `json:"name" validate:"required|minLen:3|maxLen:50" label:"Name"` }
UpdateWalletNameRequest is a request for UpdateWalletName method