From e21dfd18622dd7f70dac51855a0052a56fb74e57 Mon Sep 17 00:00:00 2001 From: Esteban MiƱo Date: Tue, 22 Jan 2019 15:22:56 -0300 Subject: Use Parity on-chain registry only when is needed (#6052) * add and use knownMethodData to avoid infura requests * dataMethod to methodData and check empty response --- ui/app/helpers/transactions.util.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'ui/app/helpers') diff --git a/ui/app/helpers/transactions.util.js b/ui/app/helpers/transactions.util.js index 0f1ed70a3..d5b7f4958 100644 --- a/ui/app/helpers/transactions.util.js +++ b/ui/app/helpers/transactions.util.js @@ -59,6 +59,18 @@ export function isConfirmDeployContract (txData = {}) { return !txParams.to } +/** + * Returns four-byte method signature from data + * + * @param {string} data - The hex data (@code txParams.data) of a transaction + * @returns {string} - The four-byte method signature + */ +export function getFourBytePrefix (data = '') { + const prefixedData = ethUtil.addHexPrefix(data) + const fourBytePrefix = prefixedData.slice(0, 10) + return fourBytePrefix +} + /** * Returns the action of a transaction as a key to be passed into the translator. * @param {Object} transaction - txData object -- cgit