Documentation ¶
Index ¶
- Constants
- Variables
- func CreateIdentityKey(mnemonic string) ([]byte, error)
- func EthereumDefaultOptions() map[string]interface{}
- func GenerateTempPath() string
- func GetDropboxApiToken(cfgBytes []byte) (string, error)
- func GetRepublishInterval(cfgBytes []byte) (time.Duration, error)
- func GetTestnetBootstrapAddrs(cfgBytes []byte) ([]string, error)
- func InitializeDatabaseSQL(encryptionPassword string) string
- func MustDefaultConfig() *config.Config
- func MustNewCustomSchemaManager(ctx SchemaContext) *openbazaarSchemaManager
- func NewCustomSchemaManager(ctx SchemaContext) (*openbazaarSchemaManager, error)
- func NewMnemonic() (string, error)
- func NewSchemaManager() (*openbazaarSchemaManager, error)
- func OpenbazaarPathTransform(basePath string, testModeEnabled bool) (path string, err error)
- func PragmaKey(password string) string
- type APIConfig
- type CoinConfig
- type DataSharing
- type ResolverConfig
- type SchemaContext
- type TorConfig
- type WalletsConfig
Constants ¶
const ( // SQL Statements PragmaUserVersionSQL = "pragma user_version = 0;" CreateTableConfigSQL = "create table config (key text primary key not null, value blob);" CreateTableFollowersSQL = "create table followers (peerID text primary key not null, proof blob);" CreateTableFollowingSQL = "create table following (peerID text primary key not null);" CreateTableOfflineMessagesSQL = "create table offlinemessages (url text primary key not null, timestamp integer, message blob);" CreateTablePointersSQL = "" /* 135-byte string literal not displayed */ CreateTableKeysSQL = "" /* 130-byte string literal not displayed */ CreateIndexKeysSQL = "create index index_keys on keys (coin);" CreateTableUnspentTransactionOutputsSQL = "" /* 136-byte string literal not displayed */ CreateIndexUnspentTransactionOutputsSQL = "create index index_utxos on utxos (coin);" CreateTableSpentTransactionOutputsSQL = "" /* 173-byte string literal not displayed */ CreateIndexSpentTransactionOutputsSQL = "create index index_stxos on stxos (coin);" CreateTableTransactionsSQL = "" /* 140-byte string literal not displayed */ CreateIndexTransactionsSQL = "create index index_txns on txns (coin);" CreateTableTransactionMetadataSQL = "" /* 132-byte string literal not displayed */ CreateTableInventorySQL = "create table inventory (invID text primary key not null, slug text, variantIndex integer, count integer);" CreateIndexInventorySQL = "create index index_inventory on inventory (slug);" CreateTablePurchasesSQL = "" /* 508-byte string literal not displayed */ CreateIndexPurchasesSQL = "create index index_purchases on purchases (paymentAddr, timestamp);" CreateTableSalesSQL = "" /* 426-byte string literal not displayed */ CreateIndexSalesSQL = "create index index_sales on sales (paymentAddr, timestamp);" CreatedTableWatchedScriptsSQL = "create table watchedscripts (scriptPubKey text primary key not null, coin text);" CreateIndexWatchedScriptsSQL = "create index index_watchscripts on watchedscripts (coin);" CreateTableDisputedCasesSQL = "" /* 470-byte string literal not displayed */ CreateIndexDisputedCasesSQL = "create index index_cases on cases (timestamp);" CreateTableChatSQL = "" /* 148-byte string literal not displayed */ CreateIndexChatSQL = "create index index_chat on chat (peerID, subject, read, timestamp);" CreateTableNotificationsSQL = "" /* 136-byte string literal not displayed */ CreateIndexNotificationsSQL = "create index index_notifications on notifications (read, type, timestamp);" CreateTableCouponsSQL = "create table coupons (slug text, code text, hash text);" CreateIndexCouponsSQL = "create index index_coupons on coupons (slug);" CreateTableModeratedStoresSQL = "create table moderatedstores (peerID text primary key not null);" // Configuration defaults EthereumRegistryAddressMainnet = "0x403d907982474cdd51687b09a8968346159378f3" EthereumRegistryAddressRinkeby = "0x403d907982474cdd51687b09a8968346159378f3" EthereumRegistryAddressRopsten = "0x403d907982474cdd51687b09a8968346159378f3" DataPushNodeOne = "QmY8puEnVx66uEet64gAf4VZRo7oUyMCwG6KdB9KM92EGQ" DataPushNodeTwo = "QmPPg2qeF3n2KvTRXRZLaTwHCw8JxzF4uZK93RfMoDvf2o" BootstrapNodeTestnet_BrooklynFlea = "/ip4/165.227.117.91/tcp/4001/ipfs/Qmaa6De5QYNqShzPb9SGSo8vLmoUte8mnWgzn4GYwzuUYA" BootstrapNodeTestnet_Shipshewana = "/ip4/46.101.221.165/tcp/4001/ipfs/QmVAQYg7ygAWTWegs8HSV2kdW1MqW8WMrmpqKG1PQtkgTC" BootstrapNodeDefault_LeMarcheSerpette = "/ip4/107.170.133.32/tcp/4001/ipfs/QmUZRGLhcKXF1JyuaHgKm23LvqcoMYwtb9jmh8CkP4og3K" BootstrapNodeDefault_BrixtonVillage = "/ip4/139.59.174.197/tcp/4001/ipfs/QmZfTbnpvPwxCjpCG3CXJ7pfexgkBZ2kgChAiRJrTK1HsM" BootstrapNodeDefault_Johari = "/ip4/139.59.6.222/tcp/4001/ipfs/QmRDcEDK9gSViAevCHiE6ghkaBCU7rTuQj4BDpmCzRvRYg" )
const ( WalletTypeAPI = "API" WalletTypeSPV = "SPV" )
const ( CoinAPIOpenBazaarBTC = "https://btc.api.openbazaar.org/api" CoinAPIOpenBazaarBCH = "https://bch.api.openbazaar.org/api" CoinAPIOpenBazaarLTC = "https://ltc.api.openbazaar.org/api" CoinAPIOpenBazaarZEC = "https://zec.api.openbazaar.org/api" CoinAPIOpenBazaarETH = "https://rinkeby.infura.io" CoinAPIOpenBazaarTBTC = "https://tbtc.api.openbazaar.org/api" CoinAPIOpenBazaarTBCH = "https://tbch.api.openbazaar.org/api" CoinAPIOpenBazaarTLTC = "https://tltc.api.openbazaar.org/api" CoinAPIOpenBazaarTZEC = "https://tzec.api.openbazaar.org/api" )
const ( CurrentSchemaVersion = "8" IdentityKeyLength = 4096 DefaultSeedPassphrase = "Secret Passphrase" )
Variables ¶
var ( DataPushNodes = []string{DataPushNodeOne, DataPushNodeTwo} BootstrapAddressesDefault = []string{ BootstrapNodeDefault_LeMarcheSerpette, BootstrapNodeDefault_BrixtonVillage, BootstrapNodeDefault_Johari, } BootstrapAddressesTestnet = []string{ BootstrapNodeTestnet_BrooklynFlea, BootstrapNodeTestnet_Shipshewana, } )
var ( CoinPoolBTC = []string{CoinAPIOpenBazaarBTC} CoinPoolBCH = []string{CoinAPIOpenBazaarBCH} CoinPoolLTC = []string{CoinAPIOpenBazaarLTC} CoinPoolZEC = []string{CoinAPIOpenBazaarZEC} CoinPoolETH = []string{CoinAPIOpenBazaarETH} CoinPoolTBTC = []string{CoinAPIOpenBazaarTBTC} CoinPoolTBCH = []string{CoinAPIOpenBazaarTBCH} CoinPoolTLTC = []string{CoinAPIOpenBazaarTLTC} CoinPoolTZEC = []string{CoinAPIOpenBazaarTZEC} CoinPoolTETH = []string{CoinAPIOpenBazaarETH} )
var ( // Errors ErrorEmptyMnemonic = errors.New("mnemonic string must not be empty") )
var MalformedConfigError error = errors.New("config file is malformed")
Functions ¶
func CreateIdentityKey ¶
IdentityKey will return a []byte representing a node's verifiable identity based on the provided mnemonic string. If the string is empty, it will return an error
func EthereumDefaultOptions ¶ added in v0.14.4
func EthereumDefaultOptions() map[string]interface{}
func GenerateTempPath ¶
func GenerateTempPath() string
GenerateTempPath returns a string path representing the location where it is okay to store temporary data. No structure or created or deleted as part of this operation.
func GetDropboxApiToken ¶
func InitializeDatabaseSQL ¶
InitializeDatabaseSQL returns the executable SQL string which initializes the database schema. It assumes the target is an empty SQLite3 database which supports encryption via the `PRAGMA key` statement
func MustDefaultConfig ¶
func MustNewCustomSchemaManager ¶
func MustNewCustomSchemaManager(ctx SchemaContext) *openbazaarSchemaManager
MustNewCustomSchemaManager returns a new schema manager or panics
func NewCustomSchemaManager ¶
func NewCustomSchemaManager(ctx SchemaContext) (*openbazaarSchemaManager, error)
NewCustomSchemaManger allows a custom SchemaContext to be provided
func NewMnemonic ¶
NewMnemonic will return a randomly-generated BIP-39 compliant mnemonic
func NewSchemaManager ¶
func NewSchemaManager() (*openbazaarSchemaManager, error)
NewSchemaManager returns a service that handles the data storage directory required during runtime. This service also ensures no errors can be produced at runtime after initial creation. An error may be produced if the SchemaManager is unable to verify the availability of the data storage directory.
func OpenbazaarPathTransform ¶
DefaultPathTransform accepts a string path representing the location where application data can be stored and returns a string representing the location where OpenBazaar prefers to store its schema on the filesystem relative to that path. If the path cannot be transformed, an error will be returned
Types ¶
type APIConfig ¶
type APIConfig struct { Authenticated bool AllowedIPs []string Username string Password string CORS *string Enabled bool HTTPHeaders map[string]interface{} SSL bool SSLCert string SSLKey string }
func GetAPIConfig ¶
type CoinConfig ¶
type CoinConfig struct { Type string `json:"Type"` APIPool []string `json:"API"` APITestnetPool []string `json:"APITestnet"` MaxFee uint64 `json:"MaxFee"` FeeAPI string `json:"FeeAPI"` HighFeeDefault uint64 `json:"HighFeeDefault"` MediumFeeDefault uint64 `json:"MediumFeeDefault"` LowFeeDefault uint64 `json:"LowFeeDefault"` TrustedPeer string `json:"TrustedPeer"` WalletOptions map[string]interface{} `json:"WalletOptions"` }
type DataSharing ¶
func GetDataSharing ¶
func GetDataSharing(cfgBytes []byte) (*DataSharing, error)
type ResolverConfig ¶
func GetResolverConfig ¶
func GetResolverConfig(cfgBytes []byte) (*ResolverConfig, error)
type SchemaContext ¶
type SchemaContext struct { DataPath string IdentityKey []byte Mnemonic string OS string SchemaPassword string TestModeEnabled bool }
SchemaContext are the parameters which the SchemaManager derive its source of truth. When their zero values are provided, a reasonable default will be assumed during runtime.
type TorConfig ¶
func GetTorConfig ¶
type WalletsConfig ¶
type WalletsConfig struct { BTC *CoinConfig `json:"BTC"` BCH *CoinConfig `json:"BCH"` LTC *CoinConfig `json:"LTC"` ZEC *CoinConfig `json:"ZEC"` ETH *CoinConfig `json:"ETH"` }
func DefaultWalletsConfig ¶ added in v0.14.4
func DefaultWalletsConfig() *WalletsConfig
func GetWalletsConfig ¶
func GetWalletsConfig(cfgBytes []byte) (*WalletsConfig, error)