@panaceacoin/pan-qrcode
TypeScript icon, indicating that this package has built-in type declarations

0.0.1 • Public • Published

PAN QR Code

A web component to generate QR codes for PAN payments.

Built With Stencil

Install

Script tag

  • Put these script tags ` <script type="module" src="/build/panqrcode.esm.js"></script> <script nomodule src="/build/panqrcode.js"></script>

` in the head of your index.html

Node Modules

  • Run npm install @panaceacoin/pan-qrcode --save
  • Put this script tag <script src='node_modules/@panaceacoin/pan-qrcode/build/panqrcode.js'></script> in the head of your index.html

In a stencil-starter app

  • Run npm install @panaceacoin/pan-qrcode --save
  • Add { name: 'pan-qrcode' } to your collections.

Usage

Insert the element in your code and enter your custom properties:

<pan-qrcode address="DE6os4N86ef9bba6kVGurqxmhpBHKctoxY" amount="20.3"></pan-qrcode>

Examples

<body>
<pan-qrcode address="DE6os4N86ef9bba6kVGurqxmhpBHKctoxY" amount="10.5" vendor-field="Hello%20Pan!" size="200" show-logo="true">
<script>
  document.querySelector('pan-qrcode').getURI();
  // => pan:DE6os4N86ef9bba6kVGurqxmhpBHKctoxY?amount=10.5&vendorField=Hello%20Pan!
</script>
</body>

Generate this QR code:

Properties

This package complies with the specifications described in AIP-13.

Attribute Description Type Required
address Ark recipient address encoded in Base58. String Yes
amount Amount in ARK (Ѧ) or DARK (DѦ). Number No
label Recipient label string. String No
size Size of the QR code (pixels) Number No
show-logo Display the ARK logo in QR code Boolean No
vendor-field Vendor field string (encoded URI). String No

Methods

You can interact with the component data using the methods below:

getURI()

Format the properties entered to the ARK URI scheme.

document.querySelector('pan-qrcode').getURI();
// => pan:DE6os4N86ef9bba6kVGurqxmhpBHKctoxY?amount=20.3

getDataURL([mime])

Generates a base64 encoded data URI for the QR code.

document.querySelector('pan-qrcode').getDataURL();
// => data:image/png;base64,iVBORw0KGgoAAAANSUhE...n6ofvMC4I9AAAAAElFTkSuQmCC

deserializeURI(uri)

Deserialize the URI scheme to a JSON object.

const uri = 'pan:DE6os4N86ef9bba6kVGurqxmhpBHKctoxY?amount=10.5&vendorField=Hello%20Pan!';
document.querySelector('pan-qrcode').deserializeURI(uri);
// => { address: 'DE6os4N86ef9bba6kVGurqxmhpBHKctoxY', amount: 10.5, label: null, vendorField: 'Hello Pan!' }

Authors

License

The MIT License (MIT)

Copyright (c) 2018 Panacea Organization Copyright (c) 2016-2017 ARK.io Copyright (c) 2016 Lisk Copyright (c) 2015 Crypti

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Readme

Keywords

none

Package Sidebar

Install

npm i @panaceacoin/pan-qrcode

Weekly Downloads

1

Version

0.0.1

License

MIT

Unpacked Size

19.8 kB

Total Files

10

Last publish

Collaborators

  • cotnals