diff --git a/locale/da/texts.po b/locale/da/texts.po index a0eff693a..25992b918 100644 --- a/locale/da/texts.po +++ b/locale/da/texts.po @@ -57,11 +57,11 @@ msgid "[Last] dddd [•] HH:mm" msgstr "[Sidste] dddd [•] HH:mm" #. See https://momentjs.com/docs/#/displaying/calendar-time/ -#: src/models.js:107 src/utils.js:415 +#: src/models.js:107 src/utils.js:416 msgid "DD MMM YYYY [•] HH:mm" msgstr "DD MMM YYYY [•] HH:mm" -#: src/utils.js:160 +#: src/utils.js:161 msgid "Invalid address" msgstr "Ugyldig adresse" @@ -432,9 +432,10 @@ msgstr "Ord" msgid "Enter your seed words separated by space" msgstr "Indtast dine seed-ord adskilt med mellemrum" -#: src/components/NanoContract/NanoContractDetails.component.js:194 +#: src/components/NanoContract/NanoContractDetails.js:194 +#: src/components/WalletConnect/NanoContract/NewNanoContractTransactionRequest.js:282 #: src/screens/LoadHistoryScreen.js:51 src/screens/LoadWalletErrorScreen.js:20 -#: src/screens/NanoContract/NanoContractRegisterScreen.js:167 +#: src/screens/NanoContract/NanoContractRegisterScreen.js:161 msgid "Try again" msgstr "" @@ -534,6 +535,7 @@ msgstr "Indtast din pinkode " msgid "Unlock Hathor Wallet" msgstr "Lås Hathor-wallet op" +#: src/components/WalletConnect/NanoContract/NewNanoContractTransactionModal.js:84 #: src/screens/PinScreen.js:265 #: src/screens/WalletConnect/WalletConnectList.js:125 msgid "Cancel" @@ -698,8 +700,8 @@ msgstr "Autoriserer overførslen" msgid "Your transfer of **${ this.amountAndToken }** has been confirmed" msgstr "Din overførsel af **${ _this.amountAndToken }** er bekræftet" -#: src/components/NanoContract/EditAddressModal.component.js:60 -#: src/components/NanoContract/SelectAddressModal.component.js:117 +#: src/components/NanoContract/EditAddressModal.js:60 +#: src/components/NanoContract/SelectAddressModal.js:117 #: src/screens/SendConfirmScreen.js:161 msgid "Address" msgstr "Adresse" @@ -797,6 +799,11 @@ msgstr "Jeg vil afregistrere token **${ tokenLabel }**" msgid "Unregister token" msgstr "Afregistrer token" +#: src/components/WalletConnect/NanoContract/NewNanoContractTransactionModal.js:68 +#: src/screens/WalletConnect/NewNanoContractTransactionScreen.js:24 +msgid "New Nano Contract Transaction" +msgstr "" + #: src/screens/WalletConnect/WalletConnectList.js:33 msgid "There was an error connecting. Please try again later." msgstr "" @@ -932,53 +939,55 @@ msgstr "" msgid "Nano Contract Details" msgstr "" -#: src/screens/NanoContract/NanoContractRegisterScreen.js:67 +#: src/screens/NanoContract/NanoContractRegisterScreen.js:58 msgid "Nano Contract ID is required." msgstr "" -#: src/screens/NanoContract/NanoContractRegisterScreen.js:157 +#: src/screens/NanoContract/NanoContractRegisterScreen.js:151 msgid "See contract" msgstr "" -#: src/screens/NanoContract/NanoContractRegisterScreen.js:175 +#: src/screens/NanoContract/NanoContractRegisterScreen.js:169 msgid "Load First Addresses Error" msgstr "" -#: src/components/NanoContract/NanoContractDetails.component.js:158 -#: src/components/NanoContract/SelectAddressModal.component.js:105 -#: src/screens/NanoContract/NanoContractRegisterScreen.js:183 +#: src/components/NanoContract/NanoContractDetails.js:158 +#: src/components/NanoContract/SelectAddressModal.js:105 +#: src/components/WalletConnect/NanoContract/NewNanoContractTransactionRequest.js:202 +#: src/screens/NanoContract/NanoContractRegisterScreen.js:177 msgid "Loading" msgstr "" -#: src/screens/NanoContract/NanoContractRegisterScreen.js:184 +#: src/screens/NanoContract/NanoContractRegisterScreen.js:178 msgid "Loading first wallet address." msgstr "" -#: src/components/NanoContract/NanoContractDetailsHeader.component.js:142 -#: src/components/NanoContract/NanoContractTransactionHeader.component.js:88 +#: src/components/NanoContract/NanoContractDetailsHeader.js:142 +#: src/components/NanoContract/NanoContractTransactionHeader.js:88 #: src/components/NanoContract/NanoContractsListItem.js:57 #: src/components/TxDetailsModal.js:106 -#: src/screens/NanoContract/NanoContractRegisterScreen.js:193 +#: src/components/WalletConnect/NanoContract/NanoContractExecInfo.js:83 +#: src/screens/NanoContract/NanoContractRegisterScreen.js:187 msgid "Nano Contract ID" msgstr "" -#: src/screens/NanoContract/NanoContractRegisterScreen.js:201 +#: src/screens/NanoContract/NanoContractRegisterScreen.js:195 msgid "Wallet Address" msgstr "" -#: src/screens/NanoContract/NanoContractRegisterScreen.js:211 +#: src/screens/NanoContract/NanoContractRegisterScreen.js:205 msgid "If you want to change the wallet address, you will be able to do" msgstr "" -#: src/screens/NanoContract/NanoContractRegisterScreen.js:213 +#: src/screens/NanoContract/NanoContractRegisterScreen.js:207 msgid "after the contract is registered." msgstr "" -#: src/screens/NanoContract/NanoContractRegisterScreen.js:232 +#: src/screens/NanoContract/NanoContractRegisterScreen.js:226 msgid "Register Nano Contract" msgstr "" -#: src/screens/NanoContract/NanoContractRegisterScreen.js:250 +#: src/screens/NanoContract/NanoContractRegisterScreen.js:244 msgid "Nano Contract Registration" msgstr "" @@ -990,31 +999,39 @@ msgstr "" msgid "Contract successfully registered." msgstr "" -#: src/sagas/nanoContract.js:43 +#: src/sagas/nanoContract.js:45 msgid "Nano Contract already registered." msgstr "" -#: src/sagas/nanoContract.js:44 +#: src/sagas/nanoContract.js:46 msgid "Wallet is not ready yet to register a Nano Contract." msgstr "" -#: src/sagas/nanoContract.js:45 +#: src/sagas/nanoContract.js:47 msgid "The informed address does not belong to the wallet." msgstr "" -#: src/sagas/nanoContract.js:46 +#: src/sagas/nanoContract.js:48 msgid "Nano Contract not found." msgstr "" -#: src/sagas/nanoContract.js:47 +#: src/sagas/nanoContract.js:49 msgid "Error while trying to get Nano Contract state." msgstr "" -#: src/sagas/nanoContract.js:48 +#: src/sagas/nanoContract.js:50 +msgid "Blueprint not found." +msgstr "" + +#: src/sagas/nanoContract.js:51 +msgid "Couldn't get Blueprint info." +msgstr "" + +#: src/sagas/nanoContract.js:52 msgid "Nano Contract not registered." msgstr "" -#: src/sagas/nanoContract.js:49 +#: src/sagas/nanoContract.js:53 msgid "Error while trying to download Nano Contract transactions history." msgstr "" @@ -1060,21 +1077,29 @@ msgstr "Transaktion" msgid "Open" msgstr "Åben" -#: src/sagas/wallet.js:744 +#: src/sagas/tokens.js:40 +msgid "Wallet is not ready yet." +msgstr "" + +#: src/sagas/tokens.js:41 +msgid "Error loading the details of some tokens." +msgstr "" + +#: src/sagas/wallet.js:749 msgid "Wallet is not ready to load addresses." msgstr "" #. This will show the message in the feedback content at SelectAddressModal -#: src/sagas/wallet.js:760 +#: src/sagas/wallet.js:765 msgid "There was an error while loading wallet addresses. Try again." msgstr "" -#: src/sagas/wallet.js:770 +#: src/sagas/wallet.js:775 msgid "Wallet is not ready to load the first address." msgstr "" #. This will show the message in the feedback content -#: src/sagas/wallet.js:786 +#: src/sagas/wallet.js:791 msgid "There was an error while loading first wallet address. Try again." msgstr "" @@ -1246,13 +1271,14 @@ msgstr "" msgid "Description" msgstr "Beskrivelse" -#: src/components/NanoContract/NanoContractTransactionHeader.component.js:47 +#: src/components/NanoContract/NanoContractTransactionHeader.js:47 #: src/components/TxDetailsModal.js:104 msgid "Transaction ID" msgstr "" -#: src/components/NanoContract/NanoContractTransactionHeader.component.js:92 +#: src/components/NanoContract/NanoContractTransactionHeader.js:92 #: src/components/TxDetailsModal.js:105 +#: src/components/WalletConnect/NanoContract/NanoContractExecInfo.js:116 msgid "Blueprint Method" msgstr "" @@ -1264,7 +1290,7 @@ msgstr "" msgid "Nano Contract Status" msgstr "" -#: src/components/NanoContract/NanoContractDetailsHeader.component.js:79 +#: src/components/NanoContract/NanoContractDetailsHeader.js:79 #: src/components/TxDetailsModal.js:120 msgid "Nano Contract" msgstr "" @@ -1298,83 +1324,216 @@ msgid "" "address derived from your root key on the m/44'/280'/0'/0/0 derivation path." msgstr "" +#: src/components/WalletConnect/NanoContract/DappContainer.js:41 +msgid "Review your transaction from this dApp" +msgstr "" + +#: src/components/WalletConnect/NanoContract/DappContainer.js:44 +msgid "Stay vigilant and protect your data from potential phishing attempts." +msgstr "" + +#: src/components/WalletConnect/NanoContract/DeclineModal.js:26 +msgid "Decline transaction" +msgstr "" + +#: src/components/WalletConnect/NanoContract/DeclineModal.js:29 +msgid "Are you sure you want to decline this transaction?" +msgstr "" + +#: src/components/WalletConnect/NanoContract/DeclineModal.js:33 +msgid "Yes, decline transaction" +msgstr "" + +#: src/components/NanoContract/UnregisterNanoContractModal.js:50 +#: src/components/WalletConnect/NanoContract/DeclineModal.js:39 +msgid "No, go back" +msgstr "" + +#: src/components/WalletConnect/NanoContract/NanoContractActions.js:36 +#, javascript-format +msgid "${ tokenSymbol } Deposit" +msgstr "" + +#: src/components/WalletConnect/NanoContract/NanoContractActions.js:37 +msgid "${ tokenSymbol } Withdrawal" +msgstr "" + +#: src/components/WalletConnect/NanoContract/NanoContractActions.js:101 +msgid "Action List" +msgstr "" + +#: src/components/WalletConnect/NanoContract/NanoContractActions.js:150 +msgid "To Address:" +msgstr "" + +#: src/components/WalletConnect/NanoContract/NanoContractExecInfo.js:88 +msgid "Blueprint ID" +msgstr "" + +#: src/components/NanoContract/NanoContractDetailsHeader.js:146 +#: src/components/NanoContract/NanoContractsListItem.js:59 +#: src/components/WalletConnect/NanoContract/NanoContractExecInfo.js:93 +msgid "Blueprint Name" +msgstr "" + +#: src/components/WalletConnect/NanoContract/NanoContractExecInfo.js:109 +#: src/components/WalletConnect/NanoContract/NanoContractExecInfo.js:140 +msgid "Loading..." +msgstr "" + +#: src/components/NanoContract/NanoContractTransactionHeader.js:106 +#: src/components/WalletConnect/NanoContract/NanoContractExecInfo.js:124 +msgid "Caller" +msgstr "" + +#: src/components/WalletConnect/NanoContract/NanoContractExecInfo.js:143 +msgid "Couldn't determine address, select one" +msgstr "" + +#: src/components/WalletConnect/NanoContract/NanoContractMethodArgs.js:48 +#, javascript-format +msgid "Position ${ idx }" +msgstr "" + +#: src/components/WalletConnect/NanoContract/NanoContractMethodArgs.js:93 +msgid "Arguments" +msgstr "" + +#: src/components/WalletConnect/NanoContract/NewNanoContractTransactionModal.js:72 +msgid "You have received a new Nano Contract Transaction. Please" +msgstr "" + +#: src/components/WalletConnect/NanoContract/NewNanoContractTransactionModal.js:74 +msgid "carefully review the details" +msgstr "" + +#: src/components/WalletConnect/NanoContract/NewNanoContractTransactionModal.js:76 +msgid "before deciding to accept or decline." +msgstr "" + +#: src/components/WalletConnect/NanoContract/NewNanoContractTransactionModal.js:80 +msgid "Review transaction details" +msgstr "" + +#: src/components/WalletConnect/NanoContract/NewNanoContractTransactionModal.js:98 +msgid "" +"Caution: There are risks associated with signing dapp transaction requests." +msgstr "" + +#: src/components/WalletConnect/NanoContract/NewNanoContractTransactionModal.js:104 +msgid "Read More." +msgstr "" + +#: src/components/WalletConnect/NanoContract/NewNanoContractTransactionRequest.js:184 +msgid "Nano Contract Not Found" +msgstr "" + +#: src/components/WalletConnect/NanoContract/NewNanoContractTransactionRequest.js:185 +msgid "" +"The Nano Contract requested is not registered. First register the Nano " +"Contract to interact with it." +msgstr "" + +#: src/components/WalletConnect/NanoContract/NewNanoContractTransactionRequest.js:188 +#: src/components/WalletConnect/NanoContract/NewNanoContractTransactionRequest.js:235 +msgid "Decline Transaction" +msgstr "" + +#: src/components/WalletConnect/NanoContract/NewNanoContractTransactionRequest.js:203 +msgid "Loading transaction information." +msgstr "" + +#: src/components/WalletConnect/NanoContract/NewNanoContractTransactionRequest.js:231 +msgid "Accept Transaction" +msgstr "" + +#: src/components/WalletConnect/NanoContract/NewNanoContractTransactionRequest.js:245 +msgid "Sending transaction" +msgstr "" + +#: src/components/WalletConnect/NanoContract/NewNanoContractTransactionRequest.js:246 +msgid "Please wait." +msgstr "" + +#: src/components/WalletConnect/NanoContract/NewNanoContractTransactionRequest.js:272 +msgid "Transaction successfully sent." +msgstr "" + +#: src/components/WalletConnect/NanoContract/NewNanoContractTransactionRequest.js:274 +msgid "Ok, close" +msgstr "" + +#: src/components/WalletConnect/NanoContract/NewNanoContractTransactionRequest.js:280 +msgid "Error while sending transaction." +msgstr "" + #: src/components/NetworkSettings/NetworkStatusBar.js:14 msgid "Custom network" msgstr "" -#: src/components/NanoContract/EditAddressModal.component.js:41 +#: src/components/NanoContract/EditAddressModal.js:41 msgid "New Nano Contract Address" msgstr "" -#: src/components/NanoContract/EditAddressModal.component.js:49 +#: src/components/NanoContract/EditAddressModal.js:49 msgid "" "This address signs any transaction you create with Nano Contracts method. " "Switching to a new one means" msgstr "" -#: src/components/NanoContract/EditAddressModal.component.js:51 +#: src/components/NanoContract/EditAddressModal.js:51 msgid "all future transactions will use this address." msgstr "" -#: src/components/NanoContract/EditAddressModal.component.js:57 +#: src/components/NanoContract/EditAddressModal.js:57 msgid "Selected Information" msgstr "" -#: src/components/NanoContract/EditAddressModal.component.js:67 +#: src/components/NanoContract/EditAddressModal.js:67 msgid "Index" msgstr "" -#: src/components/NanoContract/EditAddressModal.component.js:74 +#: src/components/NanoContract/EditAddressModal.js:74 msgid "Confirm new address" msgstr "" -#: src/components/NanoContract/EditAddressModal.component.js:78 +#: src/components/NanoContract/EditAddressModal.js:78 msgid "Go back" msgstr "" -#: src/components/NanoContract/NanoContractDetails.component.js:159 +#: src/components/NanoContract/NanoContractDetails.js:159 msgid "Loading Nano Contract transactions." msgstr "" -#: src/components/NanoContract/NanoContractDetails.component.js:173 +#: src/components/NanoContract/NanoContractDetails.js:173 msgid "Nano Contract Transactions Error" msgstr "" -#: src/components/NanoContract/NanoContractDetailsHeader.component.js:146 -#: src/components/NanoContract/NanoContractsListItem.js:59 -msgid "Blueprint Name" -msgstr "" - -#: src/components/NanoContract/NanoContractDetailsHeader.component.js:150 +#: src/components/NanoContract/NanoContractDetailsHeader.js:150 msgid "Registered Address" msgstr "" -#: src/components/NanoContract/NanoContractDetailsHeader.component.js:153 +#: src/components/NanoContract/NanoContractDetailsHeader.js:153 msgid "See status details" msgstr "" -#: src/components/NanoContract/NanoContractDetailsHeader.component.js:154 +#: src/components/NanoContract/NanoContractDetailsHeader.js:154 msgid "Unregister contract" msgstr "" #. XXX: add when shrank component can be used. -#: src/components/NanoContract/NanoContractTransactionHeader.component.js:96 +#: src/components/NanoContract/NanoContractTransactionHeader.js:96 msgid "Date and Time" msgstr "" #. XXX: add when shrank component can be used. -#: src/components/NanoContract/NanoContractTransactionHeader.component.js:103 -#: src/components/NanoContract/NanoContractTransactionsListItem.component.js:62 +#: src/components/NanoContract/NanoContractTransactionHeader.js:103 +#: src/components/NanoContract/NanoContractTransactionsListItem.js:62 msgid "From this wallet" msgstr "" #. XXX: add when shrank component can be used. -#: src/components/NanoContract/NanoContractTransactionHeader.component.js:106 -msgid "Caller" -msgstr "" - -#. XXX: add when shrank component can be used. -#: src/components/NanoContract/NanoContractTransactionHeader.component.js:109 +#: src/components/NanoContract/NanoContractTransactionHeader.js:109 msgid "See transaction details" msgstr "" @@ -1392,42 +1551,38 @@ msgstr "" msgid "Register new" msgstr "" -#: src/components/NanoContract/SelectAddressModal.component.js:90 +#: src/components/NanoContract/SelectAddressModal.js:90 msgid "Choose New Wallet Address" msgstr "" -#: src/components/NanoContract/SelectAddressModal.component.js:97 +#: src/components/NanoContract/SelectAddressModal.js:97 msgid "Load Addresses Error" msgstr "" -#: src/components/NanoContract/SelectAddressModal.component.js:106 +#: src/components/NanoContract/SelectAddressModal.js:106 msgid "Loading wallet addresses." msgstr "" -#: src/components/NanoContract/SelectAddressModal.component.js:114 +#: src/components/NanoContract/SelectAddressModal.js:114 msgid "Current Information" msgstr "" -#: src/components/NanoContract/SelectAddressModal.component.js:115 +#: src/components/NanoContract/SelectAddressModal.js:115 msgid "To change, select other address on the list below." msgstr "" -#: src/components/NanoContract/SelectAddressModal.component.js:178 +#: src/components/NanoContract/SelectAddressModal.js:178 msgid "index" msgstr "" -#: src/components/NanoContract/UnregisterNanoContractModal.component.js:39 +#: src/components/NanoContract/UnregisterNanoContractModal.js:39 msgid "Unregister Nano Contract" msgstr "" -#: src/components/NanoContract/UnregisterNanoContractModal.component.js:41 +#: src/components/NanoContract/UnregisterNanoContractModal.js:41 msgid "Are you sure you want to unregister this Nano Contract?" msgstr "" -#: src/components/NanoContract/UnregisterNanoContractModal.component.js:44 +#: src/components/NanoContract/UnregisterNanoContractModal.js:44 msgid "Yes, unregister contract" msgstr "" - -#: src/components/NanoContract/UnregisterNanoContractModal.component.js:50 -msgid "No, go back" -msgstr "" diff --git a/locale/pt-br/texts.po b/locale/pt-br/texts.po index 8e5a2d442..d9b7fc613 100644 --- a/locale/pt-br/texts.po +++ b/locale/pt-br/texts.po @@ -57,11 +57,11 @@ msgid "[Last] dddd [•] HH:mm" msgstr "[Última] dddd [•] HH:mm" #. See https://momentjs.com/docs/#/displaying/calendar-time/ -#: src/models.js:107 src/utils.js:415 +#: src/models.js:107 src/utils.js:416 msgid "DD MMM YYYY [•] HH:mm" msgstr "DD MMM YYYY [•] HH:mm" -#: src/utils.js:160 +#: src/utils.js:161 msgid "Invalid address" msgstr "Endereço inválido" @@ -443,9 +443,10 @@ msgstr "Palavras" msgid "Enter your seed words separated by space" msgstr "Digite suas palavras separadas por espaços" -#: src/components/NanoContract/NanoContractDetails.component.js:194 +#: src/components/NanoContract/NanoContractDetails.js:194 +#: src/components/WalletConnect/NanoContract/NewNanoContractTransactionRequest.js:282 #: src/screens/LoadHistoryScreen.js:51 src/screens/LoadWalletErrorScreen.js:20 -#: src/screens/NanoContract/NanoContractRegisterScreen.js:167 +#: src/screens/NanoContract/NanoContractRegisterScreen.js:161 msgid "Try again" msgstr "Tente novamente" @@ -547,6 +548,7 @@ msgstr "Digite seu PIN " msgid "Unlock Hathor Wallet" msgstr "Desbloqueie sua Hathor Wallet" +#: src/components/WalletConnect/NanoContract/NewNanoContractTransactionModal.js:84 #: src/screens/PinScreen.js:265 #: src/screens/WalletConnect/WalletConnectList.js:125 msgid "Cancel" @@ -714,8 +716,8 @@ msgstr "Autorizar operação" msgid "Your transfer of **${ this.amountAndToken }** has been confirmed" msgstr "Sua transferência de **${ this.amountAndToken }** foi confirmada" -#: src/components/NanoContract/EditAddressModal.component.js:60 -#: src/components/NanoContract/SelectAddressModal.component.js:117 +#: src/components/NanoContract/EditAddressModal.js:60 +#: src/components/NanoContract/SelectAddressModal.js:117 #: src/screens/SendConfirmScreen.js:161 msgid "Address" msgstr "Endereço" @@ -815,6 +817,11 @@ msgstr "Eu quero desregistrar o token **${ tokenLabel }**" msgid "Unregister token" msgstr "Desregistrar token" +#: src/components/WalletConnect/NanoContract/NewNanoContractTransactionModal.js:68 +#: src/screens/WalletConnect/NewNanoContractTransactionScreen.js:24 +msgid "New Nano Contract Transaction" +msgstr "Nova Transação de Nano Contract" + #: src/screens/WalletConnect/WalletConnectList.js:33 msgid "There was an error connecting. Please try again later." msgstr "" @@ -958,53 +965,55 @@ msgstr "" msgid "Nano Contract Details" msgstr "Detalhes do Nano Contract" -#: src/screens/NanoContract/NanoContractRegisterScreen.js:67 +#: src/screens/NanoContract/NanoContractRegisterScreen.js:58 msgid "Nano Contract ID is required." msgstr "ID do Nano Contract é obrigatório." -#: src/screens/NanoContract/NanoContractRegisterScreen.js:157 +#: src/screens/NanoContract/NanoContractRegisterScreen.js:151 msgid "See contract" msgstr "Ver contrato" -#: src/screens/NanoContract/NanoContractRegisterScreen.js:175 +#: src/screens/NanoContract/NanoContractRegisterScreen.js:169 msgid "Load First Addresses Error" msgstr "Erro ao carregar primeiro endereço da wallet" -#: src/components/NanoContract/NanoContractDetails.component.js:158 -#: src/components/NanoContract/SelectAddressModal.component.js:105 -#: src/screens/NanoContract/NanoContractRegisterScreen.js:183 +#: src/components/NanoContract/NanoContractDetails.js:158 +#: src/components/NanoContract/SelectAddressModal.js:105 +#: src/components/WalletConnect/NanoContract/NewNanoContractTransactionRequest.js:202 +#: src/screens/NanoContract/NanoContractRegisterScreen.js:177 msgid "Loading" msgstr "Carregando" -#: src/screens/NanoContract/NanoContractRegisterScreen.js:184 +#: src/screens/NanoContract/NanoContractRegisterScreen.js:178 msgid "Loading first wallet address." msgstr "Carregando primeiro endereço da wallet." -#: src/components/NanoContract/NanoContractDetailsHeader.component.js:142 -#: src/components/NanoContract/NanoContractTransactionHeader.component.js:88 +#: src/components/NanoContract/NanoContractDetailsHeader.js:142 +#: src/components/NanoContract/NanoContractTransactionHeader.js:88 #: src/components/NanoContract/NanoContractsListItem.js:57 #: src/components/TxDetailsModal.js:106 -#: src/screens/NanoContract/NanoContractRegisterScreen.js:193 +#: src/components/WalletConnect/NanoContract/NanoContractExecInfo.js:83 +#: src/screens/NanoContract/NanoContractRegisterScreen.js:187 msgid "Nano Contract ID" msgstr "ID do Nano Contract" -#: src/screens/NanoContract/NanoContractRegisterScreen.js:201 +#: src/screens/NanoContract/NanoContractRegisterScreen.js:195 msgid "Wallet Address" msgstr "Endereço da Carteira" -#: src/screens/NanoContract/NanoContractRegisterScreen.js:211 +#: src/screens/NanoContract/NanoContractRegisterScreen.js:205 msgid "If you want to change the wallet address, you will be able to do" msgstr "Se deseja alterar o endereço de assinatura, você pode alterar" -#: src/screens/NanoContract/NanoContractRegisterScreen.js:213 +#: src/screens/NanoContract/NanoContractRegisterScreen.js:207 msgid "after the contract is registered." msgstr "depois do contrato ser registrado." -#: src/screens/NanoContract/NanoContractRegisterScreen.js:232 +#: src/screens/NanoContract/NanoContractRegisterScreen.js:226 msgid "Register Nano Contract" msgstr "Registrar Nano Contract" -#: src/screens/NanoContract/NanoContractRegisterScreen.js:250 +#: src/screens/NanoContract/NanoContractRegisterScreen.js:244 msgid "Nano Contract Registration" msgstr "Registro do Nano Contract" @@ -1016,31 +1025,39 @@ msgstr "Transação do Nano Contract" msgid "Contract successfully registered." msgstr "Nano Contract registrado com sucesso." -#: src/sagas/nanoContract.js:43 +#: src/sagas/nanoContract.js:45 msgid "Nano Contract already registered." msgstr "Nano Contract já registrado." -#: src/sagas/nanoContract.js:44 +#: src/sagas/nanoContract.js:46 msgid "Wallet is not ready yet to register a Nano Contract." msgstr "A wallet não está pronta ainda para registrar Nano Contracts." -#: src/sagas/nanoContract.js:45 +#: src/sagas/nanoContract.js:47 msgid "The informed address does not belong to the wallet." msgstr "O endereço informado não pertence a esta carteira." -#: src/sagas/nanoContract.js:46 +#: src/sagas/nanoContract.js:48 msgid "Nano Contract not found." msgstr "Nano Contract não encontrado" -#: src/sagas/nanoContract.js:47 +#: src/sagas/nanoContract.js:49 msgid "Error while trying to get Nano Contract state." msgstr "Erro ao obter o estado do Nano Contract." -#: src/sagas/nanoContract.js:48 +#: src/sagas/nanoContract.js:50 +msgid "Blueprint not found." +msgstr "Blueprint não encontrado." + +#: src/sagas/nanoContract.js:51 +msgid "Couldn't get Blueprint info." +msgstr "Não foi possível carregar informações do Blueprint." + +#: src/sagas/nanoContract.js:52 msgid "Nano Contract not registered." msgstr "Nano Contract não registrado." -#: src/sagas/nanoContract.js:49 +#: src/sagas/nanoContract.js:53 msgid "Error while trying to download Nano Contract transactions history." msgstr "Error ao fazer download do histórico de transações do Nano Contract." @@ -1087,22 +1104,29 @@ msgstr "Transação" msgid "Open" msgstr "Abrir" -#: src/sagas/wallet.js:744 +#: src/sagas/tokens.js:40 +msgid "Wallet is not ready yet." +msgstr "A wallet não está pronta ainda." + +#: src/sagas/tokens.js:41 +msgid "Error loading the details of some tokens." +msgstr "Ocorreu um erro durante o carregamento de detalhes de alguns tokens." + +#: src/sagas/wallet.js:749 msgid "Wallet is not ready to load addresses." msgstr "A wallet não está pronta para carregar os endereços." #. This will show the message in the feedback content at SelectAddressModal -#: src/sagas/wallet.js:760 +#: src/sagas/wallet.js:765 msgid "There was an error while loading wallet addresses. Try again." -msgstr "" -"Ocorreu um erro ao carregar os endereços da wallet. Tente novamente." +msgstr "Ocorreu um erro ao carregar os endereços da wallet. Tente novamente." -#: src/sagas/wallet.js:770 +#: src/sagas/wallet.js:775 msgid "Wallet is not ready to load the first address." msgstr "A wallet não está pronta para carregar o primeiro endereço." #. This will show the message in the feedback content -#: src/sagas/wallet.js:786 +#: src/sagas/wallet.js:791 msgid "There was an error while loading first wallet address. Try again." msgstr "" "Ocorreu um erro ao carregar o primeiro endereço da wallet. Tente novamente." @@ -1277,13 +1301,14 @@ msgstr "Inválida" msgid "Description" msgstr "Descrição" -#: src/components/NanoContract/NanoContractTransactionHeader.component.js:47 +#: src/components/NanoContract/NanoContractTransactionHeader.js:47 #: src/components/TxDetailsModal.js:104 msgid "Transaction ID" msgstr "ID da Transação" -#: src/components/NanoContract/NanoContractTransactionHeader.component.js:92 +#: src/components/NanoContract/NanoContractTransactionHeader.js:92 #: src/components/TxDetailsModal.js:105 +#: src/components/WalletConnect/NanoContract/NanoContractExecInfo.js:116 msgid "Blueprint Method" msgstr "Método do Blueprint" @@ -1295,7 +1320,7 @@ msgstr "Endereço de assinatura do Nano Contract" msgid "Nano Contract Status" msgstr "Status do Nano Contract" -#: src/components/NanoContract/NanoContractDetailsHeader.component.js:79 +#: src/components/NanoContract/NanoContractDetailsHeader.js:79 #: src/components/TxDetailsModal.js:120 msgid "Nano Contract" msgstr "Nano Contract" @@ -1336,15 +1361,162 @@ msgstr "" "endereço derivado da sua chave raiz no caminho de derivação " "m/44'/280'/0'/0/0." +#: src/components/WalletConnect/NanoContract/DappContainer.js:41 +msgid "Review your transaction from this dApp" +msgstr "Revise sua transação originada neste dApp" + +#: src/components/WalletConnect/NanoContract/DappContainer.js:44 +msgid "Stay vigilant and protect your data from potential phishing attempts." +msgstr "Fique atento e proteja seus dados de potenciais tentativas de phising." + +#: src/components/WalletConnect/NanoContract/DeclineModal.js:26 +msgid "Decline transaction" +msgstr "Recusar transação" + +#: src/components/WalletConnect/NanoContract/DeclineModal.js:29 +msgid "Are you sure you want to decline this transaction?" +msgstr "Tem certeza que deseja recusar esta transação?" + +#: src/components/WalletConnect/NanoContract/DeclineModal.js:33 +msgid "Yes, decline transaction" +msgstr "Sim, recusar transação" + +#: src/components/NanoContract/UnregisterNanoContractModal.js:50 +#: src/components/WalletConnect/NanoContract/DeclineModal.js:39 +msgid "No, go back" +msgstr "Não, voltar" + +#: src/components/WalletConnect/NanoContract/NanoContractActions.js:36 +#, javascript-format +msgid "${ tokenSymbol } Deposit" +msgstr "${ tokenSymbol } Depósito" + +#: src/components/WalletConnect/NanoContract/NanoContractActions.js:37 +msgid "${ tokenSymbol } Withdrawal" +msgstr "${ tokenSymbol } Saque" + +#: src/components/WalletConnect/NanoContract/NanoContractActions.js:101 +msgid "Action List" +msgstr "Lista de Actions" + +#: src/components/WalletConnect/NanoContract/NanoContractActions.js:150 +msgid "To Address:" +msgstr "Para o endereço:" + +#: src/components/WalletConnect/NanoContract/NanoContractExecInfo.js:88 +msgid "Blueprint ID" +msgstr "ID do Blueprint" + +#: src/components/NanoContract/NanoContractDetailsHeader.js:146 +#: src/components/NanoContract/NanoContractsListItem.js:59 +#: src/components/WalletConnect/NanoContract/NanoContractExecInfo.js:93 +msgid "Blueprint Name" +msgstr "Nome do Blueprint" + +#: src/components/WalletConnect/NanoContract/NanoContractExecInfo.js:109 +#: src/components/WalletConnect/NanoContract/NanoContractExecInfo.js:140 +msgid "Loading..." +msgstr "Carregando..." + +#: src/components/NanoContract/NanoContractTransactionHeader.js:106 +#: src/components/WalletConnect/NanoContract/NanoContractExecInfo.js:124 +msgid "Caller" +msgstr "Caller" + +#: src/components/WalletConnect/NanoContract/NanoContractExecInfo.js:143 +msgid "Couldn't determine address, select one" +msgstr "Não foi possível determinar um endereço, selecione um" + +#: src/components/WalletConnect/NanoContract/NanoContractMethodArgs.js:48 +#, javascript-format +msgid "Position ${ idx }" +msgstr "Posição ${ idx }" + +#: src/components/WalletConnect/NanoContract/NanoContractMethodArgs.js:93 +msgid "Arguments" +msgstr "Argumentos" + +#: src/components/WalletConnect/NanoContract/NewNanoContractTransactionModal.js:72 +msgid "You have received a new Nano Contract Transaction. Please" +msgstr "" +"Você recebeu um pedido para criar uma transação de Nano Contract. Por favor," + +#: src/components/WalletConnect/NanoContract/NewNanoContractTransactionModal.js:74 +msgid "carefully review the details" +msgstr "revise os detalhes com cuidado" + +#: src/components/WalletConnect/NanoContract/NewNanoContractTransactionModal.js:76 +msgid "before deciding to accept or decline." +msgstr "antes de decidir aceitar ou recusar." + +#: src/components/WalletConnect/NanoContract/NewNanoContractTransactionModal.js:80 +msgid "Review transaction details" +msgstr "Revisar detalhes da transação" + +#: src/components/WalletConnect/NanoContract/NewNanoContractTransactionModal.js:98 +msgid "" +"Caution: There are risks associated with signing dapp transaction requests." +msgstr "" +"Cuidado: Há riscos associados a pedidos de assinatura de transação via dApp." + +#: src/components/WalletConnect/NanoContract/NewNanoContractTransactionModal.js:104 +msgid "Read More." +msgstr "Ler mais." + +#: src/components/WalletConnect/NanoContract/NewNanoContractTransactionRequest.js:184 +msgid "Nano Contract Not Found" +msgstr "Nano Contract não encontrado" + +#: src/components/WalletConnect/NanoContract/NewNanoContractTransactionRequest.js:185 +msgid "" +"The Nano Contract requested is not registered. First register the Nano " +"Contract to interact with it." +msgstr "" +"O Nano Contract solicitado não está registrado. Primeiro registre o Nano " +"Contract para interagir com ele." + +#: src/components/WalletConnect/NanoContract/NewNanoContractTransactionRequest.js:188 +#: src/components/WalletConnect/NanoContract/NewNanoContractTransactionRequest.js:235 +msgid "Decline Transaction" +msgstr "Recusar transação" + +#: src/components/WalletConnect/NanoContract/NewNanoContractTransactionRequest.js:203 +msgid "Loading transaction information." +msgstr "Carregando informações da transação." + +#: src/components/WalletConnect/NanoContract/NewNanoContractTransactionRequest.js:231 +msgid "Accept Transaction" +msgstr "Aceitar transação" + +#: src/components/WalletConnect/NanoContract/NewNanoContractTransactionRequest.js:245 +msgid "Sending transaction" +msgstr "Enviando transação" + +#: src/components/WalletConnect/NanoContract/NewNanoContractTransactionRequest.js:246 +msgid "Please wait." +msgstr "Por favor, espere." + +#: src/components/WalletConnect/NanoContract/NewNanoContractTransactionRequest.js:272 +msgid "Transaction successfully sent." +msgstr "Transação enviada com sucesso." + +#: src/components/WalletConnect/NanoContract/NewNanoContractTransactionRequest.js:274 +msgid "Ok, close" +msgstr "Ok, fechar" + +#: src/components/WalletConnect/NanoContract/NewNanoContractTransactionRequest.js:280 +msgid "Error while sending transaction." +msgstr "Ocorreu um erro durante o envio da transação." + #: src/components/NetworkSettings/NetworkStatusBar.js:14 msgid "Custom network" msgstr "Rede personalizada" -#: src/components/NanoContract/EditAddressModal.component.js:41 +#: src/components/NanoContract/EditAddressModal.js:41 msgid "New Nano Contract Address" msgstr "Novo endereço para o Nano Contract" -#: src/components/NanoContract/EditAddressModal.component.js:49 +#: src/components/NanoContract/EditAddressModal.js:49 msgid "" "This address signs any transaction you create with Nano Contracts method. " "Switching to a new one means" @@ -1352,69 +1524,59 @@ msgstr "" "Este endereço assina toda transação criada com os métodos do Nano Contract. " "Ao alterar para um novo endereço significa que" -#: src/components/NanoContract/EditAddressModal.component.js:51 +#: src/components/NanoContract/EditAddressModal.js:51 msgid "all future transactions will use this address." msgstr "todas as transações futuras usarão este endereço." -#: src/components/NanoContract/EditAddressModal.component.js:57 +#: src/components/NanoContract/EditAddressModal.js:57 msgid "Selected Information" msgstr "Informação Selecionada" -#: src/components/NanoContract/EditAddressModal.component.js:67 +#: src/components/NanoContract/EditAddressModal.js:67 msgid "Index" msgstr "Índice" -#: src/components/NanoContract/EditAddressModal.component.js:74 +#: src/components/NanoContract/EditAddressModal.js:74 msgid "Confirm new address" msgstr "Confirmar novo endereço" -#: src/components/NanoContract/EditAddressModal.component.js:78 +#: src/components/NanoContract/EditAddressModal.js:78 msgid "Go back" msgstr "Voltar" -#: src/components/NanoContract/NanoContractDetails.component.js:159 +#: src/components/NanoContract/NanoContractDetails.js:159 msgid "Loading Nano Contract transactions." msgstr "Carregando transações do Nano Contract" -#: src/components/NanoContract/NanoContractDetails.component.js:173 +#: src/components/NanoContract/NanoContractDetails.js:173 msgid "Nano Contract Transactions Error" msgstr "Erro em Transações do Nano Contract" -#: src/components/NanoContract/NanoContractDetailsHeader.component.js:146 -#: src/components/NanoContract/NanoContractsListItem.js:59 -msgid "Blueprint Name" -msgstr "Nome do Blueprint" - -#: src/components/NanoContract/NanoContractDetailsHeader.component.js:150 +#: src/components/NanoContract/NanoContractDetailsHeader.js:150 msgid "Registered Address" msgstr "Endereço Registrado" -#: src/components/NanoContract/NanoContractDetailsHeader.component.js:153 +#: src/components/NanoContract/NanoContractDetailsHeader.js:153 msgid "See status details" msgstr "Ver detalhes" -#: src/components/NanoContract/NanoContractDetailsHeader.component.js:154 +#: src/components/NanoContract/NanoContractDetailsHeader.js:154 msgid "Unregister contract" msgstr "Desregistrar contract" #. XXX: add when shrank component can be used. -#: src/components/NanoContract/NanoContractTransactionHeader.component.js:96 +#: src/components/NanoContract/NanoContractTransactionHeader.js:96 msgid "Date and Time" msgstr "Data & Hora" #. XXX: add when shrank component can be used. -#: src/components/NanoContract/NanoContractTransactionHeader.component.js:103 -#: src/components/NanoContract/NanoContractTransactionsListItem.component.js:62 +#: src/components/NanoContract/NanoContractTransactionHeader.js:103 +#: src/components/NanoContract/NanoContractTransactionsListItem.js:62 msgid "From this wallet" msgstr "Desta wallet" #. XXX: add when shrank component can be used. -#: src/components/NanoContract/NanoContractTransactionHeader.component.js:106 -msgid "Caller" -msgstr "Caller" - -#. XXX: add when shrank component can be used. -#: src/components/NanoContract/NanoContractTransactionHeader.component.js:109 +#: src/components/NanoContract/NanoContractTransactionHeader.js:109 msgid "See transaction details" msgstr "Ver detalhes" @@ -1432,42 +1594,38 @@ msgstr "Você pode acompanhar os Nano Contracts registrados nesta tela." msgid "Register new" msgstr "Registrar novo" -#: src/components/NanoContract/SelectAddressModal.component.js:90 +#: src/components/NanoContract/SelectAddressModal.js:90 msgid "Choose New Wallet Address" msgstr "Escolha o Novo Endereço" -#: src/components/NanoContract/SelectAddressModal.component.js:97 +#: src/components/NanoContract/SelectAddressModal.js:97 msgid "Load Addresses Error" msgstr "Erro ao carregar endereços" -#: src/components/NanoContract/SelectAddressModal.component.js:106 +#: src/components/NanoContract/SelectAddressModal.js:106 msgid "Loading wallet addresses." msgstr "Carregando endereços da wallet." -#: src/components/NanoContract/SelectAddressModal.component.js:114 +#: src/components/NanoContract/SelectAddressModal.js:114 msgid "Current Information" msgstr "Informação Atual" -#: src/components/NanoContract/SelectAddressModal.component.js:115 +#: src/components/NanoContract/SelectAddressModal.js:115 msgid "To change, select other address on the list below." msgstr "Para alterar, selecione outro endereço da lista abaixo." -#: src/components/NanoContract/SelectAddressModal.component.js:178 +#: src/components/NanoContract/SelectAddressModal.js:178 msgid "index" msgstr "índice" -#: src/components/NanoContract/UnregisterNanoContractModal.component.js:39 +#: src/components/NanoContract/UnregisterNanoContractModal.js:39 msgid "Unregister Nano Contract" msgstr "Desregistrar Nano Contract" -#: src/components/NanoContract/UnregisterNanoContractModal.component.js:41 +#: src/components/NanoContract/UnregisterNanoContractModal.js:41 msgid "Are you sure you want to unregister this Nano Contract?" msgstr "Confirma que deseja desregistrar este Nano Contract?" -#: src/components/NanoContract/UnregisterNanoContractModal.component.js:44 +#: src/components/NanoContract/UnregisterNanoContractModal.js:44 msgid "Yes, unregister contract" msgstr "Sim, desregistrar" - -#: src/components/NanoContract/UnregisterNanoContractModal.component.js:50 -msgid "No, go back" -msgstr "Não, voltar" diff --git a/locale/ru-ru/texts.po b/locale/ru-ru/texts.po index 95fb124b3..73c470714 100644 --- a/locale/ru-ru/texts.po +++ b/locale/ru-ru/texts.po @@ -58,11 +58,11 @@ msgid "[Last] dddd [•] HH:mm" msgstr "[Последний] dddd [•] HH:mm" #. See https://momentjs.com/docs/#/displaying/calendar-time/ -#: src/models.js:107 src/utils.js:415 +#: src/models.js:107 src/utils.js:416 msgid "DD MMM YYYY [•] HH:mm" msgstr "DD MMM YYYY [•] HH:mm" -#: src/utils.js:160 +#: src/utils.js:161 msgid "Invalid address" msgstr "Неправильный адрес" @@ -433,9 +433,10 @@ msgstr "Слова" msgid "Enter your seed words separated by space" msgstr "Введите seed-фразу" -#: src/components/NanoContract/NanoContractDetails.component.js:194 +#: src/components/NanoContract/NanoContractDetails.js:194 +#: src/components/WalletConnect/NanoContract/NewNanoContractTransactionRequest.js:282 #: src/screens/LoadHistoryScreen.js:51 src/screens/LoadWalletErrorScreen.js:20 -#: src/screens/NanoContract/NanoContractRegisterScreen.js:167 +#: src/screens/NanoContract/NanoContractRegisterScreen.js:161 msgid "Try again" msgstr "" @@ -536,6 +537,7 @@ msgstr "Введите свой PIN-код " msgid "Unlock Hathor Wallet" msgstr "Разблокировать Hathor Wallet" +#: src/components/WalletConnect/NanoContract/NewNanoContractTransactionModal.js:84 #: src/screens/PinScreen.js:265 #: src/screens/WalletConnect/WalletConnectList.js:125 msgid "Cancel" @@ -700,8 +702,8 @@ msgstr "Авторизовать операцию" msgid "Your transfer of **${ this.amountAndToken }** has been confirmed" msgstr "Ваш перевод **${ this.amountAndToken }** был подтвержден" -#: src/components/NanoContract/EditAddressModal.component.js:60 -#: src/components/NanoContract/SelectAddressModal.component.js:117 +#: src/components/NanoContract/EditAddressModal.js:60 +#: src/components/NanoContract/SelectAddressModal.js:117 #: src/screens/SendConfirmScreen.js:161 msgid "Address" msgstr "Адрес" @@ -801,6 +803,11 @@ msgstr "Я хочу отменить регистрацию токена **${ to msgid "Unregister token" msgstr "Отменить регистрацию токена" +#: src/components/WalletConnect/NanoContract/NewNanoContractTransactionModal.js:68 +#: src/screens/WalletConnect/NewNanoContractTransactionScreen.js:24 +msgid "New Nano Contract Transaction" +msgstr "" + #: src/screens/WalletConnect/WalletConnectList.js:33 msgid "There was an error connecting. Please try again later." msgstr "" @@ -936,53 +943,55 @@ msgstr "" msgid "Nano Contract Details" msgstr "" -#: src/screens/NanoContract/NanoContractRegisterScreen.js:67 +#: src/screens/NanoContract/NanoContractRegisterScreen.js:58 msgid "Nano Contract ID is required." msgstr "" -#: src/screens/NanoContract/NanoContractRegisterScreen.js:157 +#: src/screens/NanoContract/NanoContractRegisterScreen.js:151 msgid "See contract" msgstr "" -#: src/screens/NanoContract/NanoContractRegisterScreen.js:175 +#: src/screens/NanoContract/NanoContractRegisterScreen.js:169 msgid "Load First Addresses Error" msgstr "" -#: src/components/NanoContract/NanoContractDetails.component.js:158 -#: src/components/NanoContract/SelectAddressModal.component.js:105 -#: src/screens/NanoContract/NanoContractRegisterScreen.js:183 +#: src/components/NanoContract/NanoContractDetails.js:158 +#: src/components/NanoContract/SelectAddressModal.js:105 +#: src/components/WalletConnect/NanoContract/NewNanoContractTransactionRequest.js:202 +#: src/screens/NanoContract/NanoContractRegisterScreen.js:177 msgid "Loading" msgstr "" -#: src/screens/NanoContract/NanoContractRegisterScreen.js:184 +#: src/screens/NanoContract/NanoContractRegisterScreen.js:178 msgid "Loading first wallet address." msgstr "" -#: src/components/NanoContract/NanoContractDetailsHeader.component.js:142 -#: src/components/NanoContract/NanoContractTransactionHeader.component.js:88 +#: src/components/NanoContract/NanoContractDetailsHeader.js:142 +#: src/components/NanoContract/NanoContractTransactionHeader.js:88 #: src/components/NanoContract/NanoContractsListItem.js:57 #: src/components/TxDetailsModal.js:106 -#: src/screens/NanoContract/NanoContractRegisterScreen.js:193 +#: src/components/WalletConnect/NanoContract/NanoContractExecInfo.js:83 +#: src/screens/NanoContract/NanoContractRegisterScreen.js:187 msgid "Nano Contract ID" msgstr "" -#: src/screens/NanoContract/NanoContractRegisterScreen.js:201 +#: src/screens/NanoContract/NanoContractRegisterScreen.js:195 msgid "Wallet Address" msgstr "" -#: src/screens/NanoContract/NanoContractRegisterScreen.js:211 +#: src/screens/NanoContract/NanoContractRegisterScreen.js:205 msgid "If you want to change the wallet address, you will be able to do" msgstr "" -#: src/screens/NanoContract/NanoContractRegisterScreen.js:213 +#: src/screens/NanoContract/NanoContractRegisterScreen.js:207 msgid "after the contract is registered." msgstr "" -#: src/screens/NanoContract/NanoContractRegisterScreen.js:232 +#: src/screens/NanoContract/NanoContractRegisterScreen.js:226 msgid "Register Nano Contract" msgstr "" -#: src/screens/NanoContract/NanoContractRegisterScreen.js:250 +#: src/screens/NanoContract/NanoContractRegisterScreen.js:244 msgid "Nano Contract Registration" msgstr "" @@ -994,31 +1003,39 @@ msgstr "" msgid "Contract successfully registered." msgstr "" -#: src/sagas/nanoContract.js:43 +#: src/sagas/nanoContract.js:45 msgid "Nano Contract already registered." msgstr "" -#: src/sagas/nanoContract.js:44 +#: src/sagas/nanoContract.js:46 msgid "Wallet is not ready yet to register a Nano Contract." msgstr "" -#: src/sagas/nanoContract.js:45 +#: src/sagas/nanoContract.js:47 msgid "The informed address does not belong to the wallet." msgstr "" -#: src/sagas/nanoContract.js:46 +#: src/sagas/nanoContract.js:48 msgid "Nano Contract not found." msgstr "" -#: src/sagas/nanoContract.js:47 +#: src/sagas/nanoContract.js:49 msgid "Error while trying to get Nano Contract state." msgstr "" -#: src/sagas/nanoContract.js:48 +#: src/sagas/nanoContract.js:50 +msgid "Blueprint not found." +msgstr "" + +#: src/sagas/nanoContract.js:51 +msgid "Couldn't get Blueprint info." +msgstr "" + +#: src/sagas/nanoContract.js:52 msgid "Nano Contract not registered." msgstr "" -#: src/sagas/nanoContract.js:49 +#: src/sagas/nanoContract.js:53 msgid "Error while trying to download Nano Contract transactions history." msgstr "" @@ -1064,21 +1081,29 @@ msgstr "" msgid "Open" msgstr "Открыть" -#: src/sagas/wallet.js:744 +#: src/sagas/tokens.js:40 +msgid "Wallet is not ready yet." +msgstr "" + +#: src/sagas/tokens.js:41 +msgid "Error loading the details of some tokens." +msgstr "" + +#: src/sagas/wallet.js:749 msgid "Wallet is not ready to load addresses." msgstr "" #. This will show the message in the feedback content at SelectAddressModal -#: src/sagas/wallet.js:760 +#: src/sagas/wallet.js:765 msgid "There was an error while loading wallet addresses. Try again." msgstr "" -#: src/sagas/wallet.js:770 +#: src/sagas/wallet.js:775 msgid "Wallet is not ready to load the first address." msgstr "" #. This will show the message in the feedback content -#: src/sagas/wallet.js:786 +#: src/sagas/wallet.js:791 msgid "There was an error while loading first wallet address. Try again." msgstr "" @@ -1235,13 +1260,14 @@ msgstr "" msgid "Description" msgstr "Описание" -#: src/components/NanoContract/NanoContractTransactionHeader.component.js:47 +#: src/components/NanoContract/NanoContractTransactionHeader.js:47 #: src/components/TxDetailsModal.js:104 msgid "Transaction ID" msgstr "" -#: src/components/NanoContract/NanoContractTransactionHeader.component.js:92 +#: src/components/NanoContract/NanoContractTransactionHeader.js:92 #: src/components/TxDetailsModal.js:105 +#: src/components/WalletConnect/NanoContract/NanoContractExecInfo.js:116 msgid "Blueprint Method" msgstr "" @@ -1253,7 +1279,7 @@ msgstr "" msgid "Nano Contract Status" msgstr "" -#: src/components/NanoContract/NanoContractDetailsHeader.component.js:79 +#: src/components/NanoContract/NanoContractDetailsHeader.js:79 #: src/components/TxDetailsModal.js:120 msgid "Nano Contract" msgstr "" @@ -1287,83 +1313,216 @@ msgid "" "address derived from your root key on the m/44'/280'/0'/0/0 derivation path." msgstr "" +#: src/components/WalletConnect/NanoContract/DappContainer.js:41 +msgid "Review your transaction from this dApp" +msgstr "" + +#: src/components/WalletConnect/NanoContract/DappContainer.js:44 +msgid "Stay vigilant and protect your data from potential phishing attempts." +msgstr "" + +#: src/components/WalletConnect/NanoContract/DeclineModal.js:26 +msgid "Decline transaction" +msgstr "" + +#: src/components/WalletConnect/NanoContract/DeclineModal.js:29 +msgid "Are you sure you want to decline this transaction?" +msgstr "" + +#: src/components/WalletConnect/NanoContract/DeclineModal.js:33 +msgid "Yes, decline transaction" +msgstr "" + +#: src/components/NanoContract/UnregisterNanoContractModal.js:50 +#: src/components/WalletConnect/NanoContract/DeclineModal.js:39 +msgid "No, go back" +msgstr "" + +#: src/components/WalletConnect/NanoContract/NanoContractActions.js:36 +#, javascript-format +msgid "${ tokenSymbol } Deposit" +msgstr "" + +#: src/components/WalletConnect/NanoContract/NanoContractActions.js:37 +msgid "${ tokenSymbol } Withdrawal" +msgstr "" + +#: src/components/WalletConnect/NanoContract/NanoContractActions.js:101 +msgid "Action List" +msgstr "" + +#: src/components/WalletConnect/NanoContract/NanoContractActions.js:150 +msgid "To Address:" +msgstr "" + +#: src/components/WalletConnect/NanoContract/NanoContractExecInfo.js:88 +msgid "Blueprint ID" +msgstr "" + +#: src/components/NanoContract/NanoContractDetailsHeader.js:146 +#: src/components/NanoContract/NanoContractsListItem.js:59 +#: src/components/WalletConnect/NanoContract/NanoContractExecInfo.js:93 +msgid "Blueprint Name" +msgstr "" + +#: src/components/WalletConnect/NanoContract/NanoContractExecInfo.js:109 +#: src/components/WalletConnect/NanoContract/NanoContractExecInfo.js:140 +msgid "Loading..." +msgstr "" + +#: src/components/NanoContract/NanoContractTransactionHeader.js:106 +#: src/components/WalletConnect/NanoContract/NanoContractExecInfo.js:124 +msgid "Caller" +msgstr "" + +#: src/components/WalletConnect/NanoContract/NanoContractExecInfo.js:143 +msgid "Couldn't determine address, select one" +msgstr "" + +#: src/components/WalletConnect/NanoContract/NanoContractMethodArgs.js:48 +#, javascript-format +msgid "Position ${ idx }" +msgstr "" + +#: src/components/WalletConnect/NanoContract/NanoContractMethodArgs.js:93 +msgid "Arguments" +msgstr "" + +#: src/components/WalletConnect/NanoContract/NewNanoContractTransactionModal.js:72 +msgid "You have received a new Nano Contract Transaction. Please" +msgstr "" + +#: src/components/WalletConnect/NanoContract/NewNanoContractTransactionModal.js:74 +msgid "carefully review the details" +msgstr "" + +#: src/components/WalletConnect/NanoContract/NewNanoContractTransactionModal.js:76 +msgid "before deciding to accept or decline." +msgstr "" + +#: src/components/WalletConnect/NanoContract/NewNanoContractTransactionModal.js:80 +msgid "Review transaction details" +msgstr "" + +#: src/components/WalletConnect/NanoContract/NewNanoContractTransactionModal.js:98 +msgid "" +"Caution: There are risks associated with signing dapp transaction requests." +msgstr "" + +#: src/components/WalletConnect/NanoContract/NewNanoContractTransactionModal.js:104 +msgid "Read More." +msgstr "" + +#: src/components/WalletConnect/NanoContract/NewNanoContractTransactionRequest.js:184 +msgid "Nano Contract Not Found" +msgstr "" + +#: src/components/WalletConnect/NanoContract/NewNanoContractTransactionRequest.js:185 +msgid "" +"The Nano Contract requested is not registered. First register the Nano " +"Contract to interact with it." +msgstr "" + +#: src/components/WalletConnect/NanoContract/NewNanoContractTransactionRequest.js:188 +#: src/components/WalletConnect/NanoContract/NewNanoContractTransactionRequest.js:235 +msgid "Decline Transaction" +msgstr "" + +#: src/components/WalletConnect/NanoContract/NewNanoContractTransactionRequest.js:203 +msgid "Loading transaction information." +msgstr "" + +#: src/components/WalletConnect/NanoContract/NewNanoContractTransactionRequest.js:231 +msgid "Accept Transaction" +msgstr "" + +#: src/components/WalletConnect/NanoContract/NewNanoContractTransactionRequest.js:245 +msgid "Sending transaction" +msgstr "" + +#: src/components/WalletConnect/NanoContract/NewNanoContractTransactionRequest.js:246 +msgid "Please wait." +msgstr "" + +#: src/components/WalletConnect/NanoContract/NewNanoContractTransactionRequest.js:272 +msgid "Transaction successfully sent." +msgstr "" + +#: src/components/WalletConnect/NanoContract/NewNanoContractTransactionRequest.js:274 +msgid "Ok, close" +msgstr "" + +#: src/components/WalletConnect/NanoContract/NewNanoContractTransactionRequest.js:280 +msgid "Error while sending transaction." +msgstr "" + #: src/components/NetworkSettings/NetworkStatusBar.js:14 msgid "Custom network" msgstr "" -#: src/components/NanoContract/EditAddressModal.component.js:41 +#: src/components/NanoContract/EditAddressModal.js:41 msgid "New Nano Contract Address" msgstr "" -#: src/components/NanoContract/EditAddressModal.component.js:49 +#: src/components/NanoContract/EditAddressModal.js:49 msgid "" "This address signs any transaction you create with Nano Contracts method. " "Switching to a new one means" msgstr "" -#: src/components/NanoContract/EditAddressModal.component.js:51 +#: src/components/NanoContract/EditAddressModal.js:51 msgid "all future transactions will use this address." msgstr "" -#: src/components/NanoContract/EditAddressModal.component.js:57 +#: src/components/NanoContract/EditAddressModal.js:57 msgid "Selected Information" msgstr "" -#: src/components/NanoContract/EditAddressModal.component.js:67 +#: src/components/NanoContract/EditAddressModal.js:67 msgid "Index" msgstr "" -#: src/components/NanoContract/EditAddressModal.component.js:74 +#: src/components/NanoContract/EditAddressModal.js:74 msgid "Confirm new address" msgstr "" -#: src/components/NanoContract/EditAddressModal.component.js:78 +#: src/components/NanoContract/EditAddressModal.js:78 msgid "Go back" msgstr "" -#: src/components/NanoContract/NanoContractDetails.component.js:159 +#: src/components/NanoContract/NanoContractDetails.js:159 msgid "Loading Nano Contract transactions." msgstr "" -#: src/components/NanoContract/NanoContractDetails.component.js:173 +#: src/components/NanoContract/NanoContractDetails.js:173 msgid "Nano Contract Transactions Error" msgstr "" -#: src/components/NanoContract/NanoContractDetailsHeader.component.js:146 -#: src/components/NanoContract/NanoContractsListItem.js:59 -msgid "Blueprint Name" -msgstr "" - -#: src/components/NanoContract/NanoContractDetailsHeader.component.js:150 +#: src/components/NanoContract/NanoContractDetailsHeader.js:150 msgid "Registered Address" msgstr "" -#: src/components/NanoContract/NanoContractDetailsHeader.component.js:153 +#: src/components/NanoContract/NanoContractDetailsHeader.js:153 msgid "See status details" msgstr "" -#: src/components/NanoContract/NanoContractDetailsHeader.component.js:154 +#: src/components/NanoContract/NanoContractDetailsHeader.js:154 msgid "Unregister contract" msgstr "" #. XXX: add when shrank component can be used. -#: src/components/NanoContract/NanoContractTransactionHeader.component.js:96 +#: src/components/NanoContract/NanoContractTransactionHeader.js:96 msgid "Date and Time" msgstr "" #. XXX: add when shrank component can be used. -#: src/components/NanoContract/NanoContractTransactionHeader.component.js:103 -#: src/components/NanoContract/NanoContractTransactionsListItem.component.js:62 +#: src/components/NanoContract/NanoContractTransactionHeader.js:103 +#: src/components/NanoContract/NanoContractTransactionsListItem.js:62 msgid "From this wallet" msgstr "" #. XXX: add when shrank component can be used. -#: src/components/NanoContract/NanoContractTransactionHeader.component.js:106 -msgid "Caller" -msgstr "" - -#. XXX: add when shrank component can be used. -#: src/components/NanoContract/NanoContractTransactionHeader.component.js:109 +#: src/components/NanoContract/NanoContractTransactionHeader.js:109 msgid "See transaction details" msgstr "" @@ -1381,42 +1540,38 @@ msgstr "" msgid "Register new" msgstr "" -#: src/components/NanoContract/SelectAddressModal.component.js:90 +#: src/components/NanoContract/SelectAddressModal.js:90 msgid "Choose New Wallet Address" msgstr "" -#: src/components/NanoContract/SelectAddressModal.component.js:97 +#: src/components/NanoContract/SelectAddressModal.js:97 msgid "Load Addresses Error" msgstr "" -#: src/components/NanoContract/SelectAddressModal.component.js:106 +#: src/components/NanoContract/SelectAddressModal.js:106 msgid "Loading wallet addresses." msgstr "" -#: src/components/NanoContract/SelectAddressModal.component.js:114 +#: src/components/NanoContract/SelectAddressModal.js:114 msgid "Current Information" msgstr "" -#: src/components/NanoContract/SelectAddressModal.component.js:115 +#: src/components/NanoContract/SelectAddressModal.js:115 msgid "To change, select other address on the list below." msgstr "" -#: src/components/NanoContract/SelectAddressModal.component.js:178 +#: src/components/NanoContract/SelectAddressModal.js:178 msgid "index" msgstr "" -#: src/components/NanoContract/UnregisterNanoContractModal.component.js:39 +#: src/components/NanoContract/UnregisterNanoContractModal.js:39 msgid "Unregister Nano Contract" msgstr "" -#: src/components/NanoContract/UnregisterNanoContractModal.component.js:41 +#: src/components/NanoContract/UnregisterNanoContractModal.js:41 msgid "Are you sure you want to unregister this Nano Contract?" msgstr "" -#: src/components/NanoContract/UnregisterNanoContractModal.component.js:44 +#: src/components/NanoContract/UnregisterNanoContractModal.js:44 msgid "Yes, unregister contract" msgstr "" - -#: src/components/NanoContract/UnregisterNanoContractModal.component.js:50 -msgid "No, go back" -msgstr "" diff --git a/locale/texts.pot b/locale/texts.pot index f11693ef4..5c843988c 100644 --- a/locale/texts.pot +++ b/locale/texts.pot @@ -48,12 +48,12 @@ msgid "[Last] dddd [•] HH:mm" msgstr "" #: src/models.js:107 -#: src/utils.js:415 +#: src/utils.js:416 #. See https://momentjs.com/docs/#/displaying/calendar-time/ msgid "DD MMM YYYY [•] HH:mm" msgstr "" -#: src/utils.js:160 +#: src/utils.js:161 msgid "Invalid address" msgstr "" @@ -421,10 +421,11 @@ msgstr "" msgid "Enter your seed words separated by space" msgstr "" -#: src/components/NanoContract/NanoContractDetails.component.js:194 +#: src/components/NanoContract/NanoContractDetails.js:194 +#: src/components/WalletConnect/NanoContract/NewNanoContractTransactionRequest.js:282 #: src/screens/LoadHistoryScreen.js:51 #: src/screens/LoadWalletErrorScreen.js:20 -#: src/screens/NanoContract/NanoContractRegisterScreen.js:167 +#: src/screens/NanoContract/NanoContractRegisterScreen.js:161 msgid "Try again" msgstr "" @@ -529,6 +530,7 @@ msgstr "" msgid "Unlock Hathor Wallet" msgstr "" +#: src/components/WalletConnect/NanoContract/NewNanoContractTransactionModal.js:84 #: src/screens/PinScreen.js:265 #: src/screens/WalletConnect/WalletConnectList.js:125 msgid "Cancel" @@ -696,8 +698,8 @@ msgstr "" msgid "Your transfer of **${ this.amountAndToken }** has been confirmed" msgstr "" -#: src/components/NanoContract/EditAddressModal.component.js:60 -#: src/components/NanoContract/SelectAddressModal.component.js:117 +#: src/components/NanoContract/EditAddressModal.js:60 +#: src/components/NanoContract/SelectAddressModal.js:117 #: src/screens/SendConfirmScreen.js:161 msgid "Address" msgstr "" @@ -794,6 +796,11 @@ msgstr "" msgid "Unregister token" msgstr "" +#: src/components/WalletConnect/NanoContract/NewNanoContractTransactionModal.js:68 +#: src/screens/WalletConnect/NewNanoContractTransactionScreen.js:24 +msgid "New Nano Contract Transaction" +msgstr "" + #: src/screens/WalletConnect/WalletConnectList.js:33 msgid "There was an error connecting. Please try again later." msgstr "" @@ -929,53 +936,55 @@ msgstr "" msgid "Nano Contract Details" msgstr "" -#: src/screens/NanoContract/NanoContractRegisterScreen.js:67 +#: src/screens/NanoContract/NanoContractRegisterScreen.js:58 msgid "Nano Contract ID is required." msgstr "" -#: src/screens/NanoContract/NanoContractRegisterScreen.js:157 +#: src/screens/NanoContract/NanoContractRegisterScreen.js:151 msgid "See contract" msgstr "" -#: src/screens/NanoContract/NanoContractRegisterScreen.js:175 +#: src/screens/NanoContract/NanoContractRegisterScreen.js:169 msgid "Load First Addresses Error" msgstr "" -#: src/components/NanoContract/NanoContractDetails.component.js:158 -#: src/components/NanoContract/SelectAddressModal.component.js:105 -#: src/screens/NanoContract/NanoContractRegisterScreen.js:183 +#: src/components/NanoContract/NanoContractDetails.js:158 +#: src/components/NanoContract/SelectAddressModal.js:105 +#: src/components/WalletConnect/NanoContract/NewNanoContractTransactionRequest.js:202 +#: src/screens/NanoContract/NanoContractRegisterScreen.js:177 msgid "Loading" msgstr "" -#: src/screens/NanoContract/NanoContractRegisterScreen.js:184 +#: src/screens/NanoContract/NanoContractRegisterScreen.js:178 msgid "Loading first wallet address." msgstr "" -#: src/components/NanoContract/NanoContractDetailsHeader.component.js:142 -#: src/components/NanoContract/NanoContractTransactionHeader.component.js:88 +#: src/components/NanoContract/NanoContractDetailsHeader.js:142 +#: src/components/NanoContract/NanoContractTransactionHeader.js:88 #: src/components/NanoContract/NanoContractsListItem.js:57 #: src/components/TxDetailsModal.js:106 -#: src/screens/NanoContract/NanoContractRegisterScreen.js:193 +#: src/components/WalletConnect/NanoContract/NanoContractExecInfo.js:83 +#: src/screens/NanoContract/NanoContractRegisterScreen.js:187 msgid "Nano Contract ID" msgstr "" -#: src/screens/NanoContract/NanoContractRegisterScreen.js:201 +#: src/screens/NanoContract/NanoContractRegisterScreen.js:195 msgid "Wallet Address" msgstr "" -#: src/screens/NanoContract/NanoContractRegisterScreen.js:211 +#: src/screens/NanoContract/NanoContractRegisterScreen.js:205 msgid "If you want to change the wallet address, you will be able to do" msgstr "" -#: src/screens/NanoContract/NanoContractRegisterScreen.js:213 +#: src/screens/NanoContract/NanoContractRegisterScreen.js:207 msgid "after the contract is registered." msgstr "" -#: src/screens/NanoContract/NanoContractRegisterScreen.js:232 +#: src/screens/NanoContract/NanoContractRegisterScreen.js:226 msgid "Register Nano Contract" msgstr "" -#: src/screens/NanoContract/NanoContractRegisterScreen.js:250 +#: src/screens/NanoContract/NanoContractRegisterScreen.js:244 msgid "Nano Contract Registration" msgstr "" @@ -987,31 +996,39 @@ msgstr "" msgid "Contract successfully registered." msgstr "" -#: src/sagas/nanoContract.js:43 +#: src/sagas/nanoContract.js:45 msgid "Nano Contract already registered." msgstr "" -#: src/sagas/nanoContract.js:44 +#: src/sagas/nanoContract.js:46 msgid "Wallet is not ready yet to register a Nano Contract." msgstr "" -#: src/sagas/nanoContract.js:45 +#: src/sagas/nanoContract.js:47 msgid "The informed address does not belong to the wallet." msgstr "" -#: src/sagas/nanoContract.js:46 +#: src/sagas/nanoContract.js:48 msgid "Nano Contract not found." msgstr "" -#: src/sagas/nanoContract.js:47 +#: src/sagas/nanoContract.js:49 msgid "Error while trying to get Nano Contract state." msgstr "" -#: src/sagas/nanoContract.js:48 +#: src/sagas/nanoContract.js:50 +msgid "Blueprint not found." +msgstr "" + +#: src/sagas/nanoContract.js:51 +msgid "Couldn't get Blueprint info." +msgstr "" + +#: src/sagas/nanoContract.js:52 msgid "Nano Contract not registered." msgstr "" -#: src/sagas/nanoContract.js:49 +#: src/sagas/nanoContract.js:53 msgid "Error while trying to download Nano Contract transactions history." msgstr "" @@ -1057,20 +1074,28 @@ msgstr "" msgid "Open" msgstr "" -#: src/sagas/wallet.js:744 +#: src/sagas/tokens.js:40 +msgid "Wallet is not ready yet." +msgstr "" + +#: src/sagas/tokens.js:41 +msgid "Error loading the details of some tokens." +msgstr "" + +#: src/sagas/wallet.js:749 msgid "Wallet is not ready to load addresses." msgstr "" -#: src/sagas/wallet.js:760 +#: src/sagas/wallet.js:765 #. This will show the message in the feedback content at SelectAddressModal msgid "There was an error while loading wallet addresses. Try again." msgstr "" -#: src/sagas/wallet.js:770 +#: src/sagas/wallet.js:775 msgid "Wallet is not ready to load the first address." msgstr "" -#: src/sagas/wallet.js:786 +#: src/sagas/wallet.js:791 #. This will show the message in the feedback content msgid "There was an error while loading first wallet address. Try again." msgstr "" @@ -1228,13 +1253,14 @@ msgstr "" msgid "Description" msgstr "" -#: src/components/NanoContract/NanoContractTransactionHeader.component.js:47 +#: src/components/NanoContract/NanoContractTransactionHeader.js:47 #: src/components/TxDetailsModal.js:104 msgid "Transaction ID" msgstr "" -#: src/components/NanoContract/NanoContractTransactionHeader.component.js:92 +#: src/components/NanoContract/NanoContractTransactionHeader.js:92 #: src/components/TxDetailsModal.js:105 +#: src/components/WalletConnect/NanoContract/NanoContractExecInfo.js:116 msgid "Blueprint Method" msgstr "" @@ -1246,7 +1272,7 @@ msgstr "" msgid "Nano Contract Status" msgstr "" -#: src/components/NanoContract/NanoContractDetailsHeader.component.js:79 +#: src/components/NanoContract/NanoContractDetailsHeader.js:79 #: src/components/TxDetailsModal.js:120 msgid "Nano Contract" msgstr "" @@ -1280,82 +1306,214 @@ msgid "" "address derived from your root key on the m/44'/280'/0'/0/0 derivation path." msgstr "" +#: src/components/WalletConnect/NanoContract/DappContainer.js:41 +msgid "Review your transaction from this dApp" +msgstr "" + +#: src/components/WalletConnect/NanoContract/DappContainer.js:44 +msgid "Stay vigilant and protect your data from potential phishing attempts." +msgstr "" + +#: src/components/WalletConnect/NanoContract/DeclineModal.js:26 +msgid "Decline transaction" +msgstr "" + +#: src/components/WalletConnect/NanoContract/DeclineModal.js:29 +msgid "Are you sure you want to decline this transaction?" +msgstr "" + +#: src/components/WalletConnect/NanoContract/DeclineModal.js:33 +msgid "Yes, decline transaction" +msgstr "" + +#: src/components/NanoContract/UnregisterNanoContractModal.js:50 +#: src/components/WalletConnect/NanoContract/DeclineModal.js:39 +msgid "No, go back" +msgstr "" + +#: src/components/WalletConnect/NanoContract/NanoContractActions.js:36 +#, javascript-format +msgid "${ tokenSymbol } Deposit" +msgstr "" + +#: src/components/WalletConnect/NanoContract/NanoContractActions.js:37 +msgid "${ tokenSymbol } Withdrawal" +msgstr "" + +#: src/components/WalletConnect/NanoContract/NanoContractActions.js:101 +msgid "Action List" +msgstr "" + +#: src/components/WalletConnect/NanoContract/NanoContractActions.js:150 +msgid "To Address:" +msgstr "" + +#: src/components/WalletConnect/NanoContract/NanoContractExecInfo.js:88 +msgid "Blueprint ID" +msgstr "" + +#: src/components/NanoContract/NanoContractDetailsHeader.js:146 +#: src/components/NanoContract/NanoContractsListItem.js:59 +#: src/components/WalletConnect/NanoContract/NanoContractExecInfo.js:93 +msgid "Blueprint Name" +msgstr "" + +#: src/components/WalletConnect/NanoContract/NanoContractExecInfo.js:109 +#: src/components/WalletConnect/NanoContract/NanoContractExecInfo.js:140 +msgid "Loading..." +msgstr "" + +#: src/components/NanoContract/NanoContractTransactionHeader.js:106 +#: src/components/WalletConnect/NanoContract/NanoContractExecInfo.js:124 +msgid "Caller" +msgstr "" + +#: src/components/WalletConnect/NanoContract/NanoContractExecInfo.js:143 +msgid "Couldn't determine address, select one" +msgstr "" + +#: src/components/WalletConnect/NanoContract/NanoContractMethodArgs.js:48 +#, javascript-format +msgid "Position ${ idx }" +msgstr "" + +#: src/components/WalletConnect/NanoContract/NanoContractMethodArgs.js:93 +msgid "Arguments" +msgstr "" + +#: src/components/WalletConnect/NanoContract/NewNanoContractTransactionModal.js:72 +msgid "You have received a new Nano Contract Transaction. Please" +msgstr "" + +#: src/components/WalletConnect/NanoContract/NewNanoContractTransactionModal.js:74 +msgid "carefully review the details" +msgstr "" + +#: src/components/WalletConnect/NanoContract/NewNanoContractTransactionModal.js:76 +msgid "before deciding to accept or decline." +msgstr "" + +#: src/components/WalletConnect/NanoContract/NewNanoContractTransactionModal.js:80 +msgid "Review transaction details" +msgstr "" + +#: src/components/WalletConnect/NanoContract/NewNanoContractTransactionModal.js:98 +msgid "Caution: There are risks associated with signing dapp transaction requests." +msgstr "" + +#: src/components/WalletConnect/NanoContract/NewNanoContractTransactionModal.js:104 +msgid "Read More." +msgstr "" + +#: src/components/WalletConnect/NanoContract/NewNanoContractTransactionRequest.js:184 +msgid "Nano Contract Not Found" +msgstr "" + +#: src/components/WalletConnect/NanoContract/NewNanoContractTransactionRequest.js:185 +msgid "" +"The Nano Contract requested is not registered. First register the Nano " +"Contract to interact with it." +msgstr "" + +#: src/components/WalletConnect/NanoContract/NewNanoContractTransactionRequest.js:188 +#: src/components/WalletConnect/NanoContract/NewNanoContractTransactionRequest.js:235 +msgid "Decline Transaction" +msgstr "" + +#: src/components/WalletConnect/NanoContract/NewNanoContractTransactionRequest.js:203 +msgid "Loading transaction information." +msgstr "" + +#: src/components/WalletConnect/NanoContract/NewNanoContractTransactionRequest.js:231 +msgid "Accept Transaction" +msgstr "" + +#: src/components/WalletConnect/NanoContract/NewNanoContractTransactionRequest.js:245 +msgid "Sending transaction" +msgstr "" + +#: src/components/WalletConnect/NanoContract/NewNanoContractTransactionRequest.js:246 +msgid "Please wait." +msgstr "" + +#: src/components/WalletConnect/NanoContract/NewNanoContractTransactionRequest.js:272 +msgid "Transaction successfully sent." +msgstr "" + +#: src/components/WalletConnect/NanoContract/NewNanoContractTransactionRequest.js:274 +msgid "Ok, close" +msgstr "" + +#: src/components/WalletConnect/NanoContract/NewNanoContractTransactionRequest.js:280 +msgid "Error while sending transaction." +msgstr "" + #: src/components/NetworkSettings/NetworkStatusBar.js:14 msgid "Custom network" msgstr "" -#: src/components/NanoContract/EditAddressModal.component.js:41 +#: src/components/NanoContract/EditAddressModal.js:41 msgid "New Nano Contract Address" msgstr "" -#: src/components/NanoContract/EditAddressModal.component.js:49 +#: src/components/NanoContract/EditAddressModal.js:49 msgid "" "This address signs any transaction you create with Nano Contracts method. " "Switching to a new one means" msgstr "" -#: src/components/NanoContract/EditAddressModal.component.js:51 +#: src/components/NanoContract/EditAddressModal.js:51 msgid "all future transactions will use this address." msgstr "" -#: src/components/NanoContract/EditAddressModal.component.js:57 +#: src/components/NanoContract/EditAddressModal.js:57 msgid "Selected Information" msgstr "" -#: src/components/NanoContract/EditAddressModal.component.js:67 +#: src/components/NanoContract/EditAddressModal.js:67 msgid "Index" msgstr "" -#: src/components/NanoContract/EditAddressModal.component.js:74 +#: src/components/NanoContract/EditAddressModal.js:74 msgid "Confirm new address" msgstr "" -#: src/components/NanoContract/EditAddressModal.component.js:78 +#: src/components/NanoContract/EditAddressModal.js:78 msgid "Go back" msgstr "" -#: src/components/NanoContract/NanoContractDetails.component.js:159 +#: src/components/NanoContract/NanoContractDetails.js:159 msgid "Loading Nano Contract transactions." msgstr "" -#: src/components/NanoContract/NanoContractDetails.component.js:173 +#: src/components/NanoContract/NanoContractDetails.js:173 msgid "Nano Contract Transactions Error" msgstr "" -#: src/components/NanoContract/NanoContractDetailsHeader.component.js:146 -#: src/components/NanoContract/NanoContractsListItem.js:59 -msgid "Blueprint Name" -msgstr "" - -#: src/components/NanoContract/NanoContractDetailsHeader.component.js:150 +#: src/components/NanoContract/NanoContractDetailsHeader.js:150 msgid "Registered Address" msgstr "" -#: src/components/NanoContract/NanoContractDetailsHeader.component.js:153 +#: src/components/NanoContract/NanoContractDetailsHeader.js:153 msgid "See status details" msgstr "" -#: src/components/NanoContract/NanoContractDetailsHeader.component.js:154 +#: src/components/NanoContract/NanoContractDetailsHeader.js:154 msgid "Unregister contract" msgstr "" -#: src/components/NanoContract/NanoContractTransactionHeader.component.js:96 +#: src/components/NanoContract/NanoContractTransactionHeader.js:96 #. XXX: add when shrank component can be used. msgid "Date and Time" msgstr "" -#: src/components/NanoContract/NanoContractTransactionHeader.component.js:103 -#: src/components/NanoContract/NanoContractTransactionsListItem.component.js:62 +#: src/components/NanoContract/NanoContractTransactionHeader.js:103 +#: src/components/NanoContract/NanoContractTransactionsListItem.js:62 #. XXX: add when shrank component can be used. msgid "From this wallet" msgstr "" -#: src/components/NanoContract/NanoContractTransactionHeader.component.js:106 -#. XXX: add when shrank component can be used. -msgid "Caller" -msgstr "" - -#: src/components/NanoContract/NanoContractTransactionHeader.component.js:109 +#: src/components/NanoContract/NanoContractTransactionHeader.js:109 #. XXX: add when shrank component can be used. msgid "See transaction details" msgstr "" @@ -1374,42 +1532,38 @@ msgstr "" msgid "Register new" msgstr "" -#: src/components/NanoContract/SelectAddressModal.component.js:90 +#: src/components/NanoContract/SelectAddressModal.js:90 msgid "Choose New Wallet Address" msgstr "" -#: src/components/NanoContract/SelectAddressModal.component.js:97 +#: src/components/NanoContract/SelectAddressModal.js:97 msgid "Load Addresses Error" msgstr "" -#: src/components/NanoContract/SelectAddressModal.component.js:106 +#: src/components/NanoContract/SelectAddressModal.js:106 msgid "Loading wallet addresses." msgstr "" -#: src/components/NanoContract/SelectAddressModal.component.js:114 +#: src/components/NanoContract/SelectAddressModal.js:114 msgid "Current Information" msgstr "" -#: src/components/NanoContract/SelectAddressModal.component.js:115 +#: src/components/NanoContract/SelectAddressModal.js:115 msgid "To change, select other address on the list below." msgstr "" -#: src/components/NanoContract/SelectAddressModal.component.js:178 +#: src/components/NanoContract/SelectAddressModal.js:178 msgid "index" msgstr "" -#: src/components/NanoContract/UnregisterNanoContractModal.component.js:39 +#: src/components/NanoContract/UnregisterNanoContractModal.js:39 msgid "Unregister Nano Contract" msgstr "" -#: src/components/NanoContract/UnregisterNanoContractModal.component.js:41 +#: src/components/NanoContract/UnregisterNanoContractModal.js:41 msgid "Are you sure you want to unregister this Nano Contract?" msgstr "" -#: src/components/NanoContract/UnregisterNanoContractModal.component.js:44 +#: src/components/NanoContract/UnregisterNanoContractModal.js:44 msgid "Yes, unregister contract" msgstr "" - -#: src/components/NanoContract/UnregisterNanoContractModal.component.js:50 -msgid "No, go back" -msgstr "" diff --git a/src/App.js b/src/App.js index 16a6115ec..b7cb67260 100644 --- a/src/App.js +++ b/src/App.js @@ -89,6 +89,8 @@ import { NetworkStatusBar } from './components/NetworkSettings/NetworkStatusBar' import { NanoContractDetailsScreen } from './screens/NanoContract/NanoContractDetailsScreen'; import { NanoContractTransactionScreen } from './screens/NanoContract/NanoContractTransactionScreen'; import { NanoContractRegisterScreen } from './screens/NanoContract/NanoContractRegisterScreen'; +import { NewNanoContractTransactionScreen } from './screens/WalletConnect/NewNanoContractTransactionScreen'; +import { NewNanoContractTransactionModal } from './components/WalletConnect/NanoContract/NewNanoContractTransactionModal'; /** * This Stack Navigator is exhibited when there is no wallet initialized on the local storage. @@ -387,6 +389,7 @@ const AppStack = () => { + ( > + diff --git a/src/actions.js b/src/actions.js index 0fb3f0c9c..c72b84809 100644 --- a/src/actions.js +++ b/src/actions.js @@ -11,7 +11,7 @@ import { metadataApi, } from '@hathor/wallet-lib'; import { - METADATA_CONCURRENT_DOWNLOAD, + METADATA_CONCURRENT_DOWNLOAD, WALLETCONNECT_NEW_NANOCONTRACT_TX_STATUS, } from './constants'; import { mapToTxHistory } from './utils'; @@ -113,6 +113,9 @@ export const types = { SET_WALLET_CONNECT: 'SET_WALLET_CONNECT', SET_WALLET_CONNECT_MODAL: 'SET_WALLET_CONNECT_MODAL', SET_WALLET_CONNECT_SESSIONS: 'SET_WALLET_CONNECT_SESSIONS', + WALLET_CONNECT_ACCEPT: 'WALLET_CONNECT_ACCEPT', + WALLET_CONNECT_REJECT: 'WALLET_CONNECT_REJECT', + SET_NEW_NANO_CONTRACT_TRANSACTION: 'SET_NEW_NANO_CONTRACT_TRANSACTION', SET_UNLEASH_CLIENT: 'SET_UNLEASH_CLIENT', WC_URI_INPUTTED: 'WC_URI_INPUTTED', WC_CANCEL_SESSION: 'WC_CANCEL_SESSION', @@ -163,6 +166,12 @@ export const types = { NANOCONTRACT_UNREGISTER_SUCCESS: 'NANOCONTRACT_UNREGISTER_SUCCESS', /* It initiates a process to change the address on registered Nano Contract. */ NANOCONTRACT_ADDRESS_CHANGE_REQUEST: 'NANOCONTRACT_ADDRESS_CHANGE_REQUEST', + /* It triggers a process to fetch blueprint info. */ + NANOCONTRACT_BLUEPRINTINFO_REQUEST: 'NANOCONTRACT_BLUEPRINTINFO_REQUEST', + /* It signals a failure on fetch blueprint info. */ + NANOCONTRACT_BLUEPRINTINFO_FAILURE: 'NANOCONTRACT_BLUEPRINTINFO_FAILURE', + /* It signals a success on fetch blueprint info. */ + NANOCONTRACT_BLUEPRINTINFO_SUCCESS: 'NANOCONTRACT_BLUEPRINTINFO_SUCCESS', /* It triggers a process to fetch all wallet addresses. */ SELECTADDRESS_ADDRESSES_REQUEST: 'SELECTADDRESS_ADDRESSES_REQUEST', /* It signals the fetch has loaded all the addresses with success. */ @@ -175,6 +184,10 @@ export const types = { FIRSTADDRESS_SUCCESS: 'FIRSTADDRESS_SUCCESS', /* It signals a fetch failure due to an error. */ FIRSTADDRESS_FAILURE: 'FIRSTADDRESS_FAILURE', + /* It updates the redux state of new nano contract transaction status on wallet connect register. */ + WALLETCONNECT_NEW_NANOCONTRACT_STATUS: 'WALLETCONNECT_NEW_NANOCONTRACT_STATUS', + UNREGISTEREDTOKENS_REQUEST: 'UNREGISTEREDTOKENS_REQUEST', + UNREGISTEREDTOKENS_UPDATE: 'UNREGISTEREDTOKENS_UPDATE', }; export const featureToggleInitialized = () => ({ @@ -235,6 +248,30 @@ export const walletConnectCancelSession = (sessionKey) => ({ payload: sessionKey, }); +/** + * @param {Object} data Data that the user has accepted. + */ +export const walletConnectAccept = (data) => ({ + type: types.WALLET_CONNECT_ACCEPT, + payload: data, +}); + +export const walletConnectReject = () => ({ + type: types.WALLET_CONNECT_REJECT, +}); + +/** + * @param {Object} ncRequest + * @param {boolean} ncRequest.show + * @param {Object} ncRequest.data + * @param {Object} ncRequest.data.nc + * @param {Object} ncRequest.data.dapp + */ +export const setNewNanoContractTransaction = (ncRequest) => ({ + type: types.SET_NEW_NANO_CONTRACT_TRANSACTION, + payload: ncRequest +}); + /** * isShowingPinScreen {bool} * */ @@ -1205,3 +1242,96 @@ export const firstAddressFailure = (failurePayload) => ({ type: types.FIRSTADDRESS_FAILURE, payload: failurePayload, }); + +/** + * Signals update on new nano contract status to ready. + */ +export const setNewNanoContractStatusReady = () => ({ + type: types.WALLETCONNECT_NEW_NANOCONTRACT_STATUS, + payload: WALLETCONNECT_NEW_NANOCONTRACT_TX_STATUS.READY, +}); + +/** + * Signals update on new nano contract status to loading. + */ +export const setNewNanoContractStatusLoading = () => ({ + type: types.WALLETCONNECT_NEW_NANOCONTRACT_STATUS, + payload: WALLETCONNECT_NEW_NANOCONTRACT_TX_STATUS.LOADING, +}); + +/** + * Signals update on new nano contract status to failed. + */ +export const setNewNanoContractStatusFailure = () => ({ + type: types.WALLETCONNECT_NEW_NANOCONTRACT_STATUS, + payload: WALLETCONNECT_NEW_NANOCONTRACT_TX_STATUS.FAILED, +}); + +/** + * Signals update on new nano contract status to successful. + */ +export const setNewNanoContractStatusSuccess = () => ({ + type: types.WALLETCONNECT_NEW_NANOCONTRACT_STATUS, + payload: WALLETCONNECT_NEW_NANOCONTRACT_TX_STATUS.SUCCESSFUL, +}); + +/** + * Blueprint Info request in the context of a Nano Contract. + * @param {string} id Blueprint ID. + */ +export const nanoContractBlueprintInfoRequest = (id) => ({ + type: types.NANOCONTRACT_BLUEPRINTINFO_REQUEST, + payload: { id }, +}); + +/** + * Signals the bluprint info request has failed. + * @param {string} id Blueprint ID. + * @param {string} error Request failure reason. + */ +export const nanoContractBlueprintInfoFailure = (id, error) => ({ + type: types.NANOCONTRACT_BLUEPRINTINFO_FAILURE, + payload: { id, error }, +}); + +/** + * Signals the blueprint info was fetched with success. + * @param {string} id Blueprint ID. + * @param {{ + * id: string; + * name: string; + * public_methods: { + * [methodName: string]: { + * args: { + * type: string; + * name: string; + * }[]; + * }; + * }; + * }} blueprintInfo Raw data response from fullnode. + */ +export const nanoContractBlueprintInfoSuccess = (id, blueprintInfo) => ({ + type: types.NANOCONTRACT_BLUEPRINTINFO_SUCCESS, + payload: { id, data: { ...blueprintInfo } }, +}); + +/** + * Signals a request to load a collection of token data by a collection of token UID. + * @param {Object} payload + * @param {string[]} payload.uids A list of token UID. + */ +export const unregisteredTokensRequest = (payload) => ({ + type: types.UNREGISTEREDTOKENS_REQUEST, + payload, +}); + +/** + * Signals an update to unregistered tokens state. + * @param {Object} payload + * @param {Object} payload.tokens A map of token data by its UID. + * @param {string} payload.error The error message as feedback to user + */ +export const unregisteredTokensUpdate = (payload) => ({ + type: types.UNREGISTEREDTOKENS_UPDATE, + payload, +}); diff --git a/src/components/FeedbackContent.js b/src/components/FeedbackContent.js index b50e5db1b..87c47f200 100644 --- a/src/components/FeedbackContent.js +++ b/src/components/FeedbackContent.js @@ -25,6 +25,7 @@ import { COLORS } from '../styles/themes'; * @param {Object?} props.action A react component or react element containing a call to action, * if provided, it renders underneath the content * @param {boolean} props.offcard Renders a feedback without card style + * @param {boolean} props.offmargin Renders a feedback without margins * * @example * } * /> */ -export const FeedbackContent = ({ title, message, icon, action, offcard }) => ( - +export const FeedbackContent = ({ + title, + message, + icon, + action, + offcard, + offmargin, + offbackground +}) => ( + {icon @@ -55,8 +70,8 @@ const styles = StyleSheet.create({ alignSelf: 'stretch', marginTop: 16, marginBottom: 45, - backgroundColor: COLORS.backgroundColor, marginHorizontal: 16, + backgroundColor: COLORS.backgroundColor, }, card: { borderRadius: 16, @@ -65,6 +80,15 @@ const styles = StyleSheet.create({ shadowColor: COLORS.textColor, shadowOpacity: 0.08, }, + offMargin: { + marginTop: 0, + marginBottom: 0, + marginRight: 0, + marginLeft: 0, + }, + offBackground: { + backgroundColor: COLORS.lowContrastDetail, + }, wrapper: { overflow: 'scroll', }, diff --git a/src/components/FeedbackModal.js b/src/components/FeedbackModal.js index 4f7b371d4..4509bb187 100644 --- a/src/components/FeedbackModal.js +++ b/src/components/FeedbackModal.js @@ -10,6 +10,19 @@ import { Text, View } from 'react-native'; import PropTypes from 'prop-types'; import HathorModal from './HathorModal'; +/** + * It renders a modal with some feedback to user. + * + * @param {Object} props + * + * @example + * )} + * text={t`Error while sending transaction.`} + * onDismiss={handleFeedbackModalDismiss} + * action={()} + * /> + */ const FeedbackModal = (props) => ( ( + + {children} + +); diff --git a/src/components/HathorFlatList.js b/src/components/HathorFlatList.js index 043e2dcec..2d7cf5aac 100644 --- a/src/components/HathorFlatList.js +++ b/src/components/HathorFlatList.js @@ -5,17 +5,23 @@ * LICENSE file in the root directory of this source tree. */ +/* eslint no-unused-vars: ["warn", { "varsIgnorePattern": "Props" }] -- + * Properties like `FlatListProps` are not counted as used, + * however they are important for coding completion during development. + */ + import React from 'react'; import { - FlatList, StyleSheet, View, + FlatList, StyleSheet, View, FlatListProps } from 'react-native'; import { COLORS } from '../styles/themes'; /** - * param {FlatListProps} props + * @param {FlatListProps} props + * @param {Object} props.wrapperStyle A custom style object used to control the wrapper component. */ export const HathorFlatList = (props) => ( - + ( > diff --git a/src/components/TextValue.js b/src/components/TextValue.js index f377e069c..efcf00c71 100644 --- a/src/components/TextValue.js +++ b/src/components/TextValue.js @@ -10,23 +10,28 @@ import { StyleSheet, Text, } from 'react-native'; +import { commonStyles } from './WalletConnect/theme'; /** * @param {Object} props * @param {boolean} props.title It sets font weight to bold and a larger font size + * @param {boolean} props.label It sets font weight to bold and a bottom margin * @param {boolean} props.bold It sets font weight to bold * @param {boolean} props.oneline It sets numberOfLines to 1 * @param {boolean} props.shrink It sets flexShrink to 1 * @param {boolean} props.pb4 It sets padding bottom to 4 + * @param {string} props.color It sets text color */ -export const TextValue = ({ title, bold, oneline, shrink, pb4, children }) => ( +export const TextValue = ({ title, label, bold, oneline, shrink, pb4, color, children }) => ( {children} ); @@ -41,6 +46,10 @@ const styles = StyleSheet.create({ fontSize: 18, fontWeight: 'bold', }, + label: [ + commonStyles.bold, + commonStyles.mb4, + ], pb4: { paddingBottom: 4, }, diff --git a/src/components/WalletConnect/NanoContract/DappContainer.js b/src/components/WalletConnect/NanoContract/DappContainer.js new file mode 100644 index 000000000..7e46f6828 --- /dev/null +++ b/src/components/WalletConnect/NanoContract/DappContainer.js @@ -0,0 +1,84 @@ +/** + * Copyright (c) Hathor Labs and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +import React from 'react'; +import { + StyleSheet, + View, + Text, + Image +} from 'react-native'; +import { t } from 'ttag'; +import { commonStyles } from '../theme'; + +/** + * Renders DApp information. + * + * @param {Object} props + * @param {Object} props.dapp + */ +export const DappContainer = ({ dapp }) => ( + + + + + + + {dapp.proposer} + {'• '}{dapp.chain} + + + + {t`Review your transaction from this dApp`} + + + {t`Stay vigilant and protect your data from potential phishing attempts.`} + + +); + +const styles = StyleSheet.create({ + container: { + gap: 16, + paddingVertical: 16, + paddingHorizontal: 16, + }, + header: { + flexDirection: 'row', + gap: 16, + }, + avatar: { + flexShrink: 1, + alignSelf: 'flex-start', + maxWidth: 48, + maxHeight: 48, + }, + avatarIcon: { + width: 48, + height: 48, + backgroundColor: 'hsla(0, 0%, 85%, 1)', + borderRadius: 24, + }, + proposer: [ + commonStyles.text, + commonStyles.bold, + commonStyles.mb4, + ], + network: [ + commonStyles.text, + { color: 'hsla(263, 100%, 64%, 1)', } + ], + emphasis: [ + commonStyles.text, + commonStyles.bold + ] +}); diff --git a/src/components/WalletConnect/NanoContract/DeclineModal.js b/src/components/WalletConnect/NanoContract/DeclineModal.js new file mode 100644 index 000000000..f93959237 --- /dev/null +++ b/src/components/WalletConnect/NanoContract/DeclineModal.js @@ -0,0 +1,54 @@ +/** + * Copyright (c) Hathor Labs and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +import React from 'react'; +import { + StyleSheet, + Text, +} from 'react-native'; +import { t } from 'ttag'; +import { ModalBase } from '../../ModalBase'; + +/** + * It renders a confirmation modal to decline the tranaction creation. + * + * @param {Object} props + * @param {boolean} props.show Flag that determines the if the modal should appear or not. + * @param {() => void} props.onDecline Callback fn for decline action. + * @param {() => void} props.onDismiss Callback fn for dismiss action. + */ +export const DeclineModal = ({ show, onDecline, onDismiss }) => ( + + {t`Decline transaction`} + + + {t`Are you sure you want to decline this transaction?`} + + + + + +); + +const styles = StyleSheet.create({ + declineModalBody: { + paddingBottom: 24, + }, + text: { + fontSize: 16, + lineHeight: 20, + textAlign: 'center', + }, +}); diff --git a/src/components/WalletConnect/NanoContract/NanoContractActions.js b/src/components/WalletConnect/NanoContract/NanoContractActions.js new file mode 100644 index 000000000..9b38d0d70 --- /dev/null +++ b/src/components/WalletConnect/NanoContract/NanoContractActions.js @@ -0,0 +1,203 @@ +/** + * Copyright (c) Hathor Labs and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +import React, { useCallback } from 'react'; +import { + StyleSheet, + View, + Text, +} from 'react-native'; +import { t } from 'ttag'; +import { useSelector } from 'react-redux'; +import { HathorFlatList } from '../../HathorFlatList'; +import { commonStyles } from '../theme'; +import { getShortHash, isTokenNFT, renderValue } from '../../../utils'; +import { ReceivedIcon } from '../../Icons/Received.icon'; +import { SentIcon } from '../../Icons/Sent.icon'; +import { AlertUI, COLORS } from '../../../styles/themes'; +import { DEFAULT_TOKEN } from '../../../constants'; +import { WarnTextValue } from '../../WarnTextValue'; +import { CircleError } from '../../Icons/CircleError.icon'; + +/** + * It returns the title template for each action type, + * which is either 'deposit' or 'withdrawal'. + * + * @param {string} tokenSymbol The token symbol fetched from metadata, + * or a shortened token hash. + * + * @returns {string} A title template by action type. + */ +const actionTitleMap = (tokenSymbol) => ({ + deposit: t`${tokenSymbol} Deposit`, + withdrawal: t`${tokenSymbol} Withdrawal`, +}); + +/** + * Get action title depending on the action type. + * @param {Object} tokens A map of token metadata by token uid + * @param {Object} action An action object + * + * @returns {string} A formatted title to be used in the action card + * + * @example + * getActionTitle({ '123': { ..., symbol: 'STR' }}, { ..., token: '123', type: 'deposit' }) + * >>> 'STR Deposit' + * + * @example + * getActionTitle({}, { ..., token: '1234...5678', type: 'deposit' }) + * >>> '1234...5678 Deposit' + */ +const getActionTitle = (tokens, action) => { + const tokenMetadata = tokens[action.token]; + if (tokenMetadata) { + return actionTitleMap(tokenMetadata.symbol)[action.type]; + } + + if (action.token === DEFAULT_TOKEN.uid) { + return actionTitleMap(DEFAULT_TOKEN.symbol)[action.type] + } + + return actionTitleMap(getShortHash(action.token))[action.type]; +}; + +/** + * It renders a list of actions with a proper title for each one. + * It renders nothing if there aren't actions to render. + * + * @param {Object} props + * @param {Object[]} props.ncActions A list of Nano Contract actions. + * @param {Object} props.tokens A map of token metadata by token uid. + * @param {string} props.error A feedback error for tokens not loaded. + */ +export const NanoContractActions = ({ ncActions, tokens, error }) => { + if (!ncActions || ncActions.length < 1) { + return null; + } + + const tokenMetadata = useSelector((state) => state.tokenMetadata); + // A callback to check if the action token is an NFT. + const isNft = useCallback( + (token) => isTokenNFT(token, tokenMetadata), + [tokenMetadata] + ); + // A callback to retrieve the action title by its token symbol of hash. + const getTitle = useCallback( + (action) => getActionTitle(tokens, action), + [tokens] + ); + + const styles = StyleSheet.create({ + wrapper: { marginTop: 0, marginBottom: 0, marginHorizontal: 0 }, + }); + + return ( + + + {t`Action List`} + + ( + + )} + // If has error, shows the feedback error message in the list header. + ListHeaderComponent={error && ( + + + + {error} + + + )} + /> + + ); +}; + +/** + * @param {Object} props + * @param {{ + * type: 'deposit'|'withdrawal'; + * token: string; + * amount: number; + * address: string; + * }} props.action A transaction's action object + * @param {boolean} props.isNft A flag to inform if the token is an NFT or not + * @param {string} props.title The card title for the action + */ +const ActionItem = ({ action, title, isNft }) => { + const styles = StyleSheet.create({ + action: [commonStyles.text, commonStyles.bold], + valueLabel: [commonStyles.text, commonStyles.field, commonStyles.bold, commonStyles.mb4], + value: [commonStyles.text, commonStyles.field], + }); + + return ( + + + + {title} + {action.address + && ( + + {t`To Address:`} + {action.address} + + )} + + + + ) +} + +/** + * It renders an icon by action type, either 'deposit' or 'withdrawal'. + * + * @param {Object} props + * @param {'deposit'|'withdrawal'} props.type Action type. + */ +const Icon = ({ type }) => { + const iconMap = { + deposit: SentIcon({ type: 'default' }), + withdrawal: ReceivedIcon({ type: 'default' }), + }; + + return (iconMap[type]); +}; + +/** + * It renders an amount with the right format. + * + * @param {Object} props + * @param {number} props.amount + * @param {boolean} props.isNft + */ +const Amount = ({ amount, isNft }) => { + const amountToRender = renderValue(amount, isNft); + + const styles = StyleSheet.create({ + wrapper: { + marginLeft: 'auto', + }, + amount: { + fontSize: 16, + lineHeight: 20, + color: COLORS.black, + }, + }); + + return ( + + + {amountToRender} + + + ) +}; diff --git a/src/components/WalletConnect/NanoContract/NanoContractExecInfo.js b/src/components/WalletConnect/NanoContract/NanoContractExecInfo.js new file mode 100644 index 000000000..c06577d27 --- /dev/null +++ b/src/components/WalletConnect/NanoContract/NanoContractExecInfo.js @@ -0,0 +1,170 @@ +/** + * Copyright (c) Hathor Labs and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +import React, { useEffect, useMemo } from 'react'; +import { + StyleSheet, + View, + TouchableOpacity, +} from 'react-native'; +import { useDispatch, useSelector } from 'react-redux'; +import { t } from 'ttag'; +import { firstAddressRequest } from '../../../actions'; +import { NANOCONTRACT_BLUEPRINTINFO_STATUS as STATUS } from '../../../constants'; +import { COLORS } from '../../../styles/themes'; +import { FrozenTextValue } from '../../FrozenTextValue'; +import { CircleError } from '../../Icons/CircleError.icon'; +import { NanoContractIcon } from '../../Icons/NanoContract.icon'; +import { PenIcon } from '../../Icons/Pen.icon'; +import Spinner from '../../Spinner'; +import { TextValue } from '../../TextValue'; +import { WarnTextValue } from '../../WarnTextValue'; +import { commonStyles } from '../theme'; + +/** + * It renders a card with basic information to execute the Nano Contract creation. + * + * @param {Object} props + * @param {Object} props.nc Nano Contract info. + * @param {() => void} props.onSelectAddress Callback fn for tap on caller address component. + */ +export const NanoContractExecInfo = ({ nc, onSelectAddress }) => { + const dispatch = useDispatch(); + const registeredNc = useSelector((state) => state.nanoContract.registered[nc.ncId]); + const blueprintInfo = useSelector((state) => state.nanoContract.blueprint[nc.blueprintId]); + const firstAddress = useSelector((state) => state.firstAddress); + + const isInitialize = nc.method === 'initialize'; + const notInitialize = !isInitialize; + + const blueprintName = useMemo(() => { + if (notInitialize && registeredNc) { + return registeredNc.blueprintName; + } + + if (blueprintInfo?.status === STATUS.SUCCESSFUL) { + return blueprintInfo.data.name; + } + return null; + }, [blueprintInfo]); + + useEffect(() => { + if (isInitialize) { + // Load firstAddress if not loaded + if (!firstAddress.address) { + dispatch(firstAddressRequest()); + } + } + }, []); + + const isBlueprintInfoLoading = !registeredNc + && blueprintInfo?.status === STATUS.LOADING; + const hasBlueprintInfoFailed = !registeredNc + && blueprintInfo?.status === STATUS.FAILED; + + const hasCaller = nc.caller != null; + const hasFirstAddressFailed = !hasCaller && isInitialize && firstAddress.error; + const isFirstAddressLoading = !hasCaller + && isInitialize + && !hasFirstAddressFailed; + + return ( + + + + + + {notInitialize && ( + + {t`Nano Contract ID`} + {nc.ncId} + + )} + + {t`Blueprint ID`} + {nc.blueprintId} + + + + {t`Blueprint Name`} + {isBlueprintInfoLoading && ( + + {' '} + + )} + {hasBlueprintInfoFailed && ( + + {' '} + + )} + + {blueprintName && ( + {blueprintName} + )} + {isBlueprintInfoLoading && ( + {t`Loading...`} + )} + {hasBlueprintInfoFailed && ( + {blueprintInfo.error} + )} + + + {t`Blueprint Method`} + {nc.method} + + + + + + + {t`Caller`} + {isFirstAddressLoading && ( + + {' '} + + )} + {(hasFirstAddressFailed) && ( + + {' '} + + )} + + {hasCaller && ( + {nc.caller || firstAddress.address} + )} + {isFirstAddressLoading && ( + {t`Loading...`} + )} + {hasFirstAddressFailed && ( + {t`Couldn't determine address, select one`} + )} + + + + + + + + + ) +}; + +const styles = StyleSheet.create({ + contentEditable: { + flexDirection: 'row', + justifyContent: 'space-between', + alignItems: 'center', + }, + contentEditableValue: { + flexShrink: 1, + paddingRight: 8, + }, + contentEditableIcon: { + width: 24, + paddingRight: 2, + }, +}); diff --git a/src/components/WalletConnect/NanoContract/NanoContractMethodArgs.js b/src/components/WalletConnect/NanoContract/NanoContractMethodArgs.js new file mode 100644 index 000000000..1c7b945d8 --- /dev/null +++ b/src/components/WalletConnect/NanoContract/NanoContractMethodArgs.js @@ -0,0 +1,154 @@ +/** + * Copyright (c) Hathor Labs and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +import React, { useMemo } from 'react'; +import { + StyleSheet, + View, + Text, +} from 'react-native'; +import { useDispatch, useSelector } from 'react-redux'; +import { t } from 'ttag'; +import { get } from 'lodash'; +import { COLORS } from '../../../styles/themes'; +import { commonStyles } from '../theme'; +import { onExceptionCaptured } from '../../../actions'; +import { NANOCONTRACT_BLUEPRINTINFO_STATUS as STATUS } from '../../../constants'; +import { FeedbackContent } from '../../FeedbackContent'; +import Spinner from '../../Spinner'; + +/** + * Get method info from registered blueprint data. + * + * @param {{ + * data: Object; + * }} blueprint The blueprint info object + * @param {string} method The method name to get info from blueprint public methods + * + * @returns {Object} + */ +function getMethodInfoFromBlueprint(blueprint, method) { + return get(blueprint.data, `public_methods.${method}`, null); +} + +/** + * Get the fallback entries for the method arguments. + * + * @param {string[]} args A list of argument value + * + * @returns {[argName: string, value: string][]} + * + * @example + * getFallbackArgEntries([...argValues]) + * >>> [['Position 0', 'abc'], ['Position 1', '00'], ['Position 2', 123]] + */ +function getFallbackArgEntries(args) { + return args.map((arg, idx) => [t`Position ${idx}`, arg]); +} + +/** + * It renders a list of method arguments for when the Nano Contract executes. + * + * @param {Object} props + * @param {string} props.blueprintId ID of blueprint. + * @param {string} props.method Method's name. + * @param {string[]} props.ncArgs A list of method's argument. + */ +export const NanoContractMethodArgs = ({ blueprintId, method, ncArgs }) => { + if (!ncArgs.length) { + return null; + } + const dispatch = useDispatch(); + + const blueprintInfo = useSelector((state) => state.nanoContract.blueprint[blueprintId]); + // It results a in a list of entries like: + // >>> [['oracle_script', 'abc'], ['token_uid', '00'], ['date_last_bet', 123]] + // or a fallback like: + // >>> [['Position 0', 'abc'], ['Position 1', '00'], ['Position 2', 123]] + const argEntries = useMemo(() => { + if (blueprintInfo == null || blueprintInfo.status === STATUS.LOADING) { + return []; + } + + const methodInfo = getMethodInfoFromBlueprint(blueprintInfo, method); + if (methodInfo) { + return ncArgs.map((arg, idx) => [methodInfo.args[idx].name, arg]); + } + + // Send this condition to sentry because it should never happen. + // Check any change in the lib or in the fullnode that could cause an impact here. + const errMsg = 'Error while getting the argument names of public_methods on blueprint'; + dispatch(onExceptionCaptured(new Error(errMsg), false)); + + // Still render a fallback + return getFallbackArgEntries(ncArgs); + }, [method, ncArgs, blueprintInfo]); + + // Empty while downloading the bleuprint details + const isEmpty = argEntries.length === 0; + const notEmpty = !isEmpty; + + return ( + + + {t`Arguments`} + + {isEmpty /* This is a redundancy to the general loading */ + && ( + } + offmargin + /> + )} + {notEmpty + && ( + + + {argEntries.map(([argName, argValue]) => ( + + + {argName} + + + {argValue} + + + ))} + + + )} + + ) +}; + +const styles = StyleSheet.create({ + argPosition: { + flexShrink: 10, + width: '30%', + paddingRight: 8, + }, + argPositionText: [ + commonStyles.text, + commonStyles.bold + ], + argValue: { + maxWidth: '70%', + backgroundColor: 'hsla(0, 0%, 96%, 1)', + paddingVertical: 2, + paddingHorizontal: 8, + borderRadius: 4, + }, + argValueText: { + fontSize: 12, + lineHeight: 16, + color: COLORS.black, + }, +}); diff --git a/src/components/WalletConnect/NanoContract/NewNanoContractTransactionModal.js b/src/components/WalletConnect/NanoContract/NewNanoContractTransactionModal.js new file mode 100644 index 000000000..204026dc7 --- /dev/null +++ b/src/components/WalletConnect/NanoContract/NewNanoContractTransactionModal.js @@ -0,0 +1,163 @@ +/** + * Copyright (c) Hathor Labs and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +import React from 'react'; +import { + StyleSheet, + View, + Text, + Linking, +} from 'react-native'; +import { t } from 'ttag'; +import { useNavigation } from '@react-navigation/native'; +import { useDispatch, useSelector } from 'react-redux'; +import { COLORS } from '../../../styles/themes'; +import { CircleInfoIcon } from '../../Icons/CircleInfo.icon'; +import { ModalBase } from '../../ModalBase'; +import SimpleButton from '../../SimpleButton'; +import { setNewNanoContractTransaction, walletConnectReject } from '../../../actions'; +import { WALLET_STATUS } from '../../../sagas/wallet'; +import { NANO_CONTRACT_INFO_URL } from '../../../constants'; + +export const NewNanoContractTransactionModal = () => { + const navigation = useNavigation(); + const dispatch = useDispatch(); + const readMoreUrl = NANO_CONTRACT_INFO_URL; + + const { + showModal, + ncTxRequest, + } = useSelector((state) => { + const { + walletStartState, + walletConnect: { + newNanoContractTransaction: { + showModal: showNcTxModal, + data, + } + }, + } = state; + const isWalletReady = walletStartState === WALLET_STATUS.READY; + + return { + showModal: showNcTxModal && isWalletReady, + ncTxRequest: data, + }; + }); + + const onDismiss = () => { + dispatch(walletConnectReject()); + dispatch(setNewNanoContractTransaction({ show: false, data: null })); + }; + + const navigatesToNewNanoContractScreen = () => { + dispatch(setNewNanoContractTransaction({ show: false, data: null })); + navigation.navigate('NewNanoContractTransactionScreen', { ncTxRequest }); + }; + + const onReadMore = () => { + Linking.openURL(readMoreUrl) + }; + + return ( + + {t`New Nano Contract Transaction`} + + + + {t`You have received a new Nano Contract Transaction. Please`} + + {' '}{t`carefully review the details`}{' '} + + {t`before deciding to accept or decline.`} + + + + + + ); +}; + +const WarnDisclaimer = ({ onReadMore }) => ( + + + + + + + {t`Caution: There are risks associated with signing dapp transaction requests.`} + + + + + + +); + +const styles = StyleSheet.create({ + body: { + paddingBottom: 24, + }, + text: { + fontSize: 14, + lineHeight: 20, + }, + bold: { + fontWeight: 'bold', + }, + warnContainer: { + flexShrink: 1, + flexDirection: 'row', + alignItems: 'center', + marginBottom: 24, + borderRadius: 8, + paddingTop: 12, + /* It should have been 12 but it is adjusted to compensate the negative + * margin on learnMoreWrapper and the difference between the font size + * and the line height, which amounts to 8 points of compensation. + */ + paddingBottom: 20, + paddingHorizontal: 16, + backgroundColor: COLORS.cardWarning100, + }, + warnContent: { + paddingLeft: 8, + }, + warnMessage: { + fontSize: 12, + lineHeight: 16, + }, + learnMoreWrapper: { + display: 'inline-block', + /* We are using negative margin here to correct the text position + * and create an optic effect of alignment. */ + marginBottom: -4, + paddingLeft: 2, + marginRight: 'auto', + }, + learnMoreContainer: { + justifyContent: 'flex-start', + borderBottomWidth: 1, + }, + learnMoreText: { + fontSize: 12, + lineHeight: 16, + fontWeight: 'bold', + color: 'hsla(0, 0%, 25%, 1)', + }, +}); diff --git a/src/components/WalletConnect/NanoContract/NewNanoContractTransactionRequest.js b/src/components/WalletConnect/NanoContract/NewNanoContractTransactionRequest.js new file mode 100644 index 000000000..238cceded --- /dev/null +++ b/src/components/WalletConnect/NanoContract/NewNanoContractTransactionRequest.js @@ -0,0 +1,332 @@ +/** + * Copyright (c) Hathor Labs and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +import React, { + useEffect, + useMemo, + useState +} from 'react'; +import { + StyleSheet, + View, + ScrollView, + TouchableWithoutFeedback, + Image +} from 'react-native'; +import { useDispatch, useSelector } from 'react-redux'; +import { useNavigation } from '@react-navigation/native'; +import { t } from 'ttag'; +import { + nanoContractBlueprintInfoRequest, + setNewNanoContractStatusReady, + walletConnectAccept, + walletConnectReject, + unregisteredTokensRequest +} from '../../../actions'; +import { COLORS } from '../../../styles/themes'; +import NewHathorButton from '../../NewHathorButton'; +import { SelectAddressModal } from '../../NanoContract/SelectAddressModal'; +import { FeedbackContent } from '../../FeedbackContent'; +import { DEFAULT_TOKEN, NANOCONTRACT_BLUEPRINTINFO_STATUS, WALLETCONNECT_NEW_NANOCONTRACT_TX_STATUS } from '../../../constants'; +import Spinner from '../../Spinner'; +import FeedbackModal from '../../FeedbackModal'; +import errorIcon from '../../../assets/images/icErrorBig.png'; +import checkIcon from '../../../assets/images/icCheckBig.png'; +import { DappContainer } from './DappContainer'; +import { NanoContractExecInfo } from './NanoContractExecInfo'; +import { NanoContractActions } from './NanoContractActions'; +import { NanoContractMethodArgs } from './NanoContractMethodArgs'; +import { DeclineModal } from './DeclineModal'; + +/** + * @param {Object} props + * @param {Object} props.ncTxRequest + * @param {Object} props.ncTxRequest.nc + * @param {string} props.ncTxRequest.nc.ncId + * @param {string} props.ncTxRequest.nc.blueprintId + * @param {Object[]} props.ncTxRequest.nc.actions + * @param {string} props.ncTxRequest.nc.method + * @param {string[]} props.ncTxRequest.nc.args + * @param {Object} props.ncTxRequest.dapp + * @param {string} props.ncTxRequest.dapp.icon + * @param {string} props.ncTxRequest.dapp.proposer + * @param {string} props.ncTxRequest.dapp.url + * @param {string} props.ncTxRequest.dapp.description + */ +export const NewNanoContractTransactionRequest = ({ ncTxRequest }) => { + const { nc, dapp } = ncTxRequest; + const dispatch = useDispatch(); + const navigation = useNavigation(); + const newTxStatus = useSelector((state) => state.walletConnect.newNanoContractTransaction.status); + const firstAddress = useSelector((state) => state.firstAddress); + // Nullable if the nano contract method is 'initialize' + const registeredNc = useSelector((state) => state.nanoContract.registered[nc.ncId]); + const knownTokens = useSelector((state) => ({ ...state.tokens, ...state.unregisteredTokens })); + const blueprintInfo = useSelector((state) => state.nanoContract.blueprint[nc.blueprintId]); + + const [showSelectAddressModal, setShowSelectAddressModal] = useState(false); + const [showDeclineModal, setShowDeclineModal] = useState(false); + /** + * If nano-contract's method is 'initialize' then the expression + * should be resolved to firstAddress value by default. + * + * In case of failure to load the first address the user will see + * a feedback message instruction it to select an address for the + * transaction. + */ + const [ncAddress, setNcAddress] = useState(registeredNc?.address || firstAddress.address); + const ncToAccept = useMemo(() => ({ + ...nc, + caller: ncAddress, + }), [ncAddress]) + + const toggleSelectAddressModal = () => setShowSelectAddressModal(!showSelectAddressModal); + const handleAddressSelection = (newAddress) => { + setNcAddress(newAddress); + toggleSelectAddressModal(); + }; + + // Accepts the Nano Contract data preseted. + const onAcceptTransaction = () => { + // Update the caller with the address selected by the user. + const acceptedNc = { ...nc, caller: ncAddress }; + // Signal the user has accepted the current request and pass the accepted data. + dispatch(walletConnectAccept(acceptedNc)); + }; + + const onDeclineTransaction = () => { + setShowDeclineModal(true); + }; + const onDeclineConfirmation = () => { + setShowDeclineModal(false); + dispatch(walletConnectReject()); + navigation.goBack(); + }; + const onDismissDeclineModal = () => { + setShowDeclineModal(false); + }; + + // Control which content to show, if the nano contract is not registered + // a feedback content should tell user the nano contract must be registered first + // and only let user decline the transaction to get out the page, otherwise interaction + // content is showed. + const notInitialize = ncToAccept.method !== 'initialize'; + const notRegistered = notInitialize && registeredNc == null; + // It results in true for registered nc and initialize request + const showRequest = !notRegistered; + + // This effect should run at most twice: + // 1. when in the construct phase + // 2. after firstAddress is set on store after a request to load it + // The mentioned load request at (2) can happen for 'initialize' transaction, + // it is requested from a child component, NanoContractExecInfo. + useEffect(() => { + if (ncToAccept.method === 'initialize' && firstAddress.address) { + setNcAddress(firstAddress.address); + } + }, [firstAddress]); + + // This effect runs only once in the construct phase + useEffect(() => { + // Do nothing if nano contract is not registered and don't call initialize method. + if (notRegistered) return; + + // Request blueprint info if not present to feed the components: + // - NanoContractExecInfo, and + // - NanoContractMethodArgs + if (!blueprintInfo) { + dispatch(nanoContractBlueprintInfoRequest(nc.blueprintId)); + } + + // Request token data for each unknown token present in actions + const unknownTokensUid = []; + const actionTokensUid = nc.actions?.map((each) => each.token) || []; + actionTokensUid.forEach((uid) => { + if (uid !== DEFAULT_TOKEN.uid && !(uid in knownTokens)) { + unknownTokensUid.push(uid); + } + }); + dispatch(unregisteredTokensRequest({ uids: unknownTokensUid })); + }, []); + + const onFeedbackModalDismiss = () => { + dispatch(setNewNanoContractStatusReady()); + navigation.goBack(); + }; + + const onNavigateToDashboard = () => { + dispatch(setNewNanoContractStatusReady()); + navigation.navigate('Dashboard'); + }; + + const onTryAgain = () => { + dispatch(setNewNanoContractStatusReady()); + }; + + // Loading while downloading: + // 1. each token details + // 2. the blueprint details + const isTxInfoLoading = () => ( + knownTokens.isLoading + || blueprintInfo == null + || blueprintInfo.status === NANOCONTRACT_BLUEPRINTINFO_STATUS.LOADING + ); + const isTxInfoLoaded = () => ( + !isTxInfoLoading() && newTxStatus !== WALLETCONNECT_NEW_NANOCONTRACT_TX_STATUS.LOADING + ); + const isTxProcessing = () => ( + !isTxInfoLoading() && newTxStatus === WALLETCONNECT_NEW_NANOCONTRACT_TX_STATUS.LOADING + ); + const isTxSuccessful = () => newTxStatus === WALLETCONNECT_NEW_NANOCONTRACT_TX_STATUS.SUCCESSFUL; + const isTxFailed = () => newTxStatus === WALLETCONNECT_NEW_NANOCONTRACT_TX_STATUS.FAILED; + + return ( + <> + {notRegistered && ( + + )} + /> + )} + {showRequest && ( + + + + {isTxInfoLoading() && ( + } + offmargin + offcard + offbackground + /> + )} + {isTxInfoLoaded() && ( + + + + + + + {/* User actions */} + + + + + + )} + {isTxProcessing() && ( + } + offmargin + offcard + offbackground + /> + )} + + + + )} + + + + {isTxSuccessful() && ( + )} + text={t`Transaction successfully sent.`} + onDismiss={onFeedbackModalDismiss} + action={()} + /> + )} + {isTxFailed() && ( + )} + text={t`Error while sending transaction.`} + onDismiss={onFeedbackModalDismiss} + action={()} + /> + )} + + ); +}; + +const styles = StyleSheet.create({ + wide: { + width: '100%' + }, + wrapper: { + flex: 1, + paddingHorizontal: 16, + backgroundColor: COLORS.lowContrastDetail, // Defines an outer area on the main list content + }, + content: { + flex: 1, + rowGap: 24, + width: '100%', + paddingVertical: 16, + }, + balanceReceived: { + color: 'hsla(180, 85%, 34%, 1)', + fontWeight: 'bold', + }, + actionContainer: { + flexDirection: 'column', + gap: 8, + paddingBottom: 48, + }, + declineModalBody: { + paddingBottom: 24, + }, + text: { + fontSize: 16, + lineHeight: 20, + textAlign: 'center', + }, + feedbackModalIcon: { + height: 105, + width: 105 + }, +}); diff --git a/src/components/WalletConnect/theme.js b/src/components/WalletConnect/theme.js new file mode 100644 index 000000000..bab0f09ee --- /dev/null +++ b/src/components/WalletConnect/theme.js @@ -0,0 +1,74 @@ +import { StyleSheet } from 'react-native'; +import { COLORS } from '../../styles/themes'; + +export const commonStyles = StyleSheet.create({ + // Card + card: { + paddingVertical: 16, + paddingHorizontal: 16, + backgroundColor: COLORS.backgroundColor, + borderTopLeftRadius: 16, + borderTopRightRadius: 16, + borderBottomLeftRadius: 16, + borderBottomRightRadius: 16, + shadowOffset: { height: 2, width: 0 }, + shadowRadius: 4, + shadowColor: COLORS.textColor, + shadowOpacity: 0.08, + }, + cardSplit: { + flexDirection: 'row', + gap: 16, + }, + cardSplitIcon: { + flexShrink: 1, + alignSelf: 'flex-start', + }, + cardSplitContent: { + maxWidth: '80%', + flexDirection: 'column', + gap: 8, + }, + cardSeparator: { + width: '100%', + height: 1, + backgroundColor: COLORS.borderColor + }, + cardStack: { + flexDirection: 'column', + }, + cardStackItem: { + flexDirection: 'row', + paddingVertical: 16, + }, + listItem: { + paddingVertical: 24, + paddingHorizontal: 16, + }, + feedbackItem: { + paddingHorizontal: 16, + }, + + // General + text: { + fontSize: 14, + lineHeight: 20, + color: COLORS.black, + }, + bold: { + fontWeight: 'bold', + }, + field: { + color: 'hsla(0, 0%, 38%, 1)', + }, + mb4: { + marginBottom: 4, + }, + sectionTitle: { + fontSize: 16, + fontWeight: 'bold', + lineHeight: 20, + color: COLORS.black, + marginBottom: 24, + }, +}); diff --git a/src/components/WarnTextValue.js b/src/components/WarnTextValue.js new file mode 100644 index 000000000..4ddc85f94 --- /dev/null +++ b/src/components/WarnTextValue.js @@ -0,0 +1,31 @@ +/** + * Copyright (c) Hathor Labs and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +import React from 'react'; +import { AlertUI } from '../styles/themes'; +import { TextValue } from './TextValue'; + +/** + * @param {Object} props + * @param {boolean} props.title It sets font weight to bold and a larger font size + * @param {boolean} props.bold It sets font weight to bold + * @param {boolean} props.oneline It sets numberOfLines to 1 + * @param {boolean} props.shrink It sets flexShrink to 1 + * @param {boolean} props.pb4 It sets padding bottom to 4 + */ +export const WarnTextValue = ({ title, bold, oneline, shrink, pb4, children }) => ( + + {children} + +); diff --git a/src/constants.js b/src/constants.js index 63e206411..957f8aec5 100644 --- a/src/constants.js +++ b/src/constants.js @@ -240,6 +240,19 @@ export const NANOCONTRACT_REGISTER_STATUS = { SUCCESSFUL: 'successful', }; +export const WALLETCONNECT_NEW_NANOCONTRACT_TX_STATUS = { + READY: 'ready', + FAILED: 'failed', + LOADING: 'loading', + SUCCESSFUL: 'successful', +}; + +export const NANOCONTRACT_BLUEPRINTINFO_STATUS = { + FAILED: 'failed', + LOADING: 'loading', + SUCCESSFUL: 'successful', +}; + /** * Timeout in miliseconds to call wallet-service. */ @@ -262,7 +275,12 @@ export const NETWORK_PRIVATENET = 'privatenet'; export const MAX_RETRIES = 8; export const INITIAL_RETRY_LATENCY = 300; // ms export const LATENCY_MULTIPLIER = 30; // multiplier per iteration + /** * Nano Contract's transaction history list size. */ export const NANO_CONTRACT_TX_HISTORY_SIZE = 20; +/** + * Nano Contract documentation URL. + */ +export const NANO_CONTRACT_INFO_URL = 'https://docs.hathor.network/explanations/features/nano-contracts/'; diff --git a/src/reducers/reducer.js b/src/reducers/reducer.js index 4c92d330a..1f636ab08 100644 --- a/src/reducers/reducer.js +++ b/src/reducers/reducer.js @@ -14,7 +14,9 @@ import { FEATURE_TOGGLE_DEFAULTS, PRE_SETTINGS_MAINNET, NETWORKSETTINGS_STATUS, - NANOCONTRACT_REGISTER_STATUS + NANOCONTRACT_REGISTER_STATUS, + WALLETCONNECT_NEW_NANOCONTRACT_TX_STATUS, + NANOCONTRACT_BLUEPRINTINFO_STATUS } from '../constants'; import { types } from '../actions'; import { TOKEN_DOWNLOAD_STATUS } from '../sagas/tokens'; @@ -97,6 +99,26 @@ const initialState = { * @see {@link INITIAL_TOKENS} */ tokens: INITIAL_TOKENS, + /** + * Remarks + * We use the map of tokens to collect token details for tokens + * used in actions but not registered by the user. + * + * @example + * { + * '000003a3b261e142d3dfd84970d3a50a93b5bc3a66a3b6ba973956148a3eb824': { + * name: 'YanCoin', + * symbol: 'YAN', + * uid: '000003a3b261e142d3dfd84970d3a50a93b5bc3a66a3b6ba973956148a3eb824', + * }, + * isLoading: false, + * error: null, + * } + */ + unregisteredTokens: { + isLoading: false, + error: null, + }, /** * selectedToken {{ * uid: string; @@ -231,6 +253,38 @@ const initialState = { modal: { show: false, }, + /** + * newNanoContractTransaction {{ + * showModal: boolean; + * data: { + * nc: { + * network: string; + * ncId: string; + * blueprintId: string; + * method: string; + * caller: string; + * actions: { + * type: string; + * token: string; + * amount: number; + * address?: string; + * }[]; + * args: string[]; + * }; + * dapp: { + * icon: string; + * proposer: string; + * url: string; + * description: string; + * }; + * }; + * }} + */ + newNanoContractTransaction: { + status: WALLETCONNECT_NEW_NANOCONTRACT_TX_STATUS.READY, + showModal: false, + data: null, + }, connectionFailed: false, sessions: {}, }, @@ -322,6 +376,82 @@ const initialState = { * } */ historyMeta: {}, + /** + * blueprint { + * [blueprintId: string]: { + * status: string; + * data?: { + * id: string; + * name: string; + * public_methods: { + * [methodName: string]: { + * args: { + * type: string; + * name: string; + * }[]; + * }; + * }; + * }; + * error?: string; + * } + * } + * @example + * { + * '3cb032600bdf7db784800e4ea911b10676fa2f67591f82bb62628c234e771595': { + * status: 'success', + * data: { + * id: '3cb032600bdf7db784800e4ea911b10676fa2f67591f82bb62628c234e771595', + * name: 'Bet', + * public_methods: { + * bet: { + * args: [ + * { + * name: "address", + * type: "bytes" + * }, + * { + * name: "score", + * type: "str" + * } + * ], + * return_type: "null" + * }, + * initialize: { + * args: [ + * { + * name: "oracle_script", + * type: "bytes" + * }, + * { + * name: "token_uid", + * type: "bytes" + * }, + * { + * name: "date_last_bet", + * type: "int" + * } + * ], + * return_type: "null" + * }, + * set_result: { + * args: [ + * { + * name: "result", + * type: "SignedData[str]" + * } + * ], + * return_type: "null" + * }, + * withdraw: { + * args: [], + * return_type: "null" + * } + * }, + * }, + * }, + * } + */ + blueprint: {}, }, /** * selectAddressModal {{ @@ -531,6 +661,20 @@ export const reducer = (state = initialState, action) => { return onFirstAddressFailure(state, action); case types.FIRSTADDRESS_SUCCESS: return onFirstAddressSuccess(state, action); + case types.SET_NEW_NANO_CONTRACT_TRANSACTION: + return onSetNewNanoContractTransaction(state, action); + case types.WALLETCONNECT_NEW_NANOCONTRACT_STATUS: + return onSetNewNanoContractTransactionStatus(state, action); + case types.NANOCONTRACT_BLUEPRINTINFO_REQUEST: + return onNanoContractBlueprintInfoRequest(state, action); + case types.NANOCONTRACT_BLUEPRINTINFO_FAILURE: + return onNanoContractBlueprintInfoFailure(state, action); + case types.NANOCONTRACT_BLUEPRINTINFO_SUCCESS: + return onNanoContractBlueprintInfoSuccess(state, action); + case types.UNREGISTEREDTOKENS_REQUEST: + return onUnregisteredTokensRequest(state); + case types.UNREGISTEREDTOKENS_UPDATE: + return onUnregisteredTokensUpdate(state, action); default: return state; } @@ -1683,3 +1827,170 @@ export const onFirstAddressSuccess = (state, { payload }) => ({ error: null, }, }); + +/** + * @param {Object} state + * @param {{ + * payload: { + * showModal: boolean; + * data: { + * nc: { + * network: string; + * ncId: string; + * blueprintId: string; + * method: string; + * caller: string; + * actions: { + * type: string; + * token: string; + * amount: number; + * address?: string; + * }[]; + * args: string[]; + * }; + * dapp: { + * icon: string; + * proposer: string; + * url: string; + * description: string; + * }; + * }; + * }; + * }} action + */ +export const onSetNewNanoContractTransaction = (state, { payload }) => ({ + ...state, + walletConnect: { + ...state.walletConnect, + newNanoContractTransaction: { + ...payload, + status: WALLETCONNECT_NEW_NANOCONTRACT_TX_STATUS.READY, + }, + }, +}); + +export const onSetNewNanoContractTransactionStatus = (state, { payload }) => ({ + ...state, + walletConnect: { + ...state.walletConnect, + newNanoContractTransaction: { + ...state.walletConnect.newNanoContractTransaction, + status: payload, + }, + }, +}); + +/** + * @param {Object} state + * @param {{ + * payload: { + * id: string; + * }; + * }} action + */ +export const onNanoContractBlueprintInfoRequest = (state, { payload }) => ({ + ...state, + nanoContract: { + ...state.nanoContract, + blueprint: { + ...state.nanoContract.blueprint, + [payload.id]: { + status: NANOCONTRACT_BLUEPRINTINFO_STATUS.LOADING, + data: null, + error: null, + }, + }, + }, +}); + +/** + * @param {Object} state + * @param {{ + * payload: { + * id: string; + * error: string; + * }; + * }} action + */ +export const onNanoContractBlueprintInfoFailure = (state, { payload }) => ({ + ...state, + nanoContract: { + ...state.nanoContract, + blueprint: { + ...state.nanoContract.blueprint, + [payload.id]: { + status: NANOCONTRACT_BLUEPRINTINFO_STATUS.FAILED, + data: null, + error: payload.error, + }, + }, + }, +}); + +/** + * @param {Object} state + * @param {{ + * payload: { + * id: string; + * data: { + * id: string; + * name: string; + * public_methods: { + * [methodName: string]: { + * args: { + * type: string; + * name: string; + * }[]; + * }; + * }; + * }; + * }; + * }} action + */ +export const onNanoContractBlueprintInfoSuccess = (state, { payload }) => ({ + ...state, + nanoContract: { + ...state.nanoContract, + blueprint: { + ...state.nanoContract.blueprint, + [payload.id]: { + status: NANOCONTRACT_BLUEPRINTINFO_STATUS.SUCCESSFUL, + data: payload.data, + error: null, + }, + }, + }, +}); + +/** + * Remarks + * This reducer aims to clean error feedback message before processing the request. + */ +export const onUnregisteredTokensRequest = (state) => ({ + ...state, + unregisteredTokens: { + ...state.unregisteredTokens, + isLoading: true, + error: null, + }, +}); + +/** + * Update walletConnect.tokens with some tokens data needed to feed UI components + * without the need to register them, also update an error feedback message if present. + * + * @param {Object} state + * @param {Object} action + * @param {Object} action.payload + * @param {Object} action.payload.tokens A map of token data by its UID. + * @param {string} action.payload.error The error message as feedback to user + */ +export const onUnregisteredTokensUpdate = (state, { payload }) => ({ + ...state, + unregisteredTokens: { + ...state.unregisteredTokens, + ...payload.tokens, + isLoading: false, + error: payload.error || null, + }, +}) diff --git a/src/sagas/nanoContract.js b/src/sagas/nanoContract.js index e8ec59a5d..230f43582 100644 --- a/src/sagas/nanoContract.js +++ b/src/sagas/nanoContract.js @@ -22,6 +22,8 @@ import { import { t } from 'ttag'; import { NanoRequest404Error } from '@hathor/wallet-lib/lib/errors'; import { + nanoContractBlueprintInfoFailure, + nanoContractBlueprintInfoSuccess, nanoContractHistoryClean, nanoContractHistoryFailure, nanoContractHistoryLoading, @@ -45,6 +47,8 @@ export const failureMessage = { addressNotMine: t`The informed address does not belong to the wallet.`, nanoContractStateNotFound: t`Nano Contract not found.`, nanoContractStateFailure: t`Error while trying to get Nano Contract state.`, + blueprintInfoNotFound: t`Blueprint not found.`, + blueprintInfoFailure: t`Couldn't get Blueprint info.`, notRegistered: t`Nano Contract not registered.`, nanoContractHistoryFailure: t`Error while trying to download Nano Contract transactions history.`, }; @@ -348,6 +352,33 @@ export function* requestNanoContractAddressChange({ payload }) { log.debug(`Success persisting Nano Contract address update. ncId = ${ncId}`); } +/** + * Process request to fetch blueprint info. + * @param {{ + * payload: { + * id: string; + * } + * }} + */ +export function* requestBlueprintInfo({ payload }) { + const { id } = payload; + let blueprintInfo = null; + try { + blueprintInfo = yield call([ncApi, ncApi.getBlueprintInformation], id); + } catch (error) { + if (error instanceof NanoRequest404Error) { + yield put(nanoContractBlueprintInfoFailure(id, failureMessage.blueprintInfoNotFound)); + } else { + log.error('Error while fetching blueprint info.', error); + yield put(nanoContractBlueprintInfoFailure(id, failureMessage.blueprintInfoFailure)); + } + return; + } + + log.debug(`Success fetching blueprint info. id = ${id}`); + yield put(nanoContractBlueprintInfoSuccess(id, blueprintInfo)); +} + export function* saga() { yield all([ debounce(500, [[types.START_WALLET_SUCCESS, types.NANOCONTRACT_INIT]], init), @@ -355,5 +386,6 @@ export function* saga() { takeEvery(types.NANOCONTRACT_HISTORY_REQUEST, requestHistoryNanoContract), takeEvery(types.NANOCONTRACT_UNREGISTER_REQUEST, unregisterNanoContract), takeEvery(types.NANOCONTRACT_ADDRESS_CHANGE_REQUEST, requestNanoContractAddressChange), + takeEvery(types.NANOCONTRACT_BLUEPRINTINFO_REQUEST, requestBlueprintInfo), ]); } diff --git a/src/sagas/tokens.js b/src/sagas/tokens.js index 7e6774fa9..55e6e2fdd 100644 --- a/src/sagas/tokens.js +++ b/src/sagas/tokens.js @@ -15,6 +15,7 @@ import { all, put, } from 'redux-saga/effects'; +import { t } from 'ttag'; import { metadataApi } from '@hathor/wallet-lib'; import { channel } from 'redux-saga'; import { get } from 'lodash'; @@ -28,11 +29,18 @@ import { tokenFetchHistoryRequested, tokenFetchHistorySuccess, tokenFetchHistoryFailed, + onExceptionCaptured, + unregisteredTokensUpdate, } from '../actions'; import { logger } from '../logger'; const log = logger('tokens-saga'); +const failureMessage = { + walletNotReadyError: t`Wallet is not ready yet.`, + someTokensNotLoaded: t`Error loading the details of some tokens.`, +}; + /** * @readonly * @enum {string} @@ -287,6 +295,48 @@ export function* fetchTokenData(tokenId, force = false) { } } +/** + * Request tokens data to feed walletConnect's tokens. + * @param {Object} action + * @param {Object} action.payload + * @param {string[]} action.payload.uids + */ +export function* requestUnregisteredTokens(action) { + const { uids } = action.payload; + + const wallet = yield select((state) => state.wallet); + if (!wallet.isReady()) { + log.error('Fail updating loading tokens data because wallet is not ready yet.'); + // This will show user an error modal with the option to send the error to sentry. + yield put(onExceptionCaptured(new Error(failureMessage.walletNotReadyError), true)); + return; + } + + const tokens = {}; + let someError = false; + for (const uid of uids) { + try { + const { tokenInfo: { symbol, name } } = yield call([wallet, wallet.getTokenDetails], uid); + const token = { uid, symbol, name }; + tokens[uid] = token; + } catch (e) { + log.error(`Fail getting token data for token ${uid}.`, e); + someError = true; + // continue download of tokens + } + } + + if (someError) { + log.log('There was a failure while getting tokens data to feed unregisteredTokens.'); + yield put( + unregisteredTokensUpdate({ tokens, error: failureMessage.someTokensNotLoaded }) + ); + return; + } + log.log('Success getting tokens data to feed unregisteredTokens.'); + yield put(unregisteredTokensUpdate({ tokens })); +} + export function* saga() { yield all([ fork(fetchTokenBalanceQueue), @@ -294,5 +344,6 @@ export function* saga() { takeEvery(types.TOKEN_FETCH_HISTORY_REQUESTED, fetchTokenHistory), takeEvery(types.NEW_TOKEN, routeTokenChange), takeEvery(types.SET_TOKENS, routeTokenChange), + takeEvery(types.UNREGISTEREDTOKENS_REQUEST, requestUnregisteredTokens), ]); } diff --git a/src/sagas/wallet.js b/src/sagas/wallet.js index 2745f2c53..1a61d74f6 100644 --- a/src/sagas/wallet.js +++ b/src/sagas/wallet.js @@ -124,7 +124,7 @@ export function* isWalletServiceEnabled() { const delta = now - shouldIgnoreFlagTs; if (delta < EXPIRE_WS_IGNORE_FLAG) { - console.log(`Still ignoring wallet-service, will expire in ${EXPIRE_WS_IGNORE_FLAG - delta}ms`); + log.log(`Still ignoring wallet-service, will expire in ${EXPIRE_WS_IGNORE_FLAG - delta}ms`); return false; } } else { @@ -271,7 +271,7 @@ export function* startWallet(action) { try { yield call(loadTokens); } catch (e) { - console.error('Tokens load failed: ', e); + log.error('Tokens load failed: ', e); yield put(onExceptionCaptured(e, false)); yield put(startWalletFailed()); return; @@ -355,7 +355,7 @@ export function* loadTokens() { * So we fetch the tokens metadata and store on redux */ export function* fetchTokensMetadata(tokens) { - // No tokens to load + // No tokens to load, set metadata as loaded if (!tokens.length) { return; } @@ -381,8 +381,7 @@ export function* fetchTokensMetadata(tokens) { const tokenMetadatas = {}; for (const response of responses) { if (response.type === types.TOKEN_FETCH_METADATA_FAILED) { - // eslint-disable-next-line - console.log('Error downloading metadata of token', response.tokenId); + log.log(`Error downloading metadata of token ${response.tokenId}.`); } else if (response.type === types.TOKEN_FETCH_METADATA_SUCCESS) { // When the request returns null, it means that we have no metadata for this token if (response.data) { @@ -395,7 +394,7 @@ export function* fetchTokensMetadata(tokens) { } export function* onWalletServiceDisabled() { - console.debug('We are currently in the wallet-service and the feature-flag is disabled, reloading.'); + log.debug('We are currently in the wallet-service and the feature-flag is disabled, reloading.'); yield put(reloadWalletRequested()); } @@ -690,7 +689,7 @@ export function* onWalletReloadData() { // Finally, set the wallet to READY by dispatching startWalletSuccess yield put(startWalletSuccess()); } catch (e) { - console.log('Wallet reload data failed: ', e); + log.error('Wallet reload data failed: ', e); yield put(onExceptionCaptured(e, false)); yield put(startWalletFailed()); } diff --git a/src/sagas/walletConnect.js b/src/sagas/walletConnect.js index ea897affa..338798f62 100644 --- a/src/sagas/walletConnect.js +++ b/src/sagas/walletConnect.js @@ -243,6 +243,7 @@ export function* onSessionRequest(action) { proposer: get(requestSession.peer, 'metadata.name', ''), url: get(requestSession.peer, 'metadata.url', ''), description: get(requestSession.peer, 'metadata.description', ''), + chain: get(requestSession.namespaces, 'hathor.chains[0]', ''), }; switch (params.request.method) { diff --git a/src/screens/WalletConnect/NewNanoContractTransactionScreen.js b/src/screens/WalletConnect/NewNanoContractTransactionScreen.js new file mode 100644 index 000000000..666996548 --- /dev/null +++ b/src/screens/WalletConnect/NewNanoContractTransactionScreen.js @@ -0,0 +1,44 @@ +/** + * Copyright (c) Hathor Labs and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +import React from 'react'; +import { + StyleSheet, + View, +} from 'react-native'; +import { t } from 'ttag'; +import HathorHeader from '../../components/HathorHeader'; +import OfflineBar from '../../components/OfflineBar'; +import { NewNanoContractTransactionRequest } from '../../components/WalletConnect/NanoContract/NewNanoContractTransactionRequest'; +import { COLORS } from '../../styles/themes'; + +export function NewNanoContractTransactionScreen({ route }) { + const { ncTxRequest } = route.params; + return ( + + + + + + ); +} + +const Wrapper = ({ children }) => ( + + {children} + +); + +const styles = StyleSheet.create({ + wrapper: { + flex: 1, + alignItems: 'center', + backgroundColor: COLORS.lowContrastDetail, // Defines an outer area on the main list content + }, +}); diff --git a/src/styles/themes.js b/src/styles/themes.js index 6a2f44159..970658496 100644 --- a/src/styles/themes.js +++ b/src/styles/themes.js @@ -93,6 +93,8 @@ export const COLORS = { feedbackError600: 'hsla(7, 100%, 30%, 1)', freeze100: 'hsla(0, 0%, 90%, 1)', freeze300: 'hsla(0, 0%, 45%, 1)', + cardWarning100: 'hsla(46, 100%, 95%, 1)', + cardWarning200: 'hsla(46, 100%, 58%, 1)', /** * @type {string} Black with 38% of light and full opaque */