mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
* Fix for #11503: when you send a transaction with value as 0x, you get a Bignumber error. Fix this by setting value to 0x0 is it's 0x. Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com> * 1. Fix this in app/scripts/controllers/transactions/lib/utils.js 2. Make sure other non-hex non-valid strings for value return 0x0 Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com> * Linting Fixes. Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com> * Instead of returning 0x0 for invalid hex values, throw a descriptive error Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com> * Unit tests. Lint fixes. Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com> * assert.throws takes a function Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com> * Lint Fixes. Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com> * Use standardized error message. Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com> * remove fixHexValue move code validating hex value to validateTxParams Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com> * Change message displayed if hex string is invalid. Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com> * Fixed missing second quote mark on message. Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
This commit is contained in:
parent
be0508d41e
commit
319ab42bc1
@ -197,6 +197,12 @@ export function validateTxParams(txParams, eip1559Compatibility = true) {
|
||||
`Invalid transaction value of "${value}": number must be in wei.`,
|
||||
);
|
||||
}
|
||||
|
||||
if (!value.match(/^0x[a-fA-F0-9]+$/u)) {
|
||||
throw ethErrors.rpc.invalidParams(
|
||||
`Invalid transaction value of "${value}": not a valid hex string.`,
|
||||
);
|
||||
}
|
||||
break;
|
||||
case 'chainId':
|
||||
if (typeof value !== 'number' && typeof value !== 'string') {
|
||||
|
Loading…
Reference in New Issue
Block a user