dexc

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: ISC Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CustomDexWalletType is a keyword that identifies a custom Cryptopower
	// wallet used by the DEX client.
	CustomDexWalletType = "cryptopowerwallet"
	// WalletIDConfigKey is the key that holds the wallet ID value in the
	// settings map used to connect an existing Cryptopower wallet to the DEX
	// client.
	WalletIDConfigKey = "walletid"
	// WalletAccountNumberConfigKey is the key that holds the wallet account
	// number in the settings map used to connect an existing Cryptopower wallet
	// to the DEX client.
	WalletAccountNumberConfigKey = "accountnumber"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DEXClient

type DEXClient struct {
	*core.Core
	// contains filtered or unexported fields
}

DEXClient represents the Decred DEX client and embeds *core.Core.

func Start

func Start(ctx context.Context, root, lang, logDir, logLvl string, net libutils.NetworkType, maxLogZips int) (*DEXClient, error)

Start prepares and starts the DEX client.

NOTE: "lang" will be changed to the default language (en) if the the DEX client does not have support for it.

func (*DEXClient) AddWallet

func (dc *DEXClient) AddWallet(assetID uint32, settings map[string]string, appPW, walletPW []byte) error

AddWallet attempts to connect or create the wallet with the provided details to the DEX client. NOTE: Before connecting a dcr wallet, dcr ExchangeWallet must have been configured to use a custom wallet. See: libwallet.AssetManager.PrepareDexSupportForDcrWallet() and libwallet.AssetManager.prepareDexSupportForBTCCloneWallets.

func (*DEXClient) BondsFeeBuffer

func (dc *DEXClient) BondsFeeBuffer(assetID uint32) uint64

BondsFeeBuffer is a caching helper for the bonds fee buffer to assist the frontend by stabilizing this value for up to 45 minutes from the last request for a given asset and because (*Core).BondsFeeBuffer returns a fresh fee buffer based on a current (but padded) fee rate estimate. Values for a given asset are cached for 45 minutes. These values are meant to provide a sensible but well-padded fee buffer for bond transactions now and well into the future, so a long expiry is appropriate.

func (*DEXClient) DBPath

func (dc *DEXClient) DBPath() string

func (*DEXClient) HasWallet

func (dc *DEXClient) HasWallet(assetID int32) bool

HasWallet is true if a wallet has been added to the DEX client for the specified asset.

func (*DEXClient) InitWithPassword

func (dc *DEXClient) InitWithPassword(pw []byte, seed []byte) error

func (*DEXClient) InitializedWithPassword

func (dc *DEXClient) InitializedWithPassword() bool

func (*DEXClient) IsInitialized

func (dc *DEXClient) IsInitialized() bool

func (*DEXClient) IsLoggedIn

func (dc *DEXClient) IsLoggedIn() bool

func (*DEXClient) Login

func (dc *DEXClient) Login(pw []byte) error

func (*DEXClient) Shutdown

func (dc *DEXClient) Shutdown()

func (*DEXClient) WaitForShutdown

func (dc *DEXClient) WaitForShutdown() <-chan struct{}

WaitForShutdown returns a chan that will be closed if core exits.

func (*DEXClient) WalletIDForAsset

func (dc *DEXClient) WalletIDForAsset(assetID uint32) (*int, error)

WalletIDForAsset returns the wallet ID for the provided assetID. It'll return nil, nil if the asset does not exist in the dex client.

Jump to

Keyboard shortcuts

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