Very lightweight Obyte wallet. It works everywhere where you can run JS.
If something didn't work - write me, I'll fix it :)
!!! Support only single address wallet and does not support private assets !!!
$ yarn add owallet.js
index.js
const Wallet = require('owallet.js');
const w = new Wallet(null, true); // testnet
(async () => {
await w.init();
w.connect();
console.log(await w.createWallet('password'));
console.log(w.getAddress());
console.log(await w.getBalance());
})();
wallet + generator
<script src="https://unpkg.com/owallet.js@0.0.7/dist/owallet.all.min.js"></script>
wallet and generator (separately). Generator needs only for creating and recovery wallet.
<script src="https://unpkg.com/owallet.js@0.0.7/dist/owallet.generator.min.js"></script>
<script src="https://unpkg.com/owallet.js@0.0.7/dist/owallet.lib.min.js"></script>
$ git clone https://github.com/olabs-org/owallet.js
$ cd owallet.js
$ yarn
$ yarn all
$ yarn generator
$ yarn lib
See CDN.
const w = new Wallet();
Optional arguments
- hub url (wss://obyte.org/bb)
- testnet (boolean)
Initializes work with storage
await w.init();
Connect to hub
w.connect();
Optional argument
- testnet (need for change network)
Change network:
w.close();
w.connect(true);
await w.init();
Close connection to hub
w.close()
Create and save wallet
await w.createWallet('password');
Required argument
- password (string)
Recover and save wallet
await w.recoveryWallet('gospel oak horn excite wheat mountain remove embody school confirm fossil mad', 'password');
Required arguments
- Seed (string)
- password (string)
return obyte address
w.getAddress();
return balance
await w.getBalance();
await w.sendPayment('password', '5Q7MD7AHC2MSNGSHHBHPKVHPD2VFDB22', 1234);
Required arguments
- password (string)
- address (string)
- amount (string)
Optional argument
- asset (string)
await w.sendMultiPayment('password', [{address: '5Q7MD7AHC2MSNGSHHBHPKVHPD2VFDB22', amount: 1234}]);
Required arguments
- password (string)
- outputs (array)
Optional argument
- asset (string)
Publishes data in AA
await w.postDataInAA('test', 'RQ46GHBRQWJJMWLZTVF2GH4A5QOLXFOV', {'var': 'qwerty'}, 11000)
Required arguments
- password (string)
- aa address (string)
- data (object)
- amount (number > 10000)
return history from hub
await w.getRawHistory();
return prepared payment history
await w.getHistoryPayments()
Questions? Help is needed? @xjenek - telegram, xJeneK#3181 - discord