client

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2024 License: BlueOak-1.0.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Logger     dex.Logger
	PrivateKey *secp256k1.PrivateKey
}

Config is the configuration for the TankaClient.

type IncomingPeerConnect

type IncomingPeerConnect struct {
	PeerID tanka.PeerID
	Reject func()
}

IncomingPeerConnect will be emitted when a peer requests a connection for the transmission of tankagrams.

type IncomingTankagram

type IncomingTankagram struct {
	Msg     *msgjson.Message
	Respond func(thing interface{}) error
}

IncomingTankagram will be emitted when we receive a tankagram from a connected peer.

type NetworkBackend

type NetworkBackend interface {
	Send(*msgjson.Message) error
	Request(msg *msgjson.Message, respHandler func(*msgjson.Message)) error
}

NetworkBackend represents a peer's communication protocol.

type NewMarketSubscriber

type NewMarketSubscriber struct {
	MarketName string
	PeerID     tanka.PeerID
}

NewMarketSubscriber will be emitted when a new client subscribes to a market.

type TankaClient

type TankaClient struct {
	// contains filtered or unexported fields
}

func New

func New(cfg *Config) *TankaClient

func (*TankaClient) AddTatankaNode

func (c *TankaClient) AddTatankaNode(ctx context.Context, peerID tanka.PeerID, uri string, cert []byte) error

func (*TankaClient) Auth

func (c *TankaClient) Auth(peerID tanka.PeerID) error

func (*TankaClient) Broadcast

func (c *TankaClient) Broadcast(topic tanka.Topic, subject tanka.Subject, msgType mj.BroadcastMessageType, thing interface{}) error

func (*TankaClient) Connect

func (c *TankaClient) Connect(ctx context.Context) (*sync.WaitGroup, error)

func (*TankaClient) ConnectPeer

func (c *TankaClient) ConnectPeer(peerID tanka.PeerID, hosts ...tanka.PeerID) (*mj.TankagramResult, error)

func (*TankaClient) FiatRate

func (c *TankaClient) FiatRate(assetID uint32) float64

func (*TankaClient) ID

func (c *TankaClient) ID() tanka.PeerID

func (*TankaClient) Next

func (c *TankaClient) Next() <-chan interface{}

func (*TankaClient) PostBond

func (c *TankaClient) PostBond(bond *tanka.Bond) error

func (*TankaClient) SendTankagram

func (c *TankaClient) SendTankagram(peerID tanka.PeerID, msg *msgjson.Message) (_ *mj.TankagramResult, _ json.RawMessage, err error)

func (*TankaClient) SubscribeMarket

func (c *TankaClient) SubscribeMarket(baseID, quoteID uint32) error

func (*TankaClient) SubscribeToFiatRates

func (c *TankaClient) SubscribeToFiatRates() error

Jump to

Keyboard shortcuts

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