Prerequisites
Before you begin, ensure you have completed the following steps:- Familiarize yourself with API Keys and Client Keys authentication.
- Visit the Modular Wallet Console Setup page
to:
- Create a Client Key for the modular wallets SDK
- Configure the Domain Name for your Passkey.
- Retrieve the Client URL for authentication.
Note:Circle provides a robust built-in indexing service optimized for subscribed
transactions per wallet. You can set up
webhook subscriptions on the Circle
Console to receive notifications for transfer activities or user operations. To
retrieve data from our Indexing Service through your backend, use an API Key to
authenticate RESTful API requests.
Installation and Setup
Follow the applicable setup steps for the SDK you are installing:- Web SDK
- iOS SDK
- Android SDK
- Run the following command in your shell, depending on your package manager:
- Create an
.envfile in your local directory and add the Client Key and Client URL obtained from the Modular Wallet Console Setup page:
-
Follow the React development workflow to build your sample web app using
the provided sample code.
- The root dependencies should already be installed from the installation step above.
- Install additional web app dependencies from the provided
package.jsonfile below.
package.json- Implement the quickstart steps below within a blank
index.tsxfile. - After completing all quickstart steps, you can test your app by launching a local web server.
Quickstart Steps
You can get started with the sample code below which showcases basic Modular Wallets capabilities, including Circle Smart Account, passkey, paymaster, and bundler services to send a gasless transaction with passkey signing.1. Create or Use an Existing Passkey
Create a new Passkey or use an existing one from your client key, passkey domain, and client URL values.2. Create and Set Up a Client
Create a client to access the desired blockchain network. The sample below demonstrates using thepolygonAmoy chain.
Note:When invoking
toModularTransport(), you must specify the blockchain
network. Supported networks include: arbitrum, arbitrumSepolia,
avalanche, avalancheFuji, base, baseSepolia, optimism,
optimismSepolia, polygon, polygonAmoy, unichain, unichainSepolia.3. Create a Circle Smart Account with Passkey
Create a Circle Smart Account using the transport client and the owner’s credentials. Then, create a bundler client to send user operations for the specified blockchain. The example below uses thepolygonAmoy chain.
4. Send a Gasless Transaction
Encapsulate the transaction within a user operation (userOp) and send it to the bundler. The bundler then initiates the transaction on behalf of the sender and forwards the transaction receipt back upon request.Note:On mobile platforms, iOS and Android offer at least a second option to
send a transaction using the
encodeTransfer() method. In the code below,
ensure you select either Option 1 or Option 2 based on your
requirements.Summary
In this Quickstart, you were able to:- Set up the Modular Wallet SDK.
- Create a Circle Smart Account with Passkey.
- Send a gasless transaction using the bundler.