muon-wallet
v1.30.0
Published
Muon wallet package
Downloads
49
Readme
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 :
appName : This parameter must be the name of one of apps that exist in the Muon Explorer apps list and it should be string.
methodName : This parameter must be the name of one of method of the app that is entered as the first parameter.
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)
}