Skip to content

feat: SDK upgrade with the ModularEtherspotWalletFactory contracts (on all chains) with latest IHook #64

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
# Changelog
## [6.0.0] - 2025-05-22
### Breaking Changes
- Changed contract address for Wallet Factory from `0x2A40091f044e48DEB5C0FCbc442E443F3341B451` to `0x38CC0EDdD3a944CA17981e0A19470d2298B8d43a`
- Changed contract address for Bootstrap from `0x0D5154d7751b6e2fDaa06F0cC9B400549394C8AA` to `0xCF2808eA7d131d96E5C73Eb0eCD8Dc84D33905C7`
- Changed contract address for Multiple Owner ECDSA Validator from `0x0740Ed7c11b9da33d9C80Bd76b826e4E90CC1906` to `0x0eA25BF9F313344d422B513e1af679484338518E`
- Results in a change of precomputed modular account address.

## [5.1.2] - 2025-05-07
### Fix
- Added ability to use custom chain
Expand Down
45 changes: 21 additions & 24 deletions examples/basics/custom-chain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,42 +12,39 @@ const bundlerApiKey = 'etherspot_public_key';
const bundlerUrl = 'https://testnet-rpc.etherspot.io/v2/84532'; // bundler url
const chainId = 84532; // chain id
const entryPointAddress = '0x0000000071727De22E5E9d8BAf0edAc6f37da032'; // entry point address
const walletFactoryAddress = '0x2A40091f044e48DEB5C0FCbc442E443F3341B451'; // wallet factory address
const bootstrapAddress = '0x0D5154d7751b6e2fDaa06F0cC9B400549394C8AA'; // bootstrap address
const multipleOwnerECDSAValidatorAddress = '0x0740Ed7c11b9da33d9C80Bd76b826e4E90CC1906'; // multi owner ECDSA validator factory address
const walletFactoryAddress = '0x38CC0EDdD3a944CA17981e0A19470d2298B8d43a'; // wallet factory address
const bootstrapAddress = '0xCF2808eA7d131d96E5C73Eb0eCD8Dc84D33905C7'; // bootstrap address
const multipleOwnerECDSAValidatorAddress = '0x0eA25BF9F313344d422B513e1af679484338518E'; // multi owner ECDSA validator factory address

// tsx examples/basics/custom-chain.ts
async function main() {
// for custom chains, you can use the following code to create a chain object
const chain = defineChain({
id: chainId,
name: "Base sepolia Testnet",
name: 'Base sepolia Testnet',
nativeCurrency: {
decimals: 18,
name: 'ETH',
symbol: 'ETH'
symbol: 'ETH',
},
rpcUrls: {
default: {
http: ['https://sepolia.base.org'] // RPC URL
}
}
})
http: ['https://sepolia.base.org'], // RPC URL
},
},
});
// initializating sdk...
const modularSdk = new ModularSdk(
process.env.WALLET_PRIVATE_KEY as string,
{
chain: chain,
chainId: chainId,
bundlerProvider: new EtherspotBundler(chainId, bundlerApiKey, bundlerUrl),
index: 0,
entryPointAddress,
walletFactoryAddress,
bootstrapAddress,
multipleOwnerECDSAValidatorAddress,
rpcProviderUrl: bundlerUrl,
})

const modularSdk = new ModularSdk(process.env.WALLET_PRIVATE_KEY as string, {
chain: chain,
chainId: chainId,
bundlerProvider: new EtherspotBundler(chainId, bundlerApiKey, bundlerUrl),
index: 0,
entryPointAddress,
walletFactoryAddress,
bootstrapAddress,
multipleOwnerECDSAValidatorAddress,
rpcProviderUrl: bundlerUrl,
});

// get address of EtherspotWallet...
const address: string = await modularSdk.getCounterFactualAddress();
Expand Down Expand Up @@ -77,7 +74,7 @@ async function main() {
console.log('Waiting for transaction...');
let userOpsReceipt: string | null = null;
const timeout = Date.now() + 1200000; // 1 minute timeout
while ((userOpsReceipt == null) && (Date.now() < timeout)) {
while (userOpsReceipt == null && Date.now() < timeout) {
await sleep(2);
userOpsReceipt = await modularSdk.getUserOpReceipt(uoHash);
}
Expand Down
2 changes: 1 addition & 1 deletion examples/basics/transfer-erc20.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ dotenv.config();
// add/change these values
const recipient = '0x80a1874E1046B1cc5deFdf4D3153838B72fF94Ac'; // recipient wallet address
const value = '0.1'; // transfer value
const tokenAddress = process.env.TOKEN_ADDRESS as string; // token address
const tokenAddress = '0xf7e6a76F138817c39dC0b5fCb409f642490CcEdD'; // token address
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Consider reverting to environment variable for token address.

Hardcoding the token address reduces flexibility and may cause issues if this address is not valid across all supported chains or becomes outdated. The previous approach using process.env.TOKEN_ADDRESS was more flexible for users.

-const tokenAddress = '0xf7e6a76F138817c39dC0b5fCb409f642490CcEdD'; // token address
+const tokenAddress = process.env.TOKEN_ADDRESS || '0xf7e6a76F138817c39dC0b5fCb409f642490CcEdD'; // token address

This provides the hardcoded address as a fallback while maintaining the flexibility of environment variable configuration.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const tokenAddress = '0xf7e6a76F138817c39dC0b5fCb409f642490CcEdD'; // token address
- const tokenAddress = '0xf7e6a76F138817c39dC0b5fCb409f642490CcEdD'; // token address
+ const tokenAddress = process.env.TOKEN_ADDRESS || '0xf7e6a76F138817c39dC0b5fCb409f642490CcEdD'; // token address
🤖 Prompt for AI Agents
In examples/basics/transfer-erc20.ts at line 16, replace the hardcoded token
address with a reference to an environment variable, such as
process.env.TOKEN_ADDRESS, to improve flexibility. Keep the current hardcoded
address as a fallback default in case the environment variable is not set,
ensuring the code works across different environments and chains without manual
changes.

const bundlerApiKey = 'etherspot_public_key';

// tsx examples/basics/transfer-erc20.ts
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@etherspot/modular-sdk",
"version": "5.1.2",
"version": "6.0.0",
"description": "Etherspot Modular SDK - build with ERC-7579 smart accounts modules",
"keywords": [
"ether",
Expand Down
Loading