Rewards

node v14.18.1
version: 3.0.0
endpointsharetweet
const axios = require('axios'); const client = require('@liskhq/lisk-client') const url = 'https://service.lisk.io/api/v2/transactions?address=lskh6v4oxw4s26bx3obzsf9wq26g33coo8kztd7wh&limit=100'; const {data} = await axios.get(url); const spaceone_payout = data.data.reduce((prev, current) => { // console.log(current.moduleAssetId, current.sender.username) if(current.moduleAssetId === '2:0' && (current.sender.username === 'spaceone_payout')) { // console.log(current.asset.amount) return BigInt(prev) + BigInt(current.asset.amount); } return prev; }, BigInt(0)); const liskpool_payout = data.data.reduce((prev, current) => { // console.log(current.moduleAssetId, current.sender.username) if(current.moduleAssetId === '2:0' && (current.sender.username === 'liskpool.top')) { // console.log(current.asset.amount) return BigInt(prev) + BigInt(current.asset.amount); } return prev; }, BigInt(0)); const spaceone = client.transactions.convertBeddowsToLSK(spaceone_payout.toString()); const liskpool = client.transactions.convertBeddowsToLSK(liskpool_payout.toString()); const total = Number(spaceone) + Number(liskpool); console.log({ liskpool: liskpool.toString(), spaceone_payout: spaceone.toString(), total })
Loading…

no comments

    sign in to comment