Skip to content

mvs-org/mvs-plugin-api

Repository files navigation


Build status
Plugin API for the Metaverse Blockchain lightwallet

Installation

Install using npm:

npm install mvs-lightwallet

Setup

<script src="node_modules/mvs-lightwallet/dist/lightwallet.min.js"></script>

or

<script src="https://api.myetpwallet.com/lightwallet.js"></script>

If you want to build the API from source you can use grunt.

Usage

Get List of Avatars

Required permissions: avatars

var lightwallet = new Lightwallet();

lightwallet.getAvatars()
  .then(avatars=>avatars.forEach(console.log))
  .catch(console.error);

Broadcast Raw Transaction

Required permissions: broadcast

lightwallet.broadcast(tx)
  .then(console.log)
  .catch(console.error);

Create MIT Registration Transaction

Required permissions: create-mit

var avatar = "canguruhh"; //Avatar that should be the issuer and recipient of the MIT
var symbol = "new-mit"; //New MIT symbol
var content = "some content for the new MIT";
var getraw = true; //Get transaction hex encoded (false will return signed transaction object)

lightwallet.createMIT(avatar, symbol, content, getraw)
  .then(console.log)
  .catch(console.error);

Get list of Addresses

Required permissions: addresses

lightwallet.addresses()
  .then(addresses=>addresses.forEach(console.log))
  .catch(console.error);

List Permissions

No permissions required

lightwallet.getPermissions()
  .then(permissions=>permissions.forEach(console.log))
  .catch(console.error);

Get Network

No permissions required

lightwallet.getPermissions()
  .then(permissions=>permissions.forEach(console.log))
  .catch(console.error);

Unlock

Unlock the wallet for this plugin session to enable the use of functions like the sign function without having the user to enter the passphrase for every interaction. Can be used for message signing for example.

lightwallet.unlock()
  .catch(console.error);

Sign Message

Required permissions: sign

var message = "hello world";
var avatar = "metaverse";

lightwallet.sign(message, avatar)
  .then(console.log)
  .catch(console.error);

Verify Message

Required permissions: verify

var message = "hello world";
var avatar = "metaverse";
var signature = "signaturesignaturesignaturesignaturesignaturesignature";

lightwallet.sign(message, avatar, signature)
  .then(console.log)
  .catch(console.error);

Licence

MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

Plugin API for the Metaverse Blockchain lightwallet

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published