UNPKG

dogecoinjs

Version:

The Comfiest Way to get Dogecoin info and events for the Web and NodeJS!

43 lines (39 loc) 1.52 kB
<html> <head> <script src="dogecoin.min.js"></script> </head> <body> <img id="qrcode" src="" /> <script type="text/javascript"> ( async () => { Dogecoin.lookup( "DPsvmxqaJV15nqVnT9BiwYskVmQLozRKht", ( wallet ) => { console.log( wallet ); } ); // OR... // let wallet = await DogeCoin.lookup( "DPsvmxqaJV15nqVnT9BiwYskVmQLozRKht" ); Dogecoin.qrcode( "DPsvmxqaJV15nqVnT9BiwYskVmQLozRKht", ( data ) => { console.log( "got qr code!", data ); var image = document.getElementById( "qrcode" ); image.src = URL.createObjectURL( data ); }); // OR... // 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 with the same event handler // Dogecoin.listen( [ "address1", "address2", ... ], ( address, amount, extra ) => { // console.log( "Wallet balance update!", address, amount ); // } ); // --- TODO --- // Dogecoin.received( "DPsvmxqaJV15nqVnT9BiwYskVmQLozRKht", ( address, amount, extra ) => { // console.log( "Received Doge!", address, amount ); // } ); // Dogecoin.sent( "DPsvmxqaJV15nqVnT9BiwYskVmQLozRKht", ( address, amount, extra ) => { // console.log( "Sent Doge!", address, amount ); // } ); })(); </script> </body> </html>