An SDK for interacting with Livepeer's smart contracts.
yarn add @livepeer/sdk
Here's a code snippet showing instantiation and basic usage of the Livepeer SDK.
import LivepeerSDK from '@livepeer/sdk'
// Or if you prefer require
// const { LivepeerSDK } = require('@livepeer/sdk')
//
// First, call the SDK factory function
// pass it any configuration options
LivepeerSDK({ ... }).then(async (sdk) => {
// Once initialized, you can access the methods under the `rpc` namespace
const { rpc } = sdk
// For example, you can get the total supply of Livepeer Tokens like so
const tokens = await rpc.getTokenTotalSupply()
console.log(tokens)
// => string representation of some absurdly high number, maybe "9999999999999999999999" or something like that :)
})
To use with a testnet please instantiate with the following params:
const provider = "https://rinkeby.infura.io" #or your testnet of choice
const controllerAddress = "0x37dC71366Ec655093b9930bc816E16e6b587F968"
LivepeerSDK({ provider, controllerAddress }).then(async sdk => {
mycode...
})
The following section details the rpc API's function signatures and typedefs.
- module~exports
-
livepeer~rpc
- Examples
- getENSName
- getENSAddress
- getBlock
- getEthBalance
- getUnbondingPeriod
- getNumActiveTranscoders
- getMaxEarningsClaimsRounds
- getTotalBonded
- getTokenTotalSupply
- getTokenBalance
- getTokenInfo
- transferToken
- getFaucetAmount
- getFaucetWait
- getFaucetNext
- getFaucetInfo
- getInflation
- getInflationChange
- getDelegatorStatus
- getDelegator
- rebond
- rebondWithHint
- rebondFromUnbonded
- rebondFromUnbondedWithHint
- getPendingStake
- getPendingFees
- getTranscoderIsActive
- getTranscoderStatus
- getTranscoderTotalStake
- getTranscoderPoolMaxSize
- getTranscoder
- getTranscoders
- getProtocolPaused
- getProtocol
- getRoundLength
- getRoundsPerYear
- getCurrentRound
- getCurrentRoundIsInitialized
- getCurrentRoundStartBlock
- getLastInitializedRound
- getCurrentRoundInfo
- tapFaucet
- initializeRound
- createPoll
- getPollCreatorAllowance
- getBondingManagerAllowance
- vote
- claimEarnings
- bondWithHint
- estimateGas
- unbond
- unbondWithHint
- setupTranscoder
- getTargetBondingRate
- withdrawStake
- withdrawStakeWithUnbondLock
- withdrawFees
- getDelegatorUnbondingLocks
- getDelegatorUnbondingLock
- ABIPropDescriptor
- ContractArtifact
- LivepeerSDKOptions
- LivepeerSDK
- TokenInfo
- Protocol
- TxReceipt
- Log
- FaucetInfo
- Broadcaster
- Delegator
- Transcoder
- UnbondingLock
- RoundInfo
- Block
- TxConfig
Livepeer SDK main module exports
Livepeer SDK factory function. Creates an instance of the Livepeer SDK -- an object with useful methods for interacting with Livepeer protocol smart contracts
-
opts
LivepeerSDKOptions SDK configuration options
// Here we're naming the default export "LivepeerSDK"
import LivepeerSDK from "@livepeer/sdk";
// Call the factory function and await its Promise
LivepeerSDK().then((sdk) => {
// Your Livepeer SDK instance is now ready to use
});
Returns Promise<LivepeerSDK>
"rpc" namespace of a Livepeer SDK instance
import LivepeerSDK from "@livepeer/sdk";
LivepeerSDK().then(({ rpc }) => {
// Here, we're destructuring the sdk to expose only its rpc namespace
// Now, you you are able call rpc.<method-name>()
// All rpc method yield Promises. Their usage is further explained below.
});
Gets the ENS name for an address. This is known as a reverse lookup. Unfortunately, users must explicitly set their own resolver. So most of the time, this method just returns an empty string More info here: (https://docs.ens.domains/en/latest/userguide.html#reverse-name-resolution)
-
address
string address to look up an ENS name for
await rpc.getENSName("0xd34db33f...");
// => string
Gets the address for an ENS name
-
name
string ENS name to look up an address for
await rpc.getENSAddress("vitalik.eth");
// => string
Gets a block by number, hash, or keyword ('earliest' | 'latest')
await rpc.getBlock('latest')
// => {
"number": string,
"hash": string,
"parentHash": string,
"nonce": string,
"sha3Uncles": string,
"logsBloom": string,
"transactionsRoot": string,
"stateRoot": string,
"receiptsRoot": string,
"miner": string,
"mixHash": string,
"difficulty": string,
"totalDifficulty": string,
"extraData": string,
"size": string,
"gasLimit": string,
"gasUsed": string,
"timestamp": number,
"transactions": Array<Transaction>,
"transactionsRoot": string,
"uncles": Array<Uncle>,
}
Gets the ETH balance for an account
-
addr
string ETH account address
await rpc.getEthBalance("0xf00...");
// => string
Gets the unbonding period for transcoders
await rpc.getUnbondingPeriod();
// => string
Gets the number of active transcoders
await rpc.getNumActiveTranscoders();
// => string
Gets the maximum earnings for claims rounds
await rpc.getMaxEarningsClaimsRounds();
// => string
Gets the total amount of bonded tokens
await rpc.getTotalBonded();
// => string
Gets the total supply of token (LTPU) available in the protocol
await rpc.getTokenTotalSupply();
// => string
Gets a user's token balance (LPTU)
-
addr
string user's ETH address
await rpc.getTokenBalance("0xf00...");
// => string
Gets general information about tokens
-
addr
string user's ETH address
await rpc.getTokenInfo();
// => TokenInfo { totalSupply: string, balance: string }
Transfers tokens (LPTU) from one account to another
-
to
string the account ETH address to send tokens to -
amount
string the amount of token to send (LPTU) -
tx
TxConfig an object specifying thefrom
value of the transaction (optional, defaultconfig.defaultTx
)
await rpc.transferToken("0xf00...", "10");
// => TxReceipt {
// transactionHash: string,
// transactionIndex": BN,
// blockHash: string,
// blockNumber: BN,
// cumulativeGasUsed: BN,
// gasUsed: BN,
// contractAddress: string,
// logs: Array<Log {
// logIndex: BN,
// blockNumber: BN,
// blockHash: string,
// transactionHash: string,
// transactionIndex: string,
// address: string,
// data: string,
// topics: Array<string>
// }>
// }
The amount of LPT the faucet distributes when tapped
await rpc.getFaucetAmount();
// => string
How often an address can tap the faucet (in hours)
await rpc.getFaucetWait();
// => string
Next timestamp at which the given address will be allowed to tap the faucet
-
addr
string user's ETH address
await rpc.getFaucetNext();
// => string
Info about the state of the LPT faucet
-
addr
string user's ETH address
await rpc.getFaucetInfo("0xf00...");
// => FaucetInfo {
// amount: string,
// wait: string,
// next: string,
// }
Returns Promise<FaucetInfo>
Gets the per round inflation rate
await rpc.getInflation();
// => string
Gets the change in inflation rate per round until the target bonding rate is achieved
await rpc.getInflationChange();
// => string
The delegator status of the given address
-
addr
string user's ETH address
await rpc.getDelegatorStatus("0xf00...");
// => 'Pending' | 'Bonded' | 'Unbonded'
General info about a delegator
-
addr
string user's ETH address
await rpc.getDelegator("0xf00...");
// => Delegator {
// allowance: string,
// address: string,
// bondedAmount: string,
// delegateAddress: string,
// delegateAmount: string,
// fees: string,
// lastClaimRound: string,
// pendingFees: string,
// pendingStake: string,
// startRound: string,
// status: 'Pending' | 'Bonded' | 'Unbonding' | 'Unbonded',
// withdrawRound: string,
// nextUnbondingLockId: string,
// }
Rebonds LPT from an address
-
unbondingLockId
number -
tx
TxConfig an object specifying thefrom
andgas
values of the transaction (optional, defaultconfig.defaultTx
)
await rpc.rebond(0);
// => TxReceipt {
// transactionHash: string,
// transactionIndex": BN,
// blockHash: string,
// blockNumber: BN,
// cumulativeGasUsed: BN,
// gasUsed: BN,
// contractAddress: string,
// logs: Array<Log {
// logIndex: BN,
// blockNumber: BN,
// blockHash: string,
// transactionHash: string,
// transactionIndex: string,
// address: string,
// data: string,
// topics: Array<string>
// }>
// }
Rebonds LPT from an address with hint
-
unbondingLockId
number -
newPosPrev
string -
newPosNext
string -
tx
TxConfig an object specifying thefrom
andgas
values of the transaction (optional, defaultconfig.defaultTx
)
await rpc.rebondWithHint(0, "0x", "0x");
// => TxReceipt {
// transactionHash: string,
// transactionIndex": BN,
// blockHash: string,
// blockNumber: BN,
// cumulativeGasUsed: BN,
// gasUsed: BN,
// contractAddress: string,
// logs: Array<Log {
// logIndex: BN,
// blockNumber: BN,
// blockHash: string,
// transactionHash: string,
// transactionIndex: string,
// address: string,
// data: string,
// topics: Array<string>
// }>
// }
Rebonds LPT from an address
-
to
string -
unbondingLockId
number -
tx
TxConfig an object specifying thefrom
andgas
values of the transaction (optional, defaultconfig.defaultTx
)
await rpc.rebondFromUnbonded("0x", 1);
// => TxReceipt {
// transactionHash: string,
// transactionIndex": BN,
// blockHash: string,
// blockNumber: BN,
// cumulativeGasUsed: BN,
// gasUsed: BN,
// contractAddress: string,
// logs: Array<Log {
// logIndex: BN,
// blockNumber: BN,
// blockHash: string,
// transactionHash: string,
// transactionIndex: string,
// address: string,
// data: string,
// topics: Array<string>
// }>
// }
Rebonds LPT from an address with hint
-
to
string -
unbondingLockId
number -
newPosPrev
string -
newPosNext
string -
tx
TxConfig an object specifying thefrom
andgas
values of the transaction (optional, defaultconfig.defaultTx
)
await rpc.rebondFromUnbondedWithHint("0x", 1, "0x", "0x");
// => TxReceipt {
// transactionHash: string,
// transactionIndex": BN,
// blockHash: string,
// blockNumber: BN,
// cumulativeGasUsed: BN,
// gasUsed: BN,
// contractAddress: string,
// logs: Array<Log {
// logIndex: BN,
// blockNumber: BN,
// blockHash: string,
// transactionHash: string,
// transactionIndex: string,
// address: string,
// data: string,
// topics: Array<string>
// }>
// }
Get a delegator's pending stake
await rpc.getPendingStake("0xf00...");
// => string
Get a delegator's pending fees
await rpc.getPendingFees("0xf00...");
// => string
Whether or not the transcoder is active
-
addr
string user's ETH address
await rpc.getTranscoderIsActive("0xf00...");
// => boolean
Gets the status of a transcoder
-
addr
string user's ETH address
await rpc.getTranscoderStatus("0xf00...");
// => 'NotRegistered' | 'Registered'
Gets a transcoder's total stake
-
addr
string user's ETH address
await rpc.getTranscoderTotalStake("0xf00...");
// => string
Gets a transcoder's pool max size
await rpc.getTranscoderPoolMaxSize();
// => string
Gets info about a transcoder
-
addr
string user's ETH address
await rpc.getTranscoder("0xf00...");
// => Transcoder {
// active: boolean,
// address: string,
// rewardCut: string,
// feeShare: string,
// lastRewardRound: string,
// pendingRewardCut string,
// pendingFeeShare: string,
// pendingPricePerSegment: string,
// pricePerSegment: string,
// status: 'NotRegistered' | 'Registered',
// totalStake: string,
// }
Returns Promise<Transcoder>
Gets transcoders
await rpc.getTranscoders();
// => Array<Transcoder>
Returns Array<Transcoder>
Whether the protocol is paused
await rpc.getProtocolPaused();
// => boolean
Gets the protocol
await rpc.getProtocol()
// => Protocol {
paused
totalTokenSupply
totalBondedToken
targetBondingRate
transcoderPoolMaxSize
maxEarningsClaimsRounds
}
Gets the length of a round (in blocks)
await rpc.getRoundLength();
// => string
Gets the estimated number of rounds per year
await rpc.getRoundsPerYear();
// => string
Gets the number of the current round
await rpc.getCurrentRound();
// => string
Whether or not the current round is initalized
await rpc.getCurrentRoundIsInitialized();
// => boolean
The block at which the current round started
await rpc.getCurrentRoundStartBlock();
// => string
The previously intitialized round
await rpc.getLastInitializedRound();
// => string
Gets general information about the rounds in the protocol
await rpc.getCurrentRoundInfo();
// => RoundInfo {
// id: string,
// initialized: boolean,
// startBlock: string,
// lastInitializedRound: string,
// length: string,
// }
Gets LPT from the faucet
-
tx
TxConfig an object specifying thefrom
andgas
values of the transaction (optional, defaultconfig.defaultTx
)
await rpc.tapFaucet("1337");
// => TxReceipt {
// transactionHash: string,
// transactionIndex": BN,
// blockHash: string,
// blockNumber: BN,
// cumulativeGasUsed: BN,
// gasUsed: BN,
// contractAddress: string,
// logs: Array<Log {
// logIndex: BN,
// blockNumber: BN,
// blockHash: string,
// transactionHash: string,
// transactionIndex: string,
// address: string,
// data: string,
// topics: Array<string>
// }>
// }
Initializes the round
-
tx
TxConfig an object specifying thefrom
andgas
values of the transaction (optional, defaultconfig.defaultTx
)
await rpc.initializeRound();
// => TxReceipt {
// transactionHash: string,
// transactionIndex": BN,
// blockHash: string,
// blockNumber: BN,
// cumulativeGasUsed: BN,
// gasUsed: BN,
// contractAddress: string,
// logs: Array<Log {
// logIndex: BN,
// blockNumber: BN,
// blockHash: string,
// transactionHash: string,
// transactionIndex: string,
// address: string,
// data: string,
// topics: Array<string>
// }>
// }
Creates a poll
-
proposal
string The IPFS multihash for the proposal -
tx
TxConfig an object specifying thefrom
andgas
values of the transaction (optional, defaultconfig.defaultTx
)
await rpc.createPoll("Qm...");
// => TxReceipt {
// transactionHash: string,
// transactionIndex": BN,
// blockHash: string,
// blockNumber: BN,
// cumulativeGasUsed: BN,
// gasUsed: BN,
// contractAddress: string,
// logs: Array<Log {
// logIndex: BN,
// blockNumber: BN,
// blockHash: string,
// transactionHash: string,
// transactionIndex: string,
// address: string,
// data: string,
// topics: Array<string>
// }>
// }
Get PollCreator transfer allowance
-
addr
string user's ETH address -
tx
TxConfig an object specifying thefrom
andgas
values of the transaction (optional, defaultconfig.defaultTx
)
await rpc.getPollCreatorAllowance("0x...");
// => TxReceipt {
// transactionHash: string,
// transactionIndex": BN,
// blockHash: string,
// blockNumber: BN,
// cumulativeGasUsed: BN,
// gasUsed: BN,
// contractAddress: string,
// logs: Array<Log {
// logIndex: BN,
// blockNumber: BN,
// blockHash: string,
// transactionHash: string,
// transactionIndex: string,
// address: string,
// data: string,
// topics: Array<string>
// }>
// }
Get BondingManager transfer allowance
-
addr
string user's ETH address -
tx
TxConfig an object specifying thefrom
andgas
values of the transaction (optional, defaultconfig.defaultTx
)
await rpc.getBondingManagerAllowance("0x...");
// => TxReceipt {
// transactionHash: string,
// transactionIndex": BN,
// blockHash: string,
// blockNumber: BN,
// cumulativeGasUsed: BN,
// gasUsed: BN,
// contractAddress: string,
// logs: Array<Log {
// logIndex: BN,
// blockNumber: BN,
// blockHash: string,
// transactionHash: string,
// transactionIndex: string,
// address: string,
// data: string,
// topics: Array<string>
// }>
// }
Creates a poll
-
pollAddress
string poll contract address -
choiceId
int vote (0 = yes, 1 = no) -
tx
TxConfig an object specifying thefrom
andgas
values of the transaction (optional, defaultconfig.defaultTx
)
await rpc.initializeRound();
// => TxReceipt {
// transactionHash: string,
// transactionIndex": BN,
// blockHash: string,
// blockNumber: BN,
// cumulativeGasUsed: BN,
// gasUsed: BN,
// contractAddress: string,
// logs: Array<Log {
// logIndex: BN,
// blockNumber: BN,
// blockHash: string,
// transactionHash: string,
// transactionIndex: string,
// address: string,
// data: string,
// topics: Array<string>
// }>
// }
Claims token and eth earnings from the sender's lastClaimRound + 1
through a
given endRound
-
endRound
string the round to claim earnings until -
tx
TxConfig an object specifying thefrom
andgas
values of the transaction (optional, defaultconfig.defaultTx
)
await rpc.claimEarnings();
// => string
Returns string
Bonds to a transcoder with hint
-
amount
string -
to
string -
oldDelegateNewPosPrev
string -
oldDelegateNewPosNext
string -
currDelegateNewPosPrev
string -
currDelegateNewPosNext
string -
tx
TxConfig an object specifying thefrom
andgas
values of the transaction (optional, defaultconfig.defaultTx
)
await rpc.bondWithHint("100", "0x", "0x", "0x", "0x", "0x");
// => TxReceipt {
// transactionHash: string,
// transactionIndex": BN,
// blockHash: string,
// blockNumber: BN,
// cumulativeGasUsed: BN,
// gasUsed: BN,
// contractAddress: string,
// logs: Array<Log {
// logIndex: BN,
// blockNumber: BN,
// blockHash: string,
// transactionHash: string,
// transactionIndex: string,
// address: string,
// data: string,
// topics: Array<string>
// }>
// }
Gets the estimated amount of gas to be used by a smart contract method.
-
contractName
string : name of contract containing method you wish to find gas price for. methodName: name of method on contract. methodArgs: array of argument to be passed to the contract in specified order. tx: (optioanl){ from: address - 0x..., gas: number, value: (optional) number or string containing number } -
methodName
string -
methodArgs
Array -
tx
(optional, defaultconfig.defaultTx
)
await rpc.estimateGas("BondingManager", "bond", [10, "0x00....."]);
// => 33454
Returns Promise<number> containing estimated gas price
Unbonds LPT from an address
-
amount
string -
tx
TxConfig an object specifying thefrom
andgas
values of the transaction (optional, defaultconfig.defaultTx
)
await rpc.unbond(amount);
// => TxReceipt {
// transactionHash: string,
// transactionIndex": BN,
// blockHash: string,
// blockNumber: BN,
// cumulativeGasUsed: BN,
// gasUsed: BN,
// contractAddress: string,
// logs: Array<Log {
// logIndex: BN,
// blockNumber: BN,
// blockHash: string,
// transactionHash: string,
// transactionIndex: string,
// address: string,
// data: string,
// topics: Array<string>
// }>
// }
Unbonds LPT from an address with hint
-
amount
string -
newPosPrev
string -
newPosNext
string -
tx
TxConfig an object specifying thefrom
andgas
values of the transaction (optional, defaultconfig.defaultTx
)
await rpc.unbondWithHint("100", "0x", "0x");
// => TxReceipt {
// transactionHash: string,
// transactionIndex": BN,
// blockHash: string,
// blockNumber: BN,
// cumulativeGasUsed: BN,
// gasUsed: BN,
// contractAddress: string,
// logs: Array<Log {
// logIndex: BN,
// blockNumber: BN,
// blockHash: string,
// transactionHash: string,
// transactionIndex: string,
// address: string,
// data: string,
// topics: Array<string>
// }>
// }
Sets transcoder parameters
-
rewardCut
string the block reward cut you wish to set -
feeShare
string the fee share you wish to set -
pricePerSegment
string the price per segment you wish to set -
tx
TxConfig an object specifying thefrom
andgas
values of the transaction (optional, defaultconfig.defaultTx
)
await rpc.setupTranscoder("10", "10", "5");
// => TxReceipt {
// transactionHash: string,
// transactionIndex": BN,
// blockHash: string,
// blockNumber: BN,
// cumulativeGasUsed: BN,
// gasUsed: BN,
// contractAddress: string,
// logs: Array<Log {
// logIndex: BN,
// blockNumber: BN,
// blockHash: string,
// transactionHash: string,
// transactionIndex: string,
// address: string,
// data: string,
// topics: Array<string>
// }>
// }
Get target bonding rate
await rpc.getTargetBondingRate();
// => string
Withdraws earned token (Transfers a sender's delegator bondedAmount
to their
tokenBalance
)
-
unbondLockId
string? the unbond lock id -
tx
TxConfig an object specifying thefrom
andgas
values of the transaction (optional, defaultconfig.defaultTx
)
await rpc.withdrawStake();
// => TxReceipt {
// transactionHash: string,
// transactionIndex": BN,
// blockHash: string,
// blockNumber: BN,
// cumulativeGasUsed: BN,
// gasUsed: BN,
// contractAddress: string,
// logs: Array<Log {
// logIndex: BN,
// blockNumber: BN,
// blockHash: string,
// transactionHash: string,
// transactionIndex: string,
// address: string,
// data: string,
// topics: Array<string>
// }>
// }
Returns TxReceipt
Withdraws earned token (Transfers a sender's delegator bondedAmount
to their
tokenBalance
)
-
unbondlock
{id: string, amount: string, withdrawRound: string} -
tx
TxConfig an object specifying thefrom
andgas
values of the transaction (optional, defaultconfig.defaultTx
)
await rpc.withdrawStakeWithUnbondLock(unbondlock);
// => TxReceipt {
// transactionHash: string,
// transactionIndex": BN,
// blockHash: string,
// blockNumber: BN,
// cumulativeGasUsed: BN,
// gasUsed: BN,
// contractAddress: string,
// logs: Array<Log {
// logIndex: BN,
// blockNumber: BN,
// blockHash: string,
// transactionHash: string,
// transactionIndex: string,
// address: string,
// data: string,
// topics: Array<string>
// }>
// }
Returns TxReceipt
Withdraws earned fees (Transfers a sender's delegator fees
to their
ethBalance
)
-
tx
TxConfig an object specifying thefrom
andgas
values of the transaction (optional, defaultconfig.defaultTx
)
await rpc.withdrawFees();
// => TxReceipt {
// transactionHash: string,
// transactionIndex": BN,
// blockHash: string,
// blockNumber: BN,
// cumulativeGasUsed: BN,
// gasUsed: BN,
// contractAddress: string,
// logs: Array<Log {
// logIndex: BN,
// blockNumber: BN,
// blockHash: string,
// transactionHash: string,
// transactionIndex: string,
// address: string,
// data: string,
// topics: Array<string>
// }>
// }
Returns TxReceipt
Get all the unbonding locks for a delegator
-
addr
string delegator's ETH address
await rpc.getDelegatorUnbondingLocks("0xf00...");
// => UnbondingLock [{
// id: string,
// delegator: string,
// amount: string,
// withdrawRound: string
// }]
Returns Promise<Array<UnbondingLock>>
Get an unbonding lock for a delegator
await rpc.getDelegatorUnbondingLock("0xf00...", 1);
// => UnbondingLock {
// id: string,
// delegator: string,
// amount: string,
// withdrawRound: string
// }
Returns Promise<UnbondingLock>
ABI property descriptor
Type: Object
-
constants
boolean is the method constant? -
inputs
Array<{name: string, type: string}> the method params -
outputs
Array<{name: string, type: string}> method return values -
payable
boolean is the method payable? -
stateMutability
string type of state mutability -
type
string type of contract property
Mostly "truffle
-style" ABI artifacts but no bytecode/network properties
required
Type: Object
-
name
string name of the contract -
abi
Array<ABIPropDescriptor> lists info about contract properties
SDK configuration options
Type: Object
-
controllerAddress
string? The address of the delpoyed Controller contract -
provider
string? The ETH http provider for rpc methods -
gas
number? the amount of gas to include with transactions by default -
artifacts
Object<string, ContractArtifact> an object containing contract name -> ContractArtifact mappings -
privateKeys
Object<string, string> an object containing public -> private key mappings. Should be specified if using the SDK for transactions without MetaMask (via CLI, etc) -
account
(string | number) the account that will be used for transacting and data-fetching. Can be one of the publicKeys specified in theprivateKeys
option or an index of an account available via MetaMask
An object containing contract info and utility methods for interacting with the Livepeer protocol's smart contracts
Type: Object
-
config
Object<string, any> this prop is mostly for debugging purposes and could change a lot in the future. Currently, it contains the following props:abis
,accounts
,contracts
,defaultTx
,eth
-
constants
Object<string, any> Exposes some constant values. Currently, it contains the following props:ADDRESS_PAD
,DELEGATOR_STATUS
,EMPTY_ADDRESS
,TRANSCODER_STATUS
,VIDEO_PROFILES
,VIDEO_PROFILE_ID_SIZE
-
create
Function same as thecreateLivepeerSDK
function -
events
Object<string, Object> Object mapping an event name -> contract event descriptor object -
rpc
Object<string, Function> contains all of the rpc methods available for interacting with the Livepeer protocol -
utils
Object<string, Function> contains utility methods. Mostly here just because. Could possibly be removed or moved into its own module in the future
An object containing the total token supply and a user's account balance.
Type: Object
-
totalSupply
string total supply of token available in the protocol (LPTU) -
balance
string user's token balance (LPTU)
A Protocol struct
Type: Object
-
paused
boolean the protocol paused or not -
totalTokenSupply
string total token supply for protocol -
totalBondedToken
string total bonded token for protocol -
targetBondingRate
string target bonding rate for protocol -
transcoderPoolMaxSize
string transcoder pool max size
Transaction receipt
Type: Object
-
transactionHash
string the transaction hash -
transactionIndex
BN the transaction index -
blockHash
string the transaction block hash -
blockNumber
BN the transaction block number -
cumulativeGasUsed
BN the cumulative gas used in the transaction -
gasUsed
BN the gas used in the transaction -
contractAddress
string the contract address of the transaction method -
logs
Array<Log> an object containing logs that were fired during the transaction
An object representing a contract log
Type: Object
-
logIndex
BN the log index -
blockNumber
BN the log block number -
blockHash
string the log block hash -
transactionHash
string the log's transaction hash -
transactionIndex
BN the log's transaction index -
address
string the log's address -
data
string the log's data -
topics
Array<string> the log's topics
Information about the status of the LPT faucet
Type: Object
-
amount
string the amount distributed by the faucet -
wait
string the faucet request cooldown time -
next
string the next time a valid faucet request may be made
A Broadcaster struct
Type: Object
-
address
string the ETH address of the broadcaster -
deposit
string the amount of LPT the broadcaster has deposited -
withdrawBlock
string the next block at which a broadcaster may withdraw their deposit
A Delegator struct
Type: Object
-
allowance
string the delegator's LivepeerToken approved amount for transfer -
address
string the delegator's ETH address -
bondedAmount
string The amount of LPTU a delegator has bonded -
delegateAddress
string the ETH address of the delegator's delegate -
delegatedAmount
string the amount of LPTU the delegator has delegated -
fees
string the amount of LPTU a delegator has collected -
lastClaimRound
string the last round that the delegator claimed reward and fee pool shares -
pendingFees
string the amount of ETH the delegator has earned up to the current round -
pendingStake
string the amount of token the delegator has earned up to the current round -
startRound
string the round the delegator becomes bonded and delegated to its delegate -
status
string the delegator's status -
withdrawableAmount
string the amount of LPTU a delegator can withdraw -
withdrawRound
string the round the delegator can withdraw its stake -
nextUnbondingLockId
string the next unbonding lock ID for the delegator
A Transcoder struct
Type: Object
-
active
boolean whether or not the transcoder is active -
address
string the transcoder's ETH address -
rewardCut
string % of block reward cut paid to transcoder by a delegator -
feeShare
string % of fees paid to delegators by transcoder -
lastRewardRound
string last round that the transcoder called reward -
pendingRewardCut
string pending block reward cut for next round if the transcoder is active -
pendingFeeShare
string pending fee share for next round if the transcoder is active -
pendingPricePerSegment
string pending price per segment for next round if the transcoder is active -
pricePerSegment
string price per segment for a stream (LPTU) -
status
string the transcoder's status -
totalStake
string total tokens delegated toward a transcoder (including their own)
An UnbondingLock struct
Type: Object
-
id
string the unbonding lock ID -
delegator
string the delegator's ETH address -
amount
string the amount of tokens being unbonded -
withdrawRound
string the round at which unbonding period is over and tokens can be withdrawn
An object containing information about the current round
Type: Object
-
id
string the number of the current round -
initialized
boolean whether or not the current round is initialized -
startBlock
string the start block of the current round -
lastInitializedRound
string the last round that was initialized prior to the current -
length
string the length of rounds
An object containing information about an Ethereum block
Type: Object
-
number
string block number -
hash
string block hash -
parentHash
string parent has of the block -
nonce
string block nonce -
sha3Uncles
string block sha3 uncles -
logsBloom
string logss bloom for the block -
transactionsRoot
string block transaction root hash -
stateRoot
string block state root hash -
receiptsRoot
string block receipts root hash -
miner
string block miner hash -
mixHash
string block mixHash -
difficulty
string difficulty int -
totalDifficulty
string total difficulty int -
extraData
string hash of extra data -
size
string block size -
gasLimit
string block gas limit -
gasUsed
string gas used in block -
timestamp
number block timestamp -
transactions
string block transactions hash -
uncles
string block uncles hash -
transactions
Array<Transaction> transactions in the block -
transactionsRoot
string root transaction hash -
uncles
Array<Uncle> block uncles
Transaction config object
Type: Object