Sub-Adapters 1
Preview and test each sub adapter.
Livepeer (livepeer)
Metadata
- ID
- livepeer
- name
"Livepeer"
- icon
- protocolLaunch
"2018-10-21"
- category
"Network Protocol"
- subcategory
"Compute, Video"
- description
"Livepeer is a decentralized video streaming network built on the Ethereum blockchain."
- feeDescription
"Broadcasters pay fees in ETH for usage of transcoding services. LPT stakers earn a share of these fees."
- blockchain
"Ethereum"
- source
"The Graph Protocol"
- website
"https://livepeer.org/"
- tokenTicker
"LPT"
- tokenCoingecko
"livepeer"
- events
[]
Queries
Adapter Code
Check the entire code written for the Adapter.
Source code
1export const name = 'Livepeer';
2export const version = '0.0.3';
3export const license = 'MIT';
4
5export function setup(sdk: Context) {
6 const getFees = async (startDate: string, endDate: string): Promise<number> => {
7 const startOfDayBlock = await sdk.chainData.getBlockNumber(startDate);
8 const endOfDayBlock = await sdk.chainData.getBlockNumber(endDate);
9
10 const data = await sdk.graph.query(
11 'hepnerthomas/livepeer-revenues',
12 `query txFees($startOfDay: Int!, $endOfDay: Int!){
13 startOfDay: livepeer(id: "Livepeer", block: {number: $startOfDay}) {
14 usdCollected
15 }
16 endOfDay: livepeer(id: "Livepeer", block: {number: $endOfDay}) {
17 usdCollected
18 }
19 }`,
20 {
21 variables: {
22 startOfDay: startOfDayBlock,
23 endOfDay: endOfDayBlock,
24 },
25 },
26 );
27
28 const fees = parseFloat(data.endOfDay.usdCollected) - parseFloat(data.startOfDay.usdCollected);
29
30 return fees;
31 }
32
33 const getOneDayFees = (date: string) => {
34 const nextDay = sdk.date.offsetDaysFormatted(date, 1);
35 return getFees(date, nextDay);
36 }
37
38 sdk.register({
39 id: 'livepeer',
40 queries: {
41 oneDayTotalFees: getOneDayFees,
42 // oneDayProtocolFees: getOneDayFees,
43 dateRangeTotalFees: getFees,
44 // dateRangeProtocolFees: getFees,
45
46 },
47 metadata: {
48 name: 'Livepeer',
49 icon: sdk.ipfs.getDataURILoader('QmakL2bw1isaMrZzWyfu2dd2G6WNzX2FwqkYFwjVtXEXBB', 'image/png'),
50 protocolLaunch: '2018-10-21',
51 category: 'Network Protocol',
52 subcategory: 'Compute, Video',
53 description: 'Livepeer is a decentralized video streaming network built on the Ethereum blockchain.',
54 feeDescription: 'Broadcasters pay fees in ETH for usage of transcoding services. LPT stakers earn a share of these fees.',
55 blockchain: 'Ethereum',
56 source: 'The Graph Protocol',
57 website: 'https://livepeer.org/',
58 tokenTicker: 'LPT',
59 tokenCoingecko: 'livepeer',
60 events: [
61 ],
62 },
63 })
64}
It's something off?
Report it to the discussion board on Discord, we will take care of it.