getPermissions
Gets the wallet's current permissions
Loading...
Gets the wallet's current permissions
Import the wallet actions package so you can call this action.
import "github.com/ChefBingbong/viem-go/actions/wallet"See how to construct a wallet client and call this action.
import ( "context" "log"
"github.com/ChefBingbong/viem-go/actions/wallet" "github.com/ChefBingbong/viem-go/client" "github.com/ChefBingbong/viem-go/client/transport" "github.com/ChefBingbong/viem-go/chain/definitions")
ctx := context.Background()
walletClient, err := client.CreateWalletClient(client.WalletClientConfig{ Chain: definitions.Mainnet, Transport: transport.HTTP("https://eth.llamarpc.com"),})if err != nil { log.Fatal(err)}defer func() { _ = walletClient.Close() }()
permissions, err := wallet.GetPermissions(ctx, walletClient)if err != nil { log.Fatal(err)}log.Printf("Permissions: %+v", permissions)[]WalletPermission
A list of wallet permissions. Each permission contains:
Caveats - Permission caveatsDate - Permission grant date (Unix timestamp)ID - Permission identifierInvoker - The origin that requested the permissionParentCapability - The parent capability (e.g., "eth_accounts")This action takes no parameters.
The underlying JSON-RPC method invoked by this action.
wallet_getPermissions (EIP-2255)