@i3m/wallet-protocol-api
v2.6.1
Published
A TypeScript/JavaScript library that can be used to easily connect to an i3m Wallet Desktop App. It wraps all the functionalities provided by the wallet's HTTP API into convenient class methods. It works in Node.js (both ESM and CJS) and browsers.
Downloads
77
Readme
@i3m/wallet-protocol-api
A TypeScript/JavaScript library that can be used to easily connect to an i3m Wallet Desktop App. It wraps all the functionalities provided by the wallet's HTTP API into convenient class methods. It works in Node.js (both ESM and CJS) and browsers.
The wallet protocol description is explained here
Install
In order to use @i3m/wallet-protocol-api
, you should as well install @i3m/wallet-protocol
. Install both in your NPM project as:
npm install @i3m/wallet-protocol-api @i3m/wallet-protocol
The appropriate version for browser or node should be automatically chosen when importing. However, if your bundler does not import the appropriate module version (node esm, node cjs or browser esm), you can force it to use a specific one by just importing one of the followings:
@i3m/wallet-protocol-api/dist/cjs/index.node
: for Node.js CJS module@i3m/wallet-protocol-api/dist/esm/index.node
: for Node.js ESM module@i3m/wallet-protocol-api/dist/esm/index.browser
: for browser ESM moduleIf you are coding TypeScript, types will not be automatically detected when using the specific versions. You can easily get the types in by creating a
@i3m/wallet-protocol-api.d.ts
file with just the line:declare module '@i3m/wallet-protocol-api/dist/esm/index.browser' // use the specific file you were importing
You can also download the IIFE bundle, the ESM bundle or the UMD bundle and manually add it to your project, or, if you have already installed @i3m/wallet-protocol-api
in your project, just get the bundles from node_modules/@i3m/wallet-protocol-api/dist/bundles/
.
Usage
Read the documentation of the @i3m/wallet-protocol
package or go directly to the pairing example in Wallet pairing and use from a JS application.