core

package
v0.12.1-rc3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 25, 2018 License: MIT Imports: 69 Imported by: 71

Documentation

Index

Constants

View Source
const (
	RatingMin           = 1
	RatingMax           = 5
	ReviewMaxCharacters = 3000
)
View Source
const (
	ListingVersion           = 4
	TitleMaxCharacters       = 140
	ShortDescriptionLength   = 160
	DescriptionMaxCharacters = 50000
	MaxTags                  = 10
	MaxCategories            = 10
	MaxListItems             = 30
	FilenameMaxCharacters    = 255
	CodeMaxCharacters        = 20
	WordMaxCharacters        = 40
	SentenceMaxCharacters    = 70
	CouponTitleMaxCharacters = 70
	PolicyMaxCharacters      = 10000
	AboutMaxCharacters       = 10000
	URLMaxCharacters         = 2000
	MaxCountryCodes          = 255
	EscrowTimeout            = 1080
	SlugBuffer               = 5
	PriceModifierMin         = -99.99
	PriceModifierMax         = 1000.00

	DefaultCoinDivisibility uint32 = 1e8
)
View Source
const (
	CHAT_MESSAGE_MAX_CHARACTERS = 20000
	CHAT_SUBJECT_MAX_CHARACTERS = 500
	DefaultPointerPrefixLength  = 14
)
View Source
const (
	// We use this to check to see if the approximate fee to release funds from escrow is greater than 1/4th of the amount
	// being released. If so, we prevent the purchase from being made as it severely cuts into the vendor's profits.
	// TODO: this probably should not be hardcoded but making it adaptive requires all wallet implementations to provide this data.
	// TODO: for now, this is probably OK as it's just an approximation.
	EscrowReleaseSize                             = 337
	CryptocurrencyPurchasePaymentAddressMaxLength = 512
)
View Source
const (
	PostTitleMaxCharacters    = 280
	PostLongFormMaxCharacters = 50000
	MaxPostTags               = 50
	PostTagsMaxCharacters     = 80
)

Constants for validation

View Source
const ConfirmationsPerHour = 6

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

View Source
const KeyCachePrefix = "/pubkey/"

Variables

View Source
var (
	EscrowTimeLockedError                    error
	ErrPrematureReleaseOfTimedoutEscrowFunds = errors.New(fmt.Sprintf("Escrow can only be released when in dispute for %s days", (time.Duration(repo.DisputeTotalDurationHours) * time.Hour).String()))
)
View Source
var (
	VERSION   = "0.12.1"
	USERAGENT = "/openbazaar-go:" + VERSION + "/"
)
View Source
var (
	ErrPurchaseUnknownListing = errors.New("Order contains a hash of a listing that is not currently for sale")

	ErrListingDoesNotExist                   = errors.New("Listing doesn't exist")
	ErrListingAlreadyExists                  = errors.New("Listing already exists")
	ErrListingCoinDivisibilityIncorrect      = errors.New("Incorrect coinDivisibility")
	ErrPriceCalculationRequiresExchangeRates = errors.New("Can't calculate price with exchange rates disabled")

	ErrCryptocurrencyListingCoinTypeRequired        = errors.New("Cryptocurrency listings require a coinType")
	ErrCryptocurrencyPurchasePaymentAddressRequired = errors.New("paymentAddress required for cryptocurrency items")
	ErrCryptocurrencyPurchasePaymentAddressTooLong  = errors.New("paymentAddress required is too long")

	ErrCryptocurrencySkuQuantityInvalid = errors.New("Cryptocurrency listing quantity must be a non-negative integer")

	ErrFulfillIncorrectDeliveryType      = errors.New("Incorrect delivery type for order")
	ErrFulfillCryptocurrencyTXIDNotFound = errors.New("A transactionID is required to fulfill crypto listings")
	ErrFulfillCryptocurrencyTXIDTooLong  = errors.New("transactionID should be no longer than " + strconv.Itoa(MaxTXIDSize))
)
View Source
var DisputeWg = new(sync.WaitGroup)
View Source
var ErrCaseNotFound = errors.New("Case not found")
View Source
var ErrCloseFailureCaseExpired = errors.New("Unable to close case. Case has expired.")
View Source
var (
	ErrInventoryNotFoundForSlug = errors.New("Could not find slug in inventory")
)
View Source
var ErrOpenFailureOrderExpired = errors.New("Unable to open case. Order is too old to dispute.")
View Source
var ErrorProfileNotFound error = errors.New("Profile not found")
View Source
var InitalPublishComplete bool = false
View Source
var (
	MaxTXIDSize = 512
)
View Source
var ModeratorPointerID multihash.Multihash
View Source
var NoListingsError error = errors.New("No listings to set moderators on")
View Source
var OfflineMessageWaitGroup sync.WaitGroup
View Source
var PublishLock sync.Mutex

Functions

func CheckAndSetUlimit added in v0.9.3

func CheckAndSetUlimit() error

CheckAndSetUlimit raises the file descriptor limit

func EncodeCID added in v0.7.0

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

Hash with SHA-256 and encode as a multihash

func EncodeMultihash added in v0.5.1

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

func ExtractIDFromPointer added in v0.5.1

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

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

func FormatRFC3339PB added in v0.10.1

func FormatRFC3339PB(ts google_protobuf.Timestamp) string

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

func GetOrderQuantity added in v0.12.0

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

func GetSelectedSku added in v0.5.1

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

func NormalizeCurrencyCode added in v0.12.0

func NormalizeCurrencyCode(currencyCode string) string

NormalizeCurrencyCode standardizes the format for the given currency code

func ParseContractForListing added in v0.5.5

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

func SameSku added in v0.5.1

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

func ValidateProfile added in v0.5.3

func ValidateProfile(profile *pb.Profile) error

func ValidateRating added in v0.6.0

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

Types

type CodedError added in v0.12.0

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

CodedError is an error that is machine readable

func (CodedError) Error added in v0.12.0

func (err CodedError) Error() string

type ErrCryptocurrencyListingIllegalField added in v0.12.0

type ErrCryptocurrencyListingIllegalField string

func (ErrCryptocurrencyListingIllegalField) Error added in v0.12.0

type ErrCryptocurrencyPurchaseIllegalField added in v0.12.0

type ErrCryptocurrencyPurchaseIllegalField string

func (ErrCryptocurrencyPurchaseIllegalField) Error added in v0.12.0

type ErrMarketPriceListingIllegalField added in v0.12.0

type ErrMarketPriceListingIllegalField string

func (ErrMarketPriceListingIllegalField) Error added in v0.12.0

type ErrOutOfInventory added in v0.12.0

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

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

func NewErrOutOfInventory added in v0.12.0

func NewErrOutOfInventory(inventoryRemaining int64) ErrOutOfInventory

func (ErrOutOfInventory) Error added in v0.12.0

func (err ErrOutOfInventory) Error() string

type ErrPriceModifierOutOfRange added in v0.12.1

type ErrPriceModifierOutOfRange struct {
	Min float64
	Max float64
}

func (ErrPriceModifierOutOfRange) Error added in v0.12.1

type Inventory added in v0.12.0

type Inventory map[string]*InventoryListing

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

type InventoryListing added in v0.12.0

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

InventoryListing is the listing representation stored on IPFS

type ListingData added in v0.11.0

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"`
}

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

	TestnetEnable        bool
	RegressionTestEnable bool
}
var Node *OpenBazaarNode

func (*OpenBazaarNode) BuildTransactionRecords added in v0.6.2

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

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

func (*OpenBazaarNode) CalcOrderId added in v0.2.0

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

func (*OpenBazaarNode) CalculateOrderTotal added in v0.1.1

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

func (*OpenBazaarNode) CancelOfflineOrder added in v0.2.0

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

func (*OpenBazaarNode) CloseDispute added in v0.3.0

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

func (*OpenBazaarNode) CompleteOrder added in v0.2.2

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

func (*OpenBazaarNode) ConfirmOfflineOrder added in v0.2.0

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

func (*OpenBazaarNode) CreateListing added in v0.12.0

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

func (*OpenBazaarNode) DeleteListing added in v0.1.1

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

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

func (*OpenBazaarNode) DeletePost added in v0.10.1

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

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

func (*OpenBazaarNode) DisputeIsActive added in v0.12.1

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

func (*OpenBazaarNode) EncryptMessage

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

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 added in v0.5.5

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

func (*OpenBazaarNode) FetchAvatar added in v0.6.0

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

func (*OpenBazaarNode) FetchHeader added in v0.6.0

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

func (*OpenBazaarNode) FetchImage added in v0.6.0

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

func (*OpenBazaarNode) FetchProfile added in v0.5.0

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

func (*OpenBazaarNode) Follow

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

func (*OpenBazaarNode) FulfillOrder added in v0.2.1

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

func (*OpenBazaarNode) GeneratePostSlug added in v0.10.1

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 added in v0.5.1

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

func (*OpenBazaarNode) GetBase64Image added in v0.6.3

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

func (*OpenBazaarNode) GetListingCount

func (n *OpenBazaarNode) GetListingCount() int

Return the current number of listings

func (*OpenBazaarNode) GetListingFromHash added in v0.1.1

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

func (*OpenBazaarNode) GetListingFromSlug added in v0.1.1

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

func (*OpenBazaarNode) GetListings added in v0.2.3

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

func (*OpenBazaarNode) GetLocalInventory added in v0.12.0

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

GetLocalInventory gets the inventory from the database

func (*OpenBazaarNode) GetLocalInventoryForSlug added in v0.12.0

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

GetLocalInventoryForSlug gets the local inventory for the given slug

func (*OpenBazaarNode) GetModeratorFee added in v0.3.0

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

func (*OpenBazaarNode) GetPeerStatus

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

func (*OpenBazaarNode) GetPostCount added in v0.10.1

func (n *OpenBazaarNode) GetPostCount() int

GetPostCount [Return the current number of posts]

func (*OpenBazaarNode) GetPostFromHash added in v0.10.1

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

GetPostFromHash [Get a post based on the hash]

func (*OpenBazaarNode) GetPostFromSlug added in v0.10.1

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

GetPostFromSlug [Get a post based on the slug]

func (*OpenBazaarNode) GetPosts added in v0.10.1

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

GetPosts [Get a list of the posts]

func (*OpenBazaarNode) GetProfile

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

func (*OpenBazaarNode) GetPublishedInventoryBytes added in v0.12.0

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 added in v0.12.0

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 added in v0.9.4

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

func (*OpenBazaarNode) IPFSIdentityString added in v0.12.0

func (n *OpenBazaarNode) IPFSIdentityString() string

func (*OpenBazaarNode) IPNSResolve added in v0.11.0

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

func (*OpenBazaarNode) IPNSResolveThenCat added in v0.11.0

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

func (*OpenBazaarNode) ImportListings added in v0.6.3

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

func (*OpenBazaarNode) IsFulfilled added in v0.2.1

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

func (*OpenBazaarNode) IsItemForSale added in v0.2.0

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

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 added in v0.5.0

func (n *OpenBazaarNode) IsModerator() bool

func (*OpenBazaarNode) NewOrderConfirmation added in v0.2.0

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

func (*OpenBazaarNode) NotifyModerators added in v0.5.1

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

func (*OpenBazaarNode) OpenDispute added in v0.3.0

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

func (*OpenBazaarNode) PatchProfile added in v0.4.3

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

func (*OpenBazaarNode) ProcessDisputeOpen added in v0.3.0

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

func (*OpenBazaarNode) PublishInventory added in v0.12.0

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)

func (*OpenBazaarNode) RefundOrder added in v0.2.1

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

func (*OpenBazaarNode) RegressionNetworkEnabled added in v0.11.1

func (n *OpenBazaarNode) RegressionNetworkEnabled() bool

RegressionNetworkEnabled indicates whether the node is operating with regression parameters

func (*OpenBazaarNode) RejectOfflineOrder added in v0.2.0

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

func (*OpenBazaarNode) ReleaseFunds added in v0.3.0

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

func (*OpenBazaarNode) ReleaseFundsAfterTimeout added in v0.7.0

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

func (*OpenBazaarNode) RemoveSelfAsModerator added in v0.1.1

func (n *OpenBazaarNode) RemoveSelfAsModerator() error

func (*OpenBazaarNode) SeedNode

func (n *OpenBazaarNode) SeedNode() error

func (*OpenBazaarNode) SendBlock added in v0.9.3

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

func (*OpenBazaarNode) SendCancel added in v0.2.0

func (n *OpenBazaarNode) SendCancel(peerId, orderId string) error

func (*OpenBazaarNode) SendChat added in v0.3.1

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

func (*OpenBazaarNode) SendDisputeClose added in v0.3.0

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

func (*OpenBazaarNode) SendDisputeOpen added in v0.3.0

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

func (*OpenBazaarNode) SendDisputeUpdate added in v0.3.0

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

func (*OpenBazaarNode) SendError added in v0.11.1

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

func (*OpenBazaarNode) SendFundsReleasedByVendor added in v0.12.1

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

func (*OpenBazaarNode) SendModeratorAdd added in v0.5.1

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

func (*OpenBazaarNode) SendModeratorRemove added in v0.5.1

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

func (*OpenBazaarNode) SendOfflineAck

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

func (*OpenBazaarNode) SendOfflineMessage

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

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

func (*OpenBazaarNode) SendOrder added in v0.1.1

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

func (*OpenBazaarNode) SendOrderCompletion added in v0.2.2

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

func (*OpenBazaarNode) SendOrderConfirmation added in v0.2.0

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

func (*OpenBazaarNode) SendOrderFulfillment added in v0.2.1

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

func (*OpenBazaarNode) SendRefund added in v0.2.1

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

func (*OpenBazaarNode) SendReject added in v0.2.0

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

func (*OpenBazaarNode) SendStore added in v0.9.3

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

func (*OpenBazaarNode) SetAvatarImages added in v0.2.0

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

func (*OpenBazaarNode) SetHeaderImages added in v0.2.0

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

func (*OpenBazaarNode) SetListingInventory

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

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 added in v0.4.3

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

func (*OpenBazaarNode) SetProductImages added in v0.2.0

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

func (*OpenBazaarNode) SetSelfAsModerator added in v0.1.1

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

func (*OpenBazaarNode) SetUpRepublisher added in v0.9.3

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

func (*OpenBazaarNode) SignDispute added in v0.3.0

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

func (*OpenBazaarNode) SignDisputeResolution added in v0.3.0

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

func (*OpenBazaarNode) SignListing

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

Add our identity to the listing and sign it

func (*OpenBazaarNode) SignOrder added in v0.2.0

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

func (*OpenBazaarNode) SignOrderCompletion added in v0.2.2

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

func (*OpenBazaarNode) SignOrderConfirmation added in v0.2.0

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

func (*OpenBazaarNode) SignOrderFulfillment added in v0.2.1

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

func (*OpenBazaarNode) SignPost added in v0.10.1

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 added in v0.2.1

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

func (*OpenBazaarNode) StartMessageRetriever added in v0.12.1

func (n *OpenBazaarNode) StartMessageRetriever()

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

func (*OpenBazaarNode) StartPointerRepublisher added in v0.12.1

func (n *OpenBazaarNode) StartPointerRepublisher()

func (*OpenBazaarNode) StartRecordAgingNotifier added in v0.12.1

func (n *OpenBazaarNode) StartRecordAgingNotifier()

func (*OpenBazaarNode) TestNetworkEnabled added in v0.11.1

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

func (*OpenBazaarNode) UpdateEachListingOnIndex added in v0.11.1

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

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 added in v0.12.0

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

func (*OpenBazaarNode) UpdatePostHashes added in v0.10.1

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

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

func (*OpenBazaarNode) UpdatePostIndex added in v0.10.1

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

UpdatePostIndex [Update the posts index]

func (*OpenBazaarNode) UpdateProfile

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

func (*OpenBazaarNode) ValidateAndSaveRating added in v0.2.2

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

func (*OpenBazaarNode) ValidateCaseContract added in v0.3.0

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

func (*OpenBazaarNode) ValidateDirectPaymentAddress added in v0.2.0

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

func (*OpenBazaarNode) ValidateDisputeResolution added in v0.3.0

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

func (*OpenBazaarNode) ValidateModeratedPaymentAddress added in v0.2.1

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

func (*OpenBazaarNode) ValidateOrder added in v0.2.0

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

func (*OpenBazaarNode) ValidateOrderCompletion added in v0.2.2

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

func (*OpenBazaarNode) ValidateOrderConfirmation added in v0.2.1

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

func (*OpenBazaarNode) ValidateOrderFulfillment added in v0.2.1

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

func (*OpenBazaarNode) ValidatePaymentAmount added in v0.4.0

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

func (*OpenBazaarNode) VerifySignatureOnDisputeOpen added in v0.3.0

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

func (*OpenBazaarNode) VerifySignaturesOnRefund added in v0.2.1

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

func (*OpenBazaarNode) WaitForMessageRetrieverCompletion added in v0.12.1

func (n *OpenBazaarNode) WaitForMessageRetrieverCompletion()

WaitForMessageRetrieverCompletion will return once the MessageRetriever has finished processing messages

type OrderRatings added in v0.2.2

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

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
}

type RatingData added in v0.2.2

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"`
}

type SavedRating added in v0.6.0

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL