Documentation
¶
Index ¶
- type CancelOrderArgs
- type CancelOrderReply
- type GetBalanceArgs
- type GetBalanceReply
- type GetDepositAddressArgs
- type GetDepositAddressReply
- type GetLitConnectionArgs
- type GetLitConnectionReply
- type GetOrderArgs
- type GetOrderReply
- type GetOrdersForPubkeyArgs
- type GetOrdersForPubkeyReply
- type GetPairsArgs
- type GetPairsReply
- type GetPriceArgs
- type GetPriceReply
- type GetRegistrationStringArgs
- type GetRegistrationStringReply
- type OpencxClient
- type OpencxNoiseClient
- type OpencxRPC
- func (cl *OpencxRPC) CancelOrder(args CancelOrderArgs, reply *CancelOrderReply) (err error)
- func (cl *OpencxRPC) GetBalance(args GetBalanceArgs, reply *GetBalanceReply) (err error)
- func (cl *OpencxRPC) GetDepositAddress(args GetDepositAddressArgs, reply *GetDepositAddressReply) (err error)
- func (cl *OpencxRPC) GetLitConnection(args GetLitConnectionArgs, reply *GetLitConnectionReply) (err error)
- func (cl *OpencxRPC) GetOrder(args GetOrderArgs, reply *GetOrderReply) (err error)
- func (cl *OpencxRPC) GetOrdersForPubkey(args GetOrdersForPubkeyArgs, reply *GetOrdersForPubkeyReply) (err error)
- func (cl *OpencxRPC) GetPairs(args GetPairsArgs, reply *GetPairsReply) (err error)
- func (cl *OpencxRPC) GetPrice(args GetPriceArgs, reply *GetPriceReply) (err error)
- func (cl *OpencxRPC) GetRegistrationString(args GetRegistrationStringArgs, reply *GetRegistrationStringReply) (err error)
- func (cl *OpencxRPC) Register(args RegisterArgs, reply *RegisterReply) (err error)
- func (cl *OpencxRPC) SubmitOrder(args SubmitOrderArgs, reply *SubmitOrderReply) (err error)
- func (cl *OpencxRPC) ViewOrderBook(args ViewOrderBookArgs, reply *ViewOrderBookReply) (err error)
- func (cl *OpencxRPC) Withdraw(args WithdrawArgs, reply *WithdrawReply) (err error)
- func (cl *OpencxRPC) WithdrawToLightningNode(args WithdrawToLightningNodeArgs, reply *WithdrawToLightningNodeReply) (err error)
- type OpencxRPCCaller
- func (rpc1 *OpencxRPCCaller) NoiseListen(privkey *koblitz.PrivateKey, host string, port uint16) (err error)
- func (rpc1 *OpencxRPCCaller) NoiseListenAsync(doneChan chan bool, errChan chan error, privkey *koblitz.PrivateKey, ...)
- func (rpc1 *OpencxRPCCaller) RPCListen(host string, port uint16) (err error)
- func (rpc1 *OpencxRPCCaller) RPCListenAsync(doneChan chan bool, errChan chan error, host string, port uint16)
- func (rpc1 *OpencxRPCCaller) Stop() (err error)
- func (rpc1 *OpencxRPCCaller) WaitUntilDead()
- type OpencxRPCClient
- type RegisterArgs
- type RegisterReply
- type SubmitOrderArgs
- type SubmitOrderReply
- type ViewOrderBookArgs
- type ViewOrderBookReply
- type WithdrawArgs
- type WithdrawReply
- type WithdrawToLightningNodeArgs
- type WithdrawToLightningNodeReply
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CancelOrderArgs ¶
CancelOrderArgs holds the args for the CancelOrder command
type CancelOrderReply ¶
type CancelOrderReply struct { }
CancelOrderReply holds the args for the CancelOrder command
type GetBalanceArgs ¶
GetBalanceArgs hold the arguments for GetBalance
type GetBalanceReply ¶
type GetBalanceReply struct {
Amount uint64
}
GetBalanceReply holds the reply for GetBalance
type GetDepositAddressArgs ¶
GetDepositAddressArgs hold the arguments for GetDepositAddress
type GetDepositAddressReply ¶
type GetDepositAddressReply struct {
Address string
}
GetDepositAddressReply holds the reply for GetDepositAddress
type GetLitConnectionArgs ¶
type GetLitConnectionArgs struct { }
GetLitConnectionArgs holds the args for the getlitconnection RPC command
type GetLitConnectionReply ¶
GetLitConnectionReply holds the reply for the getlitconnection RPC command
type GetOrderArgs ¶
GetOrderArgs holds the args for the GetOrder command
type GetOrderReply ¶
type GetOrderReply struct {
Order *match.LimitOrderIDPair
}
GetOrderReply holds the reply for the GetOrder command
type GetOrdersForPubkeyArgs ¶
type GetOrdersForPubkeyArgs struct {
Signature []byte
}
GetOrdersForPubkeyArgs holds the args for the GetOrdersForPubkey command
type GetOrdersForPubkeyReply ¶
type GetOrdersForPubkeyReply struct {
Orders []*match.LimitOrderIDPair
}
GetOrdersForPubkeyReply holds the reply for the GetOrdersForPubkey command
type GetPairsArgs ¶
type GetPairsArgs struct { }
GetPairsArgs holds the args for the GetPairs command
type GetPairsReply ¶
type GetPairsReply struct {
PairList []string
}
GetPairsReply holds the reply for the GetPairs command
type GetPriceArgs ¶
GetPriceArgs holds the args for the GetPrice command
type GetPriceReply ¶
type GetPriceReply struct {
Price float64
}
GetPriceReply holds the reply for the GetPrice command
type GetRegistrationStringArgs ¶
type GetRegistrationStringArgs struct { }
GetRegistrationStringArgs holds the args for register
type GetRegistrationStringReply ¶
type GetRegistrationStringReply struct {
RegistrationString string
}
GetRegistrationStringReply holds the data for the register reply
type OpencxClient ¶
type OpencxClient interface { // Call calls the service method with a name, arguments, and reply Call(string, interface{}, interface{}) error // SetupConnection sets up a connection with the server SetupConnection(string, uint16) error }
OpencxClient is an interface defining the methods a client should implement. This could be changed, but right now this is what a client is, and this is what benchclient supports. This abstraction only allows us to use either authenticated or unauthenticated clients.
type OpencxNoiseClient ¶
OpencxNoiseClient is an authenticated RPC Client for the opencx Server
func (*OpencxNoiseClient) Call ¶
func (cl *OpencxNoiseClient) Call(serviceMethod string, args interface{}, reply interface{}) (err error)
Call calls the servicemethod with name string, args args, and reply reply
func (*OpencxNoiseClient) SetKey ¶
func (cl *OpencxNoiseClient) SetKey(privkey *koblitz.PrivateKey) (err error)
SetKey sets the private key for the noise client.
func (*OpencxNoiseClient) SetupConnection ¶
func (cl *OpencxNoiseClient) SetupConnection(server string, port uint16) (err error)
SetupConnection creates a new RPC Noise client
type OpencxRPC ¶
type OpencxRPC struct {
Server *cxserver.OpencxServer
}
OpencxRPC is what is registered and called
func (*OpencxRPC) CancelOrder ¶
func (cl *OpencxRPC) CancelOrder(args CancelOrderArgs, reply *CancelOrderReply) (err error)
CancelOrder cancels the order
func (*OpencxRPC) GetBalance ¶
func (cl *OpencxRPC) GetBalance(args GetBalanceArgs, reply *GetBalanceReply) (err error)
GetBalance is the RPC Interface for GetBalance
func (*OpencxRPC) GetDepositAddress ¶
func (cl *OpencxRPC) GetDepositAddress(args GetDepositAddressArgs, reply *GetDepositAddressReply) (err error)
GetDepositAddress is the RPC Interface for GetDepositAddress
func (*OpencxRPC) GetLitConnection ¶
func (cl *OpencxRPC) GetLitConnection(args GetLitConnectionArgs, reply *GetLitConnectionReply) (err error)
GetLitConnection gets a pubkeyhash and port for connecting with lit, the hostname is assumed to be the same.
func (*OpencxRPC) GetOrder ¶
func (cl *OpencxRPC) GetOrder(args GetOrderArgs, reply *GetOrderReply) (err error)
GetOrder gets an order based on orderID
func (*OpencxRPC) GetOrdersForPubkey ¶
func (cl *OpencxRPC) GetOrdersForPubkey(args GetOrdersForPubkeyArgs, reply *GetOrdersForPubkeyReply) (err error)
GetOrdersForPubkey gets the orders for the pubkey which has signed the getOrdersString
func (*OpencxRPC) GetPairs ¶
func (cl *OpencxRPC) GetPairs(args GetPairsArgs, reply *GetPairsReply) (err error)
GetPairs gets all the pairs as nice strings
func (*OpencxRPC) GetPrice ¶
func (cl *OpencxRPC) GetPrice(args GetPriceArgs, reply *GetPriceReply) (err error)
GetPrice returns the price for the specified asset
func (*OpencxRPC) GetRegistrationString ¶
func (cl *OpencxRPC) GetRegistrationString(args GetRegistrationStringArgs, reply *GetRegistrationStringReply) (err error)
GetRegistrationString returns a string to the client which is a valid string to sign to indicate they want their pubkey to be registered. This is like kinda weird but whatever
func (*OpencxRPC) Register ¶
func (cl *OpencxRPC) Register(args RegisterArgs, reply *RegisterReply) (err error)
Register registers a pubkey into the db, verifies that the action was signed by that pubkey. A valid signature for the string "register" is considered a valid registration.
func (*OpencxRPC) SubmitOrder ¶
func (cl *OpencxRPC) SubmitOrder(args SubmitOrderArgs, reply *SubmitOrderReply) (err error)
SubmitOrder submits an order to the order book or throws an error
func (*OpencxRPC) ViewOrderBook ¶
func (cl *OpencxRPC) ViewOrderBook(args ViewOrderBookArgs, reply *ViewOrderBookReply) (err error)
ViewOrderBook handles the vieworderbook command
func (*OpencxRPC) Withdraw ¶
func (cl *OpencxRPC) Withdraw(args WithdrawArgs, reply *WithdrawReply) (err error)
Withdraw is the RPC Interface for Withdraw
func (*OpencxRPC) WithdrawToLightningNode ¶
func (cl *OpencxRPC) WithdrawToLightningNode(args WithdrawToLightningNodeArgs, reply *WithdrawToLightningNodeReply) (err error)
WithdrawToLightningNode creates a channel that pushes a certain amount to a lightning node through a lightning channel.
type OpencxRPCCaller ¶
type OpencxRPCCaller struct {
// contains filtered or unexported fields
}
OpencxRPCCaller is a listener for RPC commands
func CreateRPCForServer ¶
func CreateRPCForServer(server *cxserver.OpencxServer) (rpc1 *OpencxRPCCaller, err error)
func (*OpencxRPCCaller) NoiseListen ¶
func (rpc1 *OpencxRPCCaller) NoiseListen(privkey *koblitz.PrivateKey, host string, port uint16) (err error)
NoiseListen is a synchronous version of RPCListenAsync
func (*OpencxRPCCaller) NoiseListenAsync ¶
func (rpc1 *OpencxRPCCaller) NoiseListenAsync(doneChan chan bool, errChan chan error, privkey *koblitz.PrivateKey, host string, port uint16)
NoiseListenAsync listens on socket host and port
func (*OpencxRPCCaller) RPCListen ¶
func (rpc1 *OpencxRPCCaller) RPCListen(host string, port uint16) (err error)
RPCListen is a synchronous version of RPCListenAsync
func (*OpencxRPCCaller) RPCListenAsync ¶
func (rpc1 *OpencxRPCCaller) RPCListenAsync(doneChan chan bool, errChan chan error, host string, port uint16)
RPCListenAsync listens on socket host and port
func (*OpencxRPCCaller) Stop ¶
func (rpc1 *OpencxRPCCaller) Stop() (err error)
Stop closes the RPC listener and notifies those from WaitUntilDead
func (*OpencxRPCCaller) WaitUntilDead ¶
func (rpc1 *OpencxRPCCaller) WaitUntilDead()
WaitUntilDead waits until the Stop() method is called
type OpencxRPCClient ¶
OpencxRPCClient is a RPC client for the opencx server
func (*OpencxRPCClient) Call ¶
func (cl *OpencxRPCClient) Call(serviceMethod string, args interface{}, reply interface{}) error
Call calls the servicemethod with name string, args args, and reply reply
func (*OpencxRPCClient) SetupConnection ¶
func (cl *OpencxRPCClient) SetupConnection(server string, port uint16) (err error)
SetupConnection creates a new RPC client
type RegisterArgs ¶
type RegisterArgs struct {
Signature []byte
}
RegisterArgs holds the args for register
type RegisterReply ¶
type RegisterReply struct { }
RegisterReply holds the data for the register reply
type SubmitOrderArgs ¶
type SubmitOrderArgs struct { Order *match.LimitOrder // Signature is a compact signature so we can do pubkey recovery Signature []byte }
SubmitOrderArgs holds the args for the submitorder command
type SubmitOrderReply ¶
SubmitOrderReply holds the reply for the submitorder command
type ViewOrderBookArgs ¶
ViewOrderBookArgs holds the args for the vieworderbook command
type ViewOrderBookReply ¶
type ViewOrderBookReply struct {
Orderbook map[float64][]*match.LimitOrderIDPair
}
ViewOrderBookReply holds the reply for the vieworderbook command
type WithdrawArgs ¶
type WithdrawArgs struct { Withdrawal *match.Withdrawal Signature []byte }
WithdrawArgs holds the args for Withdraw
type WithdrawReply ¶
type WithdrawReply struct {
Txid string
}
WithdrawReply holds the reply for Withdraw
type WithdrawToLightningNodeArgs ¶
type WithdrawToLightningNodeArgs struct { Withdrawal *match.Withdrawal Signature []byte }
WithdrawToLightningNodeArgs holds the args for the withdrawtolightning RPC command
type WithdrawToLightningNodeReply ¶
type WithdrawToLightningNodeReply struct {
Txid string
}
WithdrawToLightningNodeReply holds the reply for the withdrawtolightning RPC command