From bc10f44d4ecece1b662a67eeca723bdbd36905bf Mon Sep 17 00:00:00 2001 From: giangnamnabka Date: Wed, 2 Aug 2023 15:16:12 +0700 Subject: [PATCH 1/2] update review issues --- src/daemon/firod.ts | 39 +++------ .../AnimatedTable/AddressBookItemAddress.vue | 16 +++- .../AddressBookItemAddressType.vue | 17 ++-- .../AnimatedTableInputPrivacy.vue | 37 +++++++++ .../components/AnimatedTable/TxAmount.vue | 2 +- .../components/AnimatedTable/TxId.vue | 2 +- .../components/AnimatedTable/UTXOLocker.vue | 26 +++--- .../components/AnimatedTable/UTXOSelector.vue | 21 +---- .../AwaitingAnonymizationHeader.vue | 59 ++----------- .../components/LelantusToSparkDialog.vue | 82 +++++++++++++++++++ src/renderer/components/ReceivePage.vue | 13 +-- src/renderer/components/SendPage.vue | 11 +-- .../components/SendPage/GoPrivate.vue | 26 +++++- .../components/SendPage/InputSelection.vue | 3 +- .../components/SendPage/LelantusToSpark.vue | 47 +++++++---- src/renderer/components/SendPage/SendFlow.vue | 38 ++++----- src/renderer/components/Sidebar/Balance.vue | 6 -- src/renderer/components/TransactionsPage.vue | 9 +- .../shared/PrivatePublicBalance.vue | 3 +- src/store/modules/ApiStatus.ts | 3 +- src/store/modules/Balance.ts | 9 +- src/store/modules/Transactions.ts | 4 +- 22 files changed, 281 insertions(+), 192 deletions(-) create mode 100644 src/renderer/components/AnimatedTable/AnimatedTableInputPrivacy.vue create mode 100644 src/renderer/components/LelantusToSparkDialog.vue diff --git a/src/daemon/firod.ts b/src/daemon/firod.ts index 1ded165c..5f271dad 100644 --- a/src/daemon/firod.ts +++ b/src/daemon/firod.ts @@ -1752,7 +1752,7 @@ export class Firod { } async mintSpark(auth: string, label: string, recipient: string, amount: number, feePerKb: number, - subtractFeeFromAmount: boolean, coinControl?: CoinControl): Promise<{txid: string}> { + subtractFeeFromAmount: boolean, coinControl?: CoinControl): Promise<{txids: string[]}> { const data = await this.send(auth, 'create', 'mintSpark', { label, recipient, @@ -1763,8 +1763,17 @@ export class Firod { selected: coinControlToString(coinControl) } }); - function isValidResponse(x: any): x is {txid: string} { - return x !== null && typeof x === 'object' && typeof x.txid === 'string'; + function isValidResponse(x: any): x is {txids: string[]} { + if (x === null || + typeof x !== 'object') { + return false; + } + for (const v of x.txids) { + if (typeof v !== 'string') { + return false; + } + } + return true; } if (isValidResponse(data)) { return data; @@ -1810,28 +1819,4 @@ export class Firod { throw new UnexpectedFirodResponse('create/validateSparkAddress', data); } } - - async getAvailableSparkBalance(): Promise<{amount: number}> { - const data = await this.send('', 'create', 'getAvailableSparkBalance', {}); - function isValidResponse(x: any): x is {amount: number} { - return x !== null && typeof x === 'object' && typeof x.amount === 'number'; - } - if (isValidResponse(data)) { - return data; - } else { - throw new UnexpectedFirodResponse('create/getAvailableSparkBalance', data); - } - } - - async getUncomfirmedSparkBalance(): Promise<{amount: number}> { - const data = await this.send('', 'create', 'getUncomfirmedSparkBalance', {}); - function isValidResponse(x: any): x is {amount: number} { - return x !== null && typeof x === 'object' && typeof x.amount === 'number'; - } - if (isValidResponse(data)) { - return data; - } else { - throw new UnexpectedFirodResponse('create/getUncomfirmedSparkBalance', data); - } - } } diff --git a/src/renderer/components/AnimatedTable/AddressBookItemAddress.vue b/src/renderer/components/AnimatedTable/AddressBookItemAddress.vue index 68d571b0..4a39f3b9 100644 --- a/src/renderer/components/AnimatedTable/AddressBookItemAddress.vue +++ b/src/renderer/components/AnimatedTable/AddressBookItemAddress.vue @@ -4,7 +4,9 @@ - {{ rowData.address }} +
+ {{ rowData.address }} +
@@ -21,4 +23,16 @@ export default { \ No newline at end of file diff --git a/src/renderer/components/AnimatedTable/AddressBookItemAddressType.vue b/src/renderer/components/AnimatedTable/AddressBookItemAddressType.vue index 2b9bc861..484b2d5e 100644 --- a/src/renderer/components/AnimatedTable/AddressBookItemAddressType.vue +++ b/src/renderer/components/AnimatedTable/AddressBookItemAddressType.vue @@ -3,8 +3,10 @@ Type - - {{ rowData.inputPrivacy || rowData.addressType.toLowerCase() }} + +
+ {{ rowData.addressType.toLowerCase() }} +
@@ -21,10 +23,15 @@ export default { diff --git a/src/renderer/components/AnimatedTable/AnimatedTableInputPrivacy.vue b/src/renderer/components/AnimatedTable/AnimatedTableInputPrivacy.vue new file mode 100644 index 00000000..499991a6 --- /dev/null +++ b/src/renderer/components/AnimatedTable/AnimatedTableInputPrivacy.vue @@ -0,0 +1,37 @@ + + + + + diff --git a/src/renderer/components/AnimatedTable/TxAmount.vue b/src/renderer/components/AnimatedTable/TxAmount.vue index ed222e85..ba46a6d2 100644 --- a/src/renderer/components/AnimatedTable/TxAmount.vue +++ b/src/renderer/components/AnimatedTable/TxAmount.vue @@ -13,7 +13,7 @@ import VuetableFieldMixin from 'vue3-vuetable/src/components/VuetableFieldMixin. import {bigintToString} from "lib/convert"; export default { - name: 'TxAmount', + name: 'Amount', mixins: [ VuetableFieldMixin diff --git a/src/renderer/components/AnimatedTable/TxId.vue b/src/renderer/components/AnimatedTable/TxId.vue index 4b84e5a2..b1e258fa 100644 --- a/src/renderer/components/AnimatedTable/TxId.vue +++ b/src/renderer/components/AnimatedTable/TxId.vue @@ -13,7 +13,7 @@ import VuetableFieldMixin from 'vue3-vuetable/src/components/VuetableFieldMixin.vue' export default { - name: 'UTXOSelector', + name: 'TxId', mixins: [ VuetableFieldMixin diff --git a/src/renderer/components/AnimatedTable/UTXOLocker.vue b/src/renderer/components/AnimatedTable/UTXOLocker.vue index 5747e8db..566a032f 100644 --- a/src/renderer/components/AnimatedTable/UTXOLocker.vue +++ b/src/renderer/components/AnimatedTable/UTXOLocker.vue @@ -2,37 +2,30 @@
- - +
+ + diff --git a/src/renderer/components/ReceivePage.vue b/src/renderer/components/ReceivePage.vue index d8e41822..002318e4 100644 --- a/src/renderer/components/ReceivePage.vue +++ b/src/renderer/components/ReceivePage.vue @@ -22,7 +22,7 @@ -
+