Skip to content

Commit

Permalink
v1.0.2-RC3 (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
MButcho authored Jan 20, 2021
1 parent 586f160 commit dc59c3c
Show file tree
Hide file tree
Showing 10 changed files with 198 additions and 71 deletions.
16 changes: 8 additions & 8 deletions docs/build-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,23 +43,23 @@ npm run dist-linux;


## Checksum:
1.0.2-RC2
1.0.2-RC3

windows:

openssl dgst -sha512 -binary Elastos-Light-Wallet-Setup-1.0.2-RC2.exe | openssl base64 -A
openssl dgst -sha512 -binary Elastos-Light-Wallet-Setup-1.0.2-RC3.exe | openssl base64 -A

xxxx

Ubuntu 18:

openssl sha -sha512 Elastos-Light-Wallet-1.0.2-RC2.AppImage
openssl sha -sha512 Elastos-Light-Wallet-1.0.2-RC3.AppImage

xxxx

Mac:

openssl dgst -sha512 Elastos-Light-Wallet-1.0.2-RC2.dmg
openssl dgst -sha512 Elastos-Light-Wallet-1.0.2-RC3.dmg

xxxx

Expand All @@ -77,13 +77,13 @@ npm ls node-gyp


# to auto build a releases
git commit -am v1.0.2-RC2;
git tag v1.0.2-RC2;
git commit -am v1.0.2-RC3;
git tag v1.0.2-RC3;
git push;
git push --tags;

## to delete release tags
git push --delete origin v1.0.2-RC2;
git tag -d v1.0.2-RC2;
git push --delete origin v1.0.2-RC3;
git tag -d v1.0.2-RC3;
git pull;
git push;
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "elastos-light-wallet",
"version": "v1.0.2-RC2",
"version": "v1.0.2-RC3",
"description": "elastos light wallet",
"productName": "Elastos Light Wallet",
"main": "index.js",
Expand Down
45 changes: 32 additions & 13 deletions scripts/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ let feeAmountEla = '';

let sendToAddress = '';

let txMemo = '';

let sendStep = 1;

let isLoggedIn = false;
Expand Down Expand Up @@ -951,6 +953,7 @@ const clearSendData = () => {
GuiUtils.setValue('sendToAddress', '');
cryptoNameELAAddress = '';
GuiUtils.setValue('feeAmount', feeRequested);
GuiUtils.setValue('txMemo', '');
GuiUtils.setValue('sendPassword', '');
GuiUtils.setValue('votePassword', '');
sendAmount = '';
Expand All @@ -959,6 +962,7 @@ const clearSendData = () => {
sendToAddressStatuses.length = 0;
sendToAddressLinks.length = 0;
sendToAddress = '';
txMemo = '';
setSendStep(1);
//requestFee();
//mainConsole.log('SUCCESS clearSendData');
Expand Down Expand Up @@ -999,6 +1003,7 @@ const validateInputs = () => {
sendAmount = GuiUtils.getValue('sendAmount').replace(/,/g, '.');
feeAmountSats = GuiUtils.getValue('feeAmount');
feeRequested = feeAmountSats;
txMemo = GuiUtils.getValue('txMemo');

const isValidHistory = checkTransactionHistory();
if (!isValidHistory) {
Expand Down Expand Up @@ -1125,7 +1130,7 @@ const consolidateUTXOs = () => {
}

let encodedTx;
const tx = TxFactory.createUnsignedSendToTx(unspentTransactionOutputs, getAddress() , maxAmountToSend, publicKey, feeAmountSats, feeAccount, false);
const tx = TxFactory.createUnsignedSendToTx(unspentTransactionOutputs, getAddress() , maxAmountToSend, publicKey, feeAmountSats, feeAccount, '', false);
const encodedUnsignedTx = TxTranscoder.encodeTx(tx, false);

if (Math.ceil(encodedUnsignedTx.length/2) > maxTXSize) {
Expand Down Expand Up @@ -1180,7 +1185,7 @@ const consolidateUTXOs = () => {
}

if (privateKey) {
const encodedTx = TxFactory.createSignedSendToTx(privateKey, unspentTransactionOutputs, getAddress(), maxAmountToSend, feeAmountSats, feeAccount);
const encodedTx = TxFactory.createSignedSendToTx(privateKey, unspentTransactionOutputs, getAddress(), maxAmountToSend, feeAmountSats, feeAccount, '');
if (encodedTx == undefined) {
return false;
}
Expand Down Expand Up @@ -1217,7 +1222,7 @@ const sendAmountToAddress = () => {
let encodedTx;

if (useLedgerFlag) {
const tx = TxFactory.createUnsignedSendToTx(unspentTransactionOutputs, sendToAddress, sendAmount, publicKey, feeAmountSats, feeAccount, true);
const tx = TxFactory.createUnsignedSendToTx(unspentTransactionOutputs, sendToAddress, sendAmount, publicKey, feeAmountSats, feeAccount, txMemo, true);
const encodedUnsignedTx = TxTranscoder.encodeTx(tx, false);
//console.log(Math.ceil(encodedUnsignedTx.length/2));
showLedgerConfirmBanner(getTxByteLength(encodedUnsignedTx));
Expand Down Expand Up @@ -1265,7 +1270,7 @@ const sendAmountToAddress = () => {
}

if (privateKey) {
const encodedTx = TxFactory.createSignedSendToTx(privateKey, unspentTransactionOutputs, sendToAddress, sendAmount, feeAmountSats, feeAccount);
const encodedTx = TxFactory.createSignedSendToTx(privateKey, unspentTransactionOutputs, sendToAddress, sendAmount, feeAmountSats, feeAccount, txMemo);
if (encodedTx == undefined) {
return false;
}
Expand Down Expand Up @@ -1772,15 +1777,15 @@ const getTransactionHistoryReadyCallback = (transactionHistory) => {
parsedTransaction.txDetailsUrl = getTransactionHistoryLink(tx.Txid);
parsedTransaction.date = date;
parsedTransaction.time = time;
parsedTransaction.memoLong = tx.Memo;
if (parsedTransaction.memoLong.length > 14) {
parsedTransaction.memoLong = parsedTransaction.memoLong.substring(14, parsedTransaction.memoLong.length).trim();
}
parsedTransaction.memo = tx.Memo;
if (parsedTransaction.memo.length > 14) {
var n = 14;
if (parsedTransaction.memo.indexOf("From ELABank,") >= 0) n = n + 13;
parsedTransaction.memo = parsedTransaction.memo.substring(n, n + 24) + '...'.trim();
let memo = tx.Memo;
if (memo.indexOf("type:text,msg:") >= 0) memo = memo.substring(14, memo.length).trim();
parsedTransaction.memoLong = memo;
if (memo.length > 14) {
var n = 0;
if (memo.indexOf("From ELABank,") >= 0) n = n + 13;
parsedTransaction.memo = memo.substring(n, n + 24) + '...'.trim();
} else {
parsedTransaction.memo = memo;
}
if (tx.CreateTime != 0) {
let confirmedHeight = tx.Height;
Expand Down Expand Up @@ -2211,10 +2216,23 @@ const getFeeAmountSats = () => {
return feeAmountSats;
};

const getTxMemo = (_short) => {
let maxLength = 55;
if (_short) {
if (txMemo.length > maxLength) {
return txMemo.substr(0,maxLength)+" ...";
} else {
return txMemo;
}
}
return txMemo;
};

const writeSendData = () => {
sendToAddress = GuiUtils.getValue('sendToAddress');
sendAmount = GuiUtils.getValue('sendAmount').replace(/,/g, '.');
feeAmountSats = GuiUtils.getValue('feeAmount');
txMemo = GuiUtils.getValue('txMemo');
feeRequested = feeAmountSats;
}

Expand Down Expand Up @@ -3019,6 +3037,7 @@ exports.getSendAmount = getSendAmount;
exports.getFeeAmountEla = getFeeAmountEla;
exports.getSendToAddress = getSendToAddress;
exports.getFeeAmountSats = getFeeAmountSats;
exports.getTxMemo = getTxMemo;
exports.getSendStep = getSendStep;
exports.setSendStep = setSendStep;
exports.sendAmountToAddress = sendAmountToAddress;
Expand Down
24 changes: 19 additions & 5 deletions scripts/GuiToggles.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ let app;
let bannerID;
let bannerTimeout = 10000;
let page = '';
let menuOpened = false;

const init = (_app) => {
app = _app;
Expand All @@ -33,15 +34,20 @@ const hideEverything = () => {
hideAllMenus();
};

const hideAllMenus = () => {
const hideAllMenus = (_name) => {
GuiUtils.hide('importBanner');
GuiUtils.hide('createBanner');
const menus = ['home', 'landing', 'voting', 'import', 'create'];
menus.forEach((menu) => {
hide(menu+'Menu');
menus.forEach((name) => {
hide(name+'Menu');
// hide(menu+'MenuOpen');
hide(menu+'MenuClose');
hide(name+'MenuClose');
});

if (_name !== undefined && _name !== "") {
show(_name+'MenuOpen');
}
menuOpened = false;
};

const showLanding = () => {
Expand Down Expand Up @@ -77,13 +83,15 @@ const showMenu = (name) => {
hide(name+'MenuOpen');
show(name+'MenuClose');
hide('version');
menuOpened = true;
};

const hideMenu = (name) => {
hide(name+'Menu');
show(name+'MenuOpen');
hide(name+'MenuClose');
show('version');
menuOpened = false;
};

const showVoting = () => {
Expand Down Expand Up @@ -163,12 +171,17 @@ const getPage = () => {
return page;
}

const getMenuOpened = () => {
return menuOpened;
}

exports.init = init;
exports.showLanding = showLanding;
exports.showImport = showImport;
exports.showHome = showHome;
exports.showMenu = showMenu;
exports.hideMenu = hideMenu;
exports.hideAllMenus = hideAllMenus;
exports.showVoting = showVoting;
exports.showQRCode = showQRCode;
exports.showSettings = showSettings;
Expand All @@ -179,4 +192,5 @@ exports.showExportMnemonic = showExportMnemonic;
exports.showAllBanners = showAllBanners;
exports.hideAllBanners = hideAllBanners;
exports.bannerID = bannerID;
exports.getPage = getPage;
exports.getPage = getPage;
exports.getMenuOpened = getMenuOpened;
19 changes: 13 additions & 6 deletions scripts/TxFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ const ZERO = BigNumber(0, 10);
const FEE_SATS = BigNumber(100, 10);
/* eslint-enable */

const createSignedSendToTx = (privateKey, unspentTransactionOutputs, sendToAddress, sendAmount, feeAmountSats, feeAccount) => {
const createSignedSendToTx = (privateKey, unspentTransactionOutputs, sendToAddress, sendAmount, feeAmountSats, feeAccount, txMemo) => {
if (Number.isNaN(sendAmount)) {
throw new Error(`sendAmount ${sendAmount} is not a number`);
}
if (Number.isNaN(feeAmountSats)) {
throw new Error(`feeAmountSats ${feeAmountSats} is not a number`);
}
const publicKey = KeyTranscoder.getPublic(privateKey);
const tx = createUnsignedSendToTx(unspentTransactionOutputs, sendToAddress, sendAmount, publicKey, feeAmountSats, feeAccount);
const tx = createUnsignedSendToTx(unspentTransactionOutputs, sendToAddress, sendAmount, publicKey, feeAmountSats, feeAccount, txMemo);
const signature = TxSigner.getSignature(tx, privateKey);
const encodedSignedTx = TxSigner.addSignatureToTx(tx, publicKey, signature);

Expand All @@ -33,7 +33,7 @@ const createSignedSendToTx = (privateKey, unspentTransactionOutputs, sendToAddre
return encodedSignedTx;
};

const createUnsignedSendToTx = (unspentTransactionOutputs, sendToAddress, sendAmount, publicKey, feeAmountSats, feeAccount, showOutput) => {
const createUnsignedSendToTx = (unspentTransactionOutputs, sendToAddress, sendAmount, publicKey, feeAmountSats, feeAccount, txMemo, showOutput) => {
if (unspentTransactionOutputs == undefined) {
throw new Error(`unspentTransactionOutputs is undefined`);
}
Expand All @@ -55,10 +55,10 @@ const createUnsignedSendToTx = (unspentTransactionOutputs, sendToAddress, sendAm
/* eslint-disable */
const sendAmountSats = BigNumber(sendAmount, 10).times(Asset.satoshis);
/* eslint-enable */
return createUnsignedSendToTxSats(unspentTransactionOutputs, sendToAddress, sendAmountSats, publicKey, feeAmountSats, feeAccount, showOutput);
return createUnsignedSendToTxSats(unspentTransactionOutputs, sendToAddress, sendAmountSats, publicKey, feeAmountSats, feeAccount, txMemo, showOutput);
};

const createUnsignedSendToTxSats = (unspentTransactionOutputs, sendToAddress, sendAmountSats, publicKey, feeAmountStr, feeAccount, showOutput) => {
const createUnsignedSendToTxSats = (unspentTransactionOutputs, sendToAddress, sendAmountSats, publicKey, feeAmountStr, feeAccount, txMemo, showOutput) => {
// mainConsole.log('STARTED createUnsignedSendToTxSats');
if (unspentTransactionOutputs == undefined) {
throw new Error(`unspentTransactionOutputs is undefined`);
Expand Down Expand Up @@ -100,6 +100,13 @@ const createUnsignedSendToTxSats = (unspentTransactionOutputs, sendToAddress, se
txAttribute.Usage = 0;
txAttribute.Data = '30';
tx.TxAttributes.push(txAttribute);

if (txMemo !== undefined && txMemo !== "") {
const txAttribute2 = {};
txAttribute2.Usage = 0x81;
txAttribute2.Data = Buffer.from("type:text,msg:"+txMemo, 'utf8').toString('hex');
tx.TxAttributes.push(txAttribute2);
}
}

/* eslint-disable */
Expand Down Expand Up @@ -183,7 +190,7 @@ const createUnsignedSendToTxSats = (unspentTransactionOutputs, sendToAddress, se
}

tx.Programs = [];
// mainConsole.log('SUCCESS createUnsignedSendToTxSats', tx);
//mainConsole.log('SUCCESS createUnsignedSendToTxSats', tx);

return tx;
};
Expand Down
Loading

0 comments on commit dc59c3c

Please sign in to comment.