new Item(connection, attrs)
An Item listing. Either a create (DZITCRTE) or update (DZITUPDT), depending on the attributes supplied.
receiverAddr: Newly created items will have no receiver, and will be automatically sent to an appropriate burn address that will enable item discovery on the network. Updates to an item should be addressed to the seller's public key, from with the item was originally declared.
NOTE: All attributes that are specified below are also getter properties that can be accessed on this instantiated object.
Parameters:
Name | Type | Description | |||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
connection |
Driver | blockchain connection |
|||||||||||||||||||||||||||
attrs |
object | Attributes that this Item contains Properties
|
Extends
Methods
-
<static> distanceBetween(lat1, lon1, lat2, lon2)
-
Compute the distance between two pairs of lat/lon's. Based on the haversine formula, pulled from : http://www.movable-type.co.uk/scripts/latlong.html
Parameters:
Name Type Description lat1
Integer lon1
Integer lat2
Integer lon2
Integer -
<static> findCreatesSinceBlock(connection, startingAt, blockDepth, cb)
-
/ Returns all Items created* since (and including) the provided block to the provided depth. Note thath these are items and not listings, so as to query faster. Items are returned in the order of newest to oldest.
Parameters:
Name Type Description connection
Driver blockchain connection
startingAt
Integer Block Height to begin search from
blockDepth
Integer Block Depth to which the search should descend
cb
function Callback to receive the item creation messages in the form: function(err, items).
-
<static> findInRadius(connection, startingAt, blockDepth, lat, lon, inMeters, cb)
-
/ Returns all Items created* since (and including) the provided block. This call basically mirrors the functionality of findCreatesSinceBlock, however, the additional lat/lon/inMeters parameter is used to filter results based on geographic proximity. This returns all items created in the specified timeframe that were declared within the specified inMeters from the lat/lot.
Parameters:
Name Type Description connection
Driver blockchain connection
startingAt
Integer Block Height to begin search from
blockDepth
Integer Block Depth to which the search should descend
lat
Integer the Latitude corresponding to the buyer's location
lon
Integer the Longitude corresponding to the buyer's location
inMeters
Integer the number of meters to search for listings around the provided lat/lon
cb
function Callback to receive the item creation messages in the form: function(err, items).
-
isValid(cb)
-
Determine whether this message has been properly formatted, and is 'in consensus' with the Drop Zone protocol. Further documentation for this validation result, and it's error messages can be found in the async-validate library.
Parameters:
Name Type Description cb
function Callback to receive the results of the validity test form: function(err, res)
- Inherited From:
-
save(cb)
-
Save this message into the blockchain, if it hasn't yet been persisted, and was instantiated without a txid.
NOTE: Validation is not performed as part of this method. It's entirely possible to persist a message into the blockchain that will be ommitted from search/scan results by clients. Validation is performed as part of #find() not #save().
Parameters:
Name Type Description cb
function Callback which receives the mempool-persisted message in the form: function(err, message)
NOTE: Due to transaction-maleability, the persisted txid may change at the time of actual confirmation. This method merely broadcasts the message into the mempool.
- Inherited From:
-
toTransaction()
-
Return a hash object representing the serialized components of this transaction suitable for passing onto TxEncode.
- Inherited From:
Returns:
- Type
- object