Documentation ¶
Index ¶
- Constants
- func BipIDSymbol(id uint32) string
- func BipSymbolID(symbol string) (uint32, bool)
- func LockTimeMaker(network Network) time.Duration
- func LockTimeTaker(network Network) time.Duration
- func MarketName(base, quote uint32) (string, error)
- type Asset
- type Error
- type ErrorKind
- type MarketInfo
- type Network
Constants ¶
const Simnet = Regtest
The DEX recognizes only three networks. Simnet is an alias of Regtest.
const (
UnsupportedScriptError = ErrorKind("unsupported script type")
)
Variables ¶
This section is empty.
Functions ¶
func BipIDSymbol ¶
BipIDSymbol returns the BIP ID for a given symbol.
func BipSymbolID ¶
BipSymbolID returns the asset ID associated with a given ticker symbol. While there are a number of duplicate ticker symbols in the BIP ID list (cpc, cmt, xrd, dst, one, ask, ...), those are disambiguated in the bipIDs map here, so must be referenced with their bracketed suffix.
func LockTimeMaker ¶
LockTimeMaker returns the maker locktime value that should be used by both client and server for the specified network. Mainnet uses a constant value while test networks support setting a custom value during build.
func LockTimeTaker ¶
LockTimeTaker returns the taker locktime value that should be used by both client and server for the specified network. Mainnet uses a constant value while test networks support setting a custom value during build.
func MarketName ¶
MarketName creates the string representation of a DEX market (e.g. "dcr_btc") given the base and quote asset indexes defined in BIP-0044. See also BipIDSymbol.
Types ¶
type Asset ¶
type Asset struct { ID uint32 `json:"id"` Symbol string `json:"symbol"` LotSize uint64 `json:"lotSize"` RateStep uint64 `json:"rateStep"` MaxFeeRate uint64 `json:"maxFeeRate"` SwapSize uint64 `json:"swapSize"` SwapSizeBase uint64 `json:"swapSizeBase"` SwapConf uint32 `json:"swapConf"` }
Asset is the configurable asset variables.
type Error ¶
type Error struct {
// contains filtered or unexported fields
}
Error pairs an error with details.
func NewError ¶
NewError wraps the provided Error with details in a Error, facilitating the use of errors.Is and errors.As via errors.Unwrap.
type ErrorKind ¶
type ErrorKind string
ErrorKind identifies a kind of error that can be used to define new errors via const SomeError = dex.ErrorKind("something").
type MarketInfo ¶
type MarketInfo struct { Name string Base uint32 Quote uint32 LotSize uint64 EpochDuration uint64 // msec MarketBuyBuffer float64 MaxUserCancelsPerEpoch uint32 BookedLotLimit uint32 }
MarketInfo specifies a market that the Archiver must support.
func NewMarketInfo ¶
func NewMarketInfo(base, quote uint32, lotSize, epochDuration uint64, marketBuyBuffer float64) (*MarketInfo, error)
NewMarketInfo creates a new market configuration (MarketInfo) from the given base and quote asset indexes, order lot size, and epoch duration in milliseconds. See also MarketName.
type Network ¶
type Network uint8
Network flags passed to asset backends to signify which network to use.
func NetFromString ¶
NetFromString returns the Network for the given network name.