Turnkey
Upgrade existing Turnkey wallets to Smart Wallets to enable gasless transactions, batching, and more in under 10 minutes. Keep Turnkey for key management, no wallet migration needed. Add battle-tested transaction infrastructure using EIP-7702 to upgrade EOAs to Smart Wallets:
- #1 gas abstraction infrastructure on the market
- 370M+ sponsored transactions
- 99.9% SLAs
- Trusted by Worldcoin, JP Morgan, Gensyn, and more
Don’t have a wallet set up yet? Start with the Smart Wallet Quickstart to create one in minutes.
JavaScript
Setup
Use Turnkey’s @turnkey/sdk-server package with Smart Wallets infrastructure in a server environment.
Installation
Prerequisites: Get your keys
- Alchemy API Key:
- Go to the dashboard
- Create or select an app and copy the API key
- Gas sponsorship Policy ID:
- Create a gas sponsorship policy in the dashboard and copy its Policy ID
- Turnkey Credentials:
- Go to the Turnkey Dashboard
- Create or select an organization and copy the Organization ID
- Create an API key pair and copy the API Public Key and Private Key
- Create or import a private key and copy the Private Key ID (UUID)
- Note the Ethereum address associated with that private key
Both the Smart Wallets configuration and the gas sponsorship policy must be linked to the application behind your API key for sponsorship to work.
Create Smart Wallet Client from Turnkey
Create a helper function that converts a Turnkey wallet into an Alchemy Smart Wallet client:
Send Transactions with EIP-7702
Send gasless transactions using EIP-7702 to upgrade the Turnkey wallet to a smart wallet:
Wait for Transaction Confirmation
Wait for the transaction to be confirmed onchain:
Batch Multiple Transactions
Send multiple transactions in a single batch:
Notes
- EIP-7702: Upgrades the Turnkey wallet to a smart wallet at transaction time without migration
- Gas Sponsorship: Use
paymasterServicewith your policy ID for gasless transactions - Server-Side: This example uses Turnkey’s
@turnkey/sdk-serverpackage which is designed for server environments. However, the@account-kitpackages (@account-kit/wallet-client,@account-kit/infra, etc.) can be used in any JavaScript environment including browsers, React Native, and Node.js