Skip to content
This repository has been archived by the owner on Aug 27, 2022. It is now read-only.

Add SmartData Option to transfers, UI tweaks #35

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,19 @@
<br>
<a href="https://aidoskuneen.com"><img src="https://aidoskuneen.com/wp-content/uploads/2020/08/cropped-adk-logo-footer-192x192.png" alt="Aidos Kuneen"></a>
<br>
Aidos Kuneen Wallet
Aidos Kuneen Wallet (<b>incl. Support for SmartData Transactions<b>)
<br>
</h1>

<h5 align="center">This repository contains the desktop wallet for Aidos Kuneen</h6>
<h5 align="center">This repository has been forked from AidosKuneen/aidos-wallet by ADKMASTER.</h5>

<p align="center">
<a href="https://raw.githubusercontent.com/AidosKuneen/aidos-wallet/master/LICENSE">
<img src="https://img.shields.io/badge/license-GPLv3-blue.svg" alt="License">
</a>
This Fork is used by ADKMASTER in order to develop and add additional features, which will be published back to AidosKuneen/aidos-wallet as pull requests.
</p>

## Prebuilt binaries

If you want to just use the wallet app, please download [the latest release](https://github.com/AidosKuneen/aidos-wallet/releases) for your OS.
If you want to just use the wallet app with Smart Data functionality, please download (https://github.com/adkmaster/aidos-wallet/releases/download/2.1.2/ADK.Wallet.Setup.2.1.2.SD.exe)

For every version there are two options: default (mainnet) build and testnet build. You probably need default one, for
the mainnet. **Testnet builds should be used only for interacting with the test network of Aidos Kuneen!**
Expand Down Expand Up @@ -47,12 +45,12 @@ If you want to package the wallet you will need:

## Build & Run

These instructions are only in case you want to build the wallet by yourself. Pre-built packages are available on [Release Page](https://github.com/AidosKuneen/aidos-wallet/releases).
These instructions are only in case you want to build the wallet by yourself. Pre-built packages are available on [Release Page](https://github.com/adkmaster/aidos-wallet/releases).

1. Clone this repository:

```
git clone https://github.com/AidosKuneen/aidos-wallet
git clone https://github.com/adkmaster/aidos-wallet
```

2. Install dependencies:
Expand Down Expand Up @@ -85,7 +83,7 @@ You need the specific OS for each package (i.e. cannot cross compile).

5. After that you can find the compiled binaries in the `out` dir.

## [Changelog](https://github.com/AidosKuneen/aidos-wallet/blob/master/changelog.md)
## [Changelog](https://github.com/adkmaster/aidos-wallet/blob/master/changelog.md)

## LICENSE

Expand Down
24 changes: 21 additions & 3 deletions app/ui/aidos.html
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ <h1 class="ml-4 font-medium text-xl text-white">Aidos Kuneen</h1>
class="absolute"
onload="SVGInject(this)"
/>
<span class="ml-12">Withdraw</span>
<span class="ml-12">Transfer</span>
</a>
</li>
<li></li>
Expand All @@ -98,7 +98,7 @@ <h1 class="ml-4 font-medium text-xl text-white">Aidos Kuneen</h1>
class="absolute"
onload="SVGInject(this)"
/>
<span class="ml-12">Deposit</span>
<span class="ml-12">Receive</span>
</a>
</li>
<li></li>
Expand Down Expand Up @@ -490,6 +490,24 @@ <h3 class="font-medium text-sm text-silver">
class="w-full py-3 px-2 appearance-none bg-transparent border-b-2 border-cerebral-grey uppercase focus:outline-none"
id="transfer-address"
/>
</div>
<div class="w-full pt-10 px-4">
<label
for="additional-data"
class="block font-medium text-gravel text-sm"
onclick="toggleSmartData()"
>
Advanced: Add Smart Data [click here to show]
</label>
<input
type="text"
name="additional-data"
class="w-full py-3 px-2 appearance-none bg-transparent border-b-2 small border-cerebral-grey uppercase focus:outline-none"
style="display:none"
id="transfer-additional-data"
placeholder="Allowed Chars: A-Z9 Max Lenght: 2187"
maxLength="2187"
/>
</div>
</div>
<div class="pt-12 flex justify-center">
Expand Down Expand Up @@ -784,7 +802,7 @@ <h2 class="font-medium text-3xl">Settings</h2>
Edit Node Configuration
</button>
</div>
</div>
</div>
</div>
</div>
</div>
Expand Down
10 changes: 10 additions & 0 deletions app/ui/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,16 @@ function preventFromJumping() {
});
});
}

function toggleSmartData() {
var x = document.getElementById("transfer-additional-data");
if (x.style.display === "none") {
x.style.display = "block";
} else {
x.style.display = "none";
}
}

// Load functions when dom is ready
document.addEventListener(
"DOMContentLoaded",
Expand Down
19 changes: 17 additions & 2 deletions app/ui/js/ui.transfers.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,13 @@ var UI = (function (UI, $, undefined) {
}

$stack.addClass("loading");

var transfer_additional_data = "";

try {
var address = $("#transfer-address").val().toUpperCase();

transfer_additional_data = $("#transfer-additional-data").val().toUpperCase();

if (!address) {
throw "Address is required";
} else if (address.length == 81) {
Expand All @@ -29,6 +32,10 @@ var UI = (function (UI, $, undefined) {
throw "Incorrect address checksum";
}

if (!transfer_additional_data) {
transfer_additional_data = "";
}

// var amount = aidos.utils.convertUnits(parseFloat($("#transfer-amount").val()), $("#transfer-units-value").html(), "i");

var multi = 100000000;
Expand Down Expand Up @@ -64,6 +71,11 @@ var UI = (function (UI, $, undefined) {
if (tag && /[^A-Z9]/.test(tag)) {
throw "Tag is invalid";
}

if (transfer_additional_data && /[^A-Z9]/.test(transfer_additional_data)) {
throw "Smart Data contains invalid characters";
}

} catch (error) {
$stack.removeClass("loading");
UI.formError("transfer", error);
Expand All @@ -74,11 +86,14 @@ var UI = (function (UI, $, undefined) {
$("#progress-bar").removeClass("hidden");
console.log("Server.transfer: " + address + " -> " + amount);


aidos.api.sendTransfer(
connection.seed,
connection.depth,
connection.minWeightMagnitude,
[{ address: address, value: amount, message: "", tag: tag }],
[{ address: address, value: amount,
message: transfer_additional_data.slice(0, 2187),
tag: tag }],
function (error, transfers) {
if (error) {
console.log("UI.handleTransfers: Error");
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "adk-wallet",
"productName": "ADK Wallet",
"description": "Aidos Kuneen Wallet",
"version": "2.1.1",
"version": "2.1.2",
"license": "GPL-3.0",
"main": "app/js/main.js",
"engines": {
Expand Down