From 0420306995747e492c020bfac34d344431eb2496 Mon Sep 17 00:00:00 2001 From: vantuz-subhuman Date: Fri, 10 Jun 2022 12:53:37 +0300 Subject: [PATCH 1/5] Canonical inputs sorting before submitting to Ledger --- .../app/api/ada/transactions/shelley/ledgerTx.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/yoroi-extension/app/api/ada/transactions/shelley/ledgerTx.js b/packages/yoroi-extension/app/api/ada/transactions/shelley/ledgerTx.js index a5e7416b24..5e60297203 100644 --- a/packages/yoroi-extension/app/api/ada/transactions/shelley/ledgerTx.js +++ b/packages/yoroi-extension/app/api/ada/transactions/shelley/ledgerTx.js @@ -133,6 +133,16 @@ export async function createLedgerSignTxPayload(request: {| }; } +/** + * Canonical inputs sorting: by tx hash and then by index + */ +function compareInputs(a: TxInput, b: TxInput): number { + if (a.txHashHex !== b.txHashHex) { + return a.txHashHex < b.txHashHex ? -1 : 1; + } + return a.outputIndex - b.outputIndex; +} + function _transformToLedgerInputs( inputs: Array ): Array { @@ -143,7 +153,7 @@ function _transformToLedgerInputs( txHashHex: input.tx_hash, outputIndex: input.tx_index, path: input.addressing.path, - })); + })).sort(compareInputs); } function toLedgerTokenBundle( From c1dbc4daed1f44ddbfbde92faa3770119c545633 Mon Sep 17 00:00:00 2001 From: yushi Date: Thu, 9 Jun 2022 12:13:25 +0800 Subject: [PATCH 2/5] remove fiat conversion on pending tx amount --- .../app/components/wallet/summary/WalletSummary.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/yoroi-extension/app/components/wallet/summary/WalletSummary.js b/packages/yoroi-extension/app/components/wallet/summary/WalletSummary.js index 5fde9c327f..f3a0adea89 100644 --- a/packages/yoroi-extension/app/components/wallet/summary/WalletSummary.js +++ b/packages/yoroi-extension/app/components/wallet/summary/WalletSummary.js @@ -118,7 +118,7 @@ export default class WalletSummary extends Component { } = this.props; let pendingAmount = null; - if (unitOfAccountSetting.enabled) { + if (false /* temporarily disabled */ && unitOfAccountSetting.enabled) { const { currency } = unitOfAccountSetting; if (!currency) { throw new Error(`unexpected unit of account ${String(currency)}`); From 7515d946971ec33d899d3d9eeda1e8e75521258a Mon Sep 17 00:00:00 2001 From: yushi Date: Fri, 10 Jun 2022 00:36:32 +0800 Subject: [PATCH 3/5] remove fiat amounts for connector UI --- .../app/ergo-connector/components/signin/CardanoSignTxPage.js | 2 +- .../app/ergo-connector/components/signin/CardanoUtxoDetails.js | 2 +- .../app/ergo-connector/components/signin/SignTxPage.js | 2 +- .../app/ergo-connector/components/signin/UtxoDetails.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/yoroi-extension/app/ergo-connector/components/signin/CardanoSignTxPage.js b/packages/yoroi-extension/app/ergo-connector/components/signin/CardanoSignTxPage.js index 49c2d09067..e4c8e526a4 100644 --- a/packages/yoroi-extension/app/ergo-connector/components/signin/CardanoSignTxPage.js +++ b/packages/yoroi-extension/app/ergo-connector/components/signin/CardanoSignTxPage.js @@ -212,7 +212,7 @@ class SignTxPage extends Component { let fiatAmountDisplay = null; - if (this.props.unitOfAccountSetting.enabled === true) { + if (false && this.props.unitOfAccountSetting.enabled === true) { const { currency } = this.props.unitOfAccountSetting; const price = this.props.getCurrentPrice( getTokenName(tokenInfo), diff --git a/packages/yoroi-extension/app/ergo-connector/components/signin/CardanoUtxoDetails.js b/packages/yoroi-extension/app/ergo-connector/components/signin/CardanoUtxoDetails.js index dce00f779d..17f7caf7bd 100644 --- a/packages/yoroi-extension/app/ergo-connector/components/signin/CardanoUtxoDetails.js +++ b/packages/yoroi-extension/app/ergo-connector/components/signin/CardanoUtxoDetails.js @@ -93,7 +93,7 @@ class CardanoUtxoDetails extends Component { let fiatAmountDisplay = null; - if (this.props.unitOfAccountSetting.enabled === true) { + if (false && this.props.unitOfAccountSetting.enabled === true) { const { currency } = this.props.unitOfAccountSetting; const price = this.props.getCurrentPrice( tokenInfo ? getTokenName(tokenInfo) : nameFromIdentifier, diff --git a/packages/yoroi-extension/app/ergo-connector/components/signin/SignTxPage.js b/packages/yoroi-extension/app/ergo-connector/components/signin/SignTxPage.js index c0edb3e4f6..1b9914db6e 100644 --- a/packages/yoroi-extension/app/ergo-connector/components/signin/SignTxPage.js +++ b/packages/yoroi-extension/app/ergo-connector/components/signin/SignTxPage.js @@ -219,7 +219,7 @@ class SignTxPage extends Component { if (tokenInfo == null) return this.displayUnAvailableToken(request.entry); const shiftedAmount = request.entry.amount.shiftedBy(-tokenInfo.Metadata.numberOfDecimals); - if (this.props.unitOfAccountSetting.enabled === true) { + if (false && this.props.unitOfAccountSetting.enabled === true) { const { currency } = this.props.unitOfAccountSetting; const price = this.props.getCurrentPrice(request.entry.identifier, currency); if (price != null) { diff --git a/packages/yoroi-extension/app/ergo-connector/components/signin/UtxoDetails.js b/packages/yoroi-extension/app/ergo-connector/components/signin/UtxoDetails.js index a08c6ea404..69ed6c3b3e 100644 --- a/packages/yoroi-extension/app/ergo-connector/components/signin/UtxoDetails.js +++ b/packages/yoroi-extension/app/ergo-connector/components/signin/UtxoDetails.js @@ -98,7 +98,7 @@ class UtxoDetails extends Component { if (tokenInfo == null) return this.displayUnAvailableToken(request.entry); const shiftedAmount = request.entry.amount.shiftedBy(-tokenInfo.Metadata.numberOfDecimals); - if (this.props.unitOfAccountSetting.enabled === true) { + if (false && this.props.unitOfAccountSetting.enabled === true) { const { currency } = this.props.unitOfAccountSetting; const price = this.props.getCurrentPrice(request.entry.identifier, currency); if (price != null) { From bfa1452a17a679e3a1985ab8b16e3754e42d04b9 Mon Sep 17 00:00:00 2001 From: vantuz-subhuman Date: Fri, 10 Jun 2022 13:35:44 +0300 Subject: [PATCH 4/5] Ledger test fix --- .../ada/transactions/shelley/ledgerTx.test.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/yoroi-extension/app/api/ada/transactions/shelley/ledgerTx.test.js b/packages/yoroi-extension/app/api/ada/transactions/shelley/ledgerTx.test.js index 2306b0180a..dffd77cd99 100644 --- a/packages/yoroi-extension/app/api/ada/transactions/shelley/ledgerTx.test.js +++ b/packages/yoroi-extension/app/api/ada/transactions/shelley/ledgerTx.test.js @@ -377,11 +377,11 @@ test('Create Ledger transaction', async () => { 44 + HARD_DERIVATION_START, 1815 + HARD_DERIVATION_START, 0 + HARD_DERIVATION_START, - 1, - 2, + 0, + 7, ], - txHashHex: '3677e75c7ba699bfdc6cd57d42f246f86f69aefd76025006ac78313fad2bba20', - outputIndex: 1, + txHashHex: '1029eef5bb0f06979ab0b9530a62bac11e180797d08cab980fe39389d42b3657', + outputIndex: 0, }, { path: [ 44 + HARD_DERIVATION_START, @@ -390,18 +390,18 @@ test('Create Ledger transaction', async () => { 0, 7, ], - txHashHex: '1029eef5bb0f06979ab0b9530a62bac11e180797d08cab980fe39389d42b3657', + txHashHex: '2029eef5bb0f06979ab0b9530a62bac11e180797d08cab980fe39389d42b3658', outputIndex: 0, }, { path: [ 44 + HARD_DERIVATION_START, 1815 + HARD_DERIVATION_START, 0 + HARD_DERIVATION_START, - 0, - 7, + 1, + 2, ], - txHashHex: '2029eef5bb0f06979ab0b9530a62bac11e180797d08cab980fe39389d42b3658', - outputIndex: 0, + txHashHex: '3677e75c7ba699bfdc6cd57d42f246f86f69aefd76025006ac78313fad2bba20', + outputIndex: 1, }], outputs: [{ destination: { From 5144c56a62034dc260df24cedc60ee4298a83c7b Mon Sep 17 00:00:00 2001 From: vantuz-subhuman Date: Fri, 10 Jun 2022 13:39:58 +0300 Subject: [PATCH 5/5] Version bump: 4.14.400 --- packages/yoroi-extension/package-lock.json | 2 +- packages/yoroi-extension/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/yoroi-extension/package-lock.json b/packages/yoroi-extension/package-lock.json index 4d7afd36a5..96295a5e1a 100644 --- a/packages/yoroi-extension/package-lock.json +++ b/packages/yoroi-extension/package-lock.json @@ -1,6 +1,6 @@ { "name": "yoroi", - "version": "4.14.300", + "version": "4.14.400", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/yoroi-extension/package.json b/packages/yoroi-extension/package.json index 4217544df3..aaecc1f5b7 100644 --- a/packages/yoroi-extension/package.json +++ b/packages/yoroi-extension/package.json @@ -1,6 +1,6 @@ { "name": "yoroi", - "version": "4.14.300", + "version": "4.14.400", "description": "Cardano ADA wallet", "scripts": { "dev:build": "rimraf dev/ && babel-node scripts/build --type=debug",