mirror of
https://github.com/pezkuwichain/pezkuwi-api.git
synced 2026-04-21 23:47:57 +00:00
63 lines
1.7 KiB
HTML
63 lines
1.7 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>Bundler tests</title>
|
|
<style>
|
|
pre {
|
|
margin: 0.5rem 0;
|
|
}
|
|
|
|
pre.header {
|
|
background: #ddd;
|
|
margin-top: 1.5rem;
|
|
padding: 0.25rem 0.75rem;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<script>
|
|
function log (label, result) {
|
|
const pre = document.createElement('pre');
|
|
|
|
if (typeof result !== 'undefined') {
|
|
pre.innerHTML = `${label.padStart(24)} = ${result}`;
|
|
} else {
|
|
pre.innerHTML = label;
|
|
pre.className = 'header';
|
|
}
|
|
|
|
document.body.appendChild(pre);
|
|
}
|
|
</script>
|
|
<script src="node_modules/@pezkuwi/util/bundle-pezkuwi-util.js"></script>
|
|
<script src="node_modules/@pezkuwi/util-crypto/bundle-pezkuwi-util-crypto.js"></script>
|
|
<script src="node_modules/@pezkuwi/keyring/bundle-pezkuwi-keyring.js"></script>
|
|
<script src="packages/types/build/bundle-pezkuwi-types.js"></script>
|
|
<script>
|
|
log('pezkuwiTypes');
|
|
|
|
const { TypeRegistry } = pezkuwiTypes;
|
|
const registry = new TypeRegistry();
|
|
|
|
log('createType', registry.createType('Balance', 1234567890).toHuman());
|
|
</script>
|
|
<script src="packages/api/build/bundle-pezkuwi-api.js"></script>
|
|
<script>
|
|
log('pezkuwiApi');
|
|
|
|
const { ApiPromise, WsProvider } = pezkuwiApi;
|
|
const provider = new WsProvider('wss://rpc.pezkuwi.io');
|
|
|
|
ApiPromise
|
|
.create({ provider })
|
|
.then((api) =>
|
|
// use the derive version, checking that that also works
|
|
api.derive.chain.subscribeNewHeads((h) =>
|
|
log(pezkuwiUtil.formatNumber(h.number.unwrap()), h.hash.toHex())
|
|
)
|
|
);
|
|
</script>
|
|
</body>
|
|
</html>
|