From 804ee4685566c82af2b08dbb447582d28fd4a6f4 Mon Sep 17 00:00:00 2001 From: Anthony Law Yong Chuan Date: Tue, 17 Nov 2020 19:16:50 +0800 Subject: [PATCH 1/4] convert message to object --- src/infrastructure/CreateTransaction.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/infrastructure/CreateTransaction.js b/src/infrastructure/CreateTransaction.js index fb992c233..55975b46d 100644 --- a/src/infrastructure/CreateTransaction.js +++ b/src/infrastructure/CreateTransaction.js @@ -33,7 +33,7 @@ class CreateTransaction { ...transactionObj, transactionBody: { transactionType: transactionObj.type, - message: transactionObj.message.payload, + message: transactionObj.message, recipient: resolvedAddress, mosaics: mosaicsFieldObject } From e788eb24a02e77b8415dbfd83e4d368267a36633 Mon Sep 17 00:00:00 2001 From: Anthony Law Yong Chuan Date: Tue, 17 Nov 2020 19:17:29 +0800 Subject: [PATCH 2/4] added message field --- .../ExtendTransferValue.vue | 2 +- src/components/fields/MessageField.vue | 93 +++++++++++++++++++ src/components/graphics/MessageCircle.vue | 16 +++- src/components/tables/TableInfoView.vue | 5 +- .../transaction-graphic/TransferGraphic.vue | 6 +- src/config/i18n/en-us.json | 7 +- src/config/i18n/es.json | 5 +- src/config/i18n/ja.json | 5 +- src/config/i18n/pt.json | 5 +- src/config/i18n/ru.json | 5 +- src/config/i18n/ua.json | 5 +- src/config/i18n/zh.json | 5 +- src/infrastructure/TransactionService.js | 3 +- 13 files changed, 145 insertions(+), 17 deletions(-) create mode 100644 src/components/fields/MessageField.vue diff --git a/src/components/extend-graphic-value/ExtendTransferValue.vue b/src/components/extend-graphic-value/ExtendTransferValue.vue index 07ddd5eb7..1a33de19b 100644 --- a/src/components/extend-graphic-value/ExtendTransferValue.vue +++ b/src/components/extend-graphic-value/ExtendTransferValue.vue @@ -81,7 +81,7 @@ export default { hasMessage() { for (const item of this.value) { if (Object.keys(item).includes('message')) - return typeof item.message === 'string' && item.message.length > 0; + return typeof item.message.payload === 'string' && item.message.payload.length > 0; } return false; }, diff --git a/src/components/fields/MessageField.vue b/src/components/fields/MessageField.vue new file mode 100644 index 000000000..3a4cbf4a5 --- /dev/null +++ b/src/components/fields/MessageField.vue @@ -0,0 +1,93 @@ +/* + * + * Copyright (c) 2019-present for NEM + * + * Licensed under the Apache License, Version 2.0 (the "License "); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + + + + + + diff --git a/src/components/graphics/MessageCircle.vue b/src/components/graphics/MessageCircle.vue index 2857006f1..914b123e9 100644 --- a/src/components/graphics/MessageCircle.vue +++ b/src/components/graphics/MessageCircle.vue @@ -20,7 +20,8 @@ {} + } + }, + + computed: { + payload() { + return this.message.payload; + }, + messageType() { + return this.getTranslation(`messageTypeDescriptor_${this.message.type}`); } }, diff --git a/src/components/tables/TableInfoView.vue b/src/components/tables/TableInfoView.vue index 57453996c..4cb19c763 100644 --- a/src/components/tables/TableInfoView.vue +++ b/src/components/tables/TableInfoView.vue @@ -18,6 +18,7 @@ + {} }, signer: { type: String, @@ -104,7 +104,7 @@ export default { }, hasMessage() { - return typeof this.message === 'string' && this.message.length > 0; + return typeof this.message.payload === 'string' && this.message.payload.length > 0; }, hasNativeMosaic() { diff --git a/src/config/i18n/en-us.json b/src/config/i18n/en-us.json index 314df80fb..57eaae480 100644 --- a/src/config/i18n/en-us.json +++ b/src/config/i18n/en-us.json @@ -284,7 +284,7 @@ "mosaicAddressRestrictionError": "Mosaic address restrictions are not available.", "aggregateInnerTransactionsError": "Aggregate inner transactions are not available.", "aggregateCosignaturesError": "Cosignatures are not available.", - + "accountBalanceTitle": "Account Balance", "noAlias": "No alias", "addressBeenCopied": "The address was copied to the clipboard", @@ -356,5 +356,8 @@ "finalizationPoint": "Finalization Point", "finalizedHash": "Finalized Hash", "nodeDetailError": "Failed to fetch node detail.", - "extendGraphicValue": "Info" + "extendGraphicValue": "Info", + "messageTypeDescriptor_0": "Plain Message", + "messageTypeDescriptor_1": "Encrypted Message", + "messageTypeDescriptor_254": "Persistent Harvesting Delegation Message" } diff --git a/src/config/i18n/es.json b/src/config/i18n/es.json index 41bc57965..ee74cb845 100644 --- a/src/config/i18n/es.json +++ b/src/config/i18n/es.json @@ -351,5 +351,8 @@ "finalizationPoint": "Finalization Point", "finalizedHash": "Finalized Hash", "nodeDetailError": "Failed to fetch node detail.", - "extendGraphicValue": "Info" + "extendGraphicValue": "Info", + "messageTypeDescriptor_0": "Plain Message", + "messageTypeDescriptor_1": "Encrypted Message", + "messageTypeDescriptor_254": "Persistent Harvesting Delegation Message" } diff --git a/src/config/i18n/ja.json b/src/config/i18n/ja.json index 18ed72583..f418b2b03 100644 --- a/src/config/i18n/ja.json +++ b/src/config/i18n/ja.json @@ -350,5 +350,8 @@ "finalizationPoint": "Finalization Point", "finalizedHash": "Finalized Hash", "nodeDetailError": "Failed to fetch node detail.", - "extendGraphicValue": "Info" + "extendGraphicValue": "Info", + "messageTypeDescriptor_0": "Plain Message", + "messageTypeDescriptor_1": "Encrypted Message", + "messageTypeDescriptor_254": "Persistent Harvesting Delegation Message" } diff --git a/src/config/i18n/pt.json b/src/config/i18n/pt.json index a1e9cc3c8..120ea0bcd 100644 --- a/src/config/i18n/pt.json +++ b/src/config/i18n/pt.json @@ -351,5 +351,8 @@ "finalizationPoint": "Finalization Point", "finalizedHash": "Finalized Hash", "nodeDetailError": "Failed to fetch node detail.", - "extendGraphicValue": "Info" + "extendGraphicValue": "Info", + "messageTypeDescriptor_0": "Plain Message", + "messageTypeDescriptor_1": "Encrypted Message", + "messageTypeDescriptor_254": "Persistent Harvesting Delegation Message" } diff --git a/src/config/i18n/ru.json b/src/config/i18n/ru.json index 5d7156f69..5d72520ad 100644 --- a/src/config/i18n/ru.json +++ b/src/config/i18n/ru.json @@ -351,5 +351,8 @@ "finalizationPoint": "Finalization Point", "finalizedHash": "Finalized Hash", "nodeDetailError": "Failed to fetch node detail.", - "extendGraphicValue": "Info" + "extendGraphicValue": "Info", + "messageTypeDescriptor_0": "Plain Message", + "messageTypeDescriptor_1": "Encrypted Message", + "messageTypeDescriptor_254": "Persistent Harvesting Delegation Message" } diff --git a/src/config/i18n/ua.json b/src/config/i18n/ua.json index 8a9f50061..8cbe905cf 100644 --- a/src/config/i18n/ua.json +++ b/src/config/i18n/ua.json @@ -351,5 +351,8 @@ "finalizationPoint": "Finalization Point", "finalizedHash": "Finalized Hash", "nodeDetailError": "Failed to fetch node detail.", - "extendGraphicValue": "Info" + "extendGraphicValue": "Info", + "messageTypeDescriptor_0": "Plain Message", + "messageTypeDescriptor_1": "Encrypted Message", + "messageTypeDescriptor_254": "Persistent Harvesting Delegation Message" } diff --git a/src/config/i18n/zh.json b/src/config/i18n/zh.json index d6498f122..65b163009 100644 --- a/src/config/i18n/zh.json +++ b/src/config/i18n/zh.json @@ -351,5 +351,8 @@ "finalizationPoint": "Finalization Point", "finalizedHash": "Finalized Hash", "nodeDetailError": "Failed to fetch node detail.", - "extendGraphicValue": "Info" + "extendGraphicValue": "Info", + "messageTypeDescriptor_0": "Plain Message", + "messageTypeDescriptor_1": "Encrypted Message", + "messageTypeDescriptor_254": "Persistent Harvesting Delegation Message" } diff --git a/src/infrastructure/TransactionService.js b/src/infrastructure/TransactionService.js index e6f0dbc79..2517beaea 100644 --- a/src/infrastructure/TransactionService.js +++ b/src/infrastructure/TransactionService.js @@ -250,7 +250,7 @@ class TransactionService { id: mosaic.id.toHex(), amount: mosaic.amount.compact().toString() })), - message: transactionBody.message.payload + message: transactionBody.message }; case TransactionType.NAMESPACE_REGISTRATION: @@ -500,6 +500,7 @@ class TransactionService { switch (transactionInfo.type) { case TransactionType.TRANSFER: + console.log('transactionBody.message :>> ', transactionBody.message); return [ { nativeMosaic: helper.getNetworkCurrencyBalance(transactionInfo.mosaics) }, { message: transactionBody.message }, From 84f17759bd80d9e99e57e79cda4d5d99a5d8aeba Mon Sep 17 00:00:00 2001 From: Anthony Law Yong Chuan Date: Wed, 18 Nov 2020 18:49:59 +0800 Subject: [PATCH 3/4] fixes lint --- src/components/fields/MessageField.vue | 16 ++++++++-------- src/infrastructure/TransactionService.js | 1 - 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/components/fields/MessageField.vue b/src/components/fields/MessageField.vue index 3a4cbf4a5..7defa212e 100644 --- a/src/components/fields/MessageField.vue +++ b/src/components/fields/MessageField.vue @@ -75,19 +75,19 @@ export default { diff --git a/src/infrastructure/TransactionService.js b/src/infrastructure/TransactionService.js index f924d49a3..d0d71dd37 100644 --- a/src/infrastructure/TransactionService.js +++ b/src/infrastructure/TransactionService.js @@ -498,7 +498,6 @@ class TransactionService { switch (transactionInfo.type) { case TransactionType.TRANSFER: - console.log('transactionBody.message :>> ', transactionBody.message); return [ { nativeMosaic: helper.getNetworkCurrencyBalance(transactionInfo.mosaics) }, { message: transactionBody.message }, From e99ac5d1e28d7b0d5cb4ea549044babd0d23ffb5 Mon Sep 17 00:00:00 2001 From: Anthony Law Yong Chuan Date: Tue, 24 Nov 2020 18:42:36 +0800 Subject: [PATCH 4/4] fixes translation --- src/config/i18n/en-us.json | 6 +++--- src/config/i18n/es.json | 6 +++--- src/config/i18n/pt.json | 6 +++--- src/config/i18n/ru.json | 6 +++--- src/config/i18n/ua.json | 6 +++--- src/config/i18n/zh.json | 6 +++--- 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/config/i18n/en-us.json b/src/config/i18n/en-us.json index 360db664f..e9ebb18fd 100644 --- a/src/config/i18n/en-us.json +++ b/src/config/i18n/en-us.json @@ -358,7 +358,7 @@ "extendGraphicValue": "Info", "created": "Created", "ago": "ago", - "messageTypeDescriptor_0": "Plain Message", - "messageTypeDescriptor_1": "Encrypted Message", - "messageTypeDescriptor_254": "Persistent Harvesting Delegation Message" + "messageTypeDescriptor_0": "Plain message", + "messageTypeDescriptor_1": "Encrypted message", + "messageTypeDescriptor_254": "Delegated Harvesting Persistent message" } diff --git a/src/config/i18n/es.json b/src/config/i18n/es.json index 4ea457b6b..5571a98d5 100644 --- a/src/config/i18n/es.json +++ b/src/config/i18n/es.json @@ -353,7 +353,7 @@ "extendGraphicValue": "Info", "created": "Created", "ago": "ago", - "messageTypeDescriptor_0": "Plain Message", - "messageTypeDescriptor_1": "Encrypted Message", - "messageTypeDescriptor_254": "Persistent Harvesting Delegation Message" + "messageTypeDescriptor_0": "Plain message", + "messageTypeDescriptor_1": "Encrypted message", + "messageTypeDescriptor_254": "Delegated Harvesting Persistent message" } diff --git a/src/config/i18n/pt.json b/src/config/i18n/pt.json index cb0876961..90d93ff4e 100644 --- a/src/config/i18n/pt.json +++ b/src/config/i18n/pt.json @@ -353,7 +353,7 @@ "extendGraphicValue": "Info", "created": "Created", "ago": "ago", - "messageTypeDescriptor_0": "Plain Message", - "messageTypeDescriptor_1": "Encrypted Message", - "messageTypeDescriptor_254": "Persistent Harvesting Delegation Message" + "messageTypeDescriptor_0": "Plain message", + "messageTypeDescriptor_1": "Encrypted message", + "messageTypeDescriptor_254": "Delegated Harvesting Persistent message" } diff --git a/src/config/i18n/ru.json b/src/config/i18n/ru.json index c0e7354dd..bf765de4f 100644 --- a/src/config/i18n/ru.json +++ b/src/config/i18n/ru.json @@ -353,7 +353,7 @@ "extendGraphicValue": "Info", "created": "Created", "ago": "ago", - "messageTypeDescriptor_0": "Plain Message", - "messageTypeDescriptor_1": "Encrypted Message", - "messageTypeDescriptor_254": "Persistent Harvesting Delegation Message" + "messageTypeDescriptor_0": "Plain message", + "messageTypeDescriptor_1": "Encrypted message", + "messageTypeDescriptor_254": "Delegated Harvesting Persistent message" } diff --git a/src/config/i18n/ua.json b/src/config/i18n/ua.json index e62bf2a1d..9177c8086 100644 --- a/src/config/i18n/ua.json +++ b/src/config/i18n/ua.json @@ -353,7 +353,7 @@ "extendGraphicValue": "Info", "created": "Created", "ago": "ago", - "messageTypeDescriptor_0": "Plain Message", - "messageTypeDescriptor_1": "Encrypted Message", - "messageTypeDescriptor_254": "Persistent Harvesting Delegation Message" + "messageTypeDescriptor_0": "Plain message", + "messageTypeDescriptor_1": "Encrypted message", + "messageTypeDescriptor_254": "Delegated Harvesting Persistent message" } diff --git a/src/config/i18n/zh.json b/src/config/i18n/zh.json index 80695a1fa..b612de577 100644 --- a/src/config/i18n/zh.json +++ b/src/config/i18n/zh.json @@ -353,7 +353,7 @@ "extendGraphicValue": "Info", "created": "Created", "ago": "ago", - "messageTypeDescriptor_0": "Plain Message", - "messageTypeDescriptor_1": "Encrypted Message", - "messageTypeDescriptor_254": "Persistent Harvesting Delegation Message" + "messageTypeDescriptor_0": "Plain message", + "messageTypeDescriptor_1": "Encrypted message", + "messageTypeDescriptor_254": "Delegated Harvesting Persistent message" }