Constructor
new OIP(wif, networkopt, optionsopt)
Example
import {OIP} from 'js-oip'
let wif = "cRVa9rNx5N1YKBw8PhavegJPFCiYCfC4n8cYmdc3X1Y6TyFZGG4B"
let oip = new OIP(wif, "testnet")
Parameters:
Name | Type | Attributes | Default | Description | ||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
wif |
String |
private key in Wallet Import Format (WIF) see: https://en.bitcoin.it/wiki/Wallet_import_format |
||||||||||||||||||||||||||||||||||||||
network |
String |
<optional> |
"mainnet" |
Use "testnet" for mainnet |
||||||||||||||||||||||||||||||||||||
options |
Object |
<optional> |
Options to for the OIP class Properties
|
- Source:
Methods
(async) broadcastRecord(record, methodType) → {Promise.<Object>}
Broadcast an OIP Record
Parameters:
Name | Type | Description |
---|---|---|
record |
OIPRecord |
Any Object whos class extends OIPRecord (Artifact, Publisher, Platform, Retailer, Influencer, EditRecord, etc) |
methodType |
String |
The method you are wanting to perform, i.e. |
- Source:
Returns:
response - An object that contains a var for success
, the record
that was published, and the editRecord
if it is an edit
let oip = new OIP(wif, "testnet")
let artifact = new Artifact()
let result = await oip.broadcastRecord(artifact, 'publish')
- Type:
- Promise.<Object>
(async) edit(editedRecord) → {Promise.<Object>}
Publish an Edit for a Record
Parameters:
Name | Type | Description |
---|---|---|
editedRecord |
OIPRecord |
The new version of the Record |
- Source:
Example
let oip = new OIP(wif, "testnet")
let record = new Artifact(previousArtifactJSON)
record.setTitle('new title')
let result = await oip.edit(record)
Returns:
response - An object that contains a var for success
, the record
that was published, and the editRecord
- Type:
- Promise.<Object>
(async) publish(record) → {Promise.<Object>}
Publish OIP Records
Parameters:
Name | Type | Description |
---|---|---|
record |
OIPRecord |
an Artifact, Publisher, Platform, Retailer, or Influencer |
- Source:
Returns:
response - An object that contains a var for success
, the record
that was published
let oip = new OIP(wif, "testnet")
let artifact = new Artifact()
let result = await oip.publish(artifact)
- Type:
- Promise.<Object>
(async) publishMultiparts(data) → {Promise.<Array.<String>>}
Publish data that exceeds the maximum floData length in multiple parts
Parameters:
Name | Type | Description |
---|---|---|
data |
string |
The data you wish to publish |
- Source:
Example
let oip = new OIP(wif, "testnet")
let txArray = await oip.publishMultiparts(superLongStringData)
//For multipart publishing, use oip.publish() instead. Will auto redirect to this function
Returns:
txids - An array of transaction IDs
- Type:
- Promise.<Array.<String>>
(async) signRecord(record)
Sign an OIP Record (if unsigned), and verify it's signature
Parameters:
Name | Type | Description |
---|---|---|
record |
OIPRecord |
The record you want to make sure is signed |
- Source: