-
Notifications
You must be signed in to change notification settings - Fork 23
/
dex_interface.go
41 lines (39 loc) · 1.61 KB
/
dex_interface.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package libwallet
import (
"decred.org/dcrdex/client/core"
"decred.org/dcrdex/client/orderbook"
"decred.org/dcrdex/dex"
)
type DEXClient interface {
Ready() <-chan struct{}
WaitForShutdown() <-chan struct{}
Shutdown()
IsInitialized() bool
InitializedWithPassword() bool
IsLoggedIn() bool
InitWithPassword(pw, seed []byte) error
Login(pw []byte) error
Logout() error
DBPath() string
DiscoverAccount(dexAddr string, appPW []byte, certI any) (*core.Exchange, bool, error)
GetDEXConfig(dexAddr string, certI any) (*core.Exchange, error)
BondsFeeBuffer(assetID uint32) uint64
HasWallet(assetID int32) bool
AddWallet(assetID uint32, settings map[string]string, appPW, walletPW []byte) error
SetWalletPassword(appPW []byte, assetID uint32, newPW []byte) error
PostBond(form *core.PostBondForm) (*core.PostBondResult, error)
NotificationFeed() *core.NoteFeed
Exchanges() map[string]*core.Exchange
Exchange(host string) (*core.Exchange, error)
ExportSeed(pw []byte) ([]byte, error)
SyncBook(dex string, base, quote uint32) (*orderbook.OrderBook, core.BookFeed, error)
Orders(filter *core.OrderFilter) ([]*core.Order, error)
ActiveOrders() (map[string][]*core.Order, map[string][]*core.InFlightOrder, error)
TradeAsync(pw []byte, form *core.TradeForm) (*core.InFlightOrder, error)
WalletState(assetID uint32) *core.WalletState
WalletSettings(assetID uint32) (map[string]string, error)
WalletIDForAsset(assetID uint32) (*int, error)
MaxBuy(host string, base, quote uint32, rate uint64) (*core.MaxOrderEstimate, error)
MaxSell(host string, base, quote uint32) (*core.MaxOrderEstimate, error)
Cancel(oid dex.Bytes) error
}