🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
Socket

@iota/iota-rs-wasm

Package Overview
Dependencies
Maintainers
6
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@iota/iota-rs-wasm

WASM binding for the iota.rs library

latest
Source
npmnpm
Version
1.0.0-alpha.4
Version published
Maintainers
6
Created
Source

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-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

  • Install rollup-plugin-copy:
$ npm install rollup-plugin-copy
// or using yarn
$ yarn add rollup-plugin-copy
  • Add the copy plugin usage to the plugins array under rollup.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 plugins array 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 => { ... })

FAQs

Package last updated on 14 Jul 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts