Skip to content

Commit

Permalink
feat: add session keys service
Browse files Browse the repository at this point in the history
  • Loading branch information
ctrlc03 committed Aug 23, 2024
1 parent a752302 commit 8f7acd4
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions packages/coordinator/ts/sessionKeys/__tests__/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ import { toECDSASigner } from "@zerodev/permissions/signers";
import { addressToEmptyAccount, createKernelAccount } from "@zerodev/sdk";
import { KERNEL_V3_1 } from "@zerodev/sdk/constants";
import { ENTRYPOINT_ADDRESS_V07 } from "permissionless";
<<<<<<< HEAD
import { Address, createPublicClient, type Hex, http } from "viem";
=======
import { createPublicClient, type Hex, http } from "viem";
>>>>>>> 3efd294 (feat: add session keys service)
import { generatePrivateKey, privateKeyToAccount } from "viem/accounts";
import { localhost } from "viem/chains";

Expand All @@ -26,6 +30,7 @@ export const generateTimestampPolicy = (endTime: number, start?: number): Policy
validUntil: endTime,
});

<<<<<<< HEAD
jest.mock("@zerodev/sdk", (): unknown => ({
...jest.requireActual("@zerodev/sdk"),
createKernelAccount: jest.fn(),
Expand All @@ -36,6 +41,8 @@ jest.mock("@zerodev/permissions", (): unknown => ({
serializePermissionAccount: () => "approval",
}));

=======
>>>>>>> 3efd294 (feat: add session keys service)
/**
* Mock a session key approval
* @dev This will fail in hardhat with:
Expand Down Expand Up @@ -67,7 +74,13 @@ export const mockSessionKeyApproval = async (sessionKeyAddress: Hex): Promise<st

// Create an "empty account" as the signer -- you only need the public
// key (address) to do this.
<<<<<<< HEAD
const emptyAccount = addressToEmptyAccount(sessionKeyAddress as unknown as Address);
=======
// disabling rule even though Hex is 0x${string}
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
const emptyAccount = addressToEmptyAccount(sessionKeyAddress);
>>>>>>> 3efd294 (feat: add session keys service)
const emptySessionKeySigner = toECDSASigner({ signer: emptyAccount });

const permissionPlugin = await toPermissionValidator(publicClient, {
Expand Down

0 comments on commit 8f7acd4

Please sign in to comment.