benchclient

package
v0.0.0-...-7ad0b1f Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2022 License: MIT Imports: 7 Imported by: 0

README

BenchClient

BenchClient is a go API for use in benchmarking. All of its methods call RPC Commands from a running server. You could use it as a generic golang client API as well, if you'd like to build your own client. It supports the same methods that ocx does, and shares a lot of the same code, but it doesn't take argument lists and instead takes in actual arguments.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BenchClient

type BenchClient struct {
	RPCClient cxrpc.OpencxClient
	PrivKey   *koblitz.PrivateKey
	// contains filtered or unexported fields
}

BenchClient holds the RPC Client and defines many methods that can be called

func (*BenchClient) AuctionOrderAsync

func (cl *BenchClient) AuctionOrderAsync(pubkey *koblitz.PublicKey, side string, pair string, amountHave uint64, price float64, t uint64, auctionID [32]byte, replyChan chan *cxauctionrpc.SubmitPuzzledOrderReply, errChan chan error)

AuctionOrderAsync is supposed to be run in a separate goroutine, AuctionOrderCommand makes this synchronous however

func (*BenchClient) AuctionOrderCommand

func (cl *BenchClient) AuctionOrderCommand(pubkey *koblitz.PublicKey, side string, pair string, amountHave uint64, price float64, t uint64, auctionID [32]byte) (reply *cxauctionrpc.SubmitPuzzledOrderReply, err error)

AuctionOrderCommand submits an order synchronously. Uses asynchronous order function

func (*BenchClient) Call

func (cl *BenchClient) Call(serviceMethod string, args interface{}, reply interface{}) error

Call calls a method from the rpc client

func (*BenchClient) CancelOrder

func (cl *BenchClient) CancelOrder(orderID string) (cancelOrderReply *cxrpc.CancelOrderReply, err error)

CancelOrder calls the cancel order rpc command

func (*BenchClient) GetAllBalances

func (cl *BenchClient) GetAllBalances() (balances map[string]uint64, err error)

GetAllBalances get the balance for every token

func (*BenchClient) GetBalance

func (cl *BenchClient) GetBalance(asset string) (getBalanceReply *cxrpc.GetBalanceReply, err error)

GetBalance calls the getbalance rpc command

func (*BenchClient) GetDepositAddress

func (cl *BenchClient) GetDepositAddress(asset string) (getDepositAddressReply *cxrpc.GetDepositAddressReply, err error)

GetDepositAddress calls the getdepositaddress rpc command

func (*BenchClient) GetHostname

func (cl *BenchClient) GetHostname() string

GetHostname returns the hostname, used for convenience I guess, maybe move out of benchclient and into ocx?

func (*BenchClient) GetLitConnection

func (cl *BenchClient) GetLitConnection() (getLitConnectionReply *cxrpc.GetLitConnectionReply, err error)

GetLitConnection gets the lit con to pass in to lit. Maybe do this more automatically later on

func (*BenchClient) GetPairs

func (cl *BenchClient) GetPairs() (getPairsReply *cxrpc.GetPairsReply, err error)

GetPairs gets the available trading pairs

func (*BenchClient) GetPort

func (cl *BenchClient) GetPort() uint16

GetPort returns the port, used for convenience I guess, maybe move out of benchclient and into ocx?

func (*BenchClient) GetPrice

func (cl *BenchClient) GetPrice(assetString string) (getPriceReply *cxrpc.GetPriceReply, err error)

GetPrice calls the getprice rpc command

func (*BenchClient) GetPublicParameters

func (cl *BenchClient) GetPublicParameters(pair *match.Pair) (getPublicParametersReply *cxauctionrpc.GetPublicParametersReply, err error)

GetPublicParameters returns the public parameters like the auction time and current auction ID

func (*BenchClient) GetRegistrationString

func (cl *BenchClient) GetRegistrationString() (getRegistrationStringReply *cxrpc.GetRegistrationStringReply, err error)

GetRegistrationString gets the registration string that needs to be signed in order to be registered on the exchange

func (*BenchClient) OrderAsync

func (cl *BenchClient) OrderAsync(pubkey *koblitz.PublicKey, side match.Side, pair string, amountHave uint64, price float64, replyChan chan *cxrpc.SubmitOrderReply, errChan chan error)

OrderAsync is supposed to be run in a separate goroutine, OrderCommand makes this synchronous however

func (*BenchClient) OrderCommand

func (cl *BenchClient) OrderCommand(pubkey *koblitz.PublicKey, side match.Side, pair string, amountHave uint64, price float64) (reply *cxrpc.SubmitOrderReply, err error)

OrderCommand submits an order synchronously. Uses asynchronous order function

func (*BenchClient) Register

func (cl *BenchClient) Register(signature []byte) (registerReply *cxrpc.RegisterReply, err error)

Register registers for an account

func (*BenchClient) SetupBenchClient

func (cl *BenchClient) SetupBenchClient(server string, port uint16) (err error)

SetupBenchClient creates a new BenchClient for use as an RPC Client

func (*BenchClient) SetupBenchNoiseClient

func (cl *BenchClient) SetupBenchNoiseClient(server string, port uint16) (err error)

SetupBenchNoiseClient create a new BenchClient for use as an RPC-Noise Client

func (*BenchClient) ViewOrderbook

func (cl *BenchClient) ViewOrderbook(assetPair string) (viewOrderbookReply *cxrpc.ViewOrderBookReply, err error)

ViewOrderbook returns the orderbook

func (*BenchClient) Withdraw

func (cl *BenchClient) Withdraw(amount uint64, asset match.Asset, address string) (withdrawReply *cxrpc.WithdrawReply, err error)

Withdraw calls the withdraw rpc command

func (*BenchClient) WithdrawLightning

func (cl *BenchClient) WithdrawLightning(amount uint64, asset match.Asset) (withdrawReply *cxrpc.WithdrawReply, err error)

WithdrawLightning calls the withdraw rpc command, but with the lightning boolean set to true

func (*BenchClient) WithdrawToLightningNode

func (cl *BenchClient) WithdrawToLightningNode() (withdrawToLightningNodeReply *cxrpc.WithdrawToLightningNodeReply, err error)

WithdrawToLightningNode takes in some arguments such as public key, amount, and ln node address

Jump to

Keyboard shortcuts

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