From e49cb33bbe40b90a743cdeb1c12a2ff78f30482b Mon Sep 17 00:00:00 2001 From: Simon Date: Thu, 9 Jan 2020 14:33:03 -0800 Subject: [PATCH 1/2] chore: cleanup and formatting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - updated all license info. - team-made code: ARK MIT license headers. - Ledger-like code: ARK MIT + Apache 2.0 license headers. - add Ledger Apache 2.0 info the main LICENSE file. - remove whitespace/empty lines. - updated all “unimplemented” tx type examples. - split resources and installation into separate doc files. - update PAYLOADS doc. - update main README. - rename `./provision` -> `./scripts`. - move remaining scripts to `./scripts`. - move icons to `./icons` folder. --- LICENSE | 218 +++++++++++++ Makefile | 63 +++- README.md | 205 +----------- Vagrantfile | 14 +- docs/INSTALLATION.md | 139 ++++++++ docs/RESOURCES.md | 41 +++ docs/fixtures/type_0.md | 27 +- ...dor_field.json => type_0_vendorfield.json} | 0 ..._vendor_field.md => type_0_vendorfield.md} | 31 +- docs/fixtures/type_1.md | 33 +- docs/fixtures/type_10.md | 33 +- docs/fixtures/type_2.md | 33 +- docs/fixtures/type_3.md | 33 +- docs/fixtures/type_4.md | 55 ++-- docs/fixtures/type_5.md | 29 +- docs/fixtures/type_6.md | 308 +++++++++--------- docs/fixtures/type_7.md | 23 +- docs/fixtures/type_8.md | 43 ++- docs/fixtures/type_8_vendorfield.json | 14 +- docs/fixtures/type_8_vendorfield.md | 63 ++++ docs/fixtures/type_9.md | 35 +- docs/payloads.md | 146 +++++---- docs/unimplemented/README.md | 15 +- .../delegate_registration/assets.h | 66 ++++ .../delegate_registration.c | 78 +++++ .../delegate_registration.h | 60 ++++ .../delegate_registration_ux.c | 73 +++++ .../delegate_registration_ux.h | 49 +++ .../delegate_registration/deserializer.c | 308 ++++++++++++++++++ .../delegate_registration/display_ux.c | 111 +++++++ .../delegate_registration/types.h | 55 ++++ .../delegate_resignation/assets.h | 66 ++++ .../delegate_resignation.h | 44 +++ .../delegate_resignation_ux.c | 73 +++++ .../delegate_resignation_ux.h | 49 +++ .../delegate_resignation/deserializer.c | 308 ++++++++++++++++++ .../delegate_resignation/display_ux.c | 111 +++++++ docs/unimplemented/multi_payment/assets.h | 66 ++++ .../multi_payment/deserializer.c | 308 ++++++++++++++++++ docs/unimplemented/multi_payment/display_ux.c | 113 +++++++ .../multi_payment/multi_payment.c | 84 +++++ .../multi_payment/multi_payment.h | 57 ++++ .../multi_payment/multi_payment_ux.c | 76 +++++ .../multi_payment/multi_payment_ux.h | 49 +++ docs/unimplemented/multi_payment/types.h | 55 ++++ docs/unimplemented/multi_signature/assets.h | 66 ++++ .../multi_signature/deserializer.c | 308 ++++++++++++++++++ .../multi_signature/display_ux.c | 113 +++++++ .../multi_signature/multi_signature.c | 81 +++++ .../multi_signature/multi_signature.h | 57 ++++ .../multi_signature/multi_signature_ux.c | 74 +++++ .../multi_signature/multi_signature_ux.h | 49 +++ docs/unimplemented/multi_signature/types.h | 55 ++++ docs/unimplemented/type_2/type_2.c | 126 ------- docs/unimplemented/type_2/type_2.h | 49 --- docs/unimplemented/type_4/type_4.c | 127 -------- docs/unimplemented/type_4/type_4.h | 50 --- docs/unimplemented/type_6/type_6.c | 151 --------- docs/unimplemented/type_6/type_6.h | 52 --- docs/unimplemented/type_7/type_7.c | 89 ----- docs/unimplemented/type_7/type_7.h | 41 --- examples/README.md | 13 +- examples/example_helper.py | 58 +++- examples/v2.sh | 2 +- ark.png => icons/ark.png | Bin icon.gif => icons/icon.gif | Bin nanos_app_ark.gif => icons/nanos_app_ark.gif | Bin nanox_app_ark.gif => icons/nanox_app_ark.gif | Bin provision/setup.sh => scripts/provision.sh | 2 +- rebuild.sh => scripts/rebuild.sh | 0 {provision => scripts}/udev.sh | 0 src/approval.c | 69 ++-- src/approval.h | 48 +-- src/constants.h | 47 +-- src/crypto/hashing.c | 44 +-- src/crypto/hashing.h | 46 +-- src/crypto/keys.c | 44 +-- src/crypto/keys.h | 52 +-- src/crypto/signing.c | 43 +-- src/crypto/signing.h | 46 +-- src/display/context.c | 44 +-- src/display/context.h | 49 +-- src/display/display.h | 40 ++- src/display/nano.c | 72 ++-- src/display/nano.h | 64 ++-- src/io.c | 64 ++-- src/io.h | 65 ++-- src/main.c | 64 ++-- src/operations.c | 67 ++-- src/operations.h | 45 +-- src/operations/message_op.h | 45 +-- src/operations/transaction_op.h | 45 +-- src/operations/transactions/deserializer.c | 49 ++- src/operations/transactions/deserializer.h | 45 +-- .../transactions/legacy/deserialize_legacy.c | 43 +-- .../transactions/legacy/deserialize_legacy.h | 45 +-- .../transactions/legacy/display_legacy.c | 44 +-- .../transactions/legacy/display_legacy.h | 47 +-- src/operations/transactions/offsets.h | 40 ++- src/operations/transactions/transaction.h | 45 +-- src/operations/transactions/types/assets.h | 63 ++-- .../transactions/types/htlc_claim.c | 43 +-- .../transactions/types/htlc_claim.h | 46 +-- src/operations/transactions/types/htlc_lock.c | 45 +-- src/operations/transactions/types/htlc_lock.h | 47 +-- .../transactions/types/htlc_refund.c | 43 +-- .../transactions/types/htlc_refund.h | 48 +-- src/operations/transactions/types/ipfs.c | 43 +-- src/operations/transactions/types/ipfs.h | 50 +-- .../transactions/types/second_signature.c | 43 +-- .../transactions/types/second_signature.h | 48 +-- src/operations/transactions/types/transfer.c | 43 +-- src/operations/transactions/types/transfer.h | 47 +-- src/operations/transactions/types/types.h | 87 +++-- src/operations/transactions/types/vote.c | 43 +-- src/operations/transactions/types/vote.h | 49 +-- src/operations/transactions/ux/display_ux.c | 44 +-- src/operations/transactions/ux/display_ux.h | 45 +-- .../transactions/ux/htlc_claim_ux.c | 43 +-- .../transactions/ux/htlc_claim_ux.h | 46 +-- src/operations/transactions/ux/htlc_lock_ux.c | 47 +-- src/operations/transactions/ux/htlc_lock_ux.h | 46 +-- .../transactions/ux/htlc_refund_ux.c | 43 +-- .../transactions/ux/htlc_refund_ux.h | 46 +-- src/operations/transactions/ux/ipfs_ux.c | 43 +-- src/operations/transactions/ux/ipfs_ux.h | 46 +-- .../transactions/ux/second_signature_ux.c | 43 +-- .../transactions/ux/second_signature_ux.h | 46 +-- src/operations/transactions/ux/transfer_ux.c | 43 +-- src/operations/transactions/ux/transfer_ux.h | 46 +-- .../transactions/ux/vendorfield_ux.c | 43 +-- .../transactions/ux/vendorfield_ux.h | 43 +-- src/operations/transactions/ux/vote_ux.c | 43 +-- src/operations/transactions/ux/vote_ux.h | 46 +-- src/utils/base58.c | 63 ++-- src/utils/base58.h | 63 ++-- src/utils/hex.c | 44 +-- src/utils/hex.h | 45 +-- src/utils/print.c | 44 +-- src/utils/print.h | 45 +-- src/utils/unpack.h | 60 +++- src/utils/utils.h | 40 ++- 142 files changed, 6068 insertions(+), 2810 deletions(-) create mode 100644 docs/INSTALLATION.md create mode 100644 docs/RESOURCES.md rename docs/fixtures/{type_0_vendor_field.json => type_0_vendorfield.json} (100%) rename docs/fixtures/{type_0_vendor_field.md => type_0_vendorfield.md} (73%) create mode 100644 docs/fixtures/type_8_vendorfield.md create mode 100644 docs/unimplemented/delegate_registration/assets.h create mode 100644 docs/unimplemented/delegate_registration/delegate_registration.c create mode 100644 docs/unimplemented/delegate_registration/delegate_registration.h create mode 100644 docs/unimplemented/delegate_registration/delegate_registration_ux.c create mode 100644 docs/unimplemented/delegate_registration/delegate_registration_ux.h create mode 100644 docs/unimplemented/delegate_registration/deserializer.c create mode 100644 docs/unimplemented/delegate_registration/display_ux.c create mode 100644 docs/unimplemented/delegate_registration/types.h create mode 100644 docs/unimplemented/delegate_resignation/assets.h create mode 100644 docs/unimplemented/delegate_resignation/delegate_resignation.h create mode 100644 docs/unimplemented/delegate_resignation/delegate_resignation_ux.c create mode 100644 docs/unimplemented/delegate_resignation/delegate_resignation_ux.h create mode 100644 docs/unimplemented/delegate_resignation/deserializer.c create mode 100644 docs/unimplemented/delegate_resignation/display_ux.c create mode 100644 docs/unimplemented/multi_payment/assets.h create mode 100644 docs/unimplemented/multi_payment/deserializer.c create mode 100644 docs/unimplemented/multi_payment/display_ux.c create mode 100644 docs/unimplemented/multi_payment/multi_payment.c create mode 100644 docs/unimplemented/multi_payment/multi_payment.h create mode 100644 docs/unimplemented/multi_payment/multi_payment_ux.c create mode 100644 docs/unimplemented/multi_payment/multi_payment_ux.h create mode 100644 docs/unimplemented/multi_payment/types.h create mode 100644 docs/unimplemented/multi_signature/assets.h create mode 100644 docs/unimplemented/multi_signature/deserializer.c create mode 100644 docs/unimplemented/multi_signature/display_ux.c create mode 100644 docs/unimplemented/multi_signature/multi_signature.c create mode 100644 docs/unimplemented/multi_signature/multi_signature.h create mode 100644 docs/unimplemented/multi_signature/multi_signature_ux.c create mode 100644 docs/unimplemented/multi_signature/multi_signature_ux.h create mode 100644 docs/unimplemented/multi_signature/types.h delete mode 100644 docs/unimplemented/type_2/type_2.c delete mode 100644 docs/unimplemented/type_2/type_2.h delete mode 100644 docs/unimplemented/type_4/type_4.c delete mode 100644 docs/unimplemented/type_4/type_4.h delete mode 100644 docs/unimplemented/type_6/type_6.c delete mode 100644 docs/unimplemented/type_6/type_6.h delete mode 100644 docs/unimplemented/type_7/type_7.c delete mode 100644 docs/unimplemented/type_7/type_7.h rename ark.png => icons/ark.png (100%) rename icon.gif => icons/icon.gif (100%) rename nanos_app_ark.gif => icons/nanos_app_ark.gif (100%) rename nanox_app_ark.gif => icons/nanox_app_ark.gif (100%) rename provision/setup.sh => scripts/provision.sh (98%) rename rebuild.sh => scripts/rebuild.sh (100%) rename {provision => scripts}/udev.sh (100%) diff --git a/LICENSE b/LICENSE index d7546d47..f231bf83 100644 --- a/LICENSE +++ b/LICENSE @@ -19,3 +19,221 @@ 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. + +----- + +Parts of this software are based on Ledger Nano Secure SDK +and the Ledger Boilerplate App. + +- https://github.com/LedgerHQ/nanos-secure-sdk +- https://github.com/LedgerHQ/ledger-app-boilerplate + +(c) 2017 Ledger + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/Makefile b/Makefile index d9343630..b61d6b45 100644 --- a/Makefile +++ b/Makefile @@ -1,19 +1,46 @@ -#******************************************************************************* -# Ledger App -# (c) 2017 Ledger -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#******************************************************************************* +# /******************************************************************************* +# * This file is part of the ARK Ledger App. +# * +# * Copyright (c) ARK Ecosystem +# * +# * The MIT License (MIT) +# * +# * 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. +# * +# * ----- +# * +# * Parts of this software are based on Ledger Nano SDK +# * +# * (c) 2017 Ledger +# * +# * Licensed under the Apache License, Version 2.0 (the "License"); +# * you may not use this file except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# ******************************************************************************/ ifeq ($(BOLOS_SDK),) $(error Environment variable BOLOS_SDK is not set) @@ -32,9 +59,9 @@ ifeq ($(TARGET_NAME),TARGET_BLUE) ICONNAME=blue_app_ark.gif else ifeq ($(TARGET_NAME),TARGET_NANOX) - ICONNAME=nanox_app_ark.gif + ICONNAME=icons/nanox_app_ark.gif else - ICONNAME=nanos_app_ark.gif + ICONNAME=icons/nanos_app_ark.gif endif endif diff --git a/README.md b/README.md index 8bc43166..64993cf1 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,4 @@ + # ARK Ledger > A simple Ledger NanoS/NanoX app for the ARK Blockchain. @@ -6,209 +7,25 @@ [![License: MIT](https://badgen.now.sh/badge/license/MIT/green)](https://opensource.org/licenses/MIT) - * [The Ledger ARK app](#the-ledger-ark-app) - * [Learning Resources](#learning-resources) - * [The Ledger Docs](#the-ledger-docs) - * [The NanoS Secure SDK](#the-nanos-secure-sdk) - * [More Ledger Apps](#the-nanos-secure-sdk) - * [Further Reading](#further-reading) - * [The Vagrant Development Environment](#the-ledger-vagrant-environment) - * [Requirements](#requirements) - * [Installing Vagrant and VirtualBox](#installing-vagrant-and-virtualbox) - * [Initializing the Ledger-Vagrant Machine](#initializing-the-ledger-vagrant-machine) - * [Connecting to the Vagrant machine](#connecting-to-the-vagrant-machine) - * [Vagrant Troubleshooting](#vagrant-troubleshooting) - * [Building and Flashing](#building-and-flashing) - * [Building the Ledger ARK app](#building-the-ledger-ark-app) - * [Flashing the Ledger ARK app](#flashing-the-ledger-ark-app) - * [Rebuilding and Flashing Changes](#rebuilding-and-flashing-changes) - * [Debugging](#debugging) - * [Security](#security) - * [Credits](#credits) - * [License](#license) +* [The Ledger ARK app](#the-ledger-ark-app) +* [Security](#security) +* [Credits](#credits) +* [License](#license) - ## The Ledger ARK app This app is written in C for the Ledger NanoS and NanoX devices. -While the Ledger ARK app _is_ compatible with the Ledger NanoX, there is currently no way to load a custom app until LedgerHQ releases the nanox-sdk's. -The Ledger NanoS—however—is fully supported for development and flashing. - - -## Learning Resources - -This section contains some useful resources for learning about Ledger and embedded development—which is especially nuanced and requires additional considerations beyond typical crypto development. - -This is by no means an exhaustive list, but aims to provide some key materials. - ---- - -### The Ledger Docs - -The Ledger Docs are by far the best place to start. - -They cover anything from how a Ledger works, to publishing a Ledger Application, to secure app development. - -***Be sure to read the Ledger Security Guidelines.** -It covers many concerns that would typically not be obvious, and is something that should be read more than once. - -- [Ledger Documentation Hub](https://ledger.readthedocs.io/en/latest/index.html) -- [Ledger Documentation Hub: BOLOS](https://ledger.readthedocs.io/en/latest/bolos/features.html) -- [***Ledger Documentation Hub: Security Guidelines**](https://ledger.readthedocs.io/en/latest/additional/security_guidelines.html) - ---- - -### The NanoS Secure SDK - -- [GitHub: Ledger NanoS Secure SDK](https://github.com/LedgerHQ/nanos-secure-sdk) - ---- - -### More Ledger Apps - -- [Github: LedgerHQ Ledger Apps](https://github.com/LedgerHQ?q=ledger-app) - ---- - -### Further Reading - -- [ARM Developer Docs: The Arm C and C++ Libraries](https://developer.arm.com/docs/dui0475/i/the-arm-c-and-c-libraries) -- [C Library ABI for the ARM (PDF)](http://infocenter.arm.com/help/topic/com.arm.doc.ihi0039d/IHI0039D_clibabi.pdf) -- [Stanford Wiki: AVR Programming](https://ccrma.stanford.edu/wiki/AVR_Programming) - -## The Vagrant Development Environment - -Although the Vagrant environment is optional, it is highly recommended for development. -i.e. we _can_ use Python & the [ledgerblue CLI](https://github.com/LedgerHQ/blue-loader-python), but using Vagrant keeps the host system safe from unwanted modification and ensures code portability. - -The projects `src/`, `example/`, and `glyphs/` folders are configured to sync with the Vagrant shell, so any changes to files in those directories will be updated to the development environment accordingly. -At this time, the rebuild script and the Makefile do not sync. Modifying those files requires calling `vagrant halt && vagrant up --provision` from outside the shell. - ---- - -### Requirements -- Ledger Nano S -- Vagrant -- VirtualBox - ---- - -### Installing Vagrant and VirtualBox - -**Linux**: -```shell -sudo apt install virtualbox -sudo apt install vagrant -``` - -**macOS**: -```shell -brew cask install virtualbox -brew cask install vagrant -``` - -**Windows**: - -1) Download and run the installer: - `https://download.virtualbox.org/virtualbox/6.0.10/VirtualBox-6.0.10-132072-Win.exe` -2) Download and install the Oracle VM VirtualBox Extension Pack: - `https://download.virtualbox.org/virtualbox/6.0.10/Oracle_VM_VirtualBox_Extension_Pack-6.0.10.vbox-extpack` -3) Download and run the Vagrant installer: - `https://releases.hashicorp.com/vagrant/2.2.5/vagrant_2.2.5_x86_64.msi` - ---- - -### Initializing the Ledger-Vagrant Machine - -```shell -vagrant up -``` - -_note: setup will take a few minutes to provision._ - ---- - -### Connecting to the Vagrant machine - -```shell -vagrant ssh -``` - ---- - -### Vagrant Troubleshooting - -**USB Port locked out of the host machine**: - -- Try restarting the Vagrant Box from outside the shell. - - `vagrant halt && vagrant up` - -**Ledger not found in the Vagrant Box**: -- On Ubuntu, if the Ledger is not found in the vagrant box, ensure that the **host** user belongs to the vboxusers group. - - `sudo usermod -aG vboxusers ` -(_see [askubuntu.com/How to set up USB for VirtualBox](https://askubuntu.com/questions/25596/how-to-set-up-usb-for-virtualbox/25600#25600)_) -- Try another USB Cable. Prefer the Ledger-supplied cable. - Not all USB cables are created equal; and though rare, compromised cables have been found in the wild. - -## Building and Flashing - -Connect the Ledger device in before flashing. - -The Build and Flash commands are executed from project root: - -**Vagrant Shell**: -- `apps/ledger-app-ark` - -**ledgerblue CLI**: -- `ledger-app-ark` - ---- - -### Building the Ledger ARK app - -```shell -make -``` - ---- - -### Flashing the Ledger ARK app - -```shell -make && make load -``` - ---- - -### Rebuilding and Flashing Changes - -This is the go-to script to push changes to a Ledger device. -It cleans, builds, deletes and reflashes the app. - -```shell -sh ./rebuild.sh -``` - -## Debugging - -Along the way, debugging can save a lot of headaches when developing for embedded environments like Ledger. - -Specifically, Debugging on Ledger allows: -- Use of **PRINTF** and Console printing. -- Custom Certificates. -- Session Pin-bypass. +While the Ledger ARK app _is_ compatible with the Ledger NanoX, there is currently no way to load a custom app until LedgerHQ releases the nanox-secure-sdk's. -See the following for more information on setting up debugging: -- [**Ledger Documentation Hub: Debugging**](https://ledger.readthedocs.io/en/latest/userspace/debugging.html) +The Ledger NanoS is—however— fully supported for development and flashing. -***Be sure to also enable Debugging in the projects Makefile**: +For more development resources or environment installation and usage, see the following links: -```make -# DEBUG = 0 # <-- ln87 -DEBUG = 1 -``` +* [ARK Ledger App Example Payloads](./docs/PAYLOADS.md) +* [Development Resources](./docs/RESOURCES.md) +* [Development Environment Installation and Usage](./docs/INSTALLATION.md) ## Security diff --git a/Vagrantfile b/Vagrantfile index fec81664..3437328f 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -24,19 +24,19 @@ Vagrant.configure("2") do |config| # copy the rebuild script and app Makefile to vagrant machine config.vm.provision("file", - source: "./rebuild.sh", - destination: "/home/vagrant/apps/ledger-app-ark/") + source: "./scripts/rebuild.sh", + destination: "/home/vagrant/apps/ledger-app-ark/scripts/") config.vm.provision("file", source: "./Makefile", destination: "/home/vagrant/apps/ledger-app-ark/") # Copy Icons config.vm.provision("file", - source: "./nanos_app_ark.gif", - destination: "/home/vagrant/apps/ledger-app-ark/") + source: "./icons/nanos_app_ark.gif", + destination: "/home/vagrant/apps/ledger-app-ark/icons/") config.vm.provision("file", - source: "./nanox_app_ark.gif", - destination: "/home/vagrant/apps/ledger-app-ark/") + source: "./icons/nanox_app_ark.gif", + destination: "/home/vagrant/apps/ledger-app-ark/icons/") # VM specific configs config.vm.provider "virtualbox" do |v| @@ -55,6 +55,6 @@ Vagrant.configure("2") do |config| # Shell provisioning config.vm.provision "shell" do |s| - s.path = "provision/setup.sh" + s.path = "scripts/provision.sh" end end diff --git a/docs/INSTALLATION.md b/docs/INSTALLATION.md new file mode 100644 index 00000000..156a71b5 --- /dev/null +++ b/docs/INSTALLATION.md @@ -0,0 +1,139 @@ + +# ARK Ledger App Development Environment Installation and Usage + + +* [The Vagrant Development Environment](#the-ledger-vagrant-environment) + * [Requirements](#requirements) + * [Installing Vagrant and VirtualBox](#installing-vagrant-and-virtualbox) + * [Initializing the Ledger-Vagrant Machine](#initializing-the-ledger-vagrant-machine) + * [Connecting to the Vagrant machine](#connecting-to-the-vagrant-machine) + * [Vagrant Troubleshooting](#vagrant-troubleshooting) +* [Building and Flashing](#building-and-flashing) + * [Building the Ledger ARK app](#building-the-ledger-ark-app) + * [Flashing the Ledger ARK app](#flashing-the-ledger-ark-app) +* [Debugging](#debugging) + + +## The Vagrant Development Environment + +Although the Vagrant environment is optional, it is highly recommended for development. +i.e. we _can_ use Python & the [ledgerblue CLI](https://github.com/LedgerHQ/blue-loader-python), but using Vagrant keeps the host system safe from unwanted modification and ensures code portability. + +The projects `src/`, `example/`, and `glyphs/` folders are configured to sync with the Vagrant shell, so any changes to files in those directories will be updated to the development environment accordingly. +At this time, the rebuild script and the Makefile do not sync. Modifying those files requires calling `vagrant halt && vagrant up --provision` from outside the shell. + +### Requirements + +* Ledger Nano S +* Vagrant +* VirtualBox + +### Installing Vagrant and VirtualBox + +**Linux**: + +```shell +sudo apt install virtualbox +sudo apt install vagrant +``` + +**macOS**: + +```shell +brew cask install virtualbox +brew cask install vagrant +``` + +**Windows**: + +1) Download and run the installer: + `https://download.virtualbox.org/virtualbox/6.0.10/VirtualBox-6.0.10-132072-Win.exe` +2) Download and install the Oracle VM VirtualBox Extension Pack: + `https://download.virtualbox.org/virtualbox/6.0.10/Oracle_VM_VirtualBox_Extension_Pack-6.0.10.vbox-extpack` +3) Download and run the Vagrant installer: + `https://releases.hashicorp.com/vagrant/2.2.5/vagrant_2.2.5_x86_64.msi` + +### Initializing the Ledger-Vagrant Machine + +```shell +vagrant up +``` + +_note: setup will take a few minutes to provision._ + +### Connecting to the Vagrant machine + +```shell +vagrant ssh +``` + +### Vagrant Troubleshooting + +**USB Port locked out of the host machine**: + +* Try restarting the Vagrant Box from outside the shell. + * `vagrant halt && vagrant up` + +**Ledger not found in the Vagrant Box**: + +* On Ubuntu, if the Ledger is not found in the vagrant box, ensure that the **host** user belongs to the vboxusers group. + * `sudo usermod -aG vboxusers ` + (_see [askubuntu.com/How to set up USB for VirtualBox](https://askubuntu.com/questions/25596/how-to-set-up-usb-for-virtualbox/25600#25600)_) +* Try another USB Cable. Prefer the Ledger-supplied cable. + Not all USB cables are created equal; and though rare, compromised cables have been found in the wild. + +## Building and Flashing + +Connect the Ledger device in before flashing. + +The Build and Flash commands are executed from project root: + +**Vagrant Shell**: + +* `apps/ledger-app-ark` + +**ledgerblue CLI**: + +*`ledger-app-ark` + +### Building the Ledger ARK app + +```shell +make +``` + +### Flashing the Ledger ARK app + +```shell +make && make load +``` + +### Rebuilding and Flashing Changes + +This is the go-to script to push changes to a Ledger device. +It cleans, builds, deletes and re-flashes the app. + +```shell +sh ./scripts/rebuild.sh +``` + +## Debugging + +Along the way, debugging can save a lot of headaches when developing for embedded environments like Ledger. + +Specifically, Debugging on Ledger allows: + +* Use of **PRINTF** and Console printing. +* Custom Certificates. +* Session Pin-bypass. + +See the following for more information on setting up debugging: + +* [**Ledger Documentation Hub: Debugging**](https://ledger.readthedocs.io/en/latest/userspace/debugging.html) + +***Be sure to also enable Debugging in the projects Makefile**: + +```make +# DEBUG = 0 +DEBUG = 1 +``` diff --git a/docs/RESOURCES.md b/docs/RESOURCES.md new file mode 100644 index 00000000..b2ecfc07 --- /dev/null +++ b/docs/RESOURCES.md @@ -0,0 +1,41 @@ + +# ARK Ledger App Development Resources + +This section contains some useful resources for learning about Ledger and embedded development—which is especially nuanced and requires additional considerations beyond typical crypto development. + +This is by no means an exhaustive list, but aims to provide some key materials. + + + * [The Ledger Docs](#the-ledger-docs) + * [The NanoS Secure SDK](#the-nanos-secure-sdk) + * [More Ledger Apps](#the-nanos-secure-sdk) + * [Further Reading](#further-reading) + + +## The Ledger Docs + +The Ledger Docs are by far the best place to start. + +They cover anything from how a Ledger works, to publishing a Ledger Application, to secure app development. + +***Be sure to read the Ledger Security Guidelines.** + +It covers many concerns that would typically not be obvious, and is something that should be read more than once. + +* [Ledger Documentation Hub](https://ledger.readthedocs.io/en/latest/index.html) +* [Ledger Documentation Hub: BOLOS](https://ledger.readthedocs.io/en/latest/bolos/features.html) +* [***Ledger Documentation Hub: Security Guidelines**](https://ledger.readthedocs.io/en/latest/additional/security_guidelines.html) + +## The NanoS Secure SDK + +* [GitHub: Ledger NanoS Secure SDK](https://github.com/LedgerHQ/nanos-secure-sdk) + +## More Ledger Apps + +* [Github: LedgerHQ Ledger Apps](https://github.com/LedgerHQ?q=ledger-app) + +## Further Reading + +* [ARM Developer Docs: The Arm C and C++ Libraries](https://developer.arm.com/docs/dui0475/i/the-arm-c-and-c-libraries) +* [C Library ABI for the ARM (PDF)](http://infocenter.arm.com/help/topic/com.arm.doc.ihi0039d/IHI0039D_clibabi.pdf) +* [Stanford Wiki: AVR Programming](https://ccrma.stanford.edu/wiki/AVR_Programming) diff --git a/docs/fixtures/type_0.md b/docs/fixtures/type_0.md index 033f20bf..1929be1a 100644 --- a/docs/fixtures/type_0.md +++ b/docs/fixtures/type_0.md @@ -3,19 +3,19 @@ ## Signed Json Payload -```javascript +```json { - "version": 2, - "network": 23, - "type": 0, - "nonce": "1", - "senderPublicKey": "03a02b9d5fdd1307c2ee4652ba54d492d1fd11a7d1bb3f3a44c4a05e79f19de933", - "fee": "10000000", - "amount": "100000", - "expiration": 0, - "recipientId": "AJWRd23HNEhPLkK1ymMnwnDBX2a7QBZqff", - "signature": "4f01bd21828a633a3c821b9984fe642deab87237b99e62a543ca6948ff1d6d32f2475ada1f933da0591c40603693614afa69fcb4caa2b4be018788de9f10c42a", - "id": "8c85167cb1ca6f70e350f30173deb4c0a00ce7169d04f78fe4e4bcf2c3a75214" + "version": 2, + "network": 23, + "type": 0, + "nonce": "1", + "senderPublicKey": "03a02b9d5fdd1307c2ee4652ba54d492d1fd11a7d1bb3f3a44c4a05e79f19de933", + "fee": "10000000", + "amount": "100000", + "expiration": 0, + "recipientId": "AJWRd23HNEhPLkK1ymMnwnDBX2a7QBZqff", + "signature": "4f01bd21828a633a3c821b9984fe642deab87237b99e62a543ca6948ff1d6d32f2475ada1f933da0591c40603693614afa69fcb4caa2b4be018788de9f10c42a", + "id": "8c85167cb1ca6f70e350f30173deb4c0a00ce7169d04f78fe4e4bcf2c3a75214" } ``` @@ -46,6 +46,5 @@ ff0217010000000000010000000000000003a02b9d5fdd1307c2ee4652ba54d492d1fd11a7d1bb3f ## Example Ledger Payload ```shell -python examples/example_helper.py --tx ff0217010000000000010000000000000003a02b9d5fdd1307c2ee4652ba54d492d1fd11a7d1bb3f3a44c4a05e79f19de933809698000000000000a08601000000000000000000171dfc69b54c7fe901e91d5a9ab78388645e2427ea +python3 examples/example_helper.py --tx ff0217010000000000010000000000000003a02b9d5fdd1307c2ee4652ba54d492d1fd11a7d1bb3f3a44c4a05e79f19de933809698000000000000a08601000000000000000000171dfc69b54c7fe901e91d5a9ab78388645e2427ea ``` -> _note that signature bytes are removed (i.e. there's no need to sign a signed-transaction)._ diff --git a/docs/fixtures/type_0_vendor_field.json b/docs/fixtures/type_0_vendorfield.json similarity index 100% rename from docs/fixtures/type_0_vendor_field.json rename to docs/fixtures/type_0_vendorfield.json diff --git a/docs/fixtures/type_0_vendor_field.md b/docs/fixtures/type_0_vendorfield.md similarity index 73% rename from docs/fixtures/type_0_vendor_field.md rename to docs/fixtures/type_0_vendorfield.md index e54dbd65..b43f02ca 100644 --- a/docs/fixtures/type_0_vendor_field.md +++ b/docs/fixtures/type_0_vendorfield.md @@ -3,21 +3,21 @@ ## Signed Json Payload -```javascript +```json { - "version": 2, - "network": 23, - "type": 0, - "nonce": "3", - "senderPublicKey": "029f0ab8ab10258144332230178353fa24eb4274370345eaaf1594948a79c89399", - "fee": "10000000", - "amount": "1", - "vendorFieldHex": "48656c6c6f20576f726c64", - "vendorField": "Hello World", - "expiration": 0, - "recipientId": "AMLFBUUXs8ss9iq4k5fLLnZJ5TV757dUFV", - "signature": "0e23e11473c80ea9e2d32d32bb338a649ad09ac1e4b302ec938efcbe3046176344495e538d3fb1b95efd1f2d0d847b34eee0c440ae4575446d93e5c4219c0e63", - "id": "ffc4ace894fb29d986d0b11829e67740b47056bd362a52a5eaeda8cf8c18d349" + "version": 2, + "network": 23, + "type": 0, + "nonce": "3", + "senderPublicKey": "029f0ab8ab10258144332230178353fa24eb4274370345eaaf1594948a79c89399", + "fee": "10000000", + "amount": "1", + "vendorFieldHex": "48656c6c6f20576f726c64", + "vendorField": "Hello World", + "expiration": 0, + "recipientId": "AMLFBUUXs8ss9iq4k5fLLnZJ5TV757dUFV", + "signature": "0e23e11473c80ea9e2d32d32bb338a649ad09ac1e4b302ec938efcbe3046176344495e538d3fb1b95efd1f2d0d847b34eee0c440ae4575446d93e5c4219c0e63", + "id": "ffc4ace894fb29d986d0b11829e67740b47056bd362a52a5eaeda8cf8c18d349" } ``` @@ -49,6 +49,5 @@ ff02170100000000000300000000000000029f0ab8ab10258144332230178353fa24eb4274370345 ## Example Ledger Payload ```shell -python examples/example_helper.py --tx ff02170100000000000300000000000000029f0ab8ab10258144332230178353fa24eb4274370345eaaf1594948a79c8939980969800000000000b48656c6c6f20576f726c64010000000000000000000000173cf7ea59e8d9690e858b7674885b9a4a2c4365d6 +python3 examples/example_helper.py --tx ff02170100000000000300000000000000029f0ab8ab10258144332230178353fa24eb4274370345eaaf1594948a79c8939980969800000000000b48656c6c6f20576f726c64010000000000000000000000173cf7ea59e8d9690e858b7674885b9a4a2c4365d6 ``` -> _note that signature bytes are removed (i.e. there's no need to sign a signed-transaction)._ diff --git a/docs/fixtures/type_1.md b/docs/fixtures/type_1.md index 06c33f44..2a2f7d98 100644 --- a/docs/fixtures/type_1.md +++ b/docs/fixtures/type_1.md @@ -3,22 +3,22 @@ ## Signed Json Payload -```javascript +```json { - "version": 2, - "network": 23, - "type": 1, - "nonce": "2", - "senderPublicKey": "02e0c063777427ac196af3c426fd648231ebc4ea06fff5edb1652b98f9c8420c69", - "fee": "500000000", - "amount": "0", - "asset": { - "signature": { - "publicKey": "02877e4f35c76abaeb152b128670db0a7ae10b3999afcd28a42938b653fbf87ae9" - } - }, - "signature": "adb983dd28827860f69c6a98b2f9db88a9e084cc7fe3a691463377c3225b02fee24547b516d1cf05f2f77b65a9c36069f6540605c01694008e2a5cb4fc88f62f", - "id": "4c2cd8c4281a34a60505f260d067e5c678d3c57510bfbcda24c5e0da5f46bd5e" + "version": 2, + "network": 23, + "type": 1, + "nonce": "2", + "senderPublicKey": "02e0c063777427ac196af3c426fd648231ebc4ea06fff5edb1652b98f9c8420c69", + "fee": "500000000", + "amount": "0", + "asset": { + "signature": { + "publicKey": "02877e4f35c76abaeb152b128670db0a7ae10b3999afcd28a42938b653fbf87ae9" + } + }, + "signature": "adb983dd28827860f69c6a98b2f9db88a9e084cc7fe3a691463377c3225b02fee24547b516d1cf05f2f77b65a9c36069f6540605c01694008e2a5cb4fc88f62f", + "id": "4c2cd8c4281a34a60505f260d067e5c678d3c57510bfbcda24c5e0da5f46bd5e" } ``` @@ -47,6 +47,5 @@ ff0217010000000100020000000000000002e0c063777427ac196af3c426fd648231ebc4ea06fff5 ## Example Ledger Payload ```shell -python examples/example_helper.py --tx ff0217010000000100020000000000000002e0c063777427ac196af3c426fd648231ebc4ea06fff5edb1652b98f9c8420c690065cd1d000000000002877e4f35c76abaeb152b128670db0a7ae10b3999afcd28a42938b653fbf87ae9 +python3 examples/example_helper.py --tx ff0217010000000100020000000000000002e0c063777427ac196af3c426fd648231ebc4ea06fff5edb1652b98f9c8420c690065cd1d000000000002877e4f35c76abaeb152b128670db0a7ae10b3999afcd28a42938b653fbf87ae9 ``` -> _note that signature bytes are removed (i.e. there's no need to sign a signed-transaction)._ diff --git a/docs/fixtures/type_10.md b/docs/fixtures/type_10.md index 31af5c8b..b06b8744 100644 --- a/docs/fixtures/type_10.md +++ b/docs/fixtures/type_10.md @@ -3,22 +3,22 @@ ## Signed Json Payload -```javascript +```json { - "version": 2, - "network": 23, - "type": 10, - "nonce": "3", - "senderPublicKey": "037fc2e14f626586722a4f9e00dca2efbc4ac409c1ca63bc4309f56184265f95d5", - "fee": "0", - "amount": "0", - "asset": { - "refund": { - "lockTransactionId": "c62bd36c162dd0116a08bf8a75cd6d1f83b8f5f1e17e89c8231ebb7af595f64d" - } - }, - "signature": "ae272f4650ee1d46260b8f62e7e956af33cd25587318fed056aec8e9d518e2394d0fd3166d8cd8506abfc303c644041a4bab35daf7c8aaa77f916ef09dc90336", - "id": "4d9ee7f8b27999d4ce7acf6afee08e3da67bc1fca258f2bd17e426933a846602" + "version": 2, + "network": 23, + "type": 10, + "nonce": "3", + "senderPublicKey": "037fc2e14f626586722a4f9e00dca2efbc4ac409c1ca63bc4309f56184265f95d5", + "fee": "0", + "amount": "0", + "asset": { + "refund": { + "lockTransactionId": "c62bd36c162dd0116a08bf8a75cd6d1f83b8f5f1e17e89c8231ebb7af595f64d" + } + }, + "signature": "ae272f4650ee1d46260b8f62e7e956af33cd25587318fed056aec8e9d518e2394d0fd3166d8cd8506abfc303c644041a4bab35daf7c8aaa77f916ef09dc90336", + "id": "4d9ee7f8b27999d4ce7acf6afee08e3da67bc1fca258f2bd17e426933a846602" } ``` @@ -47,6 +47,5 @@ ff0217010000000a000300000000000000037fc2e14f626586722a4f9e00dca2efbc4ac409c1ca63 ## Example Ledger Payload ```shell -python examples/example_helper.py --tx ff0217010000000a000300000000000000037fc2e14f626586722a4f9e00dca2efbc4ac409c1ca63bc4309f56184265f95d5000000000000000000c62bd36c162dd0116a08bf8a75cd6d1f83b8f5f1e17e89c8231ebb7af595f64d +python3 examples/example_helper.py --tx ff0217010000000a000300000000000000037fc2e14f626586722a4f9e00dca2efbc4ac409c1ca63bc4309f56184265f95d5000000000000000000c62bd36c162dd0116a08bf8a75cd6d1f83b8f5f1e17e89c8231ebb7af595f64d ``` -> _note that signature bytes are removed (i.e. there's no need to sign a signed-transaction)._ diff --git a/docs/fixtures/type_2.md b/docs/fixtures/type_2.md index bf598816..3acfd7fe 100644 --- a/docs/fixtures/type_2.md +++ b/docs/fixtures/type_2.md @@ -3,22 +3,22 @@ ## Signed Json Payload -```javascript +```json { - "version": 2, - "network": 23, - "type": 2, - "nonce": "2", - "senderPublicKey": "02a574b8995542631976691a7f73b59e4700cd84badb831331ab18ae2113a184ba", - "fee": "2500000000", - "amount": "0", - "asset": { - "delegate": { - "username": "02a574b8995542631976" - } - }, - "signature": "f2cf8acf6ccb71fa0e848ca185a93e6ff44e0dd266b08c4bc0dfc7984499acd759f6067ace6bb00eae404eafa6af3548f5d35f8727f4ddeba69b6d925c604338", - "id": "9b232e31c6385a2c730f5bec3c0220da6a184320e6c38bd7b6fd5a18b8501472" + "version": 2, + "network": 23, + "type": 2, + "nonce": "2", + "senderPublicKey": "02a574b8995542631976691a7f73b59e4700cd84badb831331ab18ae2113a184ba", + "fee": "2500000000", + "amount": "0", + "asset": { + "delegate": { + "username": "02a574b8995542631976" + } + }, + "signature": "f2cf8acf6ccb71fa0e848ca185a93e6ff44e0dd266b08c4bc0dfc7984499acd759f6067ace6bb00eae404eafa6af3548f5d35f8727f4ddeba69b6d925c604338", + "id": "9b232e31c6385a2c730f5bec3c0220da6a184320e6c38bd7b6fd5a18b8501472" } ``` @@ -48,6 +48,5 @@ ff0217010000000200020000000000000002a574b8995542631976691a7f73b59e4700cd84badb83 ## Example Ledger Payload ```shell -python examples/example_helper.py --tx ff0217010000000200020000000000000002a574b8995542631976691a7f73b59e4700cd84badb831331ab18ae2113a184ba00f902950000000000143032613537346238393935353432363331393736 +python3 examples/example_helper.py --tx ff0217010000000200020000000000000002a574b8995542631976691a7f73b59e4700cd84badb831331ab18ae2113a184ba00f902950000000000143032613537346238393935353432363331393736 ``` -> _note that signature bytes are removed (i.e. there's no need to sign a signed-transaction)._ diff --git a/docs/fixtures/type_3.md b/docs/fixtures/type_3.md index b7b04b0d..2eea9ff6 100644 --- a/docs/fixtures/type_3.md +++ b/docs/fixtures/type_3.md @@ -3,22 +3,22 @@ ## Signed Json Payload -```javascript +```json { - "version": 2, - "network": 23, - "type": 3, - "nonce": "2", - "senderPublicKey": "02555806bca6737eaeaff6434d5171bac8aeb72533ed9bafb280dd11b328a3822d", - "fee": "100000000", - "amount": "0", - "asset": { - "votes": [ - "+02555806bca6737eaeaff6434d5171bac8aeb72533ed9bafb280dd11b328a3822d" - ] - }, - "signature": "77a40e4b4170ce613c8f9ccc0650887349330a9a8b459189ee379c88cf2c8506d65aa3ca8293705373f1bde8d6b27e5071de1785ac9c0182f41e364f8f9e3b64", - "id": "fd59eaa4a2bbb3570c7b01ad464c968aa9bf73a40e0417c802ab30553ded8476" + "version": 2, + "network": 23, + "type": 3, + "nonce": "2", + "senderPublicKey": "02555806bca6737eaeaff6434d5171bac8aeb72533ed9bafb280dd11b328a3822d", + "fee": "100000000", + "amount": "0", + "asset": { + "votes": [ + "+02555806bca6737eaeaff6434d5171bac8aeb72533ed9bafb280dd11b328a3822d" + ] + }, + "signature": "77a40e4b4170ce613c8f9ccc0650887349330a9a8b459189ee379c88cf2c8506d65aa3ca8293705373f1bde8d6b27e5071de1785ac9c0182f41e364f8f9e3b64", + "id": "fd59eaa4a2bbb3570c7b01ad464c968aa9bf73a40e0417c802ab30553ded8476" } ``` @@ -48,6 +48,5 @@ ff0217010000000300020000000000000002555806bca6737eaeaff6434d5171bac8aeb72533ed9b ## Example Ledger Payload ```shell -python examples/example_helper.py --tx ff0217010000000300020000000000000002555806bca6737eaeaff6434d5171bac8aeb72533ed9bafb280dd11b328a3822d00e1f5050000000000010102555806bca6737eaeaff6434d5171bac8aeb72533ed9bafb280dd11b328a3822d +python3 examples/example_helper.py --tx ff0217010000000300020000000000000002555806bca6737eaeaff6434d5171bac8aeb72533ed9bafb280dd11b328a3822d00e1f5050000000000010102555806bca6737eaeaff6434d5171bac8aeb72533ed9bafb280dd11b328a3822d ``` -> _note that signature bytes are removed (i.e. there's no need to sign a signed-transaction)._ diff --git a/docs/fixtures/type_4.md b/docs/fixtures/type_4.md index 1501d260..c051d612 100644 --- a/docs/fixtures/type_4.md +++ b/docs/fixtures/type_4.md @@ -3,33 +3,33 @@ ## Signed Json Payload -```javascript +```json { - "version": 2, - "network": 23, - "type": 4, - "nonce": "2", - "senderPublicKey": "03b593aa66b53525c5399b4af5a4f583dede1c2a46176c6796a7284ee9c0a1167f", - "fee": "2000000000", - "amount": "0", - "asset": { - "multiSignature": { - "publicKeys": [ - "037eaa8cb236c40a08fcb9d6220743ee6ae1b5c40e8a77a38f286516c3ff663901", - "0301fd417566397113ba8c55de2f093a572744ed1829b37b56a129058000ef7bce", - "0209d3c0f68994253cee24b23df3266ba1f0ca2f0666cd69a46544d63001cdf150" - ], - "min": 2 - } - }, - "signature": "16b09ed47ce05cc9096b87b73008f73aa51d4ddc8713d4ca0fcbcabeacfd738e0181201d55a92d5b2978d0c458684489cf133d18c521fbec431dd759d16bedbb", - "signatures": [ - "004495d593cfb8be3293e2473acf504870d2dcf71dbee7620270e136ed63c5eef259099d225f7866178968f0c3581509d92d902914674c8f86b99eb55aaa97586e", - "0171d86f3f6552b237dd81272a7b0da7718c4d26682255223dcf1928174082ce72b07218162938c674afe741119650135338eb3da159e0626ddab6b7851882e08b", - "02d44d9bde77c9ea02d3516ab3263a77f4f9fbb90c30b47eba7a8bb87325edeb78dd69f914f28426e6ff661c4bc001f253130f4e7eb092a9131c8ca69dbfaff32f" - ], - "id": "46343c36bf7497b68e14d4c0fd713e41a737841b6a858fa41ef0eab6c4647938", - "MultiSignatureAddress": "ATp6gFCEu4P1TWNngyD8mvg8UYdu7kps97", + "version": 2, + "network": 23, + "type": 4, + "nonce": "2", + "senderPublicKey": "03b593aa66b53525c5399b4af5a4f583dede1c2a46176c6796a7284ee9c0a1167f", + "fee": "2000000000", + "amount": "0", + "asset": { + "multiSignature": { + "publicKeys": [ + "037eaa8cb236c40a08fcb9d6220743ee6ae1b5c40e8a77a38f286516c3ff663901", + "0301fd417566397113ba8c55de2f093a572744ed1829b37b56a129058000ef7bce", + "0209d3c0f68994253cee24b23df3266ba1f0ca2f0666cd69a46544d63001cdf150" + ], + "min": 2 + } + }, + "signature": "16b09ed47ce05cc9096b87b73008f73aa51d4ddc8713d4ca0fcbcabeacfd738e0181201d55a92d5b2978d0c458684489cf133d18c521fbec431dd759d16bedbb", + "signatures": [ + "004495d593cfb8be3293e2473acf504870d2dcf71dbee7620270e136ed63c5eef259099d225f7866178968f0c3581509d92d902914674c8f86b99eb55aaa97586e", + "0171d86f3f6552b237dd81272a7b0da7718c4d26682255223dcf1928174082ce72b07218162938c674afe741119650135338eb3da159e0626ddab6b7851882e08b", + "02d44d9bde77c9ea02d3516ab3263a77f4f9fbb90c30b47eba7a8bb87325edeb78dd69f914f28426e6ff661c4bc001f253130f4e7eb092a9131c8ca69dbfaff32f" + ], + "id": "46343c36bf7497b68e14d4c0fd713e41a737841b6a858fa41ef0eab6c4647938", + "MultiSignatureAddress": "ATp6gFCEu4P1TWNngyD8mvg8UYdu7kps97", } ``` @@ -68,6 +68,5 @@ ff0217010000000400020000000000000003b593aa66b53525c5399b4af5a4f583dede1c2a46176c ## Example Ledger Payload ```shell -python examples/example_helper.py --tx ff0217010000000400020000000000000003b593aa66b53525c5399b4af5a4f583dede1c2a46176c6796a7284ee9c0a1167f0094357700000000000203037eaa8cb236c40a08fcb9d6220743ee6ae1b5c40e8a77a38f286516c3ff6639010301fd417566397113ba8c55de2f093a572744ed1829b37b56a129058000ef7bce0209d3c0f68994253cee24b23df3266ba1f0ca2f0666cd69a46544d63001cdf150004495d593cfb8be3293e2473acf504870d2dcf71dbee7620270e136ed63c5eef259099d225f7866178968f0c3581509d92d902914674c8f86b99eb55aaa97586e0171d86f3f6552b237dd81272a7b0da7718c4d26682255223dcf1928174082ce72b07218162938c674afe741119650135338eb3da159e0626ddab6b7851882e08b02d44d9bde77c9ea02d3516ab3263a77f4f9fbb90c30b47eba7a8bb87325edeb78dd69f914f28426e6ff661c4bc001f253130f4e7eb092a9131c8ca69dbfaff32f +python3 examples/example_helper.py --tx ff0217010000000400020000000000000003b593aa66b53525c5399b4af5a4f583dede1c2a46176c6796a7284ee9c0a1167f0094357700000000000203037eaa8cb236c40a08fcb9d6220743ee6ae1b5c40e8a77a38f286516c3ff6639010301fd417566397113ba8c55de2f093a572744ed1829b37b56a129058000ef7bce0209d3c0f68994253cee24b23df3266ba1f0ca2f0666cd69a46544d63001cdf150004495d593cfb8be3293e2473acf504870d2dcf71dbee7620270e136ed63c5eef259099d225f7866178968f0c3581509d92d902914674c8f86b99eb55aaa97586e0171d86f3f6552b237dd81272a7b0da7718c4d26682255223dcf1928174082ce72b07218162938c674afe741119650135338eb3da159e0626ddab6b7851882e08b02d44d9bde77c9ea02d3516ab3263a77f4f9fbb90c30b47eba7a8bb87325edeb78dd69f914f28426e6ff661c4bc001f253130f4e7eb092a9131c8ca69dbfaff32f ``` -> _note that signature bytes are removed (i.e. there's no need to sign a signed-transaction)._ diff --git a/docs/fixtures/type_5.md b/docs/fixtures/type_5.md index 52ddeb06..aee20cd4 100644 --- a/docs/fixtures/type_5.md +++ b/docs/fixtures/type_5.md @@ -3,20 +3,20 @@ ## Signed Json Payload -```javascript +```json { - "version": 2, - "network": 23, - "type": 5, - "nonce": "2", - "senderPublicKey": "038e000c902d4551065ac5705637c685d52e6ac4032e158ad0370c5ef2bbafae2c", - "fee": "500000000", - "amount": "0", - "asset": { - "ipfs": "QmYSK2JyM3RyDyB52caZCTKFR3HKniEcMnNJYdk8DQ6KKB" - }, - "signature": "ed8e729b40e73ab86c3b6675d463c19d88495bf4e091037e80352afe0ea29efff04d2667bfe8d78e5c4ad410fb0f7a0f511fbd657a54181aca8de4e8c6ebfe2c", - "id": "77d8134144780e50db71adb496e02bcbde43e76a0cd7eeae7ff3641db75187ec", + "version": 2, + "network": 23, + "type": 5, + "nonce": "2", + "senderPublicKey": "038e000c902d4551065ac5705637c685d52e6ac4032e158ad0370c5ef2bbafae2c", + "fee": "500000000", + "amount": "0", + "asset": { + "ipfs": "QmYSK2JyM3RyDyB52caZCTKFR3HKniEcMnNJYdk8DQ6KKB" + }, + "signature": "ed8e729b40e73ab86c3b6675d463c19d88495bf4e091037e80352afe0ea29efff04d2667bfe8d78e5c4ad410fb0f7a0f511fbd657a54181aca8de4e8c6ebfe2c", + "id": "77d8134144780e50db71adb496e02bcbde43e76a0cd7eeae7ff3641db75187ec", } ``` @@ -55,6 +55,5 @@ ff02170100000005000200000000000000038e000c902d4551065ac5705637c685d52e6ac4032e15 ## Example Ledger Payload ```shell -python examples/example_helper.py --tx ff02170100000005000200000000000000038e000c902d4551065ac5705637c685d52e6ac4032e158ad0370c5ef2bbafae2c0065cd1d000000000012209608184d6cee2b9af8e6c2a46fc9318adf73329aeb8a86cf8472829fff5bb89e +python3 examples/example_helper.py --tx ff02170100000005000200000000000000038e000c902d4551065ac5705637c685d52e6ac4032e158ad0370c5ef2bbafae2c0065cd1d000000000012209608184d6cee2b9af8e6c2a46fc9318adf73329aeb8a86cf8472829fff5bb89e ``` -> _note that signature bytes are removed (i.e. there's no need to sign a signed-transaction)._ diff --git a/docs/fixtures/type_6.md b/docs/fixtures/type_6.md index 9ea6caa3..318b9a42 100644 --- a/docs/fixtures/type_6.md +++ b/docs/fixtures/type_6.md @@ -3,158 +3,158 @@ ## Signed Json Payload -```javascript +```json { - "version": 2, - "network": 23, - "type": 6, - "nonce": "2", - "senderPublicKey": "02a53371b23f991740f968e3d96de42a67b4242e267cad8050ae4b68bf9ac20af2", - "fee": "10000000", - "amount": "0", - "asset": { - "payments": [ - { "amount": "1", "recipientId": "AJkSjZPqRFksw6CDyCrAqPqpRzTJ9y2JVg" }, - { "amount": "1", "recipientId": "AdmKdL2yUHa2wEq1QajidRMD5KAQ92HY1p" }, - { "amount": "1", "recipientId": "AQUBtovaVuwDuHSrjLZRbPzhuDGMp7iUje" }, - { "amount": "1", "recipientId": "AQBCwmStjJAhc665FD81swaot6NMKDmWSe" }, - { "amount": "1", "recipientId": "AZUet7svbkQ54EhkXjtHFQuz1G8Hg3k29o" }, - { "amount": "1", "recipientId": "AZy7zpA7d61Zxy51nhrVUEK52LX9dxNhwE" }, - { "amount": "1", "recipientId": "AJi63aGakFJo4aYcH5U5s3HUzmx5B31tqA" }, - { "amount": "1", "recipientId": "ARbzRpB4uQsMwjXqohA1bURVNrURHWcbRB" }, - { "amount": "1", "recipientId": "AFqBJKjoGiMBiaUA5ZvuaoHCtsAtVaYfiQ" }, - { "amount": "1", "recipientId": "AZ9W5GCvLjYn86uS4gVvLF3dUeff7Sm7kZ" }, - { "amount": "1", "recipientId": "ALetETJv5kUDaXxGyqgfbvCAq7Xd4LkNcR" }, - { "amount": "1", "recipientId": "AHNAYaC9SoWBtyiHYs8BoY6dkrFc8e1r6t" }, - { "amount": "1", "recipientId": "APHZ1wBFg2CtYSxUEoVztzrPXpjZWB7Ed3" }, - { "amount": "1", "recipientId": "ASYHnawx4LYnS3qgEshPXg1ovAMgqPvMyd" }, - { "amount": "1", "recipientId": "AJ3rQcLRmfu8myq3Riob1P1PhwoTmx1uGM" }, - { "amount": "1", "recipientId": "AdaRMae1p4XuyniQSwEF7KJMTzTDjLEtrA" }, - { "amount": "1", "recipientId": "ARXPxwvq3NzHd2h9SiGbnxB3WEHhcf3m9r" }, - { "amount": "1", "recipientId": "ATKBDzyWYJ1EWDLypzN7pP1KiTtmMYWRAd" }, - { "amount": "1", "recipientId": "AUVnmcZ3BaBTcNcp1TANSXeQqeCJnL5ajG" }, - { "amount": "1", "recipientId": "AJyp9HagSbNGo587BX37yhm6bYvJqmhfDq" }, - { "amount": "1", "recipientId": "AKVSJqTpPEPp7hrwuMfuSAzEUbRBFMivsD" }, - { "amount": "1", "recipientId": "AXVUG59zkbnGXCsVZjHN8WvX1tjEhuaJbH" }, - { "amount": "1", "recipientId": "AM6GrCiESsELYsaSxUXtLzBrZo1SGu9RGs" }, - { "amount": "1", "recipientId": "AKqaDdoNpMU234jm8tocn8rP13paJcLhc7" }, - { "amount": "1", "recipientId": "APRgmUz1jjcDqGMN9jju9DC1ZEeUE9AywY" }, - { "amount": "1", "recipientId": "AcHeBGLwiPU2X8wzVPLon1WpkpokP4Wohq" }, - { "amount": "1", "recipientId": "AWgKzu21eySyu7iqyYjWa2EfpFA7mZvQZU" }, - { "amount": "1", "recipientId": "AcKhDtSsyr9Q863PDEV5myZFChKCPfyD18" }, - { "amount": "1", "recipientId": "Ae6T9ZUTR6RSCoGD6CnhB9yVyYX7QsrZbA" }, - { "amount": "1", "recipientId": "AUDuhQsp3eCPwYxAbJa49DouCjjXtpzjjG" }, - { "amount": "1", "recipientId": "APf4R1acVovfZiccBCPLYwrcbYZPUeGKcC" }, - { "amount": "1", "recipientId": "Ab36vcphZSgPo3TfRxRUM9mgjE3D6Rcqve" }, - { "amount": "1", "recipientId": "Aai1yVoVAJcwzza8Kh9q2X7UCYHWRRsjHP" }, - { "amount": "1", "recipientId": "ATEi5aLWNrXCtLSEBwEUFJ9a3NdU2L5Cx3" }, - { "amount": "1", "recipientId": "AdxVQZpf2EZoEzr8dCY81wcGRBKksqt9uJ" }, - { "amount": "1", "recipientId": "AGvec84izZTQ4EkDdSQHdn6eQ8WHAXbRK8" }, - { "amount": "1", "recipientId": "AL7Cmvd2LukSvzUFLB729wfgfjxkFrwxKK" }, - { "amount": "1", "recipientId": "AK8sqUy3jNc1YD9rEQaHEeMmt4KkFWbiKL" }, - { "amount": "1", "recipientId": "AcZBzGrciGZQrChYdqEpRxUT28G2uEUddY" }, - { "amount": "1", "recipientId": "AaSPkSNxtsKRspwvWtvc8gvmRME5aASaEx" }, - { "amount": "1", "recipientId": "ARAjyStxuU45PqLH6kzQMrAJEqc89qZVzV" }, - { "amount": "1", "recipientId": "AdnoS6ZA7sE384pRamg9sdqC6cxjkD7pg3" }, - { "amount": "1", "recipientId": "AXH4hXPpFkRJU3HbGUUFsDbVEGxwcQLmhA" }, - { "amount": "1", "recipientId": "AX3xKYm66DeJqXUEbVeZytT8Lf6GQf4koL" }, - { "amount": "1", "recipientId": "AW7wPm9Pw3oMwBzpq24VLEwYk9CoMmYh9h" }, - { "amount": "1", "recipientId": "AapstTvRBRUWsxhEna4QC3w91sF7fKiEyC" }, - { "amount": "1", "recipientId": "AFoSv2fJK1neaNJvRDJ2bnxRUbcT8BLpxd" }, - { "amount": "1", "recipientId": "AaEQy4PNo69MWuQxBjYPv5fbX9ffj6eGxo" }, - { "amount": "1", "recipientId": "APfMoW1D7nyYjCas77UjXYG1r4ae5Z8egK" }, - { "amount": "1", "recipientId": "AdyTCFa57K44vzUHMe3cAZzN5LughnEnk1" }, - { "amount": "1", "recipientId": "AU5UYf4ARSzPVcZmEEoxygmbMFypJQU7ns" }, - { "amount": "1", "recipientId": "ALXjSdt8Bis4avRZGmUU4Kfd9D3hH4mxta" }, - { "amount": "1", "recipientId": "ALNkATjVhskN1cqnLjLYGUKxFivMTWRbR4" }, - { "amount": "1", "recipientId": "AcBKDRDbfek1ZdmP2Hz5zNyprU3bHVNZfe" }, - { "amount": "1", "recipientId": "Ab2MNhvrBGgK7ropw43sC4mXzcdiSzW8hN" }, - { "amount": "1", "recipientId": "AVMBceVMRPeZgM83qpdpQ1ytyTPCowi1F5" }, - { "amount": "1", "recipientId": "AJJNxLu5M9oPVMkx8etDPRcNs4tFaDURsz" }, - { "amount": "1", "recipientId": "AGRapiHRcPnwo3MvASwrQLppM5MKGUAHqs" }, - { "amount": "1", "recipientId": "AehS4gnFTzfnkmJqre4a5kn2sze3H28MYY" }, - { "amount": "1", "recipientId": "APQJh9sF2wZ7cDy4R3FUiepqPnefP1ByR4" }, - { "amount": "1", "recipientId": "AHVSsxZ7x7rbHEszpBzonMVYxJdRXpQX5x" }, - { "amount": "1", "recipientId": "AJ2QEu7gpzG5WkYxA7c82ojPLWMvYhpu4d" }, - { "amount": "1", "recipientId": "AMckjhZaJxoJwNke4pf43sYXBoS8xxGW3Z" }, - { "amount": "1", "recipientId": "AMutAXid6DPedsbgD6ZdSQEk1bh7ki7j5z" }, - { "amount": "1", "recipientId": "AG1RfaaZwqB8KDpFfJj75kLF1mwSAyh7jQ" }, - { "amount": "1", "recipientId": "AZebGuQaDQKWqztxoUuFyQ7jSKEobjDEtF" }, - { "amount": "1", "recipientId": "AeijCQzpk7HYpaHXS1f15TaLuHnLiqJ3td" }, - { "amount": "1", "recipientId": "AZNu9h6RTxHtMAFfH3NqLJQ7MMEr11b4jH" }, - { "amount": "1", "recipientId": "Aek93NcQX2XoEAUut4rdbWkuC4At8FQNgP" }, - { "amount": "1", "recipientId": "AK9xvxKkYJbJra2FCdYMyk4YpCBawTDqzP" }, - { "amount": "1", "recipientId": "APUvdtL5vRU4p672gkXBmk1jB7WsfnAjcg" }, - { "amount": "1", "recipientId": "ANhh6BPh8FerPGdAoEy1ZTg6XXRrWDLvGG" }, - { "amount": "1", "recipientId": "AXnsAa9Xfsmv4yR27zq3sKpwhzFASdQqHS" }, - { "amount": "1", "recipientId": "ANLKvT56LBvj6FX5bsvHLcEcFcrZgdYUhL" }, - { "amount": "1", "recipientId": "ARsEFbgLn8c76PbfaQ6NybuUSNBLx2WTFz" }, - { "amount": "1", "recipientId": "AU6JgpZeCEMACmHuDHE4KgDuNbodPLNTQj" }, - { "amount": "1", "recipientId": "AezxGoySwd5mzapEudihsPxTRC9N3mje65" }, - { "amount": "1", "recipientId": "ASu9fJ97gfwEV1BbUJQ8v6jvjehGsx7MhB" }, - { "amount": "1", "recipientId": "AcP6Mv39rvvJh2Pm2sZJb8eVRkPLdFnk31" }, - { "amount": "1", "recipientId": "AM89Z5L92EPGcntXRgjeBjaC6bvXhuXhsf" }, - { "amount": "1", "recipientId": "AdBxDtBWULrx9oi8Vw8PASg2vsAMBkfu8N" }, - { "amount": "1", "recipientId": "AYuHPh1PYkAQmWoPxFCBFkarXuHZQzr6q8" }, - { "amount": "1", "recipientId": "AHki3X6Y9oD2aC48C7nYJxBXtQrEDavw1C" }, - { "amount": "1", "recipientId": "AYsF7goWELTH1yWNHV7NuPQLFYh8Wewsy3" }, - { "amount": "1", "recipientId": "AQ4r535GMJBq9YGWNy7ZWmmiKezLPPKKVB" }, - { "amount": "1", "recipientId": "AJWMxAj163ZKE3K8oq8oGJQpsr7QhXcFjG" }, - { "amount": "1", "recipientId": "APEniF2gdeLLKL8WYwgLcp5HjebYUxpd3m" }, - { "amount": "1", "recipientId": "AeRb1mGCAus2KuR2EaaeDCs1eJSotnnSVJ" }, - { "amount": "1", "recipientId": "ALNbbL6qhRg1NmRhBBCeWNscZgdtD9FN5J" }, - { "amount": "1", "recipientId": "AMdWG71SKHgcNtwQNHYVUqmKSMTPpBDRe6" }, - { "amount": "1", "recipientId": "ASN6yDJPqAo2j2NkY4aakTSRuTVuJtgTnY" }, - { "amount": "1", "recipientId": "AFqD175UbMhHeaEJsoGpoFSyWwbpWLD7Z3" }, - { "amount": "1", "recipientId": "ALaWGuGcq6gb11Gf8rZx2LBwDHEtAAjR39" }, - { "amount": "1", "recipientId": "AJMtGbZudwPjmeUA2JtaFBbcp4aMNGEpmw" }, - { "amount": "1", "recipientId": "AWJUMu5Re8V7HjnDruAiPsVGaVyPiFt9PS" }, - { "amount": "1", "recipientId": "ATJaqBbP9BQFnjBhztVwSJnWx5stV4STVY" }, - { "amount": "1", "recipientId": "ATVNCQsWRpSrSrNkN35JfYTnm2DDP1TgSe" }, - { "amount": "1", "recipientId": "AJ9Cs9czY165T1Pbqr2NE6cAkuZxjmc1mJ" }, - { "amount": "1", "recipientId": "AbvkpAvmnVfLTWpQNGgjRGPzg18NsaZvoj" }, - { "amount": "1", "recipientId": "ASQGzFRaYaznkwTyK5XnGaSXBtct75mSAA" }, - { "amount": "1", "recipientId": "AS8JK9R8CsF7TwzjgcoWur4doCtmcdSgJD" }, - { "amount": "1", "recipientId": "AdAkT5mbKyEHZqetXDUQGkATRLgyEsGr7g" }, - { "amount": "1", "recipientId": "AZhSj2JZx5aEHaKFr2RHCrhEwTGBtaR7RY" }, - { "amount": "1", "recipientId": "AK8LqchMVGTyiAhDaCb5jcvZ6SftuEEzmj" }, - { "amount": "1", "recipientId": "AXLQ6xPHxTdhZ7YZvCwSoZ4dQ7E3qXVtWH" }, - { "amount": "1", "recipientId": "AQGeF1NLTyP5zraBCdjTdsodJCnPWR2xxZ" }, - { "amount": "1", "recipientId": "AH4b7u5gFWh7Uu4TNVD1NfETqEByxaRJNY" }, - { "amount": "1", "recipientId": "AXYdBaj8hKaqHp7kUB1LSbkdDV9vSAbpLv" }, - { "amount": "1", "recipientId": "AbU2225mM8941Fsp1K4GcVtVeEizzGsu18" }, - { "amount": "1", "recipientId": "AGNRPoJf6GmzEyaWjNV5Du63ueVdeNnb7C" }, - { "amount": "1", "recipientId": "AW732HLfot4iGJnAcvJmBshUKZHfGy5mw1" }, - { "amount": "1", "recipientId": "AWMhtF3uJiNACNAfvmzrGKhgjSHTUFbTn1" }, - { "amount": "1", "recipientId": "AXX8NPgCYnZA2ydomv5JUaFdLm3Fy5M1nE" }, - { "amount": "1", "recipientId": "ASx99YydmwakbnQ4MVrmxc7iurkhvigLew" }, - { "amount": "1", "recipientId": "Ad4gQwza6uYMNdykVBaPQGJPqcmw1xdVee" }, - { "amount": "1", "recipientId": "AUantbHXLw9mScYeaZLiee3CVYXC4hkR74" }, - { "amount": "1", "recipientId": "AThLYvvyiVeCfQAh5PAX8Qno4Wd6S62tyH" }, - { "amount": "1", "recipientId": "AWqJzREQHu3fjDxH5rqT2VSbeUM7SxEhna" }, - { "amount": "1", "recipientId": "ATzPon6cYKnadQRcdvvihooXKY9Ck1Liec" }, - { "amount": "1", "recipientId": "AaZjRkpC18yLxuSuPfgJL6LHUbda56HnSs" }, - { "amount": "1", "recipientId": "AN9T4RBCdA87aSdChpAHh7uUAG4B8uBoUq" }, - { "amount": "1", "recipientId": "AX44ttMS5RVscdiS6ij7RNevJ7DHH5qNph" }, - { "amount": "1", "recipientId": "ATLTB78g3a5w17TBU55aKjLduRbAGoThpK" }, - { "amount": "1", "recipientId": "AKarCMgn7Bk9Nei1DAr6JeYSzwtnFgBSDQ" }, - { "amount": "1", "recipientId": "AKEDqDqa78RbZupNVvGkKLtYsXA8NegCRN" }, - { "amount": "1", "recipientId": "ARYDs5Ld3waYyRdnhcfori13cXHaEDEeau" }, - { "amount": "1", "recipientId": "AeBCh8GTkJcjZGk9WZNPBAdv3rU7iggLY7" }, - { "amount": "1", "recipientId": "AX6gUdyHxZVqnoZCSA4SGt43K5RtJ7ThBu" }, - { "amount": "1", "recipientId": "AGDtW75CApDYNd5u54uFcuLB35hjQ1AtAR" }, - { "amount": "1", "recipientId": "APwfcZa61hT4CNptRWjykv8J8UNG26WKZk" }, - { "amount": "1", "recipientId": "AGyANoQJRETkdiADXMrB8EkBxYCVCiVxq4" }, - { "amount": "1", "recipientId": "AQ21SC3vq3iYf4CyQhAPuX4p9LHPhRaKUY" }, - { "amount": "1", "recipientId": "AUBKVPGUzLrHz4nh2o9wms9kf44KtiQBzF" }, - { "amount": "1", "recipientId": "AKFPFgGiv26n4LcTzCJ1FhHytgk86qZ5fk" }, - { "amount": "1", "recipientId": "AVdv6aogUAf93MnWLhjze3971P4yMqcBMY" }, - { "amount": "1", "recipientId": "AWkg5GAdQ34NApvGE4kj2t3cQw5MupuemH" }, - { "amount": "1", "recipientId": "AUwDWzNS6rvtvGuX9mp313vpSsNASMxgJc" } - ] - }, - "signature": "a5ad9228b3f6717d471411ac733629d561c19a945dbe956261f707c303c9327e12a87c48e429dc9f8ee7cfa026798aacaed59a27d650bfc2095291f816955f05", - "id": "b5e1c95a33ff1c70a96a91c2f190268189778f28f5330b0afd49aebb74da30c4" + "version": 2, + "network": 23, + "type": 6, + "nonce": "2", + "senderPublicKey": "02a53371b23f991740f968e3d96de42a67b4242e267cad8050ae4b68bf9ac20af2", + "fee": "10000000", + "amount": "0", + "asset": { + "payments": [ + { "amount": "1", "recipientId": "AJkSjZPqRFksw6CDyCrAqPqpRzTJ9y2JVg" }, + { "amount": "1", "recipientId": "AdmKdL2yUHa2wEq1QajidRMD5KAQ92HY1p" }, + { "amount": "1", "recipientId": "AQUBtovaVuwDuHSrjLZRbPzhuDGMp7iUje" }, + { "amount": "1", "recipientId": "AQBCwmStjJAhc665FD81swaot6NMKDmWSe" }, + { "amount": "1", "recipientId": "AZUet7svbkQ54EhkXjtHFQuz1G8Hg3k29o" }, + { "amount": "1", "recipientId": "AZy7zpA7d61Zxy51nhrVUEK52LX9dxNhwE" }, + { "amount": "1", "recipientId": "AJi63aGakFJo4aYcH5U5s3HUzmx5B31tqA" }, + { "amount": "1", "recipientId": "ARbzRpB4uQsMwjXqohA1bURVNrURHWcbRB" }, + { "amount": "1", "recipientId": "AFqBJKjoGiMBiaUA5ZvuaoHCtsAtVaYfiQ" }, + { "amount": "1", "recipientId": "AZ9W5GCvLjYn86uS4gVvLF3dUeff7Sm7kZ" }, + { "amount": "1", "recipientId": "ALetETJv5kUDaXxGyqgfbvCAq7Xd4LkNcR" }, + { "amount": "1", "recipientId": "AHNAYaC9SoWBtyiHYs8BoY6dkrFc8e1r6t" }, + { "amount": "1", "recipientId": "APHZ1wBFg2CtYSxUEoVztzrPXpjZWB7Ed3" }, + { "amount": "1", "recipientId": "ASYHnawx4LYnS3qgEshPXg1ovAMgqPvMyd" }, + { "amount": "1", "recipientId": "AJ3rQcLRmfu8myq3Riob1P1PhwoTmx1uGM" }, + { "amount": "1", "recipientId": "AdaRMae1p4XuyniQSwEF7KJMTzTDjLEtrA" }, + { "amount": "1", "recipientId": "ARXPxwvq3NzHd2h9SiGbnxB3WEHhcf3m9r" }, + { "amount": "1", "recipientId": "ATKBDzyWYJ1EWDLypzN7pP1KiTtmMYWRAd" }, + { "amount": "1", "recipientId": "AUVnmcZ3BaBTcNcp1TANSXeQqeCJnL5ajG" }, + { "amount": "1", "recipientId": "AJyp9HagSbNGo587BX37yhm6bYvJqmhfDq" }, + { "amount": "1", "recipientId": "AKVSJqTpPEPp7hrwuMfuSAzEUbRBFMivsD" }, + { "amount": "1", "recipientId": "AXVUG59zkbnGXCsVZjHN8WvX1tjEhuaJbH" }, + { "amount": "1", "recipientId": "AM6GrCiESsELYsaSxUXtLzBrZo1SGu9RGs" }, + { "amount": "1", "recipientId": "AKqaDdoNpMU234jm8tocn8rP13paJcLhc7" }, + { "amount": "1", "recipientId": "APRgmUz1jjcDqGMN9jju9DC1ZEeUE9AywY" }, + { "amount": "1", "recipientId": "AcHeBGLwiPU2X8wzVPLon1WpkpokP4Wohq" }, + { "amount": "1", "recipientId": "AWgKzu21eySyu7iqyYjWa2EfpFA7mZvQZU" }, + { "amount": "1", "recipientId": "AcKhDtSsyr9Q863PDEV5myZFChKCPfyD18" }, + { "amount": "1", "recipientId": "Ae6T9ZUTR6RSCoGD6CnhB9yVyYX7QsrZbA" }, + { "amount": "1", "recipientId": "AUDuhQsp3eCPwYxAbJa49DouCjjXtpzjjG" }, + { "amount": "1", "recipientId": "APf4R1acVovfZiccBCPLYwrcbYZPUeGKcC" }, + { "amount": "1", "recipientId": "Ab36vcphZSgPo3TfRxRUM9mgjE3D6Rcqve" }, + { "amount": "1", "recipientId": "Aai1yVoVAJcwzza8Kh9q2X7UCYHWRRsjHP" }, + { "amount": "1", "recipientId": "ATEi5aLWNrXCtLSEBwEUFJ9a3NdU2L5Cx3" }, + { "amount": "1", "recipientId": "AdxVQZpf2EZoEzr8dCY81wcGRBKksqt9uJ" }, + { "amount": "1", "recipientId": "AGvec84izZTQ4EkDdSQHdn6eQ8WHAXbRK8" }, + { "amount": "1", "recipientId": "AL7Cmvd2LukSvzUFLB729wfgfjxkFrwxKK" }, + { "amount": "1", "recipientId": "AK8sqUy3jNc1YD9rEQaHEeMmt4KkFWbiKL" }, + { "amount": "1", "recipientId": "AcZBzGrciGZQrChYdqEpRxUT28G2uEUddY" }, + { "amount": "1", "recipientId": "AaSPkSNxtsKRspwvWtvc8gvmRME5aASaEx" }, + { "amount": "1", "recipientId": "ARAjyStxuU45PqLH6kzQMrAJEqc89qZVzV" }, + { "amount": "1", "recipientId": "AdnoS6ZA7sE384pRamg9sdqC6cxjkD7pg3" }, + { "amount": "1", "recipientId": "AXH4hXPpFkRJU3HbGUUFsDbVEGxwcQLmhA" }, + { "amount": "1", "recipientId": "AX3xKYm66DeJqXUEbVeZytT8Lf6GQf4koL" }, + { "amount": "1", "recipientId": "AW7wPm9Pw3oMwBzpq24VLEwYk9CoMmYh9h" }, + { "amount": "1", "recipientId": "AapstTvRBRUWsxhEna4QC3w91sF7fKiEyC" }, + { "amount": "1", "recipientId": "AFoSv2fJK1neaNJvRDJ2bnxRUbcT8BLpxd" }, + { "amount": "1", "recipientId": "AaEQy4PNo69MWuQxBjYPv5fbX9ffj6eGxo" }, + { "amount": "1", "recipientId": "APfMoW1D7nyYjCas77UjXYG1r4ae5Z8egK" }, + { "amount": "1", "recipientId": "AdyTCFa57K44vzUHMe3cAZzN5LughnEnk1" }, + { "amount": "1", "recipientId": "AU5UYf4ARSzPVcZmEEoxygmbMFypJQU7ns" }, + { "amount": "1", "recipientId": "ALXjSdt8Bis4avRZGmUU4Kfd9D3hH4mxta" }, + { "amount": "1", "recipientId": "ALNkATjVhskN1cqnLjLYGUKxFivMTWRbR4" }, + { "amount": "1", "recipientId": "AcBKDRDbfek1ZdmP2Hz5zNyprU3bHVNZfe" }, + { "amount": "1", "recipientId": "Ab2MNhvrBGgK7ropw43sC4mXzcdiSzW8hN" }, + { "amount": "1", "recipientId": "AVMBceVMRPeZgM83qpdpQ1ytyTPCowi1F5" }, + { "amount": "1", "recipientId": "AJJNxLu5M9oPVMkx8etDPRcNs4tFaDURsz" }, + { "amount": "1", "recipientId": "AGRapiHRcPnwo3MvASwrQLppM5MKGUAHqs" }, + { "amount": "1", "recipientId": "AehS4gnFTzfnkmJqre4a5kn2sze3H28MYY" }, + { "amount": "1", "recipientId": "APQJh9sF2wZ7cDy4R3FUiepqPnefP1ByR4" }, + { "amount": "1", "recipientId": "AHVSsxZ7x7rbHEszpBzonMVYxJdRXpQX5x" }, + { "amount": "1", "recipientId": "AJ2QEu7gpzG5WkYxA7c82ojPLWMvYhpu4d" }, + { "amount": "1", "recipientId": "AMckjhZaJxoJwNke4pf43sYXBoS8xxGW3Z" }, + { "amount": "1", "recipientId": "AMutAXid6DPedsbgD6ZdSQEk1bh7ki7j5z" }, + { "amount": "1", "recipientId": "AG1RfaaZwqB8KDpFfJj75kLF1mwSAyh7jQ" }, + { "amount": "1", "recipientId": "AZebGuQaDQKWqztxoUuFyQ7jSKEobjDEtF" }, + { "amount": "1", "recipientId": "AeijCQzpk7HYpaHXS1f15TaLuHnLiqJ3td" }, + { "amount": "1", "recipientId": "AZNu9h6RTxHtMAFfH3NqLJQ7MMEr11b4jH" }, + { "amount": "1", "recipientId": "Aek93NcQX2XoEAUut4rdbWkuC4At8FQNgP" }, + { "amount": "1", "recipientId": "AK9xvxKkYJbJra2FCdYMyk4YpCBawTDqzP" }, + { "amount": "1", "recipientId": "APUvdtL5vRU4p672gkXBmk1jB7WsfnAjcg" }, + { "amount": "1", "recipientId": "ANhh6BPh8FerPGdAoEy1ZTg6XXRrWDLvGG" }, + { "amount": "1", "recipientId": "AXnsAa9Xfsmv4yR27zq3sKpwhzFASdQqHS" }, + { "amount": "1", "recipientId": "ANLKvT56LBvj6FX5bsvHLcEcFcrZgdYUhL" }, + { "amount": "1", "recipientId": "ARsEFbgLn8c76PbfaQ6NybuUSNBLx2WTFz" }, + { "amount": "1", "recipientId": "AU6JgpZeCEMACmHuDHE4KgDuNbodPLNTQj" }, + { "amount": "1", "recipientId": "AezxGoySwd5mzapEudihsPxTRC9N3mje65" }, + { "amount": "1", "recipientId": "ASu9fJ97gfwEV1BbUJQ8v6jvjehGsx7MhB" }, + { "amount": "1", "recipientId": "AcP6Mv39rvvJh2Pm2sZJb8eVRkPLdFnk31" }, + { "amount": "1", "recipientId": "AM89Z5L92EPGcntXRgjeBjaC6bvXhuXhsf" }, + { "amount": "1", "recipientId": "AdBxDtBWULrx9oi8Vw8PASg2vsAMBkfu8N" }, + { "amount": "1", "recipientId": "AYuHPh1PYkAQmWoPxFCBFkarXuHZQzr6q8" }, + { "amount": "1", "recipientId": "AHki3X6Y9oD2aC48C7nYJxBXtQrEDavw1C" }, + { "amount": "1", "recipientId": "AYsF7goWELTH1yWNHV7NuPQLFYh8Wewsy3" }, + { "amount": "1", "recipientId": "AQ4r535GMJBq9YGWNy7ZWmmiKezLPPKKVB" }, + { "amount": "1", "recipientId": "AJWMxAj163ZKE3K8oq8oGJQpsr7QhXcFjG" }, + { "amount": "1", "recipientId": "APEniF2gdeLLKL8WYwgLcp5HjebYUxpd3m" }, + { "amount": "1", "recipientId": "AeRb1mGCAus2KuR2EaaeDCs1eJSotnnSVJ" }, + { "amount": "1", "recipientId": "ALNbbL6qhRg1NmRhBBCeWNscZgdtD9FN5J" }, + { "amount": "1", "recipientId": "AMdWG71SKHgcNtwQNHYVUqmKSMTPpBDRe6" }, + { "amount": "1", "recipientId": "ASN6yDJPqAo2j2NkY4aakTSRuTVuJtgTnY" }, + { "amount": "1", "recipientId": "AFqD175UbMhHeaEJsoGpoFSyWwbpWLD7Z3" }, + { "amount": "1", "recipientId": "ALaWGuGcq6gb11Gf8rZx2LBwDHEtAAjR39" }, + { "amount": "1", "recipientId": "AJMtGbZudwPjmeUA2JtaFBbcp4aMNGEpmw" }, + { "amount": "1", "recipientId": "AWJUMu5Re8V7HjnDruAiPsVGaVyPiFt9PS" }, + { "amount": "1", "recipientId": "ATJaqBbP9BQFnjBhztVwSJnWx5stV4STVY" }, + { "amount": "1", "recipientId": "ATVNCQsWRpSrSrNkN35JfYTnm2DDP1TgSe" }, + { "amount": "1", "recipientId": "AJ9Cs9czY165T1Pbqr2NE6cAkuZxjmc1mJ" }, + { "amount": "1", "recipientId": "AbvkpAvmnVfLTWpQNGgjRGPzg18NsaZvoj" }, + { "amount": "1", "recipientId": "ASQGzFRaYaznkwTyK5XnGaSXBtct75mSAA" }, + { "amount": "1", "recipientId": "AS8JK9R8CsF7TwzjgcoWur4doCtmcdSgJD" }, + { "amount": "1", "recipientId": "AdAkT5mbKyEHZqetXDUQGkATRLgyEsGr7g" }, + { "amount": "1", "recipientId": "AZhSj2JZx5aEHaKFr2RHCrhEwTGBtaR7RY" }, + { "amount": "1", "recipientId": "AK8LqchMVGTyiAhDaCb5jcvZ6SftuEEzmj" }, + { "amount": "1", "recipientId": "AXLQ6xPHxTdhZ7YZvCwSoZ4dQ7E3qXVtWH" }, + { "amount": "1", "recipientId": "AQGeF1NLTyP5zraBCdjTdsodJCnPWR2xxZ" }, + { "amount": "1", "recipientId": "AH4b7u5gFWh7Uu4TNVD1NfETqEByxaRJNY" }, + { "amount": "1", "recipientId": "AXYdBaj8hKaqHp7kUB1LSbkdDV9vSAbpLv" }, + { "amount": "1", "recipientId": "AbU2225mM8941Fsp1K4GcVtVeEizzGsu18" }, + { "amount": "1", "recipientId": "AGNRPoJf6GmzEyaWjNV5Du63ueVdeNnb7C" }, + { "amount": "1", "recipientId": "AW732HLfot4iGJnAcvJmBshUKZHfGy5mw1" }, + { "amount": "1", "recipientId": "AWMhtF3uJiNACNAfvmzrGKhgjSHTUFbTn1" }, + { "amount": "1", "recipientId": "AXX8NPgCYnZA2ydomv5JUaFdLm3Fy5M1nE" }, + { "amount": "1", "recipientId": "ASx99YydmwakbnQ4MVrmxc7iurkhvigLew" }, + { "amount": "1", "recipientId": "Ad4gQwza6uYMNdykVBaPQGJPqcmw1xdVee" }, + { "amount": "1", "recipientId": "AUantbHXLw9mScYeaZLiee3CVYXC4hkR74" }, + { "amount": "1", "recipientId": "AThLYvvyiVeCfQAh5PAX8Qno4Wd6S62tyH" }, + { "amount": "1", "recipientId": "AWqJzREQHu3fjDxH5rqT2VSbeUM7SxEhna" }, + { "amount": "1", "recipientId": "ATzPon6cYKnadQRcdvvihooXKY9Ck1Liec" }, + { "amount": "1", "recipientId": "AaZjRkpC18yLxuSuPfgJL6LHUbda56HnSs" }, + { "amount": "1", "recipientId": "AN9T4RBCdA87aSdChpAHh7uUAG4B8uBoUq" }, + { "amount": "1", "recipientId": "AX44ttMS5RVscdiS6ij7RNevJ7DHH5qNph" }, + { "amount": "1", "recipientId": "ATLTB78g3a5w17TBU55aKjLduRbAGoThpK" }, + { "amount": "1", "recipientId": "AKarCMgn7Bk9Nei1DAr6JeYSzwtnFgBSDQ" }, + { "amount": "1", "recipientId": "AKEDqDqa78RbZupNVvGkKLtYsXA8NegCRN" }, + { "amount": "1", "recipientId": "ARYDs5Ld3waYyRdnhcfori13cXHaEDEeau" }, + { "amount": "1", "recipientId": "AeBCh8GTkJcjZGk9WZNPBAdv3rU7iggLY7" }, + { "amount": "1", "recipientId": "AX6gUdyHxZVqnoZCSA4SGt43K5RtJ7ThBu" }, + { "amount": "1", "recipientId": "AGDtW75CApDYNd5u54uFcuLB35hjQ1AtAR" }, + { "amount": "1", "recipientId": "APwfcZa61hT4CNptRWjykv8J8UNG26WKZk" }, + { "amount": "1", "recipientId": "AGyANoQJRETkdiADXMrB8EkBxYCVCiVxq4" }, + { "amount": "1", "recipientId": "AQ21SC3vq3iYf4CyQhAPuX4p9LHPhRaKUY" }, + { "amount": "1", "recipientId": "AUBKVPGUzLrHz4nh2o9wms9kf44KtiQBzF" }, + { "amount": "1", "recipientId": "AKFPFgGiv26n4LcTzCJ1FhHytgk86qZ5fk" }, + { "amount": "1", "recipientId": "AVdv6aogUAf93MnWLhjze3971P4yMqcBMY" }, + { "amount": "1", "recipientId": "AWkg5GAdQ34NApvGE4kj2t3cQw5MupuemH" }, + { "amount": "1", "recipientId": "AUwDWzNS6rvtvGuX9mp313vpSsNASMxgJc" } + ] + }, + "signature": "a5ad9228b3f6717d471411ac733629d561c19a945dbe956261f707c303c9327e12a87c48e429dc9f8ee7cfa026798aacaed59a27d650bfc2095291f816955f05", + "id": "b5e1c95a33ff1c70a96a91c2f190268189778f28f5330b0afd49aebb74da30c4" } ``` @@ -188,7 +188,7 @@ ff0217010000000600020000000000000002a53371b23f991740f968e3d96de42a67b4242e267cad ## Example Ledger Payload ```shell -python examples/example_helper.py --tx ff0217010000000600020000000000000002a53371b23f991740f968e3d96de42a67b4242e267cad8050ae4b68bf9ac20af28096980000000000008900000001000000000000001720a32a4fd007065355e791cffd598bb0c6fa52bc010000000000000017f13809c4c5fb2b3967a9b40efc70843f7db462ad0100000000000000175f60e0594115b71d5b136cf929c8504082ac199d0100000000000000175c2aaead4ce542788406c54e1ae31f1afdb7f081010000000000000017c2308975254751ead4df705fc76aa84116c5e34e010000000000000017c792d1958bb950596d0e7cd0bef32506200968480100000000000000172031100e628422b8409810fdb438e874765846ba0100000000000000176bd2c24bded5fdfd7888a28b3c6990503699b5e8010000000000000017009ffbb10efc47ad00a0a29cc2ef6e6c83d8c6ec010000000000000017be9147febbfe462cdbfda8575c18dabe85db4f5b010000000000000017358634b58d88abf4aef3a6fe264b4ad18b74e98b01000000000000001711745fc47a9c58c4e6f5a74eb59411ac102c6a880100000000000000175265ceb5d6102474ea7d0f401d6e6b9f13864a050100000000000000177617b5f3b82f153e388b4b200abd8636fff73dd501000000000000001718f5df4fe3108277bfa4e39071fead9d59b35b8f010000000000000017ef283e95c3fdf0e2df9ba8321407c5621f9868760100000000000000176af453a17439c9c258c25c707aa9fc1f3b59d9b40100000000000000177e94f3954665ebd80ced3d434c67cd4351966f2b0100000000000000178b8ee88e27291e33ce5403ea9b159235887dcfa9010000000000000017232a71b6b2586d5b02b6a72db08759066ba2a92b01000000000000001728c4b220f14f3745f3fff6d3c066ba2353393eb6010000000000000017ac67d5bfbef4a7ed8149727b93a01e903d84ee0c0100000000000000173a537bef2ed296a54adc354967efe3a5e52cdfb80100000000000000172c939e4633bd96ccc1d1509dbe794299603aad9901000000000000001753ef9af027797e4827d708d9ed47c511f4ea5524010000000000000017e103c02fc06140aeac275f8e579f3397d041f817010000000000000017a37d6366d765f5e446fc18ddcc3da3fa300cf6bb010000000000000017e1671fea563be042824751a3465a7dbbc4827942010000000000000017f4d63847bf07a9faad83bd69fed408b3b734dce8010000000000000017888e092eba4cbd5eab9e10646661f5a440915f9d0100000000000000175677152f9d640b175894c8da0b9f30bad3801aff010000000000000017d34bb692e52d515398d00fd57ce2c8bfd3480554010000000000000017cfafad73ebddc38d53317c80cdbf6d343c331d620100000000000000177dbca0c01f96de655cf41eb53e1b8d5e2ffa2607010000000000000017f354c71350a110a7b45b5095ed0a4601bf4bbf9d0100000000000000170ca0fbbfb8e3f615ec4eedaef6281d4d60a8f2b20100000000000000172f885faaf6a3fcc38b1f35c652bf72f0fd7ac60301000000000000001724e14548f3874b9413a28f258c2b73d35ec2b2f9010000000000000017e3f48b5211d1f21034bc15908259901ecf972be8010000000000000017ccbb32ea36fad927cb2c46cbc63930db6cda829d010000000000000017670c4b3896983f37a0d113eb6afc329c39232aa4010000000000000017f17faa6a2a251d2ac73033ea1868387542b798fa010000000000000017aa0f2cf081d9609a44dde12e0c805ebb0880c857010000000000000017a794717598f2f4379bc787be2d5730e19cef6bc50100000000000000179d5d3507b35431cd3ec3ab6dad8663a64c41772e010000000000000017d0fbd6baf73fa195989ea418aa04c90c873f8ec5010000000000000017004c2fbebda958eb1173f9f8eab22a171e0cafba010000000000000017ca7739477089657a1dd6061411cfeafec50f6d28010000000000000017568598ea898f21b665b681425f91666b910da328010000000000000017f38358caf39c93d2d1b4db950606dc703378554c01000000000000001786f5b6951d2c9578a790612f6f3c59b387105180010000000000000017342bf4e8884754b6867903ef9c5e27c03ac036e50100000000000000173278d0a270000126e0dd97e6c0641755b145babe010000000000000017dfd16cf066ffced2c1cfbb10e3ca2a9fb584578a010000000000000017d3275bfaeba7b49d2ef55673bbb3c1fb08b08d9f01000000000000001794e65c65d7abcf07f67b67a23793682f43efeb420100000000000000171bb531fb6335c6a8926a3c00eeba5fe0511856dd0100000000000000170721c33e5b98f0227b2cb8fc64b83dd510317b0b010000000000000017fb73dfa44b21e88e72c234b8c80ed9c634aae35901000000000000001753acc3249244171686f3e7162204b941ebc7261801000000000000001712d4ebc3c271406ce007e3c6f3347b14e447c13601000000000000001718af9ce5f8c983184c9650b021a645bcfebf3cfb01000000000000001740173e1b8672e92982e53c98b53c680748c725b5010000000000000017435483bed11c1b57f692d1c46389b2c5cb3157f2010000000000000017029022a47dc76855101fff5eb0243e3083af78e7010000000000000017c411af7a4a5062066dd5872ddc5373bfea2b8861010000000000000017fbb29777b4d2a728cddab9bd67c957a7b1558994010000000000000017c119f3b087e7fc3038cafea35b127ce40a797a1a010000000000000017fbf6e96524f5e752a5e4c888b21d41de9d3c52620100000000000000172515f06be5786f8be1381c55be104d90ad627112010000000000000017548c6e2d4016a41e378fda3c8873886543fa70ab0100000000000000174bfe676769da8da1f93192e079c482ecc5bc174f010000000000000017afb206cdfb25578ce365d27304470c49e4125fed01000000000000001747f3ffafa5426a110cd350443e9fe9d0f174e3b40100000000000000176eb489b953096524e44f36c85c73144bd532d402010000000000000017871de62afc7f1d49e1ee7c42b0404ba142fc7ea6010000000000000017fec42984da0e01d4a7bac024a5e475c063ac9c460100000000000000177a09a9b82ed74e61fbbcfbe7aec3cbba7cafa12e010000000000000017e20bb0016cd9f294dad34a8bb561fd11e637244a0100000000000000173aae39ea7d1f75a6e9e2227f609c4d14970c852d010000000000000017eae871ae15c3257628161ab7e32ffbb2482c78a9010000000000000017bbe0df02533620dfc8a6a5033a7345e0a34be0cb01000000000000001715b7d1c17acc078e851a177a1d367a9d3dd68d23010000000000000017bb7e23ad26914f168656213867fae480dda65c470100000000000000175af6c2e27b91e61f8e2aeeb97b1eccf227a3bebd0100000000000000171df95978e737f2fb09b8c84e14965ea93340d18601000000000000001751dffdd691c32b7eb725cadb1d079f307f95f664010000000000000017f874b060408bf32f69abd7075ef1996d73f60be00100000000000000173271a8fa8423a3deed5f428c246c570b55698437010000000000000017403b9325626c8cdef7d72607b81293c2d470a97b010000000000000017742a8590b18189f9a48ea5d6130ca261c0a4c22401000000000000001700a167a5d6b0f9ce2412c1b5df562b6d864a711001000000000000001734b2366cee1ec416e66388d3af5fd9b139a5603b0100000000000000171c5ee9ef8a8fe1f9f9b342e1eb7a386f6b8994f50100000000000000179f5b37aa9925ad7e998c3bd4b5ddbe31e9f58e8d0100000000000000177e783dc832674a0ee644cdfb29e9232f68ee505d01000000000000001780824545d87e1eb691b2171e4bb493607724e55001000000000000001719f9077cac3d96ecdca2f51f4c98407aac43868d010000000000000017dd108e250a81bda83e4613b71455753786ee746e0100000000000000177493b7565f8636184e83c6932fc92a5d5a296bd7010000000000000017718e2ae0facdbf29671853177560c5005a9f0e79010000000000000017eaae33738759c292d482eab208a0a0bf435c85af010000000000000017c49bcbe3455ba122f872e690c74fc0ec9210414f01000000000000001724c7652304c41c93aead26419604de7f5b8de442010000000000000017aab09efda1232d347381be809e1c8dfc3c0744fc0100000000000000175d31e11438d5ef1140d6296f05f7a03b6c6630100100000000000000170e21668e2123e42e03272fa24e46137242a6ff65010000000000000017ad0087f23f59dd30f586de1442cbb8b986d50fd4010000000000000017d80204238e3e94f99bfe2e44a20671ace2deb55c0100000000000000170688a4b5d8b90c9ce1703d5bfe660ddb6f1d9dc00100000000000000179d317d97a1c29ce4d134c4101673d68d8ec8b56a0100000000000000179ff7c1007941f86c2ba2a33dc420dd30dbad52d7010000000000000017acb8100b3d329598a4f0881df2ca7921a9da659d0100000000000000177a9a7b964ee2e823fcb237b352a4b3769c69e9d7010000000000000017e98855e1023a60dbe3fec3e139e496fad176ac160100000000000000178c8116b26ea08128470bd157e94214a9ef8b234801000000000000001782c5e34f55def2baa9c795064759ebeca7d71eb3010000000000000017a5304a50845a14eb3d056738c8de3c30ee49dd1901000000000000001785ffad6012d89b11b510fe32dbf85ca448249050010000000000000017ce1e89721c1df2d1b4165a622bf1288fa764a6e301000000000000001745e561944786f513c5ad3d31c3c3c88e3aa4dcc8010000000000000017a799ee7a9fc25df86361192ffbee64a8d52386ad0100000000000000177ed2ae936601fc2f079279afe249f510df5efc9101000000000000001729cab77105a600d1843c56b34c877d1b1bddd8bd01000000000000001725e40ab73be8507a874986d35bd3737463ea113f0100000000000000176b1c4f8024768772d2383d87af7d8990f732413c010000000000000017f5bc3b8ab8a28f0700df6f3602f231dc434bdcbc010000000000000017a818773d8d77e6fc74970dd488c033965669d39b01000000000000001704eb876ab3b7e2f136889dadeddc0219b47dac8a010000000000000017599b1ef53e7c4fbe6c682afda54ebdc87049391f0100000000000000170d1aaa9441c60a0e51212a5b84892aa9759cf6d20100000000000000175a6d54a6ee7e6225a4325a5e05d59b452e279d9b0100000000000000178810a6294399c640e23d42c372494e9159b1ace0010000000000000017261c52971d5e1024a7c0ececf5197f01005fe9bc01000000000000001798107a6ceb0fcf15a7b05208c29564f34eeafc98010000000000000017a44fcf637c830148b941e977ac155d2bc2f016e7010000000000000017905df747e8999695f92c58cbaac4324b11345e73 +python3 examples/example_helper.py --tx ff0217010000000600020000000000000002a53371b23f991740f968e3d96de42a67b4242e267cad8050ae4b68bf9ac20af28096980000000000008900000001000000000000001720a32a4fd007065355e791cffd598bb0c6fa52bc010000000000000017f13809c4c5fb2b3967a9b40efc70843f7db462ad0100000000000000175f60e0594115b71d5b136cf929c8504082ac199d0100000000000000175c2aaead4ce542788406c54e1ae31f1afdb7f081010000000000000017c2308975254751ead4df705fc76aa84116c5e34e010000000000000017c792d1958bb950596d0e7cd0bef32506200968480100000000000000172031100e628422b8409810fdb438e874765846ba0100000000000000176bd2c24bded5fdfd7888a28b3c6990503699b5e8010000000000000017009ffbb10efc47ad00a0a29cc2ef6e6c83d8c6ec010000000000000017be9147febbfe462cdbfda8575c18dabe85db4f5b010000000000000017358634b58d88abf4aef3a6fe264b4ad18b74e98b01000000000000001711745fc47a9c58c4e6f5a74eb59411ac102c6a880100000000000000175265ceb5d6102474ea7d0f401d6e6b9f13864a050100000000000000177617b5f3b82f153e388b4b200abd8636fff73dd501000000000000001718f5df4fe3108277bfa4e39071fead9d59b35b8f010000000000000017ef283e95c3fdf0e2df9ba8321407c5621f9868760100000000000000176af453a17439c9c258c25c707aa9fc1f3b59d9b40100000000000000177e94f3954665ebd80ced3d434c67cd4351966f2b0100000000000000178b8ee88e27291e33ce5403ea9b159235887dcfa9010000000000000017232a71b6b2586d5b02b6a72db08759066ba2a92b01000000000000001728c4b220f14f3745f3fff6d3c066ba2353393eb6010000000000000017ac67d5bfbef4a7ed8149727b93a01e903d84ee0c0100000000000000173a537bef2ed296a54adc354967efe3a5e52cdfb80100000000000000172c939e4633bd96ccc1d1509dbe794299603aad9901000000000000001753ef9af027797e4827d708d9ed47c511f4ea5524010000000000000017e103c02fc06140aeac275f8e579f3397d041f817010000000000000017a37d6366d765f5e446fc18ddcc3da3fa300cf6bb010000000000000017e1671fea563be042824751a3465a7dbbc4827942010000000000000017f4d63847bf07a9faad83bd69fed408b3b734dce8010000000000000017888e092eba4cbd5eab9e10646661f5a440915f9d0100000000000000175677152f9d640b175894c8da0b9f30bad3801aff010000000000000017d34bb692e52d515398d00fd57ce2c8bfd3480554010000000000000017cfafad73ebddc38d53317c80cdbf6d343c331d620100000000000000177dbca0c01f96de655cf41eb53e1b8d5e2ffa2607010000000000000017f354c71350a110a7b45b5095ed0a4601bf4bbf9d0100000000000000170ca0fbbfb8e3f615ec4eedaef6281d4d60a8f2b20100000000000000172f885faaf6a3fcc38b1f35c652bf72f0fd7ac60301000000000000001724e14548f3874b9413a28f258c2b73d35ec2b2f9010000000000000017e3f48b5211d1f21034bc15908259901ecf972be8010000000000000017ccbb32ea36fad927cb2c46cbc63930db6cda829d010000000000000017670c4b3896983f37a0d113eb6afc329c39232aa4010000000000000017f17faa6a2a251d2ac73033ea1868387542b798fa010000000000000017aa0f2cf081d9609a44dde12e0c805ebb0880c857010000000000000017a794717598f2f4379bc787be2d5730e19cef6bc50100000000000000179d5d3507b35431cd3ec3ab6dad8663a64c41772e010000000000000017d0fbd6baf73fa195989ea418aa04c90c873f8ec5010000000000000017004c2fbebda958eb1173f9f8eab22a171e0cafba010000000000000017ca7739477089657a1dd6061411cfeafec50f6d28010000000000000017568598ea898f21b665b681425f91666b910da328010000000000000017f38358caf39c93d2d1b4db950606dc703378554c01000000000000001786f5b6951d2c9578a790612f6f3c59b387105180010000000000000017342bf4e8884754b6867903ef9c5e27c03ac036e50100000000000000173278d0a270000126e0dd97e6c0641755b145babe010000000000000017dfd16cf066ffced2c1cfbb10e3ca2a9fb584578a010000000000000017d3275bfaeba7b49d2ef55673bbb3c1fb08b08d9f01000000000000001794e65c65d7abcf07f67b67a23793682f43efeb420100000000000000171bb531fb6335c6a8926a3c00eeba5fe0511856dd0100000000000000170721c33e5b98f0227b2cb8fc64b83dd510317b0b010000000000000017fb73dfa44b21e88e72c234b8c80ed9c634aae35901000000000000001753acc3249244171686f3e7162204b941ebc7261801000000000000001712d4ebc3c271406ce007e3c6f3347b14e447c13601000000000000001718af9ce5f8c983184c9650b021a645bcfebf3cfb01000000000000001740173e1b8672e92982e53c98b53c680748c725b5010000000000000017435483bed11c1b57f692d1c46389b2c5cb3157f2010000000000000017029022a47dc76855101fff5eb0243e3083af78e7010000000000000017c411af7a4a5062066dd5872ddc5373bfea2b8861010000000000000017fbb29777b4d2a728cddab9bd67c957a7b1558994010000000000000017c119f3b087e7fc3038cafea35b127ce40a797a1a010000000000000017fbf6e96524f5e752a5e4c888b21d41de9d3c52620100000000000000172515f06be5786f8be1381c55be104d90ad627112010000000000000017548c6e2d4016a41e378fda3c8873886543fa70ab0100000000000000174bfe676769da8da1f93192e079c482ecc5bc174f010000000000000017afb206cdfb25578ce365d27304470c49e4125fed01000000000000001747f3ffafa5426a110cd350443e9fe9d0f174e3b40100000000000000176eb489b953096524e44f36c85c73144bd532d402010000000000000017871de62afc7f1d49e1ee7c42b0404ba142fc7ea6010000000000000017fec42984da0e01d4a7bac024a5e475c063ac9c460100000000000000177a09a9b82ed74e61fbbcfbe7aec3cbba7cafa12e010000000000000017e20bb0016cd9f294dad34a8bb561fd11e637244a0100000000000000173aae39ea7d1f75a6e9e2227f609c4d14970c852d010000000000000017eae871ae15c3257628161ab7e32ffbb2482c78a9010000000000000017bbe0df02533620dfc8a6a5033a7345e0a34be0cb01000000000000001715b7d1c17acc078e851a177a1d367a9d3dd68d23010000000000000017bb7e23ad26914f168656213867fae480dda65c470100000000000000175af6c2e27b91e61f8e2aeeb97b1eccf227a3bebd0100000000000000171df95978e737f2fb09b8c84e14965ea93340d18601000000000000001751dffdd691c32b7eb725cadb1d079f307f95f664010000000000000017f874b060408bf32f69abd7075ef1996d73f60be00100000000000000173271a8fa8423a3deed5f428c246c570b55698437010000000000000017403b9325626c8cdef7d72607b81293c2d470a97b010000000000000017742a8590b18189f9a48ea5d6130ca261c0a4c22401000000000000001700a167a5d6b0f9ce2412c1b5df562b6d864a711001000000000000001734b2366cee1ec416e66388d3af5fd9b139a5603b0100000000000000171c5ee9ef8a8fe1f9f9b342e1eb7a386f6b8994f50100000000000000179f5b37aa9925ad7e998c3bd4b5ddbe31e9f58e8d0100000000000000177e783dc832674a0ee644cdfb29e9232f68ee505d01000000000000001780824545d87e1eb691b2171e4bb493607724e55001000000000000001719f9077cac3d96ecdca2f51f4c98407aac43868d010000000000000017dd108e250a81bda83e4613b71455753786ee746e0100000000000000177493b7565f8636184e83c6932fc92a5d5a296bd7010000000000000017718e2ae0facdbf29671853177560c5005a9f0e79010000000000000017eaae33738759c292d482eab208a0a0bf435c85af010000000000000017c49bcbe3455ba122f872e690c74fc0ec9210414f01000000000000001724c7652304c41c93aead26419604de7f5b8de442010000000000000017aab09efda1232d347381be809e1c8dfc3c0744fc0100000000000000175d31e11438d5ef1140d6296f05f7a03b6c6630100100000000000000170e21668e2123e42e03272fa24e46137242a6ff65010000000000000017ad0087f23f59dd30f586de1442cbb8b986d50fd4010000000000000017d80204238e3e94f99bfe2e44a20671ace2deb55c0100000000000000170688a4b5d8b90c9ce1703d5bfe660ddb6f1d9dc00100000000000000179d317d97a1c29ce4d134c4101673d68d8ec8b56a0100000000000000179ff7c1007941f86c2ba2a33dc420dd30dbad52d7010000000000000017acb8100b3d329598a4f0881df2ca7921a9da659d0100000000000000177a9a7b964ee2e823fcb237b352a4b3769c69e9d7010000000000000017e98855e1023a60dbe3fec3e139e496fad176ac160100000000000000178c8116b26ea08128470bd157e94214a9ef8b234801000000000000001782c5e34f55def2baa9c795064759ebeca7d71eb3010000000000000017a5304a50845a14eb3d056738c8de3c30ee49dd1901000000000000001785ffad6012d89b11b510fe32dbf85ca448249050010000000000000017ce1e89721c1df2d1b4165a622bf1288fa764a6e301000000000000001745e561944786f513c5ad3d31c3c3c88e3aa4dcc8010000000000000017a799ee7a9fc25df86361192ffbee64a8d52386ad0100000000000000177ed2ae936601fc2f079279afe249f510df5efc9101000000000000001729cab77105a600d1843c56b34c877d1b1bddd8bd01000000000000001725e40ab73be8507a874986d35bd3737463ea113f0100000000000000176b1c4f8024768772d2383d87af7d8990f732413c010000000000000017f5bc3b8ab8a28f0700df6f3602f231dc434bdcbc010000000000000017a818773d8d77e6fc74970dd488c033965669d39b01000000000000001704eb876ab3b7e2f136889dadeddc0219b47dac8a010000000000000017599b1ef53e7c4fbe6c682afda54ebdc87049391f0100000000000000170d1aaa9441c60a0e51212a5b84892aa9759cf6d20100000000000000175a6d54a6ee7e6225a4325a5e05d59b452e279d9b0100000000000000178810a6294399c640e23d42c372494e9159b1ace0010000000000000017261c52971d5e1024a7c0ececf5197f01005fe9bc01000000000000001798107a6ceb0fcf15a7b05208c29564f34eeafc98010000000000000017a44fcf637c830148b941e977ac155d2bc2f016e7010000000000000017905df747e8999695f92c58cbaac4324b11345e73 ``` -> _note that signature bytes are removed (i.e. there's no need to sign a signed-transaction)._ -> _also note this is currently waaaaaay too big for Ledger._ + +> _note that this is currently waaaaaay too big for Ledger._ diff --git a/docs/fixtures/type_7.md b/docs/fixtures/type_7.md index 35d1114e..b0e4b0a2 100644 --- a/docs/fixtures/type_7.md +++ b/docs/fixtures/type_7.md @@ -3,17 +3,17 @@ ## Signed Json Payload -```javascript +```json { - "version": 2, - "network": 23, - "type": 7, - "nonce": "2", - "senderPublicKey": "037a12518205254e6ebf25290d9786fd9821c43bb7319c9fc2499c8d472809dfaf", - "fee": "2500000000", - "amount": "0", - "signature": "ad7a61a76433260ef9dc687311ab6c657f6c733dbf1a80c3514da823d43226235a70a94fa1a0b8cb2f4b3d0be5011945bfbe8c8fc5b5ca0e07f6c2a37e3cf11b", - "id": "ee2a5253e28f66d5546b28bba96b4fa88973305e2e0d3b82afd5b3386ab0b6d4" + "version": 2, + "network": 23, + "type": 7, + "nonce": "2", + "senderPublicKey": "037a12518205254e6ebf25290d9786fd9821c43bb7319c9fc2499c8d472809dfaf", + "fee": "2500000000", + "amount": "0", + "signature": "ad7a61a76433260ef9dc687311ab6c657f6c733dbf1a80c3514da823d43226235a70a94fa1a0b8cb2f4b3d0be5011945bfbe8c8fc5b5ca0e07f6c2a37e3cf11b", + "id": "ee2a5253e28f66d5546b28bba96b4fa88973305e2e0d3b82afd5b3386ab0b6d4" } ``` @@ -42,6 +42,5 @@ ff02170100000007000200000000000000037a12518205254e6ebf25290d9786fd9821c43bb7319c ## Example Ledger Payload ```shell -python examples/example_helper.py --tx ff02170100000007000200000000000000037a12518205254e6ebf25290d9786fd9821c43bb7319c9fc2499c8d472809dfaf00f902950000000000 +python3 examples/example_helper.py --tx ff02170100000007000200000000000000037a12518205254e6ebf25290d9786fd9821c43bb7319c9fc2499c8d472809dfaf00f902950000000000 ``` -> _note that signature bytes are removed (i.e. there's no need to sign a signed-transaction)._ diff --git a/docs/fixtures/type_8.md b/docs/fixtures/type_8.md index ddc1c2cc..e8e53fc8 100644 --- a/docs/fixtures/type_8.md +++ b/docs/fixtures/type_8.md @@ -3,27 +3,27 @@ ## Signed Json Payload -```javascript +```json { - "version": 2, - "network": 23, - "type": 8, - "nonce": "2", - "senderPublicKey": "020d272fab67c179a9e4df4d006344d3ca47fb531b4246b483373940f0603a9216", - "fee": "10000000", - "amount": "1", - "recipientId": "ATNGUiu6sYRb7MXtdcVc7KjoyM6TdfuoC1", - "asset": { - "lock": { - "secretHash": "09b9a28393efd02fcd76a21b0f0f55ba2aad8f3640ff8cae86de033a9cfbd78c", - "expiration": { - "type": 1, - "value": 78740307 - } - } - }, - "signature": "11b1c06b4e5ba7c196f6f36fca2540275173a472e61581e949cd24a7cf5ee98af6a74f3c919f9b82a2e65b51b737bdf22f7a08ffcf52b88dc4a16d6ac5c10bfe", - "id": "f84efeab77224af8959301a7185597a7cfbfbc9a4d99cb021af62f3714feb9d3" + "version": 2, + "network": 23, + "type": 8, + "nonce": "2", + "senderPublicKey": "020d272fab67c179a9e4df4d006344d3ca47fb531b4246b483373940f0603a9216", + "fee": "10000000", + "amount": "1", + "recipientId": "ATNGUiu6sYRb7MXtdcVc7KjoyM6TdfuoC1", + "asset": { + "lock": { + "secretHash": "09b9a28393efd02fcd76a21b0f0f55ba2aad8f3640ff8cae86de033a9cfbd78c", + "expiration": { + "type": 1, + "value": 78740307 + } + } + }, + "signature": "11b1c06b4e5ba7c196f6f36fca2540275173a472e61581e949cd24a7cf5ee98af6a74f3c919f9b82a2e65b51b737bdf22f7a08ffcf52b88dc4a16d6ac5c10bfe", + "id": "f84efeab77224af8959301a7185597a7cfbfbc9a4d99cb021af62f3714feb9d3" } ``` @@ -56,6 +56,5 @@ ff02170100000008000200000000000000020d272fab67c179a9e4df4d006344d3ca47fb531b4246 ## Example Ledger Payload ```shell -python examples/example_helper.py --tx ff02170100000008000200000000000000020d272fab67c179a9e4df4d006344d3ca47fb531b4246b483373940f0603a9216809698000000000000010000000000000009b9a28393efd02fcd76a21b0f0f55ba2aad8f3640ff8cae86de033a9cfbd78c01537bb104177f2a95c7076ea278776d8fcecc5b18e588976da6 +python3 examples/example_helper.py --tx ff02170100000008000200000000000000020d272fab67c179a9e4df4d006344d3ca47fb531b4246b483373940f0603a9216809698000000000000010000000000000009b9a28393efd02fcd76a21b0f0f55ba2aad8f3640ff8cae86de033a9cfbd78c01537bb104177f2a95c7076ea278776d8fcecc5b18e588976da6 ``` -> _note that signature bytes are removed (i.e. there's no need to sign a signed-transaction)._ diff --git a/docs/fixtures/type_8_vendorfield.json b/docs/fixtures/type_8_vendorfield.json index df61d535..6593944f 100644 --- a/docs/fixtures/type_8_vendorfield.json +++ b/docs/fixtures/type_8_vendorfield.json @@ -1,23 +1,23 @@ { - "version": 1, + "version": 2, "network": 23, "type": 8, - "timestamp": 88466052, + "nonce": "0", "senderPublicKey": "034151a3ec46b5670a682b0a63394f863587d1bc97483b1b6c70eb58e7f0aed192", "fee": "10000000", "amount": "1", "vendorField": "Hello World", - "recipientId": "AQMzVKjfvAWUhKEprgnXXE5ZVbFfyZhky2", + "recipientId": "AZRJYXhknRmKMuwgqbYxr8FsfHQKn8Fk9K", "asset": { "lock": { "secretHash": "09b9a28393efd02fcd76a21b0f0f55ba2aad8f3640ff8cae86de033a9cfbd78c", "expiration": { "type": 1, - "value": 88466468 + "value": 88506746 } } }, - "signature": "3045022100f617fcc3887ea48fd2ee9b2efdfaae1959d815fa969a459fea4aa2ec464b869402206d13965427e93d49eff21e97de5ae2c600a9eed4825887716c663ccc3d28a1a9", - "id": "6bf1cda7ad17c29839b89f27d05f26560c9bd14c9416493861cf175e441c196d", - "serialized": "ff01170884e24505034151a3ec46b5670a682b0a63394f863587d1bc97483b1b6c70eb58e7f0aed19280969800000000000b48656c6c6f20576f726c64010000000000000009b9a28393efd02fcd76a21b0f0f55ba2aad8f3640ff8cae86de033a9cfbd78c0124e44505175e34dc384ea250461546302ce9deb717c19555033045022100f617fcc3887ea48fd2ee9b2efdfaae1959d815fa969a459fea4aa2ec464b869402206d13965427e93d49eff21e97de5ae2c600a9eed4825887716c663ccc3d28a1a9" + "signature": "3045022100a1cd1c89cb8e1accb0fb394dc5e14ee49385fb990c4b6ea60af37f0523213b950220037c0f8538c04d0041c3f8a3737a8e0fa7c59cde9d6ead9fad6101f0d5a85ea8", + "id": "f981d2590e59d4ae8d563aa906899ebce0a56e93fde665fd7760152108bf7209", + "serialized": "ff02170100000008000000000000000000034151a3ec46b5670a682b0a63394f863587d1bc97483b1b6c70eb58e7f0aed19280969800000000000b48656c6c6f20576f726c64010000000000000009b9a28393efd02fcd76a21b0f0f55ba2aad8f3640ff8cae86de033a9cfbd78c017a81460517c18e4fdcd78bf9a9eac22e91d52edfeb04bc8e9e3045022100a1cd1c89cb8e1accb0fb394dc5e14ee49385fb990c4b6ea60af37f0523213b950220037c0f8538c04d0041c3f8a3737a8e0fa7c59cde9d6ead9fad6101f0d5a85ea8" } diff --git a/docs/fixtures/type_8_vendorfield.md b/docs/fixtures/type_8_vendorfield.md new file mode 100644 index 00000000..271c6138 --- /dev/null +++ b/docs/fixtures/type_8_vendorfield.md @@ -0,0 +1,63 @@ + +# Type 8: HTLC Lock + +## Signed Json Payload + +```json +{ + "version": 2, + "network": 23, + "type": 8, + "nonce": "0", + "senderPublicKey": "034151a3ec46b5670a682b0a63394f863587d1bc97483b1b6c70eb58e7f0aed192", + "fee": "10000000", + "amount": "1", + "vendorField": "Hello World", + "recipientId": "AZRJYXhknRmKMuwgqbYxr8FsfHQKn8Fk9K", + "asset": { + "lock": { + "secretHash": "09b9a28393efd02fcd76a21b0f0f55ba2aad8f3640ff8cae86de033a9cfbd78c", + "expiration": { + "type": 1, + "value": 88506746 + } + } + }, + "signature": "3045022100a1cd1c89cb8e1accb0fb394dc5e14ee49385fb990c4b6ea60af37f0523213b950220037c0f8538c04d0041c3f8a3737a8e0fa7c59cde9d6ead9fad6101f0d5a85ea8", + "id": "f981d2590e59d4ae8d563aa906899ebce0a56e93fde665fd7760152108bf7209", + "serialized": "ff02170100000008000000000000000000034151a3ec46b5670a682b0a63394f863587d1bc97483b1b6c70eb58e7f0aed19280969800000000000b48656c6c6f20576f726c64010000000000000009b9a28393efd02fcd76a21b0f0f55ba2aad8f3640ff8cae86de033a9cfbd78c017a81460517c18e4fdcd78bf9a9eac22e91d52edfeb04bc8e9e3045022100a1cd1c89cb8e1accb0fb394dc5e14ee49385fb990c4b6ea60af37f0523213b950220037c0f8538c04d0041c3f8a3737a8e0fa7c59cde9d6ead9fad6101f0d5a85ea8" +} +``` + +## Serialized Payload + +```shell +ff02170100000008000000000000000000034151a3ec46b5670a682b0a63394f863587d1bc97483b1b6c70eb58e7f0aed19280969800000000000b48656c6c6f20576f726c64010000000000000009b9a28393efd02fcd76a21b0f0f55ba2aad8f3640ff8cae86de033a9cfbd78c017a81460517c18e4fdcd78bf9a9eac22e91d52edfeb04bc8e9e3045022100a1cd1c89cb8e1accb0fb394dc5e14ee49385fb990c4b6ea60af37f0523213b950220037c0f8538c04d0041c3f8a3737a8e0fa7c59cde9d6ead9fad6101f0d5a85ea8 +``` + +## Deserializing the Hex + +| Key | Pos. | Size
_(bytes)_ | Value
_(hex)_ | +| :-- | :--: | :---------------: | :---------------- | +| **Header:** | **[0]** | **1** | `0xff` | +| **Version:** | **[1]** | **1** | `0x02` | +| **Network:** | **[2]** | **1** | `0x17` | +| **Typegroup:** | **[3]** | **4** | `0x01000000` | +| **Type:** | **[7]** | **2** | `0x0800` | +| **Nonce:** | **[9]** | **8** | `0x0000000000000000` | +| **SenderPublicKey:** | **[17]** | **33** | `0x034151a3ec46b5670a682b0a63394f863587d1bc97483b1b6c70eb58e7f0aed192` | +| **Fee:** | **[50]** | **8** | `0x8096980000000000` | +| **VendorField Length:** | **[58]** | **1** | `0x0b` | +| **VendorField** | **[59]** | **1** | `0x48656c6c6f20576f726c64` | +| **Amount:** | **[70]** | **8** | `0x0100000000000000` | +| **Secret Hash:** | **[78]** | **32** | `0x09b9a28393efd02fcd76a21b0f0f55ba2aad8f3640ff8cae86de033a9cfbd78c` | +| **Expiration Type:** | **[110]** | **1** | `0x01` | +| **Expiration Value:** | **[111]** | **4** | `0x7a814605` | +| **Recipient:** | **[115]** | **21** | `0x177f2a95c7076ea278776d8fcecc5b18e588976da6` | +| **Signature:** | **[136]** | **71** | `0x3045022100a1cd1c89cb8e1accb0fb394dc5e14ee49385fb990c4b6ea60af37f0523213b950220037c0f8538c04d0041c3f8a3737a8e0fa7c59cde9d6ead9fad6101f0d5a85ea8` | + +## Example Ledger Payload + +```shell +python3 examples/example_helper.py --tx ff02170100000008000000000000000000034151a3ec46b5670a682b0a63394f863587d1bc97483b1b6c70eb58e7f0aed19280969800000000000b48656c6c6f20576f726c64010000000000000009b9a28393efd02fcd76a21b0f0f55ba2aad8f3640ff8cae86de033a9cfbd78c017a81460517c18e4fdcd78bf9a9eac22e91d52edfeb04bc8e9e +``` diff --git a/docs/fixtures/type_9.md b/docs/fixtures/type_9.md index 2959b3c9..0933ffa1 100644 --- a/docs/fixtures/type_9.md +++ b/docs/fixtures/type_9.md @@ -3,23 +3,23 @@ ## Signed Json Payload -```javascript +```json { - "version": 2, - "network": 23, - "type": 9, - "nonce": "3", - "senderPublicKey": "039d974aa6feff6a19fde69a8a8b25b991798e98252765a887118ba61218f473a2", - "fee": "0", - "amount": "0", - "asset": { - "claim": { - "lockTransactionId": "f84efeab77224af8959301a7185597a7cfbfbc9a4d99cb021af62f3714feb9d3", - "unlockSecret": "f5ea877a311ced90cf4524cb489e972f" - } - }, - "signature": "c2b9f3655174c13686dde428cf18d5d18f465712985a7086b04860457e8d2db64443083bdf69fdc5b94dcd2c4c722606cf0e058ffae98d8f9f069177c5c189ab", - "id": "d8acf49eba509e94494f454a86add1fab8b2130f223c9cc25e8e92745a584813" + "version": 2, + "network": 23, + "type": 9, + "nonce": "3", + "senderPublicKey": "039d974aa6feff6a19fde69a8a8b25b991798e98252765a887118ba61218f473a2", + "fee": "0", + "amount": "0", + "asset": { + "claim": { + "lockTransactionId": "f84efeab77224af8959301a7185597a7cfbfbc9a4d99cb021af62f3714feb9d3", + "unlockSecret": "f5ea877a311ced90cf4524cb489e972f" + } + }, + "signature": "c2b9f3655174c13686dde428cf18d5d18f465712985a7086b04860457e8d2db64443083bdf69fdc5b94dcd2c4c722606cf0e058ffae98d8f9f069177c5c189ab", + "id": "d8acf49eba509e94494f454a86add1fab8b2130f223c9cc25e8e92745a584813" } ``` @@ -49,6 +49,5 @@ ff02170100000009000300000000000000039d974aa6feff6a19fde69a8a8b25b991798e98252765 ## Example Ledger Payload ```shell -python examples/example_helper.py --tx ff02170100000009000300000000000000039d974aa6feff6a19fde69a8a8b25b991798e98252765a887118ba61218f473a2000000000000000000f84efeab77224af8959301a7185597a7cfbfbc9a4d99cb021af62f3714feb9d36635656138373761333131636564393063663435323463623438396539373266 +python3 examples/example_helper.py --tx ff02170100000009000300000000000000039d974aa6feff6a19fde69a8a8b25b991798e98252765a887118ba61218f473a2000000000000000000f84efeab77224af8959301a7185597a7cfbfbc9a4d99cb021af62f3714feb9d36635656138373761333131636564393063663435323463623438396539373266 ``` -> _note that signature bytes are removed (i.e. there's no need to sign a signed-transaction)._ diff --git a/docs/payloads.md b/docs/payloads.md index c9393a5a..953113a2 100644 --- a/docs/payloads.md +++ b/docs/payloads.md @@ -1,130 +1,158 @@ # Payloads +* [Legacy Transactions](#legacy) + * [Transfer (Type 0)](#legacy-transfer-type-0) + * [Transfer - No VendorField](#legacy-transfer-no-vendorfield) + * [Transfer - With VendorField](#legacy-transfer-with-vendorfield) + * [Vote (Type 3)](#legacy-vote-type-3) +* [v1 Transactions](#v1) + * [Transfer (Type 0)](#v1-transfer-type-0) + * [Transfer - No VendorField](#v1-transfer-no-vendorfield) + * [Transfer - With VendorField](#v1-transfer-with-vendorfield) + * [Vote (Type 3)](#legacy-vote-type-3) +* [v2 Transactions](#v2) + * [Transfer (Type 0)](#transfer-type-0) + * [Transfer - No VendorField](#transfer-no-vendorfield) + * [Transfer - With VendorField](#transfer-with-vendorfield) + * [Transfer - With VendorField - 137 length](#transfer-with-vendorfield---137-characters) + * [Transfer - With VendorField - 255 length](#transfer-with-vendorfield---255-characters) + * [Second Signature Registration (Type 1)](#second-signature-registration-type-1) + * [Vote (Type 3)](#vote-type-3) + * [Ipfs (Type 5)](#ipfs-type-5) + * [Htlc Lock (Type 8)](#htlc-lock-type-8) + * [Htlc Lock - No VendorField](#htlc-lock-no-vendorfield) + * [Htlc Lock - With VendorField](#htlc-lock-with-vendorfield) + * [Htlc Claim (Type 9)](#htlc-claim-type-9) + * [Htlc Refund (Type 10)](#htlc-refund-type-10) +* [Message](#message-signing) + * [55 Characters](#message-signing-55-characters) + * [90 Characters](#message-signing-90-characters) + * [137 Characters](#message-signing-137-characters) + * [255 Characters](#message-signing-255-characters) + ## Legacy -### Type 0: Transfer +### Legacy Transfer (Type 0) -#### No VendorField +#### Legacy Transfer: No VendorField -python3 examples/example_helper.py --tx 0092ffd30002e012f0a7cac12a74bdc17d844cbc9f637177b470019c32a53cef94c7a56e2ea9178d4aa08afea30cfc61acd261306c67a87c3e1c2e00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000bac53949010000008096980000000000 +`python3 examples/example_helper.py --tx 0092ffd30002e012f0a7cac12a74bdc17d844cbc9f637177b470019c32a53cef94c7a56e2ea9178d4aa08afea30cfc61acd261306c67a87c3e1c2e00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000bac53949010000008096980000000000` -#### With VendorField +#### Legacy Transfer: With VendorField -python3 examples/example_helper.py --tx 0092ffd30002e012f0a7cac12a74bdc17d844cbc9f637177b470019c32a53cef94c7a56e2ea9178d4aa08afea30cfc61acd261306c67a87c3e1c2e74686973206973206120746573740000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000bac53949010000008096980000000000 +`python3 examples/example_helper.py --tx 0092ffd30002e012f0a7cac12a74bdc17d844cbc9f637177b470019c32a53cef94c7a56e2ea9178d4aa08afea30cfc61acd261306c67a87c3e1c2e74686973206973206120746573740000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000bac53949010000008096980000000000` -### Type 3: Vote +### Legacy Vote (Type 3) -python3 examples/example_helper.py --tx 035706d400025f81956d5826bad7d30daed2b5c8c98e72046c1ec8323da336445476183fb7ca17af33b082a81e338a36d9fb9127597d4fb4e6ef6c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e1f505000000002b303263393536353264313665316335653337326531613234313233396663643834666236643261393564313930333063653861616138613635343638313530656439 +`python3 examples/example_helper.py --tx 035706d400025f81956d5826bad7d30daed2b5c8c98e72046c1ec8323da336445476183fb7ca17af33b082a81e338a36d9fb9127597d4fb4e6ef6c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e1f505000000002b303263393536353264313665316335653337326531613234313233396663643834666236643261393564313930333063653861616138613635343638313530656439` --- ## V1 -### Type 0: Transfer +### v1 Transfer (Type 0) -#### No VendorField +#### v1 Transfer: No VendorField -python3 examples/example_helper.py --tx ff011e0007627802034151a3ec46b5670a682b0a63394f863587d1bc97483b1b6c70eb58e7f0aed19280969800000000000000c2eb0b00000000000000001e0995750207ecaf0ccf251c1265b92ad84f553662 +`python3 examples/example_helper.py --tx ff011e0007627802034151a3ec46b5670a682b0a63394f863587d1bc97483b1b6c70eb58e7f0aed19280969800000000000000c2eb0b00000000000000001e0995750207ecaf0ccf251c1265b92ad84f553662` -#### With VendorField +#### v1 Transfer: With VendorField -python3 examples/example_helper.py --tx ff011e0007627802034151a3ec46b5670a682b0a63394f863587d1bc97483b1b6c70eb58e7f0aed19280969800000000000b48656c6c6f20576f726c6400c2eb0b00000000000000001e0995750207ecaf0ccf251c1265b92ad84f553662 +`python3 examples/example_helper.py --tx ff011e0007627802034151a3ec46b5670a682b0a63394f863587d1bc97483b1b6c70eb58e7f0aed19280969800000000000b48656c6c6f20576f726c6400c2eb0b00000000000000001e0995750207ecaf0ccf251c1265b92ad84f553662` -### Type 3: Vote +### v1 Vote (Type 3) -python3 examples/example_helper.py --tx ff011e0376b87502034151a3ec46b5670a682b0a63394f863587d1bc97483b1b6c70eb58e7f0aed19200e1f50500000000000101022cca9529ec97a772156c152a00aad155ee6708243e65c9d211a589cb5d43234d +`python3 examples/example_helper.py --tx ff011e0376b87502034151a3ec46b5670a682b0a63394f863587d1bc97483b1b6c70eb58e7f0aed19200e1f50500000000000101022cca9529ec97a772156c152a00aad155ee6708243e65c9d211a589cb5d43234d` --- ## V2 -### Type 0: Transfer - -#### No VendorField +### Transfer (Type 0) -python3 examples/example_helper.py --tx ff0217010000000000010000000000000003a02b9d5fdd1307c2ee4652ba54d492d1fd11a7d1bb3f3a44c4a05e79f19de933809698000000000000a08601000000000000000000171dfc69b54c7fe901e91d5a9ab78388645e2427ea +#### Transfer: No VendorField -#### With VendorField +`python3 examples/example_helper.py --tx ff0217010000000000010000000000000003a02b9d5fdd1307c2ee4652ba54d492d1fd11a7d1bb3f3a44c4a05e79f19de933809698000000000000a08601000000000000000000171dfc69b54c7fe901e91d5a9ab78388645e2427ea` ->VendorField: "Hello World" +#### Transfer: With VendorField -python3 examples/example_helper.py --tx ff02170100000000000300000000000000029f0ab8ab10258144332230178353fa24eb4274370345eaaf1594948a79c8939980969800000000000b48656c6c6f20576f726c64010000000000000000000000173cf7ea59e8d9690e858b7674885b9a4a2c4365d6 +>"Hello World" -#### With VendorField - 137 characters long +`python3 examples/example_helper.py --tx ff02170100000000000300000000000000029f0ab8ab10258144332230178353fa24eb4274370345eaaf1594948a79c8939980969800000000000b48656c6c6f20576f726c64010000000000000000000000173cf7ea59e8d9690e858b7674885b9a4a2c4365d6` ->VendorField: "The scientists of today think deeply instead of clearly. One must be sane to think clearly, but one can think deeply and be quite insane." +#### Transfer: With VendorField - 137 characters -python3 examples/example_helper.py --tx ff02170100000000000300000000000000029f0ab8ab10258144332230178353fa24eb4274370345eaaf1594948a79c8939980969800000000008954686520736369656e7469737473206f6620746f646179207468696e6b20646565706c7920696e7374656164206f6620636c6561726c792e204f6e65206d7573742062652073616e6520746f207468696e6b20636c6561726c792c20627574206f6e652063616e207468696e6b20646565706c7920616e6420626520717569746520696e73616e652e010000000000000000000000173cf7ea59e8d9690e858b7674885b9a4a2c4365d6 +>"The scientists of today think deeply instead of clearly. One must be sane to think clearly, but one can think deeply and be quite insane." -#### With VendorField - 255 characters long +`python3 examples/example_helper.py --tx ff02170100000000000300000000000000029f0ab8ab10258144332230178353fa24eb4274370345eaaf1594948a79c8939980969800000000008954686520736369656e7469737473206f6620746f646179207468696e6b20646565706c7920696e7374656164206f6620636c6561726c792e204f6e65206d7573742062652073616e6520746f207468696e6b20636c6561726c792c20627574206f6e652063616e207468696e6b20646565706c7920616e6420626520717569746520696e73616e652e010000000000000000000000173cf7ea59e8d9690e858b7674885b9a4a2c4365d6` ->VendorField: "All parts should go together without forcing. You must remember that the parts you are reassembling were disassembled by you. Therefore, if you can't get them together again, there must be a reason. By all means, do not use a hammer. ~ IBM Manual - (1975)" +#### Transfer: With VendorField - 255 characters -python3 examples/example_helper.py --tx ff02170100000000000300000000000000029f0ab8ab10258144332230178353fa24eb4274370345eaaf1594948a79c893998096980000000000ff416c6c2070617274732073686f756c6420676f20746f67657468657220776974686f757420666f7263696e672e20596f75206d7573742072656d656d62657220746861742074686520706172747320796f7520617265207265617373656d626c696e67207765726520646973617373656d626c656420627920796f752e205468657265666f72652c20696620796f752063616e277420676574207468656d20746f67657468657220616761696e2c207468657265206d757374206265206120726561736f6e2e20427920616c6c206d65616e732c20646f206e6f742075736520612068616d6d65722e207e2049424d204d616e75616c202d20283139373529010000000000000000000000173cf7ea59e8d9690e858b7674885b9a4a2c4365d6 +>"All parts should go together without forcing. You must remember that the parts you are reassembling were disassembled by you. Therefore, if you can't get them together again, there must be a reason. By all means, do not use a hammer. ~ IBM Manual - (1975)" -### Type 1 Second Signature Registration +`python3 examples/example_helper.py --tx ff02170100000000000300000000000000029f0ab8ab10258144332230178353fa24eb4274370345eaaf1594948a79c893998096980000000000ff416c6c2070617274732073686f756c6420676f20746f67657468657220776974686f757420666f7263696e672e20596f75206d7573742072656d656d62657220746861742074686520706172747320796f7520617265207265617373656d626c696e67207765726520646973617373656d626c656420627920796f752e205468657265666f72652c20696620796f752063616e277420676574207468656d20746f67657468657220616761696e2c207468657265206d757374206265206120726561736f6e2e20427920616c6c206d65616e732c20646f206e6f742075736520612068616d6d65722e207e2049424d204d616e75616c202d20283139373529010000000000000000000000173cf7ea59e8d9690e858b7674885b9a4a2c4365d6` -python3 examples/example_helper.py --tx ff0217010000000100020000000000000002e0c063777427ac196af3c426fd648231ebc4ea06fff5edb1652b98f9c8420c690065cd1d000000000002877e4f35c76abaeb152b128670db0a7ae10b3999afcd28a42938b653fbf87ae9 +### Second Signature Registration (Type 1) -### Type 3: Vote +`python3 examples/example_helper.py --tx ff0217010000000100020000000000000002e0c063777427ac196af3c426fd648231ebc4ea06fff5edb1652b98f9c8420c690065cd1d000000000002877e4f35c76abaeb152b128670db0a7ae10b3999afcd28a42938b653fbf87ae9` -python3 examples/example_helper.py --tx ff0217010000000300020000000000000002555806bca6737eaeaff6434d5171bac8aeb72533ed9bafb280dd11b328a3822d00e1f5050000000000010102555806bca6737eaeaff6434d5171bac8aeb72533ed9bafb280dd11b328a3822d +### Vote (Type 3) -### Type 5: IPFS +`python3 examples/example_helper.py --tx ff0217010000000300020000000000000002555806bca6737eaeaff6434d5171bac8aeb72533ed9bafb280dd11b328a3822d00e1f5050000000000010102555806bca6737eaeaff6434d5171bac8aeb72533ed9bafb280dd11b328a3822d` -python3 examples/example_helper.py --tx ff02170100000005000200000000000000038e000c902d4551065ac5705637c685d52e6ac4032e158ad0370c5ef2bbafae2c0065cd1d000000000012209608184d6cee2b9af8e6c2a46fc9318adf73329aeb8a86cf8472829fff5bb89e +### IPFS (Type 5) -### Type 8: HTLC Lock +`python3 examples/example_helper.py --tx ff02170100000005000200000000000000038e000c902d4551065ac5705637c685d52e6ac4032e158ad0370c5ef2bbafae2c0065cd1d000000000012209608184d6cee2b9af8e6c2a46fc9318adf73329aeb8a86cf8472829fff5bb89e` -#### No VendorField +### HTLC Lock (Type 8) -python3 examples/example_helper.py --tx ff02170100000008000200000000000000020d272fab67c179a9e4df4d006344d3ca47fb531b4246b483373940f0603a9216809698000000000000010000000000000009b9a28393efd02fcd76a21b0f0f55ba2aad8f3640ff8cae86de033a9cfbd78c01537bb104177f2a95c7076ea278776d8fcecc5b18e588976da6 +#### HTLC Lock: No VendorField -#### With VendorField +`python3 examples/example_helper.py --tx ff02170100000008000200000000000000020d272fab67c179a9e4df4d006344d3ca47fb531b4246b483373940f0603a9216809698000000000000010000000000000009b9a28393efd02fcd76a21b0f0f55ba2aad8f3640ff8cae86de033a9cfbd78c01537bb104177f2a95c7076ea278776d8fcecc5b18e588976da6` -python3 examples/example_helper.py --tx ff01170884e24505034151a3ec46b5670a682b0a63394f863587d1bc97483b1b6c70eb58e7f0aed19280969800000000000b48656c6c6f20576f726c64010000000000000009b9a28393efd02fcd76a21b0f0f55ba2aad8f3640ff8cae86de033a9cfbd78c0124e44505175e34dc384ea250461546302ce9deb717c1955503 +#### HTLC Lock: With VendorField -### Type 9: HTLC Claim +`python3 examples/example_helper.py --tx ff02170100000008000000000000000000034151a3ec46b5670a682b0a63394f863587d1bc97483b1b6c70eb58e7f0aed19280969800000000000b48656c6c6f20576f726c64010000000000000009b9a28393efd02fcd76a21b0f0f55ba2aad8f3640ff8cae86de033a9cfbd78c017a81460517c18e4fdcd78bf9a9eac22e91d52edfeb04bc8e9e` -python3 examples/example_helper.py --tx ff02170100000009000300000000000000039d974aa6feff6a19fde69a8a8b25b991798e98252765a887118ba61218f473a2000000000000000000f84efeab77224af8959301a7185597a7cfbfbc9a4d99cb021af62f3714feb9d36635656138373761333131636564393063663435323463623438396539373266 +### HTLC Claim (Type 9) -### Type 10: HTLC Refund +`python3 examples/example_helper.py --tx ff02170100000009000300000000000000039d974aa6feff6a19fde69a8a8b25b991798e98252765a887118ba61218f473a2000000000000000000f84efeab77224af8959301a7185597a7cfbfbc9a4d99cb021af62f3714feb9d36635656138373761333131636564393063663435323463623438396539373266` -python3 examples/example_helper.py --tx ff0217010000000a000300000000000000037fc2e14f626586722a4f9e00dca2efbc4ac409c1ca63bc4309f56184265f95d5000000000000000000c62bd36c162dd0116a08bf8a75cd6d1f83b8f5f1e17e89c8231ebb7af595f64d +### HTLC Refund (Type 10) ---- +`python3 examples/example_helper.py --tx ff0217010000000a000300000000000000037fc2e14f626586722a4f9e00dca2efbc4ac409c1ca63bc4309f56184265f95d5000000000000000000c62bd36c162dd0116a08bf8a75cd6d1f83b8f5f1e17e89c8231ebb7af595f64d` ## Message Signing -### Length = 55 +### Message Signing: 55 characters -python3 examples/example_helper.py --message 57686174207765206b6e6f7720697320612064726f702c207768617420776520646f6e2774206b6e6f7720697320616e206f6365616e2e +`python3 examples/example_helper.py --message 57686174207765206b6e6f7720697320612064726f702c207768617420776520646f6e2774206b6e6f7720697320616e206f6365616e2e` -### Length = 90 +### Message Signing: 90 characters -python3 examples/example_helper.py --message 57652063616e206f6e6c792073656520612073686f72742064697374616e63652061686561642c206275742077652063616e2073656520706c656e74792074686572652074686174206e6565647320746f20626520646f6e652e +`python3 examples/example_helper.py --message 57652063616e206f6e6c792073656520612073686f72742064697374616e63652061686561642c206275742077652063616e2073656520706c656e74792074686572652074686174206e6565647320746f20626520646f6e652e` -### Length = 137 +### Message Signing: 137 characters -python3 examples/example_helper.py --message 54686520736369656e7469737473206f6620746f646179207468696e6b20646565706c7920696e7374656164206f6620636c6561726c792e204f6e65206d7573742062652073616e6520746f207468696e6b20636c6561726c792c20627574206f6e652063616e207468696e6b20646565706c7920616e6420626520717569746520696e73616e652e +`python3 examples/example_helper.py --message 54686520736369656e7469737473206f6620746f646179207468696e6b20646565706c7920696e7374656164206f6620636c6561726c792e204f6e65206d7573742062652073616e6520746f207468696e6b20636c6561726c792c20627574206f6e652063616e207468696e6b20646565706c7920616e6420626520717569746520696e73616e652e` -### Length = 255 +### Message Signing: 255 characters -python3 examples/example_helper.py --message 416c6c2070617274732073686f756c6420676f20746f67657468657220776974686f757420666f7263696e672e20596f75206d7573742072656d656d62657220746861742074686520706172747320796f7520617265207265617373656d626c696e67207765726520646973617373656d626c656420627920796f752e205468657265666f72652c20696620796f752063616e277420676574207468656d20746f67657468657220616761696e2c207468657265206d757374206265206120726561736f6e2e20427920616c6c206d65616e732c20646f206e6f742075736520612068616d6d65722e207e2049424d204d616e75616c202d20283139373529 +`python3 examples/example_helper.py --message 416c6c2070617274732073686f756c6420676f20746f67657468657220776974686f757420666f7263696e672e20596f75206d7573742072656d656d62657220746861742074686520706172747320796f7520617265207265617373656d626c696e67207765726520646973617373656d626c656420627920796f752e205468657265666f72652c20696620796f752063616e277420676574207468656d20746f67657468657220616761696e2c207468657265206d757374206265206120726561736f6e2e20427920616c6c206d65616e732c20646f206e6f742075736520612068616d6d65722e207e2049424d204d616e75616c202d20283139373529` - +`python3 examples/example_helper.py --tx ff0217010000000200020000000000000002a574b8995542631976691a7f73b59e4700cd84badb831331ab18ae2113a184ba00f902950000000000143032613537346238393935353432363331393736` --> - +`python3 examples/example_helper.py --tx ff0217010000000400020000000000000003b593aa66b53525c5399b4af5a4f583dede1c2a46176c6796a7284ee9c0a1167f0094357700000000000203037eaa8cb236c40a08fcb9d6220743ee6ae1b5c40e8a77a38f286516c3ff6639010301fd417566397113ba8c55de2f093a572744ed1829b37b56a129058000ef7bce0209d3c0f68994253cee24b23df3266ba1f0ca2f0666cd69a46544d63001cdf150004495d593cfb8be3293e2473acf504870d2dcf71dbee7620270e136ed63c5eef259099d225f7866178968f0c3581509d92d902914674c8f86b99eb55aaa97586e0171d86f3f6552b237dd81272a7b0da7718c4d26682255223dcf1928174082ce72b07218162938c674afe741119650135338eb3da159e0626ddab6b7851882e08b02d44d9bde77c9ea02d3516ab3263a77f4f9fbb90c30b47eba7a8bb87325edeb78dd69f914f28426e6ff661c4bc001f253130f4e7eb092a9131c8ca69dbfaff32f` --> - +`python3 examples/example_helper.py --tx ff0217010000000600020000000000000002a53371b23f991740f968e3d96de42a67b4242e267cad8050ae4b68bf9ac20af28096980000000000008900000001000000000000001720a32a4fd007065355e791cffd598bb0c6fa52bc010000000000000017f13809c4c5fb2b3967a9b40efc70843f7db462ad0100000000000000175f60e0594115b71d5b136cf929c8504082ac199d0100000000000000175c2aaead4ce542788406c54e1ae31f1afdb7f081010000000000000017c2308975254751ead4df705fc76aa84116c5e34e010000000000000017c792d1958bb950596d0e7cd0bef32506200968480100000000000000172031100e628422b8409810fdb438e874765846ba0100000000000000176bd2c24bded5fdfd7888a28b3c6990503699b5e8010000000000000017009ffbb10efc47ad00a0a29cc2ef6e6c83d8c6ec010000000000000017be9147febbfe462cdbfda8575c18dabe85db4f5b010000000000000017358634b58d88abf4aef3a6fe264b4ad18b74e98b01000000000000001711745fc47a9c58c4e6f5a74eb59411ac102c6a880100000000000000175265ceb5d6102474ea7d0f401d6e6b9f13864a050100000000000000177617b5f3b82f153e388b4b200abd8636fff73dd501000000000000001718f5df4fe3108277bfa4e39071fead9d59b35b8f010000000000000017ef283e95c3fdf0e2df9ba8321407c5621f9868760100000000000000176af453a17439c9c258c25c707aa9fc1f3b59d9b40100000000000000177e94f3954665ebd80ced3d434c67cd4351966f2b0100000000000000178b8ee88e27291e33ce5403ea9b159235887dcfa9010000000000000017232a71b6b2586d5b02b6a72db08759066ba2a92b01000000000000001728c4b220f14f3745f3fff6d3c066ba2353393eb6010000000000000017ac67d5bfbef4a7ed8149727b93a01e903d84ee0c0100000000000000173a537bef2ed296a54adc354967efe3a5e52cdfb80100000000000000172c939e4633bd96ccc1d1509dbe794299603aad9901000000000000001753ef9af027797e4827d708d9ed47c511f4ea5524010000000000000017e103c02fc06140aeac275f8e579f3397d041f817010000000000000017a37d6366d765f5e446fc18ddcc3da3fa300cf6bb010000000000000017e1671fea563be042824751a3465a7dbbc4827942010000000000000017f4d63847bf07a9faad83bd69fed408b3b734dce8010000000000000017888e092eba4cbd5eab9e10646661f5a440915f9d0100000000000000175677152f9d640b175894c8da0b9f30bad3801aff010000000000000017d34bb692e52d515398d00fd57ce2c8bfd3480554010000000000000017cfafad73ebddc38d53317c80cdbf6d343c331d620100000000000000177dbca0c01f96de655cf41eb53e1b8d5e2ffa2607010000000000000017f354c71350a110a7b45b5095ed0a4601bf4bbf9d0100000000000000170ca0fbbfb8e3f615ec4eedaef6281d4d60a8f2b20100000000000000172f885faaf6a3fcc38b1f35c652bf72f0fd7ac60301000000000000001724e14548f3874b9413a28f258c2b73d35ec2b2f9010000000000000017e3f48b5211d1f21034bc15908259901ecf972be8010000000000000017ccbb32ea36fad927cb2c46cbc63930db6cda829d010000000000000017670c4b3896983f37a0d113eb6afc329c39232aa4010000000000000017f17faa6a2a251d2ac73033ea1868387542b798fa010000000000000017aa0f2cf081d9609a44dde12e0c805ebb0880c857010000000000000017a794717598f2f4379bc787be2d5730e19cef6bc50100000000000000179d5d3507b35431cd3ec3ab6dad8663a64c41772e010000000000000017d0fbd6baf73fa195989ea418aa04c90c873f8ec5010000000000000017004c2fbebda958eb1173f9f8eab22a171e0cafba010000000000000017ca7739477089657a1dd6061411cfeafec50f6d28010000000000000017568598ea898f21b665b681425f91666b910da328010000000000000017f38358caf39c93d2d1b4db950606dc703378554c01000000000000001786f5b6951d2c9578a790612f6f3c59b387105180010000000000000017342bf4e8884754b6867903ef9c5e27c03ac036e50100000000000000173278d0a270000126e0dd97e6c0641755b145babe010000000000000017dfd16cf066ffced2c1cfbb10e3ca2a9fb584578a010000000000000017d3275bfaeba7b49d2ef55673bbb3c1fb08b08d9f01000000000000001794e65c65d7abcf07f67b67a23793682f43efeb420100000000000000171bb531fb6335c6a8926a3c00eeba5fe0511856dd0100000000000000170721c33e5b98f0227b2cb8fc64b83dd510317b0b010000000000000017fb73dfa44b21e88e72c234b8c80ed9c634aae35901000000000000001753acc3249244171686f3e7162204b941ebc7261801000000000000001712d4ebc3c271406ce007e3c6f3347b14e447c13601000000000000001718af9ce5f8c983184c9650b021a645bcfebf3cfb01000000000000001740173e1b8672e92982e53c98b53c680748c725b5010000000000000017435483bed11c1b57f692d1c46389b2c5cb3157f2010000000000000017029022a47dc76855101fff5eb0243e3083af78e7010000000000000017c411af7a4a5062066dd5872ddc5373bfea2b8861010000000000000017fbb29777b4d2a728cddab9bd67c957a7b1558994010000000000000017c119f3b087e7fc3038cafea35b127ce40a797a1a010000000000000017fbf6e96524f5e752a5e4c888b21d41de9d3c52620100000000000000172515f06be5786f8be1381c55be104d90ad627112010000000000000017548c6e2d4016a41e378fda3c8873886543fa70ab0100000000000000174bfe676769da8da1f93192e079c482ecc5bc174f010000000000000017afb206cdfb25578ce365d27304470c49e4125fed01000000000000001747f3ffafa5426a110cd350443e9fe9d0f174e3b40100000000000000176eb489b953096524e44f36c85c73144bd532d402010000000000000017871de62afc7f1d49e1ee7c42b0404ba142fc7ea6010000000000000017fec42984da0e01d4a7bac024a5e475c063ac9c460100000000000000177a09a9b82ed74e61fbbcfbe7aec3cbba7cafa12e010000000000000017e20bb0016cd9f294dad34a8bb561fd11e637244a0100000000000000173aae39ea7d1f75a6e9e2227f609c4d14970c852d010000000000000017eae871ae15c3257628161ab7e32ffbb2482c78a9010000000000000017bbe0df02533620dfc8a6a5033a7345e0a34be0cb01000000000000001715b7d1c17acc078e851a177a1d367a9d3dd68d23010000000000000017bb7e23ad26914f168656213867fae480dda65c470100000000000000175af6c2e27b91e61f8e2aeeb97b1eccf227a3bebd0100000000000000171df95978e737f2fb09b8c84e14965ea93340d18601000000000000001751dffdd691c32b7eb725cadb1d079f307f95f664010000000000000017f874b060408bf32f69abd7075ef1996d73f60be00100000000000000173271a8fa8423a3deed5f428c246c570b55698437010000000000000017403b9325626c8cdef7d72607b81293c2d470a97b010000000000000017742a8590b18189f9a48ea5d6130ca261c0a4c22401000000000000001700a167a5d6b0f9ce2412c1b5df562b6d864a711001000000000000001734b2366cee1ec416e66388d3af5fd9b139a5603b0100000000000000171c5ee9ef8a8fe1f9f9b342e1eb7a386f6b8994f50100000000000000179f5b37aa9925ad7e998c3bd4b5ddbe31e9f58e8d0100000000000000177e783dc832674a0ee644cdfb29e9232f68ee505d01000000000000001780824545d87e1eb691b2171e4bb493607724e55001000000000000001719f9077cac3d96ecdca2f51f4c98407aac43868d010000000000000017dd108e250a81bda83e4613b71455753786ee746e0100000000000000177493b7565f8636184e83c6932fc92a5d5a296bd7010000000000000017718e2ae0facdbf29671853177560c5005a9f0e79010000000000000017eaae33738759c292d482eab208a0a0bf435c85af010000000000000017c49bcbe3455ba122f872e690c74fc0ec9210414f01000000000000001724c7652304c41c93aead26419604de7f5b8de442010000000000000017aab09efda1232d347381be809e1c8dfc3c0744fc0100000000000000175d31e11438d5ef1140d6296f05f7a03b6c6630100100000000000000170e21668e2123e42e03272fa24e46137242a6ff65010000000000000017ad0087f23f59dd30f586de1442cbb8b986d50fd4010000000000000017d80204238e3e94f99bfe2e44a20671ace2deb55c0100000000000000170688a4b5d8b90c9ce1703d5bfe660ddb6f1d9dc00100000000000000179d317d97a1c29ce4d134c4101673d68d8ec8b56a0100000000000000179ff7c1007941f86c2ba2a33dc420dd30dbad52d7010000000000000017acb8100b3d329598a4f0881df2ca7921a9da659d0100000000000000177a9a7b964ee2e823fcb237b352a4b3769c69e9d7010000000000000017e98855e1023a60dbe3fec3e139e496fad176ac160100000000000000178c8116b26ea08128470bd157e94214a9ef8b234801000000000000001782c5e34f55def2baa9c795064759ebeca7d71eb3010000000000000017a5304a50845a14eb3d056738c8de3c30ee49dd1901000000000000001785ffad6012d89b11b510fe32dbf85ca448249050010000000000000017ce1e89721c1df2d1b4165a622bf1288fa764a6e301000000000000001745e561944786f513c5ad3d31c3c3c88e3aa4dcc8010000000000000017a799ee7a9fc25df86361192ffbee64a8d52386ad0100000000000000177ed2ae936601fc2f079279afe249f510df5efc9101000000000000001729cab77105a600d1843c56b34c877d1b1bddd8bd01000000000000001725e40ab73be8507a874986d35bd3737463ea113f0100000000000000176b1c4f8024768772d2383d87af7d8990f732413c010000000000000017f5bc3b8ab8a28f0700df6f3602f231dc434bdcbc010000000000000017a818773d8d77e6fc74970dd488c033965669d39b01000000000000001704eb876ab3b7e2f136889dadeddc0219b47dac8a010000000000000017599b1ef53e7c4fbe6c682afda54ebdc87049391f0100000000000000170d1aaa9441c60a0e51212a5b84892aa9759cf6d20100000000000000175a6d54a6ee7e6225a4325a5e05d59b452e279d9b0100000000000000178810a6294399c640e23d42c372494e9159b1ace0010000000000000017261c52971d5e1024a7c0ececf5197f01005fe9bc01000000000000001798107a6ceb0fcf15a7b05208c29564f34eeafc98010000000000000017a44fcf637c830148b941e977ac155d2bc2f016e7010000000000000017905df747e8999695f92c58cbaac4324b11345e73` --> - +`python3 examples/example_helper.py --tx ff02170100000007000200000000000000037a12518205254e6ebf25290d9786fd9821c43bb7319c9fc2499c8d472809dfaf00f902950000000000` --> diff --git a/docs/unimplemented/README.md b/docs/unimplemented/README.md index d900520c..9a29dafe 100644 --- a/docs/unimplemented/README.md +++ b/docs/unimplemented/README.md @@ -2,11 +2,16 @@ # Unimplemented Feature Examples The code examples found here serve as a guide for adding these feature. -They're not final or guaranteed as working, but should hopefully make implementing them much easier. +They're not final, tested, or guaranteed as working; +this should still hopefully make implementing these types much easier. ## What's currently here -- Type 2: Delegate Registration -- Type 4: MultiSignature Registration -- Type 6: MultiPayment -- Type 7: Delegate Resignation +* Type 2: Delegate Registration + >Delegates Forge; forging cannot be done using a Ledger. +* Type 4: MultiSignature Registration + >Ledger will not support max MultiSig. +* Type 6: MultiPayment + >Ledger will not support max MultiPayment. +* Type 7: Delegate Resignation + >Delegates Forge; forging cannot be done using a Ledger. diff --git a/docs/unimplemented/delegate_registration/assets.h b/docs/unimplemented/delegate_registration/assets.h new file mode 100644 index 00000000..8744635a --- /dev/null +++ b/docs/unimplemented/delegate_registration/assets.h @@ -0,0 +1,66 @@ + +//////////////////////////////////////////////////////////////////////////////// + +// The Following are only examples and places where this code could be implemented. +// It is not final or guaranteed working. +// This should only serve as a reference for implementing. + +//////////////////////////////////////////////////////////////////////////////// + +/******************************************************************************* + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + ******************************************************************************/ + +#ifndef ARK_OPERATIONS_TRANSACTIONS_TYPES_ASSETS_H +#define ARK_OPERATIONS_TRANSACTIONS_TYPES_ASSETS_H + +#include "transactions/types/transfer.h" +#include "transactions/types/second_signature.h" +#include "transactions/types/delegate_registration.h" +#include "transactions/types/vote.h" +/* #include "transactions/types/multi_signature.h" */ +#include "transactions/types/ipfs.h" +/* #include "transactions/types/multi_payment.h" */ +/* #include "transactions/types/delegate_resignation.h" */ +#include "transactions/types/htlc_lock.h" +#include "transactions/types/htlc_claim.h" +#include "transactions/types/htlc_refund.h" + +//////////////////////////////////////////////////////////////////////////////// +typedef union tx_asset_t { + Transfer transfer; // Type 0 + SecondSignatureRegistration secondSignature; // Type 1 + DelegateRegistration delegateRegistration // Type 2 + Vote vote; // Type 3 +/* MultiSignature // Type 4 */ + Ipfs ipfs; // Type 5 +/* MultiPayment // Type 6 */ +/* Delegate Resignation // Type 7 */ + HtlcLock htlcLock; // Type 8 + HtlcClaim htlcClaim; // Type 9 + HtlcRefund htlcRefund; // Type 10 +} tx_asset_t; + +#endif // #define ARK_OPERATIONS_TRANSACTIONS_TYPES_ASSETS_H diff --git a/docs/unimplemented/delegate_registration/delegate_registration.c b/docs/unimplemented/delegate_registration/delegate_registration.c new file mode 100644 index 00000000..b75da6bc --- /dev/null +++ b/docs/unimplemented/delegate_registration/delegate_registration.c @@ -0,0 +1,78 @@ + +//////////////////////////////////////////////////////////////////////////////// + +// The Following are only examples and places where this code could be implemented. +// It is not final or guaranteed working. +// This should only serve as a reference for implementing. + +//////////////////////////////////////////////////////////////////////////////// + +/******************************************************************************* + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + ******************************************************************************/ + +#include "transactions/types/delegate_registration.h" + +#include +#include +#include + +#include "constants.h" + +#include "utils/utils.h" + +//////////////////////////////////////////////////////////////////////////////// +// Deserialize Transfer (Type 2) - 4 <=> 20 Bytes +// +// @param DelegateRegistrationAsset *registration: The Delegate Registration (Type 2) Asset. +// @param uint8_t *buffer: The serialized buffer beginning at the Assets offset. +// @param uint32_t length: The Asset Length. +// +// --- +// Internals: +// +// Username Length - 1 Byte: +// - registration->length = buffer[0]; +// +// Username - 3 <=> 20 Bytes: +// - bytecpy(registration->username, &buffer[1], registration->length) +// +// --- +bool deserializeDelegateRegistration(DelegateRegistration *registration, + const uint8_t *buffer, + const uint32_t length) { + // usernameLength + username + if (length < DELEGATE_REGISTRATION_USERNAME_MIN || + length > DELEGATE_REGISTRATION_USERNAME_MAX) { + return false; // Incorrect Username Length + } + + registration->length = (int)buffer[0]; + bytecpy((void *)registration->username, + &buffer[1], + (int)registration->length); + + return true; +} diff --git a/docs/unimplemented/delegate_registration/delegate_registration.h b/docs/unimplemented/delegate_registration/delegate_registration.h new file mode 100644 index 00000000..f5083695 --- /dev/null +++ b/docs/unimplemented/delegate_registration/delegate_registration.h @@ -0,0 +1,60 @@ + +//////////////////////////////////////////////////////////////////////////////// + +// The Following are only examples and places where this code could be implemented. +// It is not final or guaranteed working. +// This should only serve as a reference for implementing. + +//////////////////////////////////////////////////////////////////////////////// + +/******************************************************************************* + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + ******************************************************************************/ + +#ifndef ARK_OPERATIONS_TRANSACTIONS_TYPES_DELEGATE_REGISTRATION_H +#define ARK_OPERATIONS_TRANSACTIONS_TYPES_DELEGATE_REGISTRATION_H + +#include +#include +#include + +#include "constants.h" + +//////////////////////////////////////////////////////////////////////////////// +static const size_t DELEGATE_REGISTRATION_USERNAME_MIN = 4; +static const size_t DELEGATE_REGISTRATION_USERNAME_MAX = 20; + +//////////////////////////////////////////////////////////////////////////////// +typedef struct delegate_registration_asset_t { + uint8_t length; + uint8_t username[DELEGATE_REGISTRATION_USERNAME_MAX]; +} DelegateRegistration; + +//////////////////////////////////////////////////////////////////////////////// +bool deserializeDelegateRegistration(DelegateRegistration *registration, + const uint8_t *buffer, + size_t length); + +#endif // #define ARK_OPERATIONS_TRANSACTIONS_TYPES_DELEGATE_REGISTRATION_H diff --git a/docs/unimplemented/delegate_registration/delegate_registration_ux.c b/docs/unimplemented/delegate_registration/delegate_registration_ux.c new file mode 100644 index 00000000..8cced82a --- /dev/null +++ b/docs/unimplemented/delegate_registration/delegate_registration_ux.c @@ -0,0 +1,73 @@ + +//////////////////////////////////////////////////////////////////////////////// + +// The Following are only examples and places where this code could be implemented. +// It is not final or guaranteed working. +// This should only serve as a reference for implementing. + +//////////////////////////////////////////////////////////////////////////////// + +/******************************************************************************* + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + ******************************************************************************/ + +#include "transactions/ux/delegate_registration_ux.h" + +#include +#include + +#include "constants.h" + +#include "operations/transactions/transaction.h" + +#include "utils/print.h" +#include "utils/utils.h" + +#include "display/context.h" + +//////////////////////////////////////////////////////////////////////////////// +void displayDelegateRegistration(const Transaction *transaction) { + + const char *const LABEL = "Delegate Reg."; + const size_t LABEL_SIZE = 14; + + const char *const LABEL_USERNAME = "Username"; + const size_t LABEL_USERNAME_SIZE = 9; + + bytecpy((char *)displayCtx.operation, LABEL, LABEL_SIZE); + bytecpy((char *)displayCtx.title[0], LABEL_USERNAME, LABEL_USERNAME_SIZE); + bytecpy((char *)displayCtx.title[1], LABEL_FEE, LABEL_FEE_SIZE); + + // Username + bytecpy((char *)displayCtx.text[0], + transaction->asset.delegateRegistration.username, + transaction->asset.delegateRegistration.length); + + // Fee + printAmount(transaction->fee, + (uint8_t *)displayCtx.text[1], + sizeof(displayCtx.text[1]), + TOKEN_NAME, TOKEN_NAME_SIZE, TOKEN_DECIMALS); +} diff --git a/docs/unimplemented/delegate_registration/delegate_registration_ux.h b/docs/unimplemented/delegate_registration/delegate_registration_ux.h new file mode 100644 index 00000000..c4443d41 --- /dev/null +++ b/docs/unimplemented/delegate_registration/delegate_registration_ux.h @@ -0,0 +1,49 @@ + +//////////////////////////////////////////////////////////////////////////////// + +// The Following are only examples and places where this code could be implemented. +// It is not final or guaranteed working. +// This should only serve as a reference for implementing. + +//////////////////////////////////////////////////////////////////////////////// + +/******************************************************************************* + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + ******************************************************************************/ + +#ifndef ARK_OPERATIONS_TRANSACTIONS_UX_DELEGATE_REGISTRATION_UX_H +#define ARK_OPERATIONS_TRANSACTIONS_UX_DELEGATE_REGISTRATION_UX_H + +#include + +#include "operations/transactions/transaction.h" + +//////////////////////////////////////////////////////////////////////////////// +static const uint8_t STEPS_DELEGATE_REGISTRATION = 2U; + +//////////////////////////////////////////////////////////////////////////////// +void displayDelegateRegistration(const Transaction *transaction); + +#endif // #define ARK_OPERATIONS_TRANSACTIONS_UX_DELEGATE_REGISTRATION_UX_H diff --git a/docs/unimplemented/delegate_registration/deserializer.c b/docs/unimplemented/delegate_registration/deserializer.c new file mode 100644 index 00000000..5fe130b5 --- /dev/null +++ b/docs/unimplemented/delegate_registration/deserializer.c @@ -0,0 +1,308 @@ + +//////////////////////////////////////////////////////////////////////////////// + +// The Following are only examples and places where this code could be implemented. +// It is not final or guaranteed working. +// This should only serve as a reference for implementing. + +//////////////////////////////////////////////////////////////////////////////// + +/******************************************************************************* + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + ******************************************************************************/ + +// #include "transactions/deserializer.h" + +// #include +// #include +// #include +// #include + +// #include "constants.h" + +// #include "transactions/transaction.h" + +// #include "transactions/offsets.h" +// #include "transactions/types/types.h" + +// #include "transactions/legacy/deserialize_legacy.h" +// #include "transactions/legacy/display_legacy.h" + +// #include "utils/unpack.h" +// #include "utils/utils.h" + +// #include "transactions/ux/display_ux.h" + +// //////////////////////////////////////////////////////////////////////////////// +// Transaction transaction; + +// //////////////////////////////////////////////////////////////////////////////// +// // Deserialize Common +// // +// // @param Transaction *transaction: A Transaction object. +// // @param uint8_t *buffer: The serialized transactions buffer. +// // +// // --- +// // Internals: +// // +// // Header - 1 Byte: +// // - 0xFF Marker: buffer[0] +// // +// // Transaction Version - 1 Byte: +// // - transaction->version = buffer[1]; +// // +// // Network Version - 1 Byte: +// // - transaction->network = buffer[2]; +// // +// // TypeGroup - 4 Bytes: Not Currently Needed +// // - transaction->typeGroup = U4LE(&buffer[3]); +// // +// // Transaction Type - 2 Bytes: +// // - transaction->type = U2LE(&buffer[7]); +// // +// // Nonce - 8 Bytes: Not Currently Needed +// // - transaction->nonce = U8LE(&buffer[9]); +// // +// // SenderPublicKey - 33 Bytes: +// // - bytecpy(transaction->senderPublicKey, &buffer[17], 33); +// // +// // Fee - 8 bytes +// // - transaction->fee = U8LE(buffer, 50); +// // +// // VendorField Length - 1 Byte: +// // transaction->vendorFieldLength = buffer[58]; +// // +// // VendorField - 0 - 64 Bytes: +// // - transaction->vendorField = (uint8_t *)&buffer[59]; +// // +// // --- +// static void deserializeCommon(Transaction *transaction, const uint8_t *buffer) { +// transaction->header = buffer[HEADER_OFFSET]; // 1 Byte +// transaction->version = buffer[VERSION_OFFSET]; // 1 Byte +// transaction->network = buffer[NETWORK_OFFSET]; // 1 Byte +// transaction->type = U2LE(buffer, TYPE_OFFSET); // 2 Bytes + +// bytecpy(transaction->senderPublicKey, // 33 Bytes +// &buffer[SENDER_PUBLICKEY_OFFSET], +// PUBLICKEY_COMPRESSED_LEN); + +// transaction->fee = U8LE(buffer, FEE_OFFSET); // 8 Bytes + +// transaction->vendorFieldLength = buffer[VF_LEN_OFFSET]; // 1 Byte +// // 0 <=> 64 Bytes +// transaction->vendorField = (uint8_t *)&buffer[VF_OFFSET]; +// } + +// //////////////////////////////////////////////////////////////////////////////// +// // Deserialize Common v1 +// // +// // @param TransactionData *data: The Transaction Data destination. +// // @param const uint8_t *buffer +// // +// // --- +// // Internals: +// // +// // Header - 1 Byte: +// // - data->header = buffer.at(0); +// // +// // Transaction Version - 1 Byte: +// // - data->version = buffer.at(1); +// // +// // Network Version - 1 Byte: +// // - data->network = buffer.at(2); +// // +// // Transaction Type - 1 Byte: +// // - data->type = buffer.at(3); +// // +// // Timestamp - 4 Bytes: Not Currently Needed +// // - data->timestamp = unpack4LE(buffer, 4); +// // +// // SenderPublicKey - 33 Bytes: +// // - std::copy_n(&buffer.at(8), 33, data->senderPublicKey.begin()); +// // +// // Fee - 8 bytes +// // - data->fee = unpack8LE(buffer, 41); +// // +// // VendorField Length - 1 Byte: +// // - buffer.at(49) +// // +// // VendorField - 0 - 255 Bytes: +// // - data->vendorField.insert(data->vendorField.begin(), &buffer.at(50), &buffer.at(50 + buffer.at(49))); +// // +// // --- +// static void deserializeCommonV1(Transaction *transaction, +// const uint8_t *buffer) { +// transaction->header = buffer[HEADER_OFFSET]; // 1 Byte +// transaction->version = buffer[VERSION_OFFSET]; // 1 Byte +// transaction->network = buffer[NETWORK_OFFSET]; // 1 Byte +// transaction->type = buffer[TYPE_OFFSET_V1]; // 1 Byte + +// bytecpy(transaction->senderPublicKey, // 33 Bytes +// &buffer[SENDER_PUBLICKEY_OFFSET_V1], +// PUBLICKEY_COMPRESSED_LEN); + +// transaction->fee = U8LE(buffer, FEE_OFFSET_V1); // 8 Bytes + +// transaction->vendorFieldLength = buffer[VF_LEN_OFFSET_V1]; // 1 Byte +// // vendorField: 0 <=> 64 Bytes +// transaction->vendorField = (uint8_t *)&buffer[VF_OFFSET_V1]; +// } + +// //////////////////////////////////////////////////////////////////////////////// +// // Deserialize Asset +// // +// // @param Transaction *transaction +// // @param uint8_t *buffer: The serialized buffer at the asset offset. +// // @param size_t size: The Asset Buffer Size. +// // +// // @return bool: true if successful +// // +// // --- +// // Internals: +// // +// // - case TRANSFER +// // - case SECOND_SIGNATURE +// - case VOTE +// // - case IPFS +// // - case HTLC_LOCK +// // - case HTLC_CLAIM +// // - case HTLC_REFUND +// // +// // --- +// static bool deserializeAsset(Transaction *transaction, +// const uint8_t *buffer, +// size_t size) { +// switch (transaction->type) { +// // Transfer +// case TRANSFER_TYPE: +// return deserializeTransfer( +// &transaction->asset.transfer, buffer, size); + +// // Second Signature Registration +// case SECOND_SIGNATURE_TYPE: +// return deserializeSecondSignature( +// &transaction->asset.secondSignature, buffer, size); + + // Delegate Registration + case DELEGATE_REGISTRATION_TYPE: + return deserializeDelegateRegistration( + &transaction->asset.delegateRegistration, buffer, size); + +// // Vote +// case VOTE_TYPE: +// return deserializeVote( +// &transaction->asset.vote, buffer, size); + +// // Ipfs +// case IPFS_TYPE: +// return deserializeIpfs( +// &transaction->asset.ipfs, buffer, size); + +// // Htlc Lock +// case HTLC_LOCK_TYPE: +// return deserializeHtlcLock( +// &transaction->asset.htlcLock, buffer, size); + +// // Htlc Claim +// case HTLC_CLAIM_TYPE: +// return deserializeHtlcClaim( +// &transaction->asset.htlcClaim, buffer, size); + +// // Htlc Refund +// case HTLC_REFUND_TYPE: +// return deserializeHtlcRefund( +// &transaction->asset.htlcRefund, buffer, size); + +// // Unknown Transaction Type +// default: return false; +// }; +// } + +// //////////////////////////////////////////////////////////////////////////////// +// // v2 and v1 Transactions +// static bool internalDeserialize(Transaction *transaction, +// const uint8_t *buffer, +// size_t size) { +// size_t assetOffset = 0; +// switch (buffer[VERSION_OFFSET]) { +// // v2 +// case TRANSACTION_VERSION_TYPE_2: +// deserializeCommon(transaction, buffer); +// assetOffset = VF_OFFSET + transaction->vendorFieldLength; +// break; + +// // v1 +// case TRANSACTION_VERSION_TYPE_1: +// deserializeCommonV1(transaction, buffer); +// assetOffset = VF_OFFSET_V1 + transaction->vendorFieldLength; +// break; + +// default: return false; +// } + +// if (deserializeAsset(transaction, +// &buffer[assetOffset], +// size - assetOffset)) { +// setDisplay(transaction); +// return true; +// } + +// // Unknown Transaction Version +// return false; +// } + +// //////////////////////////////////////////////////////////////////////////////// +// // Legacy Transactions +// static bool internalDeserializeLegacy(Transaction *transaction, +// const uint8_t *buffer, +// size_t size) { +// if (buffer[HEADER_OFFSET] == TRANSFER_TYPE || +// buffer[HEADER_OFFSET] == VOTE_TYPE) { +// deserializeCommonLegacy(transaction, buffer, size); + +// transaction->assetOffset = ASSET_OFFSET_LEGACY; +// transaction->assetPtr = (uint8_t*)&buffer[transaction->assetOffset]; + +// setDisplayLegacy(transaction); + +// return true; +// } + +// // Unknown Transaction Version and Type +// return false; +// } + +// //////////////////////////////////////////////////////////////////////////////// +// bool deserialize(const uint8_t *buffer, size_t size) { +// bool successful = buffer[HEADER_OFFSET] == TRANSACTION_HEADER +// ? internalDeserialize(&transaction, buffer, size) +// : internalDeserializeLegacy(&transaction, buffer, size); + +// if (!successful) { +// explicit_bzero(&transaction, sizeof(transaction)); +// } + +// return successful; +// } diff --git a/docs/unimplemented/delegate_registration/display_ux.c b/docs/unimplemented/delegate_registration/display_ux.c new file mode 100644 index 00000000..6452f8b5 --- /dev/null +++ b/docs/unimplemented/delegate_registration/display_ux.c @@ -0,0 +1,111 @@ + +//////////////////////////////////////////////////////////////////////////////// + +// The Following are only examples and places where this code could be implemented. +// It is not final or guaranteed working. +// This should only serve as a reference for implementing. + +//////////////////////////////////////////////////////////////////////////////// + +/******************************************************************************* + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + ******************************************************************************/ + +#include "transactions/ux/display_ux.h" + +// #include +// #include + +// #include "transactions/transaction.h" + +// #include "transactions/types/types.h" + +// #include "transactions/ux/transfer_ux.h" +// #include "transactions/ux/second_signature_ux.h" +#include "transactions/ux/delegate_registration_ux.h" +// #include "transactions/ux/vote_ux.h" +// #include "transactions/ux/ipfs_ux.h" +// #include "transactions/ux/htlc_lock_ux.h" +// #include "transactions/ux/htlc_claim_ux.h" +// #include "transactions/ux/htlc_refund_ux.h" + +// #include "display/context.h" +// #include "display/display.h" + +// //////////////////////////////////////////////////////////////////////////////// +// extern void setDisplaySteps(uint8_t steps, bool isExtended); + +// //////////////////////////////////////////////////////////////////////////////// +// void setDisplay(const Transaction *transaction) { +// explicit_bzero(&displayCtx, sizeof(displayCtx)); + +// switch (transaction->type) { +// case TRANSFER_TYPE: +// displayTransfer(transaction); +// bool hasVendorField = transaction->vendorFieldLength > 0; +// setDisplaySteps(STEPS_TRANSFER_MIN + (uint8_t)hasVendorField, +// hasVendorField); +// break; + +// case SECOND_SIGNATURE_TYPE: +// displaySecondSignature(transaction); +// setDisplaySteps(STEPS_SECOND_SIGNATURE, false); +// break; + + case DELEGATE_REGISTRATION_TYPE: + displayDelegateRegistration(transaction); + setDisplaySteps(STEPS_DELEGATE_REGISTRATION, false); + break; + +// case VOTE_TYPE: +// displayVote(transaction); +// setDisplaySteps(STEPS_VOTE, false); +// break; + +// case IPFS_TYPE: +// displayIpfs(transaction); +// setDisplaySteps(STEPS_IPFS, true); +// break; + +// case HTLC_LOCK_TYPE: +// displayHtlcLock(transaction); +// bool hasVendorField = transaction->vendorFieldLength > 0; +// setDisplaySteps(STEPS_HTLC_LOCK_MIN + (uint8_t)hasVendorField, +// hasVendorField); +// break; + +// case HTLC_CLAIM_TYPE: +// displayHtlcClaim(transaction); +// setDisplaySteps(STEPS_HTLC_CLAIM, false); +// break; + +// case HTLC_REFUND_TYPE: +// displayHtlcRefund(transaction); +// setDisplaySteps(STEPS_HTLC_REFUND, false); +// break; + +// default: break; +// }; +// } diff --git a/docs/unimplemented/delegate_registration/types.h b/docs/unimplemented/delegate_registration/types.h new file mode 100644 index 00000000..aaf8e533 --- /dev/null +++ b/docs/unimplemented/delegate_registration/types.h @@ -0,0 +1,55 @@ + +//////////////////////////////////////////////////////////////////////////////// + +// The Following are only examples and places where this code could be implemented. +// It is not final or guaranteed working. +// This should only serve as a reference for implementing. + +//////////////////////////////////////////////////////////////////////////////// + +/******************************************************************************* + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + ******************************************************************************/ + +#ifndef ARK_OPERATIONS_TRANSACTIONS_ASSETS_TYPES_H +#define ARK_OPERATIONS_TRANSACTIONS_ASSETS_TYPES_H + +//////////////////////////////////////////////////////////////////////////////// +// ARK Transaction Types +enum TransactionTypes { + TRANSFER_TYPE = 0, + SECOND_SIGNATURE_TYPE = 1, + DELEGATE_REGISTRATION_TYPE = 2, + VOTE_TYPE = 3, +/* MULTI_SIGNATURE_TYPE = 4, */ + IPFS_TYPE = 5, +/* MULTI_PAYMENT_TYPE = 6, */ +/* DELEGATE_RESIGNATION_TYPE = 7, */ + HTLC_LOCK_TYPE = 8, + HTLC_CLAIM_TYPE = 9, + HTLC_REFUND_TYPE = 10 +}; + +#endif // #define ARK_OPERATIONS_TRANSACTIONS_ASSETS_TYPES_H diff --git a/docs/unimplemented/delegate_resignation/assets.h b/docs/unimplemented/delegate_resignation/assets.h new file mode 100644 index 00000000..762beb68 --- /dev/null +++ b/docs/unimplemented/delegate_resignation/assets.h @@ -0,0 +1,66 @@ + +//////////////////////////////////////////////////////////////////////////////// + +// The Following are only examples and places where this code could be implemented. +// It is not final or guaranteed working. +// This should only serve as a reference for implementing. + +//////////////////////////////////////////////////////////////////////////////// + +/******************************************************************************* + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + ******************************************************************************/ + +#ifndef ARK_OPERATIONS_TRANSACTIONS_TYPES_ASSETS_H +#define ARK_OPERATIONS_TRANSACTIONS_TYPES_ASSETS_H + +#include "transactions/types/transfer.h" +#include "transactions/types/second_signature.h" +/* #include "transactions/types/delegate_registration.h" */ +#include "transactions/types/vote.h" +/* #include "transactions/types/multi_signature.h" */ +#include "transactions/types/ipfs.h" +/* #include "transactions/types/multi_payment.h" */ +#include "transactions/types/delegate_resignation.h" +#include "transactions/types/htlc_lock.h" +#include "transactions/types/htlc_claim.h" +#include "transactions/types/htlc_refund.h" + +//////////////////////////////////////////////////////////////////////////////// +typedef union tx_asset_t { + Transfer transfer; // Type 0 + SecondSignatureRegistration secondSignature; // Type 1 +/* DelegateRegistration // Type 2 */ + Vote vote; // Type 3 +/* MultiSignature // Type 4 */ + Ipfs ipfs; // Type 5 +/* MultiPayment // Type 6 */ + DelegateResignation delegateResignation // Type 7 + HtlcLock htlcLock; // Type 8 + HtlcClaim htlcClaim; // Type 9 + HtlcRefund htlcRefund; // Type 10 +} tx_asset_t; + +#endif // #define ARK_OPERATIONS_TRANSACTIONS_TYPES_ASSETS_H diff --git a/docs/unimplemented/delegate_resignation/delegate_resignation.h b/docs/unimplemented/delegate_resignation/delegate_resignation.h new file mode 100644 index 00000000..f2d25add --- /dev/null +++ b/docs/unimplemented/delegate_resignation/delegate_resignation.h @@ -0,0 +1,44 @@ + +//////////////////////////////////////////////////////////////////////////////// + +// The Following are only examples and places where this code could be implemented. +// It is not final or guaranteed working. +// This should only serve as a reference for implementing. + +//////////////////////////////////////////////////////////////////////////////// + +/******************************************************************************* + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + ******************************************************************************/ + +#ifndef ARK_OPERATIONS_TRANSACTIONS_TYPES_DELEGATE_RESIGNATION_H +#define ARK_OPERATIONS_TRANSACTIONS_TYPES_DELEGATE_RESIGNATION_H + +#include "constants.h" + +//////////////////////////////////////////////////////////////////////////////// +typedef struct delegate_resignation_asset_t {} DelegateResignation; + +#endif // #define ARK_OPERATIONS_TRANSACTIONS_TYPES_DELEGATE_RESIGNATION_H diff --git a/docs/unimplemented/delegate_resignation/delegate_resignation_ux.c b/docs/unimplemented/delegate_resignation/delegate_resignation_ux.c new file mode 100644 index 00000000..60f82e7c --- /dev/null +++ b/docs/unimplemented/delegate_resignation/delegate_resignation_ux.c @@ -0,0 +1,73 @@ + +//////////////////////////////////////////////////////////////////////////////// + +// The Following are only examples and places where this code could be implemented. +// It is not final or guaranteed working. +// This should only serve as a reference for implementing. + +//////////////////////////////////////////////////////////////////////////////// + +/******************************************************************************* + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + ******************************************************************************/ + +#include "transactions/ux/delegate_resignation_ux.h" + +#include +#include + +#include "constants.h" + +#include "operations/transactions/transaction.h" + +#include "utils/hex.h" +#include "utils/print.h" +#include "utils/utils.h" + +#include "display/context.h" + +//////////////////////////////////////////////////////////////////////////////// +void displayDelegateResignation(const Transaction *transaction) { + + const char *const LABEL = "Delegate Res."; + const size_t LABEL_SIZE = 14; + + const char *const LABEL_PUBLICKEY = "PublicKey"; + const size_t LABEL_PUBLICKEY_SIZE = 10; + + bytecpy((char *)displayCtx.operation, LABEL, LABEL_SIZE); + bytecpy((char *)displayCtx.title[0], LABEL_PUBLICKEY, LABEL_PUBLICKEY_SIZE); + bytecpy((char *)displayCtx.title[1], LABEL_FEE, LABEL_FEE_SIZE); + + // Delegate PublicKey + bytesToHex((char *)displayCtx.text[0], + transaction->senderPublicKey, + PUBLICKEY_COMPRESSED_LEN); + + // Fee + printAmount(transaction->fee, + (uint8_t *)displayCtx.text[1], sizeof(displayCtx.text[1]), + TOKEN_NAME, TOKEN_NAME_SIZE, TOKEN_DECIMALS); +} diff --git a/docs/unimplemented/delegate_resignation/delegate_resignation_ux.h b/docs/unimplemented/delegate_resignation/delegate_resignation_ux.h new file mode 100644 index 00000000..dfd80437 --- /dev/null +++ b/docs/unimplemented/delegate_resignation/delegate_resignation_ux.h @@ -0,0 +1,49 @@ + +//////////////////////////////////////////////////////////////////////////////// + +// The Following are only examples and places where this code could be implemented. +// It is not final or guaranteed working. +// This should only serve as a reference for implementing. + +//////////////////////////////////////////////////////////////////////////////// + +/******************************************************************************* + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + ******************************************************************************/ + +#ifndef ARK_OPERATIONS_TRANSACTIONS_UX_DELEGATE_RESIGNATION_UX_H +#define ARK_OPERATIONS_TRANSACTIONS_UX_DELEGATE_RESIGNATION_UX_H + +#include + +#include "operations/transactions/transaction.h" + +//////////////////////////////////////////////////////////////////////////////// +static const uint8_t STEPS_DELEGATE_REGISTRATION = 2U; + +//////////////////////////////////////////////////////////////////////////////// +void displayDelegateResignation(const Transaction *transaction); + +#endif // #define ARK_OPERATIONS_TRANSACTIONS_UX_DELEGATE_RESIGNATION_UX_H diff --git a/docs/unimplemented/delegate_resignation/deserializer.c b/docs/unimplemented/delegate_resignation/deserializer.c new file mode 100644 index 00000000..cb7ede54 --- /dev/null +++ b/docs/unimplemented/delegate_resignation/deserializer.c @@ -0,0 +1,308 @@ + +//////////////////////////////////////////////////////////////////////////////// + +// The Following are only examples and places where this code could be implemented. +// It is not final or guaranteed working. +// This should only serve as a reference for implementing. + +//////////////////////////////////////////////////////////////////////////////// + +/******************************************************************************* + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + ******************************************************************************/ + +// #include "transactions/deserializer.h" + +// #include +// #include +// #include +// #include + +// #include "constants.h" + +// #include "transactions/transaction.h" + +// #include "transactions/offsets.h" +// #include "transactions/types/types.h" + +// #include "transactions/legacy/deserialize_legacy.h" +// #include "transactions/legacy/display_legacy.h" + +// #include "utils/unpack.h" +// #include "utils/utils.h" + +// #include "transactions/ux/display_ux.h" + +// //////////////////////////////////////////////////////////////////////////////// +// Transaction transaction; + +// //////////////////////////////////////////////////////////////////////////////// +// // Deserialize Common +// // +// // @param Transaction *transaction: A Transaction object. +// // @param uint8_t *buffer: The serialized transactions buffer. +// // +// // --- +// // Internals: +// // +// // Header - 1 Byte: +// // - 0xFF Marker: buffer[0] +// // +// // Transaction Version - 1 Byte: +// // - transaction->version = buffer[1]; +// // +// // Network Version - 1 Byte: +// // - transaction->network = buffer[2]; +// // +// // TypeGroup - 4 Bytes: Not Currently Needed +// // - transaction->typeGroup = U4LE(&buffer[3]); +// // +// // Transaction Type - 2 Bytes: +// // - transaction->type = U2LE(&buffer[7]); +// // +// // Nonce - 8 Bytes: Not Currently Needed +// // - transaction->nonce = U8LE(&buffer[9]); +// // +// // SenderPublicKey - 33 Bytes: +// // - bytecpy(transaction->senderPublicKey, &buffer[17], 33); +// // +// // Fee - 8 bytes +// // - transaction->fee = U8LE(buffer, 50); +// // +// // VendorField Length - 1 Byte: +// // transaction->vendorFieldLength = buffer[58]; +// // +// // VendorField - 0 - 64 Bytes: +// // - transaction->vendorField = (uint8_t *)&buffer[59]; +// // +// // --- +// static void deserializeCommon(Transaction *transaction, const uint8_t *buffer) { +// transaction->header = buffer[HEADER_OFFSET]; // 1 Byte +// transaction->version = buffer[VERSION_OFFSET]; // 1 Byte +// transaction->network = buffer[NETWORK_OFFSET]; // 1 Byte +// transaction->type = U2LE(buffer, TYPE_OFFSET); // 2 Bytes + +// bytecpy(transaction->senderPublicKey, // 33 Bytes +// &buffer[SENDER_PUBLICKEY_OFFSET], +// PUBLICKEY_COMPRESSED_LEN); + +// transaction->fee = U8LE(buffer, FEE_OFFSET); // 8 Bytes + +// transaction->vendorFieldLength = buffer[VF_LEN_OFFSET]; // 1 Byte +// // 0 <=> 64 Bytes +// transaction->vendorField = (uint8_t *)&buffer[VF_OFFSET]; +// } + +// //////////////////////////////////////////////////////////////////////////////// +// // Deserialize Common v1 +// // +// // @param TransactionData *data: The Transaction Data destination. +// // @param const uint8_t *buffer +// // +// // --- +// // Internals: +// // +// // Header - 1 Byte: +// // - data->header = buffer.at(0); +// // +// // Transaction Version - 1 Byte: +// // - data->version = buffer.at(1); +// // +// // Network Version - 1 Byte: +// // - data->network = buffer.at(2); +// // +// // Transaction Type - 1 Byte: +// // - data->type = buffer.at(3); +// // +// // Timestamp - 4 Bytes: Not Currently Needed +// // - data->timestamp = unpack4LE(buffer, 4); +// // +// // SenderPublicKey - 33 Bytes: +// // - std::copy_n(&buffer.at(8), 33, data->senderPublicKey.begin()); +// // +// // Fee - 8 bytes +// // - data->fee = unpack8LE(buffer, 41); +// // +// // VendorField Length - 1 Byte: +// // - buffer.at(49) +// // +// // VendorField - 0 - 255 Bytes: +// // - data->vendorField.insert(data->vendorField.begin(), &buffer.at(50), &buffer.at(50 + buffer.at(49))); +// // +// // --- +// static void deserializeCommonV1(Transaction *transaction, +// const uint8_t *buffer) { +// transaction->header = buffer[HEADER_OFFSET]; // 1 Byte +// transaction->version = buffer[VERSION_OFFSET]; // 1 Byte +// transaction->network = buffer[NETWORK_OFFSET]; // 1 Byte +// transaction->type = buffer[TYPE_OFFSET_V1]; // 1 Byte + +// bytecpy(transaction->senderPublicKey, // 33 Bytes +// &buffer[SENDER_PUBLICKEY_OFFSET_V1], +// PUBLICKEY_COMPRESSED_LEN); + +// transaction->fee = U8LE(buffer, FEE_OFFSET_V1); // 8 Bytes + +// transaction->vendorFieldLength = buffer[VF_LEN_OFFSET_V1]; // 1 Byte +// // vendorField: 0 <=> 64 Bytes +// transaction->vendorField = (uint8_t *)&buffer[VF_OFFSET_V1]; +// } + +// //////////////////////////////////////////////////////////////////////////////// +// // Deserialize Asset +// // +// // @param Transaction *transaction +// // @param uint8_t *buffer: The serialized buffer at the asset offset. +// // @param size_t size: The Asset Buffer Size. +// // +// // @return bool: true if successful +// // +// // --- +// // Internals: +// // +// // - case TRANSFER +// // - case SECOND_SIGNATURE +// - case VOTE +// // - case IPFS +// // - case HTLC_LOCK +// // - case HTLC_CLAIM +// // - case HTLC_REFUND +// // +// // --- +// static bool deserializeAsset(Transaction *transaction, +// const uint8_t *buffer, +// size_t size) { +// switch (transaction->type) { +// // Transfer +// case TRANSFER_TYPE: +// return deserializeTransfer( +// &transaction->asset.transfer, buffer, size); + +// // Second Signature Registration +// case SECOND_SIGNATURE_TYPE: +// return deserializeSecondSignature( +// &transaction->asset.secondSignature, buffer, size); + +// // Vote +// case VOTE_TYPE: +// return deserializeVote( +// &transaction->asset.vote, buffer, size); + +// // Ipfs +// case IPFS_TYPE: +// return deserializeIpfs( +// &transaction->asset.ipfs, buffer, size); + + // Delegate Registration + case DELEGATE_RESIGNATION_TYPE: + return deserializeDelegateResignation( + &transaction->asset.delegateResignation, buffer, size); + +// // Htlc Lock +// case HTLC_LOCK_TYPE: +// return deserializeHtlcLock( +// &transaction->asset.htlcLock, buffer, size); + +// // Htlc Claim +// case HTLC_CLAIM_TYPE: +// return deserializeHtlcClaim( +// &transaction->asset.htlcClaim, buffer, size); + +// // Htlc Refund +// case HTLC_REFUND_TYPE: +// return deserializeHtlcRefund( +// &transaction->asset.htlcRefund, buffer, size); + +// // Unknown Transaction Type +// default: return false; +// }; +// } + +// //////////////////////////////////////////////////////////////////////////////// +// // v2 and v1 Transactions +// static bool internalDeserialize(Transaction *transaction, +// const uint8_t *buffer, +// size_t size) { +// size_t assetOffset = 0; +// switch (buffer[VERSION_OFFSET]) { +// // v2 +// case TRANSACTION_VERSION_TYPE_2: +// deserializeCommon(transaction, buffer); +// assetOffset = VF_OFFSET + transaction->vendorFieldLength; +// break; + +// // v1 +// case TRANSACTION_VERSION_TYPE_1: +// deserializeCommonV1(transaction, buffer); +// assetOffset = VF_OFFSET_V1 + transaction->vendorFieldLength; +// break; + +// default: return false; +// } + +// if (deserializeAsset(transaction, +// &buffer[assetOffset], +// size - assetOffset)) { +// setDisplay(transaction); +// return true; +// } + +// // Unknown Transaction Version +// return false; +// } + +// //////////////////////////////////////////////////////////////////////////////// +// // Legacy Transactions +// static bool internalDeserializeLegacy(Transaction *transaction, +// const uint8_t *buffer, +// size_t size) { +// if (buffer[HEADER_OFFSET] == TRANSFER_TYPE || +// buffer[HEADER_OFFSET] == VOTE_TYPE) { +// deserializeCommonLegacy(transaction, buffer, size); + +// transaction->assetOffset = ASSET_OFFSET_LEGACY; +// transaction->assetPtr = (uint8_t*)&buffer[transaction->assetOffset]; + +// setDisplayLegacy(transaction); + +// return true; +// } + +// // Unknown Transaction Version and Type +// return false; +// } + +// //////////////////////////////////////////////////////////////////////////////// +// bool deserialize(const uint8_t *buffer, size_t size) { +// bool successful = buffer[HEADER_OFFSET] == TRANSACTION_HEADER +// ? internalDeserialize(&transaction, buffer, size) +// : internalDeserializeLegacy(&transaction, buffer, size); + +// if (!successful) { +// explicit_bzero(&transaction, sizeof(transaction)); +// } + +// return successful; +// } diff --git a/docs/unimplemented/delegate_resignation/display_ux.c b/docs/unimplemented/delegate_resignation/display_ux.c new file mode 100644 index 00000000..565a57a2 --- /dev/null +++ b/docs/unimplemented/delegate_resignation/display_ux.c @@ -0,0 +1,111 @@ + +//////////////////////////////////////////////////////////////////////////////// + +// The Following are only examples and places where this code could be implemented. +// It is not final or guaranteed working. +// This should only serve as a reference for implementing. + +//////////////////////////////////////////////////////////////////////////////// + +/******************************************************************************* + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + ******************************************************************************/ + +#include "transactions/ux/display_ux.h" + +// #include +// #include + +// #include "transactions/transaction.h" + +// #include "transactions/types/types.h" + +// #include "transactions/ux/transfer_ux.h" +// #include "transactions/ux/second_signature_ux.h" +// #include "transactions/ux/vote_ux.h" +// #include "transactions/ux/ipfs_ux.h" +#include "transactions/ux/delegate_resignation_ux.h" +// #include "transactions/ux/htlc_lock_ux.h" +// #include "transactions/ux/htlc_claim_ux.h" +// #include "transactions/ux/htlc_refund_ux.h" + +// #include "display/context.h" +// #include "display/display.h" + +// //////////////////////////////////////////////////////////////////////////////// +// extern void setDisplaySteps(uint8_t steps, bool isExtended); + +// //////////////////////////////////////////////////////////////////////////////// +// void setDisplay(const Transaction *transaction) { +// explicit_bzero(&displayCtx, sizeof(displayCtx)); + +// switch (transaction->type) { +// case TRANSFER_TYPE: +// displayTransfer(transaction); +// bool hasVendorField = transaction->vendorFieldLength > 0; +// setDisplaySteps(STEPS_TRANSFER_MIN + (uint8_t)hasVendorField, +// hasVendorField); +// break; + +// case SECOND_SIGNATURE_TYPE: +// displaySecondSignature(transaction); +// setDisplaySteps(STEPS_SECOND_SIGNATURE, false); +// break; + +// case VOTE_TYPE: +// displayVote(transaction); +// setDisplaySteps(STEPS_VOTE, false); +// break; + +// case IPFS_TYPE: +// displayIpfs(transaction); +// setDisplaySteps(STEPS_IPFS, true); +// break; + + case DELEGATE_RESIGNATION_TYPE: + displayDelegateResignation(transaction); + setDisplaySteps(STEPS_DELEGATE_RESIGNATION, false); + break; + +// case HTLC_LOCK_TYPE: +// displayHtlcLock(transaction); +// bool hasVendorField = transaction->vendorFieldLength > 0; +// setDisplaySteps(STEPS_HTLC_LOCK_MIN + (uint8_t)hasVendorField, +// hasVendorField); +// break; + +// case HTLC_CLAIM_TYPE: +// displayHtlcClaim(transaction); +// setDisplaySteps(STEPS_HTLC_CLAIM, false); +// break; + +// case HTLC_REFUND_TYPE: +// displayHtlcRefund(transaction); +// setDisplaySteps(STEPS_HTLC_REFUND, false); +// break; + +// default: break; +// }; +// } diff --git a/docs/unimplemented/multi_payment/assets.h b/docs/unimplemented/multi_payment/assets.h new file mode 100644 index 00000000..3e15b6ef --- /dev/null +++ b/docs/unimplemented/multi_payment/assets.h @@ -0,0 +1,66 @@ + +//////////////////////////////////////////////////////////////////////////////// + +// The Following are only examples and places where this code could be implemented. +// It is not final or guaranteed working. +// This should only serve as a reference for implementing. + +//////////////////////////////////////////////////////////////////////////////// + +/******************************************************************************* + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + ******************************************************************************/ + +#ifndef ARK_OPERATIONS_TRANSACTIONS_TYPES_ASSETS_H +#define ARK_OPERATIONS_TRANSACTIONS_TYPES_ASSETS_H + +#include "transactions/types/transfer.h" +#include "transactions/types/second_signature.h" +/* #include "transactions/types/delegate_registration.h" */ +#include "transactions/types/vote.h" +/* #include "transactions/types/multi_signature.h" */ +#include "transactions/types/ipfs.h" +#include "transactions/types/multi_payment.h" +/* #include "transactions/types/delegate_resignation.h" */ +#include "transactions/types/htlc_lock.h" +#include "transactions/types/htlc_claim.h" +#include "transactions/types/htlc_refund.h" + +//////////////////////////////////////////////////////////////////////////////// +typedef union tx_asset_t { + Transfer transfer; // Type 0 + SecondSignatureRegistration secondSignature; // Type 1 +/* DelegateRegistration // Type 2 */ + Vote vote; // Type 3 +/* MultiSignature // Type 4 */ + Ipfs ipfs; // Type 5 + MultiPayment multiPayment // Type 6 +/* DelegateResignation // Type 7 */ + HtlcLock htlcLock; // Type 8 + HtlcClaim htlcClaim; // Type 9 + HtlcRefund htlcRefund; // Type 10 +} tx_asset_t; + +#endif // #define ARK_OPERATIONS_TRANSACTIONS_TYPES_ASSETS_H diff --git a/docs/unimplemented/multi_payment/deserializer.c b/docs/unimplemented/multi_payment/deserializer.c new file mode 100644 index 00000000..83dce0a4 --- /dev/null +++ b/docs/unimplemented/multi_payment/deserializer.c @@ -0,0 +1,308 @@ + +//////////////////////////////////////////////////////////////////////////////// + +// The Following are only examples and places where this code could be implemented. +// It is not final or guaranteed working. +// This should only serve as a reference for implementing. + +//////////////////////////////////////////////////////////////////////////////// + +/******************************************************************************* + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + ******************************************************************************/ + +// #include "transactions/deserializer.h" + +// #include +// #include +// #include +// #include + +// #include "constants.h" + +// #include "transactions/transaction.h" + +// #include "transactions/offsets.h" +// #include "transactions/types/types.h" + +// #include "transactions/legacy/deserialize_legacy.h" +// #include "transactions/legacy/display_legacy.h" + +// #include "utils/unpack.h" +// #include "utils/utils.h" + +// #include "transactions/ux/display_ux.h" + +// //////////////////////////////////////////////////////////////////////////////// +// Transaction transaction; + +// //////////////////////////////////////////////////////////////////////////////// +// // Deserialize Common +// // +// // @param Transaction *transaction: A Transaction object. +// // @param uint8_t *buffer: The serialized transactions buffer. +// // +// // --- +// // Internals: +// // +// // Header - 1 Byte: +// // - 0xFF Marker: buffer[0] +// // +// // Transaction Version - 1 Byte: +// // - transaction->version = buffer[1]; +// // +// // Network Version - 1 Byte: +// // - transaction->network = buffer[2]; +// // +// // TypeGroup - 4 Bytes: Not Currently Needed +// // - transaction->typeGroup = U4LE(&buffer[3]); +// // +// // Transaction Type - 2 Bytes: +// // - transaction->type = U2LE(&buffer[7]); +// // +// // Nonce - 8 Bytes: Not Currently Needed +// // - transaction->nonce = U8LE(&buffer[9]); +// // +// // SenderPublicKey - 33 Bytes: +// // - bytecpy(transaction->senderPublicKey, &buffer[17], 33); +// // +// // Fee - 8 bytes +// // - transaction->fee = U8LE(buffer, 50); +// // +// // VendorField Length - 1 Byte: +// // transaction->vendorFieldLength = buffer[58]; +// // +// // VendorField - 0 - 64 Bytes: +// // - transaction->vendorField = (uint8_t *)&buffer[59]; +// // +// // --- +// static void deserializeCommon(Transaction *transaction, const uint8_t *buffer) { +// transaction->header = buffer[HEADER_OFFSET]; // 1 Byte +// transaction->version = buffer[VERSION_OFFSET]; // 1 Byte +// transaction->network = buffer[NETWORK_OFFSET]; // 1 Byte +// transaction->type = U2LE(buffer, TYPE_OFFSET); // 2 Bytes + +// bytecpy(transaction->senderPublicKey, // 33 Bytes +// &buffer[SENDER_PUBLICKEY_OFFSET], +// PUBLICKEY_COMPRESSED_LEN); + +// transaction->fee = U8LE(buffer, FEE_OFFSET); // 8 Bytes + +// transaction->vendorFieldLength = buffer[VF_LEN_OFFSET]; // 1 Byte +// // 0 <=> 64 Bytes +// transaction->vendorField = (uint8_t *)&buffer[VF_OFFSET]; +// } + +// //////////////////////////////////////////////////////////////////////////////// +// // Deserialize Common v1 +// // +// // @param TransactionData *data: The Transaction Data destination. +// // @param const uint8_t *buffer +// // +// // --- +// // Internals: +// // +// // Header - 1 Byte: +// // - data->header = buffer.at(0); +// // +// // Transaction Version - 1 Byte: +// // - data->version = buffer.at(1); +// // +// // Network Version - 1 Byte: +// // - data->network = buffer.at(2); +// // +// // Transaction Type - 1 Byte: +// // - data->type = buffer.at(3); +// // +// // Timestamp - 4 Bytes: Not Currently Needed +// // - data->timestamp = unpack4LE(buffer, 4); +// // +// // SenderPublicKey - 33 Bytes: +// // - std::copy_n(&buffer.at(8), 33, data->senderPublicKey.begin()); +// // +// // Fee - 8 bytes +// // - data->fee = unpack8LE(buffer, 41); +// // +// // VendorField Length - 1 Byte: +// // - buffer.at(49) +// // +// // VendorField - 0 - 255 Bytes: +// // - data->vendorField.insert(data->vendorField.begin(), &buffer.at(50), &buffer.at(50 + buffer.at(49))); +// // +// // --- +// static void deserializeCommonV1(Transaction *transaction, +// const uint8_t *buffer) { +// transaction->header = buffer[HEADER_OFFSET]; // 1 Byte +// transaction->version = buffer[VERSION_OFFSET]; // 1 Byte +// transaction->network = buffer[NETWORK_OFFSET]; // 1 Byte +// transaction->type = buffer[TYPE_OFFSET_V1]; // 1 Byte + +// bytecpy(transaction->senderPublicKey, // 33 Bytes +// &buffer[SENDER_PUBLICKEY_OFFSET_V1], +// PUBLICKEY_COMPRESSED_LEN); + +// transaction->fee = U8LE(buffer, FEE_OFFSET_V1); // 8 Bytes + +// transaction->vendorFieldLength = buffer[VF_LEN_OFFSET_V1]; // 1 Byte +// // vendorField: 0 <=> 64 Bytes +// transaction->vendorField = (uint8_t *)&buffer[VF_OFFSET_V1]; +// } + +// //////////////////////////////////////////////////////////////////////////////// +// // Deserialize Asset +// // +// // @param Transaction *transaction +// // @param uint8_t *buffer: The serialized buffer at the asset offset. +// // @param size_t size: The Asset Buffer Size. +// // +// // @return bool: true if successful +// // +// // --- +// // Internals: +// // +// // - case TRANSFER +// // - case SECOND_SIGNATURE +// - case VOTE +// // - case IPFS +// // - case HTLC_LOCK +// // - case HTLC_CLAIM +// // - case HTLC_REFUND +// // +// // --- +// static bool deserializeAsset(Transaction *transaction, +// const uint8_t *buffer, +// size_t size) { +// switch (transaction->type) { +// // Transfer +// case TRANSFER_TYPE: +// return deserializeTransfer( +// &transaction->asset.transfer, buffer, size); + +// // Second Signature Registration +// case SECOND_SIGNATURE_TYPE: +// return deserializeSecondSignature( +// &transaction->asset.secondSignature, buffer, size); + +// // Vote +// case VOTE_TYPE: +// return deserializeVote( +// &transaction->asset.vote, buffer, size); + +// // Ipfs +// case IPFS_TYPE: +// return deserializeIpfs( +// &transaction->asset.ipfs, buffer, size); + + // Delegate Registration + case MULTI_PAYMENT_TYPE: + return deserializeMultiPayment( + &transaction->asset.multiPayment, buffer, size); + +// // Htlc Lock +// case HTLC_LOCK_TYPE: +// return deserializeHtlcLock( +// &transaction->asset.htlcLock, buffer, size); + +// // Htlc Claim +// case HTLC_CLAIM_TYPE: +// return deserializeHtlcClaim( +// &transaction->asset.htlcClaim, buffer, size); + +// // Htlc Refund +// case HTLC_REFUND_TYPE: +// return deserializeHtlcRefund( +// &transaction->asset.htlcRefund, buffer, size); + +// // Unknown Transaction Type +// default: return false; +// }; +// } + +// //////////////////////////////////////////////////////////////////////////////// +// // v2 and v1 Transactions +// static bool internalDeserialize(Transaction *transaction, +// const uint8_t *buffer, +// size_t size) { +// size_t assetOffset = 0; +// switch (buffer[VERSION_OFFSET]) { +// // v2 +// case TRANSACTION_VERSION_TYPE_2: +// deserializeCommon(transaction, buffer); +// assetOffset = VF_OFFSET + transaction->vendorFieldLength; +// break; + +// // v1 +// case TRANSACTION_VERSION_TYPE_1: +// deserializeCommonV1(transaction, buffer); +// assetOffset = VF_OFFSET_V1 + transaction->vendorFieldLength; +// break; + +// default: return false; +// } + +// if (deserializeAsset(transaction, +// &buffer[assetOffset], +// size - assetOffset)) { +// setDisplay(transaction); +// return true; +// } + +// // Unknown Transaction Version +// return false; +// } + +// //////////////////////////////////////////////////////////////////////////////// +// // Legacy Transactions +// static bool internalDeserializeLegacy(Transaction *transaction, +// const uint8_t *buffer, +// size_t size) { +// if (buffer[HEADER_OFFSET] == TRANSFER_TYPE || +// buffer[HEADER_OFFSET] == VOTE_TYPE) { +// deserializeCommonLegacy(transaction, buffer, size); + +// transaction->assetOffset = ASSET_OFFSET_LEGACY; +// transaction->assetPtr = (uint8_t*)&buffer[transaction->assetOffset]; + +// setDisplayLegacy(transaction); + +// return true; +// } + +// // Unknown Transaction Version and Type +// return false; +// } + +// //////////////////////////////////////////////////////////////////////////////// +// bool deserialize(const uint8_t *buffer, size_t size) { +// bool successful = buffer[HEADER_OFFSET] == TRANSACTION_HEADER +// ? internalDeserialize(&transaction, buffer, size) +// : internalDeserializeLegacy(&transaction, buffer, size); + +// if (!successful) { +// explicit_bzero(&transaction, sizeof(transaction)); +// } + +// return successful; +// } diff --git a/docs/unimplemented/multi_payment/display_ux.c b/docs/unimplemented/multi_payment/display_ux.c new file mode 100644 index 00000000..da0c86a1 --- /dev/null +++ b/docs/unimplemented/multi_payment/display_ux.c @@ -0,0 +1,113 @@ + + +//////////////////////////////////////////////////////////////////////////////// + +// The Following are only examples and places where this code could be implemented. +// It is not final or guaranteed working. +// This should only serve as a reference for implementing. + +//////////////////////////////////////////////////////////////////////////////// + +/******************************************************************************* + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + ******************************************************************************/ + +#include "transactions/ux/display_ux.h" + +// #include +// #include + +// #include "transactions/transaction.h" + +// #include "transactions/types/types.h" + +// #include "transactions/ux/transfer_ux.h" +// #include "transactions/ux/second_signature_ux.h" +// #include "transactions/ux/vote_ux.h" +// #include "transactions/ux/ipfs_ux.h" +#include "transactions/ux/multi_payment.h" +// #include "transactions/ux/htlc_lock_ux.h" +// #include "transactions/ux/htlc_claim_ux.h" +// #include "transactions/ux/htlc_refund_ux.h" + +// #include "display/context.h" +// #include "display/display.h" + +// //////////////////////////////////////////////////////////////////////////////// +// extern void setDisplaySteps(uint8_t steps, bool isExtended); + +// //////////////////////////////////////////////////////////////////////////////// +// void setDisplay(const Transaction *transaction) { +// explicit_bzero(&displayCtx, sizeof(displayCtx)); + +// switch (transaction->type) { +// case TRANSFER_TYPE: +// displayTransfer(transaction); +// bool hasVendorField = transaction->vendorFieldLength > 0; +// setDisplaySteps(STEPS_TRANSFER_MIN + (uint8_t)hasVendorField, +// hasVendorField); +// break; + +// case SECOND_SIGNATURE_TYPE: +// displaySecondSignature(transaction); +// setDisplaySteps(STEPS_SECOND_SIGNATURE, false); +// break; + +// case VOTE_TYPE: +// displayVote(transaction); +// setDisplaySteps(STEPS_VOTE, false); +// break; + +// case IPFS_TYPE: +// displayIpfs(transaction); +// setDisplaySteps(STEPS_IPFS, true); +// break; + + case MULTI_PAYMENT_TYPE: + displayMultiPayment(transaction); + size_t n_payments = transaction->asset.multipayment.n_payments; + setDisplaySteps(STEPS_MULTI_PAYMENT_MIN + n_payments, true); + break; + +// case HTLC_LOCK_TYPE: +// displayHtlcLock(transaction); +// bool hasVendorField = transaction->vendorFieldLength > 0; +// setDisplaySteps(STEPS_HTLC_LOCK_MIN + (uint8_t)hasVendorField, +// hasVendorField); +// break; + +// case HTLC_CLAIM_TYPE: +// displayHtlcClaim(transaction); +// setDisplaySteps(STEPS_HTLC_CLAIM, false); +// break; + +// case HTLC_REFUND_TYPE: +// displayHtlcRefund(transaction); +// setDisplaySteps(STEPS_HTLC_REFUND, false); +// break; + +// default: break; +// }; +// } diff --git a/docs/unimplemented/multi_payment/multi_payment.c b/docs/unimplemented/multi_payment/multi_payment.c new file mode 100644 index 00000000..6d13309d --- /dev/null +++ b/docs/unimplemented/multi_payment/multi_payment.c @@ -0,0 +1,84 @@ + +//////////////////////////////////////////////////////////////////////////////// + +// The Following are only examples and places where this code could be implemented. +// It is not final or guaranteed working. +// This should only serve as a reference for implementing. + +//////////////////////////////////////////////////////////////////////////////// + +/******************************************************************************* + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + ******************************************************************************/ + +#include "transactions/types/multi_payment.h" + +#include +#include +#include + +#include "constants.h" + +#include "utils/utils.h" + +//////////////////////////////////////////////////////////////////////////////// +// +// Incomplete. Needs more consideration on safe logic behind displaying values. +// +// MultiPayment (Type 6) - 0 <=> 255 Bytes +// +// @param MultiPaymentAsset *multipayment: The MultiPayment (Type 6) Asset. +// @param uint8_t *buffer: The serialized buffer beginning at the Assets offset. +// @param uint32_t length: The Asset Length. +// +// --- +// Internals: +// +// Number of Payments - 2 Bytes: +// - payments->n_payments = U2BE(buffer, 0); +// +// Amounts[] - 8 Bytes * n_payments +// - payments->amounts[i] = U8LE(&buffer[sizeof(uint16_t) + (i * sizeof(uint64_t))], sizeof(uint64_t)) +// +// Addresses[] - 21 Bytes * n_payments +// - bytecpy(&payments->addresses[i * 21], &buffer[(sizeof(uint16_t) + (i * (sizeof(uint64_t) + 21))], 21); +// +// --- +bool deserializeMultiPayment(MultiPaymentAsset *payments, + const uint8_t *buffer, + const uint32_t length) { + payments->n_payments = U2BE(buffer, 0); + + for (uint8_t i = 0U; i < payments->n_payments; ++i) { + payments->amounts[i] = U8LE(&buffer[sizeof(uint16_t) + i * sizeof(uint64_t)], + sizeof(uint64_t)); + + bytecpy(&payments->addresses[i * ADDRESS_HASH_LEN], + &buffer[sizeof(uint16_t) + payments->n_payments * sizeof(uint64_t) + i * ADDRESS_HASH_LEN], + ADDRESS_HASH_LEN); + } + + return true; +} diff --git a/docs/unimplemented/multi_payment/multi_payment.h b/docs/unimplemented/multi_payment/multi_payment.h new file mode 100644 index 00000000..553e1bea --- /dev/null +++ b/docs/unimplemented/multi_payment/multi_payment.h @@ -0,0 +1,57 @@ + +//////////////////////////////////////////////////////////////////////////////// + +// The Following are only examples and places where this code could be implemented. +// It is not final or guaranteed working. +// This should only serve as a reference for implementing. + +//////////////////////////////////////////////////////////////////////////////// + +/******************************************************************************* + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + ******************************************************************************/ + +#ifndef ARK_OPERATIONS_TRANSACTIONS_TYPES_MULTI_PAYMENT_H +#define ARK_OPERATIONS_TRANSACTIONS_TYPES_MULTI_PAYMENT_H + +#include +#include +#include + +#include "constants.h" + +//////////////////////////////////////////////////////////////////////////////// +typedef struct multipayment_asset_t { + uint16_t n_payments; // 2,259 network max + uint8_t amounts[2259]; // payment(uint64_t) * n_payments + uint8_t addresses[47439]; // address[21] * n_payments +} MultiPayment; + +//////////////////////////////////////////////////////////////////////////////// +bool deserializeMultiPayment(MultiPayment *payments, + const uint8_t *buffer, + size_t length); + +#endif // #define ARK_OPERATIONS_TRANSACTIONS_TYPES_MULTI_PAYMENT_H diff --git a/docs/unimplemented/multi_payment/multi_payment_ux.c b/docs/unimplemented/multi_payment/multi_payment_ux.c new file mode 100644 index 00000000..c526f23c --- /dev/null +++ b/docs/unimplemented/multi_payment/multi_payment_ux.c @@ -0,0 +1,76 @@ + +//////////////////////////////////////////////////////////////////////////////// + +// The Following are only examples and places where this code could be implemented. +// It is not final or guaranteed working. +// This should only serve as a reference for implementing. + +//////////////////////////////////////////////////////////////////////////////// + +/******************************************************************************* + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + ******************************************************************************/ + +#include "transactions/ux/multi_payment_ux.h" + +#include +#include + +#include "constants.h" + +#include "operations/transactions/transaction.h" + +#include "utils/print.h" +#include "utils/utils.h" + +#include "display/context.h" + +//////////////////////////////////////////////////////////////////////////////// +// +// Incomplete. Needs more consideration on safe logic behind displaying values. +// +void displayMultiPayment(const Transaction *transaction) { + const char *const LABEL = "MultiPayment"; + const size_t LABEL_SIZE = 13; + + const char *const LABEL_COUNT = "Payment Count"; + const size_t LABEL_COUNT_SIZE = 14; + + const char *const LABEL_TOTAL_AMOUNT = "Total Amount"; + const size_t LABEL_TOTAL_AMOUNT_SIZE = 13; + + bytecpy((char *)displayCtx.operation, LABEL, + LABEL_SIZE); + bytecpy((char *)displayCtx.title[0], LABEL_COUNT, + LABEL_COUNT_SIZE); + bytecpy((char *)displayCtx.title[1], LABEL_TOTAL_AMOUNT, + LABEL_TOTAL_AMOUNT_SIZE); + bytecpy((char *)displayCtx.title[2], LABEL_FEE, + LABEL_FEE_SIZE); + + // Payment Count + + // Total Amount +} diff --git a/docs/unimplemented/multi_payment/multi_payment_ux.h b/docs/unimplemented/multi_payment/multi_payment_ux.h new file mode 100644 index 00000000..c50cc6eb --- /dev/null +++ b/docs/unimplemented/multi_payment/multi_payment_ux.h @@ -0,0 +1,49 @@ + +//////////////////////////////////////////////////////////////////////////////// + +// The Following are only examples and places where this code could be implemented. +// It is not final or guaranteed working. +// This should only serve as a reference for implementing. + +//////////////////////////////////////////////////////////////////////////////// + +/******************************************************************************* + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + ******************************************************************************/ + +#ifndef ARK_OPERATIONS_TRANSACTIONS_UX_MULTI_PAYMENT_UX_H +#define ARK_OPERATIONS_TRANSACTIONS_UX_MULTI_PAYMENT_UX_H + +#include + +#include "operations/transactions/transaction.h" + +//////////////////////////////////////////////////////////////////////////////// +static const uint8_t STEPS_MULTI_PAYMENT_MIN = 2U; + +//////////////////////////////////////////////////////////////////////////////// +void displayMultiPayment(const Transaction *transaction); + +#endif // #define ARK_OPERATIONS_TRANSACTIONS_UX_MULTI_PAYMENT_UX_H diff --git a/docs/unimplemented/multi_payment/types.h b/docs/unimplemented/multi_payment/types.h new file mode 100644 index 00000000..9d04cc2d --- /dev/null +++ b/docs/unimplemented/multi_payment/types.h @@ -0,0 +1,55 @@ + +//////////////////////////////////////////////////////////////////////////////// + +// The Following are only examples and places where this code could be implemented. +// It is not final or guaranteed working. +// This should only serve as a reference for implementing. + +//////////////////////////////////////////////////////////////////////////////// + +/******************************************************************************* + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + ******************************************************************************/ + +#ifndef ARK_OPERATIONS_TRANSACTIONS_ASSETS_TYPES_H +#define ARK_OPERATIONS_TRANSACTIONS_ASSETS_TYPES_H + +//////////////////////////////////////////////////////////////////////////////// +// ARK Transaction Types +enum TransactionTypes { + TRANSFER_TYPE = 0, + SECOND_SIGNATURE_TYPE = 1, +/* DELEGATE_REGISTRATION_TYPE = 2, */ + VOTE_TYPE = 3, +/* MULTI_SIGNATURE_TYPE = 4, */ + IPFS_TYPE = 5, + MULTI_PAYMENT_TYPE = 6, +/* DELEGATE_RESIGNATION_TYPE = 7, */ + HTLC_LOCK_TYPE = 8, + HTLC_CLAIM_TYPE = 9, + HTLC_REFUND_TYPE = 10 +}; + +#endif // #define ARK_OPERATIONS_TRANSACTIONS_ASSETS_TYPES_H diff --git a/docs/unimplemented/multi_signature/assets.h b/docs/unimplemented/multi_signature/assets.h new file mode 100644 index 00000000..4c54ed3d --- /dev/null +++ b/docs/unimplemented/multi_signature/assets.h @@ -0,0 +1,66 @@ + +//////////////////////////////////////////////////////////////////////////////// + +// The Following are only examples and places where this code could be implemented. +// It is not final or guaranteed working. +// This should only serve as a reference for implementing. + +//////////////////////////////////////////////////////////////////////////////// + +/******************************************************************************* + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + ******************************************************************************/ + +#ifndef ARK_OPERATIONS_TRANSACTIONS_TYPES_ASSETS_H +#define ARK_OPERATIONS_TRANSACTIONS_TYPES_ASSETS_H + +#include "transactions/types/transfer.h" +#include "transactions/types/second_signature.h" +/* #include "transactions/types/delegate_registration.h" */ +#include "transactions/types/vote.h" +#include "transactions/types/multi_signature.h" +#include "transactions/types/ipfs.h" +/* #include "transactions/types/multi_payment.h" */ +/* #include "transactions/types/delegate_resignation.h" */ +#include "transactions/types/htlc_lock.h" +#include "transactions/types/htlc_claim.h" +#include "transactions/types/htlc_refund.h" + +//////////////////////////////////////////////////////////////////////////////// +typedef union tx_asset_t { + Transfer transfer; // Type 0 + SecondSignatureRegistration secondSignature; // Type 1 +/* DelegateRegistration // Type 2 */ + Vote vote; // Type 3 + MultiSignature multiSignature // Type 4 + Ipfs ipfs; // Type 5 +/* MultiPayment // Type 6 */ +/* DelegateResignation // Type 7 */ + HtlcLock htlcLock; // Type 8 + HtlcClaim htlcClaim; // Type 9 + HtlcRefund htlcRefund; // Type 10 +} tx_asset_t; + +#endif // #define ARK_OPERATIONS_TRANSACTIONS_TYPES_ASSETS_H diff --git a/docs/unimplemented/multi_signature/deserializer.c b/docs/unimplemented/multi_signature/deserializer.c new file mode 100644 index 00000000..feb9bd7b --- /dev/null +++ b/docs/unimplemented/multi_signature/deserializer.c @@ -0,0 +1,308 @@ + +//////////////////////////////////////////////////////////////////////////////// + +// The Following are only examples and places where this code could be implemented. +// It is not final or guaranteed working. +// This should only serve as a reference for implementing. + +//////////////////////////////////////////////////////////////////////////////// + +/******************************************************************************* + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + ******************************************************************************/ + +// #include "transactions/deserializer.h" + +// #include +// #include +// #include +// #include + +// #include "constants.h" + +// #include "transactions/transaction.h" + +// #include "transactions/offsets.h" +// #include "transactions/types/types.h" + +// #include "transactions/legacy/deserialize_legacy.h" +// #include "transactions/legacy/display_legacy.h" + +// #include "utils/unpack.h" +// #include "utils/utils.h" + +// #include "transactions/ux/display_ux.h" + +// //////////////////////////////////////////////////////////////////////////////// +// Transaction transaction; + +// //////////////////////////////////////////////////////////////////////////////// +// // Deserialize Common +// // +// // @param Transaction *transaction: A Transaction object. +// // @param uint8_t *buffer: The serialized transactions buffer. +// // +// // --- +// // Internals: +// // +// // Header - 1 Byte: +// // - 0xFF Marker: buffer[0] +// // +// // Transaction Version - 1 Byte: +// // - transaction->version = buffer[1]; +// // +// // Network Version - 1 Byte: +// // - transaction->network = buffer[2]; +// // +// // TypeGroup - 4 Bytes: Not Currently Needed +// // - transaction->typeGroup = U4LE(&buffer[3]); +// // +// // Transaction Type - 2 Bytes: +// // - transaction->type = U2LE(&buffer[7]); +// // +// // Nonce - 8 Bytes: Not Currently Needed +// // - transaction->nonce = U8LE(&buffer[9]); +// // +// // SenderPublicKey - 33 Bytes: +// // - bytecpy(transaction->senderPublicKey, &buffer[17], 33); +// // +// // Fee - 8 bytes +// // - transaction->fee = U8LE(buffer, 50); +// // +// // VendorField Length - 1 Byte: +// // transaction->vendorFieldLength = buffer[58]; +// // +// // VendorField - 0 - 64 Bytes: +// // - transaction->vendorField = (uint8_t *)&buffer[59]; +// // +// // --- +// static void deserializeCommon(Transaction *transaction, const uint8_t *buffer) { +// transaction->header = buffer[HEADER_OFFSET]; // 1 Byte +// transaction->version = buffer[VERSION_OFFSET]; // 1 Byte +// transaction->network = buffer[NETWORK_OFFSET]; // 1 Byte +// transaction->type = U2LE(buffer, TYPE_OFFSET); // 2 Bytes + +// bytecpy(transaction->senderPublicKey, // 33 Bytes +// &buffer[SENDER_PUBLICKEY_OFFSET], +// PUBLICKEY_COMPRESSED_LEN); + +// transaction->fee = U8LE(buffer, FEE_OFFSET); // 8 Bytes + +// transaction->vendorFieldLength = buffer[VF_LEN_OFFSET]; // 1 Byte +// // 0 <=> 64 Bytes +// transaction->vendorField = (uint8_t *)&buffer[VF_OFFSET]; +// } + +// //////////////////////////////////////////////////////////////////////////////// +// // Deserialize Common v1 +// // +// // @param TransactionData *data: The Transaction Data destination. +// // @param const uint8_t *buffer +// // +// // --- +// // Internals: +// // +// // Header - 1 Byte: +// // - data->header = buffer.at(0); +// // +// // Transaction Version - 1 Byte: +// // - data->version = buffer.at(1); +// // +// // Network Version - 1 Byte: +// // - data->network = buffer.at(2); +// // +// // Transaction Type - 1 Byte: +// // - data->type = buffer.at(3); +// // +// // Timestamp - 4 Bytes: Not Currently Needed +// // - data->timestamp = unpack4LE(buffer, 4); +// // +// // SenderPublicKey - 33 Bytes: +// // - std::copy_n(&buffer.at(8), 33, data->senderPublicKey.begin()); +// // +// // Fee - 8 bytes +// // - data->fee = unpack8LE(buffer, 41); +// // +// // VendorField Length - 1 Byte: +// // - buffer.at(49) +// // +// // VendorField - 0 - 255 Bytes: +// // - data->vendorField.insert(data->vendorField.begin(), &buffer.at(50), &buffer.at(50 + buffer.at(49))); +// // +// // --- +// static void deserializeCommonV1(Transaction *transaction, +// const uint8_t *buffer) { +// transaction->header = buffer[HEADER_OFFSET]; // 1 Byte +// transaction->version = buffer[VERSION_OFFSET]; // 1 Byte +// transaction->network = buffer[NETWORK_OFFSET]; // 1 Byte +// transaction->type = buffer[TYPE_OFFSET_V1]; // 1 Byte + +// bytecpy(transaction->senderPublicKey, // 33 Bytes +// &buffer[SENDER_PUBLICKEY_OFFSET_V1], +// PUBLICKEY_COMPRESSED_LEN); + +// transaction->fee = U8LE(buffer, FEE_OFFSET_V1); // 8 Bytes + +// transaction->vendorFieldLength = buffer[VF_LEN_OFFSET_V1]; // 1 Byte +// // vendorField: 0 <=> 64 Bytes +// transaction->vendorField = (uint8_t *)&buffer[VF_OFFSET_V1]; +// } + +// //////////////////////////////////////////////////////////////////////////////// +// // Deserialize Asset +// // +// // @param Transaction *transaction +// // @param uint8_t *buffer: The serialized buffer at the asset offset. +// // @param size_t size: The Asset Buffer Size. +// // +// // @return bool: true if successful +// // +// // --- +// // Internals: +// // +// // - case TRANSFER +// // - case SECOND_SIGNATURE +// - case VOTE +// // - case IPFS +// // - case HTLC_LOCK +// // - case HTLC_CLAIM +// // - case HTLC_REFUND +// // +// // --- +// static bool deserializeAsset(Transaction *transaction, +// const uint8_t *buffer, +// size_t size) { +// switch (transaction->type) { +// // Transfer +// case TRANSFER_TYPE: +// return deserializeTransfer( +// &transaction->asset.transfer, buffer, size); + +// // Second Signature Registration +// case SECOND_SIGNATURE_TYPE: +// return deserializeSecondSignature( +// &transaction->asset.secondSignature, buffer, size); + +// // Vote +// case VOTE_TYPE: +// return deserializeVote( +// &transaction->asset.vote, buffer, size); + + // Delegate Registration + case MULTI_SIGNATURE_TYPE: + return deserializeMultiSignature( + &transaction->asset.multiSignature, buffer, size); + +// // Ipfs +// case IPFS_TYPE: +// return deserializeIpfs( +// &transaction->asset.ipfs, buffer, size); + +// // Htlc Lock +// case HTLC_LOCK_TYPE: +// return deserializeHtlcLock( +// &transaction->asset.htlcLock, buffer, size); + +// // Htlc Claim +// case HTLC_CLAIM_TYPE: +// return deserializeHtlcClaim( +// &transaction->asset.htlcClaim, buffer, size); + +// // Htlc Refund +// case HTLC_REFUND_TYPE: +// return deserializeHtlcRefund( +// &transaction->asset.htlcRefund, buffer, size); + +// // Unknown Transaction Type +// default: return false; +// }; +// } + +// //////////////////////////////////////////////////////////////////////////////// +// // v2 and v1 Transactions +// static bool internalDeserialize(Transaction *transaction, +// const uint8_t *buffer, +// size_t size) { +// size_t assetOffset = 0; +// switch (buffer[VERSION_OFFSET]) { +// // v2 +// case TRANSACTION_VERSION_TYPE_2: +// deserializeCommon(transaction, buffer); +// assetOffset = VF_OFFSET + transaction->vendorFieldLength; +// break; + +// // v1 +// case TRANSACTION_VERSION_TYPE_1: +// deserializeCommonV1(transaction, buffer); +// assetOffset = VF_OFFSET_V1 + transaction->vendorFieldLength; +// break; + +// default: return false; +// } + +// if (deserializeAsset(transaction, +// &buffer[assetOffset], +// size - assetOffset)) { +// setDisplay(transaction); +// return true; +// } + +// // Unknown Transaction Version +// return false; +// } + +// //////////////////////////////////////////////////////////////////////////////// +// // Legacy Transactions +// static bool internalDeserializeLegacy(Transaction *transaction, +// const uint8_t *buffer, +// size_t size) { +// if (buffer[HEADER_OFFSET] == TRANSFER_TYPE || +// buffer[HEADER_OFFSET] == VOTE_TYPE) { +// deserializeCommonLegacy(transaction, buffer, size); + +// transaction->assetOffset = ASSET_OFFSET_LEGACY; +// transaction->assetPtr = (uint8_t*)&buffer[transaction->assetOffset]; + +// setDisplayLegacy(transaction); + +// return true; +// } + +// // Unknown Transaction Version and Type +// return false; +// } + +// //////////////////////////////////////////////////////////////////////////////// +// bool deserialize(const uint8_t *buffer, size_t size) { +// bool successful = buffer[HEADER_OFFSET] == TRANSACTION_HEADER +// ? internalDeserialize(&transaction, buffer, size) +// : internalDeserializeLegacy(&transaction, buffer, size); + +// if (!successful) { +// explicit_bzero(&transaction, sizeof(transaction)); +// } + +// return successful; +// } diff --git a/docs/unimplemented/multi_signature/display_ux.c b/docs/unimplemented/multi_signature/display_ux.c new file mode 100644 index 00000000..fbf665d8 --- /dev/null +++ b/docs/unimplemented/multi_signature/display_ux.c @@ -0,0 +1,113 @@ + + +//////////////////////////////////////////////////////////////////////////////// + +// The Following are only examples and places where this code could be implemented. +// It is not final or guaranteed working. +// This should only serve as a reference for implementing. + +//////////////////////////////////////////////////////////////////////////////// + +/******************************************************************************* + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + ******************************************************************************/ + +#include "transactions/ux/display_ux.h" + +// #include +// #include + +// #include "transactions/transaction.h" + +// #include "transactions/types/types.h" + +// #include "transactions/ux/transfer_ux.h" +// #include "transactions/ux/second_signature_ux.h" +// #include "transactions/ux/vote_ux.h" +#include "transactions/ux/multi_signature.h" +// #include "transactions/ux/ipfs_ux.h" +// #include "transactions/ux/htlc_lock_ux.h" +// #include "transactions/ux/htlc_claim_ux.h" +// #include "transactions/ux/htlc_refund_ux.h" + +// #include "display/context.h" +// #include "display/display.h" + +// //////////////////////////////////////////////////////////////////////////////// +// extern void setDisplaySteps(uint8_t steps, bool isExtended); + +// //////////////////////////////////////////////////////////////////////////////// +// void setDisplay(const Transaction *transaction) { +// explicit_bzero(&displayCtx, sizeof(displayCtx)); + +// switch (transaction->type) { +// case TRANSFER_TYPE: +// displayTransfer(transaction); +// bool hasVendorField = transaction->vendorFieldLength > 0; +// setDisplaySteps(STEPS_TRANSFER_MIN + (uint8_t)hasVendorField, +// hasVendorField); +// break; + +// case SECOND_SIGNATURE_TYPE: +// displaySecondSignature(transaction); +// setDisplaySteps(STEPS_SECOND_SIGNATURE, false); +// break; + +// case VOTE_TYPE: +// displayVote(transaction); +// setDisplaySteps(STEPS_VOTE, false); +// break; + + case MULTI_SIGNATURE_TYPE: + displayMultiSignature(transaction); + size_t n_signatures = transaction->asset.multiSignature.count; + setDisplaySteps(STEPS_MULTI_SIGNATURE_MIN + count, true); + break; + +// case IPFS_TYPE: +// displayIpfs(transaction); +// setDisplaySteps(STEPS_IPFS, true); +// break; + +// case HTLC_LOCK_TYPE: +// displayHtlcLock(transaction); +// bool hasVendorField = transaction->vendorFieldLength > 0; +// setDisplaySteps(STEPS_HTLC_LOCK_MIN + (uint8_t)hasVendorField, +// hasVendorField); +// break; + +// case HTLC_CLAIM_TYPE: +// displayHtlcClaim(transaction); +// setDisplaySteps(STEPS_HTLC_CLAIM, false); +// break; + +// case HTLC_REFUND_TYPE: +// displayHtlcRefund(transaction); +// setDisplaySteps(STEPS_HTLC_REFUND, false); +// break; + +// default: break; +// }; +// } diff --git a/docs/unimplemented/multi_signature/multi_signature.c b/docs/unimplemented/multi_signature/multi_signature.c new file mode 100644 index 00000000..b9eea6a1 --- /dev/null +++ b/docs/unimplemented/multi_signature/multi_signature.c @@ -0,0 +1,81 @@ + +//////////////////////////////////////////////////////////////////////////////// + +// The Following are only examples and places where this code could be implemented. +// It is not final or guaranteed working. +// This should only serve as a reference for implementing. + +//////////////////////////////////////////////////////////////////////////////// + +/******************************************************************************* + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + ******************************************************************************/ + +#include "transactions/types/multi_signature.h" + +#include +#include +#include + +#include "constants.h" + +#include "utils/utils.h" + +//////////////////////////////////////////////////////////////////////////////// +// +// Incomplete. Needs more consideration on safe logic behind displaying values. +// +// MultiSignature Registration (Type 4) +// +// @param MultiSignature *muSig: The MultiSignature (Type 4) Asset. +// @param uint8_t *buffer: The serialized buffer beginning at the Assets offset. +// @param uint32_t length: The Asset Length. +// +// --- +// Internals: +// +// Minimum Participants - 1 Byte: +// - multiSig->min = buffer[0]; +// +// Key Count +// - multiSig->count = buffer[1]; +// +// PublicKeys - 33N Bytes +// - bytecpy(&multiSig->keys[0], &buffer[2], multiSig->count); +// +// --- +bool deserializeMultiSignature(MultiSignature *multiSignature, + const uint8_t *buffer, + size_t length) { + if ((length % 34U) != 0) { + return false; + } + + multiSig->min = buffer[0]; + multiSig->count = buffer[1]; + bytecpy(&multiSig->keys[0], &buffer[2], multiSig->count); + + return true; +} diff --git a/docs/unimplemented/multi_signature/multi_signature.h b/docs/unimplemented/multi_signature/multi_signature.h new file mode 100644 index 00000000..bec2b9f0 --- /dev/null +++ b/docs/unimplemented/multi_signature/multi_signature.h @@ -0,0 +1,57 @@ + +//////////////////////////////////////////////////////////////////////////////// + +// The Following are only examples and places where this code could be implemented. +// It is not final or guaranteed working. +// This should only serve as a reference for implementing. + +//////////////////////////////////////////////////////////////////////////////// + +/******************************************************************************* + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + ******************************************************************************/ + +#ifndef ARK_OPERATIONS_TRANSACTIONS_TYPES_MULTI_SIGNATURE_H +#define ARK_OPERATIONS_TRANSACTIONS_TYPES_MULTI_SIGNATURE_H + +#include +#include +#include + +#include "constants.h" + +//////////////////////////////////////////////////////////////////////////////// +typedef struct multi_signature_asset_t { + uint8_t min; + uint8_t count; + uint8_t keys[528]; // 16 * 33 keys max +} MultiSignature; + +//////////////////////////////////////////////////////////////////////////////// +bool deserializeMultiSignature(MultiSignature *multiSignature, + const uint8_t *buffer, + size_t length); + +#endif // #define ARK_OPERATIONS_TRANSACTIONS_TYPES_MULTI_SIGNATURE_H diff --git a/docs/unimplemented/multi_signature/multi_signature_ux.c b/docs/unimplemented/multi_signature/multi_signature_ux.c new file mode 100644 index 00000000..6f71e1a9 --- /dev/null +++ b/docs/unimplemented/multi_signature/multi_signature_ux.c @@ -0,0 +1,74 @@ + +//////////////////////////////////////////////////////////////////////////////// + +// The Following are only examples and places where this code could be implemented. +// It is not final or guaranteed working. +// This should only serve as a reference for implementing. + +//////////////////////////////////////////////////////////////////////////////// + +/******************************************************************************* + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + ******************************************************************************/ + +#include "transactions/ux/multi_signature_ux.h" + +#include +#include + +#include "constants.h" + +#include "operations/transactions/transaction.h" + +#include "utils/print.h" +#include "utils/utils.h" + +#include "display/context.h" + +//////////////////////////////////////////////////////////////////////////////// +// +// Incomplete. Needs more consideration on safe logic behind displaying values. +// +void displayMultiSignature(const Transaction *transaction) { + const char *const LABEL = "MultiSignature"; + const size_t LABEL_SIZE = 15; + + const char *const LABEL_COUNT = "Key Count"; + const size_t LABEL_COUNT_SIZE = 10; + + bytecpy((char *)displayCtx.operation, LABEL, LABEL_SIZE); + bytecpy((char *)displayCtx.title[0], LABEL_COUNT, LABEL_COUNT_SIZE); + bytecpy((char *)displayCtx.title[1], LABEL_FEE, LABEL_FEE_SIZE); + + // Key Count + printAmount(transaction->asset.multiSignature.count, + (uint8_t *)displayCtx.text[0], sizeof(displayCtx.text[0]), + "", 0, 0); + + // Fee + printAmount(transaction->fee, + (uint8_t *)displayCtx.text[1], sizeof(displayCtx.text[1]), + TOKEN_NAME, TOKEN_NAME_SIZE, TOKEN_DECIMALS); +} diff --git a/docs/unimplemented/multi_signature/multi_signature_ux.h b/docs/unimplemented/multi_signature/multi_signature_ux.h new file mode 100644 index 00000000..116777ca --- /dev/null +++ b/docs/unimplemented/multi_signature/multi_signature_ux.h @@ -0,0 +1,49 @@ + +//////////////////////////////////////////////////////////////////////////////// + +// The Following are only examples and places where this code could be implemented. +// It is not final or guaranteed working. +// This should only serve as a reference for implementing. + +//////////////////////////////////////////////////////////////////////////////// + +/******************************************************************************* + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + ******************************************************************************/ + +#ifndef ARK_OPERATIONS_TRANSACTIONS_UX_MULTI_SIGNATURE_UX_H +#define ARK_OPERATIONS_TRANSACTIONS_UX_MULTI_SIGNATURE_UX_H + +#include + +#include "operations/transactions/transaction.h" + +//////////////////////////////////////////////////////////////////////////////// +static const uint8_t STEPS_MULTI_SIGNATURE_MIN = 2U; + +//////////////////////////////////////////////////////////////////////////////// +void displayMultiSignature(const Transaction *transaction); + +#endif // #define ARK_OPERATIONS_TRANSACTIONS_UX_MULTI_SIGNATURE_UX_H diff --git a/docs/unimplemented/multi_signature/types.h b/docs/unimplemented/multi_signature/types.h new file mode 100644 index 00000000..68fb60b6 --- /dev/null +++ b/docs/unimplemented/multi_signature/types.h @@ -0,0 +1,55 @@ + +//////////////////////////////////////////////////////////////////////////////// + +// The Following are only examples and places where this code could be implemented. +// It is not final or guaranteed working. +// This should only serve as a reference for implementing. + +//////////////////////////////////////////////////////////////////////////////// + +/******************************************************************************* + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + ******************************************************************************/ + +#ifndef ARK_OPERATIONS_TRANSACTIONS_ASSETS_TYPES_H +#define ARK_OPERATIONS_TRANSACTIONS_ASSETS_TYPES_H + +//////////////////////////////////////////////////////////////////////////////// +// ARK Transaction Types +enum TransactionTypes { + TRANSFER_TYPE = 0, + SECOND_SIGNATURE_TYPE = 1, +/* DELEGATE_REGISTRATION_TYPE = 2, */ + VOTE_TYPE = 3, + MULTI_SIGNATURE_TYPE = 4, + IPFS_TYPE = 5, +/* MULTI_PAYMENT_TYPE = 6, */ +/* DELEGATE_RESIGNATION_TYPE = 7, */ + HTLC_LOCK_TYPE = 8, + HTLC_CLAIM_TYPE = 9, + HTLC_REFUND_TYPE = 10 +}; + +#endif // #define ARK_OPERATIONS_TRANSACTIONS_ASSETS_TYPES_H diff --git a/docs/unimplemented/type_2/type_2.c b/docs/unimplemented/type_2/type_2.c deleted file mode 100644 index 894b66dc..00000000 --- a/docs/unimplemented/type_2/type_2.c +++ /dev/null @@ -1,126 +0,0 @@ - -//////////////////////////////////////////////////////////////////////////////// - -// The Following are only examples and places where this code could be implemented. -// It is not final or guaranteed working. -// This should only serve as a reference for implementing. - -//////////////////////////////////////////////////////////////////////////////// - - -/******************************************************************************* -* Ark Wallet -* (c) 2017 Ledger -* (c) ARK Ecosystem -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -********************************************************************************/ - -#include "transactions/types/type_2.h" - -#include - -#include - -#include "constants.h" - -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// - -// Deserialize Transfer (Type 2) - 4 <=> 21 Bytes -// -// @param DelegateRegistrationAsset *registration: The Delegate Registration (Type 2) Asset. -// @param uint8_t *buffer: The serialized buffer beginning at the Assets offset. -// @param uint32_t length: The Asset Length. -// -// --- -// Internals: -// -// Username Length - 1 Byte: -// - registration->length = buffer[0]; -// -// Username - 3 <=> 20 Bytes: -// - bytecpy(registration->username, &buffer[1], registration->length) -// -// --- -bool deserializeDelegateRegistration(DelegateRegistration *registration, - const uint8_t *buffer, - const uint32_t length) { - // usernameLength + username - if (length < 4U || length > 21U) { - return false; // Incorrect Username Length - } - - registration->length = (int)buffer[0]; - bytecpy((void *)registration->username, &buffer[1], (int)registration->length); - - return true; -} - -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// - -static bool internalDeserializeAsset(Transaction *transaction, - const uint8_t *buffer, - const uint32_t length) { -///////// - case TRANSACTION_TYPE_DELEGATE_REGISTRATION: - status = deserializeDelegateRegistration( - &transaction->asset.delegateRegistration, - &buffer[assetOffset], - assetSize); - break; -///////// -} - -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// - -void setDisplayDelegateRegistration(const Transaction *transaction,) { - bytecpy((char *)displayCtx.operation, "Delegate Registration", 22); - bytecpy((char *)displayCtx.title[0], "Username", 9); - bytecpy((char *)displayCtx.title[1], "Fees", 5); - - // Username - bytecpy((char *)displayCtx.text[0], - transaction->asset.delegateRegistration.username, - transaction->asset.delegateRegistration.length); - displayCtx.text[0][transaction->asset.delegateRegistration.length] = '\0'; - - // Fee - printAmount(transaction->fee, - (uint8_t *)displayCtx.text[1], sizeof(displayCtx.text[1]), - TOKEN_NAME, TOKEN_NAME_SIZE, TOKEN_DECIMALS); -} - -//////////////////////////////////////////////////////////////////////////////// - -void setDisplay(const Transaction *transaction) { -///////// - case TRANSACTION_TYPE_SECOND_SIGNATURE: - setDisplaySecondSignature(transaction); - setDisplaySteps(2U); - break; -///////// -} - -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// diff --git a/docs/unimplemented/type_2/type_2.h b/docs/unimplemented/type_2/type_2.h deleted file mode 100644 index e30d8172..00000000 --- a/docs/unimplemented/type_2/type_2.h +++ /dev/null @@ -1,49 +0,0 @@ - -//////////////////////////////////////////////////////////////////////////////// - -// The Following are only examples and places where this code could be implemented. -// It is not final or guaranteed working. -// This should only serve as a reference for implementing. - -//////////////////////////////////////////////////////////////////////////////// - - -/******************************************************************************* -* Ark Wallet -* (c) 2017 Ledger -* (c) ARK Ecosystem -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -********************************************************************************/ - -#ifndef ARK_TRANSACTION_TYPE_2_H -#define ARK_TRANSACTION_TYPE_2_H - -#include - -//////////////////////////////////////////////////////////////////////////////// - -typedef struct delegate_registration_asset_t { - uint8_t length; - uint8_t username[20U]; -} DelegateRegistration; - -//////////////////////////////////////////////////////////////////////////////// - -bool deserializeDelegateRegistration(DelegateRegistration *registration, - const uint8_t *buffer, - const uint32_t length); - -//////////////////////////////////////////////////////////////////////////////// - -#endif \ No newline at end of file diff --git a/docs/unimplemented/type_4/type_4.c b/docs/unimplemented/type_4/type_4.c deleted file mode 100644 index ee821df0..00000000 --- a/docs/unimplemented/type_4/type_4.c +++ /dev/null @@ -1,127 +0,0 @@ - -//////////////////////////////////////////////////////////////////////////////// - -// The Following are only examples and places where this code could be implemented. -// It is not final or guaranteed working. -// This should only serve as a reference for implementing. - -//////////////////////////////////////////////////////////////////////////////// - - -/******************************************************************************* -* Ark Wallet -* (c) 2017 Ledger -* (c) ARK Ecosystem -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -********************************************************************************/ - -#include "transactions/types/type_4.h" - -#include - -#include - -#include "constants.h" - -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// - -// MultiSignature Registration (Type 4) -// -// @param MultiSignature *muSig: The MultiSignature (Type 4) Asset. -// @param uint8_t *buffer: The serialized buffer beginning at the Assets offset. -// @param uint32_t length: The Asset Length. -// -// --- -// Internals: -// -// Minimum Participants - 1 Byte: -// - multiSig->min = buffer[0]; -// -// Key Count -// - multiSig->count = buffer[1]; -// -// PublicKeys - 33N Bytes -// - bytecpy(&multiSig->keys[0], &buffer[2], multiSig->count); -// -// --- -bool deserializeMultiSignature(MultiSignatureAsset *multiSig, - const uint8_t *buffer, - const uint32_t length) { - if ((length % 34U) != 0) { - return false; - } - - multiSig->min = buffer[0]; - multiSig->count = buffer[1]; - bytecpy(&multiSig->keys[0], &buffer[2], multiSig->count); - - return true; -} - -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// - -static bool internalDeserializeAsset(Transaction *transaction, - const uint8_t *buffer, - const uint32_t length) { -///////// - case TRANSACTION_TYPE_MULTI_SIGNATURE: - status = deserializeMultiSignature(&transaction->asset.multiSignature, - &buffer[assetOffset], - assetSize); - break; -///////// -} - -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// - -void setDisplayMultiSignature(const Transaction *transaction) { - bytecpy((char *)displayCtx.operation, "MultiSignature", 15); - bytecpy((char *)displayCtx.title[0], "Key Count", 10); - bytecpy((char *)displayCtx.title[1], "Fees", 5); - - // Key Count - printAmount(transaction->asset.multiSignature.count, - (uint8_t *)displayCtx.text[0], sizeof(displayCtx.text[0]), - "", 0, 0); - - // Fee - printAmount(transaction->fee, - (uint8_t *)displayCtx.text[1], sizeof(displayCtx.text[1]), - TOKEN_NAME, TOKEN_NAME_SIZE, TOKEN_DECIMALS); -} - -//////////////////////////////////////////////////////////////////////////////// - -void setDisplay(const Transaction *transaction) { -///////// - case TRANSACTION_TYPE_MULTI_SIGNATURE: - setDisplayMultiSignature(transaction); - setDisplaySteps(2U); - break; -///////// -} - -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// diff --git a/docs/unimplemented/type_4/type_4.h b/docs/unimplemented/type_4/type_4.h deleted file mode 100644 index 531c75f2..00000000 --- a/docs/unimplemented/type_4/type_4.h +++ /dev/null @@ -1,50 +0,0 @@ - -//////////////////////////////////////////////////////////////////////////////// - -// The Following are only examples and places where this code could be implemented. -// It is not final or guaranteed working. -// This should only serve as a reference for implementing. - -//////////////////////////////////////////////////////////////////////////////// - - -/******************************************************************************* -* Ark Wallet -* (c) 2017 Ledger -* (c) ARK Ecosystem -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -********************************************************************************/ - -#ifndef ARK_TRANSACTION_TYPE_4_H -#define ARK_TRANSACTION_TYPE_4_H - -#include - -//////////////////////////////////////////////////////////////////////////////// - -typedef struct multi_signature_asset_t { - uint8_t min; - uint8_t count; - uint8_t keys[528]; // 16 * 33 keys max -} MultiSignature; - -//////////////////////////////////////////////////////////////////////////////// - -bool deserializeMultiSignature(MultiSignature *muSig, - const uint8_t *buffer, - const uint32_t length); - -//////////////////////////////////////////////////////////////////////////////// - -#endif diff --git a/docs/unimplemented/type_6/type_6.c b/docs/unimplemented/type_6/type_6.c deleted file mode 100644 index 58df8bab..00000000 --- a/docs/unimplemented/type_6/type_6.c +++ /dev/null @@ -1,151 +0,0 @@ - -//////////////////////////////////////////////////////////////////////////////// - -// The Following are only examples and places where this code could be implemented. -// It is not final or guaranteed working. -// This should only serve as a reference for implementing. - -//////////////////////////////////////////////////////////////////////////////// - - -/******************************************************************************* -* Ark Wallet -* (c) 2017 Ledger -* (c) ARK Ecosystem -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -********************************************************************************/ - -#include "transactions/types/type_6.h" - -#include - -#include - -#include "constants.h" - -#include "utils/unpack.h" - -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// - -// MultiPayment (Type 6) - 0 <=> 255 Bytes -// -// @param MultiPaymentAsset *multipayment: The MultiPayment (Type 6) Asset. -// @param uint8_t *buffer: The serialized buffer beginning at the Assets offset. -// @param uint32_t length: The Asset Length. -// -// --- -// Internals: -// -// Number of Payments - 2 Bytes: -// - payments->n_payments = U2BE(buffer, 0); -// -// Amounts[] - 8 Bytes * n_payments -// - payments->amounts[i] = U8LE(&buffer[sizeof(uint16_t) + (i * sizeof(uint64_t))], sizeof(uint64_t)) -// -// Addresses[] - 21 Bytes * n_payments -// - bytecpy(&payments->addresses[i * 21], &buffer[(sizeof(uint16_t) + (i * (sizeof(uint64_t) + 21))], 21); -// -// --- -bool deserializeMultiPayment(MultiPaymentAsset *payments, - const uint8_t *buffer, - const uint32_t length) { - payments->n_payments = U2BE(buffer, 0); - - for (uint8_t i = 0U; i < payments->n_payments; ++i) { - payments->amounts[i] = U8LE(&buffer[sizeof(uint16_t) + i * sizeof(uint64_t)], - sizeof(uint64_t)); - - bytecpy(&payments->addresses[i * ADDRESS_HASH_LEN], - &buffer[sizeof(uint16_t) + payments->n_payments * sizeof(uint64_t) + i * ADDRESS_HASH_LEN], - ADDRESS_HASH_LEN); - } - - return true; -} - -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// - -static bool internalDeserializeAsset(Transaction *transaction, - const uint8_t *buffer, - const uint32_t length) { -///////// - case TRANSACTION_TYPE_MULTIPAYMENT: - status = deserializeMultiPayment(&transaction->asset.multiPayment, - &buffer[assetOffset], - assetSize); - break; -///////// -} - -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// - -void displayMultiPayment(const Transaction *transaction, uint8_t step) { - switch(step) { - // Operation type - case 0: - bytecpy((void *)amountBuffer, "MultiPayment", 13); - break; - - // Count - case 1: - printAmount(transaction->asset.multiPayment.n_payments, - (uint8_t *)screenBuffer, - sizeof(transaction->asset.multiPayment.n_payments), - "", 0, 0); - break; - - // Total Amount - case 2: - printAmount(transaction->asset.transfer.amount, - (uint8_t *)amountBuffer, sizeof(amountBuffer), - TOKEN_NAME, TOKEN_NAME_SIZE, - TOKEN_DECIMALS); - break; - - // Fees - case 3: - printAmount(transaction->fee, - (uint8_t *)amountBuffer, sizeof(amountBuffer), - TOKEN_NAME, TOKEN_NAME_SIZE, - TOKEN_DECIMALS); - break; - - default: break; - } -} - -//////////////////////////////////////////////////////////////////////////////// - -void setDisplay(const Transaction *transaction) { -///////// - case TRANSACTION_TYPE_MULTIPAYMENT: - setDisplayMultiPayment(transaction); - setDisplaySteps(3U); - break; -///////// -} - -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// diff --git a/docs/unimplemented/type_6/type_6.h b/docs/unimplemented/type_6/type_6.h deleted file mode 100644 index b683b679..00000000 --- a/docs/unimplemented/type_6/type_6.h +++ /dev/null @@ -1,52 +0,0 @@ - -//////////////////////////////////////////////////////////////////////////////// - -// The Following are only examples and places where this code could be implemented. -// It is not final or guaranteed working. -// This should only serve as a reference for implementing. - -//////////////////////////////////////////////////////////////////////////////// - - -/******************************************************************************* -* Ark Wallet -* (c) 2017 Ledger -* (c) ARK Ecosystem -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -********************************************************************************/ - -#ifndef ARK_TRANSACTION_TYPE_6_H -#define ARK_TRANSACTION_TYPE_6_H - -#include - -#include "constants.h" - -//////////////////////////////////////////////////////////////////////////////// - -typedef struct multipayment_asset_t { - uint16_t n_payments; // 2,259 network max - uint8_t amounts[2259]; // payment(uint64_t) * n_payments - uint8_t addresses[47439]; // address[21] * n_payments -} MultiPayment; - -//////////////////////////////////////////////////////////////////////////////// - -bool deserializeMultiPayment(MultiPayment *payments, - const uint8_t *buffer, - const uint32_t length); - -//////////////////////////////////////////////////////////////////////////////// - -#endif diff --git a/docs/unimplemented/type_7/type_7.c b/docs/unimplemented/type_7/type_7.c deleted file mode 100644 index cb5a1590..00000000 --- a/docs/unimplemented/type_7/type_7.c +++ /dev/null @@ -1,89 +0,0 @@ - -//////////////////////////////////////////////////////////////////////////////// - -// The Following are only examples and places where this code could be implemented. -// It is not final or guaranteed working. -// This should only serve as a reference for implementing. - -//////////////////////////////////////////////////////////////////////////////// - - -/******************************************************************************* -* Ark Wallet -* (c) 2017 Ledger -* (c) ARK Ecosystem -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -********************************************************************************/ - -#include "transactions/types/type_7.h" - -#include - -#include - -#include "constants.h" - - -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// - -static bool internalDeserializeAsset(Transaction *transaction, - const uint8_t *buffer, - const uint32_t length) { -///////// - case TRANSACTION_TYPE_DELEGATE_RESIGNATION: - // No Payload - status = USTREAM_FINISHED; - break; -///////// -} - -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// - -void setDisplayDelegateResignation(const Transaction *transaction) { - bytecpy((char *)displayCtx.operation, "Delegate Resignation", 21); - bytecpy((char *)displayCtx.title[0], "PublicKey", 10); - bytecpy((char *)displayCtx.title[1], "Fees", 5); - - // Delegate PublicKey - bytesToHex((char *)displayCtx.text[0], - transaction->senderPublicKey, - PUBLICKEY_COMPRESSED_LEN); - - // Fees - printAmount(transaction->fee, - (uint8_t *)displayCtx.text[1], sizeof(displayCtx.text[1]), - TOKEN_NAME, TOKEN_NAME_SIZE, ARK_TOKEN_DECIMALS); -} - -//////////////////////////////////////////////////////////////////////////////// - -void setDisplay(const Transaction *transaction) { -///////// - case TRANSACTION_TYPE_DELEGATE_RESIGNATION: - setDisplayDelegateResignation(transaction); - setDisplaySteps(2U); - break; -///////// -} - -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// diff --git a/docs/unimplemented/type_7/type_7.h b/docs/unimplemented/type_7/type_7.h deleted file mode 100644 index 01e76489..00000000 --- a/docs/unimplemented/type_7/type_7.h +++ /dev/null @@ -1,41 +0,0 @@ - -//////////////////////////////////////////////////////////////////////////////// - -// The Following are only examples and places where this code could be implemented. -// It is not final or guaranteed working. -// This should only serve as a reference for implementing. - -//////////////////////////////////////////////////////////////////////////////// - - -/******************************************************************************* -* Ark Wallet -* (c) 2017 Ledger -* (c) ARK Ecosystem -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -********************************************************************************/ - -#include - -#include - -#include "constants.h" - -//////////////////////////////////////////////////////////////////////////////// - -typedef struct delegate_resignation_asset_t {} DelegateResignationAsset; - -//////////////////////////////////////////////////////////////////////////////// - -#endif diff --git a/examples/README.md b/examples/README.md index c3dc8f2d..2eae0913 100644 --- a/examples/README.md +++ b/examples/README.md @@ -3,19 +3,20 @@ ## Requirements -- Ledger Nano S Hardware Wallet -- Python -- [Ledger-Vagrant](https://github.com/sleepdefic1t/ledger-vagrant). +* Ledger Nano S Hardware Wallet +* Python +* [Ledger-Vagrant](https://github.com/sleepdefic1t/ledger-vagrant). ## Running all examples ```shell -sh ./all.sh +sh ./examples/all.sh ``` ## Running individual examples ```shell -sh ./legacy.sh -sh ./v2.sh +sh ./examples/legacy.sh +sh ./examples/v2.sh +sh ./examples/message.sh ``` diff --git a/examples/example_helper.py b/examples/example_helper.py index f9cdd056..96614731 100644 --- a/examples/example_helper.py +++ b/examples/example_helper.py @@ -1,22 +1,48 @@ #!/usr/bin/env python3 # /******************************************************************************* -# * Ark Wallet -# * (c) 2017 Ledger -# * (c) ARK Ecosystem -# * -# * Licensed under the Apache License, Version 2.0 (the "License"); -# * you may not use this file except in compliance with the License. -# * You may obtain a copy of the License at -# * -# * http://www.apache.org/licenses/LICENSE-2.0 -# * -# * Unless required by applicable law or agreed to in writing, software -# * distributed under the License is distributed on an "AS IS" BASIS, -# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# * See the License for the specific language governing permissions and -# * limitations under the License. -# ********************************************************************************/ +# * This file is part of the ARK Ledger App. +# * +# * Copyright (c) ARK Ecosystem +# * +# * The MIT License (MIT) +# * +# * 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. +# * +# * ----- +# * +# * Parts of this software are based on Ledger Nano SDK +# * +# * (c) 2017 Ledger +# * +# * Licensed under the Apache License, Version 2.0 (the "License"); +# * you may not use this file except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# ******************************************************************************/ from ledgerblue.comm import getDongle from ledgerblue.commException import CommException diff --git a/examples/v2.sh b/examples/v2.sh index e4d19f3c..0f7ff834 100644 --- a/examples/v2.sh +++ b/examples/v2.sh @@ -36,7 +36,7 @@ python3 $(dirname $0)/example_helper.py --tx ff021701000000080002000000000000000 echo "" echo Testing an HTLC Lock Transaction with a VendorField. -python3 $(dirname $0)/example_helper.py --tx ff01170884e24505034151a3ec46b5670a682b0a63394f863587d1bc97483b1b6c70eb58e7f0aed19280969800000000000b48656c6c6f20576f726c64010000000000000009b9a28393efd02fcd76a21b0f0f55ba2aad8f3640ff8cae86de033a9cfbd78c0124e44505175e34dc384ea250461546302ce9deb717c1955503 +python3 $(dirname $0)/example_helper.py --tx ff02170100000008000000000000000000034151a3ec46b5670a682b0a63394f863587d1bc97483b1b6c70eb58e7f0aed19280969800000000000b48656c6c6f20576f726c64010000000000000009b9a28393efd02fcd76a21b0f0f55ba2aad8f3640ff8cae86de033a9cfbd78c017a81460517c18e4fdcd78bf9a9eac22e91d52edfeb04bc8e9e echo "" echo Testing an HTLC Claim Transaction. diff --git a/ark.png b/icons/ark.png similarity index 100% rename from ark.png rename to icons/ark.png diff --git a/icon.gif b/icons/icon.gif similarity index 100% rename from icon.gif rename to icons/icon.gif diff --git a/nanos_app_ark.gif b/icons/nanos_app_ark.gif similarity index 100% rename from nanos_app_ark.gif rename to icons/nanos_app_ark.gif diff --git a/nanox_app_ark.gif b/icons/nanox_app_ark.gif similarity index 100% rename from nanox_app_ark.gif rename to icons/nanox_app_ark.gif diff --git a/provision/setup.sh b/scripts/provision.sh similarity index 98% rename from provision/setup.sh rename to scripts/provision.sh index 0a0de345..87edbca1 100644 --- a/provision/setup.sh +++ b/scripts/provision.sh @@ -44,7 +44,7 @@ if [ ! -d "/opt/bolos/nanos-secure-sdk" ]; then fi echo "Finetuning rights for USB access" -sudo bash /vagrant/provision/udev.sh +sudo bash /vagrant/scripts/udev.sh usermod -a -G plugdev vagrant echo "Setting up bash profile" diff --git a/rebuild.sh b/scripts/rebuild.sh similarity index 100% rename from rebuild.sh rename to scripts/rebuild.sh diff --git a/provision/udev.sh b/scripts/udev.sh similarity index 100% rename from provision/udev.sh rename to scripts/udev.sh diff --git a/src/approval.c b/src/approval.c index 2699440f..80b5654c 100644 --- a/src/approval.c +++ b/src/approval.c @@ -1,20 +1,46 @@ /******************************************************************************* -* Ark Wallet -* (c) 2017 Ledger -* (c) ARK Ecosystem -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -********************************************************************************/ + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + * + * ----- + * + * Parts of this software are based on Ledger Nano SDK + * + * (c) 2017 Ledger + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ #include "approval.h" @@ -32,18 +58,15 @@ #include "display/context.h" //////////////////////////////////////////////////////////////////////////////// +extern void ui_idle(void); +//////////////////////////////////////////////////////////////////////////////// union { PublicKeyContext publicKey; SigningContext signing; } tmpCtx; //////////////////////////////////////////////////////////////////////////////// - -extern void ui_idle(void); - -//////////////////////////////////////////////////////////////////////////////// - unsigned int ioApprove(const bagl_element_t *e) { explicit_bzero(&displayCtx, sizeof(displayCtx)); @@ -93,7 +116,6 @@ unsigned int ioApprove(const bagl_element_t *e) { } //////////////////////////////////////////////////////////////////////////////// - unsigned int ioCancel(const bagl_element_t *e) { explicit_bzero(&displayCtx, sizeof(displayCtx)); @@ -111,7 +133,6 @@ unsigned int ioCancel(const bagl_element_t *e) { } //////////////////////////////////////////////////////////////////////////////// - unsigned int ioExit(const bagl_element_t *e) { // Go back to the dashboard os_sched_exit(0); @@ -119,5 +140,3 @@ unsigned int ioExit(const bagl_element_t *e) { // do not redraw the widget return 0; } - -//////////////////////////////////////////////////////////////////////////////// diff --git a/src/approval.h b/src/approval.h index a134f913..13ea0e41 100644 --- a/src/approval.h +++ b/src/approval.h @@ -1,20 +1,29 @@ /******************************************************************************* -* Ark Wallet -* (c) 2017 Ledger -* (c) ARK Ecosystem -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -********************************************************************************/ + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + * + ******************************************************************************/ #ifndef ARK_APPROVAL_H #define ARK_APPROVAL_H @@ -23,13 +32,8 @@ #include //////////////////////////////////////////////////////////////////////////////// - unsigned int ioApprove(const bagl_element_t *e); - unsigned int ioCancel(const bagl_element_t *e); - unsigned int ioExit(const bagl_element_t *e); -//////////////////////////////////////////////////////////////////////////////// - -#endif +#endif // #define ARK_APPROVAL_H diff --git a/src/constants.h b/src/constants.h index f9786a0f..bad172c3 100644 --- a/src/constants.h +++ b/src/constants.h @@ -1,19 +1,28 @@ /******************************************************************************* -* Ark Wallet -* (c) 2017 Ledger -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -********************************************************************************/ + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + ******************************************************************************/ #ifndef ARK_CONSTANTS_H #define ARK_CONSTANTS_H @@ -22,20 +31,17 @@ #include //////////////////////////////////////////////////////////////////////////////// - // General static const size_t MAX_RAW_OPERATION = 704; // 64-byte-aligned static const size_t MAX_TEXT_LEN = 255; //////////////////////////////////////////////////////////////////////////////// - // Hash static const size_t HASH_20_LEN = 20; static const size_t HASH_32_LEN = 32; static const size_t HASH_64_LEN = 64; //////////////////////////////////////////////////////////////////////////////// - // Identities static const size_t ADDRESS_LEN = 34; static const size_t ADDRESS_HASH_LEN = 21; @@ -43,7 +49,6 @@ static const size_t ADDRESS_MAX_BIP32_PATH = 10; static const size_t PUBLICKEY_COMPRESSED_LEN = 33; //////////////////////////////////////////////////////////////////////////////// - // Labels static const char *const LABEL_AMOUNT = "Amount"; static const size_t LABEL_AMOUNT_SIZE = 7; @@ -58,7 +63,6 @@ static const char *const LABEL_TO = "To"; static const size_t LABEL_TO_SIZE = 3; //////////////////////////////////////////////////////////////////////////////// - // Token static const size_t TOKEN_DECIMALS = 8; static const char *const TOKEN_NAME = "ARK "; @@ -66,7 +70,6 @@ static const size_t TOKEN_NAME_SIZE = 4; // sizeof("ARK ") - 1 static const uint8_t TOKEN_NETWORK_BYTE = 0x1e; // ARK Mainnet //////////////////////////////////////////////////////////////////////////////// - // Transactions static const uint8_t TRANSACTION_HEADER = 0xFF; @@ -74,4 +77,4 @@ static const uint8_t TRANSACTION_VERSION_LEGACY = 0; static const uint8_t TRANSACTION_VERSION_TYPE_1 = 1; static const uint8_t TRANSACTION_VERSION_TYPE_2 = 2; -#endif +#endif // #define ARK_CONSTANTS_H diff --git a/src/crypto/hashing.c b/src/crypto/hashing.c index 01af2fe5..bd0cf2ef 100644 --- a/src/crypto/hashing.c +++ b/src/crypto/hashing.c @@ -1,20 +1,28 @@ /******************************************************************************* -* Ark Wallet -* (c) 2017 Ledger -* (c) ARK Ecosystem -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -********************************************************************************/ + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + ******************************************************************************/ #include "crypto/hashing.h" @@ -25,7 +33,6 @@ #include //////////////////////////////////////////////////////////////////////////////// - // Generate a Ripemd160 hash void hash160(uint8_t *in, size_t inSize, uint8_t *out) { cx_ripemd160_t ripeHash; @@ -34,11 +41,8 @@ void hash160(uint8_t *in, size_t inSize, uint8_t *out) { } //////////////////////////////////////////////////////////////////////////////// - void hash256(uint8_t *in, size_t inSize, uint8_t *out) { cx_sha256_t ctx; cx_sha256_init(&ctx); cx_hash(&ctx.header, CX_LAST, in, inSize, out, CX_SHA256_SIZE); } - -//////////////////////////////////////////////////////////////////////////////// diff --git a/src/crypto/hashing.h b/src/crypto/hashing.h index 0a183245..5d49bed4 100644 --- a/src/crypto/hashing.h +++ b/src/crypto/hashing.h @@ -1,20 +1,28 @@ /******************************************************************************* -* Ark Wallet -* (c) 2017 Ledger -* (c) ARK Ecosystem -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -********************************************************************************/ + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + ******************************************************************************/ #ifndef ARK_CRYPTO_HASHING_H #define ARK_CRYPTO_HASHING_H @@ -23,11 +31,7 @@ #include //////////////////////////////////////////////////////////////////////////////// - void hash160(uint8_t *in, size_t inSize, uint8_t *out); - void hash256(uint8_t *in, size_t inSize, uint8_t *out); -//////////////////////////////////////////////////////////////////////////////// - -#endif +#endif // #define ARK_CRYPTO_HASHING_H diff --git a/src/crypto/keys.c b/src/crypto/keys.c index dcee0ab9..fc3f9ffb 100644 --- a/src/crypto/keys.c +++ b/src/crypto/keys.c @@ -1,20 +1,28 @@ /******************************************************************************* -* Ark Wallet -* (c) 2017 Ledger -* (c) ARK Ecosystem -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -********************************************************************************/ + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + ******************************************************************************/ #include "crypto/keys.h" @@ -28,7 +36,6 @@ #include "utils/utils.h" //////////////////////////////////////////////////////////////////////////////// - void compressPublicKey(const cx_ecfp_public_key_t *publicKey, uint8_t *out, size_t outSize) { @@ -46,7 +53,6 @@ void compressPublicKey(const cx_ecfp_public_key_t *publicKey, } //////////////////////////////////////////////////////////////////////////////// - uint32_t setPublicKeyContext(PublicKeyContext *ctx, uint8_t *apduBuffer) { uint32_t tx = 0; apduBuffer[tx++] = PUBLICKEY_COMPRESSED_LEN; @@ -69,5 +75,3 @@ uint32_t setPublicKeyContext(PublicKeyContext *ctx, uint8_t *apduBuffer) { return tx; } - -//////////////////////////////////////////////////////////////////////////////// diff --git a/src/crypto/keys.h b/src/crypto/keys.h index bf469105..bce59173 100644 --- a/src/crypto/keys.h +++ b/src/crypto/keys.h @@ -1,23 +1,31 @@ /******************************************************************************* -* Ark Wallet -* (c) 2017 Ledger -* (c) ARK Ecosystem -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -********************************************************************************/ - -#ifndef ARK_CRYPTO_KEYS -#define ARK_CRYPTO_KEYS + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + ******************************************************************************/ + +#ifndef ARK_CRYPTO_KEYS_H +#define ARK_CRYPTO_KEYS_H #include #include @@ -28,7 +36,6 @@ #include "constants.h" //////////////////////////////////////////////////////////////////////////////// - typedef struct public_key_context_t { cx_ecfp_public_key_t data; uint8_t address[41]; @@ -37,13 +44,10 @@ typedef struct public_key_context_t { } PublicKeyContext; //////////////////////////////////////////////////////////////////////////////// - void compressPublicKey(const cx_ecfp_public_key_t *publicKey, uint8_t *out, size_t outSize); uint32_t setPublicKeyContext(PublicKeyContext *ctx, uint8_t *apduBuffer); -//////////////////////////////////////////////////////////////////////////////// - -#endif \ No newline at end of file +#endif // #define ARK_CRYPTO_KEYS_H diff --git a/src/crypto/signing.c b/src/crypto/signing.c index 3c1d515e..95920b16 100644 --- a/src/crypto/signing.c +++ b/src/crypto/signing.c @@ -1,20 +1,28 @@ /******************************************************************************* -* Ark Wallet -* (c) 2017 Ledger -* (c) ARK Ecosystem -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -********************************************************************************/ + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + ******************************************************************************/ #include "crypto/signing.h" @@ -26,7 +34,6 @@ #include "constants.h" //////////////////////////////////////////////////////////////////////////////// - uint32_t signEcdsa(const cx_ecfp_private_key_t *privateKey, const uint8_t *hash, uint8_t *signature, @@ -46,5 +53,3 @@ uint32_t signEcdsa(const cx_ecfp_private_key_t *privateKey, signature[0] = 0x30; #endif } - -//////////////////////////////////////////////////////////////////////////////// diff --git a/src/crypto/signing.h b/src/crypto/signing.h index 7f0092e4..6c7fe294 100644 --- a/src/crypto/signing.h +++ b/src/crypto/signing.h @@ -1,20 +1,28 @@ /******************************************************************************* -* Ark Wallet -* (c) 2017 Ledger -* (c) ARK Ecosystem -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -********************************************************************************/ + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + ******************************************************************************/ #ifndef ARK_CRYPTO_SIGNING_H #define ARK_CRYPTO_SIGNING_H @@ -28,7 +36,6 @@ #include "constants.h" //////////////////////////////////////////////////////////////////////////////// - typedef struct signing_context_t { cx_curve_t curve; uint8_t pathLength; @@ -38,12 +45,9 @@ typedef struct signing_context_t { } SigningContext; //////////////////////////////////////////////////////////////////////////////// - uint32_t signEcdsa(const cx_ecfp_private_key_t *privateKey, const uint8_t *hash, uint8_t *signature, size_t signatureSize); -//////////////////////////////////////////////////////////////////////////////// - -#endif +#endif // #define ARK_CRYPTO_SIGNING_H diff --git a/src/display/context.c b/src/display/context.c index 74e54d2a..04b2ed6e 100644 --- a/src/display/context.c +++ b/src/display/context.c @@ -1,25 +1,31 @@ /******************************************************************************* -* Ark Wallet -* (c) 2017 Ledger -* (c) ARK Ecosystem -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -********************************************************************************/ + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + ******************************************************************************/ #include "display/context.h" //////////////////////////////////////////////////////////////////////////////// - +// Global DisplayContext instance DisplayContext displayCtx; - -//////////////////////////////////////////////////////////////////////////////// diff --git a/src/display/context.h b/src/display/context.h index c3082a1e..660ccc5e 100644 --- a/src/display/context.h +++ b/src/display/context.h @@ -1,20 +1,28 @@ /******************************************************************************* -* Ark Wallet -* (c) 2017 Ledger -* (c) ARK Ecosystem -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -********************************************************************************/ + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + ******************************************************************************/ #ifndef ARK_DISPLAY_CONTEXT_H #define ARK_DISPLAY_CONTEXT_H @@ -23,7 +31,6 @@ #include //////////////////////////////////////////////////////////////////////////////// - static const size_t DISPLAY_CTX_STEP_COUNT = 5; static const size_t DISPLAY_CTX_OP_SIZE = 18; static const size_t DISPLAY_CTX_TITLE_SIZE = DISPLAY_CTX_OP_SIZE - 3; @@ -31,7 +38,8 @@ static const size_t DISPLAY_CTX_TEXT_SIZE = 68; static const size_t DISPLAY_CTX_EXTENDED_TEXT_SIZE = 256; //////////////////////////////////////////////////////////////////////////////// - +// Display Context. +// // 704 Bytes (64-byte-aligned) typedef struct display_context_t { uint8_t operation [DISPLAY_CTX_OP_SIZE]; @@ -47,8 +55,7 @@ typedef struct display_context_t { uint8_t extended_text[DISPLAY_CTX_EXTENDED_TEXT_SIZE]; } DisplayContext; -extern DisplayContext displayCtx; - //////////////////////////////////////////////////////////////////////////////// +extern DisplayContext displayCtx; -#endif +#endif // #define ARK_DISPLAY_CONTEXT_H diff --git a/src/display/display.h b/src/display/display.h index cd7a66f4..f9c629c1 100644 --- a/src/display/display.h +++ b/src/display/display.h @@ -1,20 +1,28 @@ /******************************************************************************* -* Ark Wallet -* (c) 2017 Ledger -* (c) ARK Ecosystem -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -********************************************************************************/ + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + ******************************************************************************/ #ifndef ARK_DISPLAY_H #define ARK_DISPLAY_H diff --git a/src/display/nano.c b/src/display/nano.c index d5ee7103..434d111e 100644 --- a/src/display/nano.c +++ b/src/display/nano.c @@ -1,20 +1,46 @@ /******************************************************************************* -* Ark Wallet -* (c) 2017 Ledger -* (c) ARK Ecosystem -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -********************************************************************************/ + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + * + * ----- + * + * Parts of this software are based on Ledger Nano SDK + * + * (c) 2017 Ledger + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ #include "display/display.h" @@ -34,11 +60,9 @@ #include "display/context.h" //////////////////////////////////////////////////////////////////////////////// - ux_state_t G_ux; //////////////////////////////////////////////////////////////////////////////// - // Main App Menu UX_STEP_NOCB(ux_idle_application_ready, pnn, @@ -60,7 +84,6 @@ UX_FLOW(ux_idle_flow, &ux_idle_application_quit); //////////////////////////////////////////////////////////////////////////////// - // Operation UX Flow Template UX_STEP_NOCB(ux_screen_operation, pnn, @@ -108,6 +131,7 @@ UX_STEP_VALID(ux_screen_reject, { &C_icon_crossmark, "Reject", }); //////////////////////////////////////////////////////////////////////////////// +// UX Flow Variables // 1-variable UX Flow UX_FLOW(ux_flow_1_screen, @@ -149,6 +173,12 @@ UX_FLOW(ux_flow_5_screen, &ux_screen_item_5, &ux_screen_accept, &ux_screen_reject); +//////////////////////////////////////////////////////////////////////////////// +// Extended UX Flow Variables +// +// Extended text fields should always be set as the last step; +// they must also not exceed 255 characters/bytes. + // 1-variable UX Flow, Extended last step UX_FLOW(ux_flow_1_screen_extended, &ux_screen_operation, @@ -201,7 +231,6 @@ UX_FLOW(ux_flow_6_screen_extended, &ux_screen_accept, &ux_screen_reject); //////////////////////////////////////////////////////////////////////////////// - void setDisplaySteps(uint8_t steps, bool isExtended) { switch(steps) { case 1: isExtended ? ux_flow_init(0U, ux_flow_1_screen_extended, NULL) @@ -226,7 +255,6 @@ void setDisplaySteps(uint8_t steps, bool isExtended) { } } //////////////////////////////////////////////////////////////////////////////// - void ui_idle(void) { // reserve a display stack slot if none yet if (G_ux.stack_count == 0) { @@ -235,6 +263,4 @@ void ui_idle(void) { ux_flow_init(0, ux_idle_flow, NULL); } -//////////////////////////////////////////////////////////////////////////////// - #endif // defined(TARGET_NANOS) || defined(TARGET_NANOX) diff --git a/src/display/nano.h b/src/display/nano.h index d367f32f..9210dbdc 100644 --- a/src/display/nano.h +++ b/src/display/nano.h @@ -1,20 +1,46 @@ /******************************************************************************* -* Ark Wallet -* (c) 2017 Ledger -* (c) ARK Ecosystem -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -********************************************************************************/ + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + * + * ----- + * + * Parts of this software are based on Ledger Nano SDK + * + * (c) 2017 Ledger + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ #ifndef ARK_DISPLAY_NANO_H #define ARK_DISPLAY_NANO_H @@ -23,11 +49,9 @@ #include //////////////////////////////////////////////////////////////////////////////// - void setDisplaySteps(uint8_t steps, bool isExtended); -void ui_idle(void); - //////////////////////////////////////////////////////////////////////////////// +void ui_idle(void); -#endif +#endif // #define ARK_DISPLAY_NANO_H diff --git a/src/io.c b/src/io.c index f2484ab3..9d3422af 100644 --- a/src/io.c +++ b/src/io.c @@ -1,20 +1,46 @@ /******************************************************************************* -* Ark Wallet -* (c) 2017 Ledger -* (c) ARK Ecosystem -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -********************************************************************************/ + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + * + * ----- + * + * Parts of this software are based on Ledger Nano SDK + * + * (c) 2017 Ledger + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ #include "io.h" @@ -23,11 +49,9 @@ #include //////////////////////////////////////////////////////////////////////////////// - uint8_t G_io_seproxyhal_spi_buffer[IO_SEPROXYHAL_BUFFER_SIZE_B]; //////////////////////////////////////////////////////////////////////////////// - uint8_t io_event(uint8_t channel) { // nothing done with the event // throw an error on the transport layer if needed. @@ -76,7 +100,6 @@ uint8_t io_event(uint8_t channel) { } //////////////////////////////////////////////////////////////////////////////// - uint16_t io_exchange_al(uint8_t channel, uint16_t tx_len) { switch (channel & ~(IO_FLAGS)) { case CHANNEL_KEYBOARD: break; @@ -107,10 +130,7 @@ uint16_t io_exchange_al(uint8_t channel, uint16_t tx_len) { } //////////////////////////////////////////////////////////////////////////////// - // override point, but nothing more to do void io_seproxyhal_display(const bagl_element_t *element) { io_seproxyhal_display_default((bagl_element_t *)element); } - -//////////////////////////////////////////////////////////////////////////////// diff --git a/src/io.h b/src/io.h index 476b14d7..6674beab 100644 --- a/src/io.h +++ b/src/io.h @@ -1,20 +1,46 @@ /******************************************************************************* -* Ark Wallet -* (c) 2017 Ledger -* (c) ARK Ecosystem -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -********************************************************************************/ + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + * + * ----- + * + * Parts of this software are based on Ledger Nano SDK + * + * (c) 2017 Ledger + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ #ifndef ARK_IO_H #define ARK_IO_H @@ -23,13 +49,8 @@ #include //////////////////////////////////////////////////////////////////////////////// - uint8_t io_event(uint8_t channel); - uint16_t io_exchange_al(uint8_t channel, uint16_t tx_len); - void io_seproxyhal_display(const bagl_element_t *element); -//////////////////////////////////////////////////////////////////////////////// - -#endif +#endif // #define ARK_IO_H diff --git a/src/main.c b/src/main.c index 6fe68d61..5a7a827f 100644 --- a/src/main.c +++ b/src/main.c @@ -1,20 +1,46 @@ /******************************************************************************* -* Ark Wallet -* (c) 2017 Ledger -* (c) ARK Ecosystem -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -********************************************************************************/ + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + * + * ----- + * + * Parts of this software are based on Ledger Nano SDK + * + * (c) 2017 Ledger + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ #include #include @@ -23,11 +49,9 @@ #include "operations.h" //////////////////////////////////////////////////////////////////////////////// - extern void ui_idle(void); //////////////////////////////////////////////////////////////////////////////// - void ark_main(void) { volatile unsigned int rx = 0U; volatile unsigned int tx = 0U; @@ -89,7 +113,6 @@ void ark_main(void) { } //////////////////////////////////////////////////////////////////////////////// - void app_exit(void) { BEGIN_TRY_L(exit) { TRY_L(exit) { os_sched_exit(-1); } @@ -99,7 +122,6 @@ void app_exit(void) { } //////////////////////////////////////////////////////////////////////////////// - __attribute__((section(".boot"))) int main(void) { // Exit critical section __asm volatile("cpsie i"); @@ -139,5 +161,3 @@ __attribute__((section(".boot"))) int main(void) { return 0U; } - -//////////////////////////////////////////////////////////////////////////////// diff --git a/src/operations.c b/src/operations.c index 2da0ead2..a487b8ac 100644 --- a/src/operations.c +++ b/src/operations.c @@ -1,20 +1,46 @@ /******************************************************************************* -* Ark Wallet -* (c) 2017 Ledger -* (c) ARK Ecosystem -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -********************************************************************************/ + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + * + * ----- + * + * Parts of this software are based on Ledger Nano SDK + * + * (c) 2017 Ledger + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ #include "operations.h" @@ -38,7 +64,6 @@ #include "utils/utils.h" //////////////////////////////////////////////////////////////////////////////// - #define OFFSET_P1 2U #define OFFSET_P2 3U #define OFFSET_LC 4U @@ -68,21 +93,18 @@ #define P2_SECP256K1 0x40 //////////////////////////////////////////////////////////////////////////////// - #define INS_GET_PUBLIC_KEY 0x02 #define INS_SIGN 0x04 #define INS_SIGN_MESSAGE 0x08 #define INS_GET_APP_CONFIGURATION 0x06 //////////////////////////////////////////////////////////////////////////////// - extern union { PublicKeyContext publicKey; SigningContext signing; } tmpCtx; //////////////////////////////////////////////////////////////////////////////// - static void handlePublicKeyContext(volatile unsigned int *tx) { uint8_t p1 = G_io_apdu_buffer[OFFSET_P1]; uint8_t p2 = G_io_apdu_buffer[OFFSET_P2]; @@ -156,7 +178,6 @@ static void handlePublicKeyContext(volatile unsigned int *tx) { } //////////////////////////////////////////////////////////////////////////////// - static void handleSigningContext() { uint8_t p1 = G_io_apdu_buffer[OFFSET_P1]; uint8_t p2 = G_io_apdu_buffer[OFFSET_P2]; @@ -216,7 +237,6 @@ static void handleSigningContext() { } //////////////////////////////////////////////////////////////////////////////// - static void handleAppConfiguration(volatile unsigned int *tx) { G_io_apdu_buffer[0] = 0x00; G_io_apdu_buffer[1] = LEDGER_MAJOR_VERSION; @@ -228,7 +248,6 @@ static void handleAppConfiguration(volatile unsigned int *tx) { } //////////////////////////////////////////////////////////////////////////////// - void handleOperation(volatile unsigned int *flags, volatile unsigned int *tx) { if (G_io_apdu_buffer[0] != 0xE0) { THROW(0x6E00); @@ -268,5 +287,3 @@ void handleOperation(volatile unsigned int *flags, volatile unsigned int *tx) { *flags |= IO_ASYNCH_REPLY; } - -//////////////////////////////////////////////////////////////////////////////// diff --git a/src/operations.h b/src/operations.h index 42db2d65..b278d058 100644 --- a/src/operations.h +++ b/src/operations.h @@ -1,28 +1,33 @@ /******************************************************************************* -* Ark Wallet -* (c) 2017 Ledger -* (c) ARK Ecosystem -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -********************************************************************************/ + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + ******************************************************************************/ #ifndef ARK_OPERATIONS_H #define ARK_OPERATIONS_H //////////////////////////////////////////////////////////////////////////////// - void handleOperation(volatile unsigned int *flags, volatile unsigned int *tx); -//////////////////////////////////////////////////////////////////////////////// - -#endif +#endif // #define ARK_OPERATIONS_H diff --git a/src/operations/message_op.h b/src/operations/message_op.h index 847c3253..87cda69c 100644 --- a/src/operations/message_op.h +++ b/src/operations/message_op.h @@ -1,20 +1,28 @@ /******************************************************************************* -* Ark Wallet -* (c) 2017 Ledger -* (c) ARK Ecosystem -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -********************************************************************************/ + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + ******************************************************************************/ #ifndef ARK_OPERATIONS_MESSAGE_H #define ARK_OPERATIONS_MESSAGE_H @@ -37,7 +45,6 @@ extern void setDisplaySteps(uint8_t steps, bool isExtended); //////////////////////////////////////////////////////////////////////////////// - // Prepare a Message Operation for Display. // // - UTF8 Encoded @@ -77,6 +84,4 @@ bool handleMessage(const uint8_t *buffer, size_t length) { return true; } -//////////////////////////////////////////////////////////////////////////////// - -#endif +#endif // #define ARK_OPERATIONS_MESSAGE_H diff --git a/src/operations/transaction_op.h b/src/operations/transaction_op.h index be6885a7..399b4a91 100644 --- a/src/operations/transaction_op.h +++ b/src/operations/transaction_op.h @@ -1,20 +1,28 @@ /******************************************************************************* -* Ark Wallet -* (c) 2017 Ledger -* (c) ARK Ecosystem -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -********************************************************************************/ + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + ******************************************************************************/ #ifndef ARK_OPERATIONS_TRANSACTION_H #define ARK_OPERATIONS_TRANSACTION_H @@ -26,11 +34,8 @@ #include "transactions/deserializer.h" //////////////////////////////////////////////////////////////////////////////// - bool handleTransaction(const uint8_t *buffer, size_t size) { return deserialize(buffer, size); } -//////////////////////////////////////////////////////////////////////////////// - -#endif +#endif // #ifndef ARK_OPERATIONS_TRANSACTION_H diff --git a/src/operations/transactions/deserializer.c b/src/operations/transactions/deserializer.c index 8945be06..6b1122ef 100644 --- a/src/operations/transactions/deserializer.c +++ b/src/operations/transactions/deserializer.c @@ -1,20 +1,28 @@ /******************************************************************************* -* Ark Wallet -* (c) 2017 Ledger -* (c) ARK Ecosystem -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -********************************************************************************/ + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + ******************************************************************************/ #include "transactions/deserializer.h" @@ -39,11 +47,9 @@ #include "transactions/ux/display_ux.h" //////////////////////////////////////////////////////////////////////////////// - Transaction transaction; //////////////////////////////////////////////////////////////////////////////// - // Deserialize Common // // @param Transaction *transaction: A Transaction object. @@ -101,7 +107,6 @@ static void deserializeCommon(Transaction *transaction, const uint8_t *buffer) { } //////////////////////////////////////////////////////////////////////////////// - // Deserialize Common v1 // // @param TransactionData *data: The Transaction Data destination. @@ -157,7 +162,6 @@ static void deserializeCommonV1(Transaction *transaction, } //////////////////////////////////////////////////////////////////////////////// - // Deserialize Asset // // @param Transaction *transaction @@ -223,7 +227,6 @@ static bool deserializeAsset(Transaction *transaction, } //////////////////////////////////////////////////////////////////////////////// - // v2 and v1 Transactions static bool internalDeserialize(Transaction *transaction, const uint8_t *buffer, @@ -257,7 +260,6 @@ static bool internalDeserialize(Transaction *transaction, } //////////////////////////////////////////////////////////////////////////////// - // Legacy Transactions static bool internalDeserializeLegacy(Transaction *transaction, const uint8_t *buffer, @@ -279,7 +281,6 @@ static bool internalDeserializeLegacy(Transaction *transaction, } //////////////////////////////////////////////////////////////////////////////// - bool deserialize(const uint8_t *buffer, size_t size) { bool successful = buffer[HEADER_OFFSET] == TRANSACTION_HEADER ? internalDeserialize(&transaction, buffer, size) @@ -291,5 +292,3 @@ bool deserialize(const uint8_t *buffer, size_t size) { return successful; } - -//////////////////////////////////////////////////////////////////////////////// diff --git a/src/operations/transactions/deserializer.h b/src/operations/transactions/deserializer.h index e5ed358d..fbb9d64d 100644 --- a/src/operations/transactions/deserializer.h +++ b/src/operations/transactions/deserializer.h @@ -1,20 +1,28 @@ /******************************************************************************* -* Ark Wallet -* (c) 2017 Ledger -* (c) ARK Ecosystem -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -********************************************************************************/ + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + ******************************************************************************/ #ifndef ARK_OPERATIONS_TRANSACTIONS_DESERIALIZER_H #define ARK_OPERATIONS_TRANSACTIONS_DESERIALIZER_H @@ -24,9 +32,6 @@ #include //////////////////////////////////////////////////////////////////////////////// - bool deserialize(const uint8_t *buffer, size_t size); -//////////////////////////////////////////////////////////////////////////////// - -#endif +#endif // #define ARK_OPERATIONS_TRANSACTIONS_DESERIALIZER_H diff --git a/src/operations/transactions/legacy/deserialize_legacy.c b/src/operations/transactions/legacy/deserialize_legacy.c index 09e6fed2..b6565d79 100644 --- a/src/operations/transactions/legacy/deserialize_legacy.c +++ b/src/operations/transactions/legacy/deserialize_legacy.c @@ -1,20 +1,28 @@ /******************************************************************************* -* Ark Wallet -* (c) 2017 Ledger -* (c) ARK Ecosystem -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -********************************************************************************/ + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + ******************************************************************************/ #include "transactions/legacy/deserialize_legacy.h" @@ -30,7 +38,6 @@ #include "utils/utils.h" //////////////////////////////////////////////////////////////////////////////// - void deserializeCommonLegacy(Transaction *transaction, const uint8_t *buffer, size_t size) { @@ -59,5 +66,3 @@ void deserializeCommonLegacy(Transaction *transaction, transaction->assetOffset = ASSET_OFFSET_LEGACY; transaction->assetSize = size - transaction->assetOffset; } - -//////////////////////////////////////////////////////////////////////////////// diff --git a/src/operations/transactions/legacy/deserialize_legacy.h b/src/operations/transactions/legacy/deserialize_legacy.h index 6c8ecc41..ff3c2759 100644 --- a/src/operations/transactions/legacy/deserialize_legacy.h +++ b/src/operations/transactions/legacy/deserialize_legacy.h @@ -1,20 +1,28 @@ /******************************************************************************* -* Ark Wallet -* (c) 2017 Ledger -* (c) ARK Ecosystem -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -********************************************************************************/ + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + ******************************************************************************/ #ifndef ARK_OPERATIONS_TRANSACTIONS_DESERIALIZE_LEGACY_H #define ARK_OPERATIONS_TRANSACTIONS_DESERIALIZE_LEGACY_H @@ -25,11 +33,8 @@ #include "transactions/transaction.h" //////////////////////////////////////////////////////////////////////////////// - void deserializeCommonLegacy(Transaction *transaction, const uint8_t *buffer, size_t size); -//////////////////////////////////////////////////////////////////////////////// - -#endif +#endif // #define ARK_OPERATIONS_TRANSACTIONS_DESERIALIZE_LEGACY_H diff --git a/src/operations/transactions/legacy/display_legacy.c b/src/operations/transactions/legacy/display_legacy.c index bc45442d..58ac3674 100644 --- a/src/operations/transactions/legacy/display_legacy.c +++ b/src/operations/transactions/legacy/display_legacy.c @@ -1,20 +1,28 @@ /******************************************************************************* -* Ark Wallet -* (c) 2017 Ledger -* (c) ARK Ecosystem -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -********************************************************************************/ + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + ******************************************************************************/ #include "transactions/legacy/display_legacy.h" @@ -41,11 +49,9 @@ #include "display/display.h" //////////////////////////////////////////////////////////////////////////////// - extern void setDisplaySteps(uint8_t steps, bool isExtended); //////////////////////////////////////////////////////////////////////////////// - void setTransferLegacy(const Transaction *transaction) { bytecpy((char*)displayCtx.operation, "Transfer", 9); bytecpy((char*)displayCtx.title[0], "To", 3); @@ -83,7 +89,6 @@ void setTransferLegacy(const Transaction *transaction) { } //////////////////////////////////////////////////////////////////////////////// - static void setVoteLegacy(const Transaction *transaction) { bytecpy((char*)displayCtx.operation, "Vote", 5); bytecpy((char*)displayCtx.title[0], "Vote", 5); @@ -101,7 +106,6 @@ static void setVoteLegacy(const Transaction *transaction) { } //////////////////////////////////////////////////////////////////////////////// - void setDisplayLegacy(const Transaction *transaction) { explicit_bzero(&displayCtx, sizeof(displayCtx)); diff --git a/src/operations/transactions/legacy/display_legacy.h b/src/operations/transactions/legacy/display_legacy.h index 6beabe4b..d480a0c0 100644 --- a/src/operations/transactions/legacy/display_legacy.h +++ b/src/operations/transactions/legacy/display_legacy.h @@ -1,32 +1,35 @@ /******************************************************************************* -* Ark Wallet -* (c) 2017 Ledger -* (c) ARK Ecosystem -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -********************************************************************************/ + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + ******************************************************************************/ #ifndef ARK_OPERATIONS_TRANSACTIONS_DISPLAY_LEGACY_H #define ARK_OPERATIONS_TRANSACTIONS_DISPLAY_LEGACY_H -#include - #include "transactions/transaction.h" //////////////////////////////////////////////////////////////////////////////// - void setDisplayLegacy(const Transaction *transaction); -//////////////////////////////////////////////////////////////////////////////// - -#endif +#endif // #define ARK_OPERATIONS_TRANSACTIONS_DISPLAY_LEGACY_H diff --git a/src/operations/transactions/offsets.h b/src/operations/transactions/offsets.h index 061e455f..2d5c59c2 100644 --- a/src/operations/transactions/offsets.h +++ b/src/operations/transactions/offsets.h @@ -1,20 +1,28 @@ /******************************************************************************* -* Ark Wallet -* (c) 2017 Ledger -* (c) ARK Ecosystem -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -********************************************************************************/ + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + ******************************************************************************/ #ifndef ARK_TRANSACTIONS_DEFAULTS_OFFSETS_HPP #define ARK_TRANSACTIONS_DEFAULTS_OFFSETS_HPP diff --git a/src/operations/transactions/transaction.h b/src/operations/transactions/transaction.h index b652ee74..5802683b 100644 --- a/src/operations/transactions/transaction.h +++ b/src/operations/transactions/transaction.h @@ -1,20 +1,28 @@ /******************************************************************************* -* Ark Wallet -* (c) 2017 Ledger -* (c) ARK Ecosystem -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -********************************************************************************/ + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + ******************************************************************************/ #ifndef ARK_OPERATIONS_TRANSACTION_H #define ARK_OPERATIONS_TRANSACTION_H @@ -27,7 +35,6 @@ #include "transactions/types/assets.h" //////////////////////////////////////////////////////////////////////////////// - typedef struct transaction_t { uint8_t header; uint8_t version; @@ -51,6 +58,4 @@ typedef struct transaction_t { }; } Transaction; -//////////////////////////////////////////////////////////////////////////////// - -#endif +#endif // #define ARK_OPERATIONS_TRANSACTION_H diff --git a/src/operations/transactions/types/assets.h b/src/operations/transactions/types/assets.h index d203c257..2c7d9d54 100644 --- a/src/operations/transactions/types/assets.h +++ b/src/operations/transactions/types/assets.h @@ -1,54 +1,57 @@ /******************************************************************************* -* Ark Wallet -* (c) 2017 Ledger -* (c) ARK Ecosystem -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -********************************************************************************/ + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + ******************************************************************************/ #ifndef ARK_OPERATIONS_TRANSACTIONS_TYPES_ASSETS_H #define ARK_OPERATIONS_TRANSACTIONS_TYPES_ASSETS_H -//////////////////////////////////////////////////////////////////////////////// - #include "transactions/types/transfer.h" #include "transactions/types/second_signature.h" -// #include "transactions/types/delegate_registration.h" +/* #include "transactions/types/delegate_registration.h" */ #include "transactions/types/vote.h" -// #include "transactions/types/multi_signature.h" +/* #include "transactions/types/multi_signature.h" */ #include "transactions/types/ipfs.h" -// #include "transactions/types/multi_payment.h" -// #include "transactions/types/delegate_resignation.h" +/* #include "transactions/types/multi_payment.h" */ +/* #include "transactions/types/delegate_resignation.h" */ #include "transactions/types/htlc_lock.h" #include "transactions/types/htlc_claim.h" #include "transactions/types/htlc_refund.h" //////////////////////////////////////////////////////////////////////////////// - typedef union tx_asset_t { Transfer transfer; // Type 0 SecondSignatureRegistration secondSignature; // Type 1 - // Delegate Registration // Type 2 +/* Delegate Registration // Type 2 */ Vote vote; // Type 3 - // MultiSignature // Type 4 +/* MultiSignature // Type 4 */ Ipfs ipfs; // Type 5 - // MultiPayment // Type 6 - // Delegate Resignation // Type 7 +/* MultiPayment // Type 6 */ +/* Delegate Resignation // Type 7 */ HtlcLock htlcLock; // Type 8 HtlcClaim htlcClaim; // Type 9 HtlcRefund htlcRefund; // Type 10 } tx_asset_t; -//////////////////////////////////////////////////////////////////////////////// - -#endif +#endif // #define ARK_OPERATIONS_TRANSACTIONS_TYPES_ASSETS_H diff --git a/src/operations/transactions/types/htlc_claim.c b/src/operations/transactions/types/htlc_claim.c index 63502f79..493c9e4c 100644 --- a/src/operations/transactions/types/htlc_claim.c +++ b/src/operations/transactions/types/htlc_claim.c @@ -1,20 +1,28 @@ /******************************************************************************* -* Ark Wallet -* (c) 2017 Ledger -* (c) ARK Ecosystem -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -********************************************************************************/ + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + ******************************************************************************/ #include "transactions/types/htlc_claim.h" @@ -27,7 +35,6 @@ #include "utils/utils.h" //////////////////////////////////////////////////////////////////////////////// - // Htlc Claim (Type 8) - 64 Bytes // // @param HtlcClaim *claim @@ -56,5 +63,3 @@ bool deserializeHtlcClaim(HtlcClaim *claim, const uint8_t *buffer, size_t size) return true; } - -//////////////////////////////////////////////////////////////////////////////// diff --git a/src/operations/transactions/types/htlc_claim.h b/src/operations/transactions/types/htlc_claim.h index 7ef6b070..ecc62780 100644 --- a/src/operations/transactions/types/htlc_claim.h +++ b/src/operations/transactions/types/htlc_claim.h @@ -1,20 +1,28 @@ /******************************************************************************* -* Ark Wallet -* (c) 2017 Ledger -* (c) ARK Ecosystem -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -********************************************************************************/ + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + ******************************************************************************/ #ifndef ARK_OPERATIONS_TRANSACTIONS_TYPES_HTLC_CLAIM_H #define ARK_OPERATIONS_TRANSACTIONS_TYPES_HTLC_CLAIM_H @@ -26,16 +34,12 @@ #include "constants.h" //////////////////////////////////////////////////////////////////////////////// - typedef struct htlc_claim_asset_t { uint8_t id[HASH_32_LEN]; uint8_t secret[HASH_32_LEN]; } HtlcClaim; //////////////////////////////////////////////////////////////////////////////// - bool deserializeHtlcClaim(HtlcClaim *claim, const uint8_t *buffer, size_t size); -//////////////////////////////////////////////////////////////////////////////// - -#endif +#endif // #define ARK_OPERATIONS_TRANSACTIONS_TYPES_HTLC_CLAIM_H diff --git a/src/operations/transactions/types/htlc_lock.c b/src/operations/transactions/types/htlc_lock.c index 7224749b..70444b55 100644 --- a/src/operations/transactions/types/htlc_lock.c +++ b/src/operations/transactions/types/htlc_lock.c @@ -1,20 +1,28 @@ /******************************************************************************* -* Ark Wallet -* (c) 2017 Ledger -* (c) ARK Ecosystem -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -********************************************************************************/ + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + ******************************************************************************/ #include "transactions/types/htlc_lock.h" @@ -28,7 +36,6 @@ #include "utils/utils.h" //////////////////////////////////////////////////////////////////////////////// - // Htlc Lock (Type 8) - 66 Bytes // // @param HtlcLock *lock @@ -79,7 +86,7 @@ bool deserializeHtlcLock(HtlcLock *lock, const uint8_t *buffer, size_t size) { lock->expiration = U4LE(buffer, offset); // 4 Bytes - offset += sizeof(uint32_t); // += sizeof(expiration) + offset += sizeof(uint32_t); // += sizeof(expiration) bytecpy(lock->recipientId, // 21 Bytes &buffer[offset], @@ -87,5 +94,3 @@ bool deserializeHtlcLock(HtlcLock *lock, const uint8_t *buffer, size_t size) { return true; } - -//////////////////////////////////////////////////////////////////////////////// diff --git a/src/operations/transactions/types/htlc_lock.h b/src/operations/transactions/types/htlc_lock.h index d0178a32..b0ce2b66 100644 --- a/src/operations/transactions/types/htlc_lock.h +++ b/src/operations/transactions/types/htlc_lock.h @@ -1,20 +1,28 @@ /******************************************************************************* -* Ark Wallet -* (c) 2017 Ledger -* (c) ARK Ecosystem -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -********************************************************************************/ + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + ******************************************************************************/ #ifndef ARK_OPERATIONS_TRANSACTIONS_ASSETS_HTLC_LOCK_H #define ARK_OPERATIONS_TRANSACTIONS_ASSETS_HTLC_LOCK_H @@ -26,11 +34,9 @@ #include "constants.h" //////////////////////////////////////////////////////////////////////////////// - static const size_t TRANSACTION_TYPE_HTLC_LOCK_SIZE = 66; //////////////////////////////////////////////////////////////////////////////// - typedef struct htlc_lock_asset_t { uint64_t amount; uint8_t expirationType; @@ -40,9 +46,6 @@ typedef struct htlc_lock_asset_t { } HtlcLock; //////////////////////////////////////////////////////////////////////////////// - bool deserializeHtlcLock(HtlcLock *lock, const uint8_t *buffer, size_t size); -//////////////////////////////////////////////////////////////////////////////// - -#endif +#endif // #define ARK_OPERATIONS_TRANSACTIONS_ASSETS_HTLC_LOCK_H diff --git a/src/operations/transactions/types/htlc_refund.c b/src/operations/transactions/types/htlc_refund.c index 7ccfef94..2598a6db 100644 --- a/src/operations/transactions/types/htlc_refund.c +++ b/src/operations/transactions/types/htlc_refund.c @@ -1,20 +1,28 @@ /******************************************************************************* -* Ark Wallet -* (c) 2017 Ledger -* (c) ARK Ecosystem -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -********************************************************************************/ + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + ******************************************************************************/ #include "transactions/types/htlc_refund.h" @@ -27,7 +35,6 @@ #include "utils/utils.h" //////////////////////////////////////////////////////////////////////////////// - // Htlc Refund (Type 10) - 32 Bytes // // @param HtlcRefund *refund @@ -54,5 +61,3 @@ bool deserializeHtlcRefund(HtlcRefund *refund, return true; } - -//////////////////////////////////////////////////////////////////////////////// diff --git a/src/operations/transactions/types/htlc_refund.h b/src/operations/transactions/types/htlc_refund.h index 23479444..c98ea999 100644 --- a/src/operations/transactions/types/htlc_refund.h +++ b/src/operations/transactions/types/htlc_refund.h @@ -1,20 +1,28 @@ /******************************************************************************* -* Ark Wallet -* (c) 2017 Ledger -* (c) ARK Ecosystem -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -********************************************************************************/ + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + ******************************************************************************/ #ifndef ARK_OPERATIONS_TRANSACTIONS_TYPES_HTLC_REFUND_H #define ARK_OPERATIONS_TRANSACTIONS_TYPES_HTLC_REFUND_H @@ -26,17 +34,13 @@ #include "constants.h" //////////////////////////////////////////////////////////////////////////////// - typedef struct htlc_refund_asset_t { - uint8_t id[HASH_32_LEN]; + uint8_t id[HASH_32_LEN]; } HtlcRefund; //////////////////////////////////////////////////////////////////////////////// - bool deserializeHtlcRefund(HtlcRefund *refund, const uint8_t *buffer, size_t size); -//////////////////////////////////////////////////////////////////////////////// - -#endif +#endif // #define ARK_OPERATIONS_TRANSACTIONS_TYPES_HTLC_REFUND_H diff --git a/src/operations/transactions/types/ipfs.c b/src/operations/transactions/types/ipfs.c index 8fe83579..983425d3 100644 --- a/src/operations/transactions/types/ipfs.c +++ b/src/operations/transactions/types/ipfs.c @@ -1,20 +1,28 @@ /******************************************************************************* -* Ark Wallet -* (c) 2017 Ledger -* (c) ARK Ecosystem -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -********************************************************************************/ + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + ******************************************************************************/ #include "transactions/types/ipfs.h" @@ -27,7 +35,6 @@ #include "utils/utils.h" //////////////////////////////////////////////////////////////////////////////// - // IPFS (Type 5) - 0 <=> 64 Bytes // // @param Ipfs *ipfs @@ -64,5 +71,3 @@ bool deserializeIpfs(Ipfs *ipfs, const uint8_t *buffer, size_t size) { return true; } - -//////////////////////////////////////////////////////////////////////////////// diff --git a/src/operations/transactions/types/ipfs.h b/src/operations/transactions/types/ipfs.h index 7470496d..8aa770aa 100644 --- a/src/operations/transactions/types/ipfs.h +++ b/src/operations/transactions/types/ipfs.h @@ -1,20 +1,28 @@ /******************************************************************************* -* Ark Wallet -* (c) 2017 Ledger -* (c) ARK Ecosystem -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -********************************************************************************/ + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + ******************************************************************************/ #ifndef ARK_OPERATIONS_TRANSACTIONS_TYPES_IPFS_H #define ARK_OPERATIONS_TRANSACTIONS_TYPES_IPFS_H @@ -26,16 +34,12 @@ #include "constants.h" //////////////////////////////////////////////////////////////////////////////// - typedef struct ipfs_asset_t { - size_t length; - uint8_t dag[HASH_64_LEN]; + size_t length; + uint8_t dag[HASH_64_LEN]; } Ipfs; //////////////////////////////////////////////////////////////////////////////// - bool deserializeIpfs(Ipfs *ipfs, const uint8_t *buffer, size_t size); -//////////////////////////////////////////////////////////////////////////////// - -#endif +#endif // #define ARK_OPERATIONS_TRANSACTIONS_TYPES_IPFS_H diff --git a/src/operations/transactions/types/second_signature.c b/src/operations/transactions/types/second_signature.c index e020481b..45ae6a3d 100644 --- a/src/operations/transactions/types/second_signature.c +++ b/src/operations/transactions/types/second_signature.c @@ -1,20 +1,28 @@ /******************************************************************************* -* Ark Wallet -* (c) 2017 Ledger -* (c) ARK Ecosystem -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -********************************************************************************/ + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + ******************************************************************************/ #include "transactions/types/second_signature.h" @@ -27,7 +35,6 @@ #include "utils/utils.h" //////////////////////////////////////////////////////////////////////////////// - // Second Signature Registration (Type 1) - 33 Bytes // // @param SecondSignatureRegistration *registration @@ -54,5 +61,3 @@ bool deserializeSecondSignature(SecondSignatureRegistration *registration, return true; } - -//////////////////////////////////////////////////////////////////////////////// diff --git a/src/operations/transactions/types/second_signature.h b/src/operations/transactions/types/second_signature.h index b591fcbf..48102ee0 100644 --- a/src/operations/transactions/types/second_signature.h +++ b/src/operations/transactions/types/second_signature.h @@ -1,20 +1,28 @@ /******************************************************************************* -* Ark Wallet -* (c) 2017 Ledger -* (c) ARK Ecosystem -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -********************************************************************************/ + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + ******************************************************************************/ #ifndef ARK_OPERATIONS_TRANSACTIONS_TYPES_SECOND_SIGNATURE_H #define ARK_OPERATIONS_TRANSACTIONS_TYPES_SECOND_SIGNATURE_H @@ -26,17 +34,13 @@ #include "constants.h" //////////////////////////////////////////////////////////////////////////////// - typedef struct ss_registration_asset_t { - uint8_t publicKey[PUBLICKEY_COMPRESSED_LEN]; + uint8_t publicKey[PUBLICKEY_COMPRESSED_LEN]; } SecondSignatureRegistration; //////////////////////////////////////////////////////////////////////////////// - bool deserializeSecondSignature(SecondSignatureRegistration *registration, const uint8_t *buffer, size_t size); -//////////////////////////////////////////////////////////////////////////////// - -#endif +#endif // #define ARK_OPERATIONS_TRANSACTIONS_TYPES_SECOND_SIGNATURE_H diff --git a/src/operations/transactions/types/transfer.c b/src/operations/transactions/types/transfer.c index 01089132..2b90d1a6 100644 --- a/src/operations/transactions/types/transfer.c +++ b/src/operations/transactions/types/transfer.c @@ -1,20 +1,28 @@ /******************************************************************************* -* Ark Wallet -* (c) 2017 Ledger -* (c) ARK Ecosystem -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -********************************************************************************/ + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + ******************************************************************************/ #include "transactions/types/transfer.h" @@ -28,7 +36,6 @@ #include "utils/utils.h" //////////////////////////////////////////////////////////////////////////////// - // Deserialize Transfer (Type 0) - 33 bytes // // @param Transfer *transfer @@ -67,5 +74,3 @@ bool deserializeTransfer(Transfer *transfer, return true; } - -//////////////////////////////////////////////////////////////////////////////// diff --git a/src/operations/transactions/types/transfer.h b/src/operations/transactions/types/transfer.h index 32cb8538..5aa912a8 100644 --- a/src/operations/transactions/types/transfer.h +++ b/src/operations/transactions/types/transfer.h @@ -1,20 +1,28 @@ /******************************************************************************* -* Ark Wallet -* (c) 2017 Ledger -* (c) ARK Ecosystem -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -********************************************************************************/ + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + ******************************************************************************/ #ifndef ARK_OPERATIONS_TRANSACTIONS_TYPES_TRANSFER_H #define ARK_OPERATIONS_TRANSACTIONS_TYPES_TRANSFER_H @@ -26,11 +34,9 @@ #include "constants.h" //////////////////////////////////////////////////////////////////////////////// - static const size_t TRANSACTION_TYPE_TRANSFER_SIZE = 33; //////////////////////////////////////////////////////////////////////////////// - typedef struct transfer_asset_t { uint64_t amount; uint32_t expiration; @@ -38,9 +44,6 @@ typedef struct transfer_asset_t { } Transfer; //////////////////////////////////////////////////////////////////////////////// - bool deserializeTransfer(Transfer *transfer, const uint8_t *buffer, size_t size); -//////////////////////////////////////////////////////////////////////////////// - -#endif +#endif // #define ARK_OPERATIONS_TRANSACTIONS_TYPES_TRANSFER_H \ No newline at end of file diff --git a/src/operations/transactions/types/types.h b/src/operations/transactions/types/types.h index 51924f99..2600cdcf 100644 --- a/src/operations/transactions/types/types.h +++ b/src/operations/transactions/types/types.h @@ -1,41 +1,80 @@ /******************************************************************************* -* Ark Wallet -* (c) 2017 Ledger -* (c) ARK Ecosystem -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -********************************************************************************/ + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + ******************************************************************************/ #ifndef ARK_OPERATIONS_TRANSACTIONS_ASSETS_TYPES_H #define ARK_OPERATIONS_TRANSACTIONS_ASSETS_TYPES_H //////////////////////////////////////////////////////////////////////////////// - // ARK Transaction Types +// +// Supported Tx Types: +// - Transfer (type 0) +// - Second Signature Registration (type 1) +// - Vote/Unvote (type 3) +// - Ipfs (type 5) +// - Htlc Lock (type 8) +// - Htlc Claim (type 9) +// - Htlc Refund (type 10) +// +// --- +// +// Unsupported Tx Types: +// +// - Delegate Registration (type 2) +// *Not Supported* +// Delegates Forge; +// forging can't be done using a Ledger. +// +// - MultiSignature Registration (type 4) +// *Under Development* +// Ledger can't support max MultiSig. +// Schnorr also needs implemented. +// +// - MultiPayment (type 6) +// *Under Development* +// Ledger can't support max MultiPayment. +// +// - Delegate Resignation (type 7) +// *Not Supported* +// Delegates Forge; +// forging can't be done using a Ledger. +// +// --- enum TransactionTypes { TRANSFER_TYPE = 0, SECOND_SIGNATURE_TYPE = 1, - // DELEGATE_REGISTRATION_TYPE = 2, +/* DELEGATE_REGISTRATION_TYPE = 2, */ VOTE_TYPE = 3, - // MULTI_SIGNATURE_TYPE = 4, +/* MULTI_SIGNATURE_TYPE = 4, */ IPFS_TYPE = 5, - // MULTI_PAYMENT_TYPE = 6, - // DELEGATE_RESIGNATION_TYPE = 7, +/* MULTI_PAYMENT_TYPE = 6, */ +/* DELEGATE_RESIGNATION_TYPE = 7, */ HTLC_LOCK_TYPE = 8, HTLC_CLAIM_TYPE = 9, HTLC_REFUND_TYPE = 10 }; -//////////////////////////////////////////////////////////////////////////////// - -#endif +#endif // #define ARK_OPERATIONS_TRANSACTIONS_ASSETS_TYPES_H diff --git a/src/operations/transactions/types/vote.c b/src/operations/transactions/types/vote.c index 0033e580..0535bf66 100644 --- a/src/operations/transactions/types/vote.c +++ b/src/operations/transactions/types/vote.c @@ -1,20 +1,28 @@ /******************************************************************************* -* Ark Wallet -* (c) 2017 Ledger -* (c) ARK Ecosystem -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -********************************************************************************/ + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + ******************************************************************************/ #include "transactions/types/vote.h" @@ -27,7 +35,6 @@ #include "utils/utils.h" //////////////////////////////////////////////////////////////////////////////// - // Vote (Type 3) - 34 Bytes // // @param Vote *vote @@ -56,5 +63,3 @@ bool deserializeVote(Vote *vote, const uint8_t *buffer, size_t size) { return true; } - -//////////////////////////////////////////////////////////////////////////////// diff --git a/src/operations/transactions/types/vote.h b/src/operations/transactions/types/vote.h index c590dc6a..549f4330 100644 --- a/src/operations/transactions/types/vote.h +++ b/src/operations/transactions/types/vote.h @@ -1,20 +1,28 @@ /******************************************************************************* -* Ark Wallet -* (c) 2017 Ledger -* (c) ARK Ecosystem -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -********************************************************************************/ + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + ******************************************************************************/ #ifndef ARK_OPERATIONS_TRANSACTIONS_TYPES_VOTE_H #define ARK_OPERATIONS_TRANSACTIONS_TYPES_VOTE_H @@ -26,19 +34,14 @@ #include "constants.h" //////////////////////////////////////////////////////////////////////////////// - static const size_t VOTE_LEN = sizeof(uint8_t) + PUBLICKEY_COMPRESSED_LEN; //////////////////////////////////////////////////////////////////////////////// - typedef struct vote_asset_t { - uint8_t data[VOTE_LEN]; // ( '+/-' + publicKey[33]) + uint8_t data[VOTE_LEN]; // ( '+/-' + publicKey[33]) } Vote; //////////////////////////////////////////////////////////////////////////////// - bool deserializeVote(Vote *vote, const uint8_t *buffer, size_t size); -//////////////////////////////////////////////////////////////////////////////// - -#endif +#endif // #define ARK_OPERATIONS_TRANSACTIONS_TYPES_VOTE_H diff --git a/src/operations/transactions/ux/display_ux.c b/src/operations/transactions/ux/display_ux.c index 8210a53d..b547b075 100644 --- a/src/operations/transactions/ux/display_ux.c +++ b/src/operations/transactions/ux/display_ux.c @@ -1,20 +1,28 @@ /******************************************************************************* -* Ark Wallet -* (c) 2017 Ledger -* (c) ARK Ecosystem -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -********************************************************************************/ + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + ******************************************************************************/ #include "transactions/ux/display_ux.h" @@ -37,11 +45,9 @@ #include "display/display.h" //////////////////////////////////////////////////////////////////////////////// - extern void setDisplaySteps(uint8_t steps, bool isExtended); //////////////////////////////////////////////////////////////////////////////// - void setDisplay(const Transaction *transaction) { explicit_bzero(&displayCtx, sizeof(displayCtx)); @@ -89,5 +95,3 @@ void setDisplay(const Transaction *transaction) { default: break; }; } - -//////////////////////////////////////////////////////////////////////////////// diff --git a/src/operations/transactions/ux/display_ux.h b/src/operations/transactions/ux/display_ux.h index 096582e0..fa18c9fc 100644 --- a/src/operations/transactions/ux/display_ux.h +++ b/src/operations/transactions/ux/display_ux.h @@ -1,20 +1,28 @@ /******************************************************************************* -* Ark Wallet -* (c) 2017 Ledger -* (c) ARK Ecosystem -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -********************************************************************************/ + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + ******************************************************************************/ #ifndef ARK_OPERATIONS_TRANSACTIONS_UX_DISPLAY_UX_H #define ARK_OPERATIONS_TRANSACTIONS_UX_DISPLAY_UX_H @@ -22,9 +30,6 @@ #include "transactions/transaction.h" //////////////////////////////////////////////////////////////////////////////// - void setDisplay(const Transaction *transaction); -//////////////////////////////////////////////////////////////////////////////// - -#endif +#endif // #define ARK_OPERATIONS_TRANSACTIONS_UX_DISPLAY_UX_H diff --git a/src/operations/transactions/ux/htlc_claim_ux.c b/src/operations/transactions/ux/htlc_claim_ux.c index 6d2cce6c..dbaefec7 100644 --- a/src/operations/transactions/ux/htlc_claim_ux.c +++ b/src/operations/transactions/ux/htlc_claim_ux.c @@ -1,20 +1,28 @@ /******************************************************************************* -* Ark Wallet -* (c) 2017 Ledger -* (c) ARK Ecosystem -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -********************************************************************************/ + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + ******************************************************************************/ #include "transactions/ux/htlc_claim_ux.h" @@ -31,7 +39,6 @@ #include "display/context.h" //////////////////////////////////////////////////////////////////////////////// - void displayHtlcClaim(const Transaction *transaction) { const char *const LABEL = "HTLC Claim"; const size_t LABEL_SIZE = 12; @@ -56,5 +63,3 @@ void displayHtlcClaim(const Transaction *transaction) { transaction->asset.htlcClaim.secret, HASH_32_LEN); } - -//////////////////////////////////////////////////////////////////////////////// diff --git a/src/operations/transactions/ux/htlc_claim_ux.h b/src/operations/transactions/ux/htlc_claim_ux.h index cc1216af..c5c93058 100644 --- a/src/operations/transactions/ux/htlc_claim_ux.h +++ b/src/operations/transactions/ux/htlc_claim_ux.h @@ -1,20 +1,28 @@ /******************************************************************************* -* Ark Wallet -* (c) 2017 Ledger -* (c) ARK Ecosystem -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -********************************************************************************/ + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + ******************************************************************************/ #ifndef ARK_OPERATIONS_TRANSACTION_UX_HTLC_CLAIM_UX_H #define ARK_OPERATIONS_TRANSACTION_UX_HTLC_CLAIM_UX_H @@ -24,13 +32,9 @@ #include "operations/transactions/transaction.h" //////////////////////////////////////////////////////////////////////////////// - static const uint8_t STEPS_HTLC_CLAIM = 2U; //////////////////////////////////////////////////////////////////////////////// - void displayHtlcClaim(const Transaction *transaction); -//////////////////////////////////////////////////////////////////////////////// - -#endif +#endif // #define ARK_OPERATIONS_TRANSACTION_UX_HTLC_CLAIM_UX_H diff --git a/src/operations/transactions/ux/htlc_lock_ux.c b/src/operations/transactions/ux/htlc_lock_ux.c index 3a326ee0..619bee5a 100644 --- a/src/operations/transactions/ux/htlc_lock_ux.c +++ b/src/operations/transactions/ux/htlc_lock_ux.c @@ -1,20 +1,28 @@ /******************************************************************************* -* Ark Wallet -* (c) 2017 Ledger -* (c) ARK Ecosystem -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -********************************************************************************/ + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + ******************************************************************************/ #include "transactions/ux/htlc_lock_ux.h" @@ -35,7 +43,6 @@ #include "display/context.h" //////////////////////////////////////////////////////////////////////////////// - void displayHtlcLock(const Transaction *transaction) { const char *const LABEL = "HTLC Lock"; const size_t LABEL_SIZE = 10; @@ -44,10 +51,10 @@ void displayHtlcLock(const Transaction *transaction) { const size_t LABEL_SECRET_HASH_SIZE = 12; const char *const LABEL_TIME = "time: "; - const size_t LABEL_TIME_SIZE = 6; // sizeof - 1 + const size_t LABEL_TIME_SIZE = 6; // sizeof - 1 const char *const LABEL_HEIGHT = "height: "; - const size_t LABEL_HEIGHT_SIZE = 8; // sizeof - 1 + const size_t LABEL_HEIGHT_SIZE = 8; // sizeof - 1 bytecpy((char *)displayCtx.operation, LABEL, LABEL_SIZE); @@ -100,5 +107,3 @@ void displayHtlcLock(const Transaction *transaction) { setVendorField(transaction); } } - -//////////////////////////////////////////////////////////////////////////////// diff --git a/src/operations/transactions/ux/htlc_lock_ux.h b/src/operations/transactions/ux/htlc_lock_ux.h index 4b6b492e..f91eed47 100644 --- a/src/operations/transactions/ux/htlc_lock_ux.h +++ b/src/operations/transactions/ux/htlc_lock_ux.h @@ -1,20 +1,28 @@ /******************************************************************************* -* Ark Wallet -* (c) 2017 Ledger -* (c) ARK Ecosystem -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -********************************************************************************/ + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + ******************************************************************************/ #ifndef ARK_OPERATIONS_TRANSACTION_UX_HTLC_LOCK_UX_H #define ARK_OPERATIONS_TRANSACTION_UX_HTLC_LOCK_UX_H @@ -24,13 +32,9 @@ #include "operations/transactions/transaction.h" //////////////////////////////////////////////////////////////////////////////// - static const uint8_t STEPS_HTLC_LOCK_MIN = 5U; //////////////////////////////////////////////////////////////////////////////// - void displayHtlcLock(const Transaction *transaction); -//////////////////////////////////////////////////////////////////////////////// - -#endif +#endif // #define ARK_OPERATIONS_TRANSACTION_UX_HTLC_LOCK_UX_H diff --git a/src/operations/transactions/ux/htlc_refund_ux.c b/src/operations/transactions/ux/htlc_refund_ux.c index 41318502..11c9baf9 100644 --- a/src/operations/transactions/ux/htlc_refund_ux.c +++ b/src/operations/transactions/ux/htlc_refund_ux.c @@ -1,20 +1,28 @@ /******************************************************************************* -* Ark Wallet -* (c) 2017 Ledger -* (c) ARK Ecosystem -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -********************************************************************************/ + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + ******************************************************************************/ #include "transactions/ux/htlc_refund_ux.h" @@ -31,7 +39,6 @@ #include "display/context.h" //////////////////////////////////////////////////////////////////////////////// - void displayHtlcRefund(const Transaction *transaction) { const char *const LABEL = "HTLC Refund"; const size_t LABEL_SIZE = 12; @@ -47,5 +54,3 @@ void displayHtlcRefund(const Transaction *transaction) { transaction->asset.htlcRefund.id, HASH_32_LEN); } - -//////////////////////////////////////////////////////////////////////////////// diff --git a/src/operations/transactions/ux/htlc_refund_ux.h b/src/operations/transactions/ux/htlc_refund_ux.h index 3fe74812..5e4fd51c 100644 --- a/src/operations/transactions/ux/htlc_refund_ux.h +++ b/src/operations/transactions/ux/htlc_refund_ux.h @@ -1,20 +1,28 @@ /******************************************************************************* -* Ark Wallet -* (c) 2017 Ledger -* (c) ARK Ecosystem -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -********************************************************************************/ + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + ******************************************************************************/ #ifndef ARK_OPERATIONS_TRANSACTION_UX_HTLC_REFUND_UX_H #define ARK_OPERATIONS_TRANSACTION_UX_HTLC_REFUND_UX_H @@ -24,13 +32,9 @@ #include "operations/transactions/transaction.h" //////////////////////////////////////////////////////////////////////////////// - static const uint8_t STEPS_HTLC_REFUND = 1U; //////////////////////////////////////////////////////////////////////////////// - void displayHtlcRefund(const Transaction *transaction); -//////////////////////////////////////////////////////////////////////////////// - -#endif +#endif // #define ARK_OPERATIONS_TRANSACTION_UX_HTLC_REFUND_UX_H diff --git a/src/operations/transactions/ux/ipfs_ux.c b/src/operations/transactions/ux/ipfs_ux.c index fb1d2669..c57f5ec7 100644 --- a/src/operations/transactions/ux/ipfs_ux.c +++ b/src/operations/transactions/ux/ipfs_ux.c @@ -1,20 +1,28 @@ /******************************************************************************* -* Ark Wallet -* (c) 2017 Ledger -* (c) ARK Ecosystem -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -********************************************************************************/ + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + ******************************************************************************/ #include "transactions/ux/ipfs_ux.h" @@ -32,7 +40,6 @@ #include "display/context.h" //////////////////////////////////////////////////////////////////////////////// - void displayIpfs(const Transaction *transaction) { const char *const LABEL = "IPFS"; const size_t LABEL_SIZE = 5; @@ -55,5 +62,3 @@ void displayIpfs(const Transaction *transaction) { (uint8_t *)displayCtx.extended_text, MAX_TEXT_LEN); } - -//////////////////////////////////////////////////////////////////////////////// diff --git a/src/operations/transactions/ux/ipfs_ux.h b/src/operations/transactions/ux/ipfs_ux.h index cb641c39..a20e9170 100644 --- a/src/operations/transactions/ux/ipfs_ux.h +++ b/src/operations/transactions/ux/ipfs_ux.h @@ -1,20 +1,28 @@ /******************************************************************************* -* Ark Wallet -* (c) 2017 Ledger -* (c) ARK Ecosystem -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -********************************************************************************/ + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + ******************************************************************************/ #ifndef ARK_OPERATIONS_TRANSACTION_UX_IPFS_UX_H #define ARK_OPERATIONS_TRANSACTION_UX_IPFS_UX_H @@ -24,13 +32,9 @@ #include "operations/transactions/transaction.h" //////////////////////////////////////////////////////////////////////////////// - static const uint8_t STEPS_IPFS = 2U; //////////////////////////////////////////////////////////////////////////////// - void displayIpfs(const Transaction *transaction); -//////////////////////////////////////////////////////////////////////////////// - -#endif +#endif // #define ARK_OPERATIONS_TRANSACTION_UX_IPFS_UX_H diff --git a/src/operations/transactions/ux/second_signature_ux.c b/src/operations/transactions/ux/second_signature_ux.c index de87a9e5..3400bc13 100644 --- a/src/operations/transactions/ux/second_signature_ux.c +++ b/src/operations/transactions/ux/second_signature_ux.c @@ -1,20 +1,28 @@ /******************************************************************************* -* Ark Wallet -* (c) 2017 Ledger -* (c) ARK Ecosystem -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -********************************************************************************/ + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + ******************************************************************************/ #include "transactions/ux/second_signature_ux.h" @@ -32,7 +40,6 @@ #include "display/context.h" //////////////////////////////////////////////////////////////////////////////// - void displaySecondSignature(const Transaction *transaction) { const char *const LABEL = "2nd Signature"; const size_t LABEL_SIZE = 14; @@ -54,5 +61,3 @@ void displaySecondSignature(const Transaction *transaction) { (uint8_t *)displayCtx.text[1], sizeof(displayCtx.text[1]), TOKEN_NAME, TOKEN_NAME_SIZE, TOKEN_DECIMALS); } - -//////////////////////////////////////////////////////////////////////////////// diff --git a/src/operations/transactions/ux/second_signature_ux.h b/src/operations/transactions/ux/second_signature_ux.h index 6a8c9962..0dd7cc9b 100644 --- a/src/operations/transactions/ux/second_signature_ux.h +++ b/src/operations/transactions/ux/second_signature_ux.h @@ -1,20 +1,28 @@ /******************************************************************************* -* Ark Wallet -* (c) 2017 Ledger -* (c) ARK Ecosystem -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -********************************************************************************/ + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + ******************************************************************************/ #ifndef ARK_OPERATIONS_TRANSACTION_UX_SECOND_SIGNATURE_UX_H #define ARK_OPERATIONS_TRANSACTION_UX_SECOND_SIGNATURE_UX_H @@ -24,13 +32,9 @@ #include "operations/transactions/transaction.h" //////////////////////////////////////////////////////////////////////////////// - static const uint8_t STEPS_SECOND_SIGNATURE = 2U; //////////////////////////////////////////////////////////////////////////////// - void displaySecondSignature(const Transaction *transaction); -//////////////////////////////////////////////////////////////////////////////// - -#endif +#endif // #define ARK_OPERATIONS_TRANSACTION_UX_SECOND_SIGNATURE_UX_H diff --git a/src/operations/transactions/ux/transfer_ux.c b/src/operations/transactions/ux/transfer_ux.c index 4dcc7fcc..e1d214b6 100644 --- a/src/operations/transactions/ux/transfer_ux.c +++ b/src/operations/transactions/ux/transfer_ux.c @@ -1,20 +1,28 @@ /******************************************************************************* -* Ark Wallet -* (c) 2017 Ledger -* (c) ARK Ecosystem -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -********************************************************************************/ + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + ******************************************************************************/ #include "transactions/ux/transfer_ux.h" @@ -34,7 +42,6 @@ #include "display/context.h" //////////////////////////////////////////////////////////////////////////////// - void displayTransfer(const Transaction *transaction) { const char *const LABEL = "Transfer"; const size_t LABEL_SIZE = 9; @@ -77,5 +84,3 @@ void displayTransfer(const Transaction *transaction) { setVendorField(transaction); } } - -//////////////////////////////////////////////////////////////////////////////// diff --git a/src/operations/transactions/ux/transfer_ux.h b/src/operations/transactions/ux/transfer_ux.h index a1361f4b..3c780eb5 100644 --- a/src/operations/transactions/ux/transfer_ux.h +++ b/src/operations/transactions/ux/transfer_ux.h @@ -1,20 +1,28 @@ /******************************************************************************* -* Ark Wallet -* (c) 2017 Ledger -* (c) ARK Ecosystem -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -********************************************************************************/ + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + ******************************************************************************/ #ifndef ARK_OPERATIONS_TRANSACTIONS_UX_TRANSFER_UX_H #define ARK_OPERATIONS_TRANSACTIONS_UX_TRANSFER_UX_H @@ -24,13 +32,9 @@ #include "operations/transactions/transaction.h" //////////////////////////////////////////////////////////////////////////////// - static const uint8_t STEPS_TRANSFER_MIN = 4U; //////////////////////////////////////////////////////////////////////////////// - void displayTransfer(const Transaction *transaction); -//////////////////////////////////////////////////////////////////////////////// - -#endif +#endif // #define ARK_OPERATIONS_TRANSACTIONS_UX_TRANSFER_UX_H diff --git a/src/operations/transactions/ux/vendorfield_ux.c b/src/operations/transactions/ux/vendorfield_ux.c index b0723c1c..a26b8291 100644 --- a/src/operations/transactions/ux/vendorfield_ux.c +++ b/src/operations/transactions/ux/vendorfield_ux.c @@ -1,20 +1,28 @@ /******************************************************************************* -* Ark Wallet -* (c) 2017 Ledger -* (c) ARK Ecosystem -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -********************************************************************************/ + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + ******************************************************************************/ #include "transactions/ux/vendorfield_ux.h" @@ -30,7 +38,6 @@ #include "display/context.h" //////////////////////////////////////////////////////////////////////////////// - void setVendorField(const Transaction *transaction) { const char *const LABEL_VENDORFIELD = "VendorField"; const size_t LABEL_VENDORFIELD_SIZE = 12; @@ -44,5 +51,3 @@ void setVendorField(const Transaction *transaction) { transaction->vendorFieldLength); displayCtx.extended_text[transaction->vendorFieldLength] = '\0'; } - -//////////////////////////////////////////////////////////////////////////////// diff --git a/src/operations/transactions/ux/vendorfield_ux.h b/src/operations/transactions/ux/vendorfield_ux.h index f61d46ab..bee326ed 100644 --- a/src/operations/transactions/ux/vendorfield_ux.h +++ b/src/operations/transactions/ux/vendorfield_ux.h @@ -1,20 +1,28 @@ /******************************************************************************* -* Ark Wallet -* (c) 2017 Ledger -* (c) ARK Ecosystem -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -********************************************************************************/ + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + ******************************************************************************/ #ifndef ARK_OPERATIONS_TRANSACTIONS_UX_VENDORFIELD_UX_H #define ARK_OPERATIONS_TRANSACTIONS_UX_VENDORFIELD_UX_H @@ -22,9 +30,6 @@ #include "transactions/transaction.h" //////////////////////////////////////////////////////////////////////////////// - void setVendorField(const Transaction *transaction); -//////////////////////////////////////////////////////////////////////////////// - #endif // #define ARK_OPERATIONS_TRANSACTIONS_UX_VENDORFIELD_UX_H diff --git a/src/operations/transactions/ux/vote_ux.c b/src/operations/transactions/ux/vote_ux.c index f6e8659d..72776297 100644 --- a/src/operations/transactions/ux/vote_ux.c +++ b/src/operations/transactions/ux/vote_ux.c @@ -1,20 +1,28 @@ /******************************************************************************* -* Ark Wallet -* (c) 2017 Ledger -* (c) ARK Ecosystem -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -********************************************************************************/ + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + ******************************************************************************/ #include "transactions/ux/vote_ux.h" @@ -33,7 +41,6 @@ #include "display/context.h" //////////////////////////////////////////////////////////////////////////////// - void displayVote(const Transaction *transaction) { const char *const LABEL_VOTE = "Vote"; const size_t LABEL_VOTE_SIZE = 5; @@ -64,5 +71,3 @@ void displayVote(const Transaction *transaction) { (uint8_t *)displayCtx.text[1], sizeof(displayCtx.text[1]), TOKEN_NAME, TOKEN_NAME_SIZE, TOKEN_DECIMALS); } - -//////////////////////////////////////////////////////////////////////////////// diff --git a/src/operations/transactions/ux/vote_ux.h b/src/operations/transactions/ux/vote_ux.h index a10c9c18..e8d6772a 100644 --- a/src/operations/transactions/ux/vote_ux.h +++ b/src/operations/transactions/ux/vote_ux.h @@ -1,20 +1,28 @@ /******************************************************************************* -* Ark Wallet -* (c) 2017 Ledger -* (c) ARK Ecosystem -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -********************************************************************************/ + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + ******************************************************************************/ #ifndef ARK_OPERATIONS_TRANSACTIONS_UX_VOTE_UX_H #define ARK_OPERATIONS_TRANSACTIONS_UX_VOTE_UX_H @@ -24,13 +32,9 @@ #include "operations/transactions/transaction.h" //////////////////////////////////////////////////////////////////////////////// - static const uint8_t STEPS_VOTE = 2U; //////////////////////////////////////////////////////////////////////////////// - void displayVote(const Transaction *transaction); -//////////////////////////////////////////////////////////////////////////////// - -#endif +#endif // #define ARK_OPERATIONS_TRANSACTIONS_UX_VOTE_UX_H diff --git a/src/utils/base58.c b/src/utils/base58.c index 394e509f..45b1224d 100644 --- a/src/utils/base58.c +++ b/src/utils/base58.c @@ -1,20 +1,46 @@ /******************************************************************************* -* Ark Wallet -* (c) 2017 Ledger -* (c) ARK Ecosystem -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -********************************************************************************/ + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + * + * ----- + * + * Parts of this software are based on Ledger Nano SDK + * + * (c) 2017 Ledger + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ #include "utils/base58.h" @@ -29,7 +55,6 @@ #include "utils/utils.h" //////////////////////////////////////////////////////////////////////////////// - static const uint8_t BASE58ALPHABET[] = { '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', @@ -38,7 +63,6 @@ static const uint8_t BASE58ALPHABET[] = { }; //////////////////////////////////////////////////////////////////////////////// - uint8_t encodeBase58(uint8_t *in, size_t inSize, uint8_t *out, @@ -98,7 +122,6 @@ uint8_t encodeBase58(uint8_t *in, } //////////////////////////////////////////////////////////////////////////////// - uint16_t encodeBase58PublicKey(uint8_t *in, size_t inSize, uint8_t *out, @@ -132,5 +155,3 @@ uint16_t encodeBase58PublicKey(uint8_t *in, return encodeBase58(temp, ripeLength + 4, out, outSize); } - -//////////////////////////////////////////////////////////////////////////////// diff --git a/src/utils/base58.h b/src/utils/base58.h index 418df4fe..139419c7 100644 --- a/src/utils/base58.h +++ b/src/utils/base58.h @@ -1,20 +1,46 @@ /******************************************************************************* -* Ark Wallet -* (c) 2017 Ledger -* (c) ARK Ecosystem -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -********************************************************************************/ + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + * + * ----- + * + * Parts of this software are based on Ledger Nano SDK + * + * (c) 2017 Ledger + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ #ifndef ARK_UTILS_BASE58_H #define ARK_UTILS_BASE58_H @@ -23,7 +49,6 @@ #include //////////////////////////////////////////////////////////////////////////////// - uint8_t encodeBase58(uint8_t *in, size_t inSize, uint8_t *out, @@ -36,6 +61,4 @@ uint16_t encodeBase58PublicKey(uint8_t *in, uint16_t version, uint8_t alreadyHashed); -//////////////////////////////////////////////////////////////////////////////// - -#endif +#endif // #ifndef ARK_UTILS_BASE58_H diff --git a/src/utils/hex.c b/src/utils/hex.c index c7cb1bd6..3f214c2f 100644 --- a/src/utils/hex.c +++ b/src/utils/hex.c @@ -1,20 +1,28 @@ /******************************************************************************* -* Ark Wallet -* (c) 2017 Ledger -* (c) ARK Ecosystem -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -********************************************************************************/ + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + ******************************************************************************/ #include "utils/hex.h" @@ -22,14 +30,12 @@ #include //////////////////////////////////////////////////////////////////////////////// - static const uint8_t hexDigits[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; //////////////////////////////////////////////////////////////////////////////// - // Convert Bytes to a Hex string. // NULL terminator is added at (hexStringLen + 1) void bytesToHex(char *dest, const uint8_t *src, size_t length) { @@ -40,5 +46,3 @@ void bytesToHex(char *dest, const uint8_t *src, size_t length) { } *dest = '\0'; } - -//////////////////////////////////////////////////////////////////////////////// diff --git a/src/utils/hex.h b/src/utils/hex.h index 29372c0c..1c2f54fd 100644 --- a/src/utils/hex.h +++ b/src/utils/hex.h @@ -1,20 +1,28 @@ /******************************************************************************* -* Ark Wallet -* (c) 2017 Ledger -* (c) ARK Ecosystem -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -********************************************************************************/ + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + ******************************************************************************/ #ifndef ARK_UTILS_HEX_H #define ARK_UTILS_HEX_H @@ -23,9 +31,6 @@ #include //////////////////////////////////////////////////////////////////////////////// - void bytesToHex(char *dest, const uint8_t *src, size_t length); -//////////////////////////////////////////////////////////////////////////////// - -#endif +#endif // #ifndef ARK_UTILS_HEX_H diff --git a/src/utils/print.c b/src/utils/print.c index c6cdc2e5..56354947 100644 --- a/src/utils/print.c +++ b/src/utils/print.c @@ -1,20 +1,28 @@ /******************************************************************************* -* Ark Wallet -* (c) 2017 Ledger -* (c) ARK Ecosystem -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -********************************************************************************/ + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + ******************************************************************************/ #include "utils/print.h" @@ -27,7 +35,6 @@ #include "utils/utils.h" //////////////////////////////////////////////////////////////////////////////// - static bool adjustDecimals(char *src, size_t srcSize, char *target, @@ -114,7 +121,6 @@ static bool adjustDecimals(char *src, } //////////////////////////////////////////////////////////////////////////////// - size_t printAmount(uint64_t amount, uint8_t *out, size_t outSize, @@ -160,5 +166,3 @@ size_t printAmount(uint64_t amount, return sizeof(tmp2); } - -//////////////////////////////////////////////////////////////////////////////// diff --git a/src/utils/print.h b/src/utils/print.h index bc2904ff..cb294766 100644 --- a/src/utils/print.h +++ b/src/utils/print.h @@ -1,20 +1,28 @@ /******************************************************************************* -* Ark Wallet -* (c) 2017 Ledger -* (c) ARK Ecosystem -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -********************************************************************************/ + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + ******************************************************************************/ #ifndef ARK_UTILS_PRINT_H #define ARK_UTILS_PRINT_H @@ -23,7 +31,6 @@ #include //////////////////////////////////////////////////////////////////////////////// - size_t printAmount(uint64_t amount, uint8_t *out, size_t outSize, @@ -31,6 +38,4 @@ size_t printAmount(uint64_t amount, size_t tokenNameSize, uint8_t decimals); -//////////////////////////////////////////////////////////////////////////////// - -#endif +#endif // #ifndef ARK_UTILS_PRINT_H diff --git a/src/utils/unpack.h b/src/utils/unpack.h index 57cad9e3..955d5747 100644 --- a/src/utils/unpack.h +++ b/src/utils/unpack.h @@ -1,20 +1,46 @@ /******************************************************************************* -* Ark Wallet -* (c) 2017 Ledger -* (c) ARK Ecosystem -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -********************************************************************************/ + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + * + * ----- + * + * Parts of this software are based on Ledger Nano SDK + * + * (c) 2017 Ledger + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ #ifndef ARK_UTILS_UNPACK_H #define ARK_UTILS_UNPACK_H @@ -56,13 +82,11 @@ static const uint64_t U4_SHIFT = 32ULL; (((uint16_t)(((src)[((offset) + U1_SIZE)]) & U1_MAX) << U1_SHIFT))) \ & U2_MAX) -//////////////////////////////////////////////////////////////////////////////// #define U4LE(src, offset) \ ((((uint32_t)((U2LE((src), (offset))) & U2_MAX)) | \ (((uint32_t)((U2LE((src), ((offset) + U2_SIZE))) & U2_MAX) << U2_SHIFT))) \ & U4_MAX) -//////////////////////////////////////////////////////////////////////////////// #define U8LE(src, offset) \ ((((uint64_t)((U4LE((src), (offset))) & U4_MAX)) | \ (((uint64_t)((U4LE((src), ((offset) + U4_SIZE))) & U4_MAX) << U4_SHIFT))) \ diff --git a/src/utils/utils.h b/src/utils/utils.h index 714394fe..c0e3bded 100644 --- a/src/utils/utils.h +++ b/src/utils/utils.h @@ -1,20 +1,28 @@ /******************************************************************************* -* Ark Wallet -* (c) 2017 Ledger -* (c) ARK Ecosystem -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -********************************************************************************/ + * This file is part of the ARK Ledger App. + * + * Copyright (c) ARK Ecosystem + * + * The MIT License (MIT) + * + * 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. + ******************************************************************************/ #ifndef ARK_UTILS_H #define ARK_UTILS_H From 2b4320081e423534f6c53096876ef84e113297c2 Mon Sep 17 00:00:00 2001 From: Simon Date: Fri, 10 Jan 2020 13:12:54 -0800 Subject: [PATCH 2/2] chore: update `unsupported` comments and docs - rename `unimplemented` docs -> `unsupported` - update main README with a link the the `unsupported` docs. - add more information about what types aren't supported and why in code comments and in `unsupported` docs. --- README.md | 3 +- docs/unimplemented/README.md | 17 -------- docs/unsupported/README.md | 40 +++++++++++++++++++ .../delegate_registration/assets.h | 0 .../delegate_registration.c | 0 .../delegate_registration.h | 0 .../delegate_registration_ux.c | 0 .../delegate_registration_ux.h | 0 .../delegate_registration/deserializer.c | 0 .../delegate_registration/display_ux.c | 0 .../delegate_registration/types.h | 0 .../delegate_resignation/assets.h | 0 .../delegate_resignation.h | 0 .../delegate_resignation_ux.c | 0 .../delegate_resignation_ux.h | 0 .../delegate_resignation/deserializer.c | 0 .../delegate_resignation/display_ux.c | 0 .../multi_payment/assets.h | 0 .../multi_payment/deserializer.c | 0 .../multi_payment/display_ux.c | 0 .../multi_payment/multi_payment.c | 0 .../multi_payment/multi_payment.h | 0 .../multi_payment/multi_payment_ux.c | 0 .../multi_payment/multi_payment_ux.h | 0 .../multi_payment/types.h | 0 .../multi_signature/assets.h | 0 .../multi_signature/deserializer.c | 0 .../multi_signature/display_ux.c | 0 .../multi_signature/multi_signature.c | 0 .../multi_signature/multi_signature.h | 0 .../multi_signature/multi_signature_ux.c | 0 .../multi_signature/multi_signature_ux.h | 0 .../multi_signature/types.h | 0 src/operations/transactions/deserializer.c | 12 ++++++ src/operations/transactions/types/assets.h | 5 +-- src/operations/transactions/types/types.h | 7 ++-- 36 files changed, 59 insertions(+), 25 deletions(-) delete mode 100644 docs/unimplemented/README.md create mode 100644 docs/unsupported/README.md rename docs/{unimplemented => unsupported}/delegate_registration/assets.h (100%) rename docs/{unimplemented => unsupported}/delegate_registration/delegate_registration.c (100%) rename docs/{unimplemented => unsupported}/delegate_registration/delegate_registration.h (100%) rename docs/{unimplemented => unsupported}/delegate_registration/delegate_registration_ux.c (100%) rename docs/{unimplemented => unsupported}/delegate_registration/delegate_registration_ux.h (100%) rename docs/{unimplemented => unsupported}/delegate_registration/deserializer.c (100%) rename docs/{unimplemented => unsupported}/delegate_registration/display_ux.c (100%) rename docs/{unimplemented => unsupported}/delegate_registration/types.h (100%) rename docs/{unimplemented => unsupported}/delegate_resignation/assets.h (100%) rename docs/{unimplemented => unsupported}/delegate_resignation/delegate_resignation.h (100%) rename docs/{unimplemented => unsupported}/delegate_resignation/delegate_resignation_ux.c (100%) rename docs/{unimplemented => unsupported}/delegate_resignation/delegate_resignation_ux.h (100%) rename docs/{unimplemented => unsupported}/delegate_resignation/deserializer.c (100%) rename docs/{unimplemented => unsupported}/delegate_resignation/display_ux.c (100%) rename docs/{unimplemented => unsupported}/multi_payment/assets.h (100%) rename docs/{unimplemented => unsupported}/multi_payment/deserializer.c (100%) rename docs/{unimplemented => unsupported}/multi_payment/display_ux.c (100%) rename docs/{unimplemented => unsupported}/multi_payment/multi_payment.c (100%) rename docs/{unimplemented => unsupported}/multi_payment/multi_payment.h (100%) rename docs/{unimplemented => unsupported}/multi_payment/multi_payment_ux.c (100%) rename docs/{unimplemented => unsupported}/multi_payment/multi_payment_ux.h (100%) rename docs/{unimplemented => unsupported}/multi_payment/types.h (100%) rename docs/{unimplemented => unsupported}/multi_signature/assets.h (100%) rename docs/{unimplemented => unsupported}/multi_signature/deserializer.c (100%) rename docs/{unimplemented => unsupported}/multi_signature/display_ux.c (100%) rename docs/{unimplemented => unsupported}/multi_signature/multi_signature.c (100%) rename docs/{unimplemented => unsupported}/multi_signature/multi_signature.h (100%) rename docs/{unimplemented => unsupported}/multi_signature/multi_signature_ux.c (100%) rename docs/{unimplemented => unsupported}/multi_signature/multi_signature_ux.h (100%) rename docs/{unimplemented => unsupported}/multi_signature/types.h (100%) diff --git a/README.md b/README.md index 64993cf1..2caf450f 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ This app is written in C for the Ledger NanoS and NanoX devices. -While the Ledger ARK app _is_ compatible with the Ledger NanoX, there is currently no way to load a custom app until LedgerHQ releases the nanox-secure-sdk's. +While the Ledger ARK app _is_ compatible with the Ledger NanoX, there is currently no way to load a custom app until LedgerHQ releases the nanox-secure-sdk. The Ledger NanoS is—however— fully supported for development and flashing. @@ -26,6 +26,7 @@ For more development resources or environment installation and usage, see the fo * [ARK Ledger App Example Payloads](./docs/PAYLOADS.md) * [Development Resources](./docs/RESOURCES.md) * [Development Environment Installation and Usage](./docs/INSTALLATION.md) +* [Unsupported Transaction Types](./docs/unsupported/README.md) ## Security diff --git a/docs/unimplemented/README.md b/docs/unimplemented/README.md deleted file mode 100644 index 9a29dafe..00000000 --- a/docs/unimplemented/README.md +++ /dev/null @@ -1,17 +0,0 @@ - -# Unimplemented Feature Examples - -The code examples found here serve as a guide for adding these feature. -They're not final, tested, or guaranteed as working; -this should still hopefully make implementing these types much easier. - -## What's currently here - -* Type 2: Delegate Registration - >Delegates Forge; forging cannot be done using a Ledger. -* Type 4: MultiSignature Registration - >Ledger will not support max MultiSig. -* Type 6: MultiPayment - >Ledger will not support max MultiPayment. -* Type 7: Delegate Resignation - >Delegates Forge; forging cannot be done using a Ledger. diff --git a/docs/unsupported/README.md b/docs/unsupported/README.md new file mode 100644 index 00000000..61645525 --- /dev/null +++ b/docs/unsupported/README.md @@ -0,0 +1,40 @@ + +# Unsupported Transaction Types + +The examples found here illustrate how these transaction types could be implemented, +as well as why they are not supported. + +These are **not** final, tested, or guaranteed as working; +however, this should help make implementation easier when needed--if ever. + +## What's currently here + +* Type 2: Delegate Registration + >Not Supported. + > + >Delegates Forge; forging cannot be done using a Ledger. +* Type 4: MultiSignature Registration + >Development in progress. + > + >Max MultiSig can potentially take up lots of memory. + >Handling and display logic requires careful consideration. + >Schnorr signing also need implemented. +* Type 6: MultiPayment + >Not supported + > + >Max MultiPayment just won't fit. + >This type can be upwards of ~2MB; + >Ledger NanoS only has 4KiB(~4KB) of runtime memory. + > + >It's also unreasonable to expect users to consistently validate hundreds-of-payments; + >especially on a device the size of a pack of chewing gum. + >This could encourage users to haphazardly skip over verifying payments. + > + >Additionally, using checksum-based validation exposes users to potential attacks from compromised wallets. + > + >Considering the above, + >it's better to protect users and err on the side of security by not supporting MultiPayment at this time. +* Type 7: Delegate Resignation + >Not Supported. + > + >Delegates Forge; forging cannot be done using a Ledger. diff --git a/docs/unimplemented/delegate_registration/assets.h b/docs/unsupported/delegate_registration/assets.h similarity index 100% rename from docs/unimplemented/delegate_registration/assets.h rename to docs/unsupported/delegate_registration/assets.h diff --git a/docs/unimplemented/delegate_registration/delegate_registration.c b/docs/unsupported/delegate_registration/delegate_registration.c similarity index 100% rename from docs/unimplemented/delegate_registration/delegate_registration.c rename to docs/unsupported/delegate_registration/delegate_registration.c diff --git a/docs/unimplemented/delegate_registration/delegate_registration.h b/docs/unsupported/delegate_registration/delegate_registration.h similarity index 100% rename from docs/unimplemented/delegate_registration/delegate_registration.h rename to docs/unsupported/delegate_registration/delegate_registration.h diff --git a/docs/unimplemented/delegate_registration/delegate_registration_ux.c b/docs/unsupported/delegate_registration/delegate_registration_ux.c similarity index 100% rename from docs/unimplemented/delegate_registration/delegate_registration_ux.c rename to docs/unsupported/delegate_registration/delegate_registration_ux.c diff --git a/docs/unimplemented/delegate_registration/delegate_registration_ux.h b/docs/unsupported/delegate_registration/delegate_registration_ux.h similarity index 100% rename from docs/unimplemented/delegate_registration/delegate_registration_ux.h rename to docs/unsupported/delegate_registration/delegate_registration_ux.h diff --git a/docs/unimplemented/delegate_registration/deserializer.c b/docs/unsupported/delegate_registration/deserializer.c similarity index 100% rename from docs/unimplemented/delegate_registration/deserializer.c rename to docs/unsupported/delegate_registration/deserializer.c diff --git a/docs/unimplemented/delegate_registration/display_ux.c b/docs/unsupported/delegate_registration/display_ux.c similarity index 100% rename from docs/unimplemented/delegate_registration/display_ux.c rename to docs/unsupported/delegate_registration/display_ux.c diff --git a/docs/unimplemented/delegate_registration/types.h b/docs/unsupported/delegate_registration/types.h similarity index 100% rename from docs/unimplemented/delegate_registration/types.h rename to docs/unsupported/delegate_registration/types.h diff --git a/docs/unimplemented/delegate_resignation/assets.h b/docs/unsupported/delegate_resignation/assets.h similarity index 100% rename from docs/unimplemented/delegate_resignation/assets.h rename to docs/unsupported/delegate_resignation/assets.h diff --git a/docs/unimplemented/delegate_resignation/delegate_resignation.h b/docs/unsupported/delegate_resignation/delegate_resignation.h similarity index 100% rename from docs/unimplemented/delegate_resignation/delegate_resignation.h rename to docs/unsupported/delegate_resignation/delegate_resignation.h diff --git a/docs/unimplemented/delegate_resignation/delegate_resignation_ux.c b/docs/unsupported/delegate_resignation/delegate_resignation_ux.c similarity index 100% rename from docs/unimplemented/delegate_resignation/delegate_resignation_ux.c rename to docs/unsupported/delegate_resignation/delegate_resignation_ux.c diff --git a/docs/unimplemented/delegate_resignation/delegate_resignation_ux.h b/docs/unsupported/delegate_resignation/delegate_resignation_ux.h similarity index 100% rename from docs/unimplemented/delegate_resignation/delegate_resignation_ux.h rename to docs/unsupported/delegate_resignation/delegate_resignation_ux.h diff --git a/docs/unimplemented/delegate_resignation/deserializer.c b/docs/unsupported/delegate_resignation/deserializer.c similarity index 100% rename from docs/unimplemented/delegate_resignation/deserializer.c rename to docs/unsupported/delegate_resignation/deserializer.c diff --git a/docs/unimplemented/delegate_resignation/display_ux.c b/docs/unsupported/delegate_resignation/display_ux.c similarity index 100% rename from docs/unimplemented/delegate_resignation/display_ux.c rename to docs/unsupported/delegate_resignation/display_ux.c diff --git a/docs/unimplemented/multi_payment/assets.h b/docs/unsupported/multi_payment/assets.h similarity index 100% rename from docs/unimplemented/multi_payment/assets.h rename to docs/unsupported/multi_payment/assets.h diff --git a/docs/unimplemented/multi_payment/deserializer.c b/docs/unsupported/multi_payment/deserializer.c similarity index 100% rename from docs/unimplemented/multi_payment/deserializer.c rename to docs/unsupported/multi_payment/deserializer.c diff --git a/docs/unimplemented/multi_payment/display_ux.c b/docs/unsupported/multi_payment/display_ux.c similarity index 100% rename from docs/unimplemented/multi_payment/display_ux.c rename to docs/unsupported/multi_payment/display_ux.c diff --git a/docs/unimplemented/multi_payment/multi_payment.c b/docs/unsupported/multi_payment/multi_payment.c similarity index 100% rename from docs/unimplemented/multi_payment/multi_payment.c rename to docs/unsupported/multi_payment/multi_payment.c diff --git a/docs/unimplemented/multi_payment/multi_payment.h b/docs/unsupported/multi_payment/multi_payment.h similarity index 100% rename from docs/unimplemented/multi_payment/multi_payment.h rename to docs/unsupported/multi_payment/multi_payment.h diff --git a/docs/unimplemented/multi_payment/multi_payment_ux.c b/docs/unsupported/multi_payment/multi_payment_ux.c similarity index 100% rename from docs/unimplemented/multi_payment/multi_payment_ux.c rename to docs/unsupported/multi_payment/multi_payment_ux.c diff --git a/docs/unimplemented/multi_payment/multi_payment_ux.h b/docs/unsupported/multi_payment/multi_payment_ux.h similarity index 100% rename from docs/unimplemented/multi_payment/multi_payment_ux.h rename to docs/unsupported/multi_payment/multi_payment_ux.h diff --git a/docs/unimplemented/multi_payment/types.h b/docs/unsupported/multi_payment/types.h similarity index 100% rename from docs/unimplemented/multi_payment/types.h rename to docs/unsupported/multi_payment/types.h diff --git a/docs/unimplemented/multi_signature/assets.h b/docs/unsupported/multi_signature/assets.h similarity index 100% rename from docs/unimplemented/multi_signature/assets.h rename to docs/unsupported/multi_signature/assets.h diff --git a/docs/unimplemented/multi_signature/deserializer.c b/docs/unsupported/multi_signature/deserializer.c similarity index 100% rename from docs/unimplemented/multi_signature/deserializer.c rename to docs/unsupported/multi_signature/deserializer.c diff --git a/docs/unimplemented/multi_signature/display_ux.c b/docs/unsupported/multi_signature/display_ux.c similarity index 100% rename from docs/unimplemented/multi_signature/display_ux.c rename to docs/unsupported/multi_signature/display_ux.c diff --git a/docs/unimplemented/multi_signature/multi_signature.c b/docs/unsupported/multi_signature/multi_signature.c similarity index 100% rename from docs/unimplemented/multi_signature/multi_signature.c rename to docs/unsupported/multi_signature/multi_signature.c diff --git a/docs/unimplemented/multi_signature/multi_signature.h b/docs/unsupported/multi_signature/multi_signature.h similarity index 100% rename from docs/unimplemented/multi_signature/multi_signature.h rename to docs/unsupported/multi_signature/multi_signature.h diff --git a/docs/unimplemented/multi_signature/multi_signature_ux.c b/docs/unsupported/multi_signature/multi_signature_ux.c similarity index 100% rename from docs/unimplemented/multi_signature/multi_signature_ux.c rename to docs/unsupported/multi_signature/multi_signature_ux.c diff --git a/docs/unimplemented/multi_signature/multi_signature_ux.h b/docs/unsupported/multi_signature/multi_signature_ux.h similarity index 100% rename from docs/unimplemented/multi_signature/multi_signature_ux.h rename to docs/unsupported/multi_signature/multi_signature_ux.h diff --git a/docs/unimplemented/multi_signature/types.h b/docs/unsupported/multi_signature/types.h similarity index 100% rename from docs/unimplemented/multi_signature/types.h rename to docs/unsupported/multi_signature/types.h diff --git a/src/operations/transactions/deserializer.c b/src/operations/transactions/deserializer.c index 6b1122ef..79c95556 100644 --- a/src/operations/transactions/deserializer.c +++ b/src/operations/transactions/deserializer.c @@ -196,16 +196,28 @@ static bool deserializeAsset(Transaction *transaction, return deserializeSecondSignature( &transaction->asset.secondSignature, buffer, size); + // Delegate Registration + /* case DELEGATE_REGISTRATION_TYPE: */ // <- Not Supported + // Vote case VOTE_TYPE: return deserializeVote( &transaction->asset.vote, buffer, size); + // MultiSignature Registration + /* case MULTI_SIGNATURE_TYPE: */ // <- Under Development + // Ipfs case IPFS_TYPE: return deserializeIpfs( &transaction->asset.ipfs, buffer, size); + // MultiPayment + /* case MULTI_PAYMENT_TYPE: */ // <- Not Supported + + // Delegate Resignation + /* case DELEGATE_RESIGNATION_TYPE: */ // <- Not Supported + // Htlc Lock case HTLC_LOCK_TYPE: return deserializeHtlcLock( diff --git a/src/operations/transactions/types/assets.h b/src/operations/transactions/types/assets.h index 2c7d9d54..ddd8f24a 100644 --- a/src/operations/transactions/types/assets.h +++ b/src/operations/transactions/types/assets.h @@ -29,12 +29,9 @@ #include "transactions/types/transfer.h" #include "transactions/types/second_signature.h" -/* #include "transactions/types/delegate_registration.h" */ #include "transactions/types/vote.h" -/* #include "transactions/types/multi_signature.h" */ +/* #include "transactions/types/multi_signature.h" */ // <- Under Development #include "transactions/types/ipfs.h" -/* #include "transactions/types/multi_payment.h" */ -/* #include "transactions/types/delegate_resignation.h" */ #include "transactions/types/htlc_lock.h" #include "transactions/types/htlc_claim.h" #include "transactions/types/htlc_refund.h" diff --git a/src/operations/transactions/types/types.h b/src/operations/transactions/types/types.h index 2600cdcf..ed4342e3 100644 --- a/src/operations/transactions/types/types.h +++ b/src/operations/transactions/types/types.h @@ -50,18 +50,19 @@ // // - MultiSignature Registration (type 4) // *Under Development* -// Ledger can't support max MultiSig. +// Handling and display logic need careful consideration. // Schnorr also needs implemented. // // - MultiPayment (type 6) -// *Under Development* -// Ledger can't support max MultiPayment. +// *Not Supported* +// Max MultiPayment won't fit on Ledger hardware. // // - Delegate Resignation (type 7) // *Not Supported* // Delegates Forge; // forging can't be done using a Ledger. // +// for more info, see the "unsupported" section of the ARK Ledger App docs. // --- enum TransactionTypes { TRANSFER_TYPE = 0,