From d481ee9a676f981243b7e7f2e990383732cb3863 Mon Sep 17 00:00:00 2001 From: howydev <132113803+howydev@users.noreply.github.com> Date: Tue, 17 Dec 2024 12:58:19 -0500 Subject: [PATCH] chore: removing arbsepo instance --- .vitest/src/instances.ts | 13 +--------- aa-sdk/core/src/errors/client.ts | 4 ++-- .../src/ma-v2/account/account.ts | 20 +++++++++++----- .../src/ma-v2/client/client.test.ts | 7 +++--- .../smart-contracts/src/ma-v2/utils.ts | 24 +++++++++---------- .../InvalidEntityIdError/constructor.mdx | 2 +- 6 files changed, 33 insertions(+), 37 deletions(-) diff --git a/.vitest/src/instances.ts b/.vitest/src/instances.ts index 08431e186f..489c8b4350 100644 --- a/.vitest/src/instances.ts +++ b/.vitest/src/instances.ts @@ -10,17 +10,6 @@ import { split } from "../../aa-sdk/core/src/transport/split"; import { poolId, rundlerBinaryPath } from "./constants"; import { paymasterTransport } from "./paymaster/transport"; -export const local070InstanceOptSep = defineInstance({ - chain: localhost, - forkBlockNumber: 21153995, - forkUrl: - process.env.VITEST_OPT_SEPOLIA_FORK_URL ?? - "https://opt-sepolia-rpc.publicnode.com", - entryPointVersion: "0.7.0", - anvilPort: 8345, - bundlerPort: 8445, -}); - export const local060Instance = defineInstance({ chain: localhost, forkBlockNumber: 6381303, @@ -34,7 +23,7 @@ export const local060Instance = defineInstance({ export const local070Instance = defineInstance({ chain: localhost, - forkBlockNumber: 6381303, + forkBlockNumber: 7299096, forkUrl: process.env.VITEST_SEPOLIA_FORK_URL ?? "https://ethereum-sepolia-rpc.publicnode.com", diff --git a/aa-sdk/core/src/errors/client.ts b/aa-sdk/core/src/errors/client.ts index 5c42a1e252..b3040fe785 100644 --- a/aa-sdk/core/src/errors/client.ts +++ b/aa-sdk/core/src/errors/client.ts @@ -63,9 +63,9 @@ export class InvalidEntityIdError extends BaseError { /** * Initializes a new instance of the error message with a default message indicating that the entity id is invalid because it's too large. * - * @param {bigint} entityId the invalid entityId used + * @param {number} entityId the invalid entityId used */ - constructor(entityId: bigint) { + constructor(entityId: number) { super(`Entity ID used is ${entityId}, but must be less than uint32.max`); } } diff --git a/account-kit/smart-contracts/src/ma-v2/account/account.ts b/account-kit/smart-contracts/src/ma-v2/account/account.ts index fc75fbb622..a5ab0e932f 100644 --- a/account-kit/smart-contracts/src/ma-v2/account/account.ts +++ b/account-kit/smart-contracts/src/ma-v2/account/account.ts @@ -8,6 +8,7 @@ import { createBundlerClient, getEntryPoint, toSmartContractAccount, + getAccountAddress, } from "@aa-sdk/core"; import { concatHex, @@ -49,11 +50,11 @@ export type CreateSMAV2AccountParams< } & ( | { isGlobalValidation: boolean; - entityId: bigint; + entityId: number; } | { - isGlobalValidation: never; - entityId: never; + isGlobalValidation?: never; + entityId?: never; } ); @@ -78,10 +79,10 @@ export async function createSMAV2Account( accountAddress, entryPoint = getEntryPoint(chain, { version: "0.7.0" }), isGlobalValidation = true, - entityId = 0n, + entityId = 0, } = config; - if (entityId >= maxUint32) { + if (entityId >= Number(maxUint32)) { throw new InvalidEntityIdError(entityId); } @@ -119,6 +120,13 @@ export async function createSMAV2Account( ...singleSignerMessageSigner(signer), }); + const accountAddress_ = await getAccountAddress({ + client, + entryPoint, + accountAddress, + getAccountInitCode, + }); + // TODO: add deferred action flag const getAccountNonce = async (nonceKey?: bigint): Promise => { const nonceKeySuffix: Hex = `${toHex(entityId, { size: 4 })}${ @@ -136,7 +144,7 @@ export async function createSMAV2Account( }); return entryPointContract.read.getNonce([ - baseAccount.address, + accountAddress_, nonceKey ?? hexToBigInt(nonceKeySuffix), ]) as Promise; }; diff --git a/account-kit/smart-contracts/src/ma-v2/client/client.test.ts b/account-kit/smart-contracts/src/ma-v2/client/client.test.ts index 825403a2b4..8ead56e5fa 100644 --- a/account-kit/smart-contracts/src/ma-v2/client/client.test.ts +++ b/account-kit/smart-contracts/src/ma-v2/client/client.test.ts @@ -4,13 +4,14 @@ import { LocalAccountSigner, type SmartAccountSigner } from "@aa-sdk/core"; import { createSMAV2AccountClient } from "./client.js"; -import { local070InstanceOptSep } from "~test/instances.js"; +import { local070Instance } from "~test/instances.js"; import { setBalance } from "viem/actions"; import { accounts } from "~test/constants.js"; describe("MA v2 Tests", async () => { - const instance = local070InstanceOptSep; - let client: ReturnType; + const instance = local070Instance; + let client: ReturnType & + ReturnType; beforeAll(async () => { client = instance.getClient().extend(publicActions); diff --git a/account-kit/smart-contracts/src/ma-v2/utils.ts b/account-kit/smart-contracts/src/ma-v2/utils.ts index f480b5561f..4766fc033b 100644 --- a/account-kit/smart-contracts/src/ma-v2/utils.ts +++ b/account-kit/smart-contracts/src/ma-v2/utils.ts @@ -15,28 +15,26 @@ export const packSignature = ({ export const addresses = { allowlistModule: - "0xE46ca4a98c485caEE2Abb6ef5116292B8c78a868" as `0x${string}`, + "0xe768abEe3ad779Be1318388fC5D6A6fCf658011B" as `0x${string}`, nativeTokenLimitModule: - "0xEa6a05306315196f2A7CA2ec7eEA45290bae00A0" as `0x${string}`, + "0xbFD077C53ec21f91699cF2DBab5324ea608b4eF0" as `0x${string}`, paymasterGuardModule: - "0x976D01aF75D128cae526B5328AC268ac83D607f4" as `0x${string}`, + "0x97018B224C969A1992076293f15482FB9982A271" as `0x${string}`, singleSignerValidationModule: - "0xF56716aE104545BdAf012e14e4640beb52727479" as `0x${string}`, + "0x2a42a36ee6DC9E8f75d2f8B5ef621EE8F2bD3156" as `0x${string}`, timeRangeModule: - "0x6FD0a9765a86788126a55aD5a483029a484F996C" as `0x${string}`, + "0x335a66470B5052DD9F540bD64ca6b7dE205F6f0B" as `0x${string}`, webauthnValidationModule: - "0xCf3423F8EB9EE215560802D03a48cDD44f85bD28" as `0x${string}`, + "0x52bB58A05659F2fF4bDb57E602824859De11119A" as `0x${string}`, executionInstallDelegate: "0x8Bf909fEb66EBcC4725f04E70F319791Ec9d9628" as `0x${string}`, modularAccountImpl: - "0x99090abd2700E24Cc70E3c486A89F7af876fFA33" as `0x${string}`, + "0x7219030794F2937ff4A322B7CE9a58C070aF08C5" as `0x${string}`, semiModularAccountBytecodeImpl: - "0xDCBb5d4639428B18703801f7Cd7230add729E4b0" as `0x${string}`, + "0xc6176BeF7E32224238ef3A2Ee3F9BaCfA801Cc95" as `0x${string}`, semiModularAccountStorageOnlyImpl: - "0x563ea43Ba0CD9150466B054Ce47FB0Fb45B234E2" as `0x${string}`, - accountFactory: "0xA5FC7aDc6d2c838443dF5bb826152c58b918f2c8" as `0x${string}`, + "0x8bD01f353058513fE5968C80585dc0792f56961b" as `0x${string}`, + accountFactory: "0x52fd2B39bd2a2c411371514114f9a1b3F9Ba3a64" as `0x${string}`, accountFactoryOwner: - "0x3BD786ac7Dec96eF9d06ebbCFa4e0E0947A2c303" as `0x${string}`, + "0xDdF32240B4ca3184De7EC8f0D5Aba27dEc8B7A5C" as `0x${string}`, }; - -export const tempChainId = 11155420; diff --git a/site/pages/reference/aa-sdk/core/classes/InvalidEntityIdError/constructor.mdx b/site/pages/reference/aa-sdk/core/classes/InvalidEntityIdError/constructor.mdx index 3755d0a81f..34ebabe704 100644 --- a/site/pages/reference/aa-sdk/core/classes/InvalidEntityIdError/constructor.mdx +++ b/site/pages/reference/aa-sdk/core/classes/InvalidEntityIdError/constructor.mdx @@ -21,5 +21,5 @@ import { InvalidEntityIdError } from "@aa-sdk/core"; ### entityId -`bigint` +`number` the invalid entityId used