1.0.0-alpha.4 • Published 5 years ago
@iota/iota-rs-wasm v1.0.0-alpha.4
iota.rs-wasm
This is the alpha version of the official WASM binding to IOTA's Rust API.
Web Setup
Install the library:
$ npm install @iota/iota-rs-wasm
// or using yarn
$ yarn add @iota/iota-rs-wasmThe 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
- Install
rollup-plugin-copy:
$ npm install rollup-plugin-copy
// or using yarn
$ yarn add rollup-plugin-copy- Add the copy plugin usage to the
pluginsarray underrollup.config.js:
copy({
targets: [{
src: 'node_modules/@iota/iota-rs-wasm/wasm-web/iota_wasm_bg.wasm',
dest: 'public',
rename: 'iota_client.wasm'
}]
})Webpack
- Install
copy-webpack-plugin:
$ npm install copy-webpack-plugin --save-dev
// or using yarn
$ yarn add copy-webpack-plugin --dev- Add the copy plugin to the
pluginsarray of your webpack config:
new CopyWebpackPlugin([
{
from: 'node_modules/@iota/iota-rs-wasm/wasm-web/iota_wasm_bg.wasm',
to: 'iota_client.wasm'
}
])Usage
Web
import * as client from '@iota/iota-rs-wasm/web'
const uri = 'https://nodes.comnet.thetangle.org'
await client.addNode(uri)
client.getNodeInfo().then(nodeInfo => { ... })Node.js
const client = require('@iota/iota-rs-wasm/node')
const uri = 'https://nodes.comnet.thetangle.org'
await client.addNode(uri)
client.getNodeInfo().then(nodeInfo => { ... })1.0.0-alpha.4
5 years ago
1.0.0-alpha.3
5 years ago
1.0.0-alpha.2
5 years ago
1.0.0-alpha.1
5 years ago
1.0.0-alpha.0
5 years ago