OIP

OIP

Class to publish, register, edit, transfer, and deactivate OIP Records




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
Name Type Attributes Description
publicAddress Object <optional>

Explicitly define a public address for the passed WIF

oipdURL Object <optional>

The OIP daemon API url to use when looking up the Latest Record in oip.edit()

rpc Object <optional>

By default, OIP uses a connection to a web explorer to publish Records, you can however use a connection to an RPC wallet instead by passing an object into this option

Properties
Name Type Attributes Description
host Object <optional>

The Hostname for the RPC wallet connection

port Object <optional>

The Port for the RPC wallet connection

username Object <optional>

The Username for the RPC wallet connection

password Object <optional>

The Password for the RPC wallet connection

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. publish, edit, deactivate, transfer etc

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: