Get Started
Install and create your first ERC-4337 smart account wallet.
This guide explains how to install the package, create a wallet, get your first account, and optionally convert to read-only.
1. Install the Package
Prerequisites
npm install @tetherto/wdk-wallet-evm-erc-43372. Create a Wallet
You can create a new wallet instance using the WalletManagerEvmErc4337 constructor with a BIP-39 seed phrase and ERC-4337 configuration:
import WalletManagerEvmErc4337 from '@tetherto/wdk-wallet-evm-erc-4337'
const seedPhrase = 'abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about'
const wallet = new WalletManagerEvmErc4337(seedPhrase, {
chainId: 1,
provider: 'https://rpc.mevblocker.io/fast',
bundlerUrl: 'https://api.candide.dev/public/v3/ethereum',
paymasterUrl: 'https://api.candide.dev/public/v3/ethereum',
paymasterAddress: '0x8b1f6cb5d062aa2ce8d581942bbb960420d875ba',
entryPointAddress: '0x0000000071727De22E5E9d8BAf0edAc6f37da032',
safeModulesVersion: '0.3.0',
paymasterToken: {
address: '0xdAC17F958D2ee523a2206206994597C13D831ec7' // USDT
}
})Secure the Seed Phrase: You must securely store this seed phrase immediately. If it is lost, the user will permanently lose access to their funds.
To use test/mock tokens instead of real funds, see the testnet configuration section.
3. Get Your First Account
You can retrieve a smart account at a given index using wallet.getAccount():
const account = await wallet.getAccount(0)
const address = await account.getAddress()
console.log('Smart account address:', address)4. (optional) Convert to Read-Only
You can convert an owned account to a read-only account using account.toReadOnlyAccount():
const readOnlyAccount = await account.toReadOnlyAccount()Next Steps
With your wallet ready, learn how to manage multiple accounts.