Version: 0.12.4


import ""




const (
    // RatingMin - min raring
    RatingMin = 1
    // RatingMax - max rating
    RatingMax = 5
    // ReviewMaxCharacters - max size for review
    ReviewMaxCharacters = 3000
const (
    // ListingVersion - current listing version
    ListingVersion = 4
    // TitleMaxCharacters - max size for title
    TitleMaxCharacters = 140
    // ShortDescriptionLength - min length for description
    ShortDescriptionLength = 160
    // DescriptionMaxCharacters - max length for description
    DescriptionMaxCharacters = 50000
    // MaxTags - max permitted tags
    MaxTags = 10
    // MaxCategories - max permitted categories
    MaxCategories = 10
    // MaxListItems - max items in a listing
    MaxListItems = 30
    // FilenameMaxCharacters - max filename size
    FilenameMaxCharacters = 255
    // CodeMaxCharacters - max chars for a code
    CodeMaxCharacters = 20
    // WordMaxCharacters - max chars for word
    WordMaxCharacters = 40
    // SentenceMaxCharacters - max chars for sentence
    SentenceMaxCharacters = 70
    // CouponTitleMaxCharacters - max length of a coupon title
    CouponTitleMaxCharacters = 70
    // PolicyMaxCharacters - max length for policy
    PolicyMaxCharacters = 10000
    // AboutMaxCharacters - max length for about
    AboutMaxCharacters = 10000
    // URLMaxCharacters - max length for URL
    URLMaxCharacters = 2000
    // MaxCountryCodes - max country codes
    MaxCountryCodes = 255
    // EscrowTimeout - escrow timeout in hours
    EscrowTimeout = 1080
    // SlugBuffer - buffer size for slug
    SlugBuffer = 5
    // PriceModifierMin - min price modifier
    PriceModifierMin = -99.99
    // PriceModifierMax = max price modifier
    PriceModifierMax = 1000.00

    // DefaultCoinDivisibility - decimals for price
    DefaultCoinDivisibility uint32 = 1e8
const (
    // ChatMessageMaxCharacters - limit for chat msg
    ChatMessageMaxCharacters = 20000
    // ChatSubjectMaxCharacters - limit for chat subject
    ChatSubjectMaxCharacters = 500
    // DefaultPointerPrefixLength - default ipfs pointer prefix
    DefaultPointerPrefixLength = 14
const (

    // EscrowReleaseSize - size in bytes for escrow op
    EscrowReleaseSize = 337
    // CryptocurrencyPurchasePaymentAddressMaxLength - max permissible length for an address
    CryptocurrencyPurchasePaymentAddressMaxLength = 512
const (
    PostTitleMaxCharacters    = 280
    PostLongFormMaxCharacters = 50000
    MaxPostTags               = 50
    PostTagsMaxCharacters     = 80

Constants for validation

const ConfirmationsPerHour = 6

ConfirmationsPerHour is temporary until the Wallet interface has Attributes() to provide this value

const KeyCachePrefix = "/pubkey/"

KeyCachePrefix - cache prefix for public key


var (
    // EscrowTimeLockedError - custom err for time locked escrow
    EscrowTimeLockedError error
    // ErrPrematureReleaseOfTimedoutEscrowFunds - custom err for premature escrow funds release
    ErrPrematureReleaseOfTimedoutEscrowFunds = fmt.Errorf("escrow can only be released when in dispute for %s days", (time.Duration(repo.DisputeTotalDurationHours) * time.Hour).String())
var (
    // VERSION - current version
    VERSION = "0.12.4"
    // USERAGENT - user-agent header string
    USERAGENT = "/openbazaar-go:" + VERSION + "/"
var (
    // ErrPurchaseUnknownListing - unavailable listing err
    ErrPurchaseUnknownListing = errors.New("order contains a hash of a listing that is not currently for sale")

    // ErrListingDoesNotExist - non-existent listing err
    ErrListingDoesNotExist = errors.New("listing doesn't exist")
    // ErrListingAlreadyExists - duplicate listing err
    ErrListingAlreadyExists = errors.New("listing already exists")
    // ErrListingCoinDivisibilityIncorrect - coin divisibility err
    ErrListingCoinDivisibilityIncorrect = errors.New("incorrect coinDivisibility")
    // ErrPriceCalculationRequiresExchangeRates - exchange rates dependency err
    ErrPriceCalculationRequiresExchangeRates = errors.New("can't calculate price with exchange rates disabled")

    // ErrCryptocurrencyListingCoinTypeRequired - missing coinType err
    ErrCryptocurrencyListingCoinTypeRequired = errors.New("cryptocurrency listings require a coinType")
    // ErrCryptocurrencyPurchasePaymentAddressRequired - missing payment address err
    ErrCryptocurrencyPurchasePaymentAddressRequired = errors.New("paymentAddress required for cryptocurrency items")
    // ErrCryptocurrencyPurchasePaymentAddressTooLong - invalid payment address
    ErrCryptocurrencyPurchasePaymentAddressTooLong = errors.New("paymentAddress required is too long")

    // ErrCryptocurrencySkuQuantityInvalid - invalid sku qty err
    ErrCryptocurrencySkuQuantityInvalid = errors.New("cryptocurrency listing quantity must be a non-negative integer")

    // ErrFulfillIncorrectDeliveryType - incorrect delivery type err
    ErrFulfillIncorrectDeliveryType = errors.New("incorrect delivery type for order")
    // ErrFulfillCryptocurrencyTXIDNotFound - missing txn id err
    ErrFulfillCryptocurrencyTXIDNotFound = errors.New("a transactionID is required to fulfill crypto listings")
    // ErrFulfillCryptocurrencyTXIDTooLong - invalid txn id err
    ErrFulfillCryptocurrencyTXIDTooLong = errors.New("transactionID should be no longer than " + strconv.Itoa(MaxTXIDSize))
var DisputeWg = new(sync.WaitGroup)

DisputeWg - waitgroup for disputes

var ErrCaseNotFound = errors.New("case not found")

ErrCaseNotFound - case not found err

var ErrCloseFailureCaseExpired = errors.New("unable to close expired case")

ErrCloseFailureCaseExpired - tried closing expired case err

var ErrCloseFailureNoOutpoints = errors.New("unable to close case with missing outpoints")

ErrCloseFailureNoOutpoints indicates when a dispute cannot be closed due to neither party including outpoints with their dispute

var (

    // ErrInventoryNotFoundForSlug - inventory not found error
    ErrInventoryNotFoundForSlug = errors.New("Could not find slug in inventory")
var ErrNoListings = errors.New("no listings to set moderators on")

ErrNoListings - no listing error FIXME : This is not used anywhere

var ErrOpenFailureOrderExpired = errors.New("unable to open case beacuse order is too old to dispute")

ErrOpenFailureOrderExpired - tried disputing expired order err

var ErrorProfileNotFound = errors.New("profile not found")

ErrorProfileNotFound - profile not found error

var InitalPublishComplete bool // = false

InitalPublishComplete - indicate publish completion

var (
    // MaxTXIDSize - max length for order txnID
    MaxTXIDSize = 512
var ModeratorPointerID multihash.Multihash

ModeratorPointerID moderator ipfs multihash

var OfflineMessageWaitGroup sync.WaitGroup

OfflineMessageWaitGroup - used for offline msgs

var PublishLock sync.Mutex

PublishLock seedLock - Unpin the current node repo, re-add it, then publish to IPNS

func CheckAndSetUlimit

func CheckAndSetUlimit() error

CheckAndSetUlimit raises the file descriptor limit

func EncodeCID

func EncodeCID(b []byte) (*cid.Cid, error)

EncodeCID - Hash with SHA-256 and encode as a multihash

func EncodeMultihash

func EncodeMultihash(b []byte) (*mh.Multihash, error)

EncodeMultihash - sha256 encode

func ExtractIDFromPointer

func ExtractIDFromPointer(pi ps.PeerInfo) (string, error)

ExtractIDFromPointer Certain pointers, such as moderators, contain a peerID. This function will extract the ID from the underlying PeerInfo object.

func FormatRFC3339PB

func FormatRFC3339PB(ts google_protobuf.Timestamp) string

FormatRFC3339PB returns the given google_protobuf.Timestamp as a RFC3339 formatted string

func GetOrderQuantity

func GetOrderQuantity(l *pb.Listing, item *pb.Order_Item) uint64

GetOrderQuantity - return the specified item quantity

func GetSelectedSku

func GetSelectedSku(listing *pb.Listing, itemOptions []*pb.Order_Item_Option) (int, error)

GetSelectedSku - return the specified item SKU

func NormalizeCurrencyCode

func NormalizeCurrencyCode(currencyCode string) string

NormalizeCurrencyCode standardizes the format for the given currency code

func ParseContractForListing

func ParseContractForListing(hash string, contract *pb.RicardianContract) (*pb.Listing, error)

ParseContractForListing - return the listing identified by the hash from the contract

func SameSku

func SameSku(selectedVariants []int, sku *pb.Listing_Item_Sku) bool

SameSku - check if the variants have the same SKU

func ValidateProfile

func ValidateProfile(profile *pb.Profile) error

ValidateProfile - validate fetched profile

func ValidateRating

func ValidateRating(rating *pb.Rating) (bool, error)

ValidateRating - validates rating for API GET and Post/Update

type CodedError

type CodedError struct {
    Reason string `json:"reason,omitempty"`
    Code   string `json:"code,omitempty"`

CodedError is an error that is machine readable

func (CodedError) Error

func (err CodedError) Error() string

type ErrCryptocurrencyListingIllegalField

type ErrCryptocurrencyListingIllegalField string

ErrCryptocurrencyListingIllegalField - invalid field err

func (ErrCryptocurrencyListingIllegalField) Error

func (e ErrCryptocurrencyListingIllegalField) Error() string

type ErrCryptocurrencyPurchaseIllegalField

type ErrCryptocurrencyPurchaseIllegalField string

ErrCryptocurrencyPurchaseIllegalField - invalid purchase field err

func (ErrCryptocurrencyPurchaseIllegalField) Error

func (e ErrCryptocurrencyPurchaseIllegalField) Error() string

type ErrMarketPriceListingIllegalField

type ErrMarketPriceListingIllegalField string

ErrMarketPriceListingIllegalField - invalid listing field err

func (ErrMarketPriceListingIllegalField) Error

func (e ErrMarketPriceListingIllegalField) Error() string

type ErrOutOfInventory

type ErrOutOfInventory struct {
    RemainingInventory int64 `json:"remainingInventory"`

ErrOutOfInventory is a codedError returned from vendor nodes when buyers try purchasing too many of an item

func NewErrOutOfInventory

func NewErrOutOfInventory(inventoryRemaining int64) ErrOutOfInventory

NewErrOutOfInventory - return out of inventory err with available inventory

func (ErrOutOfInventory) Error

func (err ErrOutOfInventory) Error() string

type ErrPriceModifierOutOfRange

type ErrPriceModifierOutOfRange struct {
    Min float64
    Max float64

ErrPriceModifierOutOfRange - customize limits for price modifier

func (ErrPriceModifierOutOfRange) Error

func (e ErrPriceModifierOutOfRange) Error() string

type Inventory

type Inventory map[string]*InventoryListing

Inventory is the complete inventory representation stored on IPFS It maps slug -> quantity information

type InventoryListing

type InventoryListing struct {
    Inventory   int64  `json:"inventory"`
    LastUpdated string `json:"lastUpdated"`

InventoryListing is the listing representation stored on IPFS

type ListingData

type ListingData struct {
    Hash               string    `json:"hash"`
    Slug               string    `json:"slug"`
    Title              string    `json:"title"`
    Categories         []string  `json:"categories"`
    NSFW               bool      `json:"nsfw"`
    ContractType       string    `json:"contractType"`
    Description        string    `json:"description"`
    Thumbnail          thumbnail `json:"thumbnail"`
    Price              price     `json:"price"`
    ShipsTo            []string  `json:"shipsTo"`
    FreeShipping       []string  `json:"freeShipping"`
    Language           string    `json:"language"`
    AverageRating      float32   `json:"averageRating"`
    RatingCount        uint32    `json:"ratingCount"`
    ModeratorIDs       []string  `json:"moderators"`
    AcceptedCurrencies []string  `json:"acceptedCurrencies"`
    CoinType           string    `json:"coinType"`

ListingData - represent a listing

type OpenBazaarNode

type OpenBazaarNode struct {
    // IPFS node object
    IpfsNode *core.IpfsNode

    /* The roothash of the node directory inside the openbazaar repo.
       This directory hash is published on IPNS at our peer ID making
       the directory publicly viewable on the network. */
    RootHash string

    // The path to the openbazaar repo in the file system
    RepoPath string

    // The OpenBazaar network service for direct communication between peers
    Service net.NetworkService

    // Database for storing node specific data
    Datastore repo.Datastore

    // Websocket channel used for pushing data to the UI
    Broadcast chan repo.Notifier

    // Bitcoin wallet implementation
    Wallet wallet.Wallet

    // Storage for our outgoing messages
    MessageStorage sto.OfflineMessagingStorage

    // A service that periodically checks the dht for outstanding messages
    MessageRetriever *ret.MessageRetriever

    // A service that periodically republishes active pointers
    PointerRepublisher *rep.PointerRepublisher

    // Used to resolve domains to OpenBazaar IDs
    NameSystem *namesys.NameSystem

    // A service that periodically fetches and caches the bitcoin exchange rates
    ExchangeRates wallet.ExchangeRates

    // Optional nodes to push user data to
    PushNodes []peer.ID

    // The user-agent for this node
    UserAgent string

    // A dialer for Tor if available
    TorDialer proxy.Dialer

    // Manage blocked peers
    BanManager *net.BanManager

    // Allow other nodes to push data to this node for storage
    AcceptStoreRequests bool

    // Last ditch API to find records that dropped out of the DHT
    IPNSBackupAPI string

    // RecordAgingNotifier is a worker that walks the cases datastore to
    // notify the user as disputes age past certain thresholds
    RecordAgingNotifier *recordAgingNotifier

    // Generic pubsub interface
    Pubsub ipfs.Pubsub

    TestnetEnable        bool
    RegressionTestEnable bool

OpenBazaarNode - represent ob node which encapsulates ipfsnode, wallet etc

var Node *OpenBazaarNode

Node - ob node

func (*OpenBazaarNode) BuildTransactionRecords

func (n *OpenBazaarNode) BuildTransactionRecords(contract *pb.RicardianContract, records []*wallet.TransactionRecord, state pb.OrderState) ([]*pb.TransactionRecord, *pb.TransactionRecord, error)

BuildTransactionRecords - Used by the GET order API to build transaction records suitable to be included in the order response

func (*OpenBazaarNode) CalcOrderID

func (n *OpenBazaarNode) CalcOrderID(order *pb.Order) (string, error)

CalcOrderID - return b58 encoded orderID

func (*OpenBazaarNode) CalculateOrderTotal

func (n *OpenBazaarNode) CalculateOrderTotal(contract *pb.RicardianContract) (uint64, error)

CalculateOrderTotal - calculate the total in satoshi/wei

func (*OpenBazaarNode) CancelOfflineOrder

func (n *OpenBazaarNode) CancelOfflineOrder(contract *pb.RicardianContract, records []*wallet.TransactionRecord) error

CancelOfflineOrder - cancel order

func (*OpenBazaarNode) CloseDispute

func (n *OpenBazaarNode) CloseDispute(orderID string, buyerPercentage, vendorPercentage float32, resolution string) error

CloseDispute - close a dispute

func (*OpenBazaarNode) CompleteOrder

func (n *OpenBazaarNode) CompleteOrder(orderRatings *OrderRatings, contract *pb.RicardianContract, records []*wallet.TransactionRecord) error

CompleteOrder - complete the order

func (*OpenBazaarNode) ConfirmOfflineOrder

func (n *OpenBazaarNode) ConfirmOfflineOrder(contract *pb.RicardianContract, records []*wallet.TransactionRecord) error

ConfirmOfflineOrder - confirm offline order

func (*OpenBazaarNode) CreateListing

func (n *OpenBazaarNode) CreateListing(listing *pb.Listing) error

CreateListing - add a listing

func (*OpenBazaarNode) DeleteListing

func (n *OpenBazaarNode) DeleteListing(slug string) error

DeleteListing Deletes the listing directory, removes the listing from the index, and deletes the inventory

func (*OpenBazaarNode) DeletePost

func (n *OpenBazaarNode) DeletePost(slug string) error

DeletePost [Deletes the post directory, and removes the post from the index]

func (*OpenBazaarNode) DisputeIsActive

func (n *OpenBazaarNode) DisputeIsActive(contract *pb.RicardianContract) (bool, error)

DisputeIsActive - check if the dispute is active

func (*OpenBazaarNode) EncryptMessage

func (n *OpenBazaarNode) EncryptMessage(peerID peer.ID, peerKey *libp2p.PubKey, message []byte) (ct []byte, rerr error)

EncryptMessage This is a placeholder until the libsignal is operational.

For now we will just encrypt outgoing offline messages with the long lived identity key.
Optionally you may provide a public key, to avoid doing an IPFS lookup

func (*OpenBazaarNode) EstimateOrderTotal

func (n *OpenBazaarNode) EstimateOrderTotal(data *PurchaseData) (uint64, error)

EstimateOrderTotal - returns order total in satoshi/wei

func (*OpenBazaarNode) FetchAvatar

func (n *OpenBazaarNode) FetchAvatar(peerID string, size string, useCache bool) (io.DagReader, error)

FetchAvatar - fetch image avatar from ipfs

func (*OpenBazaarNode) FetchHeader

func (n *OpenBazaarNode) FetchHeader(peerID string, size string, useCache bool) (io.DagReader, error)

FetchHeader - fetch image header from ipfs

func (*OpenBazaarNode) FetchImage

func (n *OpenBazaarNode) FetchImage(peerID string, imageType string, size string, useCache bool) (io.DagReader, error)

FetchImage - fetch ipfs image

func (*OpenBazaarNode) FetchProfile

func (n *OpenBazaarNode) FetchProfile(peerID string, useCache bool) (pb.Profile, error)

FetchProfile - fetch peer’s profile

func (*OpenBazaarNode) Follow

func (n *OpenBazaarNode) Follow(peerID string) error

Follow - follow a peer

func (*OpenBazaarNode) FulfillOrder

func (n *OpenBazaarNode) FulfillOrder(fulfillment *pb.OrderFulfillment, contract *pb.RicardianContract, records []*wallet.TransactionRecord) error

FulfillOrder - fulfill the order

func (*OpenBazaarNode) GeneratePostSlug

func (n *OpenBazaarNode) GeneratePostSlug(title string) (string, error)

GeneratePostSlug [Create a slug for the post based on the title, if a slug is missing]

func (*OpenBazaarNode) GenerateSlug

func (n *OpenBazaarNode) GenerateSlug(title string) (string, error)

GenerateSlug - slugify the title of the listing

func (*OpenBazaarNode) GetBase64Image

func (n *OpenBazaarNode) GetBase64Image(url string) (base64ImageData, filename string, err error)

GetBase64Image - fetch the image and return it as base64 encoded string

func (*OpenBazaarNode) GetListingCount

func (n *OpenBazaarNode) GetListingCount() int

GetListingCount Return the current number of listings

func (*OpenBazaarNode) GetListingFromHash

func (n *OpenBazaarNode) GetListingFromHash(hash string) (*pb.SignedListing, error)

GetListingFromHash - fetch listing for the specified hash

func (*OpenBazaarNode) GetListingFromSlug

func (n *OpenBazaarNode) GetListingFromSlug(slug string) (*pb.SignedListing, error)

GetListingFromSlug - fetch listing for the specified slug

func (*OpenBazaarNode) GetListings

func (n *OpenBazaarNode) GetListings() ([]byte, error)

GetListings - fetch all listings

func (*OpenBazaarNode) GetLocalInventory

func (n *OpenBazaarNode) GetLocalInventory() (Inventory, error)

GetLocalInventory gets the inventory from the database

func (*OpenBazaarNode) GetLocalInventoryForSlug

func (n *OpenBazaarNode) GetLocalInventoryForSlug(slug string) (*InventoryListing, error)

GetLocalInventoryForSlug gets the local inventory for the given slug

func (*OpenBazaarNode) GetModeratorFee

func (n *OpenBazaarNode) GetModeratorFee(transactionTotal uint64) (uint64, error)

GetModeratorFee - fetch moderator fee

func (*OpenBazaarNode) GetPeerStatus

func (n *OpenBazaarNode) GetPeerStatus(peerID string) (string, error)

GetPeerStatus - check if a peer is online/offline

func (*OpenBazaarNode) GetPostCount

func (n *OpenBazaarNode) GetPostCount() int

GetPostCount [Return the current number of posts]

func (*OpenBazaarNode) GetPostFromHash

func (n *OpenBazaarNode) GetPostFromHash(hash string) (*pb.SignedPost, error)

GetPostFromHash [Get a post based on the hash]

func (*OpenBazaarNode) GetPostFromSlug

func (n *OpenBazaarNode) GetPostFromSlug(slug string) (*pb.SignedPost, error)

GetPostFromSlug [Get a post based on the slug]

func (*OpenBazaarNode) GetPosts

func (n *OpenBazaarNode) GetPosts() ([]byte, error)

GetPosts [Get a list of the posts]

func (*OpenBazaarNode) GetProfile

func (n *OpenBazaarNode) GetProfile() (pb.Profile, error)

GetProfile - fetch user profile

func (*OpenBazaarNode) GetPublishedInventoryBytes

func (n *OpenBazaarNode) GetPublishedInventoryBytes(p peer.ID, useCache bool) ([]byte, error)

GetPublishedInventoryBytes gets a byte slice representing the given peer’s inventory that it published to IPFS

func (*OpenBazaarNode) GetPublishedInventoryBytesForSlug

func (n *OpenBazaarNode) GetPublishedInventoryBytesForSlug(p peer.ID, slug string, useCache bool) ([]byte, error)

GetPublishedInventoryBytesForSlug gets a byte slice representing the given slug’s inventory from IPFS

func (*OpenBazaarNode) GetRatingCounts

func (n *OpenBazaarNode) GetRatingCounts() (uint32, float32, error)

GetRatingCounts - fetch rating count

func (*OpenBazaarNode) IPFSIdentityString

func (n *OpenBazaarNode) IPFSIdentityString() string

IPFSIdentityString - IPFS identifier

func (*OpenBazaarNode) IPNSResolve

func (n *OpenBazaarNode) IPNSResolve(peerID string, timeout time.Duration, usecache bool) (string, error)

IPNSResolve - try fetching the record from an API

func (*OpenBazaarNode) IPNSResolveThenCat

func (n *OpenBazaarNode) IPNSResolveThenCat(ipnsPath ipfspath.Path, timeout time.Duration, usecache bool) ([]byte, error)

IPNSResolveThenCat - find the record in the DHT

func (*OpenBazaarNode) ImportListings

func (n *OpenBazaarNode) ImportListings(r io.ReadCloser) error

ImportListings - upload/read listings

func (*OpenBazaarNode) IsFulfilled

func (n *OpenBazaarNode) IsFulfilled(contract *pb.RicardianContract) bool

IsFulfilled - check is order is fulfilled

func (*OpenBazaarNode) IsItemForSale

func (n *OpenBazaarNode) IsItemForSale(listing *pb.Listing) bool

IsItemForSale Check to see we are selling the given listing. Used when validating an order. FIXME: This wont scale well. We will need to store the hash of active listings in a db to do an indexed search.

func (*OpenBazaarNode) IsModerator

func (n *OpenBazaarNode) IsModerator() bool

IsModerator - Am I a moderator?

func (*OpenBazaarNode) NewOrderConfirmation

func (n *OpenBazaarNode) NewOrderConfirmation(contract *pb.RicardianContract, addressRequest, calculateNewTotal bool) (*pb.RicardianContract, error)

NewOrderConfirmation - add order confirmation to the contract

func (*OpenBazaarNode) NotifyModerators

func (n *OpenBazaarNode) NotifyModerators(moderators []string) error

NotifyModerators - notify moderators(peers)

func (*OpenBazaarNode) OpenDispute

func (n *OpenBazaarNode) OpenDispute(orderID string, contract *pb.RicardianContract, records []*wallet.TransactionRecord, claim string) error

OpenDispute - open a dispute

func (*OpenBazaarNode) PatchProfile

func (n *OpenBazaarNode) PatchProfile(patch map[string]interface{}) error

PatchProfile - patch user profile

func (*OpenBazaarNode) ProcessDisputeOpen

func (n *OpenBazaarNode) ProcessDisputeOpen(rc *pb.RicardianContract, peerID string) error

ProcessDisputeOpen - process an open dispute

func (*OpenBazaarNode) PublishInventory

func (n *OpenBazaarNode) PublishInventory() error

PublishInventory stores an inventory on IPFS

func (*OpenBazaarNode) Purchase

func (n *OpenBazaarNode) Purchase(data *PurchaseData) (orderID string, paymentAddress string, paymentAmount uint64, vendorOnline bool, err error)

Purchase - add ricardian contract

func (*OpenBazaarNode) RefundOrder

func (n *OpenBazaarNode) RefundOrder(contract *pb.RicardianContract, records []*wallet.TransactionRecord) error

RefundOrder - refund buyer

func (*OpenBazaarNode) RegressionNetworkEnabled

func (n *OpenBazaarNode) RegressionNetworkEnabled() bool

RegressionNetworkEnabled indicates whether the node is operating with regression parameters

func (*OpenBazaarNode) RejectOfflineOrder

func (n *OpenBazaarNode) RejectOfflineOrder(contract *pb.RicardianContract, records []*wallet.TransactionRecord) error

RejectOfflineOrder - reject offline order

func (*OpenBazaarNode) ReleaseFunds

func (n *OpenBazaarNode) ReleaseFunds(contract *pb.RicardianContract, records []*wallet.TransactionRecord) error

ReleaseFunds - release funds

func (*OpenBazaarNode) ReleaseFundsAfterTimeout

func (n *OpenBazaarNode) ReleaseFundsAfterTimeout(contract *pb.RicardianContract, records []*wallet.TransactionRecord) error

ReleaseFundsAfterTimeout - release funds

func (*OpenBazaarNode) RemoveSelfAsModerator

func (n *OpenBazaarNode) RemoveSelfAsModerator() error

RemoveSelfAsModerator - relinquish moderatorship

func (*OpenBazaarNode) SeedNode

func (n *OpenBazaarNode) SeedNode() error

SeedNode - publish to IPNS

func (*OpenBazaarNode) SendBlock

func (n *OpenBazaarNode) SendBlock(peerID string, id cid.Cid) error

SendBlock - send requested ipfs block to peer

func (*OpenBazaarNode) SendCancel

func (n *OpenBazaarNode) SendCancel(peerID, orderID string) error

SendCancel - send order cancelled msg to peer

func (*OpenBazaarNode) SendChat

func (n *OpenBazaarNode) SendChat(peerID string, chatMessage *pb.Chat) error

SendChat - send chat msg to peer

func (*OpenBazaarNode) SendDisputeClose

func (n *OpenBazaarNode) SendDisputeClose(peerID string, k *libp2p.PubKey, resolutionMessage *pb.RicardianContract) error

SendDisputeClose - send dispute closed msg to peer

func (*OpenBazaarNode) SendDisputeOpen

func (n *OpenBazaarNode) SendDisputeOpen(peerID string, k *libp2p.PubKey, disputeMessage *pb.RicardianContract) error

SendDisputeOpen - send open dispute msg to peer

func (*OpenBazaarNode) SendDisputeUpdate

func (n *OpenBazaarNode) SendDisputeUpdate(peerID string, updateMessage *pb.DisputeUpdate) error

SendDisputeUpdate - send update dispute msg to peer

func (*OpenBazaarNode) SendError

func (n *OpenBazaarNode) SendError(peerID string, k *libp2p.PubKey, errorMessage pb.Message) error

SendError - send error msg to peer

func (*OpenBazaarNode) SendFundsReleasedByVendor

func (n *OpenBazaarNode) SendFundsReleasedByVendor(peerID string, marshalledPeerPublicKey []byte, orderID string) error

SendFundsReleasedByVendor - send funds released by vendor msg to peer

func (*OpenBazaarNode) SendModeratorAdd

func (n *OpenBazaarNode) SendModeratorAdd(peerID string) error

SendModeratorAdd - send add moderator msg to peer

func (*OpenBazaarNode) SendModeratorRemove

func (n *OpenBazaarNode) SendModeratorRemove(peerID string) error

SendModeratorRemove - send remove moderator msg to peer

func (*OpenBazaarNode) SendOfflineAck

func (n *OpenBazaarNode) SendOfflineAck(peerID string, pointerID peer.ID) error

SendOfflineAck - send ack to offline peer

func (*OpenBazaarNode) SendOfflineMessage

func (n *OpenBazaarNode) SendOfflineMessage(p peer.ID, k *libp2p.PubKey, m *pb.Message) error

SendOfflineMessage Supply of a public key is optional, if nil is instead provided n.EncryptMessage does a lookup

func (*OpenBazaarNode) SendOfflineRelay

func (n *OpenBazaarNode) SendOfflineRelay(peerID string, encryptedMessage []byte) error

SendOfflineRelay - send and offline relay message to the peer. Used for relaying messages from a client node to another peer.

func (*OpenBazaarNode) SendOrder

func (n *OpenBazaarNode) SendOrder(peerID string, contract *pb.RicardianContract) (resp *pb.Message, err error)

SendOrder - send order created msg to peer

func (*OpenBazaarNode) SendOrderCompletion

func (n *OpenBazaarNode) SendOrderCompletion(peerID string, k *libp2p.PubKey, completionMessage *pb.RicardianContract) error

SendOrderCompletion - send order completion msg to peer

func (*OpenBazaarNode) SendOrderConfirmation

func (n *OpenBazaarNode) SendOrderConfirmation(peerID string, contract *pb.RicardianContract) error

SendOrderConfirmation - send order confirmed msg to peer

func (*OpenBazaarNode) SendOrderFulfillment

func (n *OpenBazaarNode) SendOrderFulfillment(peerID string, k *libp2p.PubKey, fulfillmentMessage *pb.RicardianContract) error

SendOrderFulfillment - send order fulfillment msg to peer

func (*OpenBazaarNode) SendRefund

func (n *OpenBazaarNode) SendRefund(peerID string, refundMessage *pb.RicardianContract) error

SendRefund - send refund msg to peer

func (*OpenBazaarNode) SendReject

func (n *OpenBazaarNode) SendReject(peerID string, rejectMessage *pb.OrderReject) error

SendReject - send order rejected msg to peer

func (*OpenBazaarNode) SendStore

func (n *OpenBazaarNode) SendStore(peerID string, ids []cid.Cid) error

SendStore - send requested stores to peer

func (*OpenBazaarNode) SetAvatarImages

func (n *OpenBazaarNode) SetAvatarImages(base64ImageData string) (*pb.Profile_Image, error)

SetAvatarImages - set avatar image from the base64 encoded image string

func (*OpenBazaarNode) SetHeaderImages

func (n *OpenBazaarNode) SetHeaderImages(base64ImageData string) (*pb.Profile_Image, error)

SetHeaderImages - set header image from the base64 encoded string

func (*OpenBazaarNode) SetListingInventory

func (n *OpenBazaarNode) SetListingInventory(listing *pb.Listing) error

SetListingInventory Sets the inventory for the listing in the database. Does some basic validation

to make sure the inventory uses the correct variants.

func (*OpenBazaarNode) SetModeratorsOnListings

func (n *OpenBazaarNode) SetModeratorsOnListings(moderators []string) error

SetModeratorsOnListings - set moderators for a listing

func (*OpenBazaarNode) SetProductImages

func (n *OpenBazaarNode) SetProductImages(base64ImageData, filename string) (*pb.Profile_Image, error)

SetProductImages - use the original image ina base64 string format and generate tiny, small, medium and large images for the product

func (*OpenBazaarNode) SetSelfAsModerator

func (n *OpenBazaarNode) SetSelfAsModerator(moderator *pb.Moderator) error

SetSelfAsModerator - set self as a moderator

func (*OpenBazaarNode) SetUpRepublisher

func (n *OpenBazaarNode) SetUpRepublisher(interval time.Duration)

SetUpRepublisher - periodic publishing to IPNS

func (*OpenBazaarNode) SignDispute

func (n *OpenBazaarNode) SignDispute(contract *pb.RicardianContract) (*pb.RicardianContract, error)

SignDispute - sign the dispute

func (*OpenBazaarNode) SignDisputeResolution

func (n *OpenBazaarNode) SignDisputeResolution(contract *pb.RicardianContract) (*pb.RicardianContract, error)

SignDisputeResolution - add signature to DisputeResolution

func (*OpenBazaarNode) SignListing

func (n *OpenBazaarNode) SignListing(listing *pb.Listing) (*pb.SignedListing, error)

SignListing Add our identity to the listing and sign it

func (*OpenBazaarNode) SignOrder

func (n *OpenBazaarNode) SignOrder(contract *pb.RicardianContract) (*pb.RicardianContract, error)

SignOrder - add signature to the order

func (*OpenBazaarNode) SignOrderCompletion

func (n *OpenBazaarNode) SignOrderCompletion(contract *pb.RicardianContract) (*pb.RicardianContract, error)

SignOrderCompletion - sign order on completion

func (*OpenBazaarNode) SignOrderConfirmation

func (n *OpenBazaarNode) SignOrderConfirmation(contract *pb.RicardianContract) (*pb.RicardianContract, error)

SignOrderConfirmation - sign the added order confirmation

func (*OpenBazaarNode) SignOrderFulfillment

func (n *OpenBazaarNode) SignOrderFulfillment(contract *pb.RicardianContract) (*pb.RicardianContract, error)

SignOrderFulfillment - add signature to order fulfillment

func (*OpenBazaarNode) SignPost

func (n *OpenBazaarNode) SignPost(post *pb.Post) (*pb.SignedPost, error)

SignPost [Add the peer’s identity to the post and sign it]

func (*OpenBazaarNode) SignRefund

func (n *OpenBazaarNode) SignRefund(contract *pb.RicardianContract) (*pb.RicardianContract, error)

SignRefund - add signature to refund

func (*OpenBazaarNode) StartMessageRetriever

func (n *OpenBazaarNode) StartMessageRetriever()

StartMessageRetriever will collect the required options from the OpenBazaarNode and begin the MessageRetriever in the background

func (*OpenBazaarNode) StartPointerRepublisher

func (n *OpenBazaarNode) StartPointerRepublisher()

StartPointerRepublisher - setup republisher for IPNS

func (*OpenBazaarNode) StartRecordAgingNotifier

func (n *OpenBazaarNode) StartRecordAgingNotifier()

StartRecordAgingNotifier - start the notifier

func (*OpenBazaarNode) TestNetworkEnabled

func (n *OpenBazaarNode) TestNetworkEnabled() bool

TestNetworkEnabled indicates whether the node is operating with test parameters

func (*OpenBazaarNode) Unfollow

func (n *OpenBazaarNode) Unfollow(peerID string) error

Unfollow - unfollow a peer

func (*OpenBazaarNode) UpdateEachListingOnIndex

func (n *OpenBazaarNode) UpdateEachListingOnIndex(updateListing func(*ListingData) error) error

UpdateEachListingOnIndex will visit each listing in the index and execute the function with a pointer to the listing passed as the argument. The function should return an error to further processing.

func (*OpenBazaarNode) UpdateFollow

func (n *OpenBazaarNode) UpdateFollow() error

UpdateFollow This function updates the follow and following lists in the node’s root directory

as well as adds the current follow, following, and listing counts to the profile.
We only do this when a user updates his node to avoid needing to make network calls
each time a new follower or unfollow request comes in.

func (*OpenBazaarNode) UpdateListing

func (n *OpenBazaarNode) UpdateListing(listing *pb.Listing) error

UpdateListing - update the listing

func (*OpenBazaarNode) UpdatePostHashes

func (n *OpenBazaarNode) UpdatePostHashes(hashes map[string]string) error

UpdatePostHashes [Update the hashes in the posts.json file]

func (*OpenBazaarNode) UpdatePostIndex

func (n *OpenBazaarNode) UpdatePostIndex(post *pb.SignedPost) error

UpdatePostIndex [Update the posts index]

func (*OpenBazaarNode) UpdateProfile

func (n *OpenBazaarNode) UpdateProfile(profile *pb.Profile) error

UpdateProfile - update user profile

func (*OpenBazaarNode) ValidateAndSaveRating

func (n *OpenBazaarNode) ValidateAndSaveRating(contract *pb.RicardianContract) (retErr error)

ValidateAndSaveRating - validates rating

func (*OpenBazaarNode) ValidateCaseContract

func (n *OpenBazaarNode) ValidateCaseContract(contract *pb.RicardianContract) []string

ValidateCaseContract - validate contract details

func (*OpenBazaarNode) ValidateDirectPaymentAddress

func (n *OpenBazaarNode) ValidateDirectPaymentAddress(order *pb.Order) error

ValidateDirectPaymentAddress - validate address

func (*OpenBazaarNode) ValidateDisputeResolution

func (n *OpenBazaarNode) ValidateDisputeResolution(contract *pb.RicardianContract) error

ValidateDisputeResolution - validate dispute resolution

func (*OpenBazaarNode) ValidateModeratedPaymentAddress

func (n *OpenBazaarNode) ValidateModeratedPaymentAddress(order *pb.Order, timeout time.Duration) error

ValidateModeratedPaymentAddress - validate moderator address

func (*OpenBazaarNode) ValidateOrder

func (n *OpenBazaarNode) ValidateOrder(contract *pb.RicardianContract, checkInventory bool) error

ValidateOrder - check the order validity wrt signatures etc

func (*OpenBazaarNode) ValidateOrderCompletion

func (n *OpenBazaarNode) ValidateOrderCompletion(contract *pb.RicardianContract) error

ValidateOrderCompletion - validate order signatures on completion

func (*OpenBazaarNode) ValidateOrderConfirmation

func (n *OpenBazaarNode) ValidateOrderConfirmation(contract *pb.RicardianContract, validateAddress bool) error

ValidateOrderConfirmation - validate address and signatures for order confirmation

func (*OpenBazaarNode) ValidateOrderFulfillment

func (n *OpenBazaarNode) ValidateOrderFulfillment(fulfillment *pb.OrderFulfillment, contract *pb.RicardianContract) error

ValidateOrderFulfillment - validate order details

func (*OpenBazaarNode) ValidatePaymentAmount

func (n *OpenBazaarNode) ValidatePaymentAmount(requestedAmount, paymentAmount uint64) bool

ValidatePaymentAmount - validate amount requested

func (*OpenBazaarNode) VerifySignatureOnDisputeOpen

func (n *OpenBazaarNode) VerifySignatureOnDisputeOpen(contract *pb.RicardianContract, peerID string) error

VerifySignatureOnDisputeOpen - verify signatures in an open dispute

func (*OpenBazaarNode) VerifySignaturesOnRefund

func (n *OpenBazaarNode) VerifySignaturesOnRefund(contract *pb.RicardianContract) error

VerifySignaturesOnRefund - verify signatures on refund

func (*OpenBazaarNode) WaitForMessageRetrieverCompletion

func (n *OpenBazaarNode) WaitForMessageRetrieverCompletion()

WaitForMessageRetrieverCompletion will return once the MessageRetriever has finished processing messages

type OrderRatings

type OrderRatings struct {
    OrderID string       `json:"orderId"`
    Ratings []RatingData `json:"ratings"`

OrderRatings - record ratings for an order

type PurchaseData

type PurchaseData struct {
    ShipTo               string  `json:"shipTo"`
    Address              string  `json:"address"`
    City                 string  `json:"city"`
    State                string  `json:"state"`
    PostalCode           string  `json:"postalCode"`
    CountryCode          string  `json:"countryCode"`
    AddressNotes         string  `json:"addressNotes"`
    Moderator            string  `json:"moderator"`
    Items                []item  `json:"items"`
    AlternateContactInfo string  `json:"alternateContactInfo"`
    RefundAddress        *string `json:"refundAddress"` //optional, can be left out of json

PurchaseData - record purchase data

type RatingData

type RatingData struct {
    Slug            string `json:"slug"`
    Overall         int    `json:"overall"`
    Quality         int    `json:"quality"`
    Description     int    `json:"description"`
    DeliverySpeed   int    `json:"deliverySpeed"`
    CustomerService int    `json:"customerService"`
    Review          string `json:"review"`
    Anonymous       bool   `json:"anonymous"`

RatingData - record rating in detail

type SavedRating

type SavedRating struct {
    Slug    string   `json:"slug"`
    Count   int      `json:"count"`
    Average float32  `json:"average"`
    Ratings []string `json:"ratings"`

SavedRating - represent saved rating

Generated by godoc2md