-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
example.js
29 lines (24 loc) · 996 Bytes
/
example.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
var Dogecoin = require( "./index" );
( async () => {
// Lookup a wallet
Dogecoin.lookup( "DPsvmxqaJV15nqVnT9BiwYskVmQLozRKht", ( wallet ) => {
console.log( wallet );
} );
// Lookup a wallet with async/await
let wallet = await Dogecoin.lookup( "DPsvmxqaJV15nqVnT9BiwYskVmQLozRKht" );
console.log( wallet );
// Get a wallet QR Code
Dogecoin.qrcode( "DPsvmxqaJV15nqVnT9BiwYskVmQLozRKht", ( data ) => {
console.log( "got qr code!", data );
});
// Get a wallet QR Code with async/await
let qrcode = await Dogecoin.qrcode( "DPsvmxqaJV15nqVnT9BiwYskVmQLozRKht" );
// Listen for wallet balance updates
Dogecoin.listen( "DPsvmxqaJV15nqVnT9BiwYskVmQLozRKht", ( address, amount, extra ) => {
console.log( "Wallet balance update!", address, amount, extra );
});
// Listen to multiple wallets by passing an array
// Dogecoin.listen( [ "address1", "address2", ... ], ( address, amount, extra ) => {
// console.log( "Wallet balance update!", address, amount, extra );
// });
})();