Documentation ¶
Index ¶
- Constants
- Variables
- func CreateSlugFor(slugName string) string
- func DoInit(repoRoot string, nBitsForKeypair int, testnet bool, password string, ...) error
- func ExtractIDFromListing(data []byte) (*pb.ID, error)
- func ExtractVersionFromSignedListing(data []byte) (uint, error)
- func GenerateSlug(title, repoPath string, isTestnet bool, dStore *Datastore) (string, error)
- func GetListingFromSlug(slug, repoPath string, isTestnet bool, dStore *Datastore) (*pb.SignedListing, error)
- func GetObjectFromIPFS(n *core.IpfsNode, p peer.ID, name string, maxCacheLen time.Duration) ([]byte, error)
- func GetPathForListingSlug(slug, repoPath string, isTestnet bool) (string, error)
- func GetRepoPath(isTestnet bool, repoPath string) (string, error)
- func MigrateUp(repoPath, dbPassword string, testnet bool) error
- func NewNotificationID() string
- func ToHtmlEntities(str string) string
- func ToV5Dispute(dispute *pb.Dispute) *pb.Dispute
- func ToV5DisputeResolution(disputeResolution *pb.DisputeResolution) *pb.DisputeResolution
- func ToV5Order(order *pb.Order, ...) (*pb.Order, error)
- func ToV5OrderConfirmation(orderConfirmation *pb.OrderConfirmation) *pb.OrderConfirmation
- func ToV5OrderFulfillment(orderFulfillment *pb.OrderFulfillment) *pb.OrderFulfillment
- func ToV5Refund(refund *pb.Refund) *pb.Refund
- func ValidateListingOptions(listingItemOptions []*pb.Listing_Item_Option, itemOptions []option) ([]*pb.Order_Item_Option, error)
- func ValidateShippingRegion(shippingOption *pb.Listing_ShippingOption) error
- type APITime
- type BuyerDisputeExpiry
- type BuyerDisputeTimeout
- type Case
- type CaseStore
- type ChatConversation
- type ChatMessage
- type ChatMessageNotification
- func (n ChatMessageNotification) Data() ([]byte, error)
- func (n ChatMessageNotification) GetID() string
- func (n ChatMessageNotification) GetSMTPTitleAndBody() (string, string, bool)
- func (n ChatMessageNotification) GetType() NotificationType
- func (n ChatMessageNotification) WebsocketData() ([]byte, error)
- type ChatRead
- type ChatStore
- type ChatTyping
- type CheckoutBreakdown
- type CheckoutCurrency
- type CheckoutVariant
- type CompletionNotification
- func (n CompletionNotification) Data() ([]byte, error)
- func (n CompletionNotification) GetID() string
- func (n CompletionNotification) GetSMTPTitleAndBody() (string, string, bool)
- func (n CompletionNotification) GetType() NotificationType
- func (n CompletionNotification) WebsocketData() ([]byte, error)
- type Config
- type ConfigurationStore
- type Coupon
- type CouponStore
- type CurrencyCode
- type CurrencyConverter
- type CurrencyDefinition
- type CurrencyDictionary
- type CurrencyDictionaryProcessingError
- type CurrencyValue
- func NewCurrencyValue(amount string, currency CurrencyDefinition) (*CurrencyValue, error)
- func NewCurrencyValueFromBigInt(amt *big.Int, def CurrencyDefinition) *CurrencyValue
- func NewCurrencyValueFromInt(amount int64, currency CurrencyDefinition) (*CurrencyValue, error)
- func NewCurrencyValueFromProtobuf(amount string, currency *pb.CurrencyDefinition) (*CurrencyValue, error)
- func NewCurrencyValueFromUint(amount uint64, currency CurrencyDefinition) (*CurrencyValue, error)
- func NewCurrencyValueWithLookup(amount, currencyCode string) (*CurrencyValue, error)
- func (c *CurrencyValue) AddBigFloatProduct(factor *big.Float) *CurrencyValue
- func (c *CurrencyValue) AddBigInt(addend *big.Int) *CurrencyValue
- func (c *CurrencyValue) AdjustDivisibility(div uint) (*CurrencyValue, big.Accuracy, error)
- func (c *CurrencyValue) AmountBigInt() *big.Int
- func (c *CurrencyValue) AmountInt64() (int64, error)
- func (c *CurrencyValue) AmountString() string
- func (c *CurrencyValue) AmountUint64() (uint64, error)
- func (c *CurrencyValue) Cmp(other *CurrencyValue) (int, error)
- func (c *CurrencyValue) ConvertTo(final CurrencyDefinition, reserveConverter *CurrencyConverter) (*CurrencyValue, big.Accuracy, error)
- func (c *CurrencyValue) ConvertUsingProtobufDef(convertTo *pb.CurrencyDefinition, reserve *CurrencyConverter) (*CurrencyValue, big.Accuracy, error)
- func (c *CurrencyValue) Equal(other *CurrencyValue) bool
- func (c *CurrencyValue) IsNegative() bool
- func (c *CurrencyValue) IsPositive() bool
- func (c *CurrencyValue) IsZero() bool
- func (c *CurrencyValue) MarshalJSON() ([]byte, error)
- func (c *CurrencyValue) MulBigFloat(factor *big.Float) (*CurrencyValue, big.Accuracy)
- func (c *CurrencyValue) MulBigInt(factor *big.Int) *CurrencyValue
- func (c *CurrencyValue) Normalize() (*CurrencyValue, error)
- func (c *CurrencyValue) String() string
- func (c *CurrencyValue) SubBigInt(subtrahend *big.Int) *CurrencyValue
- func (c *CurrencyValue) UnmarshalJSON(b []byte) error
- func (c *CurrencyValue) Valid() error
- type Datastore
- type DisputeAcceptedNotification
- func (n DisputeAcceptedNotification) Data() ([]byte, error)
- func (n DisputeAcceptedNotification) GetID() string
- func (n DisputeAcceptedNotification) GetSMTPTitleAndBody() (string, string, bool)
- func (n DisputeAcceptedNotification) GetType() NotificationType
- func (n DisputeAcceptedNotification) WebsocketData() ([]byte, error)
- type DisputeCaseRecord
- func (r *DisputeCaseRecord) BuildModeratorDisputeExpiryFirstNotification(createdAt time.Time) *Notification
- func (r *DisputeCaseRecord) BuildModeratorDisputeExpiryLastNotification(createdAt time.Time) *Notification
- func (r *DisputeCaseRecord) BuildModeratorDisputeExpirySecondNotification(createdAt time.Time) *Notification
- func (r *DisputeCaseRecord) BuildModeratorDisputeExpiryThirdNotification(createdAt time.Time) *Notification
- func (r *DisputeCaseRecord) Contract() *pb.RicardianContract
- func (r *DisputeCaseRecord) IsExpired(when time.Time) bool
- func (r *DisputeCaseRecord) IsExpiredNow() bool
- func (r *DisputeCaseRecord) ResolutionPaymentContract(ratio PayoutRatio) (contract *pb.RicardianContract)
- func (r *DisputeCaseRecord) ResolutionPaymentFeePerByte(ratio PayoutRatio, defaultFee big.Int) *big.Int
- func (r *DisputeCaseRecord) ResolutionPaymentOutpoints(ratio PayoutRatio) (outpoints []*pb.Outpoint)
- type DisputeCloseNotification
- func (n DisputeCloseNotification) Data() ([]byte, error)
- func (n DisputeCloseNotification) GetID() string
- func (n DisputeCloseNotification) GetSMTPTitleAndBody() (string, string, bool)
- func (n DisputeCloseNotification) GetType() NotificationType
- func (n DisputeCloseNotification) WebsocketData() ([]byte, error)
- type DisputeOpenNotification
- func (n DisputeOpenNotification) Data() ([]byte, error)
- func (n DisputeOpenNotification) GetID() string
- func (n DisputeOpenNotification) GetSMTPTitleAndBody() (string, string, bool)
- func (n DisputeOpenNotification) GetType() NotificationType
- func (n DisputeOpenNotification) WebsocketData() ([]byte, error)
- type DisputeUpdateNotification
- func (n DisputeUpdateNotification) Data() ([]byte, error)
- func (n DisputeUpdateNotification) GetID() string
- func (n DisputeUpdateNotification) GetSMTPTitleAndBody() (string, string, bool)
- func (n DisputeUpdateNotification) GetType() NotificationType
- func (n DisputeUpdateNotification) WebsocketData() ([]byte, error)
- type ErrCryptocurrencyListingIllegalField
- type ErrCryptocurrencyPurchaseIllegalField
- type ErrMarketPriceListingIllegalField
- type ErrPriceModifierOutOfRange
- type FollowNotification
- type Follower
- type FollowerStore
- type FollowingStore
- type FulfillmentNotification
- func (n FulfillmentNotification) Data() ([]byte, error)
- func (n FulfillmentNotification) GetID() string
- func (n FulfillmentNotification) GetSMTPTitleAndBody() (string, string, bool)
- func (n FulfillmentNotification) GetType() NotificationType
- func (n FulfillmentNotification) WebsocketData() ([]byte, error)
- type GroupChatMessage
- type IncomingTransaction
- type IndividualListingContainer
- type InventoryStore
- type Item
- type KeyStore
- type Listing
- func CreateListing(r []byte, isTestnet bool, dstore *Datastore, repoPath string) (Listing, error)
- func NewListingFromProtobuf(l *pb.Listing) (*Listing, error)
- func UnmarshalJSONListing(data []byte) (*Listing, error)
- func UpdateListing(r []byte, isTestnet bool, dstore *Datastore, repoPath string) (Listing, error)
- func (l *Listing) GetAcceptedCurrencies() []string
- func (l *Listing) GetCategories() []string
- func (l *Listing) GetCondition() string
- func (l *Listing) GetContractType() string
- func (l *Listing) GetCoupons() (ListingCoupons, error)
- func (l *Listing) GetCryptoCurrencyCode() string
- func (l *Listing) GetCryptoDivisibility() uint32
- func (l *Listing) GetDescription() string
- func (l *Listing) GetEscrowTimeoutHours() uint32
- func (l *Listing) GetFormat() string
- func (l *Listing) GetImages() []*ListingImage
- func (l *Listing) GetInventory() (map[int]*big.Int, error)
- func (l *Listing) GetLanguage() string
- func (l *Listing) GetModerators() []string
- func (l *Listing) GetNsfw() bool
- func (l *Listing) GetPrice() (*CurrencyValue, error)
- func (l *Listing) GetPriceModifier() float32
- func (l *Listing) GetProcessingTime() string
- func (l *Listing) GetProtobuf() *pb.Listing
- func (l *Listing) GetRefundPolicy() string
- func (l *Listing) GetShippingOptions() ([]*pb.Listing_ShippingOption, error)
- func (l *Listing) GetShippingRegions() ([]string, []string)
- func (l *Listing) GetShortDescription() string
- func (l *Listing) GetSkus() ([]*pb.Listing_Item_Sku, error)
- func (l *Listing) GetSlug() string
- func (l *Listing) GetTags() []string
- func (l *Listing) GetTaxes() ListingTaxes
- func (l *Listing) GetTermsAndConditions() string
- func (l *Listing) GetTitle() string
- func (l *Listing) GetVendorID() *PeerInfo
- func (l *Listing) GetVersion() uint32
- func (l *Listing) GetWeightGrams() float32
- func (l *Listing) MarshalJSON() ([]byte, error)
- func (l *Listing) MarshalProtobuf() ([]byte, error)
- func (l *Listing) Normalize() (*Listing, error)
- func (*Listing) ProtoMessage()
- func (l *Listing) Reset()
- func (l *Listing) SetAcceptedCurrencies(codes ...string) error
- func (l *Listing) SetCryptocurrencyListingDefaults() error
- func (l *Listing) SetModerators(mods []string) error
- func (l *Listing) SetPrices(percentage float64) error
- func (l *Listing) SetRefundPolicy(refundPolicy string)
- func (l *Listing) SetShippingOptions(shippingDetails []*pb.Listing_ShippingOption)
- func (l *Listing) SetTermsAndConditions(termsAndConditions string)
- func (l *Listing) Sign(n listingSigner) (*SignedListing, error)
- func (l *Listing) String() string
- func (l *Listing) UpdateCouponsFromDatastore(cdb couponGetter) error
- func (l *Listing) ValidateCryptoListing() error
- func (l *Listing) ValidateListing(testnet bool) (err error)
- func (l *Listing) ValidatePurchaseItemOptions(itemOptions []option) error
- func (l *Listing) ValidateSkus() error
- type ListingCoupon
- func (c *ListingCoupon) GetAmountOff() *CurrencyValue
- func (c *ListingCoupon) GetListingSlug() string
- func (c *ListingCoupon) GetPercentOff() float32
- func (c *ListingCoupon) GetRedemptionCode() (string, error)
- func (c *ListingCoupon) GetRedemptionHash() (string, error)
- func (c *ListingCoupon) GetTitle() string
- func (c *ListingCoupon) SetRedemptionCode(code string) error
- type ListingCoupons
- type ListingImage
- func (i *ListingImage) GetFilename() string
- func (i *ListingImage) GetLarge() string
- func (i *ListingImage) GetMedium() string
- func (i *ListingImage) GetOriginal() string
- func (i *ListingImage) GetSmall() string
- func (i *ListingImage) GetTiny() string
- func (i *ListingImage) SetLarge(cid string) error
- func (i *ListingImage) SetMedium(cid string) error
- func (i *ListingImage) SetOriginal(cid string) error
- func (i *ListingImage) SetSmall(cid string) error
- func (i *ListingImage) SetTiny(cid string) error
- func (i *ListingImage) String() string
- type ListingIndexData
- type ListingMetadata
- type ListingPrice
- type ListingTax
- type ListingTaxes
- type ListingThumbnail
- type Message
- type MessageStore
- type Metadata
- type Migration
- type ModeratedStore
- type ModeratorAddNotification
- func (n ModeratorAddNotification) Data() ([]byte, error)
- func (n ModeratorAddNotification) GetID() string
- func (n ModeratorAddNotification) GetSMTPTitleAndBody() (string, string, bool)
- func (n ModeratorAddNotification) GetType() NotificationType
- func (n ModeratorAddNotification) WebsocketData() ([]byte, error)
- type ModeratorDisputeExpiry
- func (n ModeratorDisputeExpiry) Data() ([]byte, error)
- func (n ModeratorDisputeExpiry) GetID() string
- func (n ModeratorDisputeExpiry) GetSMTPTitleAndBody() (string, string, bool)
- func (n ModeratorDisputeExpiry) GetType() NotificationType
- func (n ModeratorDisputeExpiry) WebsocketData() ([]byte, error)
- type ModeratorRemoveNotification
- func (n ModeratorRemoveNotification) Data() ([]byte, error)
- func (n ModeratorRemoveNotification) GetID() string
- func (n ModeratorRemoveNotification) GetSMTPTitleAndBody() (string, string, bool)
- func (n ModeratorRemoveNotification) GetType() NotificationType
- func (n ModeratorRemoveNotification) WebsocketData() ([]byte, error)
- type Notification
- func (n *Notification) Data() ([]byte, error)
- func (n *Notification) GetID() string
- func (n *Notification) GetSMTPTitleAndBody() (string, string, bool)
- func (n *Notification) GetType() NotificationType
- func (n *Notification) GetTypeString() string
- func (n *Notification) GetUnixCreatedAt() int
- func (n *Notification) MarshalJSON() ([]byte, error)
- func (n *Notification) UnmarshalJSON(data []byte) error
- func (n *Notification) WebsocketData() ([]byte, error)
- type NotificationStore
- type NotificationType
- type Notifier
- type OfflineMessageStore
- type OrderCancelNotification
- func (n OrderCancelNotification) Data() ([]byte, error)
- func (n OrderCancelNotification) GetID() string
- func (n OrderCancelNotification) GetSMTPTitleAndBody() (string, string, bool)
- func (n OrderCancelNotification) GetType() NotificationType
- func (n OrderCancelNotification) WebsocketData() ([]byte, error)
- type OrderConfirmationNotification
- func (n OrderConfirmationNotification) Data() ([]byte, error)
- func (n OrderConfirmationNotification) GetID() string
- func (n OrderConfirmationNotification) GetSMTPTitleAndBody() (string, string, bool)
- func (n OrderConfirmationNotification) GetType() NotificationType
- func (n OrderConfirmationNotification) WebsocketData() ([]byte, error)
- type OrderDeclinedNotification
- func (n OrderDeclinedNotification) Data() ([]byte, error)
- func (n OrderDeclinedNotification) GetID() string
- func (n OrderDeclinedNotification) GetSMTPTitleAndBody() (string, string, bool)
- func (n OrderDeclinedNotification) GetType() NotificationType
- func (n OrderDeclinedNotification) WebsocketData() ([]byte, error)
- type OrderMessage
- type OrderNotification
- type OrderNotificationV4
- type PaymentNotification
- type PayoutRatio
- type PeerInfo
- func (p *PeerInfo) BitcoinKey() []byte
- func (p *PeerInfo) BitcoinSignature() []byte
- func (p *PeerInfo) Equal(other *PeerInfo) bool
- func (p *PeerInfo) GeneratePeerIDFromIdentityKey() (string, error)
- func (p *PeerInfo) Handle() string
- func (p *PeerInfo) Hash() (string, error)
- func (p *PeerInfo) IdentityKey() (ipfs.PubKey, error)
- func (p *PeerInfo) IdentityKeyBytes() []byte
- func (p *PeerInfo) Protobuf() *pb.ID
- func (p *PeerInfo) String() string
- func (p *PeerInfo) Valid() error
- func (p *PeerInfo) VerifyBitcoinSignature() error
- func (p *PeerInfo) VerifyIdentity() error
- type PeerKeychain
- type PointerStore
- type PremarshalledNotifier
- type ProcessingErrorNotification
- func (n ProcessingErrorNotification) Data() ([]byte, error)
- func (n ProcessingErrorNotification) GetID() string
- func (n ProcessingErrorNotification) GetSMTPTitleAndBody() (string, string, bool)
- func (n ProcessingErrorNotification) GetType() NotificationType
- func (n ProcessingErrorNotification) WebsocketData() ([]byte, error)
- type Profile
- func (p *Profile) DisableModeration() error
- func (p *Profile) GetModeratedFixedFee() (*CurrencyValue, error)
- func (p *Profile) GetProtobuf() *pb.Profile
- func (p *Profile) GetVersion() uint32
- func (p *Profile) IsModerationEnabled() bool
- func (p *Profile) NormalizeDataForAllSchemas() *Profile
- func (p *Profile) SetModeratorFixedFee(fee *CurrencyValue) error
- func (p *Profile) SetModeratorFixedPlusPercentageFee(fee *CurrencyValue, percentage float32) error
- func (p *Profile) SetModeratorPercentageFee(percentage float32) error
- func (p *Profile) Valid() error
- type Purchase
- type PurchaseData
- type PurchaseRecord
- func (r *PurchaseRecord) BuildBuyerDisputeExpiryFirstNotification(createdAt time.Time) *Notification
- func (r *PurchaseRecord) BuildBuyerDisputeExpiryLastNotification(createdAt time.Time) *Notification
- func (r *PurchaseRecord) BuildBuyerDisputeExpirySecondNotification(createdAt time.Time) *Notification
- func (r *PurchaseRecord) BuildBuyerDisputeTimeoutFirstNotification(createdAt time.Time) *Notification
- func (r *PurchaseRecord) BuildBuyerDisputeTimeoutLastNotification(createdAt time.Time) *Notification
- func (r *PurchaseRecord) BuildBuyerDisputeTimeoutSecondNotification(createdAt time.Time) *Notification
- func (r *PurchaseRecord) BuildBuyerDisputeTimeoutThirdNotification(createdAt time.Time) *Notification
- func (r *PurchaseRecord) IsDisputeable() bool
- type PurchaseStore
- type Queryable
- type RefundNotification
- type SMTPSettings
- type Sale
- type SaleRecord
- type SaleStore
- type SettingsData
- type ShippingAddress
- type SignedListing
- func (l SignedListing) GetAcceptedCurrencies() []string
- func (l SignedListing) GetCryptoCurrencyCode() string
- func (l SignedListing) GetCryptoDivisibility() uint32
- func (l SignedListing) GetListing() *Listing
- func (l SignedListing) GetListingSigProtobuf() *pb.Signature
- func (l SignedListing) GetPrice() (*CurrencyValue, error)
- func (l SignedListing) GetSignature() []byte
- func (l SignedListing) GetSlug() string
- func (l SignedListing) GetTitle() string
- func (l SignedListing) GetVendorID() *PeerInfo
- func (l SignedListing) GetVersion() uint32
- func (l SignedListing) MarshalJSON() ([]byte, error)
- func (l *SignedListing) Normalize() error
- func (*SignedListing) ProtoMessage()
- func (l *SignedListing) Reset()
- func (l *SignedListing) String() string
- func (l SignedListing) ValidateListing(isTestnet bool) error
- func (l SignedListing) VerifySignature() error
- type SpentTransactionOutputStore
- type StatusNotification
- type TestNotification
- type Thumbnail
- type TransactionMetadataStore
- type TransactionStore
- type UnfollowNotification
- type UnfundedOrder
- type UnspentTransactionOutputStore
- type VendorDisputeTimeout
- type VendorFinalizedPayment
- func (n VendorFinalizedPayment) Data() ([]byte, error)
- func (n VendorFinalizedPayment) GetID() string
- func (n VendorFinalizedPayment) GetSMTPTitleAndBody() (string, string, bool)
- func (n VendorFinalizedPayment) GetType() NotificationType
- func (n VendorFinalizedPayment) WebsocketData() ([]byte, error)
- type WatchedScriptStore
Constants ¶
const ( // Number of hours after purchase before a dispute may no longer be opened DisputeOptionTimeoutHours int = 45 * 24 // Number of hours after dispute begins before it is resolved automatically DisputeTotalDurationHours int = 45 * 24 NotifierTypeBuyerDisputeTimeout NotificationType = "buyerDisputeTimeout" NotifierTypeBuyerDisputeExpiry NotificationType = "buyerDisputeExpiry" NotifierTypeChatMessage NotificationType = "chatMessage" NotifierTypeChatRead NotificationType = "chatRead" NotifierTypeChatTyping NotificationType = "chatTyping" NotifierTypeCompletionNotification NotificationType = "orderComplete" NotifierTypeDisputeAcceptedNotification NotificationType = "disputeAccepted" NotifierTypeDisputeCloseNotification NotificationType = "disputeClose" NotifierTypeDisputeOpenNotification NotificationType = "disputeOpen" NotifierTypeDisputeUpdateNotification NotificationType = "disputeUpdate" NotifierTypeFindModeratorResponse NotificationType = "findModeratorResponse" NotifierTypeFollowNotification NotificationType = "follow" NotifierTypeFulfillmentNotification NotificationType = "fulfillment" NotifierTypeIncomingTransaction NotificationType = "incomingTransaction" NotifierTypeModeratorAddNotification NotificationType = "moderatorAdd" NotifierTypeModeratorDisputeExpiry NotificationType = "moderatorDisputeExpiry" NotifierTypeModeratorRemoveNotification NotificationType = "moderatorRemove" NotifierTypeOrderCancelNotification NotificationType = "cancel" NotifierTypeOrderConfirmationNotification NotificationType = "orderConfirmation" NotifierTypeOrderDeclinedNotification NotificationType = "orderDeclined" NotifierTypeOrderNewNotification NotificationType = "order" NotifierTypePaymentNotification NotificationType = "payment" NotifierTypePremarshalledNotifier NotificationType = "premarshalledNotifier" NotifierTypeProcessingErrorNotification NotificationType = "processingError" NotifierTypeRefundNotification NotificationType = "refund" NotifierTypeStatusUpdateNotification NotificationType = "statusUpdate" NotifierTypeTestNotification NotificationType = "testNotification" NotifierTypeUnfollowNotification NotificationType = "unfollow" NotifierTypeVendorDisputeTimeout NotificationType = "vendorDisputeTimeout" NotifierTypeVendorFinalizedPayment NotificationType = "vendorFinalizedPayment" )
const ( CurrencyCodeValidMinimumLength = 3 CurrencyCodeValidMaximumLength = 4 )
const ( Fiat = "fiat" Crypto = "crypto" DefaultCryptoDivisibility = 8 NilCurrencyCode = CurrencyCode("") DefaultBlockTime = 10 * time.Minute )
const ( // ListingVersion - current listing version ListingVersion = 5 // 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 // DefaultEscrowTimeout - escrow timeout in hours DefaultEscrowTimeout = 1080 // SlugBuffer - buffer size for slug SlugBuffer = 5 // PriceModifierMin - min price modifier PriceModifierMin = -99.99 // PriceModifierMax = max price modifier PriceModifierMax = 1000.00 )
const JSONAPITimeFormat = `"2006-01-02T15:04:05.999999999Z07:00"` // time.RFC3339Nano
const RepoVersion = "34"
Variables ¶
var ( ErrCurrencyValueInsufficientPrecision = errors.New("unable to accurately represent value as int64") ErrCurrencyValueNegativeRate = errors.New("conversion rate must be greater than zero") ErrCurrencyValueAmountInvalid = errors.New("invalid amount") ErrCurrencyValueDefinitionInvalid = errors.New("invalid currency definition") ErrCurrencyValueInvalidCmpDifferentCurrencies = errors.New("unable to compare two different currencies") )
var ( ErrCurrencyCodeLengthInvalid = errors.New("invalid length for currency code, must be three characters or four characters and begin with a 'T'") ErrCurrencyCodeTestSymbolInvalid = errors.New("invalid test indicator for currency code, four characters must begin with a 'T'") ErrCurrencyDefinitionUndefined = errors.New("unknown currency") ErrCurrencyTypeInvalid = errors.New("currency type must be crypto or fiat") ErrCurrencyDivisibilityNonPositive = errors.New("currency divisibility most be greater than zero") ErrDictionaryIndexMismatchedCode = errors.New("dictionary index mismatched with definition currency code") ErrDictionaryCurrencyCodeCollision = errors.New("currency code is used by more than one currency") NilCurrencyDefinition = CurrencyDefinition{Name: "", Code: NilCurrencyCode, Divisibility: 0, CurrencyType: "", BlockTime: 0 * time.Second} )
var ( ModeratorDisputeExpiry_firstInterval = time.Duration(15*24) * time.Hour ModeratorDisputeExpiry_secondInterval = time.Duration(30*24) * time.Hour ModeratorDisputeExpiry_thirdInterval = time.Duration(44*24) * time.Hour ModeratorDisputeExpiry_lastInterval = time.Duration(45*24) * time.Hour )
var ( // ErrCryptocurrencySkuQuantityInvalid - invalid sku qty err ErrCryptocurrencySkuQuantityInvalid = errors.New("cryptocurrency listing quantity must be a non-negative integer") // ErrListingCryptoDivisibilityInvalid indicates the given divisibility doesn't match the default ErrListingCryptoDivisibilityInvalid = errors.New("invalid cryptocurrency divisibility") // ErrListingCryptoCurrencyCodeInvalid indicates the given code isn't valid or known ErrListingCryptoCurrencyCodeInvalid = errors.New("invalid cryptocurrency code") ErrShippingRegionMustBeSet = errors.New("shipping region must be set") ErrShippingRegionUndefined = errors.New("undefined shipping region") ErrShippingRegionMustNotBeContinent = errors.New("cannot specify continent as shipping region") // ErrListingDoesNotExist - non-existent listing err ErrListingDoesNotExist = errors.New("listing doesn't exist") // ErrListingAlreadyExists - duplicate listing err ErrListingAlreadyExists = errors.New("listing already exists") )
var ( ErrUnknownSchema = errors.New("unable to migrate unknown schema") Migrations = []Migration{ migrations.Migration000{}, migrations.Migration001{}, migrations.Migration002{}, migrations.Migration003{}, migrations.Migration004{}, migrations.Migration005{}, migrations.Migration006{}, migrations.Migration007{}, migrations.Migration008{}, migrations.Migration009{}, migrations.Migration010{}, migrations.Migration011{}, migrations.Migration012{}, migrations.Migration013{}, migrations.Migration014{}, migrations.Migration015{}, migrations.Migration016{}, migrations.Migration017{}, migrations.Migration018{}, migrations.Migration019{}, migrations.Migration020{}, migrations.Migration021{}, migrations.Migration022{}, migrations.Migration023{}, migrations.Migration024{}, migrations.Migration025{}, migrations.Migration026{}, migrations.Migration027{}, migrations.Migration028{}, migrations.Migration029{}, migrations.Migration030{}, migrations.Migration031{}, migrations.Migration032{}, migrations.Migration033{}, } )
var ( ErrInvalidInlinePeerID = errors.New("inline hash does not match produced hash") ErrPeerInfoIsNil = errors.New("peer info is nil") )
var ( // ErrModeratorInfoMissing indicates when the moderator information is // missing while also indicating they are a moderator ErrModeratorInfoMissing = errors.New("moderator is enabled but information is missing") // ErrMissingModeratorFee indicates the fee schedule is missing ErrMissingModeratorFee = errors.New("moderator info is missing fee schedule") // ErrUnknownModeratorFeeType indicates the feeType is unknown ErrUnknownModeratorFeeType = errors.New("moderator fee type is unknown") // ErrModeratorFeeHasNegativePercentage indicates when the percentage is non-positive but should be ErrModeratorFeeHasNegativePercentage = errors.New("percentage moderator fee should not be negative") // ErrFixedFeeHasNonZeroPercentage indicates when the percentage is not zero but should be ErrFixedFeeHasNonZeroPercentage = errors.New("fixed moderator fee should have a zero percentage amount") // ErrPercentageFeeHasFixedFee indicates that a fixed fee is included when there should not be ErrPercentageFeeHasFixedFee = fmt.Errorf("percentage moderator fee should not include a fixed fee or should use (%s) feeType", pb.Moderator_Fee_FIXED_PLUS_PERCENTAGE.String()) // ErrModeratorFixedFeeIsMissing indicates when the fixed fee is missing ErrModeratorFixedFeeIsMissing = fmt.Errorf("fixed moderator fee is missing or should use (%s) feeType", pb.Moderator_Fee_PERCENTAGE.String()) // ErrModeratorFixedFeeAmountIsEmpty indicates the fee is defined with an empty amount ErrModeratorFixedFeeAmountIsEmpty = errors.New("fixed moderator fee amount is missing or not a parseable number") // ErrModeratorFixedFeeIsNegative indicates that the fixed fee is non-positive ErrModeratorFixedFeeIsNegative = errors.New("fixed moderator fee is negative or not a parsable number") )
var ( BuyerDisputeTimeout_firstInterval = time.Duration(15*24) * time.Hour BuyerDisputeTimeout_secondInterval = time.Duration(40*24) * time.Hour BuyerDisputeTimeout_thirdInterval = time.Duration(44*24) * time.Hour BuyerDisputeTimeout_lastInterval = time.Duration(45*24) * time.Hour BuyerDisputeTimeout_totalDuration = time.Duration(DisputeOptionTimeoutHours) * time.Hour BuyerDisputeExpiry_firstInterval = time.Duration(15*24) * time.Hour BuyerDisputeExpiry_secondInterval = time.Duration(40*24) * time.Hour BuyerDisputeExpiry_lastInterval = time.Duration(44*24) * time.Hour BuyerDisputeExpiry_totalDuration = time.Duration(DisputeTotalDurationHours) * time.Hour )
var ( // ErrPriceCalculationRequiresExchangeRates - exchange rates dependency err ErrPriceCalculationRequiresExchangeRates = errors.New("can't calculate price with exchange rates disabled") )
var ErrRepoExists = errors.New("IPFS configuration file exists. Reinitializing would overwrite your keys. Use -f to force overwrite.")
var ErrUnknownAPITimeFormat = errors.New("unknown api time format")
var ErrUnknownMessage = errors.New("unknown or invalid message")
ErrUnknownMessage - notify an invalid message
var (
VendorDisputeTimeout_lastInterval = time.Duration(45*24) * time.Hour
)
Functions ¶
func CreateSlugFor ¶ added in v0.14.0
CreateSlugFor Create a slug from a multi-lang string
func ExtractIDFromListing ¶ added in v0.14.0
ExtractIDFromListing returns pb.ID of the listing
func ExtractVersionFromSignedListing ¶ added in v0.14.0
ExtractVersion returns the version of the listing
func GenerateSlug ¶ added in v0.14.0
GenerateSlug - slugify the title of the listing
func GetListingFromSlug ¶ added in v0.14.0
func GetListingFromSlug(slug, repoPath string, isTestnet bool, dStore *Datastore) (*pb.SignedListing, error)
GetListingFromSlug - fetch listing for the specified slug
func GetObjectFromIPFS ¶ added in v0.12.0
func GetObjectFromIPFS(n *core.IpfsNode, p peer.ID, name string, maxCacheLen time.Duration) ([]byte, error)
GetObjectFromIPFS gets the requested name from ipfs or the local cache
func GetPathForListingSlug ¶ added in v0.14.0
func GetRepoPath ¶ added in v0.9.4
GetRepoPath returns the directory to store repo data in.
func MigrateUp ¶ added in v0.9.2
MigrateUp looks at the currently active migration version and will migrate all the way up (applying all up migrations).
func NewNotificationID ¶ added in v0.12.1
func NewNotificationID() string
func ToHtmlEntities ¶ added in v0.14.0
func ToV5Dispute ¶ added in v0.14.0
ToV5Dispute scans through the dispute looking for any deprecated fields and turns them into their v5 counterpart.
func ToV5DisputeResolution ¶ added in v0.14.0
func ToV5DisputeResolution(disputeResolution *pb.DisputeResolution) *pb.DisputeResolution
ToV5DisputeResolution scans through the dispute resolution looking for any deprecated fields and turns them into their v5 counterpart.
func ToV5Order ¶ added in v0.14.0
func ToV5Order(order *pb.Order, lookupFunc func(currencyCode string) (CurrencyDefinition, error)) (*pb.Order, error)
ToV5Order scans through the order looking for any deprecated fields and turns them into their v5 counterpart.
func ToV5OrderConfirmation ¶ added in v0.14.0
func ToV5OrderConfirmation(orderConfirmation *pb.OrderConfirmation) *pb.OrderConfirmation
ToV5OrderConfirmation scans through the order confirmation looking for any deprecated fields and turns them into their v5 counterpart.
func ToV5OrderFulfillment ¶ added in v0.14.0
func ToV5OrderFulfillment(orderFulfillment *pb.OrderFulfillment) *pb.OrderFulfillment
ToV5OrderFulfillment scans through the order fulfillment looking for any deprecated fields and turns them into their v5 counterpart.
func ToV5Refund ¶ added in v0.14.0
ToV5Refund scans through the refund looking for any deprecated fields and turns them into their v5 counterpart.
func ValidateListingOptions ¶ added in v0.14.0
func ValidateListingOptions(listingItemOptions []*pb.Listing_Item_Option, itemOptions []option) ([]*pb.Order_Item_Option, error)
ValidateListingOptions is a helper to ensure item options are valid
func ValidateShippingRegion ¶ added in v0.14.0
func ValidateShippingRegion(shippingOption *pb.Listing_ShippingOption) error
ValidateShippingRegion ensures shipping options are valid
Types ¶
type APITime ¶ added in v0.13.5
func NewAPITime ¶ added in v0.13.5
NewAPITime returns a pointer to a new APITime instance
func (APITime) MarshalJSON ¶ added in v0.13.5
func (*APITime) UnmarshalJSON ¶ added in v0.13.5
type BuyerDisputeExpiry ¶ added in v0.12.1
type BuyerDisputeExpiry struct { ID string `json:"notificationId"` Type NotificationType `json:"type"` OrderID string `json:"orderId"` ExpiresIn uint `json:"expiresIn"` Thumbnail Thumbnail `json:"thumbnail"` }
BuyerDisputeExpiry represents a notification about a purchase which has an open dispute that is expiring
func (BuyerDisputeExpiry) Data ¶ added in v0.12.1
func (n BuyerDisputeExpiry) Data() ([]byte, error)
func (BuyerDisputeExpiry) GetID ¶ added in v0.12.1
func (n BuyerDisputeExpiry) GetID() string
func (BuyerDisputeExpiry) GetSMTPTitleAndBody ¶ added in v0.12.1
func (n BuyerDisputeExpiry) GetSMTPTitleAndBody() (string, string, bool)
func (BuyerDisputeExpiry) GetType ¶ added in v0.12.1
func (n BuyerDisputeExpiry) GetType() NotificationType
func (BuyerDisputeExpiry) WebsocketData ¶ added in v0.12.1
func (n BuyerDisputeExpiry) WebsocketData() ([]byte, error)
type BuyerDisputeTimeout ¶ added in v0.12.1
type BuyerDisputeTimeout struct { ID string `json:"notificationId"` Type NotificationType `json:"type"` OrderID string `json:"orderId"` ExpiresIn uint `json:"expiresIn"` Thumbnail Thumbnail `json:"thumbnail"` }
BuyerDisputeTimeout represents a notification about a purchase which will soon be unable to dispute.
func (BuyerDisputeTimeout) Data ¶ added in v0.12.1
func (n BuyerDisputeTimeout) Data() ([]byte, error)
func (BuyerDisputeTimeout) GetID ¶ added in v0.12.1
func (n BuyerDisputeTimeout) GetID() string
func (BuyerDisputeTimeout) GetSMTPTitleAndBody ¶ added in v0.12.1
func (n BuyerDisputeTimeout) GetSMTPTitleAndBody() (string, string, bool)
func (BuyerDisputeTimeout) GetType ¶ added in v0.12.1
func (n BuyerDisputeTimeout) GetType() NotificationType
func (BuyerDisputeTimeout) WebsocketData ¶ added in v0.12.1
func (n BuyerDisputeTimeout) WebsocketData() ([]byte, error)
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 CurrencyValue `json:"total"` BuyerId string `json:"buyerId"` BuyerHandle string `json:"buyerHandle"` VendorId string `json:"vendorId"` VendorHandle string `json:"vendorHandle"` CoinType string `json:"coinType"` PaymentCoin string `json:"paymentCoin"` 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, paymentCoin string, coinType string) error // Save a new case PutRecord(*DisputeCaseRecord) 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) // GetByCaseID returns the dispute payout data for a case GetByCaseID(caseID string) (*DisputeCaseRecord, 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 // GetDisputesForDisputeExpiryNotification returns []*DisputeCaseRecord including // each record which needs Notifications to be generated. GetDisputesForDisputeExpiryNotification() ([]*DisputeCaseRecord, error) // UpdateDisputesLastDisputeExpiryNotifiedAt accepts []*DisputeCaseRecord and updates each records lastDisputeExpiryNotifiedAt by its CaseID UpdateDisputesLastDisputeExpiryNotifiedAt([]*DisputeCaseRecord) error }
type ChatConversation ¶ added in v0.3.1
type ChatMessage ¶ added in v0.3.1
type ChatMessageNotification ¶ added in v0.13.5
type ChatMessageNotification ChatMessage
ChatMessageNotification handles serialization of ChatMessages for notifications
func (ChatMessageNotification) Data ¶ added in v0.13.5
func (n ChatMessageNotification) Data() ([]byte, error)
func (ChatMessageNotification) GetID ¶ added in v0.13.5
func (n ChatMessageNotification) GetID() string
func (ChatMessageNotification) GetSMTPTitleAndBody ¶ added in v0.13.5
func (n ChatMessageNotification) GetSMTPTitleAndBody() (string, string, bool)
func (ChatMessageNotification) GetType ¶ added in v0.13.5
func (n ChatMessageNotification) GetType() NotificationType
func (ChatMessageNotification) WebsocketData ¶ added in v0.13.5
func (n ChatMessageNotification) WebsocketData() ([]byte, error)
type ChatRead ¶ added in v0.12.1
type ChatRead struct { MessageId string `json:"messageId"` PeerId string `json:"peerId"` Subject string `json:"subject"` }
func (ChatRead) GetSMTPTitleAndBody ¶ added in v0.12.1
func (ChatRead) GetType ¶ added in v0.12.1
func (n ChatRead) GetType() NotificationType
func (ChatRead) WebsocketData ¶ added in v0.12.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 ChatTyping ¶ added in v0.12.1
type ChatTyping struct { MessageId string `json:"messageId"` PeerId string `json:"peerId"` Subject string `json:"subject"` }
func (ChatTyping) Data ¶ added in v0.12.1
func (n ChatTyping) Data() ([]byte, error)
func (ChatTyping) GetID ¶ added in v0.12.1
func (n ChatTyping) GetID() string
func (ChatTyping) GetSMTPTitleAndBody ¶ added in v0.12.1
func (n ChatTyping) GetSMTPTitleAndBody() (string, string, bool)
func (ChatTyping) GetType ¶ added in v0.12.1
func (n ChatTyping) GetType() NotificationType
func (ChatTyping) WebsocketData ¶ added in v0.12.1
func (n ChatTyping) WebsocketData() ([]byte, error)
type CheckoutBreakdown ¶ added in v0.14.4
type CheckoutCurrency ¶ added in v0.14.4
type CheckoutVariant ¶ added in v0.14.4
type CompletionNotification ¶ added in v0.12.1
type CompletionNotification struct { ID string `json:"notificationId"` Type NotificationType `json:"type"` OrderId string `json:"orderId"` Thumbnail Thumbnail `json:"thumbnail"` BuyerHandle string `json:"buyerHandle"` BuyerID string `json:"buyerId"` }
func (CompletionNotification) Data ¶ added in v0.12.1
func (n CompletionNotification) Data() ([]byte, error)
func (CompletionNotification) GetID ¶ added in v0.12.1
func (n CompletionNotification) GetID() string
func (CompletionNotification) GetSMTPTitleAndBody ¶ added in v0.12.1
func (n CompletionNotification) GetSMTPTitleAndBody() (string, string, bool)
func (CompletionNotification) GetType ¶ added in v0.12.1
func (n CompletionNotification) GetType() NotificationType
func (CompletionNotification) WebsocketData ¶ added in v0.12.1
func (n CompletionNotification) WebsocketData() ([]byte, 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, bool, error) // Update mnemonic in database - used to encrypt / decrypt it UpdateMnemonic(string, bool) 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 CouponStore interface { Queryable // Put a list of coupons to the db Put(coupons []Coupon) error // Get a list of coupons given a slug Get(slug string) ([]Coupon, error) // Delete all coupons for a given slug Delete(slug string) error }
Coupons interface defines basic database operations for coupon information
type CurrencyCode ¶ added in v0.13.0
type CurrencyCode string
CurrencyCode is a string-based currency symbol
func (CurrencyCode) String ¶ added in v0.13.0
func (c CurrencyCode) String() string
String returns a readable representation of CurrencyCode
type CurrencyConverter ¶ added in v0.14.0
type CurrencyConverter struct {
// contains filtered or unexported fields
}
CurrencyConverter is suitable for converting a currency from one CurrencyDefinition to another, accounting for their differing divisibility as well as their differing exchange rate as provided by the rater. The rater can represent all rates for the reserve currency code provided.
func NewCurrencyConverter ¶ added in v0.14.0
func NewCurrencyConverter(reserveCode string, rater rater) (*CurrencyConverter, error)
NewCurrencyConverter returns a valid CurrencyConverter. The rater is verified by ensuring the rate of its reserveCode is 1.0 (ensuring it is equivalent to itself).
func NewEquivalentConverter ¶ added in v0.14.0
func NewEquivalentConverter() *CurrencyConverter
NewEquivalentConverter returns a currency converter where all rates are always returns as 1.0 making all currencies equivalent to one another
func (CurrencyConverter) GetFinalPrice ¶ added in v0.14.0
func (c CurrencyConverter) GetFinalPrice(originAmount *CurrencyValue, resultCurrency CurrencyDefinition) (*CurrencyValue, big.Accuracy, error)
GetFinalPrice returns the resulting CurrencyValue after converting the amount and divisibility of the originAmount to the target currency
type CurrencyDefinition ¶ added in v0.13.1
type CurrencyDefinition struct { // Name describes the colloquial term for the currency Name string `json:"name,omitempty"` // Code describes the currency as an uppercase string similar to ISO 4217 Code CurrencyCode `json:"code"` // Divisibility indicates the number of decimal places the currency can be divided in // base10. Ex: 8 suggests a maximum divisibility of 0.00000001 Divisibility uint `json:"divisibility"` // CurrencyType indicates whether the currency is "fiat" or "crypto" currency CurrencyType string `json:"currencyType,omitempty"` // BlockTime is the general/approximate duration for a block to be mined BlockTime time.Duration `json:"-"` }
CurrencyDefinition defines the characteristics of a currency
func NewUnknownCryptoDefinition ¶ added in v0.14.0
func NewUnknownCryptoDefinition(code string, div uint) CurrencyDefinition
NewUnknownCryptoDefinition returns a suitable crypto definition when one does not already exist in local dictionaries
func (CurrencyDefinition) ConfirmationsPerHour ¶ added in v0.14.0
func (c CurrencyDefinition) ConfirmationsPerHour() uint32
ConfirmationsPerHour will calculate the no of confirmations in 1 hr this is valid only for a crypto
func (CurrencyDefinition) CurrencyCode ¶ added in v0.13.1
func (c CurrencyDefinition) CurrencyCode() CurrencyCode
CurrencyCode returns the CurrencyCode of the definition
func (CurrencyDefinition) Equal ¶ added in v0.13.1
func (c CurrencyDefinition) Equal(other CurrencyDefinition) bool
Equal indicates if the receiver and other have the same code and divisibility
func (CurrencyDefinition) String ¶ added in v0.13.1
func (c CurrencyDefinition) String() string
String returns a readable representation of CurrencyDefinition
func (CurrencyDefinition) Valid ¶ added in v0.13.1
func (c CurrencyDefinition) Valid() error
Valid asserts that the CurrencyDefinition is either valid or has at least one error
type CurrencyDictionary ¶ added in v0.13.1
type CurrencyDictionary struct {
// contains filtered or unexported fields
}
CurrencyDictionary represents a collection of CurrencyDefinitions keyed by their CurrencyCode in string form
func AllCurrencies ¶ added in v0.14.0
func AllCurrencies() *CurrencyDictionary
AllCurrencies returns the singleton representing all known currency definitions
func FiatCurrencies ¶ added in v0.14.0
func FiatCurrencies() *CurrencyDictionary
FiatCurrencies returns the mainnet crypto currency definition singleton
func MainnetCurrencies ¶ added in v0.14.0
func MainnetCurrencies() *CurrencyDictionary
MainnetCurrencies returns the mainnet crypto currency definition singleton
func NewCurrencyDictionary ¶ added in v0.13.1
func NewCurrencyDictionary(defs map[string]CurrencyDefinition) (*CurrencyDictionary, error)
NewCurrencyDictionary returns a CurrencyDictionary for managing CurrencyDefinitions
func TestnetCurrencies ¶ added in v0.14.0
func TestnetCurrencies() *CurrencyDictionary
TestnetCurrencies returns the mainnet crypto currency definition singleton
func (CurrencyDictionary) AsMap ¶ added in v0.14.0
func (c CurrencyDictionary) AsMap() map[string]CurrencyDefinition
AsMap returns a cloned map of all known the definitions
func (CurrencyDictionary) Lookup ¶ added in v0.13.1
func (c CurrencyDictionary) Lookup(code string) (CurrencyDefinition, error)
Lookup returns the CurrencyDefinition out of the loaded dictionary. Lookup normalizes the code before lookup and recommends using CurrencyDefinition.CurrencyCode().String() from the response as a normalized code.
type CurrencyDictionaryProcessingError ¶ added in v0.13.1
CurrencyDictionaryProcessingError represents a list of errors after processing a CurrencyDictionary
func (CurrencyDictionaryProcessingError) All ¶ added in v0.14.0
func (c CurrencyDictionaryProcessingError) All() []string
func (CurrencyDictionaryProcessingError) Error ¶ added in v0.13.1
func (c CurrencyDictionaryProcessingError) Error() string
Error satisfies the Error interface without needing the process the set of errors
type CurrencyValue ¶ added in v0.13.1
type CurrencyValue struct { Amount *big.Int Currency CurrencyDefinition }
CurrencyValue represents the amount and variety of currency
func NewCurrencyValue ¶ added in v0.13.1
func NewCurrencyValue(amount string, currency CurrencyDefinition) (*CurrencyValue, error)
NewCurrencyValue accepts string amounts and currency codes, and creates a valid CurrencyValue
func NewCurrencyValueFromBigInt ¶ added in v0.14.0
func NewCurrencyValueFromBigInt(amt *big.Int, def CurrencyDefinition) *CurrencyValue
NewCurrencyValueFromBigInt is a convenience function which converts a big.Int and CurrencyDefinition into a new CurrencyValue
func NewCurrencyValueFromInt ¶ added in v0.13.1
func NewCurrencyValueFromInt(amount int64, currency CurrencyDefinition) (*CurrencyValue, error)
NewCurrencyValueFromInt is a convenience function which converts an int64 into a string and passes the arguments to NewCurrencyValue
func NewCurrencyValueFromProtobuf ¶ added in v0.14.0
func NewCurrencyValueFromProtobuf(amount string, currency *pb.CurrencyDefinition) (*CurrencyValue, error)
NewCurrencyValueFromProtobuf consumes the string and pb.CurrencyDefinition objects from parsed Listings and converts them into CurrencyValue objects
func NewCurrencyValueFromUint ¶ added in v0.13.1
func NewCurrencyValueFromUint(amount uint64, currency CurrencyDefinition) (*CurrencyValue, error)
NewCurrencyValueFromUint is a convenience function which converts an int64 into a string and passes the arguments to NewCurrencyValue
func NewCurrencyValueWithLookup ¶ added in v0.14.0
func NewCurrencyValueWithLookup(amount, currencyCode string) (*CurrencyValue, error)
NewCurrencyValueWithLookup accepts a string value as a base10 integer and uses the currency code to lookup the CurrencyDefinition
func (*CurrencyValue) AddBigFloatProduct ¶ added in v0.14.0
func (c *CurrencyValue) AddBigFloatProduct(factor *big.Float) *CurrencyValue
AddBigFloatProduct will add to itself the product of itself and the float argument and return the result
func (*CurrencyValue) AddBigInt ¶ added in v0.14.0
func (c *CurrencyValue) AddBigInt(addend *big.Int) *CurrencyValue
AddBigInt will add the addend to the amount and return the value sum
func (*CurrencyValue) AdjustDivisibility ¶ added in v0.14.0
func (c *CurrencyValue) AdjustDivisibility(div uint) (*CurrencyValue, big.Accuracy, error)
AdjustDivisibility updates the Currency.Divisibility and adjusts the Amount to match the new value. An error will be returned if the new divisibility is invalid or produces an unreliable result. This is a helper function which is equivalent to ConvertTo using a copy of the CurrencyDefinition using the updated divisibility and an exchangeRatio of 1.0
func (*CurrencyValue) AmountBigInt ¶ added in v0.14.0
func (c *CurrencyValue) AmountBigInt() *big.Int
AmountBigInt returns the big.Int representation of the amount
func (*CurrencyValue) AmountInt64 ¶ added in v0.13.1
func (c *CurrencyValue) AmountInt64() (int64, error)
AmountInt64 returns a valid int64 or an error
func (*CurrencyValue) AmountString ¶ added in v0.14.0
func (c *CurrencyValue) AmountString() string
AmountString returns the string representation of the amount
func (*CurrencyValue) AmountUint64 ¶ added in v0.13.1
func (c *CurrencyValue) AmountUint64() (uint64, error)
AmountUint64 returns a valid int64 or an error
func (*CurrencyValue) Cmp ¶ added in v0.14.0
func (c *CurrencyValue) Cmp(other *CurrencyValue) (int, error)
Cmp exposes the (*big.Int).Cmp behavior after verifying currency and adjusting for different currency divisibilities.
func (*CurrencyValue) ConvertTo ¶ added in v0.13.1
func (c *CurrencyValue) ConvertTo(final CurrencyDefinition, reserveConverter *CurrencyConverter) (*CurrencyValue, big.Accuracy, error)
ConvertTo will convert c.Amount into the final CurrencyDefinition through the reserve CurrencyConverter. As long as the provided reserveConverter has rates between the reserve currency and the current and final CurrencyDefintions, it will provide the result. Errors are raised if any rate is unavailable. The accuracy indicates if decimal values were trimmed when converting the value back to integer.
func (*CurrencyValue) ConvertUsingProtobufDef ¶ added in v0.14.0
func (c *CurrencyValue) ConvertUsingProtobufDef(convertTo *pb.CurrencyDefinition, reserve *CurrencyConverter) (*CurrencyValue, big.Accuracy, error)
ConvertUsingProtobufDef will use the currency code provided in pb.CurrencyDefinition to find the locally defined currency and exchange rate and will convert the amount into target currency. If the divisibility provided by the pb.CurrencyDefinition is different than the one provided for the exchange rate, the converted amount will be adjusted to match the provided divisibility.
func (*CurrencyValue) Equal ¶ added in v0.13.1
func (c *CurrencyValue) Equal(other *CurrencyValue) bool
Equal indicates if the amount and variety of currency is equivalent
func (*CurrencyValue) IsNegative ¶ added in v0.14.0
func (c *CurrencyValue) IsNegative() bool
IsNegative returns true if Amount is valid and less-than zero
func (*CurrencyValue) IsPositive ¶ added in v0.14.0
func (c *CurrencyValue) IsPositive() bool
IsPositive returns true if Amount is valid and greater-than zero
func (*CurrencyValue) IsZero ¶ added in v0.14.0
func (c *CurrencyValue) IsZero() bool
IsZero returns true if Amount is valid and equal to zero
func (*CurrencyValue) MarshalJSON ¶ added in v0.14.0
func (c *CurrencyValue) MarshalJSON() ([]byte, error)
func (*CurrencyValue) MulBigFloat ¶ added in v0.14.0
func (c *CurrencyValue) MulBigFloat(factor *big.Float) (*CurrencyValue, big.Accuracy)
MulBigFloat will multiple the amount and the factor and return the product result cast to a big.Int along with the big.Accuracy of the cast
func (*CurrencyValue) MulBigInt ¶ added in v0.14.0
func (c *CurrencyValue) MulBigInt(factor *big.Int) *CurrencyValue
MulBigInt will multiply the amount and the factor and return the product result
func (*CurrencyValue) Normalize ¶ added in v0.14.0
func (c *CurrencyValue) Normalize() (*CurrencyValue, error)
Normalize updates the CurrencyValue to match the divisibility of the locally defined CurrencyDefinition
func (*CurrencyValue) String ¶ added in v0.13.1
func (c *CurrencyValue) String() string
String returns a string representation of a CurrencyValue
func (*CurrencyValue) SubBigInt ¶ added in v0.14.0
func (c *CurrencyValue) SubBigInt(subtrahend *big.Int) *CurrencyValue
SubBigInt will subtract the subtrahend from the amount and return the value difference
func (*CurrencyValue) UnmarshalJSON ¶ added in v0.14.0
func (c *CurrencyValue) UnmarshalJSON(b []byte) error
func (*CurrencyValue) Valid ¶ added in v0.13.1
func (c *CurrencyValue) Valid() error
Valid returns an error if the CurrencyValue is invalid
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 Messages() MessageStore Ping() error Close() }
type DisputeAcceptedNotification ¶ added in v0.12.1
type DisputeAcceptedNotification struct { ID string `json:"notificationId"` Type NotificationType `json:"type"` OrderId string `json:"orderId"` Thumbnail Thumbnail `json:"thumbnail"` OherPartyID string `json:"otherPartyId"` OtherPartyHandle string `json:"otherPartyHandle"` Buyer string `json:"buyer"` }
func (DisputeAcceptedNotification) Data ¶ added in v0.12.1
func (n DisputeAcceptedNotification) Data() ([]byte, error)
func (DisputeAcceptedNotification) GetID ¶ added in v0.12.1
func (n DisputeAcceptedNotification) GetID() string
func (DisputeAcceptedNotification) GetSMTPTitleAndBody ¶ added in v0.12.1
func (n DisputeAcceptedNotification) GetSMTPTitleAndBody() (string, string, bool)
func (DisputeAcceptedNotification) GetType ¶ added in v0.12.1
func (n DisputeAcceptedNotification) GetType() NotificationType
func (DisputeAcceptedNotification) WebsocketData ¶ added in v0.12.1
func (n DisputeAcceptedNotification) WebsocketData() ([]byte, error)
type DisputeCaseRecord ¶ added in v0.12.1
type DisputeCaseRecord struct { CaseID string Claim string OrderState pb.OrderState Timestamp time.Time LastDisputeExpiryNotifiedAt time.Time BuyerContract *pb.RicardianContract BuyerOutpoints []*pb.Outpoint BuyerPayoutAddress string VendorContract *pb.RicardianContract VendorOutpoints []*pb.Outpoint VendorPayoutAddress string IsBuyerInitiated bool CoinType string PaymentCoin *CurrencyCode }
DisputeCaseRecord is a one-to-one relationship with records in the SQL datastore
func (*DisputeCaseRecord) BuildModeratorDisputeExpiryFirstNotification ¶ added in v0.12.1
func (r *DisputeCaseRecord) BuildModeratorDisputeExpiryFirstNotification(createdAt time.Time) *Notification
BuildModeratorDisputeExpiryFirstNotification returns a Notification with ExpiresIn set for the First Interval
func (*DisputeCaseRecord) BuildModeratorDisputeExpiryLastNotification ¶ added in v0.12.1
func (r *DisputeCaseRecord) BuildModeratorDisputeExpiryLastNotification(createdAt time.Time) *Notification
BuildModeratorDisputeExpiryLastNotification returns a Notification with ExpiresIn set for the Last Interval
func (*DisputeCaseRecord) BuildModeratorDisputeExpirySecondNotification ¶ added in v0.12.1
func (r *DisputeCaseRecord) BuildModeratorDisputeExpirySecondNotification(createdAt time.Time) *Notification
BuildModeratorDisputeExpirySecondNotification returns a Notification with ExpiresIn set for the Second Interval
func (*DisputeCaseRecord) BuildModeratorDisputeExpiryThirdNotification ¶ added in v0.12.1
func (r *DisputeCaseRecord) BuildModeratorDisputeExpiryThirdNotification(createdAt time.Time) *Notification
BuildModeratorDisputeExpiryThirdNotification returns a Notification with ExpiresIn set for the Third Interval
func (*DisputeCaseRecord) Contract ¶ added in v0.12.1
func (r *DisputeCaseRecord) Contract() *pb.RicardianContract
Contract returns the contract from the dispute if one has been supplied by either the buyer or vendor
func (*DisputeCaseRecord) IsExpired ¶ added in v0.12.1
func (r *DisputeCaseRecord) IsExpired(when time.Time) bool
IsExpired returns a bool indicating whether the case is still open
func (*DisputeCaseRecord) IsExpiredNow ¶ added in v0.12.1
func (r *DisputeCaseRecord) IsExpiredNow() bool
IsExpired returns a bool indicating whether the case is still open right now
func (*DisputeCaseRecord) ResolutionPaymentContract ¶ added in v0.12.4
func (r *DisputeCaseRecord) ResolutionPaymentContract(ratio PayoutRatio) (contract *pb.RicardianContract)
ResolutionPaymentContract returns the preferred contract to be used when resolving a pending DisputeCaseRecord based on the provided PayoutRatio
func (*DisputeCaseRecord) ResolutionPaymentFeePerByte ¶ added in v0.12.4
func (r *DisputeCaseRecord) ResolutionPaymentFeePerByte(ratio PayoutRatio, defaultFee big.Int) *big.Int
ResolutionPaymentFeePerByte returns the preferred outpoints to be used when resolving a pending DisputeCaseResolution based on the provided PayoutRatio
func (*DisputeCaseRecord) ResolutionPaymentOutpoints ¶ added in v0.12.4
func (r *DisputeCaseRecord) ResolutionPaymentOutpoints(ratio PayoutRatio) (outpoints []*pb.Outpoint)
ResolutionPaymentOutpoints returns the preferred outpoints to be used when resolving a pending DisputeCaseResolution based on the provided PayoutRatio
type DisputeCloseNotification ¶ added in v0.12.1
type DisputeCloseNotification struct { ID string `json:"notificationId"` Type NotificationType `json:"type"` OrderId string `json:"orderId"` Thumbnail Thumbnail `json:"thumbnail"` OtherPartyID string `json:"otherPartyId"` OtherPartyHandle string `json:"otherPartyHandle"` Buyer string `json:"buyer"` }
func (DisputeCloseNotification) Data ¶ added in v0.12.1
func (n DisputeCloseNotification) Data() ([]byte, error)
func (DisputeCloseNotification) GetID ¶ added in v0.12.1
func (n DisputeCloseNotification) GetID() string
func (DisputeCloseNotification) GetSMTPTitleAndBody ¶ added in v0.12.1
func (n DisputeCloseNotification) GetSMTPTitleAndBody() (string, string, bool)
func (DisputeCloseNotification) GetType ¶ added in v0.12.1
func (n DisputeCloseNotification) GetType() NotificationType
func (DisputeCloseNotification) WebsocketData ¶ added in v0.12.1
func (n DisputeCloseNotification) WebsocketData() ([]byte, error)
type DisputeOpenNotification ¶ added in v0.12.1
type DisputeOpenNotification struct { ID string `json:"notificationId"` Type NotificationType `json:"type"` OrderId string `json:"orderId"` Thumbnail Thumbnail `json:"thumbnail"` DisputerID string `json:"disputerId"` DisputerHandle string `json:"disputerHandle"` DisputeeID string `json:"disputeeId"` DisputeeHandle string `json:"disputeeHandle"` Buyer string `json:"buyer"` }
func (DisputeOpenNotification) Data ¶ added in v0.12.1
func (n DisputeOpenNotification) Data() ([]byte, error)
func (DisputeOpenNotification) GetID ¶ added in v0.12.1
func (n DisputeOpenNotification) GetID() string
func (DisputeOpenNotification) GetSMTPTitleAndBody ¶ added in v0.12.1
func (n DisputeOpenNotification) GetSMTPTitleAndBody() (string, string, bool)
func (DisputeOpenNotification) GetType ¶ added in v0.12.1
func (n DisputeOpenNotification) GetType() NotificationType
func (DisputeOpenNotification) WebsocketData ¶ added in v0.12.1
func (n DisputeOpenNotification) WebsocketData() ([]byte, error)
type DisputeUpdateNotification ¶ added in v0.12.1
type DisputeUpdateNotification struct { ID string `json:"notificationId"` Type NotificationType `json:"type"` OrderId string `json:"orderId"` Thumbnail Thumbnail `json:"thumbnail"` DisputerID string `json:"disputerId"` DisputerHandle string `json:"disputerHandle"` DisputeeID string `json:"disputeeId"` DisputeeHandle string `json:"disputeeHandle"` Buyer string `json:"buyer"` }
func (DisputeUpdateNotification) Data ¶ added in v0.12.1
func (n DisputeUpdateNotification) Data() ([]byte, error)
func (DisputeUpdateNotification) GetID ¶ added in v0.12.1
func (n DisputeUpdateNotification) GetID() string
func (DisputeUpdateNotification) GetSMTPTitleAndBody ¶ added in v0.12.1
func (n DisputeUpdateNotification) GetSMTPTitleAndBody() (string, string, bool)
func (DisputeUpdateNotification) GetType ¶ added in v0.12.1
func (n DisputeUpdateNotification) GetType() NotificationType
func (DisputeUpdateNotification) WebsocketData ¶ added in v0.12.1
func (n DisputeUpdateNotification) WebsocketData() ([]byte, error)
type ErrCryptocurrencyListingIllegalField ¶ added in v0.14.0
type ErrCryptocurrencyListingIllegalField string
ErrCryptocurrencyListingIllegalField - invalid field err
func (ErrCryptocurrencyListingIllegalField) Error ¶ added in v0.14.0
func (e ErrCryptocurrencyListingIllegalField) Error() string
type ErrCryptocurrencyPurchaseIllegalField ¶ added in v0.14.0
type ErrCryptocurrencyPurchaseIllegalField string
ErrCryptocurrencyPurchaseIllegalField - invalid purchase field err
func (ErrCryptocurrencyPurchaseIllegalField) Error ¶ added in v0.14.0
func (e ErrCryptocurrencyPurchaseIllegalField) Error() string
type ErrMarketPriceListingIllegalField ¶ added in v0.14.0
type ErrMarketPriceListingIllegalField string
ErrMarketPriceListingIllegalField - invalid listing field err
func (ErrMarketPriceListingIllegalField) Error ¶ added in v0.14.0
func (e ErrMarketPriceListingIllegalField) Error() string
type ErrPriceModifierOutOfRange ¶ added in v0.14.0
ErrPriceModifierOutOfRange - customize limits for price modifier
func (ErrPriceModifierOutOfRange) Error ¶ added in v0.14.0
func (e ErrPriceModifierOutOfRange) Error() string
type FollowNotification ¶ added in v0.12.1
type FollowNotification struct { ID string `json:"notificationId"` Type NotificationType `json:"type"` PeerId string `json:"peerId"` }
func (FollowNotification) Data ¶ added in v0.12.1
func (n FollowNotification) Data() ([]byte, error)
func (FollowNotification) GetID ¶ added in v0.12.1
func (n FollowNotification) GetID() string
func (FollowNotification) GetSMTPTitleAndBody ¶ added in v0.12.1
func (n FollowNotification) GetSMTPTitleAndBody() (string, string, bool)
func (FollowNotification) GetType ¶ added in v0.12.1
func (n FollowNotification) GetType() NotificationType
func (FollowNotification) WebsocketData ¶ added in v0.12.1
func (n FollowNotification) WebsocketData() ([]byte, error)
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 FulfillmentNotification ¶ added in v0.12.1
type FulfillmentNotification struct { ID string `json:"notificationId"` Type NotificationType `json:"type"` OrderId string `json:"orderId"` Thumbnail Thumbnail `json:"thumbnail"` VendorHandle string `json:"vendorHandle"` VendorID string `json:"vendorId"` }
func (FulfillmentNotification) Data ¶ added in v0.12.1
func (n FulfillmentNotification) Data() ([]byte, error)
func (FulfillmentNotification) GetID ¶ added in v0.12.1
func (n FulfillmentNotification) GetID() string
func (FulfillmentNotification) GetSMTPTitleAndBody ¶ added in v0.12.1
func (n FulfillmentNotification) GetSMTPTitleAndBody() (string, string, bool)
func (FulfillmentNotification) GetType ¶ added in v0.12.1
func (n FulfillmentNotification) GetType() NotificationType
func (FulfillmentNotification) WebsocketData ¶ added in v0.12.1
func (n FulfillmentNotification) WebsocketData() ([]byte, error)
type GroupChatMessage ¶ added in v0.6.0
type IncomingTransaction ¶ added in v0.12.1
type IncomingTransaction struct { Txid string `json:"txid"` Value *CurrencyValue `json:"value"` Address string `json:"address"` Status string `json:"status"` Memo string `json:"memo"` Timestamp time.Time `json:"timestamp"` Confirmations int32 `json:"confirmations"` OrderId string `json:"orderId"` Thumbnail string `json:"thumbnail"` Height int32 `json:"height"` CanBumpFee bool `json:"canBumpFee"` }
func (IncomingTransaction) Data ¶ added in v0.12.1
func (n IncomingTransaction) Data() ([]byte, error)
func (IncomingTransaction) GetID ¶ added in v0.12.1
func (n IncomingTransaction) GetID() string
func (IncomingTransaction) GetSMTPTitleAndBody ¶ added in v0.12.1
func (n IncomingTransaction) GetSMTPTitleAndBody() (string, string, bool)
func (IncomingTransaction) GetType ¶ added in v0.12.1
func (n IncomingTransaction) GetType() NotificationType
func (IncomingTransaction) WebsocketData ¶ added in v0.12.1
func (n IncomingTransaction) WebsocketData() ([]byte, error)
type IndividualListingContainer ¶ added in v0.14.0
type IndividualListingContainer struct {
Listing `json:"listing"`
}
IndividualListingContainer is a wrapper for a single listing
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 *big.Int) error // Return the count for a specific listing including variants GetSpecific(slug string, variantIndex int) (*big.Int, error) // Get the count for all variants of a given listing Get(slug string) (map[int]*big.Int, error) // Fetch all inventory maps for each slug GetAll() (map[string]map[int]*big.Int, 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 Item ¶ added in v0.14.0
type Item struct { ListingHash string `json:"listingHash"` Quantity string `json:"bigQuantity"` Options options `json:"options"` Shipping shippingOption `json:"shipping"` Memo string `json:"memo"` Coupons []string `json:"coupons"` PaymentAddress string `json:"paymentAddress"` }
Item represents a purchased item
type Listing ¶ added in v0.14.0
Listing represents a trade offer which can be accepted by another party on the OpenBazaar network
func CreateListing ¶ added in v0.14.0
CreateListing will create a pb Listing
func NewListingFromProtobuf ¶ added in v0.14.0
NewListingFromProtobuf - return Listing from pb.Listing
func UnmarshalJSONListing ¶ added in v0.14.0
UnmarshalJSONListing - unmarshal listing
func UpdateListing ¶ added in v0.14.0
UpdateListing will update a pb Listing
func (*Listing) GetAcceptedCurrencies ¶ added in v0.14.0
GetAcceptedCurrencies returns the listing's list of accepted currency codes
func (*Listing) GetCategories ¶ added in v0.14.0
GetCategories returns a list of categories for the listing
func (*Listing) GetCondition ¶ added in v0.14.0
GetCondition returns listing item condition
func (*Listing) GetContractType ¶ added in v0.14.0
GetContractType returns listing's contract type
func (*Listing) GetCoupons ¶ added in v0.14.0
func (l *Listing) GetCoupons() (ListingCoupons, error)
GetCoupons returns listing coupons with discount amount normalized as a CurrencyValue
func (*Listing) GetCryptoCurrencyCode ¶ added in v0.14.0
GetCryptoCurrencyCode returns the listing crypto currency code
func (*Listing) GetCryptoDivisibility ¶ added in v0.14.0
GetCryptoDivisibility returns the listing crypto divisibility
func (*Listing) GetDescription ¶ added in v0.14.0
GetDescription returns item description
func (*Listing) GetEscrowTimeoutHours ¶ added in v0.14.0
GetEscrowTimeout return listing's escrow timeout in hours
func (*Listing) GetImages ¶ added in v0.14.0
func (l *Listing) GetImages() []*ListingImage
GetImages return set of listing item images
func (*Listing) GetInventory ¶ added in v0.14.0
GetInventory - returns a map of skus and quantityies
func (*Listing) GetLanguage ¶ added in v0.14.0
GetLanguage return listing's language
func (*Listing) GetModerators ¶ added in v0.14.0
GetModerators returns accepted moderators for the listing
func (*Listing) GetNsfw ¶ added in v0.14.0
GetNSFW returns whether the listing is marked as inappropriate for general viewing or otherwise "Not Safe For Work"
func (*Listing) GetPrice ¶ added in v0.14.0
func (l *Listing) GetPrice() (*CurrencyValue, error)
GetPrice returns the listing price. For CRYPTOCURRENCY listings, this value would be zero in the denomination of the cryptocurrency being traded and the item value in all other cases. In the event that the shema version or contract type are unrecognizable, an error is returned.
func (*Listing) GetPriceModifier ¶ added in v0.14.0
GetPriceModifier return listing's price modifier
func (*Listing) GetProcessingTime ¶ added in v0.14.0
GetProcessingTime returns the expected time for vendor to process listing fulfillment
func (*Listing) GetProtobuf ¶ added in v0.14.0
GetProtobuf returns the current state of pb.Listing managed by Listing
func (*Listing) GetRefundPolicy ¶ added in v0.14.0
GetRefundPolicy return the refund policy for the listing
func (*Listing) GetShippingOptions ¶ added in v0.14.0
func (l *Listing) GetShippingOptions() ([]*pb.Listing_ShippingOption, error)
GetShippingOptions returns all shipping options
func (*Listing) GetShippingRegions ¶ added in v0.14.0
GetShippingRegions returns all region strings for the defined shipping services
func (*Listing) GetShortDescription ¶ added in v0.14.0
GetShortDescription returns the item description truncated down to the ShortDescriptionLength maximum
func (*Listing) GetSkus ¶ added in v0.14.0
func (l *Listing) GetSkus() ([]*pb.Listing_Item_Sku, error)
GetSkus returns the listing SKUs
func (*Listing) GetTaxes ¶ added in v0.14.0
func (l *Listing) GetTaxes() ListingTaxes
GetTaxes returns listing tax information
func (*Listing) GetTermsAndConditions ¶ added in v0.14.0
GetTermsAndConditions return the terms for the listings purchase contract
func (*Listing) GetVendorID ¶ added in v0.14.0
GetVendorID returns the vendor peer ID
func (*Listing) GetVersion ¶ added in v0.14.0
GetVersion returns the schema version of the Listing
func (*Listing) GetWeightGrams ¶ added in v0.14.0
GetGrams returns listing item weight in grams
func (*Listing) MarshalJSON ¶ added in v0.14.0
MarshalJSON returns the json serialization of the underlying protobuf
func (*Listing) MarshalProtobuf ¶ added in v0.14.0
MarshalProtobuf returns the byte serialization of the underlying protobuf
func (*Listing) Normalize ¶ added in v0.14.0
Normalize converts legacy schema listing data from other users on the network to fit the latest schema for consumption via the API for local use. NOTE: Legacy nodes do not understand the latest schema. As such, normalized listings must not be used as part of the RicardianContract and must be serialized and used as they were provided by the originating node.
func (*Listing) ProtoMessage ¶ added in v0.14.0
func (*Listing) ProtoMessage()
func (*Listing) SetAcceptedCurrencies ¶ added in v0.14.0
SetAcceptedCurrencies the listing's accepted currency codes. Assumes the node serving the listing has already validated the wallet supports the currencies.
func (*Listing) SetCryptocurrencyListingDefaults ¶ added in v0.14.0
SetCryptocurrencyListingDefaults ensures appropriate defaults are set for Crypto listings
func (*Listing) SetModerators ¶ added in v0.14.0
SetModerators updates the listing's accepted moderators
func (*Listing) SetRefundPolicy ¶
Set refurn policy
func (*Listing) SetShippingOptions ¶
func (l *Listing) SetShippingOptions(shippingDetails []*pb.Listing_ShippingOption)
Set refurn policy
func (*Listing) SetTermsAndConditions ¶
Set Terms and conditions
func (*Listing) Sign ¶ added in v0.14.0
func (l *Listing) Sign(n listingSigner) (*SignedListing, error)
Sign verifies the Listing and returns a SignedListing
func (*Listing) UpdateCouponsFromDatastore ¶ added in v0.14.0
UpdateCouponsFromDatastore will get all coupons from the datastore and update the internal protobuf with the codes that match the coupon's hash, if any.
func (*Listing) ValidateCryptoListing ¶ added in v0.14.0
func (*Listing) ValidateListing ¶ added in v0.14.0
ValidateListing ensures all listing state is valid
func (*Listing) ValidatePurchaseItemOptions ¶ added in v0.14.0
ValidatePurchaseItemOptions ensures item options are valid
func (*Listing) ValidateSkus ¶ added in v0.14.0
ValidateSkus ensures valid SKU state
type ListingCoupon ¶ added in v0.14.0
type ListingCoupon struct {
// contains filtered or unexported fields
}
ListingCoupon represents an coupon which can be applied to a listing for a discount
func (*ListingCoupon) GetAmountOff ¶ added in v0.14.0
func (c *ListingCoupon) GetAmountOff() *CurrencyValue
GetAmountOff returns the value to reduce listing by
func (*ListingCoupon) GetListingSlug ¶ added in v0.14.0
func (c *ListingCoupon) GetListingSlug() string
GetListingSlug returns the slug for the coupon's listing
func (*ListingCoupon) GetPercentOff ¶ added in v0.14.0
func (c *ListingCoupon) GetPercentOff() float32
GetPercentOff returns the percentage amount to reduce listing by
func (*ListingCoupon) GetRedemptionCode ¶ added in v0.14.0
func (c *ListingCoupon) GetRedemptionCode() (string, error)
GetRedemptionCode returns the coupon redemption code
func (*ListingCoupon) GetRedemptionHash ¶ added in v0.14.0
func (c *ListingCoupon) GetRedemptionHash() (string, error)
GetRedemptionHash returns the hashed representation of the code
func (*ListingCoupon) GetTitle ¶ added in v0.14.0
func (c *ListingCoupon) GetTitle() string
GetTitle returns the coupon's title
func (*ListingCoupon) SetRedemptionCode ¶ added in v0.14.0
func (c *ListingCoupon) SetRedemptionCode(code string) error
SetRedemptionCode sets the coupon's redemption code
type ListingCoupons ¶ added in v0.14.0
type ListingCoupons []*ListingCoupon
ListingCoupons is a set of listing coupons
func (ListingCoupons) GetProtobuf ¶ added in v0.14.0
func (cs ListingCoupons) GetProtobuf() []*pb.Listing_Coupon
GetProtobuf converts ListingCoupons into its protobuf representation
type ListingImage ¶ added in v0.14.0
type ListingImage struct {
// contains filtered or unexported fields
}
ListingImage represents the underlying protobuf image
func (*ListingImage) GetFilename ¶ added in v0.14.0
func (i *ListingImage) GetFilename() string
GetFilename returns the image filename
func (*ListingImage) GetLarge ¶ added in v0.14.0
func (i *ListingImage) GetLarge() string
GetLarge returns the image's large size
func (*ListingImage) GetMedium ¶ added in v0.14.0
func (i *ListingImage) GetMedium() string
GetMedium returns the image's medium size
func (*ListingImage) GetOriginal ¶ added in v0.14.0
func (i *ListingImage) GetOriginal() string
GetOriginal returns the image's original size
func (*ListingImage) GetSmall ¶ added in v0.14.0
func (i *ListingImage) GetSmall() string
GetSmall returns the image's small size
func (*ListingImage) GetTiny ¶ added in v0.14.0
func (i *ListingImage) GetTiny() string
GetTiny returns the image's tiny size
func (*ListingImage) SetLarge ¶ added in v0.14.0
func (i *ListingImage) SetLarge(cid string) error
SetLarge updates CID for the large image
func (*ListingImage) SetMedium ¶ added in v0.14.0
func (i *ListingImage) SetMedium(cid string) error
SetMedium updates CID for the medium image
func (*ListingImage) SetOriginal ¶ added in v0.14.0
func (i *ListingImage) SetOriginal(cid string) error
SetOriginal updates CID for the original image
func (*ListingImage) SetSmall ¶ added in v0.14.0
func (i *ListingImage) SetSmall(cid string) error
SetSmall updates CID for the small image
func (*ListingImage) SetTiny ¶ added in v0.14.0
func (i *ListingImage) SetTiny(cid string) error
SetTiny updates CID for the tiny image
func (*ListingImage) String ¶ added in v0.14.0
func (i *ListingImage) String() string
String satisfies Stringer and returns the image filename
type ListingIndexData ¶ added in v0.14.0
type ListingIndexData struct { Hash string `json:"hash"` Slug string `json:"slug"` Title string `json:"title"` Tags []string `json:"tags"` Categories []string `json:"categories"` NSFW bool `json:"nsfw"` ContractType string `json:"contractType"` Format string `json:"format"` Description string `json:"description"` Thumbnail ListingThumbnail `json:"thumbnail"` Price *CurrencyValue `json:"price"` Modifier float32 `json:"modifier"` 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"` CryptoCurrencyCode string `json:"coinType"` }
ListingIndexData reprents a single node in the Listing index
func UnmarshalJSONSignedListingIndex ¶ added in v0.14.0
func UnmarshalJSONSignedListingIndex(data []byte) ([]ListingIndexData, error)
UnmarshalJSONSignedListingIndex consumes a []byte payload of JSON representing a list of SignedListings and returns a parsed instance or an error if the payload cannot be successfully parsed
type ListingMetadata ¶ added in v0.14.0
type ListingMetadata struct {
Version uint `json:"version"`
}
ListingMetadata -
type ListingPrice ¶ added in v0.13.0
type ListingTax ¶ added in v0.14.0
type ListingTax struct {
// contains filtered or unexported fields
}
ListingTax describes how a listing is taxed in each region
func (ListingTax) GetApplicableRegions ¶ added in v0.14.0
func (t ListingTax) GetApplicableRegions() []string
GetApplicableRegions returns the regions affected by the tax
func (ListingTax) GetRate ¶ added in v0.14.0
func (t ListingTax) GetRate() float32
GetRate returns the tax rate
func (ListingTax) GetTaxableShipping ¶ added in v0.14.0
func (t ListingTax) GetTaxableShipping() bool
GetTaxableShipping indicates whether the shipping is subject to the tax
func (ListingTax) GetType ¶ added in v0.14.0
func (t ListingTax) GetType() string
GetType returns the tax type
type ListingThumbnail ¶ added in v0.14.0
type Message ¶ added in v0.13.5
Message - wrapper for pb.Message
func (*Message) GetMessageType ¶ added in v0.13.5
func (m *Message) GetMessageType() pb.Message_MessageType
GetMessageType - return the pb.Message messageType
func (*Message) GetPayload ¶ added in v0.13.5
GetPayload - return the pb.Message payload
func (*Message) MarshalJSON ¶ added in v0.13.5
MarshalJSON - invoke the pb.Message marshaller
func (*Message) UnmarshalJSON ¶ added in v0.13.5
UnmarshalJSON - invoke the pb.Message unmarshaller
type MessageStore ¶ added in v0.13.5
type MessageStore interface { Queryable // Save a new message Put(messageID, orderID string, mType pb.Message_MessageType, peerID string, msg Message, err string, receivedAt int64, pubkey []byte) error // GetByOrderIDType returns the message for specified order and type GetByOrderIDType(orderID string, mType pb.Message_MessageType) (*Message, string, error) // GetAllErrored returns the all messages with error GetAllErrored() ([]OrderMessage, error) // MarkAsResolved sets the message as resolved and will no longer return // with GetAllErrored MarkAsResolved(OrderMessage) error }
MessageStore is the messages table interface
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 }
ModeratedStores interface defines basic database operations for moderated stores
type ModeratorAddNotification ¶ added in v0.12.1
type ModeratorAddNotification struct { ID string `json:"notificationId"` Type NotificationType `json:"type"` PeerId string `json:"peerId"` }
func (ModeratorAddNotification) Data ¶ added in v0.12.1
func (n ModeratorAddNotification) Data() ([]byte, error)
func (ModeratorAddNotification) GetID ¶ added in v0.12.1
func (n ModeratorAddNotification) GetID() string
func (ModeratorAddNotification) GetSMTPTitleAndBody ¶ added in v0.12.1
func (n ModeratorAddNotification) GetSMTPTitleAndBody() (string, string, bool)
func (ModeratorAddNotification) GetType ¶ added in v0.12.1
func (n ModeratorAddNotification) GetType() NotificationType
func (ModeratorAddNotification) WebsocketData ¶ added in v0.12.1
func (n ModeratorAddNotification) WebsocketData() ([]byte, error)
type ModeratorDisputeExpiry ¶ added in v0.12.1
type ModeratorDisputeExpiry struct { ID string `json:"notificationId"` Type NotificationType `json:"type"` CaseID string `json:"disputeCaseId"` ExpiresIn uint `json:"expiresIn"` Thumbnail Thumbnail `json:"thumbnail"` }
ModeratorDisputeExpiry represents a notification about an open dispute which will soon be expired and automatically resolved. The Type indicates the age of the dispute case and the CaseID references the cases caseID in the database schema
func (ModeratorDisputeExpiry) Data ¶ added in v0.12.1
func (n ModeratorDisputeExpiry) Data() ([]byte, error)
func (ModeratorDisputeExpiry) GetID ¶ added in v0.12.1
func (n ModeratorDisputeExpiry) GetID() string
func (ModeratorDisputeExpiry) GetSMTPTitleAndBody ¶ added in v0.12.1
func (n ModeratorDisputeExpiry) GetSMTPTitleAndBody() (string, string, bool)
func (ModeratorDisputeExpiry) GetType ¶ added in v0.12.1
func (n ModeratorDisputeExpiry) GetType() NotificationType
func (ModeratorDisputeExpiry) WebsocketData ¶ added in v0.12.1
func (n ModeratorDisputeExpiry) WebsocketData() ([]byte, error)
type ModeratorRemoveNotification ¶ added in v0.12.1
type ModeratorRemoveNotification struct { ID string `json:"notificationId"` Type NotificationType `json:"type"` PeerId string `json:"peerId"` }
func (ModeratorRemoveNotification) Data ¶ added in v0.12.1
func (n ModeratorRemoveNotification) Data() ([]byte, error)
func (ModeratorRemoveNotification) GetID ¶ added in v0.12.1
func (n ModeratorRemoveNotification) GetID() string
func (ModeratorRemoveNotification) GetSMTPTitleAndBody ¶ added in v0.12.1
func (n ModeratorRemoveNotification) GetSMTPTitleAndBody() (string, string, bool)
func (ModeratorRemoveNotification) GetType ¶ added in v0.12.1
func (n ModeratorRemoveNotification) GetType() NotificationType
func (ModeratorRemoveNotification) WebsocketData ¶ added in v0.12.1
func (n ModeratorRemoveNotification) WebsocketData() ([]byte, error)
type Notification ¶ added in v0.12.1
type Notification struct { ID string `json:"-"` CreatedAt *APITime `json:"timestamp"` IsRead bool `json:"read"` NotifierData Notifier `json:"notification"` NotifierType NotificationType `json:"-"` }
Notification represents both a record from the Notifications Datastore as well as an unmarshalling envelope for the Notifier interface field NotifierData. NOTE: Only ID, NotifierData and NotifierType fields are valid in both contexts. This is because (*Notification).MarshalJSON only wraps the NotifierData field. NotifierData describes ID and NotifierType and will also be valid when unmarshalled. TODO: Ecapsulate the whole Notification struct inside of MarshalJSON and update persisted serializations to match in the Notifications Datastore
func NewNotification ¶ added in v0.12.1
func NewNotification(n Notifier, createdAt time.Time, isRead bool) *Notification
NewNotification is a helper that returns a properly instantiated *Notification
func (*Notification) Data ¶ added in v0.12.1
func (n *Notification) Data() ([]byte, error)
func (*Notification) GetID ¶ added in v0.12.1
func (n *Notification) GetID() string
func (*Notification) GetSMTPTitleAndBody ¶ added in v0.12.1
func (n *Notification) GetSMTPTitleAndBody() (string, string, bool)
func (*Notification) GetType ¶ added in v0.12.1
func (n *Notification) GetType() NotificationType
func (*Notification) GetTypeString ¶ added in v0.12.1
func (n *Notification) GetTypeString() string
func (*Notification) GetUnixCreatedAt ¶ added in v0.12.1
func (n *Notification) GetUnixCreatedAt() int
func (*Notification) MarshalJSON ¶ added in v0.12.1
func (n *Notification) MarshalJSON() ([]byte, error)
func (*Notification) UnmarshalJSON ¶ added in v0.12.1
func (n *Notification) UnmarshalJSON(data []byte) error
func (*Notification) WebsocketData ¶ added in v0.12.1
func (n *Notification) WebsocketData() ([]byte, error)
type NotificationStore ¶ added in v0.11.1
type NotificationStore interface { Queryable // PutRecord persists a Notification to the database PutRecord(*Notification) 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) ([]*Notification, int, error) // Returns the unread count for all notifications GetUnreadCount() (int, error) // Delete a notification Delete(notifID string) error }
Notifications interface defines basic database operations for notification information
type NotificationType ¶ added in v0.12.1
type NotificationType string
func (NotificationType) String ¶ added in v0.12.1
func (t NotificationType) String() string
type Notifier ¶ added in v0.12.1
type Notifier interface { // GetID returns the unique string identifier for the Notifier and is used to // uniquely persist the Notifier in the DB. Some Notifiers are not persisted. // Until we can represent this as part of the interface, the Notifiers which // do not get persisted can safely return an empty string. Notifiers which are // persisted and return a non-unique GetID() string will eventually fail the DB's // uniqueness constraints during runtime. GetID() string // GetType returns the type as a NotificationType GetType() NotificationType // GetSMTPTitleAndBody returns the title and body strings to be used // in any notification content. The bool can return false to bypass the // SMTP notification for this Notifier. GetSMTPTitleAndBody() (string, string, bool) // Data returns the marhsalled []byte suitable for transmission to the client // over the HTTP connection Data() ([]byte, error) // WebsocketData returns the marhsalled []byte suitable for transmission to the client // over the websocket connection WebsocketData() ([]byte, error) }
Notifier is an interface which is used to send data to the frontend
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 OrderCancelNotification ¶ added in v0.12.1
type OrderCancelNotification struct { ID string `json:"notificationId"` Type NotificationType `json:"type"` OrderId string `json:"orderId"` Thumbnail Thumbnail `json:"thumbnail"` BuyerHandle string `json:"buyerHandle"` BuyerID string `json:"buyerId"` }
func (OrderCancelNotification) Data ¶ added in v0.12.1
func (n OrderCancelNotification) Data() ([]byte, error)
func (OrderCancelNotification) GetID ¶ added in v0.12.1
func (n OrderCancelNotification) GetID() string
func (OrderCancelNotification) GetSMTPTitleAndBody ¶ added in v0.12.1
func (n OrderCancelNotification) GetSMTPTitleAndBody() (string, string, bool)
func (OrderCancelNotification) GetType ¶ added in v0.12.1
func (n OrderCancelNotification) GetType() NotificationType
func (OrderCancelNotification) WebsocketData ¶ added in v0.12.1
func (n OrderCancelNotification) WebsocketData() ([]byte, error)
type OrderConfirmationNotification ¶ added in v0.12.1
type OrderConfirmationNotification struct { ID string `json:"notificationId"` Type NotificationType `json:"type"` OrderId string `json:"orderId"` Thumbnail Thumbnail `json:"thumbnail"` VendorHandle string `json:"vendorHandle"` VendorID string `json:"vendorId"` }
func (OrderConfirmationNotification) Data ¶ added in v0.12.1
func (n OrderConfirmationNotification) Data() ([]byte, error)
func (OrderConfirmationNotification) GetID ¶ added in v0.12.1
func (n OrderConfirmationNotification) GetID() string
func (OrderConfirmationNotification) GetSMTPTitleAndBody ¶ added in v0.12.1
func (n OrderConfirmationNotification) GetSMTPTitleAndBody() (string, string, bool)
func (OrderConfirmationNotification) GetType ¶ added in v0.12.1
func (n OrderConfirmationNotification) GetType() NotificationType
func (OrderConfirmationNotification) WebsocketData ¶ added in v0.12.1
func (n OrderConfirmationNotification) WebsocketData() ([]byte, error)
type OrderDeclinedNotification ¶ added in v0.12.1
type OrderDeclinedNotification struct { ID string `json:"notificationId"` Type NotificationType `json:"type"` OrderId string `json:"orderId"` Thumbnail Thumbnail `json:"thumbnail"` VendorHandle string `json:"vendorHandle"` VendorID string `json:"vendorId"` }
func (OrderDeclinedNotification) Data ¶ added in v0.12.1
func (n OrderDeclinedNotification) Data() ([]byte, error)
func (OrderDeclinedNotification) GetID ¶ added in v0.12.1
func (n OrderDeclinedNotification) GetID() string
func (OrderDeclinedNotification) GetSMTPTitleAndBody ¶ added in v0.12.1
func (n OrderDeclinedNotification) GetSMTPTitleAndBody() (string, string, bool)
func (OrderDeclinedNotification) GetType ¶ added in v0.12.1
func (n OrderDeclinedNotification) GetType() NotificationType
func (OrderDeclinedNotification) WebsocketData ¶ added in v0.12.1
func (n OrderDeclinedNotification) WebsocketData() ([]byte, error)
type OrderMessage ¶ added in v0.14.0
type OrderNotification ¶ added in v0.12.1
type OrderNotification struct { BuyerHandle string `json:"buyerHandle"` BuyerID string `json:"buyerId"` ID string `json:"notificationId"` ListingType string `json:"listingType"` OrderId string `json:"orderId"` Price *CurrencyValue `json:"price"` PriceModifier float32 `json:"priceModifier"` Slug string `json:"slug"` Thumbnail Thumbnail `json:"thumbnail"` Title string `json:"title"` Type NotificationType `json:"type"` }
func (OrderNotification) Data ¶ added in v0.12.1
func (n OrderNotification) Data() ([]byte, error)
func (OrderNotification) GetID ¶ added in v0.12.1
func (n OrderNotification) GetID() string
func (OrderNotification) GetSMTPTitleAndBody ¶ added in v0.12.1
func (n OrderNotification) GetSMTPTitleAndBody() (string, string, bool)
func (OrderNotification) GetType ¶ added in v0.12.1
func (n OrderNotification) GetType() NotificationType
func (OrderNotification) WebsocketData ¶ added in v0.12.1
func (n OrderNotification) WebsocketData() ([]byte, error)
type OrderNotificationV4 ¶ added in v0.14.0
type OrderNotificationV4 struct { BuyerHandle string `json:"buyerHandle"` BuyerID string `json:"buyerId"` ID string `json:"notificationId"` ListingType string `json:"listingType"` OrderId string `json:"orderId"` Price ListingPrice `json:"price"` PriceModifier float32 `json:"priceModifier"` Slug string `json:"slug"` Thumbnail Thumbnail `json:"thumbnail"` Title string `json:"title"` Type NotificationType `json:"type"` }
type PaymentNotification ¶ added in v0.12.1
type PaymentNotification struct { ID string `json:"notificationId"` Type NotificationType `json:"type"` OrderId string `json:"orderId"` FundingTotal *CurrencyValue `json:"fundingTotal"` CoinType string `json:"coinType"` }
func (PaymentNotification) Data ¶ added in v0.12.1
func (n PaymentNotification) Data() ([]byte, error)
func (PaymentNotification) GetID ¶ added in v0.12.1
func (n PaymentNotification) GetID() string
func (PaymentNotification) GetSMTPTitleAndBody ¶ added in v0.12.1
func (n PaymentNotification) GetSMTPTitleAndBody() (string, string, bool)
func (PaymentNotification) GetType ¶ added in v0.12.1
func (n PaymentNotification) GetType() NotificationType
func (PaymentNotification) WebsocketData ¶ added in v0.12.1
func (n PaymentNotification) WebsocketData() ([]byte, error)
type PayoutRatio ¶ added in v0.12.4
type PayoutRatio struct{ Buyer, Vendor float32 }
func (PayoutRatio) BuyerAny ¶ added in v0.12.4
func (r PayoutRatio) BuyerAny() bool
func (PayoutRatio) BuyerMajority ¶ added in v0.12.4
func (r PayoutRatio) BuyerMajority() bool
func (PayoutRatio) EvenMajority ¶ added in v0.12.4
func (r PayoutRatio) EvenMajority() bool
func (PayoutRatio) Validate ¶ added in v0.12.4
func (r PayoutRatio) Validate() error
func (PayoutRatio) VendorAny ¶ added in v0.12.4
func (r PayoutRatio) VendorAny() bool
func (PayoutRatio) VendorMajority ¶ added in v0.12.4
func (r PayoutRatio) VendorMajority() bool
type PeerInfo ¶ added in v0.14.0
type PeerInfo struct {
// contains filtered or unexported fields
}
PeerInfo represents a signed identity on OpenBazaar
func NewPeerInfoFromProtobuf ¶ added in v0.14.0
NewPeerInfoFromProtobuf translates a pb.ID protobuf into a PeerInfo
func (*PeerInfo) BitcoinKey ¶ added in v0.14.0
func (*PeerInfo) BitcoinSignature ¶ added in v0.14.0
func (*PeerInfo) GeneratePeerIDFromIdentityKey ¶ added in v0.14.0
func (*PeerInfo) Hash ¶ added in v0.14.0
Hash returns the public hash based on the PeerKeychain.Identity key material
func (*PeerInfo) IdentityKey ¶ added in v0.14.0
func (*PeerInfo) IdentityKeyBytes ¶ added in v0.14.0
func (*PeerInfo) Valid ¶ added in v0.14.0
Valid ensures the PeerInfo is valid as derived by the provided protobuf
func (*PeerInfo) VerifyBitcoinSignature ¶ added in v0.14.0
VerifyBitcoinSignature checks that the bitcoin key and the peer id both agree
func (*PeerInfo) VerifyIdentity ¶ added in v0.14.0
VerifyIdentity checks that the peer id, identity key both agree
type PeerKeychain ¶ added in v0.14.0
type PeerKeychain struct {
// contains filtered or unexported fields
}
PeerKeychain holds bytes representing key material suitable for extracting with libp2p-crypto
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 PremarshalledNotifier ¶ added in v0.12.1
type PremarshalledNotifier struct {
Payload []byte
}
PremarshalledNotifier is a hack to allow []byte data to be transferred through the Notifier interface without having to do things the right way. You should not be using this and should prefer to use an existing Notifier struct or create a new one following the pattern of the TestNotification
func (PremarshalledNotifier) Data ¶ added in v0.12.1
func (n PremarshalledNotifier) Data() ([]byte, error)
func (PremarshalledNotifier) GetID ¶ added in v0.12.1
func (n PremarshalledNotifier) GetID() string
func (PremarshalledNotifier) GetSMTPTitleAndBody ¶ added in v0.12.1
func (n PremarshalledNotifier) GetSMTPTitleAndBody() (string, string, bool)
func (PremarshalledNotifier) GetType ¶ added in v0.12.1
func (n PremarshalledNotifier) GetType() NotificationType
func (PremarshalledNotifier) WebsocketData ¶ added in v0.12.1
func (n PremarshalledNotifier) WebsocketData() ([]byte, error)
type ProcessingErrorNotification ¶ added in v0.12.1
type ProcessingErrorNotification struct { ID string `json:"notificationId"` Type NotificationType `json:"type"` OrderId string `json:"orderId"` Thumbnail Thumbnail `json:"thumbnail"` VendorHandle string `json:"vendorHandle"` VendorID string `json:"vendorId"` }
func (ProcessingErrorNotification) Data ¶ added in v0.12.1
func (n ProcessingErrorNotification) Data() ([]byte, error)
func (ProcessingErrorNotification) GetID ¶ added in v0.12.1
func (n ProcessingErrorNotification) GetID() string
func (ProcessingErrorNotification) GetSMTPTitleAndBody ¶ added in v0.12.1
func (n ProcessingErrorNotification) GetSMTPTitleAndBody() (string, string, bool)
func (ProcessingErrorNotification) GetType ¶ added in v0.12.1
func (n ProcessingErrorNotification) GetType() NotificationType
func (ProcessingErrorNotification) WebsocketData ¶ added in v0.12.1
func (n ProcessingErrorNotification) WebsocketData() ([]byte, error)
type Profile ¶ added in v0.14.0
type Profile struct {
// contains filtered or unexported fields
}
Profile presents the user's metadata. The profile state is maintained within a *pb.Profile internally which captures all state changes suitable to be persisted via marshaling to JSON. This struct should ensure the integrity of *pb.Profile to its data as indicated by the set schema version.
func NewProfileFromProtobuf ¶ added in v0.14.0
NewProfileFromProtobuf returns a Profile wrapped around a profile protobuf
func UnmarshalJSONProfile ¶ added in v0.14.0
UnmarshalJSONProfile consumes a JSON byte slice and returns a Profile-wrapped unmarshaled protobuf
func (*Profile) DisableModeration ¶ added in v0.14.0
DisableModeration sets the profile so moderationr is disabled and all fee schedules are removed
func (*Profile) GetModeratedFixedFee ¶ added in v0.14.0
func (p *Profile) GetModeratedFixedFee() (*CurrencyValue, error)
GetModeratedFixedFee returns the fixed CurrencyValue for moderator services currently set on the Profile
func (*Profile) GetProtobuf ¶ added in v0.14.0
GetProtobuf returns the underlying protobuf which represents the persistable state of the profile. (Note: This method is a shim to access data which isn't represented in this package's Profile methods. Consider adding missing getters and setters which repsect the schema version instead of using the protobuf directly for manipulation.)
func (*Profile) GetVersion ¶ added in v0.14.0
GetVersion returns the schema version for the profile protobuf
func (*Profile) IsModerationEnabled ¶ added in v0.14.0
IsModerationEnabled checks if the Moderator flag and info are present
func (*Profile) NormalizeDataForAllSchemas ¶ added in v0.14.0
NormalizeDataForAllSchemas converts existing data from its current schema into legacy schema. This does not guarantee success as legacy schema that was abandoned due to unacceptable constraints will not be able to fulfill the full capability of the newer schema. (Ex: FixedFee.BigAmount can support full precision, whereas FixedFee.Amount is limited to math.MaxInt64
func (*Profile) SetModeratorFixedFee ¶ added in v0.14.0
func (p *Profile) SetModeratorFixedFee(fee *CurrencyValue) error
SetModeratorFixedFee sets the profile to be a moderator with a fixed fee schedule
func (*Profile) SetModeratorFixedPlusPercentageFee ¶ added in v0.14.0
func (p *Profile) SetModeratorFixedPlusPercentageFee(fee *CurrencyValue, percentage float32) error
SetModeratorFixedPlusPercentageFee sets the profile to be a moderator with a fixed fee plus percentage schedule
func (*Profile) SetModeratorPercentageFee ¶ added in v0.14.0
SetModeratorPercentageFee sets the profile to be a moderator with a percentage fee schedule
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 CurrencyValue `json:"total"` VendorId string `json:"vendorId"` VendorHandle string `json:"vendorHandle"` ShippingName string `json:"shippingName"` ShippingAddress string `json:"shippingAddress"` CoinType string `json:"coinType"` PaymentCoin string `json:"paymentCoin"` State string `json:"state"` Read bool `json:"read"` Moderated bool `json:"moderated"` UnreadChatMessages int `json:"unreadChatMessages"` }
type PurchaseData ¶ added in v0.14.0
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 PaymentCoin string `json:"paymentCoin"` }
PurchaseData represents purchase request metadata
type PurchaseRecord ¶ added in v0.12.1
type PurchaseRecord struct { Contract *pb.RicardianContract DisputedAt time.Time OrderID string OrderState pb.OrderState Timestamp time.Time LastDisputeTimeoutNotifiedAt time.Time LastDisputeExpiryNotifiedAt time.Time }
PurchaseRecord represents a one-to-one relationship with records in the SQL datastore
func (*PurchaseRecord) BuildBuyerDisputeExpiryFirstNotification ¶ added in v0.12.1
func (r *PurchaseRecord) BuildBuyerDisputeExpiryFirstNotification(createdAt time.Time) *Notification
BuildBuyerDisputeExpiryFirstNotification returns a Notification with ExpiresIn set for the First Interval
func (*PurchaseRecord) BuildBuyerDisputeExpiryLastNotification ¶ added in v0.12.1
func (r *PurchaseRecord) BuildBuyerDisputeExpiryLastNotification(createdAt time.Time) *Notification
BuildBuyerDisputeExpiryLastNotification returns a Notification with ExpiresIn set for the Last Interval
func (*PurchaseRecord) BuildBuyerDisputeExpirySecondNotification ¶ added in v0.12.1
func (r *PurchaseRecord) BuildBuyerDisputeExpirySecondNotification(createdAt time.Time) *Notification
BuildBuyerDisputeExpirySecondNotification returns a Notification with ExpiresIn set for the Second Interval
func (*PurchaseRecord) BuildBuyerDisputeTimeoutFirstNotification ¶ added in v0.12.1
func (r *PurchaseRecord) BuildBuyerDisputeTimeoutFirstNotification(createdAt time.Time) *Notification
BuildBuyerDisputeTimeoutFirstNotification returns a Notification with ExpiresIn set for the First Interval
func (*PurchaseRecord) BuildBuyerDisputeTimeoutLastNotification ¶ added in v0.12.1
func (r *PurchaseRecord) BuildBuyerDisputeTimeoutLastNotification(createdAt time.Time) *Notification
BuildBuyerDisputeTimeoutLastNotification returns a Notification with ExpiresIn set for the Last Interval
func (*PurchaseRecord) BuildBuyerDisputeTimeoutSecondNotification ¶ added in v0.12.1
func (r *PurchaseRecord) BuildBuyerDisputeTimeoutSecondNotification(createdAt time.Time) *Notification
BuildBuyerDisputeTimeoutSecondNotification returns a Notification with ExpiresIn set for the Second Interval
func (*PurchaseRecord) BuildBuyerDisputeTimeoutThirdNotification ¶ added in v0.12.1
func (r *PurchaseRecord) BuildBuyerDisputeTimeoutThirdNotification(createdAt time.Time) *Notification
BuildBuyerDisputeTimeoutThirdNotification returns a Notification with ExpiresIn set for the Third Interval
func (*PurchaseRecord) IsDisputeable ¶ added in v0.12.1
func (r *PurchaseRecord) IsDisputeable() bool
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, currencyCode *CurrencyCode, 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 unfunded orders. GetUnfunded() ([]UnfundedOrder, error) // Return the number of purchases in the database Count() int // GetPurchasesForDisputeTimeoutNotification returns []*PurchaseRecord including // each record which needs buyerDisputeTimeout Notifications to be generated. GetPurchasesForDisputeTimeoutNotification() ([]*PurchaseRecord, error) // GetPurchasesForDisputeExpiryNotification returns []*PurchaseRecord including // each record which needs buyerDisputeExpiry Notifications to be generated. GetPurchasesForDisputeExpiryNotification() ([]*PurchaseRecord, error) // UpdatePurchasesLastDisputeTimeoutNotifiedAt accepts []*PurchaseRecord and updates each records lastDisputeTimeoutNotifiedAt by its OrderID UpdatePurchasesLastDisputeTimeoutNotifiedAt([]*PurchaseRecord) error // UpdatePurchasesLastDisputeExpiryNotifiedAt accepts []*PurchaseRecord and updates each records lastDisputeExpiryNotifiedAt by its OrderID UpdatePurchasesLastDisputeExpiryNotifiedAt([]*PurchaseRecord) error }
type RefundNotification ¶ added in v0.12.1
type RefundNotification struct { ID string `json:"notificationId"` Type NotificationType `json:"type"` OrderId string `json:"orderId"` Thumbnail Thumbnail `json:"thumbnail"` VendorHandle string `json:"vendorHandle"` VendorID string `json:"vendorId"` }
func (RefundNotification) Data ¶ added in v0.12.1
func (n RefundNotification) Data() ([]byte, error)
func (RefundNotification) GetID ¶ added in v0.12.1
func (n RefundNotification) GetID() string
func (RefundNotification) GetSMTPTitleAndBody ¶ added in v0.12.1
func (n RefundNotification) GetSMTPTitleAndBody() (string, string, bool)
func (RefundNotification) GetType ¶ added in v0.12.1
func (n RefundNotification) GetType() NotificationType
func (RefundNotification) WebsocketData ¶ added in v0.12.1
func (n RefundNotification) WebsocketData() ([]byte, error)
type SMTPSettings ¶
type SMTPSettings struct { Notifications bool `json:"notifications"` ServerAddress string `json:"serverAddress"` Username string `json:"username"` Password string `json:"password"` SenderEmail string `json:"senderEmail"` RecipientEmail string `json:"recipientEmail"` OpenBazaarName string `json:"openBazaarName"` }
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 CurrencyValue `json:"total"` BuyerId string `json:"buyerId"` BuyerHandle string `json:"buyerHandle"` ShippingName string `json:"shippingName"` ShippingAddress string `json:"shippingAddress"` CoinType string `json:"coinType"` PaymentCoin string `json:"paymentCoin"` State string `json:"state"` Read bool `json:"read"` Moderated bool `json:"moderated"` UnreadChatMessages int `json:"unreadChatMessages"` }
type SaleRecord ¶ added in v0.12.1
type SaleRecord struct { Contract *pb.RicardianContract OrderID string OrderState pb.OrderState Timestamp time.Time LastDisputeTimeoutNotifiedAt time.Time }
SaleRecord represents a one-to-one relationship with records in the SQL datastore
func (*SaleRecord) BuildVendorDisputeTimeoutLastNotification ¶ added in v0.12.1
func (r *SaleRecord) BuildVendorDisputeTimeoutLastNotification(createdAt time.Time) *Notification
BuildVendorDisputeTimeoutLastNotification returns a Notification that alerts a SaleRecord is more than 45 days old and already expired
func (*SaleRecord) IsDisputeable ¶ added in v0.12.1
func (r *SaleRecord) IsDisputeable() bool
IsDisputeable returns whether the Sale is in a state that it can be disputed with a third-party moderator
func (*SaleRecord) IsModeratedContract ¶ added in v0.12.1
func (r *SaleRecord) IsModeratedContract() bool
IsModeratedContract indicates whether the SaleRecord has a contract which includes a third-party moderator
func (*SaleRecord) SupportsTimedEscrowRelease ¶ added in v0.12.1
func (r *SaleRecord) SupportsTimedEscrowRelease() bool
SupportsTimedEscrowRelease indicates whether the underlying AcceptedCurrency supports a time-bassed release behavior. TODO: Express this from the wallet-interface instead
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, currencyCode *CurrencyCode, 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. GetUnfunded() ([]UnfundedOrder, error) // Return the number of sales in the database Count() int // GetSalesForDisputeTimeoutNotification returns []*SaleRecord including // each record which needs Notifications to be generated. GetSalesForDisputeTimeoutNotification() ([]*SaleRecord, error) // UpdateSalesLastDisputeTimeoutNotifiedAt accepts []*SaleRecord and updates each records lastDisputeTimeoutNotifiedAt by its CaseID UpdateSalesLastDisputeTimeoutNotifiedAt([]*SaleRecord) error }
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"` PreferredCurrencies *[]string `json:"preferredCurrencies"` }
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 SignedListing ¶ added in v0.14.0
SignedListing represents a finalized listing which has been signed by the vendor
func NewSignedListingFromProtobuf ¶ added in v0.14.0
func NewSignedListingFromProtobuf(sl *pb.SignedListing) SignedListing
func UnmarshalJSONSignedListing ¶ added in v0.14.0
func UnmarshalJSONSignedListing(data []byte) (SignedListing, error)
UnmarshalJSONSignedListing extracts a SignedListing from marshaled JSON
func (SignedListing) GetAcceptedCurrencies ¶ added in v0.14.0
func (l SignedListing) GetAcceptedCurrencies() []string
GetAcceptedCurrencies returns the list of currencies which the listing may be purchased with
func (SignedListing) GetCryptoCurrencyCode ¶ added in v0.14.0
func (l SignedListing) GetCryptoCurrencyCode() string
GetCryptoCurrencyCode returns the currency code of the sold cryptocurrency listing
func (SignedListing) GetCryptoDivisibility ¶ added in v0.14.0
func (l SignedListing) GetCryptoDivisibility() uint32
GetCryptoDivisibility returns the divisibility of a cryptocurrency's listing sold inventory
func (SignedListing) GetListing ¶ added in v0.14.0
func (l SignedListing) GetListing() *Listing
GetListing returns the underlying repo.Listing object
func (SignedListing) GetListingSigProtobuf ¶ added in v0.14.0
func (l SignedListing) GetListingSigProtobuf() *pb.Signature
GetListingSigProtobuf returns the protobuf signature suitable for attaching to a pb.RicardianContract
func (SignedListing) GetPrice ¶ added in v0.14.0
func (l SignedListing) GetPrice() (*CurrencyValue, error)
GetPrice returns the price
func (SignedListing) GetSignature ¶ added in v0.14.0
func (l SignedListing) GetSignature() []byte
GetSignature returns the signature on the listing
func (SignedListing) GetSlug ¶ added in v0.14.0
func (l SignedListing) GetSlug() string
GetSlug returns the slug
func (SignedListing) GetTitle ¶ added in v0.14.0
func (l SignedListing) GetTitle() string
GetTitle returns the title
func (SignedListing) GetVendorID ¶ added in v0.14.0
func (l SignedListing) GetVendorID() *PeerInfo
GetVendorID returns the PeerInfo for the listing
func (SignedListing) GetVersion ¶ added in v0.14.0
func (l SignedListing) GetVersion() uint32
GetVersion returns the schema version
func (SignedListing) MarshalJSON ¶ added in v0.14.0
func (l SignedListing) MarshalJSON() ([]byte, error)
func (*SignedListing) Normalize ¶ added in v0.14.0
func (l *SignedListing) Normalize() error
Normalize is a helper method which will mutate the listing protobuf in-place but maintain the original signature for external verification purposes.
func (*SignedListing) ProtoMessage ¶ added in v0.14.0
func (*SignedListing) ProtoMessage()
func (*SignedListing) Reset ¶ added in v0.14.0
func (l *SignedListing) Reset()
func (*SignedListing) String ¶ added in v0.14.0
func (l *SignedListing) String() string
func (SignedListing) ValidateListing ¶ added in v0.14.0
func (l SignedListing) ValidateListing(isTestnet bool) error
ValidateListing ensures all listing state is valid
func (SignedListing) VerifySignature ¶ added in v0.14.0
func (l SignedListing) VerifySignature() error
VerifySignature checks the listings signature was produced by the vendor's Identity key and that the key was derived from the vendor's peerID
type SpentTransactionOutputStore ¶ added in v0.11.1
type SpentTransactionOutputStore interface { Queryable wallet.Stxos }
type StatusNotification ¶ added in v0.12.1
type StatusNotification struct {
Status string `json:"status"`
}
func (StatusNotification) Data ¶ added in v0.12.1
func (n StatusNotification) Data() ([]byte, error)
func (StatusNotification) GetID ¶ added in v0.12.1
func (n StatusNotification) GetID() string
func (StatusNotification) GetSMTPTitleAndBody ¶ added in v0.12.1
func (n StatusNotification) GetSMTPTitleAndBody() (string, string, bool)
func (StatusNotification) GetType ¶ added in v0.12.1
func (n StatusNotification) GetType() NotificationType
func (StatusNotification) WebsocketData ¶ added in v0.12.1
func (n StatusNotification) WebsocketData() ([]byte, error)
type TestNotification ¶ added in v0.12.1
type TestNotification struct{}
func (TestNotification) Data ¶ added in v0.12.1
func (TestNotification) Data() ([]byte, error)
func (TestNotification) GetID ¶ added in v0.12.1
func (TestNotification) GetID() string
func (TestNotification) GetSMTPTitleAndBody ¶ added in v0.12.1
func (TestNotification) GetSMTPTitleAndBody() (string, string, bool)
func (TestNotification) GetType ¶ added in v0.12.1
func (TestNotification) GetType() NotificationType
func (TestNotification) WebsocketData ¶ added in v0.12.1
func (n TestNotification) WebsocketData() ([]byte, error)
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 }
TxMetadata interface defines basic database operations for transaction metadata
type TransactionStore ¶ added in v0.11.1
type TransactionStore interface { Queryable wallet.Txns }
type UnfollowNotification ¶ added in v0.12.1
type UnfollowNotification struct { ID string `json:"notificationId"` Type NotificationType `json:"type"` PeerId string `json:"peerId"` }
func (UnfollowNotification) Data ¶ added in v0.12.1
func (n UnfollowNotification) Data() ([]byte, error)
func (UnfollowNotification) GetID ¶ added in v0.12.1
func (n UnfollowNotification) GetID() string
func (UnfollowNotification) GetSMTPTitleAndBody ¶ added in v0.12.1
func (n UnfollowNotification) GetSMTPTitleAndBody() (string, string, bool)
func (UnfollowNotification) GetType ¶ added in v0.12.1
func (n UnfollowNotification) GetType() NotificationType
func (UnfollowNotification) WebsocketData ¶ added in v0.12.1
func (n UnfollowNotification) WebsocketData() ([]byte, error)
type UnfundedOrder ¶ added in v0.13.5
type UnspentTransactionOutputStore ¶ added in v0.11.1
type UnspentTransactionOutputStore interface { Queryable wallet.Utxos }
type VendorDisputeTimeout ¶ added in v0.12.1
type VendorDisputeTimeout struct { ID string `json:"notificationId"` Type NotificationType `json:"type"` OrderID string `json:"purchaseOrderId"` ExpiresIn uint `json:"expiresIn"` Thumbnail Thumbnail `json:"thumbnail"` }
VendorDisputeTimeout represents a notification about a sale which will soon be unable to dispute. The Type indicates the age of the purchase and OrderID references the purchases orderID in the database schema
func (VendorDisputeTimeout) Data ¶ added in v0.12.1
func (n VendorDisputeTimeout) Data() ([]byte, error)
func (VendorDisputeTimeout) GetID ¶ added in v0.12.1
func (n VendorDisputeTimeout) GetID() string
func (VendorDisputeTimeout) GetSMTPTitleAndBody ¶ added in v0.12.1
func (n VendorDisputeTimeout) GetSMTPTitleAndBody() (string, string, bool)
func (VendorDisputeTimeout) GetType ¶ added in v0.12.1
func (n VendorDisputeTimeout) GetType() NotificationType
func (VendorDisputeTimeout) WebsocketData ¶ added in v0.12.1
func (n VendorDisputeTimeout) WebsocketData() ([]byte, error)
type VendorFinalizedPayment ¶ added in v0.12.1
type VendorFinalizedPayment struct { ID string `json:"notificationId"` Type NotificationType `json:"type"` OrderID string `json:"orderId"` }
VendorFinalizedPayment represents a notification about a purchase which will soon be unable to dispute.
func (VendorFinalizedPayment) Data ¶ added in v0.12.1
func (n VendorFinalizedPayment) Data() ([]byte, error)
func (VendorFinalizedPayment) GetID ¶ added in v0.12.1
func (n VendorFinalizedPayment) GetID() string
func (VendorFinalizedPayment) GetSMTPTitleAndBody ¶ added in v0.12.1
func (n VendorFinalizedPayment) GetSMTPTitleAndBody() (string, string, bool)
func (VendorFinalizedPayment) GetType ¶ added in v0.12.1
func (n VendorFinalizedPayment) GetType() NotificationType
func (VendorFinalizedPayment) WebsocketData ¶ added in v0.12.1
func (n VendorFinalizedPayment) WebsocketData() ([]byte, error)
type WatchedScriptStore ¶ added in v0.11.1
type WatchedScriptStore interface { Queryable wallet.WatchedScripts }
Source Files ¶
- api_time.go
- buyer_order.go
- chat_message.go
- checkout.go
- constants.go
- currency.go
- currency_converter.go
- currency_definition.go
- datastore.go
- dispute.go
- dispute_case_record.go
- dispute_resolution.go
- errors.go
- init.go
- ipfs_keystore.go
- listing.go
- listing_index.go
- message.go
- migration.go
- models.go
- notification.go
- order_confirmation.go
- order_fulfillment.go
- payout_ratio.go
- peer_info.go
- profile.go
- purchase_record.go
- refund.go
- sale_record.go
- signed_listing.go