8000 Auto suggestion for proxy based on transaction type by rajk93 · Pull Request #11579 · polkadot-js/apps · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Auto suggestion for proxy based on transaction type #11579

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

Merged
merged 1 commit into from
May 28, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions packages/react-signer/src/Address.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,6 @@ interface ProxyState {
proxiesFilter: string[];
}

// true if we don't try to filter the list of proxies by type and
// instead leave it up to the user
const BYPASS_PROXY_CHECK = true;

function findCall (tx: Call | SubmittableExtrinsic<'promise'>): { method: string; section: string } {
try {
const { method, section } = tx.registry.findMetaCall(tx.callIndex);
Expand All @@ -63,13 +59,18 @@ function findCall (tx: Call | SubmittableExtrinsic<'promise'>): { method: string
}
}

function filterProxies (allAccounts: string[], tx: Call | SubmittableExtrinsic<'promise'>, proxies: [string, BN, KitchensinkRuntimeProxyType][]): string[] {
function filterProxies (
allAccounts: string[],
tx: Call | SubmittableExtrinsic<'promise'>,
proxies: [string, BN, KitchensinkRuntimeProxyType][],
bypassProxyTypeCheck = false
): string[] {
// get the call info
const { method, section } = findCall(tx);

// check an array of calls to all have proxies as the address
const checkCalls = (address: string, txs: Call[]): boolean =>
!txs.some((tx) => !filterProxies(allAccounts, tx, proxies).includes(address));
!txs.some((tx) => !filterProxies(allAccounts, tx, proxies, bypassProxyTypeCheck).includes(address));

// inspect nested calls, e.g. batch, ensuring that the proxy address
// is applicable to the containing calls
Expand All @@ -90,7 +91,7 @@ function filterProxies (allAccounts: string[], tx: Call | SubmittableExtrinsic<'
// FIXME Change when we add support for delayed proxies
if (!allAccounts.includes(address) || !delay.isZero()) {
return false;
} else if (BYPASS_PROXY_CHECK) {
} else if (bypassProxyTypeCheck) {
return true;
}

Expand Down
0