-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Append EVM function name to unencrypted verified contract calls #1516
base: master
Are you sure you want to change the base?
Conversation
Deployed to Cloudflare Pages
|
Added function names in transactions tables Added parameters in transaction details view |
TODO:
|
Sorry, just to make it formal - this looks good to me @lukaw3d Only nit is for mobile. I think we should vertically align the icon at the top on mobile (see current 'before' image vs the after option). |
if (transaction.to_eth === '0x0100000000000000000000000000000000000103' && transaction.body?.data) { | ||
// Subcall precompile | ||
try { | ||
const coder = AbiCoder.defaultAbiCoder() | ||
const [methodName, cborHexArgs] = coder.decode(['string', 'bytes'], base64ToHex(transaction.body.data)) | ||
label += `: ${methodName}` | ||
|
||
if (!truncate) { | ||
const rawArgs = oasis.misc.fromCBOR(hexToBytes(cborHexArgs)) | ||
if (rawArgs === null) { | ||
label += `(null)` | ||
} else if (typeof rawArgs === 'object' && !Array.isArray(rawArgs)) { | ||
const jsonArgs = JSON.stringify( | ||
rawArgs, | ||
(key, value) => { | ||
if (value instanceof Uint8Array) { | ||
if (key === 'from') return oasis.staking.addressToBech32(value) | ||
if (key === 'to') return oasis.staking.addressToBech32(value) | ||
if (key === 'shares') return oasis.quantity.toBigInt(value).toLocaleString() | ||
return `0x${oasis.misc.toHex(value)}` | ||
} | ||
if (Array.isArray(value) && value.length === 2) { | ||
if (key === 'amount') { | ||
return [ | ||
oasis.quantity.toBigInt(value[0]).toLocaleString(), | ||
oasis.misc.toStringUTF8(value[1]), | ||
] | ||
} | ||
} | ||
return value | ||
}, | ||
2, | ||
) | ||
label += `(${jsonArgs})` | ||
} | ||
} | ||
} catch (e) { | ||
console.error('Failed to parse subcall data (might be malformed)', e, transaction) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added subcall cbor parsing, preview https://2bb6e93e.oasis-explorer.pages.dev/testnet/sapphire/tx/0x6e9aae5bc52f6f6f386424a8428e1ae822bd0f64222648fc3208e16591eec10d
Part of #1222