server

package
v1.0.0-beta Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2019 License: GPL-3.0 Imports: 25 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrHandlerIsShuttingDown = fmt.Errorf("Http handler is shutting down")

Functions

This section is empty.

Types

type GetAddressResponse

type GetAddressResponse string

type GetAddressesResponse

type GetAddressesResponse map[blockchain.TokenName]string

type GetBalanceResponse

type GetBalanceResponse blockchain.Balance

type GetBalancesResponse

type GetBalancesResponse map[blockchain.TokenName]blockchain.Balance

type GetInfoResponse

type GetInfoResponse struct {
	Version         string             `json:"version"`
	Bootloaded      bool               `json:"bootloaded"`
	SupportedTokens []blockchain.Token `json:"supportedTokens"`
}

type GetSignatureResponseJSON

type GetSignatureResponseJSON struct {
	Message   json.RawMessage `json:"message"`
	Signature string          `json:"signature"`
}

type GetSignatureResponseString

type GetSignatureResponseString struct {
	Message   string `json:"message"`
	Signature string `json:"signature"`
}

type GetSwapResponse

type GetSwapResponse swap.SwapReceipt

type GetSwapsResponse

type GetSwapsResponse struct {
	Swaps []swap.SwapReceipt `json:"swaps"`
}

type GetTransfersResponse

type GetTransfersResponse struct {
	Transfers []transfer.TransferReceipt `json:"transfers"`
}

func MarshalGetTransfersResponse

func MarshalGetTransfersResponse(receiptMap transfer.TransferReceiptMap) GetTransfersResponse

type Handler

type Handler interface {
	GetID(password string, idType string) (string, error)
	GetInfo(password string) GetInfoResponse
	GetSwap(password string, id swap.SwapID) (GetSwapResponse, error)
	GetSwaps(password string) (GetSwapsResponse, error)
	GetBalances(password string) (GetBalancesResponse, error)
	GetBalance(password string, token blockchain.Token) (GetBalanceResponse, error)
	GetAddresses(password string) (GetAddressesResponse, error)
	GetAddress(password string, token blockchain.Token) (GetAddressResponse, error)
	GetTransfers(password string) (GetTransfersResponse, error)
	GetJSONSignature(password string, message json.RawMessage) (GetSignatureResponseJSON, error)
	GetBase64Signature(password string, message string) (GetSignatureResponseString, error)
	GetHexSignature(password string, message string) (GetSignatureResponseString, error)
	PostTransfers(PostTransfersRequest) (PostTransfersResponse, error)
	PostSwaps(PostSwapRequest) (PostSwapResponse, error)
	PostDelayedSwaps(PostSwapRequest) error

	Receive() (tau.Message, error)
	Write(msg tau.Message)
	ShutDown()
}

The Handler for swapperd requests

func NewHandler

func NewHandler(cap int, wallet wallet.Wallet) Handler

type PostRedeemSwapResponse

type PostRedeemSwapResponse struct {
	ID swap.SwapID `json:"id"`
}

type PostSwapRequest

type PostSwapRequest swap.SwapBlob

type PostSwapResponse

type PostSwapResponse struct {
	ID        swap.SwapID   `json:"id"`
	Swap      swap.SwapBlob `json:"swap,omitempty"`
	Signature string        `json:"signature,omitempty"`
}

type PostTransfersRequest

type PostTransfersRequest struct {
	Token    string `json:"token"`
	To       string `json:"to"`
	Amount   string `json:"amount"`
	Password string `json:"password"`
}

type PostTransfersResponse

type PostTransfersResponse transfer.TransferReceipt

type Server

type Server interface {
	Run(doneCh <-chan struct{})
	Receive() (tau.Message, error)
}

func NewHttpServer

func NewHttpServer(cap int, port string, wallet wallet.Wallet, logger logrus.FieldLogger) Server

type Storage

type Storage interface {
	swapper.Storage
	transfer.Storage
}

Jump to

Keyboard shortcuts

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