Skip to content

Commit

Permalink
Rename property to ethPrivateKeyRaw
Browse files Browse the repository at this point in the history
  • Loading branch information
buberdds committed May 15, 2024
1 parent ee970da commit 046cee0
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ describe('<TransactionRecipient />', () => {
ticker: 'ROSE',
transactionForm: {
recipient: '',
ethPrivateRawKey: '',
ethPrivateKeyRaw: '',
},
usesOasisAddress: true,
} as ParaTimesHook
Expand Down Expand Up @@ -123,7 +123,7 @@ describe('<TransactionRecipient />', () => {
...mockUseParaTimesEVMcResult,
transactionForm: {
...mockUseParaTimesEVMcResult.transactionForm,
ethPrivateRawKey: '123',
ethPrivateKeyRaw: '123',
},
})
jest.mocked(useParaTimesNavigation).mockReturnValue({
Expand All @@ -144,7 +144,7 @@ describe('<TransactionRecipient />', () => {
...mockUseParaTimesEVMcResult,
transactionForm: {
...mockUseParaTimesEVMcResult.transactionForm,
ethPrivateRawKey: '----------------------------------------------------------------',
ethPrivateKeyRaw: '----------------------------------------------------------------',
},
})
jest.mocked(useParaTimesNavigation).mockReturnValue({
Expand All @@ -169,7 +169,7 @@ describe('<TransactionRecipient />', () => {
setTransactionForm,
transactionForm: {
recipient: 'oasis1qq3xrq0urs8qcffhvmhfhz4p0mu7ewc8rscnlwxe',
ethPrivateRawKey: ethPrivateKeyWith0xPrefix,
ethPrivateKeyRaw: ethPrivateKeyWith0xPrefix,
} as TransactionForm,
})
jest.mocked(useParaTimesNavigation).mockReturnValue({
Expand All @@ -182,7 +182,7 @@ describe('<TransactionRecipient />', () => {

expect(setTransactionForm).toHaveBeenCalledWith({
ethPrivateKey: ethPrivateKey,
ethPrivateRawKey: ethPrivateKeyWith0xPrefix,
ethPrivateKeyRaw: ethPrivateKeyWith0xPrefix,
recipient: 'oasis1qq3xrq0urs8qcffhvmhfhz4p0mu7ewc8rscnlwxe',
})
expect(navigateToAmount).toHaveBeenCalled()
Expand Down
22 changes: 11 additions & 11 deletions src/app/pages/ParaTimesPage/TransactionRecipient/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,16 @@ export const TransactionRecipient = () => {
onChange={nextValue =>
setTransactionForm({
...nextValue,
ethPrivateRawKey:
typeof nextValue.ethPrivateRawKey === 'object'
? (nextValue.ethPrivateRawKey as any).value // from suggestions
: nextValue.ethPrivateRawKey,
ethPrivateKeyRaw:
typeof nextValue.ethPrivateKeyRaw === 'object'
? (nextValue.ethPrivateKeyRaw as any).value // from suggestions
: nextValue.ethPrivateKeyRaw,
})
}
onSubmit={formData => {
setTransactionForm({
...formData.value,
ethPrivateKey: stripHexPrefix(formData.value.ethPrivateRawKey),
ethPrivateKey: stripHexPrefix(formData.value.ethPrivateKeyRaw),
})
navigateToAmount()
}}
Expand All @@ -86,15 +86,15 @@ export const TransactionRecipient = () => {
<Box margin={{ bottom: 'medium' }}>
{isEvmcParaTime && !isDepositing && (
<PasswordField
inputElementId="ethPrivateRawKey"
name="ethPrivateRawKey"
validate={ethPrivateRawKey =>
!isValidEthPrivateKeyLength(stripHexPrefix(ethPrivateRawKey))
inputElementId="ethPrivateKeyRaw"
name="ethPrivateKeyRaw"
validate={ethPrivateKeyRaw =>
!isValidEthPrivateKeyLength(stripHexPrefix(ethPrivateKeyRaw))
? t(
'paraTimes.validation.invalidEthPrivateKeyLength',
'Private key should be 64 characters long',
)
: !isValidEthPrivateKey(stripHexPrefix(ethPrivateRawKey))
: !isValidEthPrivateKey(stripHexPrefix(ethPrivateKeyRaw))
? t(
'paraTimes.validation.invalidEthPrivateKey',
'Ethereum-compatible private key is invalid',
Expand All @@ -105,7 +105,7 @@ export const TransactionRecipient = () => {
'paraTimes.recipient.ethPrivateKeyPlaceholder',
'Enter Ethereum-compatible private key',
)}
value={transactionForm.ethPrivateRawKey}
value={transactionForm.ethPrivateKeyRaw}
showTip={t('openWallet.privateKey.showPrivateKey', 'Show private key')}
hideTip={t('openWallet.privateKey.hidePrivateKey', 'Hide private key')}
suggestions={evmAccounts.map(acc => ({ label: acc.ethAddress, value: acc.ethPrivateKey }))}
Expand Down
2 changes: 1 addition & 1 deletion src/app/state/paratimes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const initialState: ParaTimesState = {
confirmTransferToForeignAccount: false,
defaultFeeAmount: '',
ethPrivateKey: '',
ethPrivateRawKey: '',
ethPrivateKeyRaw: '',
feeAmount: '',
feeGas: '',
paraTime: undefined,
Expand Down
2 changes: 1 addition & 1 deletion src/app/state/paratimes/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export interface TransactionForm {
// compatible with oasisRT.signatureSecp256k1
ethPrivateKey: string
// provided by user and used in form inputs allowing back and forth form navigation
ethPrivateRawKey: string
ethPrivateKeyRaw: string
feeAmount: string
feeGas: string
paraTime?: ParaTime
Expand Down
4 changes: 2 additions & 2 deletions src/utils/__fixtures__/test-inputs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export const privateKeyUnlockedState = {
confirmTransferToForeignAccount: false,
defaultFeeAmount: '',
ethPrivateKey: '',
ethPrivateRawKey: '',
ethPrivateKeyRaw: '',
feeAmount: '',
feeGas: '',
paraTime: undefined,
Expand Down Expand Up @@ -274,7 +274,7 @@ export const walletExtensionV0UnlockedState = {
confirmTransferToForeignAccount: false,
defaultFeeAmount: '',
ethPrivateKey: '',
ethPrivateRawKey: '',
ethPrivateKeyRaw: '',
feeAmount: '',
feeGas: '',
paraTime: undefined,
Expand Down

0 comments on commit 046cee0

Please sign in to comment.