muon-wallet-v2
TypeScript icon, indicating that this package has built-in type declarations

1.0.8 • Public • Published

Muon Wallet

Installation

Run the following command to install the package

npm install muon-wallet

Include the styles file in your project

For React applications :

import 'muon-wallet/src/css/index.css'

Getting Started

Importing

Now you can import the "Muon" class

Using Node.js require()

const { Muon } = require('muon-wallet')

Using ES6 imports

import { Muon } from 'muon-wallet'

Usage

The Muon class accepts an optional base url as string that will replace the package default base url. Then you can call the request method of the constructed muon class.

const muon = new Muon()
muon.request()

The "request" method, accepts these required parameters :

  1. appName : This parameter must be the name of one of apps that exist in the Muon Explorer apps list and it should be string.

  2. methodName : This parameter must be the name of one of method of the app that is entered as the first parameter.

  3. params : This parameter must be the params of the method that is entered as the second parameter and it should be an object.

Examples

This function returns a promise that should be handled correctly.

const muon = new Muon()
muon.request(app, method, params)
   .then(res => {
      console.log(res)
   })
   .catch(err => {
      console.error(err)
   })
try{
	const muon = new Muon()
   const res = await request(app, method, params)
   console.log(res)
}
catch(err){
   console.error(err)
}

Package Sidebar

Install

npm i muon-wallet-v2

Homepage

muon.net

Weekly Downloads

11

Version

1.0.8

License

MIT

Unpacked Size

331 kB

Total Files

43

Last publish

Collaborators

  • abbasnosrati