I have created an anonymous proxy(Proxy pallet). Now I need to delete this proxy
.
I am using killAnonymous but it is giving me errors.
Please suggest what i am doing incorrect here
Substrate and Polkadot Stack Exchange is a question and answer site for developers building blockchains with the Substrate SDK. It only takes a minute to sign up.
Sign up to join this communityThe kill_anonymous
call needs to come from the anonymous itself:
let who = ensure_signed(origin)?;
let when = (height, ext_index);
let proxy = Self::anonymous_account(&spawner, &proxy_type, index, Some(when));
ensure!(proxy == who, Error::<T>::NoPermission);
Of course the only way to access an anonymous proxy origin is via proxy.proxy
. Your call above is correct, but you need to wrap it in a proxy.proxy
such that the origin is the anon proxy.
proxy.proxy(
real: <YOUR_ANON_PROXY>,
force_proxy_type: Any,
call: proxy.killAnonymous(
/* args */
)
)
This is because the spawner may have set a new account as the proxy and removed itself, so the permission to kill an anon rests with the anon itself.
killAnonymous
isNoPermission
, otherwise, it cannot fail.