Module: private

Methods

(static) call(web3, tx, verbose) → {Promise.<Object>}

Reads the state of a private contract, given that the account in the `from` field has the key to decrypt the private contract’s state. This call happens off-chain and no transaction gets broadcasted.
Parameters:
Name Type Default Description
web3 Object The web3 instance
tx Object The transaction object
verbose Boolean true Whether to console log errors
Source:
Returns:
The private state
Type
Promise.<Object>

(static) composeDeploymentTx(web3, rawData, validators, gasPrice, verbose) → {Promise.<Object>}

Crafts a specific transaction wrapping a private contract inside a public contract. The resulting transaction is later expected to be signed and broadcasted. The "to-be-deployed" contract's address can be found in the return value.
Parameters:
Name Type Default Description
web3 Object The web3 instance
rawData String The raw transaction data
validators Array.<String> List of private validators
gasPrice String 0x0 Gas price for the transaction. Default is "0x0"
verbose Boolean true Whether to console log errors
Source:
Returns:
The transaction’s receipt object and the transaction object
Type
Promise.<Object>

(static) composePublicTx(web3, tx) → {Promise.<Object>}

Composes a regular public transaction with the missing fields filled in. Delegates to `parity_composeTransaction` RPC API call. This method is not part of the official `Parity private API`, just here for convenience.
Parameters:
Name Type Description
web3 Object The web3 instance
tx Object The transaction object, which can be partially incomplete
Source:
Returns:
The complete transaction object, missing fields filled in by defaults
Type
Promise.<Object>

(static) contractKey(web3, address, verbose) → {Promise.<String>}

Returns document key ID associated with the deployed public contract.
Parameters:
Name Type Default Description
web3 Object The web3 instance
address String Address of the private contract
verbose Boolean true Whether to console log errors
Source:
Returns:
Document key ID associated with the deployed public contract
Type
Promise.<String>

(static) send(web3, tx, verbose) → {Promise.<Object>}

Broadcast a previously signed transaction to the validators for them to read, and to validate the state change of a private contract.
Parameters:
Name Type Default Description
web3 Object The web3 instance
tx Object The transaction object
verbose Boolean true Whether to console log errors
Source:
Returns:
The contract address, status and the public transaction's hash
Type
Promise.<Object>