Published
Edited
Mar 25, 2020
1 fork
1 star
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
getAccount = async address => {
const acc = { address, balance: 0, txCount: 0, id: address, type: 'account' };
acc.balance = await accountBalance(address);
acc.txCount = await accountTxCount(address);
acc.contractCode = await accountContractCode(address);
acc.isContract = acc.contractCode.length > 2;
return acc;
}
Insert cell
{
svg.call(header);
svg.call(showAccounts);
}
Insert cell
// Search - wait for click to go
{
if (settingsGui.search.Address_TxHash_BlockNum) {
console.log('have search term');
if (searchClicked) {
doSearch(settingsGui.search.Address_TxHash_BlockNum);
}
}
}
Insert cell
mutable searchClicked = false
Insert cell
Insert cell
Insert cell
getTransaction = async hash => {
const tx = await rpcCallResult("eth_getTransactionByHash", [hash]);
tx.id = tx.hash;
tx.type = 'transaction';
return tx;
}
Insert cell
Insert cell
//latestBlock = getLatestBlock()
Insert cell
Insert cell
Insert cell
addBlockMetadata = block => {
return {
...block,
number: parseInt(block.number, 16),
time: parseInt(block.timestamp, 16) * 1000,
id: block.hash,
type: 'block'
};
}
Insert cell
Insert cell
//accountBalance(coinbase)
Insert cell
Insert cell
Insert cell
Insert cell
blockNumber = parseInt(await rpcCallResult("eth_blockNumber"), 16)
Insert cell
Insert cell
accountsList = rpcCallResult("eth_accounts")
Insert cell
//coinbase = rpcCallResult("eth_coinbase")
Insert cell
nodeVersionResponse = rpcCall("net_version")
Insert cell
mutable initialFetch = false
Insert cell
Insert cell
Insert cell
mutable isConnected = false
Insert cell
mutable displayTab = 'blocks'
Insert cell
scaleY = d3.scaleLinear([0, 20], [margins.top, height - margins.bottom])
Insert cell
scaleX = d3.scaleLinear([0, 100], [margins.left, width - margins.right])
Insert cell
accBox = ({ width: 80, height: 20, xseparation: 85, yseparation: 25 })
Insert cell
blockRect = ({ x: 20, width: 80, height: 20 })
Insert cell
margins = ({ top: 30, bottom: 10, left: 20, right: 20 })
Insert cell
height = 600
Insert cell
width = 500
Insert cell
url = settingsGui.nodeUrl
Insert cell
import { wrapGUI } from '@rreusser/control-panel-2-prototype-test'
Insert cell
State = require('https://unpkg.com/controls-state@2.0.0/dist/controls-state.min.js')
Insert cell
moment = require("https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.24.0/moment.min.js")
Insert cell
web3 = require("https://cdn.jsdelivr.net/npm/web3@latest/dist/web3.min.js")
Insert cell
d3 = require("d3@5")
Insert cell
md`## License

The code in this notebook is MIT Licensed.

Copyright (c) 2020 Stonebell Consulting Pty Ltd`
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more