@waves.exchange/provider-mailbox
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

provider-mailbox

Signer wx.network mailbox auth provider ​

Overview

​ ProviderMailbox developed by WX.Network implements a Signature Provider for Signer protocol library. Signer enables easy deploy dApps based on Waves blockchain. User's private key and SEED phrase are encrypted and stored in WX.Network, so your web app does not have access to them. ​

For now, signing is implemented for all types of transactions except exchange transactions. ​

Getting Started

1. Library installation

​ To install Signer and ProviderMailbox libraries use ​

npm i @waves/signer @waves.exchange/provider-mailbox

​ For Windows, use the following format:

npm i @waves/signer '@waves.exchange/provider-mailbox'

​ ​

2. Library initialization

​ Add library initialization to your app. ​

  • For Testnet: ​
    import Signer from '@waves/signer';
    import { ProviderMailbox } from '@waves.exchange/provider-mailbox';
    
    const signer = new Signer({
      // Specify URL of the node on Testnet
      NODE_URL: 'https://nodes-testnet.wavesnodes.com'
    });
    signer.setProvider(new ProviderMailbox('https://testnet.wx.network/signer-mailbox'));

  • For Mainnet: ​
    import Signer from '@waves/signer';
    import { ProviderMailbox } from '@waves.exchange/provider-mailbox;
    
    const signer = new Signer();
    signer.setProvider(new ProviderMailbox());

  • For tetsnetwxnetwork env: ​
    import { ProviderMailbox } from '@waves.exchange/provider-mailbox';
    
    const provider = new ProviderMailbox('https://testnet.wx.network/signer-mailbox?env=testnetwxnetwork');

3. Basic example

​ Now your application is ready to work with Waves Platform. Let's test it by implementing basic functionality. For example, we could try to authenticate user, get his/her balances and transfer funds. ​

const user = await signer.login();
const balances = await signer.getBalance();
const [broadcastedTransfer] = await signer
  .transfer({amount: 100000000, recipient: 'alias:T:merry'}) // Transfer 1 WAVES to alias merry
  .broadcast(); // Promise will resolved after user sign and node responseconst [signedTransfer] = await signer
  .transfer({amount: 100000000, recipient: 'alias:T:merry'}) // Transfer 1 WAVES to alias merry
  .sign(); // Promise will resolved after user sign

Readme

Keywords

none

Package Sidebar

Install

npm i @waves.exchange/provider-mailbox

Homepage

wx.network

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

53.4 kB

Total Files

11

Last publish

Collaborators

  • m_malyavin
  • gakhramanov
  • exchangeadmin
  • tsigel
  • axepuff
  • okanishcheva
  • vba2000