 Documentation
      ¶
      Documentation
      ¶
    
    
  
    
  
    Index ¶
- Constants
- Variables
- func DoInit(repoRoot string, nBitsForKeypair int, testnet bool, password string, ...) error
- func GetDropboxApiToken(cfgBytes []byte) (string, error)
- func GetObjectFromIPFS(ctx commands.Context, p peer.ID, name string, maxCacheLen time.Duration) ([]byte, error)
- func GetRepoPath(isTestnet bool) (string, error)
- func GetRepublishInterval(cfgBytes []byte) (time.Duration, error)
- func GetTestnetBootstrapAddrs(cfgBytes []byte) ([]string, error)
- func InitConfig(repoRoot string) (*config.Config, error)
- func MigrateUp(repoPath, dbPassword string, testnet bool) error
- func PublishObjectToIPFS(ctx commands.Context, ipfsNode *core.IpfsNode, tempDir string, name string, ...) (string, error)
- type APIConfig
- type Case
- type CaseStore
- type ChatConversation
- type ChatMessage
- type ChatStore
- type Config
- type ConfigurationStore
- type Coupon
- type CouponStore
- type DataSharing
- type Datastore
- type Follower
- type FollowerStore
- type FollowingStore
- type GroupChatMessage
- type InventoryStore
- type KeyStore
- type Metadata
- type Migration
- type ModeratedStore
- type NotificationStore
- type OfflineMessageStore
- type PointerStore
- type Purchase
- type PurchaseStore
- type Queryable
- type ResolverConfig
- type SMTPSettings
- type Sale
- type SaleStore
- type SettingsData
- type ShippingAddress
- type SpentTransactionOutputStore
- type TorConfig
- type TransactionMetadataStore
- type TransactionStore
- type UnfundedSale
- type UnspentTransactionOutputStore
- type WalletConfig
- type WatchedScriptStore
Constants ¶
      View Source
      
  
const RepoVersion = "7"
    Variables ¶
      View Source
      
  
    var DataPushNodes = []string{
	"QmY8puEnVx66uEet64gAf4VZRo7oUyMCwG6KdB9KM92EGQ",
	"QmPPg2qeF3n2KvTRXRZLaTwHCw8JxzF4uZK93RfMoDvf2o",
}
    
      View Source
      
  
    var DefaultBootstrapAddresses = []string{
	"/ip4/107.170.133.32/tcp/4001/ipfs/QmUZRGLhcKXF1JyuaHgKm23LvqcoMYwtb9jmh8CkP4og3K",
	"/ip4/139.59.174.197/tcp/4001/ipfs/QmZfTbnpvPwxCjpCG3CXJ7pfexgkBZ2kgChAiRJrTK1HsM",
	"/ip4/139.59.6.222/tcp/4001/ipfs/QmRDcEDK9gSViAevCHiE6ghkaBCU7rTuQj4BDpmCzRvRYg",
	"/ip4/46.101.198.170/tcp/4001/ipfs/QmePWxsFT9wY3QuukgVDB7XZpqdKhrqJTHTXU7ECLDWJqX",
}
    
      View Source
      
  
    var ErrRepoExists = errors.New("IPFS configuration file exists. Reinitializing would overwrite your keys. Use -f to force overwrite.")
    
      View Source
      
  
    var MalformedConfigError error = errors.New("Config file is malformed")
    
      View Source
      
  
    var Migrations = []Migration{ migrations.Migration000{}, migrations.Migration001{}, migrations.Migration002{}, migrations.Migration003{}, migrations.Migration004{}, migrations.Migration005{}, migrations.Migration006{}, }
      View Source
      
  
var TestnetBootstrapAddresses = []string{
	"/ip4/165.227.117.91/tcp/4001/ipfs/Qmaa6De5QYNqShzPb9SGSo8vLmoUte8mnWgzn4GYwzuUYA",
	"/ip4/46.101.221.165/tcp/4001/ipfs/QmVAQYg7ygAWTWegs8HSV2kdW1MqW8WMrmpqKG1PQtkgTC",
}
    Functions ¶
func GetDropboxApiToken ¶
func GetObjectFromIPFS ¶ added in v0.12.0
func GetObjectFromIPFS(ctx commands.Context, p peer.ID, name string, maxCacheLen time.Duration) ([]byte, error)
GetObjectFromIPFS gets the requested name from ipfs or the local cache
func GetRepoPath ¶ added in v0.9.4
Returns the directory to store repo data in.
It depends on the OS and whether or not we are on testnet.
func GetRepublishInterval ¶ added in v0.9.3
func GetTestnetBootstrapAddrs ¶ added in v0.9.2
Types ¶
type APIConfig ¶ added in v0.2.0
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 ¶ added in v0.2.0
type Case ¶ added in v0.5.1
type Case struct {
	CaseId             string    `json:"caseId"`
	Slug               string    `json:"slug"`
	Timestamp          time.Time `json:"timestamp"`
	Title              string    `json:"title"`
	Thumbnail          string    `json:"thumbnail"`
	Total              uint64    `json:"total"`
	BuyerId            string    `json:"buyerId"`
	BuyerHandle        string    `json:"buyerHandle"`
	VendorId           string    `json:"vendorId"`
	VendorHandle       string    `json:"vendorHandle"`
	BuyerOpened        bool      `json:"buyerOpened"`
	State              string    `json:"state"`
	Read               bool      `json:"read"`
	UnreadChatMessages int       `json:"unreadChatMessages"`
}
    type CaseStore ¶ added in v0.11.1
type CaseStore interface {
	Queryable
	// Save a new case
	Put(caseID string, state pb.OrderState, buyerOpened bool, claim string) error
	// Update a case with the buyer info
	UpdateBuyerInfo(caseID string, buyerContract *pb.RicardianContract, buyerValidationErrors []string, buyerPayoutAddress string, buyerOutpoints []*pb.Outpoint) error
	// Update a case with the vendor info
	UpdateVendorInfo(caseID string, vendorContract *pb.RicardianContract, vendorValidationErrors []string, vendorPayoutAddress string, vendorOutpoints []*pb.Outpoint) error
	// Mark a case as read in the database
	MarkAsRead(caseID string) error
	// Mark a case as unread in the database
	MarkAsUnread(caseID string) error
	// Mark a case as closed in the database
	MarkAsClosed(caseID string, resolution *pb.DisputeResolution) error
	// Delete a case
	Delete(caseID string) error
	// Return the case metadata given a case ID
	GetCaseMetadata(caseID string) (buyerContract, vendorContract *pb.RicardianContract, buyerValidationErrors, vendorValidationErrors []string, state pb.OrderState, read bool, timestamp time.Time, buyerOpened bool, claim string, resolution *pb.DisputeResolution, err error)
	// Return the dispute payout data for a case
	GetPayoutDetails(caseID string) (buyerContract, vendorContract *pb.RicardianContract, buyerPayoutAddress, vendorPayoutAddress string, buyerOutpoints, vendorOutpoints []*pb.Outpoint, state pb.OrderState, err error)
	// Return the metadata for all cases given the search terms. Also returns the original size of the query.
	GetAll(stateFilter []pb.OrderState, searchTerm string, sortByAscending bool, sortByRead bool, limit int, exclude []string) ([]Case, int, error)
	// Return the number of cases in the database
	Count() int
}
    type ChatConversation ¶ added in v0.3.1
type ChatMessage ¶ added in v0.3.1
type ChatStore ¶ added in v0.11.1
type ChatStore interface {
	Queryable
	// Put a new chat message to the database
	Put(messageId string, peerId string, subject string, message string, timestamp time.Time, read bool, outgoing bool) error
	// Returns a list of open conversations
	GetConversations() []ChatConversation
	// A list of messages given a peer ID and a subject
	GetMessages(peerID string, subject string, offsetID string, limit int) []ChatMessage
	// Mark all chat messages for a peer as read. Returns the Id of the last seen message and
	// whether any messages were updated.
	// If message Id is specified it will only mark that message and earlier as read.
	MarkAsRead(peerID string, subject string, outgoing bool, messageId string) (string, bool, error)
	// Returns the incoming unread count for all messages of a given subject
	GetUnreadCount(subject string) (int, error)
	// Delete a message
	DeleteMessage(msgID string) error
	// Delete all messages from from a peer
	DeleteConversation(peerID string) error
}
    type Config ¶
type Config interface {
	/* Initialize the database with the node's mnemonic seed and
	   identity key. This will be called during repo init. */
	Init(mnemonic string, identityKey []byte, password string, creationDate time.Time) error
	// Return the mnemonic string
	GetMnemonic() (string, error)
	// Return the identity key
	GetIdentityKey() ([]byte, error)
	// Returns the date the seed was created
	GetCreationDate() (time.Time, error)
	// Returns true if the database has failed to decrypt properly ex) wrong pw
	IsEncrypted() bool
}
    type ConfigurationStore ¶ added in v0.11.1
type ConfigurationStore interface {
	Queryable
	// Put settings to the database, overriding all fields
	Put(settings SettingsData) error
	// Update all non-nil fields
	Update(settings SettingsData) error
	// Return the settings object
	Get() (SettingsData, error)
	// Delete all settings data
	Delete() error
}
    type CouponStore ¶ added in v0.11.1
type DataSharing ¶ added in v0.9.3
func GetDataSharing ¶ added in v0.9.3
func GetDataSharing(cfgBytes []byte) (*DataSharing, error)
type Datastore ¶
type Datastore interface {
	Config() Config
	Followers() FollowerStore
	Following() FollowingStore
	OfflineMessages() OfflineMessageStore
	Pointers() PointerStore
	Settings() ConfigurationStore
	Inventory() InventoryStore
	Purchases() PurchaseStore
	Sales() SaleStore
	Cases() CaseStore
	Chat() ChatStore
	Notifications() NotificationStore
	Coupons() CouponStore
	TxMetadata() TransactionMetadataStore
	ModeratedStores() ModeratedStore
	Ping() error
	Close()
}
    type FollowerStore ¶ added in v0.11.1
type FollowerStore interface {
	Queryable
	// Put a B58 encoded follower ID and proof to the database
	Put(follower string, proof []byte) error
	/* Get followers from the database.
	   The offset and limit arguments can be used to for lazy loading. */
	Get(offsetId string, limit int) ([]Follower, error)
	// Delete a follower from the database
	Delete(follower string) error
	// Return the number of followers in the database
	Count() int
	// Are we followed by this peer?
	FollowsMe(peerId string) bool
}
    type FollowingStore ¶ added in v0.11.1
type FollowingStore interface {
	Queryable
	// Put a B58 encoded peer ID to the database
	Put(peer string) error
	/* Get a list of following peers from the database.
	   The offset and limit arguments can be used to for lazy loading. */
	Get(offsetId string, limit int) ([]string, error)
	// Delete a peer from the database
	Delete(peer string) error
	// Return the number of peers in the database
	Count() int
	// Am I following this peer?
	IsFollowing(peerId string) bool
}
    type GroupChatMessage ¶ added in v0.6.0
type InventoryStore ¶ added in v0.11.1
type InventoryStore interface {
	Queryable
	/* Put an inventory count for a listing
	   Override the existing count if it exists */
	Put(slug string, variantIndex int, count int64) error
	// Return the count for a specific listing including variants
	GetSpecific(slug string, variantIndex int) (int64, error)
	// Get the count for all variants of a given listing
	Get(slug string) (map[int]int64, error)
	// Fetch all inventory maps for each slug
	GetAll() (map[string]map[int]int64, error)
	// Delete a listing and related count
	Delete(slug string, variant int) error
	// Delete all variants of a given slug
	DeleteAll(slug string) error
}
    type ModeratedStore ¶ added in v0.11.1
type ModeratedStore interface {
	Queryable
	// Put a B58 encoded peer ID to the database
	Put(peerId string) error
	/* Get the moderated store list from the database.
	   The offset and limit arguments can be used to for lazy loading. */
	Get(offsetId string, limit int) ([]string, error)
	// Delete a moderated store from the database
	Delete(peerId string) error
}
    type NotificationStore ¶ added in v0.11.1
type NotificationStore interface {
	Queryable
	// Put a new notification to the database
	Put(notifID string, notification notif.Data, notifType string, timestamp time.Time) error
	// Mark notification as read
	MarkAsRead(notifID string) error
	// Mark all notifications as read
	MarkAllAsRead() error
	// Fetch notifications from database
	GetAll(offsetID string, limit int, typeFilter []string) ([]notif.Notification, int, error)
	// Returns the unread count for all notifications
	GetUnreadCount() (int, error)
	// Delete a notification
	Delete(notifID string) error
}
    type OfflineMessageStore ¶ added in v0.11.1
type OfflineMessageStore interface {
	Queryable
	// Put a URL from a retrieved message
	Put(url string) error
	// Does the given URL exist in the database?
	Has(url string) bool
	// Save a message with the url
	SetMessage(url string, message []byte) error
	// Get all entries with a message
	GetMessages() (map[string][]byte, error)
	// Delete the given message
	DeleteMessage(url string) error
}
    type PointerStore ¶ added in v0.11.1
type PointerStore interface {
	Queryable
	// Put a pointer to the database
	Put(p ipfs.Pointer) error
	// Delete a pointer from the database
	Delete(id peer.ID) error
	// Delete all pointers of a given purpose
	DeleteAll(purpose ipfs.Purpose) error
	// Fetch a specific pointer
	Get(id peer.ID) (ipfs.Pointer, error)
	// Fetch all pointers of the given type
	GetByPurpose(purpose ipfs.Purpose) ([]ipfs.Pointer, error)
	// Fetch the entire list of pointers
	GetAll() ([]ipfs.Pointer, error)
}
    type Purchase ¶ added in v0.5.1
type Purchase struct {
	OrderId            string    `json:"orderId"`
	Slug               string    `json:"slug"`
	Timestamp          time.Time `json:"timestamp"`
	Title              string    `json:"title"`
	Thumbnail          string    `json:"thumbnail"`
	Total              uint64    `json:"total"`
	VendorId           string    `json:"vendorId"`
	VendorHandle       string    `json:"vendorHandle"`
	ShippingName       string    `json:"shippingName"`
	ShippingAddress    string    `json:"shippingAddress"`
	State              string    `json:"state"`
	Read               bool      `json:"read"`
	Moderated          bool      `json:"moderated"`
	UnreadChatMessages int       `json:"unreadChatMessages"`
}
    type PurchaseStore ¶ added in v0.11.1
type PurchaseStore interface {
	Queryable
	// Save or update an order
	Put(orderID string, contract pb.RicardianContract, state pb.OrderState, read bool) error
	// Mark an order as read in the database
	MarkAsRead(orderID string) error
	// Mark an order as unread in the database
	MarkAsUnread(orderID string) error
	// Update the funding level for the contract
	UpdateFunding(orderId string, funded bool, records []*wallet.TransactionRecord) error
	// Delete an order
	Delete(orderID string) error
	// Return a purchase given the payment address
	GetByPaymentAddress(addr btc.Address) (contract *pb.RicardianContract, state pb.OrderState, funded bool, records []*wallet.TransactionRecord, err error)
	// Return a purchase given the order ID
	GetByOrderId(orderId string) (contract *pb.RicardianContract, state pb.OrderState, funded bool, records []*wallet.TransactionRecord, read bool, err error)
	// Return the metadata for all purchases. Also returns the original size of the query.
	GetAll(stateFilter []pb.OrderState, searchTerm string, sortByAscending bool, sortByRead bool, limit int, exclude []string) ([]Purchase, int, error)
	// Return the number of purchases in the database
	Count() int
}
    type ResolverConfig ¶ added in v0.9.2
func GetResolverConfig ¶ added in v0.9.2
func GetResolverConfig(cfgBytes []byte) (*ResolverConfig, error)
type SMTPSettings ¶
type Sale ¶ added in v0.5.1
type Sale struct {
	OrderId            string    `json:"orderId"`
	Slug               string    `json:"slug"`
	Timestamp          time.Time `json:"timestamp"`
	Title              string    `json:"title"`
	Thumbnail          string    `json:"thumbnail"`
	Total              uint64    `json:"total"`
	BuyerId            string    `json:"buyerId"`
	BuyerHandle        string    `json:"buyerHandle"`
	ShippingName       string    `json:"shippingName"`
	ShippingAddress    string    `json:"shippingAddress"`
	State              string    `json:"state"`
	Read               bool      `json:"read"`
	Moderated          bool      `json:"moderated"`
	UnreadChatMessages int       `json:"unreadChatMessages"`
}
    type SaleStore ¶ added in v0.11.1
type SaleStore interface {
	Queryable
	// Save or update a sale
	Put(orderID string, contract pb.RicardianContract, state pb.OrderState, read bool) error
	// Mark an order as read in the database
	MarkAsRead(orderID string) error
	// Mark an order as unread in the database
	MarkAsUnread(orderID string) error
	// Update the funding level for the contract
	UpdateFunding(orderId string, funded bool, records []*wallet.TransactionRecord) error
	// Delete an order
	Delete(orderID string) error
	// Return a sale given the payment address
	GetByPaymentAddress(addr btc.Address) (contract *pb.RicardianContract, state pb.OrderState, funded bool, records []*wallet.TransactionRecord, err error)
	// Return a sale given the order ID
	GetByOrderId(orderId string) (contract *pb.RicardianContract, state pb.OrderState, funded bool, records []*wallet.TransactionRecord, read bool, err error)
	// Return the metadata for all sales. Also returns the original size of the query.
	GetAll(stateFilter []pb.OrderState, searchTerm string, sortByAscending bool, sortByRead bool, limit int, exclude []string) ([]Sale, int, error)
	// Return unfunded orders which failed to detect funding because the chain was synced passed the block containing the transaction when the order was recorded.
	GetNeedsResync() ([]UnfundedSale, error)
	// Set whether the given order needs a blockchain resync
	SetNeedsResync(orderID string, needsResync bool) error
	// Return the number of sales in the database
	Count() int
}
    type SettingsData ¶
type SettingsData struct {
	PaymentDataInQR    *bool              `json:"paymentDataInQR"`
	ShowNotifications  *bool              `json:"showNotifications"`
	ShowNsfw           *bool              `json:"showNsfw"`
	ShippingAddresses  *[]ShippingAddress `json:"shippingAddresses"`
	LocalCurrency      *string            `json:"localCurrency"`
	Country            *string            `json:"country"`
	TermsAndConditions *string            `json:"termsAndConditions"`
	RefundPolicy       *string            `json:"refundPolicy"`
	BlockedNodes       *[]string          `json:"blockedNodes"`
	StoreModerators    *[]string          `json:"storeModerators"`
	MisPaymentBuffer   *float32           `json:"mispaymentBuffer"`
	SMTPSettings       *SMTPSettings      `json:"smtpSettings"`
	Version            *string            `json:"version"`
}
    type ShippingAddress ¶
type ShippingAddress struct {
	Name           string `json:"name"`
	Company        string `json:"company"`
	AddressLineOne string `json:"addressLineOne"`
	AddressLineTwo string `json:"addressLineTwo"`
	City           string `json:"city"`
	State          string `json:"state"`
	Country        string `json:"country"`
	PostalCode     string `json:"postalCode"`
	AddressNotes   string `json:"addressNotes"`
}
    type SpentTransactionOutputStore ¶ added in v0.11.1
type SpentTransactionOutputStore interface {
	Queryable
	wallet.Stxos
}
    type TorConfig ¶ added in v0.5.0
func GetTorConfig ¶ added in v0.5.0
type TransactionMetadataStore ¶ added in v0.11.1
type TransactionMetadataStore interface {
	Queryable
	// Put metadata for a transaction to the db
	Put(m Metadata) error
	// Get the metadata given the txid
	Get(txid string) (Metadata, error)
	// Get a map of the txid to each metadata object
	GetAll() (map[string]Metadata, error)
	// Delete a metadata entry
	Delete(txid string) error
}
    type TransactionStore ¶ added in v0.11.1
type TransactionStore interface {
	Queryable
	wallet.Txns
}
    type UnfundedSale ¶ added in v0.9.4
type UnspentTransactionOutputStore ¶ added in v0.11.1
type UnspentTransactionOutputStore interface {
	Queryable
	wallet.Utxos
}
    type WalletConfig ¶ added in v0.2.0
type WalletConfig struct {
	Type             string
	Binary           string
	MaxFee           int
	FeeAPI           string
	HighFeeDefault   int
	MediumFeeDefault int
	LowFeeDefault    int
	TrustedPeer      string
}
    func GetWalletConfig ¶ added in v0.2.0
func GetWalletConfig(cfgBytes []byte) (*WalletConfig, error)
type WatchedScriptStore ¶ added in v0.11.1
type WatchedScriptStore interface {
	Queryable
	wallet.WatchedScripts
}
    
       Source Files
      ¶
      Source Files
      ¶
    
   Click to show internal directories. 
   Click to hide internal directories.