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 IpnsExtraConfig
- 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 = "" /* 133-byte string literal not displayed */ CreateIndexUnspentTransactionOutputsSQL = "create index index_utxos on utxos (coin);" CreateTableSpentTransactionOutputsSQL = "" /* 170-byte string literal not displayed */ CreateIndexSpentTransactionOutputsSQL = "create index index_stxos on stxos (coin);" CreateTableTransactionsSQL = "" /* 137-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 = "" /* 407-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);" CreateMessagesSQL = "" /* 253-byte string literal not displayed */ CreateIndexMessagesSQLMessageID = "create index index_messages_messageID on messages (messageID);" CreateIndexMessagesSQLOrderIDMType = "create index index_messages_orderIDmType on messages (orderID, message_type);" CreateIndexMessagesSQLPeerIDMType = "create index index_messages_peerIDmType on messages (peerID, message_type);" // Configuration defaults EthereumRegistryAddressMainnet = "0x5c69ccf91eab4ef80d9929b3c1b4d5bc03eb0981" EthereumRegistryAddressRinkeby = "0x5cEF053c7b383f430FC4F4e1ea2F7D31d8e2D16C" EthereumRegistryAddressRopsten = "0x403d907982474cdd51687b09a8968346159378f3" DataPushNodeOne = "QmWbi8z4uPkEdrWHtgxCkQGE5vxJnrStXAeEQnupmQnKRh" DataPushNodeTwo = "Qma2LRYB4xLaoxsMCL2kb93WKCW4EotUMhgvQUSqE6tCka" DataPushNodeThree = "QmZLs6zVpVtkoR8oYyAbCxujvC6weU5CgUPTYx8zKMAtTf" DataPushNodeFour = "QmNSnS2K3TkSQjxJhaRBSZxotUQp1yxLss4zKDVbhRc9nv" BootstrapNodeDefaultOne = "/ip4/54.227.172.110/tcp/5001/ipfs/QmWbi8z4uPkEdrWHtgxCkQGE5vxJnrStXAeEQnupmQnKRh" BootstrapNodeDefaultTwo = "/ip4/144.202.25.235/tcp/5001/ipfs/Qma2LRYB4xLaoxsMCL2kb93WKCW4EotUMhgvQUSqE6tCka" BootstrapNodeDefaultThree = "/ip4/54.175.193.226/tcp/5001/ipfs/QmZLs6zVpVtkoR8oYyAbCxujvC6weU5CgUPTYx8zKMAtTf" BootstrapNodeDefaultFour = "/ip4/34.239.133.237/tcp/5001/ipfs/QmNSnS2K3TkSQjxJhaRBSZxotUQp1yxLss4zKDVbhRc9nv" BootstrapNodeDefault_LeMarcheSerpette = "/ip4/159.203.115.78/tcp/5001/ipfs/QmPJuP4Myo8pGL1k56b85Q4rpaoSnmn5L3wLjYHTzbBrk1" BootstrapNodeDefault_BrixtonVillage = "/ip4/104.131.19.44/tcp/5001/ipfs/QmRvbZttqh6CPFiMKWa1jPfRR9JxagYRv4wsvMAG4ADUTj" IPFSCachingRouterDefaultURI = "https://routing.api.phore.io" // Testnet defaults DataPushNodeTestnetOne = "QmYJ42wLrkZE119DoDEd4TASuWFTEdwY9A9MpYS2okvfvJ" BootstrapNodeTestnetOne = "/ip4/3.89.75.185/tcp/5001/ipfs/QmYJ42wLrkZE119DoDEd4TASuWFTEdwY9A9MpYS2okvfvJ" )
const ( WalletTypeAPI = "API" WalletTypeSPV = "SPV" )
const ( CoinAPIOpenBazaarPHR = "https://phr.blockbook.api.phore.io/api" CoinAPIOpenBazaarBTC = "https://btc.blockbook.api.phore.io/api" CoinAPIOpenBazaarETH = "https://mainnet.infura.io" CoinAPIOpenBazaarTPHR = "https://tphr.blockbook.api.phore.io/api" CoinAPIOpenBazaarTBTC = "https://tbtc.blockbook.api.phore.io/api" CoinAPIOpenBazaarTETH = "https://rinkeby.infura.io" )
const ( CurrentSchemaVersion = "8" IdentityKeyLength = 4096 DefaultSeedPassphrase = "Secret Passphrase" )
Variables ¶
var ( DataPushNodes = []string{DataPushNodeOne, DataPushNodeTwo, DataPushNodeThree, DataPushNodeFour} BootstrapAddressesDefault = []string{ BootstrapNodeDefaultOne, BootstrapNodeDefaultTwo, BootstrapNodeDefaultThree, BootstrapNodeDefaultFour, BootstrapNodeDefault_LeMarcheSerpette, BootstrapNodeDefault_BrixtonVillage, } BootstrapAddressesTestnet = []string{ BootstrapNodeTestnetOne, } )
var ( CoinPoolPHR = []string{CoinAPIOpenBazaarPHR} CoinPoolBTC = []string{CoinAPIOpenBazaarBTC} CoinPoolETH = []string{CoinAPIOpenBazaarETH} CoinPoolTPHR = []string{CoinAPIOpenBazaarTPHR} CoinPoolTBTC = []string{CoinAPIOpenBazaarTBTC} CoinPoolTETH = []string{CoinAPIOpenBazaarTETH} )
var ( // Errors ErrorEmptyMnemonic = errors.New("mnemonic string must not be empty") )
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.13.0
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 MustDefaultConfig() *config.Config
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"` SuperLowFeeDefault uint64 `json:"SuperLowFeeDefault"` 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 IpnsExtraConfig ¶ added in v0.13.1
func GetIPNSExtraConfig ¶ added in v0.13.1
func GetIPNSExtraConfig(cfgBytes []byte) (*IpnsExtraConfig, 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 { PHR *CoinConfig `json:"PHR"` 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.13.0
func DefaultWalletsConfig() *WalletsConfig
func GetWalletsConfig ¶
func GetWalletsConfig(cfgBytes []byte) (*WalletsConfig, error)