owallet.js
v0.0.7
Published
Very lightweight Obyte wallet. It works everywhere where you can run JS.
Readme
owallet.js
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 !!!
How to start?
Node.js
$ yarn add owallet.jsindex.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());
})();Browser
CDN
wallet + generator
<script src="https://unpkg.com/[email protected]/dist/owallet.all.min.js"></script>wallet and generator (separately). Generator needs only for creating and recovery wallet.
<script src="https://unpkg.com/[email protected]/dist/owallet.generator.min.js"></script>
<script src="https://unpkg.com/[email protected]/dist/owallet.lib.min.js"></script>build
$ git clone https://github.com/olabs-org/owallet.js
$ cd owallet.js
$ yarn
$ yarn all
$ yarn generator
$ yarn libSee CDN.
Functions
Create
const w = new Wallet();Optional arguments
- hub url (wss://obyte.org/bb)
- testnet (boolean)
init
Initializes work with storage
await w.init();connect
Connect to hub
w.connect();Optional argument
- testnet (need for change network)
Change network:
w.close();
w.connect(true);
await w.init(); close
Close connection to hub
w.close()createWallet
Create and save wallet
await w.createWallet('password');Required argument
- password (string)
recoveryWallet
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)
getAddress
return obyte address
w.getAddress();getBalance
return balance
await w.getBalance();sendPayment
await w.sendPayment('password', '5Q7MD7AHC2MSNGSHHBHPKVHPD2VFDB22', 1234);Required arguments
- password (string)
- address (string)
- amount (string)
Optional argument
- asset (string)
sendMultiPayment
await w.sendMultiPayment('password', [{address: '5Q7MD7AHC2MSNGSHHBHPKVHPD2VFDB22', amount: 1234}]);Required arguments
- password (string)
- outputs (array)
Optional argument
- asset (string)
postDataInAA
Publishes data in AA
await w.postDataInAA('test', 'RQ46GHBRQWJJMWLZTVF2GH4A5QOLXFOV', {'var': 'qwerty'}, 11000)Required arguments
- password (string)
- aa address (string)
- data (object)
- amount (number > 10000)
getRawHistory
return history from hub
await w.getRawHistory();getHistoryPayments
return prepared payment history
await w.getHistoryPayments()Questions? Help is needed? @xjenek - telegram, xJeneK#3181 - discord
