MIT License
This is the alpha version of the official WASM binding to IOTA's Rust API.
Install the library:
$ npm install iota-rs-wasm
// or using yarn
$ yarn add iota-rs-wasm
The library loads the WASM file with an HTTP GET request, so the .wasm file must be copied to the root of the dist folder.
rollup-plugin-copy
:$ npm install rollup-plugin-copy
// or using yarn
$ yarn add rollup-plugin-copy
plugins
array under rollup.config.js
:copy({
targets: [{
src: 'node_modules/iota-rs-wasm/wasm-web/iota_wasm_bg.wasm',
dest: 'public',
rename: 'iota_client.wasm'
}]
})
copy-webpack-plugin
:$ npm install copy-webpack-plugin --save-dev
// or using yarn
$ yarn add copy-webpack-plugin --dev
plugins
array of your webpack config:new CopyWebpackPlugin([
{
from: 'node_modules/iota-rs-wasm/wasm-web/iota_wasm_bg.wasm',
to: 'iota_client.wasm'
}
])
import { Client } from 'iota-rs-wasm/web'
const uri = 'https://nodes.comnet.thetangle.org'
const client = new Client(uri)
client.getNodeInfo().then(nodeInfo => { ... })
const { Client } = require('iota-rs-wasm/node')
const uri = 'https://nodes.comnet.thetangle.org'
const client = new Client(uri)
client.getNodeInfo().then(nodeInfo => { ... })