Skip to content

Commit

Permalink
Merge pull request #24 from aliascash/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
HLXEasy authored Mar 27, 2022
2 parents 2b82d66 + 263023c commit 624a923
Show file tree
Hide file tree
Showing 15 changed files with 263 additions and 55 deletions.
2 changes: 2 additions & 0 deletions ReleaseNotes.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# ALiWa - Alias Light Wallet Release Notes

## Changelog
### 0.1.2
Adding type native currency for sending & receiving
### 0.1.1
MAC BUILD PATCH
### 0.1.0
Expand Down
2 changes: 1 addition & 1 deletion confg package
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
--------fresh package.json---------
{
"name": "ALiWa",
"version": "0.1.1",
"version": "0.1.2",
"author": "dynamiccreator",
"description": "ALiWa - A light wallet for the Alias cryptocurrency.",
"main": "main.js",
Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html>
<head>
<meta charset="UTF-8">
<title>ALiWa v0.1.1 - Alias Light Wallet</title>
<title>ALiWa v0.1.2 - Alias Light Wallet</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="aliwa_current_site" content="null">
<!-- You MUST include jQuery before Fomantic -->
Expand Down
2 changes: 1 addition & 1 deletion inno-setup.iss
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#define MyAppName "ALiWa"
#define MyAppVersion "0.1.1"
#define MyAppVersion "0.1.2"

#define MyAppPublisher "Alias Team"
#define MyAppURL "https://github.com/aliascash/aliwa"
Expand Down
4 changes: 2 additions & 2 deletions ipc_communications.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,8 @@ module.exports = function () {
return list_result;
});

ipcMain.handle('list_contact_addresses', async (event,page, order_field, direction, search) => {
var list_result= wallet.list_contact_addresses(page, order_field, direction, search);
ipcMain.handle('list_contact_addresses', async (event,page, order_field, direction, search,strict_label=false) => {
var list_result= wallet.list_contact_addresses(page, order_field, direction, search,strict_label);
return list_result;
});

Expand Down
47 changes: 37 additions & 10 deletions logic/wallet.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ class aliwa_wallet{
this.db_wallet=new db_wallet_r.db_wallet();
const wallet_functions_r=require("./wallet_functions");
this.wallet_functions=new wallet_functions_r.wallet_functions();

this.last_send_tx_hash=null;
this.last_send_tx_object=null;
}


Expand Down Expand Up @@ -141,7 +144,8 @@ class aliwa_wallet{
}

if(cnf.aliwa_server_address!=null && cnf.aliwa_server_address.includes(".onion")){
this.socket = await io.connect(cnf.aliwa_server_address, { agent: agent });
this.socket = await io.connect(cnf.aliwa_server_address, { agent: agent,
withCredentials: true, extraHeaders: {"aliwa-server": "true"}});
}


Expand Down Expand Up @@ -170,14 +174,25 @@ class aliwa_wallet{
var message = JSON.parse(result.message);
if (message.result == undefined || message.result == null) {
this.gui_was_updated = "failed_send";
this.last_send_tx_hash=null;
this.last_send_tx_object=null;
return false;
}
if (message.result.length == 64) { //only if result is a valid tx

//update self sent
this.db_wallet.update_self_sent_txs(message.result, result.data.inputs, result.data.outputs);
//update transactions

//update self sent
if(this.last_send_tx_hash!=result.data && this.last_send_tx_hash!=null){
this.last_send_tx_hash=null;
this.last_send_tx_object=null;

this.gui_was_updated = "failed_send";
return false;
}
this.db_wallet.update_self_sent_txs(message.result, this.last_send_tx_object.inputs, this.last_send_tx_object.outputs);
this.last_send_tx_hash=null;
this.last_send_tx_object=null;

//update address list
var cnf = this.db_wallet.get_config_values();
var private_standard_address_list = this.db_wallet.get_wallet_addresses(0, 0, (cnf.used_pos.standard + 20));
var private_change_address_list = this.db_wallet.get_wallet_addresses(1, 0, (cnf.used_pos.change + 20));
Expand All @@ -187,6 +202,8 @@ class aliwa_wallet{
} else {
console.error(message.error);
this.gui_was_updated = "failed_send";
this.last_send_tx_hash=null;
this.last_send_tx_object=null;
return message.error;
}

Expand Down Expand Up @@ -582,7 +599,7 @@ class aliwa_wallet{
}


list_contact_addresses(page, order_field, direction, search) {
list_contact_addresses(page, order_field, direction, search,strict_label=false) {
// add / update standard contacts


Expand All @@ -600,12 +617,19 @@ class aliwa_wallet{
} else {
search=search.trim();
var txs = this.db_wallet.get_contact_addresses();
var result = [];
var tx_array = txs.chain().find({'$or': [
var result = [];
var tx_array=[];
if(strict_label){
tx_array = txs.chain().find({"label": {'$aeq': search}})
.simplesort(order_field, {desc: direction}).data({forceClones: true, removeMeta: true});
}
else{
tx_array = txs.chain().find({'$or': [
{"pos": {'$aeq': (parseInt(search)-1)}},
{"label": {'$contains': search}},
{"address": {'$contains': search}}
]}).simplesort(order_field, {desc: direction}).data({forceClones: true, removeMeta: true});
}
var len = tx_array.length;
var page_start = page * this.pagination_num;
for (var i = page_start; i < page_start + this.pagination_num && i < len; i++) {
Expand Down Expand Up @@ -747,7 +771,10 @@ class aliwa_wallet{


async send_transaction(hex,tx_object){
this.socket.emit("send_raw_tx",hex,tx_object);
this.last_send_tx_hash= createHash('sha256').update(hex).digest().toString("hex");
this.last_send_tx_object=tx_object;
//console.log("send_raw_tx",hex,this.last_send_tx_hash);
this.socket.emit("send_raw_tx",hex,this.last_send_tx_hash);
}

create_transaction(destinations,fee,utxo_result,fee_only) {
Expand All @@ -757,7 +784,7 @@ class aliwa_wallet{
var amount=new Big(0);
for(var i=0;i<destinations.length;i++){
amount=amount.plus(destinations[i].amount);
console.log("correct value ? :",(destinations[i].amount));
//console.log("correct value ? :",(destinations[i].amount));
}
if(fee==undefined){fee=this.const_fee;}
amount=amount.plus(fee);
Expand Down
4 changes: 2 additions & 2 deletions logic/wallet_functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class wallet_functions {
for (var o = 0; o < tx_input_data.outputs.length; o++) {
output_hex += int_toVarint_byte(Math.floor(new Big(tx_input_data.outputs[o].amount).times(100000000).toNumber()), 8); // Math.floor because of javascript adding some 0.000000000001 at the end after multiplying
output_hex += int_toVarint_byte(25, 1);// script length
output_hex += "76a914" + bs58_2.decode(tx_input_data.outputs[o].destination_address).toString("hex").substr(2, 40) + "88ac";//output script
output_hex += "76a914" + Buffer(bs58_2.decode(tx_input_data.outputs[o].destination_address)).toString("hex").substr(2, 40) + "88ac";//output script
//build narration if available
if (tx_input_data.outputs[o].narration != undefined) {
// console.log("narration:\n");
Expand Down Expand Up @@ -162,4 +162,4 @@ class wallet_functions {

}

exports.wallet_functions = wallet_functions;
exports.wallet_functions = wallet_functions;
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ALiWa",
"version": "0.1.1",
"version": "0.1.2",
"author": "dynamiccreator",
"description": "ALiWa - A light wallet for the Alias cryptocurrency.",
"main": "main.js",
Expand Down
13 changes: 12 additions & 1 deletion view_resources/css/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ html * {
color: #db2828;
}

.aliwa_input_field,.aliwa_input_field_search,.aliwa_input_field_white,.aliwa_input_field_red{
.aliwa_input_field,.aliwa_input_field_search,.aliwa_input_field_white,.aliwa_input_field_red,.aliwa_input_field_secondary{
background: none !important;
border:none !important;
color:#f38320 !important;
Expand All @@ -104,11 +104,22 @@ html * {
text-overflow: ellipsis !important;
}

.aliwa_input_field_secondary{
border-bottom: none !important;
color:#ccc !important;
padding: 0.5rem 0.5rem 0.0rem 0 !important;
}

.aliwa_input_field::placeholder,.aliwa_input_field_search::placeholder { /* Chrome, Firefox, Opera, Safari 10.1+ */
color: #f38320 !important;
opacity: 0.6 !important; /* Firefox */
}

.aliwa_input_field_secondary::placeholder { /* Chrome, Firefox, Opera, Safari 10.1+ */
color: #ccc !important;
opacity: 0.6 !important; /* Firefox */
}

.aliwa_input_field_search{
padding: 0.5rem 0.5rem 0.5rem 2rem !important;
}
Expand Down
2 changes: 1 addition & 1 deletion view_resources/html/templ_about.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div style="margin: auto;text-align: center;">
<div style="text-align: left">
<div style="font-size: 1.5rem;color:#fff;">Thanks for using the ALiWa Wallet!<br><br>
<b>Version:</b> v0.1.1 <br><br>
<b>Version:</b> v0.1.2 <br><br>
<b>Blockheight: </b> <span id="view_about_blockheight"></span> <br><br>
<b>Server Label: </b> <br><span id="view_about_server_label" style="display: inline;overflow: hidden;text-overflow: ellipsis;max-width: 90%;"></span> <br><br>
<b>Server Address: </b> <br> <span id="view_about_server_address" style="display: inline-block;overflow: hidden;text-overflow: ellipsis;max-width: 90%;"></span> <br><br>
Expand Down
14 changes: 11 additions & 3 deletions view_resources/html/templ_receive_payment.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,20 @@
</div>
<!-- <span class="aliwa_input_label_distance">Amount</span> <br> -->
<div class="ui action input large fluid">
<input id="view_receive_payment_amount_input" type="text" value="" class="aliwa_input_field" placeholder="0.00000000">
<input id="view_receive_payment_amount_input" type="text" value="" class="aliwa_input_field" placeholder="0.00000000">
<i id="view_receive_payment_amount_input_clear" class="times link icon white inverted large" style="margin-top: 0.5rem"></i>
<span style="color:#f38320;padding-top:0.7rem;padding-right: 0rem;">ALIAS</span>
</div>

<div class="ui action input large fluid">
<input id="view_receive_payment_value_input" type="text" value="" class="aliwa_input_field_secondary" placeholder="0.00000000">

<i id="view_receive_payment_value_input_clear" class="times link icon white inverted large" style="margin-top: 0.5rem"></i>
<span id="view_receive_payment_value_input_currency" style="color:#ccc;padding-top:0.7rem;padding-right: 1rem;">USD</span>

</div>




<div style="text-align: center;">
<button id="view_receive_payment_copy_button" class="ui icon button alias_orange_button2 massive" style="margin-top: 2rem;">
<i class="clone outline icon white"></i>&nbsp;Copy Payment
Expand Down
11 changes: 8 additions & 3 deletions view_resources/html/templ_send.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,19 @@
<i id="view_send_input_amount_clear" class="times link icon white inverted large" style="margin-top: 0.5rem"></i>
</div>

<span id="send_currency_value" style="color:#8a8c8e;font-size: 1.5rem;margin-top: 0.7rem;display: inline-block;font-family:aliwa_mono;">0.00</span>
<!--<span id="send_currency_value" style="color:#8a8c8e;font-size: 1.5rem;margin-top: 0.7rem;display: inline-block;font-family:aliwa_mono;">0.00</span> -->

<div class="ui input large fluid">
<input id="send_currency_input_value" type="text" value="" class="aliwa_input_field_secondary" style= "font-family:aliwa_mono;" placeholder="0.00000000">
<i id="send_currency_input_value_clear" class="times link icon white inverted large" style="margin-top: 0.5rem"></i>
</div>

</div>

<div style="float: left;width: 9rem;">
<div style="float:left;margin-left: 0.5rem;">
<span style="color: #f38320;font-size: 1.1rem;margin-top: 1.3rem;display: inline-block;">ALIAS</span> <br>
<span id="send_currency_label" style="color: #8a8c8e;font-size: 1.1rem;margin-top: 1.3rem;display: inline-block;">
<span id="send_currency_label" style="color: #ccc;font-size: 1.1rem;margin-top: 1.3rem;display: inline-block;">

<!-- <button class="ui icon button">
Expand Down Expand Up @@ -100,7 +105,7 @@
<div style="clear: both;"></div>

<div style="margin: auto;text-align: center;margin-top:1rem;">
<button id="view_send_button_send_transaction" class="ui icon button alias_orange_button2 massive" style="margin-top:calc(100vh - 40rem);width:20rem;">
<button id="view_send_button_send_transaction" class="ui icon button alias_orange_button2 massive" style="margin-top:calc(100vh - 41rem);width:20rem;">
Send
</button>
</div>
Expand Down
2 changes: 1 addition & 1 deletion view_resources/html/templ_start_up.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<section id="view_startup" style="background: #382b3f;height:100%;width:100%;">
<img src="view_resources/img/aliwa_logo_5_light.png" style="margin:auto;display: block;max-height: 20rem;max-width:50%;">
<div style="color: #fff;text-align: center;margin-top:0.5rem;" class="ui text">v0.1.1</div>
<div style="color: #fff;text-align: center;margin-top:0.5rem;" class="ui text">v0.1.2</div>
<div style="color: #fff;text-align: center;margin-top:0.5rem;" class="ui text">@2021 by dynamiccreator</div>


Expand Down
Loading

0 comments on commit 624a923

Please sign in to comment.