@polkadot/react-qr
Advanced tools
Comparing version 0.42.0-beta.22 to 0.42.0-beta.23
@@ -12,4 +12,2 @@ "use strict"; | ||
var _qrcodeGenerator = _interopRequireDefault(require("qrcode-generator")); | ||
var _styledComponents = _interopRequireDefault(require("styled-components")); | ||
@@ -19,2 +17,4 @@ | ||
var _qrcode = _interopRequireDefault(require("./qrcode")); | ||
var _util = require("./util"); | ||
@@ -28,3 +28,6 @@ | ||
function getDataUrl(value) { | ||
const qr = (0, _qrcodeGenerator.default)(0, 'M'); | ||
const qr = (0, _qrcode.default)(0, 'M'); // HACK See out qrcode stringToBytes override as used internally. This | ||
// will only work for the case where we actuall pass `Bytes` in here | ||
// @ts-ignore | ||
qr.addData(value, 'Byte'); | ||
@@ -56,3 +59,6 @@ qr.make(); | ||
const nextIdx = frameIdx === frames.length - 1 ? 0 : frameIdx + 1; | ||
const nextIdx = frameIdx === frames.length - 1 ? 0 : frameIdx + 1; // only encode the frames on demand, not above as part of the | ||
// state derivation - in the case of large payloads, this should | ||
// be slightly more responsive on initial load | ||
this.setState({ | ||
@@ -76,3 +82,4 @@ frameIdx: nextIdx, | ||
const frames = skipEncoding ? [(0, _util.decodeString)(value)] : (0, _util.createFrames)(value); | ||
const frames = skipEncoding ? [value] : (0, _util.createFrames)(value); // encode on demand | ||
return { | ||
@@ -79,0 +86,0 @@ frames, |
{ | ||
"name": "@polkadot/react-qr", | ||
"version": "0.42.0-beta.22", | ||
"version": "0.42.0-beta.23", | ||
"description": "Generates and reads QR codes", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -6,3 +6,3 @@ export declare function encodeNumber(value: number): Uint8Array; | ||
export declare function createSignPayload(address: string, payload: string | Uint8Array): Uint8Array; | ||
export declare function createFrames(input: Uint8Array): string[]; | ||
export declare function createFrames(input: Uint8Array): Uint8Array[]; | ||
export declare function createImgSize(size?: number): Record<string, string>; |
@@ -62,3 +62,3 @@ "use strict"; | ||
return frames.map((frame, index) => decodeString((0, _util.u8aConcat)(MULTIPART, encodeNumber(frames.length), encodeNumber(index), frame))); | ||
return frames.map((frame, index) => (0, _util.u8aConcat)(MULTIPART, encodeNumber(frames.length), encodeNumber(index), frame)); | ||
} | ||
@@ -65,0 +65,0 @@ |
@@ -59,3 +59,3 @@ "use strict"; | ||
it('encodes frames properly', () => { | ||
expect((0, _util2.createFrames)((0, _util2.createSignPayload)('5HbgaJEuVN5qGbkhgtuDQANivSWwHXWsC2erP1SQUXgciTVq', '0x12345678')).map(str => (0, _util.u8aToHex)((0, _util2.encodeString)(str)))).toEqual(['0x' + '00' + // multipart | ||
expect((0, _util2.createFrames)((0, _util2.createSignPayload)('5HbgaJEuVN5qGbkhgtuDQANivSWwHXWsC2erP1SQUXgciTVq', '0x12345678')).map(u8a => (0, _util.u8aToHex)(u8a))).toEqual(['0x' + '00' + // multipart | ||
'0001' + // length | ||
@@ -62,0 +62,0 @@ '0000' + // index |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
32725
27
643