Skip to content

KMMRCap/Muon-Wallet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published