npx create-dynamic-app
, or simply following the Quickstart guide.
When that’s done you should have an app which is wrapped with the DynamicContextProvider.
Transport URL
NEXT_PUBLIC_PIMLICO_API_KEY
in your .env
file.pimlicoBundlerClient
getUserOperationGasPrice
later.You can see that as well as the transport (i.e. how it should communicate which in this case is via HTTP using the Transport URL we defined earlier), it needs something called the entrypoint address. This is imported as a static variable via ENTRYPOINT_ADDRESS_V07
from the permissionless
package. This is an address of a smart contract (deployed on every chain) that acts as a gateway for user operations. This article helps describe what the V07 version is compared to previous.You can learn more about the Bundler Client here.pimlicoPaymasterClient
Viem Clients & Chain
getPublicClient
and getWalletClient
methods on the wallet connector respectively.You can learn more about interacting with Wallets (covers all kinds of actions) here.walletClientToSmartAccountSigner
signTransaction
or signMessage
directly on the walletClient. But for Smart Accounts, we need a specific type of signer that can handle the extra complexity of Smart Accounts.You can learn more about this specific Signer type here.signerToSafeSmartAccount
signerToSafeSmartAccount
. It takes the Public Client, the signer we just created, and some other options, and returns a Safe Account.You can learn more about this method here.createSmartAccountClient
createSmartAccountClient
does.You can see we are defining some extra middleware here, such as the gas price and the sponsorUserOperation. These are optional but can be helpful in certain situations.In our case we’re going to use the paymaster we created earlier to sponsor the user operations, and the bundler to get the gas prices.You can learn more about the signerToSafeSmartAccount method here.Main.js
, we can now fetch the walletClient once logged in and then create that Safe account using the function we just created. To learn how to handle loading states, visit the Loading States guide.