Management API Reference

Usage

How to use smart wallets in your React app

Openfort Kit uses wagmi internally and therefore it's possible to use hooks from wagmi to fetch data such as info about the connected account. Below there is an example of useAccount wagmi hook in use.

Getting user address#


_10
import { useAccount } from 'wagmi'
_10
_10
const MyComponent = () => {
_10
const { address } = useAccount()
_10
_10
return <div>Your address is: {address}</div>
_10
}

Openfort Smart Wallet#

When using the wallet provided by Openfort Embedded signer, you can sponsor gas fees, send batch transactions, use session keys, and more. Below is an example of how to use the wallet in your React app.

Sponsoring Transactions#

Openfort Smart Wallet allows you to sponsor gas fees for your users. Making it easier for them to interact with your app.

  1. Create a gas policy on the Openfort Dashboard.

  2. Set up the provider configuration with the embedded signer.

  3. Set the ethereumProviderPolicyId in the embeddedSignerConfiguration object.

  4. That's it! Your users will now have their gas fees sponsored.

More information about sponsoring gas fees can be found here.

Sending Batch Transactions#

Openfort Smart Wallet support sending a batch of transactions in a single, atomic submission to the network.

LibraryMethod
WagmiUse the useWriteContracts hook.
ViemsendCalls action

Using Session Keys#

Session keys are programmable access tokens with specific permissions, designed for controlled interactions. Examples include:

  • Granting access to specific areas or features.
  • Limiting usage to a set amount of resources (e.g., 1000 units of currency).
  • Time-bound validity (e.g., expiring after 3 days). Permissions can be combined, enabling fine-tuned, context-specific capabilities.

Session Keys streamline interactions by:

  • Seamless Interactions: Reducing the need for repeated confirmations by delegating specific permissions to locally stored keys, enhancing user experience.
  • Automated Processes: Enabling automation through server-bound keys with defined permissions for tasks like recurring actions, resource management, or condition-based triggers.
LibraryMethod
ViemUse the wallet_grantPermissions action

Using another wallet#

If you are using another wallet you will need to check if they have your desired functionality.

LibraryMethod
WagmiUse the getCapabilities hook.
ViemgetCapabilities action