GraphQL SDK
A GraphQL schema that can be used to simplify protocol interactions in the browser or node.js.
Table of Contents
Installation
yarn add @livepeer/graphql-sdk
Schema Types
Table of Contents
Query
Contains all protocol data-fetching queries
Field | Argument | Type | Description |
---|---|---|---|
account | Account! |
An Account by ETH address or ENS name |
|
id | String | ||
broadcaster | Broadcaster! |
A Broadcaster by ETH address |
|
id | String! | ||
coinbase | String! |
The currently authenticated user's ETH address |
|
currentBlock | Block! |
The current Ethereum block |
|
currentRound | Round! |
The current round in the Livepeer protocol |
|
delegator | Delegator! |
A Delegator by ETH address |
|
id | String! | ||
job | Job! |
A Job by id |
|
id | String! | ||
jobs | [Job!]! |
A list of Jobs |
|
broadcaster | String | ||
skip | Int | ||
limit | Int | ||
me | Account! |
The currently selected account (usually set by something like MetaMask) |
|
transactions | [Transaction!]! |
All transactions to or from an account between the given start block and end block |
|
address | String! | ||
startBlock | String | ||
endBlock | String | ||
skip | String | ||
limit | String | ||
sort | String | ||
transcoder | Transcoder! |
A Transcoder by ETH address |
|
id | String! | ||
transcoders | [Transcoder!]! |
A list of Transcoders |
|
skip | Int | ||
first | Int | ||
protocol | Protocol |
The protocol as a whole |
Objects
Account
A type that describes a Livepeer account
Field | Argument | Type | Description |
---|---|---|---|
id | String! |
The ETH address for an account |
|
ensName | String! |
The ENS name for an account |
|
ethBalance | String! |
The ETH balance for an account |
|
tokenBalance | String! |
The Livepeer Token (LPTU) balance for an account |
|
broadcaster | Broadcaster! |
The broadcaster info for an account |
|
delegator | Delegator! |
The delegator info for an account |
|
transcoder | Transcoder! |
The transcoder info for an account |
Block
Info about an Ethereum block.
Field | Argument | Type | Description |
---|---|---|---|
id | String! |
The block number |
Broadcaster
Submit transcode jobs for live video streams.
Field | Argument | Type | Description |
---|---|---|---|
id | String! |
The broadcaster's ETH address |
|
ensName | String! |
The ENS name for an account |
|
deposit | String! |
The broadcaster's ETH deposit (required to create a Job) |
|
withdrawBlock | String! |
The earliest ETH block at which the broadcaster is eligible to withdraw their deposited ETH |
|
jobs | [Job!]! |
The jobs created by a broadcaster |
|
skip | Int | ||
limit | Int |
Delegator
Users that bond tokens and delegate their bonded stake to other users, usually registered transcoders in exchange for shared rewards and fees.
Field | Argument | Type | Description |
---|---|---|---|
id | String! |
The ETH address of a delegator |
|
ensName | String! |
The ENS name for an account |
|
allowance | String! |
The delegator's token allowance |
|
bondedAmount | String! |
The amount of Livepeer Token a delegator has bonded |
|
fees | String! |
The amount of fees a delegator has collected |
|
delegateAddress | String! |
The ETH address of the delegate (the one whom the delegator has bonded to) |
|
delegatedAmount | String! |
The amount of Livepeer Token the delegator has delegated |
|
lastClaimRound | String! |
The last round that the delegator claimed reward and fee pool shares |
|
pendingFees | String! |
The total amount of ETH the delegator has earned through the current round |
|
pendingStake | String! |
The total amount of tokens the delegator has earned through the current round |
|
startRound | String! |
The round the delegator becomes bonded and delegated to its delegate |
|
status | DelegatorStatus! |
The status of a delegator |
|
withdrawAmount | String! |
The amount of Livepeer Token to withdraw for a delegator |
|
withdrawRound | String! |
The round the delegator can withdraw its stake. |
|
nextUnbondingLockId | String! |
The ID of the delegator's next unbonding lock |
Job
A transcode job, created by a broadcaster
Field | Argument | Type | Description |
---|---|---|---|
id | String! |
Unique identifer for job |
|
broadcaster | String! |
Address of broadcaster that requested the transcoding job |
|
broadcasterENSName | String! |
The broadcaster's ENS name |
|
profiles | [JobProfile!]! |
Transcoding profiles associated with the job |
|
streamId | String! |
Unique identifier for the stream |
JobProfile
A job's transcoding profile
Field | Argument | Type | Description |
---|---|---|---|
id | String! |
The hashcode for the transcoding profile |
|
name | String! |
The name of the profile |
|
bitrate | String! |
The profile bitrate |
|
framerate | Int! |
The profile framerate |
|
resolution | String! |
The screen resolution of the profile |
Mutation
Contains all protocol transaction queries
Field | Argument | Type | Description |
---|---|---|---|
approve | Boolean |
Approve an amount for an ERC20 token transfer |
|
type | String! | ||
amount | String! | ||
bond | JSON |
Submits a bond transaction for a previously approved amount |
|
to | String! | ||
amount | String! | ||
claimEarnings | Boolean |
Claims earnings from your last claim round through specified round |
|
endRound | String! | ||
sendTransaction | Boolean |
Sends a transaction based on an input object |
|
options | JSON! | ||
unbond | Boolean |
Submits a bond transaction for a previously approved amount |
Protocol
Field | Argument | Type | Description |
---|---|---|---|
id | String! |
Protocol id |
|
paused | Boolean! |
Protocol paused |
|
totalTokenSupply | String! |
Protocol totalTokenSupply |
|
totalBondedToken | String! |
Protocol totalBondedToken |
|
targetBondingRate | String! |
Protocol targetBondingRate |
|
transcoderPoolMaxSize | String! |
Protocol transcoderPoolMaxSize |
|
maxEarningsClaimsRounds | String! |
Protocol maxEarningsClaimsRounds |
Round
Submit transcode jobs for live video streams.
Field | Argument | Type | Description |
---|---|---|---|
id | String! |
The round number |
|
initialized | Boolean! |
Whether the round was initialized |
|
lastInitializedRound | String! |
The last previously initialized round |
|
length | String! |
The number of blocks this round lasts for |
|
startBlock | String! |
When the round starts |
Subscription
Field | Argument | Type | Description |
---|---|---|---|
transactionSubmitted | Transaction! |
A newly submitted transaction |
|
transactionConfirmed | Transaction! |
A newly confirmed transaction |
Transaction
An Ethereum transaction receipt
Field | Argument | Type | Description |
---|---|---|---|
id | String! |
The transaction hash |
|
blockNumber | String! | ||
timeStamp | String! | ||
nonce | String! | ||
blockHash | String! | ||
transactionIndex | String! | ||
from | String! | ||
to | String! | ||
value | String! | ||
gas | String! | ||
gasPrice | String! | ||
isError | String! | ||
status | String! | ||
input | String! | ||
contractAddress | String! | ||
cumulativeGasUsed | String! | ||
gasUsed | String! | ||
confirmations | String! | ||
contract | String! | ||
method | String! | ||
params | JSON! |
Transcoder
Perform transcoding work for the network. The transcoders with the most delegated stake are elected as active transcoders that process transcode jobs for the network.
Field | Argument | Type | Description |
---|---|---|---|
id | String! |
The transcoder's ETH address |
|
active | Boolean! |
Whether or not the transcoder is active |
|
ensName | String! |
The ENS name for an account |
|
status | TranscoderStatus! |
The status of the transcoder |
|
lastRewardRound | String! |
Last round that the transcoder called reward |
|
rewardCut | String! |
% of block reward cut paid to transcoder by a delegator |
|
feeShare | String! |
% of fees paid to delegators by transcoder |
|
pricePerSegment | String! |
Price per segment for a stream (LPTU) |
|
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 |
|
totalStake | String! |
Total tokens delegated toward a transcoder (including their own) |
Enums
DelegatorStatus
The possible statuses of a delegator
Value | Description |
---|---|
Pending | |
Bonded | |
Unbonded | |
Unbonding |
TranscoderStatus
The possible statuses of a transcoder
Value | Description |
---|---|
NotRegistered | |
Registered | |
Resigned |
Scalars
Boolean
The Boolean
scalar type represents true
or false
.
Int
The Int
scalar type represents non-fractional signed whole numeric values. Int can represent values between -(2^31) and 2^31 - 1.
JSON
The JSON
scalar type represents JSON values as specified by ECMA-404.
String
The String
scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.