Skip to content

Commit

Permalink
Merge pull request #64 from symbol/release-0.14.2-sdk-upgrade
Browse files Browse the repository at this point in the history
release v0.14.2, symbol-sdk upgrade, dependencies upgrades
  • Loading branch information
yilmazbahadir authored Jan 4, 2022
2 parents 1a5cd88 + bb2ee37 commit ccbc70d
Show file tree
Hide file tree
Showing 55 changed files with 2,735 additions and 4,529 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# CHANGELOG

## [v0.14.2][v0.14.2] - 30-Dec-2021

- Upgraded symbol-sdk(dev dependency) to v1.0.3
- Upgraded symbol-hd-wallets to v0.14.2
- Upgraded other dependencies to latest versions
- `cat.currency` replaced with `symbol.xym`
- Updated copyrights and README.md

## [v0.14.0][v0.14.0] - 22-Dev-2020

- Removed symbol-sdk dependency.
Expand Down Expand Up @@ -120,6 +128,7 @@
- generate image base64 string by string.


[v0.14.2]: https://github.com/nemfoundation/symbol-qr-library/compare/v0.14.0...v0.14.2
[v0.13.0]: https://github.com/nemfoundation/symbol-qr-library/compare/v0.12.0...v0.13.0
[v0.12.0]: https://github.com/nemfoundation/symbol-qr-library/compare/v0.11.0...v0.12.0
[v0.11.0]: https://github.com/nemfoundation/symbol-qr-library/compare/v0.10.0...v0.11.0
Expand Down
41 changes: 20 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
# Symbol QR Library

[![npm version](https://badge.fury.io/js/symbol-qr-library.svg)](https://badge.fury.io/js/symbol-qr-library)
[![Build Status](https://travis-ci.com/nemtech/symbol-qr-library.svg?branch=main)](https://travis-ci.com/nemtech/symbol-qr-library)
[![Slack](https://img.shields.io/badge/chat-on%20slack-green.svg)](https://nem2.slack.com/messages/CB0UU89GS//)
[![Build Status](https://travis-ci.com/symbol/symbol-qr-library.svg?branch=main)](https://travis-ci.com/symbol/symbol-qr-library.svg?branch=main)
[![Discord](https://img.shields.io/badge/chat-on%20discord-green.svg)](https://discord.com/invite/xymcity)

Library to generate QR codes for Symbol.

This is a PoC to validate the proposed [NIP 7 QR Library Standard Definition](https://github.com/nemtech/NIP/issues/3). When stable, the repository will be moved to the [nemtech](https://github.com/nemtech) organization.
Library to generate QR codes for Symbol.

**NOTE**: The author of this package cannot be held responsible for any loss of money or any malintentioned usage forms of this package. Please use this package with caution.

Expand Down Expand Up @@ -43,18 +42,18 @@ const transfer = TransferTransaction.create(
Deadline.create(),
Address.createFromPublicKey(
'C5C55181284607954E56CD46DE85F4F3EF4CC713CC2B95000FA741998558D268',
NetworkType.MIJIN_TEST
NetworkType.TEST_NET
),
[new Mosaic(new NamespaceId('cat.currency'), UInt64.fromUint(10000000))],
PlainMessage.create('Welcome to NEM!'),
NetworkType.MIJIN_TEST
[new Mosaic(new NamespaceId('symbol.xym'), UInt64.fromUint(10000000))],
PlainMessage.create('Welcome to Symbol!'),
NetworkType.TEST_NET
);

// generation hash of the connected network
const generationHash = 'ACECD90E7B248E012803228ADB4424F0D966D24149B72E58987D2BF2F2AF03C4'

// create QR Code base64
const qrCode: TransactionQR = QRCodeGenerator.createTransactionRequest(transfer, NetworkType.MIJIN_TEST, generationHash);
const qrCode: TransactionQR = QRCodeGenerator.createTransactionRequest(transfer, NetworkType.TEST_NET, generationHash);

// get base64 notation for <img> HTML attribute
const base64 = qrCode.toBase64();
Expand Down Expand Up @@ -92,7 +91,7 @@ const accountPublicKey = 'C5C55181284607954E56CD46DE85F4F3EF4CC713CC2B95000FA741
const generationHash = 'ACECD90E7B248E012803228ADB4424F0D966D24149B72E58987D2BF2F2AF03C4'

// create QR Code base64
const qrCode: ContactQR = QRCodeGenerator.createAddContact(name, accountPublicKey, NetworkType.MIJIN_TEST, generationHash);
const qrCode: ContactQR = QRCodeGenerator.createAddContact(name, accountPublicKey, NetworkType.TEST_NET, generationHash);

// get base64 notation for <img> HTML attribute
const base64 = qrCode.toBase64();
Expand All @@ -113,9 +112,9 @@ const mnemonic = MnemonicPassPhrase.createRandom();
const generationHash = 'ACECD90E7B248E012803228ADB4424F0D966D24149B72E58987D2BF2F2AF03C4'

// create QR Code base64
const encryptedMnemonicQR: MnemonicQR = new MnemonicQR(mnemonic.plain, NetworkType.MIJIN_TEST, generationHash, 'password');
const encryptedMnemonicQR: MnemonicQR = new MnemonicQR(mnemonic.plain, NetworkType.TEST_NET, generationHash, 'password');
// or
const plainMnemonicQR: MnemonicQR = new MnemonicQR(mnemonic.plain, NetworkType.MIJIN_TEST, generationHash); // no password
const plainMnemonicQR: MnemonicQR = new MnemonicQR(mnemonic.plain, NetworkType.TEST_NET, generationHash); // no password

// get base64 notation for <img> HTML attribute
const base64 = encryptedMnemonicQR.toBase64();
Expand All @@ -140,8 +139,8 @@ const accountPrivateKey = 'F97AE23C2A28ECEDE6F8D6C447C0A10B55C92DDE9316CCD36C317
const generationHash = 'ACECD90E7B248E012803228ADB4424F0D966D24149B72E58987D2BF2F2AF03C4'

// create QR Code base64
const encryptedAccountQR: AccountQR = QRCodeGenerator.createExportAccount(accountPrivateKey, NetworkType.MIJIN_TEST, generationHash, 'password')
const plainAccountQR: AccountQR = QRCodeGenerator.createExportAccount(accountPrivateKey, NetworkType.MIJIN_TEST, generationHash) // no password
const encryptedAccountQR: AccountQR = QRCodeGenerator.createExportAccount(accountPrivateKey, NetworkType.TEST_NET, generationHash, 'password')
const plainAccountQR: AccountQR = QRCodeGenerator.createExportAccount(accountPrivateKey, NetworkType.TEST_NET, generationHash) // no password

// get base64 notation for <img> HTML attribute
const base64 = encryptedAccountQR.toBase64();
Expand All @@ -161,7 +160,7 @@ const object = {"obj": "test"};
const generationHash = 'ACECD90E7B248E012803228ADB4424F0D966D24149B72E58987D2BF2F2AF03C4'

// create QR Code base64
const qrCode: ObjectQR = QRCodeGenerator.createExportObject(object, NetworkType.MIJIN_TEST, generationHash);
const qrCode: ObjectQR = QRCodeGenerator.createExportObject(object, NetworkType.TEST_NET, generationHash);

// get base64 notation for <img> HTML attribute
const base64 = qrCode.toBase64();
Expand All @@ -172,7 +171,7 @@ const base64 = qrCode.toBase64();
Use the following available resources to get help:

- [Symbol Documentation][docs]
- Join the community [slack group (#sig-client)][slack]
- Join the community [discord][discord]
- If you found a bug, [open a new issue][issues]

## Contributing
Expand All @@ -182,11 +181,11 @@ Check [CONTRIBUTING](CONTRIBUTING.md) for information on how to contribute.

## License

Copyright 2019-present NEM
(C) Symbol Contributors 2022

Licensed under the [Apache License 2.0](LICENSE)

[self]: https://github.com/nemtech/symbol-qr-library
[docs]: https://nemtech.github.io
[issues]: https://github.com/nemtech/symbol-qr-library/issues
[slack]: https://join.slack.com/t/nem2/shared_invite/enQtMzY4MDc2NTg0ODgyLWZmZWRiMjViYTVhZjEzOTA0MzUyMTA1NTA5OWQ0MWUzNTA4NjM5OTJhOGViOTBhNjkxYWVhMWRiZDRkOTE0YmU
[self]: https://github.com/symbol/symbol-qr-library
[docs]: https://docs.symbolplatform.com/
[issues]: https://github.com/symbol/symbol-qr-library/issues
[discord]: https://discord.com/invite/xymcity
4 changes: 2 additions & 2 deletions examples/Example.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2019 NEM
* (C) Symbol Contributors 2022
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -27,7 +27,7 @@ abstract class Example {
*
* @return {number}
*/
public abstract async execute(): Promise<number>;
public abstract execute(): Promise<number>;
/// end-region Abstract Methods

/**
Expand Down
4 changes: 2 additions & 2 deletions examples/ExampleAddContactQR.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2019 NEM
* (C) Symbol Contributors 2022
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -39,7 +39,7 @@ class ExampleAddContactQR extends Example {
const contactInfo = {
v: 3,
type: QRCodeType.AddContact,
network_id: NetworkType.MIJIN_TEST,
network_id: NetworkType.TEST_NET,
chain_id: 'no-chain-id',
data: {
name: 'nemtech',
Expand Down
4 changes: 2 additions & 2 deletions examples/ExampleExportAccountQR.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2019 NEM
* (C) Symbol Contributors 2022
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -45,7 +45,7 @@ class ExampleExportAccountQR extends Example {
const accountInfo = {
v: 3,
type: QRCodeType.ExportAccount,
network_id: NetworkType.MIJIN_TEST,
network_id: NetworkType.TEST_NET,
chain_id: '9F1979BEBA29C47E59B40393ABB516801A353CFC0C18BC241FEDE41939C907E7',
data: {
ciphertext: '56d310848ee93d0794eb1f64a5195778ded2q7IxvtPbO+sA7jZZyhpu/khbaNdx1pzuoGoPJRw1A4aBsWPlex3y/gy5da8WjF0i4d+/D0B5ESy+zX5P+AoFAw3EFi3UVBdnav4rnqg=',
Expand Down
4 changes: 2 additions & 2 deletions examples/ExampleExportMnemonicQR.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2019 NEM
* (C) Symbol Contributors 2022
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -46,7 +46,7 @@ class ExampleExportMnemonicQR extends Example {
const mnemonicInfo = {
v: 3,
type: QRCodeType.ExportMnemonic,
network_id: NetworkType.MIJIN_TEST,
network_id: NetworkType.TEST_NET,
chain_id: "9F1979BEBA29C47E59B40393ABB516801A353CFC0C18BC241FEDE41939C907E7",
data: {
ciphertext: "964322228f401a2ec576ac256cbbdce29YfW+CykqESzGSzDYuKJxJUSpQ4woqMdD8Up7mjbow09I/UYV4e8HEgbhjlLjf30YLlQ+JKLBTf9kUGMnp3tZqYSq3lLZRDp8TVE6GzHiX4V59RTP7BOixwpDWDmfOP0B0i+Q1s0+OPfmyck4p7YZkVNi/HYvQF4kDV27sjRTZKs+uETKA0Ae0rl17d9EMV3eLUVcWEGE/ChgEfmnMlN1g==",
Expand Down
6 changes: 3 additions & 3 deletions examples/ExampleRequestTransactionQR.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2019 NEM
* (C) Symbol Contributors 2022
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -34,7 +34,7 @@ class ExampleRequestTransactionQR extends Example {
* This example uses an unsigned transfer transaction
* with following details:
* - Recipient: namespaceId "nemtech"
* - Mosaics: 1 mosaic with namespaceId "cat.currency" and absolute amount 1
* - Mosaics: 1 mosaic with namespaceId "symbol.xym" and absolute amount 1
* - Message: Empty
*
* @return {number}
Expand All @@ -44,7 +44,7 @@ class ExampleRequestTransactionQR extends Example {
const unsignedTransferInfo = {
v: 3,
type: QRCodeType.RequestTransaction,
network_id: NetworkType.MIJIN_TEST,
network_id: NetworkType.TEST_NET,
chain_id: '9F1979BEBA29C47E59B40393ABB516801A353CFC0C18BC241FEDE41939C907E7',
data: {
payload: 'A500000000000000000000000000000000000000000000000000000000000000'
Expand Down
2 changes: 1 addition & 1 deletion examples/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2019 NEM
* (C) Symbol Contributors 2022
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2019 NEM
* (C) Symbol Contributors 2022
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Loading

0 comments on commit ccbc70d

Please sign in to comment.