hotweb3
v1.0.12
Published
A JavaScript/TypeScript client for a remote Hotmoka node
Downloads
7
Readme
hotweb3
JavaScript/TypeScript client for a remote Hotmoka node
Usage
// In Browser
<script src="https://cdnjs.cloudflare.com/ajax/libs/axios/0.21.1/axios.min.js"></script>
<script src="dist/hotweb3.js"></script>
<script type="application/javascript">
const remoteNode = new hotweb3.RemoteNode("http://panarea.hotmoka.io");
(async function() {
try {
const takamakacode = await remoteNode.getTakamakaCode();
alert('takamakacode: ' + JSON.stringify(takamakacode));
} catch (e) {
console.error(e);
alert(e);
}
})();
</script>
// In Node.js/JavaScript
const { RemoteNode } = require("hotweb3");
const remoteNode = new RemoteNode("http://panarea.hotmoka.io")
(async function () {
try {
const takamakaCode = await remoteNode.getTakamakaCode()
console.log('takamakaCode', takamakaCode)
} catch (e) {
console.error(e)
}
})()
// In TypeScript
import {
RemoteNode,
TransactionReferenceModel
} from "hotweb3";
const remoteNode = new RemoteNode("http://panarea.hotmoka.io")
(async (): Promise<void> => {
try {
const takamakaCode: TransactionReferenceModel = await remoteNode.getTakamakaCode()
console.log('takamakaCode', takamakaCode)
} catch (e) {
console.error(e)
}
})()
Build
Requirements
Install dependencies
npm install
Bundle source code
npm run bundle
Tests
npm run test:all