Determine whether a Substrate proxy executed its inner call
An outer proxy extrinsic can dispatch successfully while the action performed for its principal fails. A service fulfilling orders must inspect the result carried by the proxy pallet.
Group events for the submitted proxy extrinsic
Read events at the inclusion block and filter to the extrinsic’s ApplyExtrinsic phase. The example assumes those records are in recordsForExtrinsic and api is connected to the matching runtime. Inspect each ProxyExecuted event for its DispatchResult.
for (const {event} of recordsForExtrinsic) {
if (api.events.proxy.ProxyExecuted.is(event)) {
const result = event.data[0]
console.log(result.isOk ? "inner call succeeded" : result.asErr.toString())
}
}
Separate authorization failures from dispatch failures
If the outer extrinsic fails before a proxy dispatch, there may be no ProxyExecuted event. Inspect system.ExtrinsicFailed in that case. When ProxyExecuted exists and its result is Err, inspect the returned DispatchError and the actual requested action, including any proxy type filter.
Preserve both delegate signer and principal in the audit record. A transfer executed for the principal should be attributed to that principal even though the outer extrinsic bears the delegate’s signature.