@livepeer/sdk v1.0.1-alpha.10
Livepeer SDK
An SDK for interacting with Livepeer's smart contracts.
Table of Contents
Installation
yarn add @livepeer/sdkUsage
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.
API
Table of Contents
- 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
module~exports
Livepeer SDK main module exports
default
Livepeer SDK factory function. Creates an instance of the Livepeer SDK -- an object with useful methods for interacting with Livepeer protocol smart contracts
Parameters
optsLivepeerSDKOptions SDK configuration options
Examples
// 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>
livepeer~rpc
"rpc" namespace of a Livepeer SDK instance
Examples
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.
});getENSName
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)
Parameters
addressstring address to look up an ENS name for
Examples
await rpc.getENSName("0xd34db33f...");
// => stringgetENSAddress
Gets the address for an ENS name
Parameters
namestring ENS name to look up an address for
Examples
await rpc.getENSAddress("vitalik.eth");
// => stringgetBlock
Gets a block by number, hash, or keyword ('earliest' | 'latest')
Parameters
Examples
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>,
}getEthBalance
Gets the ETH balance for an account
Parameters
addrstring ETH account address
Examples
await rpc.getEthBalance("0xf00...");
// => stringgetUnbondingPeriod
Gets the unbonding period for transcoders
Examples
await rpc.getUnbondingPeriod();
// => stringgetNumActiveTranscoders
Gets the number of active transcoders
Examples
await rpc.getNumActiveTranscoders();
// => stringgetMaxEarningsClaimsRounds
Gets the maximum earnings for claims rounds
Examples
await rpc.getMaxEarningsClaimsRounds();
// => stringgetTotalBonded
Gets the total amount of bonded tokens
Examples
await rpc.getTotalBonded();
// => stringgetTokenTotalSupply
Gets the total supply of token (LTPU) available in the protocol
Examples
await rpc.getTokenTotalSupply();
// => stringgetTokenBalance
Gets a user's token balance (LPTU)
Parameters
addrstring user's ETH address
Examples
await rpc.getTokenBalance("0xf00...");
// => stringgetTokenInfo
Gets general information about tokens
Parameters
addrstring user's ETH address
Examples
await rpc.getTokenInfo();
// => TokenInfo { totalSupply: string, balance: string }transferToken
Transfers tokens (LPTU) from one account to another
Parameters
tostring the account ETH address to send tokens toamountstring the amount of token to send (LPTU)txTxConfig an object specifying thefromvalue of the transaction (optional, defaultconfig.defaultTx)
Examples
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>
// }>
// }getFaucetAmount
The amount of LPT the faucet distributes when tapped
Examples
await rpc.getFaucetAmount();
// => stringgetFaucetWait
How often an address can tap the faucet (in hours)
Examples
await rpc.getFaucetWait();
// => stringgetFaucetNext
Next timestamp at which the given address will be allowed to tap the faucet
Parameters
addrstring user's ETH address
Examples
await rpc.getFaucetNext();
// => stringgetFaucetInfo
Info about the state of the LPT faucet
Parameters
addrstring user's ETH address
Examples
await rpc.getFaucetInfo("0xf00...");
// => FaucetInfo {
// amount: string,
// wait: string,
// next: string,
// }Returns Promise<FaucetInfo>
getInflation
Gets the per round inflation rate
Examples
await rpc.getInflation();
// => stringgetInflationChange
Gets the change in inflation rate per round until the target bonding rate is achieved
Examples
await rpc.getInflationChange();
// => stringgetDelegatorStatus
The delegator status of the given address
Parameters
addrstring user's ETH address
Examples
await rpc.getDelegatorStatus("0xf00...");
// => 'Pending' | 'Bonded' | 'Unbonded'getDelegator
General info about a delegator
Parameters
addrstring user's ETH address
Examples
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,
// }rebond
Rebonds LPT from an address
Parameters
unbondingLockIdnumbertxTxConfig an object specifying thefromandgasvalues of the transaction (optional, defaultconfig.defaultTx)
Examples
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>
// }>
// }rebondWithHint
Rebonds LPT from an address with hint
Parameters
unbondingLockIdnumbernewPosPrevstringnewPosNextstringtxTxConfig an object specifying thefromandgasvalues of the transaction (optional, defaultconfig.defaultTx)
Examples
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>
// }>
// }rebondFromUnbonded
Rebonds LPT from an address
Parameters
tostringunbondingLockIdnumbertxTxConfig an object specifying thefromandgasvalues of the transaction (optional, defaultconfig.defaultTx)
Examples
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>
// }>
// }rebondFromUnbondedWithHint
Rebonds LPT from an address with hint
Parameters
tostringunbondingLockIdnumbernewPosPrevstringnewPosNextstringtxTxConfig an object specifying thefromandgasvalues of the transaction (optional, defaultconfig.defaultTx)
Examples
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>
// }>
// }getPendingStake
Get a delegator's pending stake
Parameters
Examples
await rpc.getPendingStake("0xf00...");
// => stringgetPendingFees
Get a delegator's pending fees
Parameters
Examples
await rpc.getPendingFees("0xf00...");
// => stringgetTranscoderIsActive
Whether or not the transcoder is active
Parameters
addrstring user's ETH address
Examples
await rpc.getTranscoderIsActive("0xf00...");
// => booleangetTranscoderStatus
Gets the status of a transcoder
Parameters
addrstring user's ETH address
Examples
await rpc.getTranscoderStatus("0xf00...");
// => 'NotRegistered' | 'Registered'getTranscoderTotalStake
Gets a transcoder's total stake
Parameters
addrstring user's ETH address
Examples
await rpc.getTranscoderTotalStake("0xf00...");
// => stringgetTranscoderPoolMaxSize
Gets a transcoder's pool max size
Examples
await rpc.getTranscoderPoolMaxSize();
// => stringgetTranscoder
Gets info about a transcoder
Parameters
addrstring user's ETH address
Examples
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>
getTranscoders
Gets transcoders
Examples
await rpc.getTranscoders();
// => Array<Transcoder>Returns Array<Transcoder>
getProtocolPaused
Whether the protocol is paused
Examples
await rpc.getProtocolPaused();
// => booleangetProtocol
Gets the protocol
Examples
await rpc.getProtocol()
// => Protocol {
paused
totalTokenSupply
totalBondedToken
targetBondingRate
transcoderPoolMaxSize
maxEarningsClaimsRounds
}getRoundLength
Gets the length of a round (in blocks)
Examples
await rpc.getRoundLength();
// => stringgetRoundsPerYear
Gets the estimated number of rounds per year
Examples
await rpc.getRoundsPerYear();
// => stringgetCurrentRound
Gets the number of the current round
Examples
await rpc.getCurrentRound();
// => stringgetCurrentRoundIsInitialized
Whether or not the current round is initalized
Examples
await rpc.getCurrentRoundIsInitialized();
// => booleangetCurrentRoundStartBlock
The block at which the current round started
Examples
await rpc.getCurrentRoundStartBlock();
// => stringgetLastInitializedRound
The previously intitialized round
Examples
await rpc.getLastInitializedRound();
// => stringgetCurrentRoundInfo
Gets general information about the rounds in the protocol
Examples
await rpc.getCurrentRoundInfo();
// => RoundInfo {
// id: string,
// initialized: boolean,
// startBlock: string,
// lastInitializedRound: string,
// length: string,
// }tapFaucet
Gets LPT from the faucet
Parameters
txTxConfig an object specifying thefromandgasvalues of the transaction (optional, defaultconfig.defaultTx)
Examples
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>
// }>
// }initializeRound
Initializes the round
Parameters
txTxConfig an object specifying thefromandgasvalues of the transaction (optional, defaultconfig.defaultTx)
Examples
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>
// }>
// }createPoll
Creates a poll
Parameters
proposalstring The IPFS multihash for the proposaltxTxConfig an object specifying thefromandgasvalues of the transaction (optional, defaultconfig.defaultTx)
Examples
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>
// }>
// }getPollCreatorAllowance
Get PollCreator transfer allowance
Parameters
addrstring user's ETH addresstxTxConfig an object specifying thefromandgasvalues of the transaction (optional, defaultconfig.defaultTx)
Examples
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>
// }>
// }getBondingManagerAllowance
Get BondingManager transfer allowance
Parameters
addrstring user's ETH addresstxTxConfig an object specifying thefromandgasvalues of the transaction (optional, defaultconfig.defaultTx)
Examples
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>
// }>
// }vote
Creates a poll
Parameters
pollAddressstring poll contract addresschoiceIdint vote (0 = yes, 1 = no)txTxConfig an object specifying thefromandgasvalues of the transaction (optional, defaultconfig.defaultTx)
Examples
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>
// }>
// }claimEarnings
Claims token and eth earnings from the sender's lastClaimRound + 1 through a
given endRound
Parameters
endRoundstring the round to claim earnings untiltxTxConfig an object specifying thefromandgasvalues of the transaction (optional, defaultconfig.defaultTx)
Examples
await rpc.claimEarnings();
// => stringReturns string
bondWithHint
Bonds to a transcoder with hint
Parameters
amountstringtostringoldDelegateNewPosPrevstringoldDelegateNewPosNextstringcurrDelegateNewPosPrevstringcurrDelegateNewPosNextstringtxTxConfig an object specifying thefromandgasvalues of the transaction (optional, defaultconfig.defaultTx)
Examples
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>
// }>
// }estimateGas
Gets the estimated amount of gas to be used by a smart contract method.
Parameters
contractNamestring : 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 }methodNamestringmethodArgsArraytx(optional, defaultconfig.defaultTx)
Examples
await rpc.estimateGas("BondingManager", "bond", [10, "0x00....."]);
// => 33454Returns Promise<number> containing estimated gas price
unbond
Unbonds LPT from an address
Parameters
amountstringtxTxConfig an object specifying thefromandgasvalues of the transaction (optional, defaultconfig.defaultTx)
Examples
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>
// }>
// }unbondWithHint
Unbonds LPT from an address with hint
Parameters
amountstringnewPosPrevstringnewPosNextstringtxTxConfig an object specifying thefromandgasvalues of the transaction (optional, defaultconfig.defaultTx)
Examples
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>
// }>
// }setupTranscoder
Sets transcoder parameters
Parameters
rewardCutstring the block reward cut you wish to setfeeSharestring the fee share you wish to setpricePerSegmentstring the price per segment you wish to settxTxConfig an object specifying thefromandgasvalues of the transaction (optional, defaultconfig.defaultTx)
Examples
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>
// }>
// }getTargetBondingRate
Get target bonding rate
Examples
await rpc.getTargetBondingRate();
// => stringwithdrawStake
Withdraws earned token (Transfers a sender's delegator bondedAmount to their
tokenBalance)
Parameters
unbondLockIdstring? the unbond lock idtxTxConfig an object specifying thefromandgasvalues of the transaction (optional, defaultconfig.defaultTx)
Examples
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
withdrawStakeWithUnbondLock
Withdraws earned token (Transfers a sender's delegator bondedAmount to their
tokenBalance)
Parameters
unbondlock{id: string, amount: string, withdrawRound: string}txTxConfig an object specifying thefromandgasvalues of the transaction (optional, defaultconfig.defaultTx)
Examples
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
withdrawFees
Withdraws earned fees (Transfers a sender's delegator fees to their
ethBalance)
Parameters
txTxConfig an object specifying thefromandgasvalues of the transaction (optional, defaultconfig.defaultTx)
Examples
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
getDelegatorUnbondingLocks
Get all the unbonding locks for a delegator
Parameters
addrstring delegator's ETH address
Examples
await rpc.getDelegatorUnbondingLocks("0xf00...");
// => UnbondingLock [{
// id: string,
// delegator: string,
// amount: string,
// withdrawRound: string
// }]Returns Promise<Array<UnbondingLock>>
getDelegatorUnbondingLock
Get an unbonding lock for a delegator
Parameters
Examples
await rpc.getDelegatorUnbondingLock("0xf00...", 1);
// => UnbondingLock {
// id: string,
// delegator: string,
// amount: string,
// withdrawRound: string
// }Returns Promise<UnbondingLock>
ABIPropDescriptor
ABI property descriptor
Type: Object
Properties
constantsboolean is the method constant?inputsArray<{name: string, type: string}> the method paramsoutputsArray<{name: string, type: string}> method return valuespayableboolean is the method payable?stateMutabilitystring type of state mutabilitytypestring type of contract property
ContractArtifact
Mostly "truffle-style" ABI artifacts but no bytecode/network properties
required
Type: Object
Properties
namestring name of the contractabiArray<ABIPropDescriptor> lists info about contract properties
LivepeerSDKOptions
SDK configuration options
Type: Object
Properties
controllerAddressstring? The address of the delpoyed Controller contractproviderstring? The ETH http provider for rpc methodsgasnumber? the amount of gas to include with transactions by defaultartifactsObject<string, ContractArtifact> an object containing contract name -> ContractArtifact mappingsprivateKeysObject<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 theprivateKeysoption or an index of an account available via MetaMask
LivepeerSDK
An object containing contract info and utility methods for interacting with the Livepeer protocol's smart contracts
Type: Object
Properties
configObject<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,ethconstantsObject<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_SIZEcreateFunction same as thecreateLivepeerSDKfunctioneventsObject<string, Object> Object mapping an event name -> contract event descriptor objectrpcObject<string, Function> contains all of the rpc methods available for interacting with the Livepeer protocolutilsObject<string, Function> contains utility methods. Mostly here just because. Could possibly be removed or moved into its own module in the future
TokenInfo
An object containing the total token supply and a user's account balance.
Type: Object
Properties
totalSupplystring total supply of token available in the protocol (LPTU)balancestring user's token balance (LPTU)
Protocol
A Protocol struct
Type: Object
Properties
pausedboolean the protocol paused or nottotalTokenSupplystring total token supply for protocoltotalBondedTokenstring total bonded token for protocoltargetBondingRatestring target bonding rate for protocoltranscoderPoolMaxSizestring transcoder pool max size
TxReceipt
Transaction receipt
Type: Object
Properties
transactionHashstring the transaction hashtransactionIndexBN the transaction indexblockHashstring the transaction block hashblockNumberBN the transaction block numbercumulativeGasUsedBN the cumulative gas used in the transactiongasUsedBN the gas used in the transactioncontractAddressstring the contract address of the transaction methodlogsArray<Log> an object containing logs that were fired during the transaction
Log
An object representing a contract log
Type: Object
Properties
logIndexBN the log indexblockNumberBN the log block numberblockHashstring the log block hashtransactionHashstring the log's transaction hashtransactionIndexBN the log's transaction indexaddressstring the log's addressdatastring the log's datatopicsArray<string> the log's topics
FaucetInfo
Information about the status of the LPT faucet
Type: Object
Properties
amountstring the amount distributed by the faucetwaitstring the faucet request cooldown timenextstring the next time a valid faucet request may be made
Broadcaster
A Broadcaster struct
Type: Object
Properties
addressstring the ETH address of the broadcasterdepositstring the amount of LPT the broadcaster has depositedwithdrawBlockstring the next block at which a broadcaster may withdraw their deposit
Delegator
A Delegator struct
Type: Object
Properties
allowancestring the delegator's LivepeerToken approved amount for transferaddressstring the delegator's ETH addressbondedAmountstring The amount of LPTU a delegator has bondeddelegateAddressstring the ETH address of the delegator's delegatedelegatedAmountstring the amount of LPTU the delegator has delegatedfeesstring the amount of LPTU a delegator has collectedlastClaimRoundstring the last round that the delegator claimed reward and fee pool sharespendingFeesstring the amount of ETH the delegator has earned up to the current roundpendingStakestring the amount of token the delegator has earned up to the current roundstartRoundstring the round the delegator becomes bonded and delegated to its delegatestatusstring the delegator's statuswithdrawableAmountstring the amount of LPTU a delegator can withdrawwithdrawRoundstring the round the delegator can withdraw its stakenextUnbondingLockIdstring the next unbonding lock ID for the delegator
Transcoder
A Transcoder struct
Type: Object
Properties
activeboolean whether or not the transcoder is activeaddressstring the transcoder's ETH addressrewardCutstring % of block reward cut paid to transcoder by a delegatorfeeSharestring % of fees paid to delegators by transcoderlastRewardRoundstring last round that the transcoder called rewardpendingRewardCutstring pending block reward cut for next round if the transcoder is activependingFeeSharestring pending fee share for next round if the transcoder is activependingPricePerSegmentstring pending price per segment for next round if the transcoder is activepricePerSegmentstring price per segment for a stream (LPTU)statusstring the transcoder's statustotalStakestring total tokens delegated toward a transcoder (including their own)
UnbondingLock
An UnbondingLock struct
Type: Object
Properties
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
7 years ago
8 years ago
8 years ago
8 years ago
8 years ago