{"_id":"@cycraig/iota-client-wasm","_rev":"2-b12d90902d9711a9591f0ab7b124887e","name":"@cycraig/iota-client-wasm","dist-tags":{"latest":"0.5.0-alpha.2"},"versions":{"0.5.0-alpha.1":{"name":"@cycraig/iota-client-wasm","version":"0.5.0-alpha.1","description":"WebAssembly bindings for the IOTA client library","repository":{"type":"git","url":"git+https://github.com/iotaledger/iota.rs.git"},"author":{"name":"IOTA Foundation","email":"contact@iota.org"},"license":"Apache-2.0","publishConfig":{"access":"public"},"scripts":{"build":"npm run build:nodejs && npm run build:web","build:src":"cargo build --lib --release --target wasm32-unknown-unknown","build:nodejs":"node ./build_scripts/copyNeonDefs.js && npm run build:src && npm run bundle:nodejs && wasm-opt -O node/wasm/client_wasm_bg.wasm -o node/wasm/client_wasm_bg.wasm","build:web":"node ./build_scripts/copyNeonDefs.js && npm run build:src && npm run bundle:web && wasm-opt -O web/wasm/client_wasm_bg.wasm -o web/wasm/client_wasm_bg.wasm","bundle:nodejs":"wasm-bindgen target/wasm32-unknown-unknown/release/client_wasm.wasm --typescript --weak-refs --target nodejs --out-dir node/wasm && node ./build_scripts/node && tsc --project tsconfig.node.json --outDir node","bundle:web":"wasm-bindgen target/wasm32-unknown-unknown/release/client_wasm.wasm --typescript --weak-refs --target web --out-dir web/wasm && node ./build_scripts/web && tsc --project tsconfig.web.json --outDir web","copy-neon-defs":"node ./build_scripts/copyNeonDefs.js","lint":"eslint --ignore-path .eslintignore --ext .js,.ts .","format":"prettier --ignore-path .eslintignore -w {,*/**/}*.{ts,js,json}","format-check":"prettier --ignore-path .eslintignore -c {,*/**/}*.{ts,js,json}","docs-wiki-build":"typedoc --githubPages false --disableSources --excludePrivate --excludeInternal --excludeNotDocumented --plugin typedoc-plugin-markdown --theme markdown --hideBreadcrumbs --entryDocument api_ref.md --readme none --hideGenerator --sort source-order --exclude ./**/src/index.ts --out ../../documentation/docs/libraries/wasm/references/ ./lib/index.ts","test":"jest --forceExit"},"dependencies":{"@iota/types":"^1.0.0-beta.11","node-fetch":"^2.6.7","text-encoding":"^0.7.0"},"devDependencies":{"@types/jest":"^27.5.2","@typescript-eslint/eslint-plugin":"^5.31.0","@typescript-eslint/parser":"^5.31.0","dotenv":"^16.0.1","eslint":"^8.20.0","eslint-config-prettier":"^8.5.0","fs-extra":"^10.1.0","jest":"^27.5.1","jest-matcher-utils":"^28.1.3","prettier":"^2.7.1","ts-jest":"^27.1.5","ts-node":"^10.9.1","typedoc":"^0.23.9","typedoc-plugin-markdown":"^3.13.4","typescript":"^4.7.4","wasm-opt":"^1.3.0"},"engines":{"node":">=16"},"gitHead":"d8f5a5bac8b8c6a3713346488e3972227a6b802f","bugs":{"url":"https://github.com/iotaledger/iota.rs/issues"},"homepage":"https://github.com/iotaledger/iota.rs#readme","_id":"@cycraig/iota-client-wasm@0.5.0-alpha.1","_nodeVersion":"16.15.1","_npmVersion":"7.23.0","dist":{"integrity":"sha512-5D1l6QkOupmvaI19mROp/QjcqFNOHvjjGo2zJUbGbF7tI/v6J/CyiYpziREqWMUkCzKW3a/gEE9/YRbTRkJ7pg==","shasum":"fa92d6ba02db7bfd35ba56627336c7e1ecf545f2","tarball":"https://registry.npmjs.org/@cycraig/iota-client-wasm/-/iota-client-wasm-0.5.0-alpha.1.tgz","fileCount":175,"unpackedSize":5968095,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIALN7DDEj7jLySXqVGy5EErwLbB7hdVQjtUYOIZh7WPTAiBhxorzWiXTMzJntXg5G+Mg1B+ril+ic+YuOcQy4F2hGA=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJi/iobACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqTBw//dtTt4Yxnensdn7D5BeDKxNU6kyOdXp/P4e+CsiEBWLl9TClm\r\nD6prGyY3yJqo3K1t9eJOvQoeOCJgQgaHnTciUxjlROLMaiOjLkOR66vf6nI5\r\nKWpBGycJj8d7RL2V73tqyRV6rcVb1zrA5kF88vDkg/OyWQ1VLFofQIr6jFNK\r\niMA2nSxRaV+MjPfMzukvHx5LQIlRskdij+/89wujoDiLxGjB4D/L0eOnSX2w\r\nzAXnA7XCVRTbgp8GmU5PYc/i2+GMndXroWH/mYvvwp1Pl7ezCJP0uXboF1K0\r\naDM8xZlOrGh/a+2XUhsdN31opiQUPDpLT3cWvbqAH+j2YJ4MPNF8Mepsjlio\r\nFfR6e0tqOydR36qEdeHfkeAiAmE1gJU3McINYMJjeKIeNqb7mL9jIbQ2NLcu\r\npJcyfzjPSgiLzPRlzt379745k/Ji/4GuCjB7CaT+h7UqTCN+dR/S7ABwnZRS\r\nuoJA6ccpKjRhv1Jdw8+tmbJJBubK4XpBX8c9OrZQT73e0petT1YOR/kOmWtq\r\nV2cj4ppm/28E4pZGu+Zzk5SlGVFuu2Oc8bKvB+x90qej435I/7r8Cp0xMUoE\r\nUpvtB1ETdOFJnAOob3VXooUwbeUegcHZLtHcbzEcZf7ArKhA4MYrxSs7XcAM\r\nroa5jGTOrUuh/j6CtyliJzT733cZyH/XE2Y=\r\n=G7hB\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"cycraig","email":"craig.bester@iota.org"},"directories":{},"maintainers":[{"name":"cycraig","email":"craig.bester@iota.org"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/iota-client-wasm_0.5.0-alpha.1_1660824091109_0.8535489458980869"},"_hasShrinkwrap":false,"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"0.5.0-alpha.2":{"name":"@cycraig/iota-client-wasm","version":"0.5.0-alpha.2","description":"WebAssembly bindings for the IOTA client library","repository":{"type":"git","url":"git+https://github.com/iotaledger/iota.rs.git"},"author":{"name":"IOTA Foundation","email":"contact@iota.org"},"license":"Apache-2.0","publishConfig":{"access":"public"},"scripts":{"build":"npm run build:nodejs && npm run build:web","build:src":"cargo build --lib --release --target wasm32-unknown-unknown","build:nodejs":"node ./build_scripts/copyNeonDefs.js && npm run build:src && npm run bundle:nodejs && wasm-opt -O node/wasm/client_wasm_bg.wasm -o node/wasm/client_wasm_bg.wasm","build:web":"node ./build_scripts/copyNeonDefs.js && npm run build:src && npm run bundle:web && wasm-opt -O web/wasm/client_wasm_bg.wasm -o web/wasm/client_wasm_bg.wasm","bundle:nodejs":"wasm-bindgen target/wasm32-unknown-unknown/release/client_wasm.wasm --typescript --weak-refs --target nodejs --out-dir node/wasm && node ./build_scripts/node && tsc --project tsconfig.node.json --outDir node","bundle:web":"wasm-bindgen target/wasm32-unknown-unknown/release/client_wasm.wasm --typescript --weak-refs --target web --out-dir web/wasm && node ./build_scripts/web && tsc --project tsconfig.web.json --outDir web","copy-neon-defs":"node ./build_scripts/copyNeonDefs.js","lint":"eslint --ignore-path .eslintignore --ext .js,.ts .","format":"prettier --ignore-path .eslintignore -w {,*/**/}*.{ts,js,json}","format-check":"prettier --ignore-path .eslintignore -c {,*/**/}*.{ts,js,json}","docs-wiki-build":"typedoc --githubPages false --disableSources --excludePrivate --excludeInternal --excludeNotDocumented --plugin typedoc-plugin-markdown --theme markdown --hideBreadcrumbs --entryDocument api_ref.md --readme none --hideGenerator --sort source-order --exclude ./**/src/index.ts --out ../../documentation/docs/libraries/wasm/references/ ./lib/index.ts","test":"jest --forceExit"},"dependencies":{"@iota/types":"^1.0.0-beta.11","node-fetch":"^2.6.7","text-encoding":"^0.7.0"},"devDependencies":{"@types/jest":"^27.5.2","@typescript-eslint/eslint-plugin":"^5.31.0","@typescript-eslint/parser":"^5.31.0","dotenv":"^16.0.1","eslint":"^8.20.0","eslint-config-prettier":"^8.5.0","fs-extra":"^10.1.0","jest":"^27.5.1","jest-matcher-utils":"^28.1.3","prettier":"^2.7.1","ts-jest":"^27.1.5","ts-node":"^10.9.1","typedoc":"^0.23.9","typedoc-plugin-markdown":"^3.13.4","typescript":"^4.7.4","wasm-opt":"^1.3.0"},"engines":{"node":">=16"},"gitHead":"6ae54bca94507015826d1d2d8a2d4a4e88923a9a","bugs":{"url":"https://github.com/iotaledger/iota.rs/issues"},"homepage":"https://github.com/iotaledger/iota.rs#readme","_id":"@cycraig/iota-client-wasm@0.5.0-alpha.2","_nodeVersion":"16.15.1","_npmVersion":"7.23.0","dist":{"integrity":"sha512-KbA7YUzEf+A1KoucQaPkKHTm8SFAB9ZX9WKAvRjgI+qh40xVubykbaj1cZ+x1UNekMK3K8Oc7uOmRtzBnsZZkA==","shasum":"c693e3570bbecad6e15d6c7d7f541e9ee0f7df0b","tarball":"https://registry.npmjs.org/@cycraig/iota-client-wasm/-/iota-client-wasm-0.5.0-alpha.2.tgz","fileCount":175,"unpackedSize":6263696,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAyHlaUX9kE34izWQ/QtfcN3imbZ832IVfNak8kjfWpAAiEAv1KGT44olRz24J3XBWE5QqvJ06vgibCGVlUZLa1mJ7M="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjA87rACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrVdw//cVCxI2oPwp+7jCkFuYj1ATx06HKb0yJx2c3qzZ+JFG4lKB8l\r\n5qhnbZ2rIN6gkUAj8KZEpvCaCW6xW1J0VVYWCVAMOAOEHYoIYADUFRXpy8TR\r\nTBtYrP0eqUgOLHaspvMLPxTrp/kIvqzpjaLRQfQurgo+IlqedUyf/32Kx5MW\r\nsZ5vmZPPGYk5MiemVM6rLfT2yhvW3gK7Ghcb6abKnDoHfytK04SySUqDyhtA\r\nVNWD6WyophggNFjgwLRD689D12VIUzFzvzhgQZxOgbTysmQeaGLKhMGpKz7X\r\nxZQGFUFlpHXUrM9eM1ddA9fd1uTh3rseX7B4KIqMaznQefY9MDXpyHAkU53q\r\n4QJzqkYjdCKED9YDHnJ52U+ABwi8qGUZtP1nOOjMudmYpZzxg8LYYSeaKJMZ\r\nf7jpF2bSaE+K/zLLusfrGotBBXdB5vQBRNckTq3Lm4iH40zIu7a44OqF67ad\r\nHk01Jp+YQFNti7uXt0Tg0MT4RxDjafgBov0QowPuawBS2HXWdtInE+k8Olrm\r\npQFAcZFnKxrXyfcbAuHq1H5kKtjVPO+nvJ1eF8GwOTZHItp4CcTN3c8+IVop\r\nPwgleIzejT2Jo8y7jFmcBD4r0xHFA/JTiYrDOsKNiPh6e06p7ARSjblTbF2n\r\nmncwJ3ARBpvVPnEcHSz2NV6ol1WknwhqV/0=\r\n=LDB/\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"cycraig","email":"craig.bester@iota.org"},"directories":{},"maintainers":[{"name":"cycraig","email":"craig.bester@iota.org"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/iota-client-wasm_0.5.0-alpha.2_1661193962901_0.5907304840690537"},"_hasShrinkwrap":false,"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."}},"time":{"created":"2022-08-18T12:01:31.034Z","0.5.0-alpha.1":"2022-08-18T12:01:31.387Z","modified":"2024-04-06T08:48:45.596Z","0.5.0-alpha.2":"2022-08-22T18:46:03.246Z"},"maintainers":[{"name":"cycraig","email":"craig.bester@iota.org"}],"description":"WebAssembly bindings for the IOTA client library","homepage":"https://github.com/iotaledger/iota.rs#readme","repository":{"type":"git","url":"git+https://github.com/iotaledger/iota.rs.git"},"author":{"name":"IOTA Foundation","email":"contact@iota.org"},"bugs":{"url":"https://github.com/iotaledger/iota.rs/issues"},"license":"Apache-2.0","readme":"# IOTA Client Library - WebAssembly bindings\r\n\r\nWebAssembly (Wasm) bindings for TypeScript/JavaScript to the `iota.rs` client library.\r\n\r\n## Which bindings to choose?\r\n\r\nThe `iota.rs` client library also offers dedicated [Node.js bindings](../nodejs). The differences with this package are outlined below.\r\n\r\n|               |   Wasm bindings   |   Node.js bindings    |\r\n|:--------------|:-----------------:|:---------------------:|\r\n| Environment   | Node.js, browsers |     Node.js       |\r\n| Installation  |         -         | Rust, Cargo required* |\r\n| Performance   |        ✔️         |         ✔️✔️          |\r\n| Proof-of-work |  Single-threaded  |    Multi-threaded     |\r\n| MQTT          |         ❌         |          ✔️           |\r\n| Stronghold    |         ❌         |          ✔️           |\r\n| Ledger Nano   |         ❌         |          ✔️           |\r\n\r\n*Node.js bindings only need to be compiled during `npm install` if a pre-compiled binary is not available for your platform.\r\n\r\n**tl;dr: Use the Node.js bindings if you can. The Wasm bindings are just more portable and support browser environments.** \r\n\r\n## Requirements\r\n\r\nOne of the following Node.js versions: '16.x', '18.x'\r\n\r\n## Installation\r\n\r\n- Using npm:\r\n\r\n```bash\r\n$ npm i @iota/client-wasm\r\n```\r\n\r\n- Using yarn:\r\n\r\n```bash\r\n$ yarn add @iota/client-wasm\r\n```\r\n\r\n## Getting Started\r\n\r\nAfter installing the library, you can create a `Client` instance and interface with it.\r\n\r\n### Node.js Usage\r\n\r\n```javascript\r\nconst { Client } = require('@iota/client-wasm/node');\r\n\r\nconst client = new Client({\r\n    nodes: ['https://api.testnet.shimmer.network'],\r\n});\r\n\r\nclient.getInfo().then(console.log).catch(console.error);\r\n```\r\n\r\nSee the [Node.js examples](../nodejs/examples) for more demonstrations, the only change needed is to import `@iota/client-wasm/node` instead of `@iota/client`.\r\n\r\n### Web Setup\r\n\r\nUnlike Node.js, a few more steps are required to use this in the browser.\r\n\r\nThe library loads the compiled Wasm file with an HTTP GET request, so the `client_wasm_bg.wasm` file must be copied to the root of the distribution folder.\r\n\r\nA bundler such as [webpack](https://webpack.js.org/) or [rollup](https://rollupjs.org/) is recommended.\r\n\r\n#### Rollup\r\n\r\n- Install `rollup-plugin-copy`:\r\n\r\n```bash\r\nnpm install rollup-plugin-copy --save-dev\r\n```\r\n\r\n- Add the plugin to your `rollup.config.js`:\r\n\r\n```js\r\n// Include the copy plugin.\r\nimport copy from 'rollup-plugin-copy'\r\n\r\n// ...\r\n\r\n// Add the copy plugin to the `plugins` array:\r\ncopy({\r\n  targets: [{\r\n    src: 'node_modules/@iota/client-wasm/web/wasm/client_wasm_bg.wasm',\r\n    dest: 'public',\r\n    rename: 'client_wasm_bg.wasm'\r\n  }]\r\n})\r\n```\r\n\r\n#### Webpack\r\n\r\n- Install `copy-webpack-plugin`:\r\n\r\n```bash\r\nnpm install copy-webpack-plugin --save-dev\r\n```\r\n\r\n- Add the plugin to your `webpack.config.js`:\r\n\r\n```js\r\n// Include the copy plugin.\r\nconst CopyWebPlugin = require('copy-webpack-plugin');\r\n\r\n// ...\r\n\r\nexperiments: {\r\n    // futureDefaults: true, // includes asyncWebAssembly, topLevelAwait etc.\r\n    asyncWebAssembly: true\r\n}\r\n\r\n// Add the copy plugin to the `plugins` array:\r\nplugins: [\r\n    new CopyWebPlugin({\r\n      patterns: [\r\n        {\r\n          from: 'node_modules/@iota/client-wasm/web/wasm/client_wasm_bg.wasm',\r\n          to: 'client_wasm_bg.wasm'\r\n        }\r\n      ]\r\n    }),\r\n    // other plugins...\r\n]\r\n```\r\n\r\n### Web Usage\r\n\r\n```javascript\r\nimport { init, Client } from \"@iota/client-wasm/web\";\r\n\r\ninit().then(() => {\r\n  const client = new Client({\r\n    nodes: ['https://api.testnet.shimmer.network'],\r\n  });\r\n\r\n  client.getInfo().then(console.log).catch(console.error);\r\n}).catch(console.error);\r\n\r\n// Default path to load is \"client_wasm_bg.wasm\", \r\n// but you can override it by passing a path explicitly.\r\n//\r\n// init(\"./static/client_wasm_bg.wasm\").then(...)\r\n```\r\n","readmeFilename":"README.md"}