Skip to content

Granted permissions via connect() capabilities not being applied to sendCalls - still shows transaction confirmation popup #1034

@grmkris

Description

@grmkris

Environment

  • Porto SDK: v0.2.37
  • Wagmi: v2.19.3
  • Viem: v2.38.6
  • Next.js: 16.0.1
  • Network: Base mainnet

Problem Description

Permissions are successfully granted during wallet connection (user sees and approves the permission popup showing ETH spending limit and contract interactions), but subsequent sendCalls operations still trigger transaction confirmation popups instead of using the pre-authorized permissions.

Expected Behavior

According to Porto documentation, once permissions are granted via wallet_grantPermissions, they should automatically apply to subsequent wallet_sendCalls without requiring additional user confirmation:

"Once permissions have been granted, they will be automatically applied to any calls made by the Application via wallet_sendCalls"

Actual Behavior

After approving permissions during connection, attempting to execute a pre-authorized contract call still shows a Porto transaction confirmation popup requesting user approval.

Implementation Details

1. Permissions granted during connection:

// porto-connect-button.tsx
connect({
  connector: portoConnector,
  capabilities: { 
    grantPermissions: getOnboardingPermissions(), 
  }, 
});

2. Permission structure:

// onboarding-permissions.ts
export function getOnboardingPermissions() {
  return {
    expiry: Math.floor(Date.now() / 1000) + 60 * 60, // 1 hour
    feeToken: {
      limit: "1",
    },
    permissions: {
      calls: [
        {
          signature: "registerWithInvite(string,address,uint256,address,bytes)",
          to: "0x63e7b8F8A8d42b043fe58Be1243d7cBcb1Ca5514", // L2Registrar
        },
        {
          signature: "multicall(bytes[])",
          to: "0xa609955257eacbbd566a1fa654e6c5f4b1fdc9e2", // L2Registry
        },
      ],
    },
  } as const;
}

3. Call execution (after permissions granted):

// use-register-subdomain.ts
const result = await sendCallsAsync({
  calls: [
    {
      abi: L2RegistrarABI,
      functionName: "registerWithInvite",
      to: "0x63e7b8F8A8d42b043fe58Be1243d7cBcb1Ca5514",
      args: [label, recipient, expiration, inviter, signature],
    },
  ],
  capabilities: {
    atomicBatch: {
      supported: true,
    },
  },
});

Steps to Reproduce

  1. Connect Porto wallet using connect() with capabilities.grantPermissions parameter
  2. User approves the permission popup (sees "up to 11 ETH" spending limit and contract interaction permissions)
  3. Execute sendCalls with a pre-authorized contract function (registerWithInvite)
  4. Observe: Transaction confirmation popup still appears, asking user to approve the transaction

Questions

  1. Is there additional configuration needed to associate granted permissions with subsequent calls?
  2. Should the permission context/ID returned from the grant be explicitly passed to sendCalls?
  3. Is this a known issue in v0.2.37?
  4. Are we missing something in our implementation?

Additional Context

  • User confirmed seeing the permission details in the approval popup ("up to 11 ETH" spending limit and contract interactions), suggesting permissions were properly formatted and displayed by Porto
  • The permission popup appears and is approved successfully during connection
  • Only the atomicBatch capability is currently passed to sendCalls - not sure if granted permissions need to be explicitly referenced

Any guidance on the correct implementation would be greatly appreciated!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions