diff --git a/.arclint b/.arclint --- a/.arclint +++ b/.arclint @@ -286,7 +286,10 @@ "prettier": { "type": "prettier", "version": ">=2.6.0", - "include": "(^web/.*\\.(css|html|js|json|jsx|md|scss|ts|tsx)$)", + "include": [ + "(^cashtab/.*\\.(css|html|js|json|jsx|md|scss|ts|tsx)$)", + "(^web/.*\\.(css|html|js|json|jsx|md|scss|ts|tsx)$)" + ], "exclude": "(^web/.*/translations/.*\\.json$)" }, "lint-python-isort": { diff --git a/cashtab/src/components/Alias/Alias.js b/cashtab/src/components/Alias/Alias.js --- a/cashtab/src/components/Alias/Alias.js +++ b/cashtab/src/components/Alias/Alias.js @@ -306,7 +306,9 @@ onCancel={handleCancel} >

- {`Are you sure you want to register the alias '${formData.aliasName}' for ${fromSatoshisToXec(aliasFee)} XECs?`} + {`Are you sure you want to register the alias '${ + formData.aliasName + }' for ${fromSatoshisToXec(aliasFee)} XECs?`}

@@ -380,7 +382,9 @@ setIsModalVisible(true)} + onClick={() => + setIsModalVisible(true) + } > Register Alias diff --git a/cashtab/src/components/Configure/Configure.js b/cashtab/src/components/Configure/Configure.js --- a/cashtab/src/components/Configure/Configure.js +++ b/cashtab/src/components/Configure/Configure.js @@ -1223,11 +1223,14 @@ const isAlias = isAliasFormat(value); // extract alias without the `.xec` const aliasName = value.slice(0, value.length - 4); - const isRegistered = isAliasRegistered(cashtabCache.aliasCache.aliases, aliasName); + const isRegistered = isAliasRegistered( + cashtabCache.aliasCache.aliases, + aliasName, + ); const isValidAlias = isAlias && isRegistered ? true : false; setManualContactAddressIsValid(isValidAlias); } - + setManualContactAddress(value); }; diff --git a/cashtab/src/components/Send/Send.js b/cashtab/src/components/Send/Send.js --- a/cashtab/src/components/Send/Send.js +++ b/cashtab/src/components/Send/Send.js @@ -41,7 +41,12 @@ TxLink, MsgBytesizeError, } from 'components/Common/Atoms'; -import { getWalletState, fromSatoshisToXec, calcFee, getMessageByteSize } from 'utils/cashMethods'; +import { + getWalletState, + fromSatoshisToXec, + calcFee, + getMessageByteSize, +} from 'utils/cashMethods'; import { sendXec } from 'utils/transactions'; import ApiError from 'components/Common/ApiError'; import { formatFiatBalance, formatBalance } from 'utils/formatting'; @@ -182,7 +187,11 @@ const pushDataByteCount = 1; const prefixByteCount = 4; const tokenIdByteCount = 32; - const localAirdropTxAddedBytes = pushDataByteCount + tokenIdByteCount + pushDataByteCount + prefixByteCount; // 38 + const localAirdropTxAddedBytes = + pushDataByteCount + + tokenIdByteCount + + pushDataByteCount + + prefixByteCount; // 38 const [airdropFlag, setAirdropFlag] = useState(false); @@ -243,14 +252,14 @@ setFormData({ address: location.state.contactSend, }); - + // explicitly trigger the address validation upon navigation from contact list handleAddressChange({ target: { name: 'address', value: location.state.contactSend, }, - }) + }); } // if this was routed from the Airdrop screen's Airdrop Calculator then @@ -610,18 +619,21 @@ [name]: value, })); }; - + const handleMsgChange = e => { const { value } = e.target; let msgError = false; const msgByteSize = getMessageByteSize(value); - const maxSize = (location && - location.state && - location.state.airdropTokenId) ? (currency.opReturn.unencryptedMsgByteLimit - localAirdropTxAddedBytes) - : isEncryptedOptionalOpReturnMsg ? currency.opReturn.encryptedMsgByteLimit : currency.opReturn.unencryptedMsgByteLimit; + const maxSize = + location && location.state && location.state.airdropTokenId + ? currency.opReturn.unencryptedMsgByteLimit - + localAirdropTxAddedBytes + : isEncryptedOptionalOpReturnMsg + ? currency.opReturn.encryptedMsgByteLimit + : currency.opReturn.unencryptedMsgByteLimit; if (msgByteSize > maxSize) { - msgError = `Message can not exceed ${maxSize} bytes`; + msgError = `Message can not exceed ${maxSize} bytes`; } setIsMsgError(msgError); setOpReturnMsg(e.target.value); @@ -1037,7 +1049,11 @@ : location && location.state && location.state.airdropTokenId - ? `(max ${currency.opReturn.unencryptedMsgByteLimit - localAirdropTxAddedBytes} bytes)` + ? `(max ${ + currency.opReturn + .unencryptedMsgByteLimit - + localAirdropTxAddedBytes + } bytes)` : `(max ${currency.opReturn.unencryptedMsgByteLimit} bytes)` } value={ @@ -1052,16 +1068,16 @@ : opReturnMsg : '' } - onChange={e => - handleMsgChange(e) - } + onChange={e => handleMsgChange(e)} onKeyDown={e => e.keyCode == 13 ? e.preventDefault() : '' } /> - {isMsgError ? isMsgError : ''} + + {isMsgError ? isMsgError : ''} + {apiError && } diff --git a/cashtab/src/utils/transactions.js b/cashtab/src/utils/transactions.js --- a/cashtab/src/utils/transactions.js +++ b/cashtab/src/utils/transactions.js @@ -533,9 +533,13 @@ let opReturnByteCount; if (optionalOpReturnMsg) { - opReturnByteCount = getMessageByteSize(optionalOpReturnMsg, encryptionFlag, encryptedEj); + opReturnByteCount = getMessageByteSize( + optionalOpReturnMsg, + encryptionFlag, + encryptedEj, + ); } - + // generate the tx inputs and add to txBuilder instance // returns the updated txBuilder, txFee, totalInputUtxoValue and inputUtxos let txInputObj = generateTxInput(