Skip to content

Commit

Permalink
Merge pull request #1736 from oasisprotocol/lw/consistent-rename
Browse files Browse the repository at this point in the history
Rename privateKeyPlaceholder to ethPrivateKeyPlaceholder
  • Loading branch information
lukaw3d committed Oct 20, 2023
2 parents 0c16bcf + f84ebb3 commit b05c379
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions .changelog/1736.internal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Rename privateKeyPlaceholder to ethPrivateKeyPlaceholder
10 changes: 5 additions & 5 deletions src/app/lib/eth-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ import { bytesToHex, isValidPrivate, privateToAddress, toChecksumAddress } from
export { isValidAddress as isValidEthAddress } from '@ethereumjs/util'

export const hexToBuffer = (value: string): Buffer => Buffer.from(value, 'hex')
export const isValidEthPrivateKey = (value: string): boolean => {
export const isValidEthPrivateKey = (ethPrivateKey: string): boolean => {
try {
return isValidPrivate(hexToBuffer(value))
return isValidPrivate(hexToBuffer(ethPrivateKey))
} catch {
return false
}
}
export const isValidEthPrivateKeyLength = (value: string) => value.length === 64
export const privateToEthAddress = (value: string): string =>
toChecksumAddress(bytesToHex(privateToAddress(hexToBuffer(value))))
export const isValidEthPrivateKeyLength = (ethPrivateKey: string) => ethPrivateKey.length === 64
export const privateToEthAddress = (ethPrivateKey: string): string =>
toChecksumAddress(bytesToHex(privateToAddress(hexToBuffer(ethPrivateKey))))

export async function getEvmBech32Address(evmAddress: string) {
const evmBytes = oasis.misc.fromHex(evmAddress.replace('0x', ''))
Expand Down
2 changes: 1 addition & 1 deletion src/app/pages/ParaTimesPage/TransactionRecipient/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export const TransactionRecipient = () => {
: undefined
}
placeholder={t(
'paraTimes.recipient.privateKeyPlaceholder',
'paraTimes.recipient.ethPrivateKeyPlaceholder',
'Enter Ethereum-compatible private key',
)}
value={transactionForm.ethPrivateKey}
Expand Down
2 changes: 1 addition & 1 deletion src/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -323,9 +323,9 @@
"pageInaccessible": "Transfers are not available.",
"recipient": {
"depositDescription": "Please enter the recipient address on <strong>{{paraTime}}</strong> {{paratimeType}} and then click \"{{nextButtonLabel}}\"",
"ethPrivateKeyPlaceholder": "Enter Ethereum-compatible private key",
"evmcWithdrawDescription": "Please enter the private key of the account on ParaTime, the recipient address on consensus and click \"{{nextButtonLabel}}\"",
"placeholder": "0x...",
"privateKeyPlaceholder": "Enter Ethereum-compatible private key",
"withdrawDescription": "Please enter the recipient address on consensus and click \"{{nextButtonLabel}}\""
},
"selection": {
Expand Down

0 comments on commit b05c379

Please sign in to comment.