0.0.1 • Published 2 years ago

@panaceacoin/pan-qrcode v0.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

PAN QR Code

A web component to generate QR codes for PAN payments.

Built With Stencil

Install

Script tag

  • Put these script tags `` 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.

AttributeDescriptionTypeRequired
addressArk recipient address encoded in Base58.StringYes
amountAmount in ARK (Ѧ) or DARK (DѦ).NumberNo
labelRecipient label string.StringNo
sizeSize of the QR code (pixels)NumberNo
show-logoDisplay the ARK logo in QR codeBooleanNo
vendor-fieldVendor field string (encoded URI).StringNo

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.