Skip to content

Commit

Permalink
chore: removing arbsepo instance
Browse files Browse the repository at this point in the history
  • Loading branch information
howydev committed Dec 18, 2024
1 parent d010f10 commit d481ee9
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 37 deletions.
13 changes: 1 addition & 12 deletions .vitest/src/instances.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions aa-sdk/core/src/errors/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`);
}
}
Expand Down
20 changes: 14 additions & 6 deletions account-kit/smart-contracts/src/ma-v2/account/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
createBundlerClient,
getEntryPoint,
toSmartContractAccount,
getAccountAddress,
} from "@aa-sdk/core";
import {
concatHex,
Expand Down Expand Up @@ -49,11 +50,11 @@ export type CreateSMAV2AccountParams<
} & (
| {
isGlobalValidation: boolean;
entityId: bigint;
entityId: number;
}
| {
isGlobalValidation: never;
entityId: never;
isGlobalValidation?: never;
entityId?: never;
}
);

Expand All @@ -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);
}

Expand Down Expand Up @@ -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<bigint> => {
const nonceKeySuffix: Hex = `${toHex(entityId, { size: 4 })}${
Expand All @@ -136,7 +144,7 @@ export async function createSMAV2Account(
});

return entryPointContract.read.getNonce([
baseAccount.address,
accountAddress_,
nonceKey ?? hexToBigInt(nonceKeySuffix),
]) as Promise<bigint>;
};
Expand Down
7 changes: 4 additions & 3 deletions account-kit/smart-contracts/src/ma-v2/client/client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<typeof instance.getClient>;
const instance = local070Instance;
let client: ReturnType<typeof instance.getClient> &
ReturnType<typeof publicActions>;

beforeAll(async () => {
client = instance.getClient().extend(publicActions);
Expand Down
24 changes: 11 additions & 13 deletions account-kit/smart-contracts/src/ma-v2/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d481ee9

Please sign in to comment.