npm.io
0.1.18 • Published 7 years ago

sdagwallet.js

Licence
MIT
Version
0.1.18
Deps
2
Size
42 kB
Vulns
0
Weekly
0

SDAGWallet.js

SDAG Wallet for Javascript Developers

Installation

npm i sdagwallet.js

Usage

Import
import Wallet from 'sdagwallet.js'

let wallet = new Wallet();
Auto configuration
wallet.autoConfigHub("mainnet"); // Using mainnet
wallet.autoConfigHub("testnet"); // Using testnet
Manual configuration
wallet.configHub("ws://10.168.3.131:6635");
Generate Mnemonic
wallet.generateMnemonic();
Login
await wallet.loginWithMnemonic(secret, password);
Keys
wallet.getAddress();
wallet.getPrivateKey(); // Extened Private Key
wallet.getPublicKey();
Getting Balance
await wallet.getBalance();
Getting History Txs
await wallet.getHistory();
Getting a Unit
await wallet.getUnit('AELe/VgaqoCJekPfVxd8huecW3g7n33ihFw1A3vVVPE=');
Sending Assets
await wallet.send({ to: 'E5UR2ISKQWT3HISO55SHQYGYTF5BLWV6', amount: 2, text: 'Hello world' });
Subscribe
wallet.onAssetMessage(msg => {});
wallet.watchAddress(addrs, msg => {});

License

GPL-3.0