Documentation ¶
Index ¶
- Constants
- Variables
- type OpenBazaarNode
- func (n *OpenBazaarNode) CalculateOrderTotal(contract *pb.RicardianContract) (uint64, error)
- func (n *OpenBazaarNode) DeleteListing(slug string) error
- func (n *OpenBazaarNode) EncryptMessage(peerId peer.ID, message []byte) (ct []byte, rerr error)
- func (n *OpenBazaarNode) Follow(peerId string) error
- func (n *OpenBazaarNode) GetListingCount() int
- func (n *OpenBazaarNode) GetListingFromHash(hash string) (*pb.RicardianContract, []*pb.Inventory, error)
- func (n *OpenBazaarNode) GetListingFromSlug(slug string) (*pb.RicardianContract, []*pb.Inventory, error)
- func (n *OpenBazaarNode) GetPeerStatus(peerId string) string
- func (n *OpenBazaarNode) GetProfile() (pb.Profile, error)
- func (n *OpenBazaarNode) Purchase(data *PurchaseData) error
- func (n *OpenBazaarNode) RemoveSelfAsModerator() error
- func (n *OpenBazaarNode) SeedNode() error
- func (n *OpenBazaarNode) SendOfflineAck(peerId string, pointerID peer.ID) error
- func (n *OpenBazaarNode) SendOfflineMessage(p peer.ID, m *pb.Message) error
- func (n *OpenBazaarNode) SendOrder(peerId string, contract *pb.RicardianContract) (resp *pb.Message, err error)
- func (n *OpenBazaarNode) SetListingInventory(listing *pb.Listing, inventory []*pb.Inventory) error
- func (n *OpenBazaarNode) SetSelfAsModerator(moderator *pb.Moderator) error
- func (n *OpenBazaarNode) SignListing(listing *pb.Listing) (*pb.RicardianContract, error)
- func (n *OpenBazaarNode) TransferImages(fromSlug, toSlug string) error
- func (n *OpenBazaarNode) Unfollow(peerId string) error
- func (n *OpenBazaarNode) UpdateFollow() error
- func (n *OpenBazaarNode) UpdateListingIndex(contract *pb.RicardianContract) error
- func (n *OpenBazaarNode) UpdateProfile(profile *pb.Profile) error
- type PurchaseData
Constants ¶
const ( ListingVersion = 1 TitleMaxCharacters = 140 ShortDescriptionLength = 160 DescriptionMaxCharacters = 50000 MaxTags = 10 WordMaxCharacters = 40 SentanceMaxCharacters = 70 )
const ( MaxCoins = 2100000000000000 SatoshiPerBTC = 100000000 )
Variables ¶
var ModeratorPointerID multihash.Multihash
Functions ¶
This section is empty.
Types ¶
type OpenBazaarNode ¶
type OpenBazaarNode struct { // Context for issuing IPFS commands Context commands.Context // IPFS node object IpfsNode *core.IpfsNode // The roothash of the node directory inside the openbazaar repo. // This directory hash is published on IPNS at our peer ID making // the directory publicly viewable on the network. RootHash string // The path to the openbazaar repo in the file system. RepoPath string // The OpenBazaar network service for direct communication between peers Service net.NetworkService // Database for storing node specific data Datastore repo.Datastore // Websocket channel used for pushing data to the UI. Broadcast chan []byte // Bitcoin wallet implementation Wallet bitcoin.BitcoinWallet // Storage for our outgoing messages MessageStorage sto.OfflineMessagingStorage // A service that periodically checks the dht for outstanding messages MessageRetriever *net.MessageRetriever // A service that periodically republishes active pointers PointerRepublisher *net.PointerRepublisher // Used to resolve blockchainIDs to OpenBazaar IDs Resolver *bstk.BlockstackClient // A service that periodically fetches and caches the bitcoin exchange rates ExchangeRates bitcoin.ExchangeRates }
var Node *OpenBazaarNode
func (*OpenBazaarNode) CalculateOrderTotal ¶ added in v0.1.1
func (n *OpenBazaarNode) CalculateOrderTotal(contract *pb.RicardianContract) (uint64, error)
func (*OpenBazaarNode) DeleteListing ¶ added in v0.1.1
func (n *OpenBazaarNode) DeleteListing(slug string) error
Deletes the listing directory, removes the listing from the index, and deletes the inventory
func (*OpenBazaarNode) EncryptMessage ¶
func (n *OpenBazaarNode) EncryptMessage(peerId peer.ID, message []byte) (ct []byte, rerr error)
This is a placeholder until the libsignal is operational For now we will just encrypt outgoing offline messages with the long lived identity key.
func (*OpenBazaarNode) Follow ¶
func (n *OpenBazaarNode) Follow(peerId string) error
func (*OpenBazaarNode) GetListingCount ¶
func (n *OpenBazaarNode) GetListingCount() int
Return the current number of listings
func (*OpenBazaarNode) GetListingFromHash ¶ added in v0.1.1
func (n *OpenBazaarNode) GetListingFromHash(hash string) (*pb.RicardianContract, []*pb.Inventory, error)
func (*OpenBazaarNode) GetListingFromSlug ¶ added in v0.1.1
func (n *OpenBazaarNode) GetListingFromSlug(slug string) (*pb.RicardianContract, []*pb.Inventory, error)
func (*OpenBazaarNode) GetPeerStatus ¶
func (n *OpenBazaarNode) GetPeerStatus(peerId string) string
func (*OpenBazaarNode) GetProfile ¶
func (n *OpenBazaarNode) GetProfile() (pb.Profile, error)
func (*OpenBazaarNode) Purchase ¶
func (n *OpenBazaarNode) Purchase(data *PurchaseData) error
func (*OpenBazaarNode) RemoveSelfAsModerator ¶ added in v0.1.1
func (n *OpenBazaarNode) RemoveSelfAsModerator() error
func (*OpenBazaarNode) SeedNode ¶
func (n *OpenBazaarNode) SeedNode() error
Unpin the current node repo, re-add it, then publish to ipns
func (*OpenBazaarNode) SendOfflineAck ¶
func (n *OpenBazaarNode) SendOfflineAck(peerId string, pointerID peer.ID) error
func (*OpenBazaarNode) SendOfflineMessage ¶
func (*OpenBazaarNode) SendOrder ¶ added in v0.1.1
func (n *OpenBazaarNode) SendOrder(peerId string, contract *pb.RicardianContract) (resp *pb.Message, err error)
func (*OpenBazaarNode) SetListingInventory ¶
Sets the inventory for the listing in the database. Does some basic validation to make sure the inventory uses the correct variants.
func (*OpenBazaarNode) SetSelfAsModerator ¶ added in v0.1.1
func (n *OpenBazaarNode) SetSelfAsModerator(moderator *pb.Moderator) error
func (*OpenBazaarNode) SignListing ¶
func (n *OpenBazaarNode) SignListing(listing *pb.Listing) (*pb.RicardianContract, error)
Add our identity to the listing and sign it
func (*OpenBazaarNode) TransferImages ¶ added in v0.1.1
func (n *OpenBazaarNode) TransferImages(fromSlug, toSlug string) error
Moves images from one directory to another. This is used when a user changes a slug and we need to copy images into the new listing directory.
func (*OpenBazaarNode) Unfollow ¶
func (n *OpenBazaarNode) Unfollow(peerId string) error
func (*OpenBazaarNode) UpdateFollow ¶
func (n *OpenBazaarNode) UpdateFollow() error
This function updates the follow and following lists in the node's root directory as well as adds the current follow, following, and listing counts to the profile. We only do this when a user updates his node to avoid needing to make network calls each time a new follower or unfollow request comes in.
func (*OpenBazaarNode) UpdateListingIndex ¶
func (n *OpenBazaarNode) UpdateListingIndex(contract *pb.RicardianContract) error
Update the index.json file in the listings directory
func (*OpenBazaarNode) UpdateProfile ¶
func (n *OpenBazaarNode) UpdateProfile(profile *pb.Profile) error
type PurchaseData ¶
type PurchaseData struct { ShipTo string `json:"shipTo"` Address string `json:"address"` City string `json:"city"` State string `json:"state"` PostalCode string `json:"postalCode"` CountryCode string `json:"countryCode"` AddressNotes string `json:"addressNotes"` Moderator string `json:"moderator"` Items []item `json:"items"` }