Home Reference Source
public class | source

Bonds

Constructor Summary

Public Constructor
public

constructor(provider: Provider): Bonds

Creates a new oo7-parity bonds aggregate object with given ethereum provider.

Member Summary

Public Members
public

accounts: Bond<Address[]>

List of accounts managed by the node.

public
public
public

author: Bond<Address>

A Bond for currently set block author.

public

authoring: Bond<bool>

Returns node's authoring status. If the node is not authoring blocks this will return false.

public

badgereg: Contract<BadgeReg>

Parity registry contract instance.

public

badges: Bond<{id:string,name:string,img:string,caption:string,badge:Contract}[]>

A Bond representing all currently registered badges from BadgeReg.

public

badgesOf(address: Address): Bond<Badge[]>: *

Returns a list of badges for given address.

public

balance(address: string | Bond<Address>): Bond<BigNumber>: *

Returns balance of given address.

public

blockByHash(hash: string | number | Bond): Bond<Block>: *

A function returning bond that represents given block content.

public

blockByNumber(number: string | number | Bond): Bond<Block>: *

A function returning bond that represents given block content.

public

A Bond representing latest block number.

public

Returns block transaction count given block number or hash.

public

A subscriptable version of Bonds.findBlock

public

callTx(transaction: TransactionRequest, traces: String[], block: string | number | Bond): Bond<object>: *

Executs a transaction and collects traces.

public

Returns chain id (used for chain replay protection).

public

Returns a string name of currently connected chain.

public

Returns a status of currently connected chain.

public

Returns client version string.

public

code(address: string | Bond<Address>): Bond<Bytes>: *

Returns code of given address.

public
public
public
public

defaultAccount: Bond<Address>

User-selected default account for this dapp.

public
public

deployContract(init: string | Bytes, abi: ABI, options: {from: ?Address, gas: ?BigNumber, gasPrice: ?BigNumber, nonce: ?BigNumber}): ReactivePromise<DeployStatus>: *

Deploys a new contract

public

enode: *

public

estimateGas(call: {from: ?Address, to: ?Address, data: ?Bytes}): Bond<BigNumber>: *

Estimates gas required to execute given transaction

public
public
public

findBlock(hashOrNumber: string | number | Bond): Bond<Block>: *

Similar to Bonds.blockByNumber and Bonds.blockByHash, but accepts both hashes and numbers as arguments.

public

future: *

public
public
public

gasPrice: Bond<BigNumber>

Suggested gas price value.

public
public

githubhint: Contract<GithubHint>

Parity registry contract instance.

public
public

Returns a hash of content under given URL.

public

hashrate: Bond<BigNumber>

Reported hashrate.

public

head: Bond<Block>

A Bond for latest block.

public

A Bond representing latest block number.

public

listening: Bond<bool>

Returns true if the node is actively listening for network connections.

public

local: *

public

makeContract(address: string | Bond, abi: ABI, extras: ABI): Contract: *

Creates bond-enabled contract object for existing contract.

public

me: Bond<Address>

public
public

mode: *

public
public
public
public

nonce(address: string | Bond<Address>): Bond<BigNumber>: *

Returns the nonce of given address.

public

operations: Contract<Operations>

Parity registry contract instance.

public

Returns current peer count.

public

peers: *

public

pending: *

public
public

post(tx: TransactionRequest): ReactivePromise<TransactionStatus>: *

Posts a transaction to the network.

public

receipt(hash: string | number | Bond): Bond<TransactionReceipt>: *

Returns receipt given transaction hash.

public

registry: Contract<Registry>

Parity registry contract instance.

public
public

replayTx(hash: string, traces: String[]): Bond<object>: *

Replays (re-executes) a transaction.

public

sign(hash: Hash | Bond, from: Address | Bond): ReactivePromise<SignStatus>: *

Returns a signature of given message

public
public

storageAt(address: string | Bond<Address>, storageIdx: string | number | Bond<H256>): Bond<BigNumber>: *

Returns storage at given index of an address.

public

syncing: Bond<bool>

Returns node's syncing status. If the node is fully synced this will return false.

public

A Bond representing latest time.

public

tokenreg: Contract<TokenReg>

Parity registry contract instance.

public

tokens: Bond<{id:string,tla:string,base:string,name:string,owner:address,img:string,caption:string}[]>

A Bond representing all currently registered tokens from TokenReg.

public

tokensOf(address: Address): Bond<Token[]>: *

Returns a list of tokens with a non-empty balance for given address.

public

transaction(block: string | number | Bond, index: string | number | Bond): Bond<Transaction>: *

Returns transaction given block number or hash and transaction index

public
public

uncle(block: string | number | Bond, index: string | number | Bond): Bond<Header>: *

Returns uncle given block number or hash and uncle index

public

uncleCount(block: string | number | Bond): Bond<Number>: *

Returns uncle count given block number or hash.

public
public
public

Public Constructors

public constructor(provider: Provider): Bonds source

Creates a new oo7-parity bonds aggregate object with given ethereum provider.

Additional documentation can be found at https://wiki.parity.io/oo7-Parity-Reference.html

Params:

NameTypeAttributeDescription
provider Provider
  • nullable: true

Web3-compatible transport Provider (i.e. window.ethereum). Uses a sane default if not provided.

Return:

Bonds

Public Members

public accounts: Bond<Address[]> source

List of accounts managed by the node.

Example:

const { bonds } = require('oo7-parity')

bonds
.accounts
.tie(console.log) // prints accounts list every time it changes

public accountsInfo: * source

public allAccountsInfo: * source

public author: Bond<Address> source

A Bond for currently set block author. Represents a result of eth_coinbase RPC call.

Example:

const { bonds } = require('oo7-parity')

bonds
.author
.tie(console.log) // prints currently set block author (coinbase/miner) every time it changes

public authoring: Bond<bool> source

Returns node's authoring status. If the node is not authoring blocks this will return false.

Example:

const { bonds } = require('oo7-parity')

bonds
.authoring
.tie(console.log) // prints authoring status every time it changes

public badgereg: Contract<BadgeReg> source

Parity registry contract instance.

public badges: Bond<{id:string,name:string,img:string,caption:string,badge:Contract}[]> source

A Bond representing all currently registered badges from BadgeReg.

public badgesOf(address: Address): Bond<Badge[]>: * source

Returns a list of badges for given address.

Return:

Bond<Badge[]>

see Bonds.badges

public balance(address: string | Bond<Address>): Bond<BigNumber>: * source

Returns balance of given address.

Return:

Bond<BigNumber>

Example:

const { bonds } = require('oo7-parity')

bonds
.balance(bonds.me)
.tie(console.log) // prints default account balance every time any of them changes

public blockByHash(hash: string | number | Bond): Bond<Block>: * source

A function returning bond that represents given block content.

Return:

Bond<Block>

block bond

Example:

const { bonds } = require('oo7-parity')

bonds
.blockByHash('0x2b23d04567313fa141ca396f1e2620b62ab0c5d69f8c77157118f8d7671e1f4d')
.tie(console.log) // prints block with given hash

public blockByNumber(number: string | number | Bond): Bond<Block>: * source

A function returning bond that represents given block content.

Return:

Bond<Block>

block bond

Example:

const { bonds } = require('oo7-parity')

bonds
.blockByNumber(bonds.height)
.tie(console.log) // prints latest block

public blockNumber: Bond<Number> source

A Bond representing latest block number.

Example:

const { bonds } = require('oo7-parity')

bonds
.blockNumber
.tie(console.log) // prints latest block number when it changes

public blockTransactionCount(block: string | number | Bond): Bond<Number>: * source

Returns block transaction count given block number or hash.

Return:

Bond<Number>

number of transactions in block

Example:

const { bonds } = require('oo7-parity')

bonds
.blockTransactionCount(bonds.blockNumber)
.tie(console.log) // prints number of transactions in latest block

public blocks: Object<string|number|Bond, Bond> source

A subscriptable version of Bonds.findBlock

You can retrieve bonds given block numbers or hashes or other Bonds.

Example:

const { bonds } = require('oo7-parity')

bonds
.blocks['0x2b23d04567313fa141ca396f1e2620b62ab0c5d69f8c77157118f8d7671e1f4d']
.tie(console.log) // prints block with given hash

bonds
.blocks[bonds.height]
.tie(console.log) // prints latest block every time it changes

public callTx(transaction: TransactionRequest, traces: String[], block: string | number | Bond): Bond<object>: * source

Executs a transaction and collects traces.

Return:

Bond<object>

Example:

const { bonds } = require('oo7-parity')

bonds
.callTx({
	from: bonds.me,
	to: bonds.registry.address
}, ['trace'], 'latest')
.tie(console.log)

public chainId: Bond<Number> source

Returns chain id (used for chain replay protection). NOTE: It's not network id.

Example:

const { bonds } = require('oo7-parity')

bonds
.chainId
.tie(console.log)

public chainName: Bond<string> source

Returns a string name of currently connected chain.

Example:

const { bonds } = require('oo7-parity')

bonds
.chainName
.tie(console.log)

public chainStatus: Bond<object> source

Returns a status of currently connected chain.

Example:

const { bonds } = require('oo7-parity')

bonds
.chainStatus
.tie(console.log)

public clientVersion: Bond<String> source

Returns client version string. (web3_clientVersion).

Example:

const { bonds } = require('oo7-parity')

bonds
.clientVersion
.tie(console.log)

public code(address: string | Bond<Address>): Bond<Bytes>: * source

Returns code of given address.

Return:

Bond<Bytes>

Example:

const { bonds } = require('oo7-parity')

bonds
.code(bonds.me)
.tie(console.log) // prints default account code every time any of them changes

public consensusCapability: * source

public dappsInterface: * source

public dappsPort: * source

public defaultAccount: Bond<Address> source

User-selected default account for this dapp.

Example:

const { bonds } = require('oo7-parity')

bonds
.defaultAccount
.tie(console.log) // prints default account every time it changes

public defaultExtraData: * source

public deployContract(init: string | Bytes, abi: ABI, options: {from: ?Address, gas: ?BigNumber, gasPrice: ?BigNumber, nonce: ?BigNumber}): ReactivePromise<DeployStatus>: * source

Deploys a new contract

Return:

ReactivePromise<DeployStatus>

Example:

const { bonds } = require('oo7-parity')

bonds
.deployContract('0x1234', abi, {})
.tie(console.log) // Reports deployment progress

public enode: * source

public estimateGas(call: {from: ?Address, to: ?Address, data: ?Bytes}): Bond<BigNumber>: * source

Estimates gas required to execute given transaction

Return:

Bond<BigNumber>

gas estimate

Example:

const { bonds } = require('oo7-parity')

bonds
.estimateGas({ from: bonds.me, to: '0x00D6Cc1BA9cf89BD2e58009741f4F7325BAdc0ED' })
.tie(console.log) // prints current gas estimate

public ethProtocolVersion: * source

public extraData: * source

public findBlock(hashOrNumber: string | number | Bond): Bond<Block>: * source

Similar to Bonds.blockByNumber and Bonds.blockByHash, but accepts both hashes and numbers as arguments.

Return:

Bond<Block>

block bond

Example:

const { bonds } = require('oo7-parity')

bonds
.findBlock('0x2b23d04567313fa141ca396f1e2620b62ab0c5d69f8c77157118f8d7671e1f4d')
.tie(console.log) // prints block with given hash

public future: * source

public gasCeilTarget: * source

public gasFloorTarget: * source

public gasPrice: Bond<BigNumber> source

Suggested gas price value. (Gas Price Oracle) This returns a suggested gas price for next transaction. The estimation is based on statistics from last blocks.

Example:

const { bonds } = require('oo7-parity')

bonds
.gasPrice
.tie(console.log) // prints current gas price suggestion

public gasPriceHistogram: * source

public githubhint: Contract<GithubHint> source

Parity registry contract instance.

public hardwareAccountsInfo: * source

public hashContent(url: string | Bond): Bond<string>: * source

Returns a hash of content under given URL.

Return:

Bond<string>

hash of the content

Example:

const { bonds } = require('oo7-parity')

bonds
.hashContent('https://google.com')
.tie(console.log)

public hashrate: Bond<BigNumber> source

Reported hashrate. If there is an external miner connected to the node it will return reported values.

Example:

const { bonds } = require('oo7-parity')

bonds
.hashrate
.tie(console.log) // prints current average hashrate

public head: Bond<Block> source

A Bond for latest block.

Example:

const { bonds } = require('oo7-parity')

bonds
.head
.tie(console.log) // prints latest block every time it changes

public height: Bond<Number> source

A Bond representing latest block number. Alias for Bonds.blockNumber

public listening: Bond<bool> source

Returns true if the node is actively listening for network connections.

Example:

const { bonds } = require('oo7-parity')

bonds
.listening
.tie(console.log)

public local: * source

public makeContract(address: string | Bond, abi: ABI, extras: ABI): Contract: * source

Creates bond-enabled contract object for existing contract.

Return:

Contract

Example:

const { bonds } = require('oo7-parity')

bonds
.makeContract(bonds.me, abi)
.someMethod()
.tie(console.log) // returns a result of someMethod call

public me: Bond<Address> source

Alias for Bonds.defaultAccount

Example:

const { bonds } = require('oo7-parity')

bonds
.me
.tie(console.log) // prints default account every time it changes

public minGasPrice: * source

public mode: * source

public nextNonce: * source

public nodeName: * source

public nodePort: * source

public nonce(address: string | Bond<Address>): Bond<BigNumber>: * source

Returns the nonce of given address.

Return:

Bond<BigNumber>

Example:

const { bonds } = require('oo7-parity')

bonds
.nonce(bonds.me)
.tie(console.log) // prints default account nonce every time any of them changes

public operations: Contract<Operations> source

Parity registry contract instance.

public peerCount: Bond<Number> source

Returns current peer count. (net_peerCount).

Example:

const { bonds } = require('oo7-parity')

bonds
.peerCount
.tie(console.log)

public peers: * source

public pending: * source

public pendingStats: * source

public post(tx: TransactionRequest): ReactivePromise<TransactionStatus>: * source

Posts a transaction to the network.

Return:

ReactivePromise<TransactionStatus>

Example:

const { bonds } = require('oo7-parity')

bonds
.post({ to: bonds.me, value: 0  })
.tie(console.log) // Reports transaction progress

public receipt(hash: string | number | Bond): Bond<TransactionReceipt>: * source

Returns receipt given transaction hash.

Return:

Bond<TransactionReceipt>

transaction at that index

Example:

const { bonds } = require('oo7-parity')

bonds
.receipt(bonds.transaction(bonds.height, 0).map(x => x ? x.hash : undefined))
.tie(console.log) // prints receipt of first transaction in latest block

public registry: Contract<Registry> source

Parity registry contract instance.

public releaseInfo: * source

public replayTx(hash: string, traces: String[]): Bond<object>: * source

Replays (re-executes) a transaction. Returns requested traces of execution.

Return:

Bond<object>

Example:

const { bonds } = require('oo7-parity')

bonds
.replayTx('0x2ea2e504d09c458dbadc703112125564d53ca03c27a5b28e7b3e2b5804289c45', ['trace'])
.tie(console.log)

public sign(hash: Hash | Bond, from: Address | Bond): ReactivePromise<SignStatus>: * source

Returns a signature of given message

Return:

ReactivePromise<SignStatus>

Example:

const { bonds } = require('oo7-parity')

bonds
.sign('0x2ea2e504d09c458dbadc703112125564d53ca03c27a5b28e7b3e2b5804289c45')
.tie(console.log) // Reports signing progress

public signerPort: * source

public storageAt(address: string | Bond<Address>, storageIdx: string | number | Bond<H256>): Bond<BigNumber>: * source

Returns storage at given index of an address.

Return:

Bond<BigNumber>

Example:

const { bonds } = require('oo7-parity')

bonds
.storageAt(bonds.me, 0)
.tie(console.log) // prints default account storage at position 0 every time any of them changes

public syncing: Bond<bool> source

Returns node's syncing status. If the node is fully synced this will return false.

Example:

const { bonds } = require('oo7-parity')

bonds
.syncing
.tie(console.log) // prints sync status every time it changes

public time: TimeBond source

A Bond representing latest time. Updated every second.

Example:

const { bonds } = require('oo7-parity')

bonds
.time
.tie(console.log) // prints time periodically

public tokenreg: Contract<TokenReg> source

Parity registry contract instance.

public tokens: Bond<{id:string,tla:string,base:string,name:string,owner:address,img:string,caption:string}[]> source

A Bond representing all currently registered tokens from TokenReg.

public tokensOf(address: Address): Bond<Token[]>: * source

Returns a list of tokens with a non-empty balance for given address.

Return:

Bond<Token[]>

see Bonds.tokens

public transaction(block: string | number | Bond, index: string | number | Bond): Bond<Transaction>: * source

Returns transaction given block number or hash and transaction index

Return:

Bond<Transaction>

transaction at that index

Example:

const { bonds } = require('oo7-parity')

bonds
.transaction(bonds.blockNumber, 0)
.tie(console.log) // prints the first uncle in latest block

public transactionsLimit: * source

public uncle(block: string | number | Bond, index: string | number | Bond): Bond<Header>: * source

Returns uncle given block number or hash and uncle index

Return:

Bond<Header>

uncle header at that index

Example:

const { bonds } = require('oo7-parity')

bonds
.uncle(bonds.blockNumber, 0)
.tie(console.log) // prints the first uncle in latest block

public uncleCount(block: string | number | Bond): Bond<Number>: * source

Returns uncle count given block number or hash.

Return:

Bond<Number>

number of uncles in a block

Example:

const { bonds } = require('oo7-parity')

bonds
.uncleCount(bonds.blockNumber)
.tie(console.log) // prints number of uncles in latest block

public unsignedCount: * source

public upgradeReady: * source

public versionInfo: * source