Connect 4337
Cometh ConnectCometh MarketplaceCometh Checkout
  • 🚀Quick start
    • What is Connect 4337
    • Getting started
    • Supported Networks
  • 🛠️CORE FEATURES
    • Create a Wallet
    • Send transactions
    • Go Gasless
    • Sign/Verify a message
    • Retrieve a wallet address
    • Handle owners
    • Import a safe into connect
  • 🥷ADVANCED
    • Session Keys
      • Tutorial
      • Policies
        • Sudo policy
        • Action policy
    • Social recovery
    • Add a passkey signer on a different OS
    • Capabilities
      • sendCalls
      • getCallsStatus
      • getCapabilities
      • grantPermissions
    • Other signers (Auth Providers)
      • EOA wallets (Metamask, Phantom...)
      • Magic signer
      • Web3Auth signer
      • Turnkey signer
      • Privy signer
  • 🔌Integrations
    • React hooks
      • ConnectProvider
      • useAccount
      • useConnect
      • useDisconnect
      • useGetGasPrice
      • useSendTransaction
      • useSignMessage
      • useVerifyMessage
      • useWriteContract
      • Handle owners
        • useRemoveOwner
        • useValidateAddDevice
        • useCreateNewSigner
        • useAddOwner
        • useGetOwners/EnrichedOwners
      • Session Keys
        • useGrantPermission
        • useSendPermission
        • useSessionKeyClient
        • useSessionKeySigner
      • Recovery
        • useIsRecoveryActive
        • useSetUpRecovery
        • useGetRecoveryRequest
        • useCancelRecoveryRequest
    • Mobile SDKs
      • IOS
      • Android
      • React Native
    • Wagmi
  • SDK Core
    • Signers (Auth Providers)
      • EOA wallets (Metamask, Phantom...)
      • Magic signer
      • Web3Auth signer
      • Turnkey signer
      • Privy signer
    • Handle owners
    • Capabilities
      • sendCalls
      • getCallsStatus
      • getCapabilities
  • SDK Session Keys
    • Setup Smart Account Client
    • Manage session keys
    • Policies
      • Sudo policy
      • Action policy
  • 📦Bundler
    • Bundler API
      • eth_sendUserOperation
      • eth_estimateUserOperationGas
      • eth_getUserOperationByHash
      • eth_getUserOperationReceipt
      • eth_supportedEntryPoints
  • 💳Paymaster
    • Paymaster API
  • 📖RESOURCES
    • Migrate from the connect legacy SDK
    • Connect Legacy SDKs (Unity, JS)
    • FAQ
Powered by GitBook
On this page
  • contract-call
  • sudo
  • Returns
  1. ADVANCED
  2. Capabilities

grantPermissions

Grants specific permissions to a session key or account, allowing controlled execution of actions such as contract calls. Permissions are time-limited and require an expiration timestamp.

contract-call

const COUNTER_CONTRACT_ADDRESS = "0x4FbF9EE4B2AF774D4617eAb027ac2901a41a7b5F";

const grantParams = {
  chainId,
  signer: {
    type: "account",
    data: { address: sessionOwner.address },
  },
  permissions: [
    {
      type: "contract-call",
      data: {
        contractAddress: COUNTER_CONTRACT_ADDRESS,
        functionSelector: "function count()",
      },
      policies: [],
    },
  ],
  expiry: Math.floor(Date.now() / 1000) + 3600, // Expires in 1 hour
};

const response = await smartAccountClient.grantPermissions(grantParams);

sudo

const grantParams = {
  chainId,
  signer: {
    type: "account",
    data: { address: sessionOwner.address },
  },
  permissions: [
    {
      type: "sudo",
      policies: [],
    },
  ],
  expiry: Math.floor(Date.now() / 1000) + 3600, // Expires in 1 hour
};

const response = await smartAccountClient.grantPermissions(grantParams);

Returns

A JSON object containing the granted permissions, their expiry, and the associated UserOperation hash for tracking.

PreviousgetCapabilitiesNextOther signers (Auth Providers)

Last updated 3 months ago

🥷