Skip to content

Commit e1db80a

Browse files
authored
fix(entrykit): session client uses smart account (#3547)
1 parent 491a5ac commit e1db80a

3 files changed

Lines changed: 12 additions & 3 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@latticexyz/entrykit": patch
3+
---
4+
5+
Clarified `SessionClient` type as using a `SmartAccount` under the hood so that it can be used with smart account-related Viem actions.

packages/entrykit/src/common.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
import { resourceToHex } from "@latticexyz/common";
22
import { Client, Chain, Transport, Account, parseAbi, ClientConfig, Address } from "viem";
33
import worldConfig from "@latticexyz/world/mud.config";
4+
import { SmartAccount } from "viem/account-abstraction";
45

56
export type ConnectedClient<chain extends Chain = Chain> = Client<Transport, chain, Account>;
6-
export type SessionClient<chain extends Chain = Chain> = ConnectedClient<chain> & { readonly userAddress: Address };
7+
export type SessionClient<chain extends Chain = Chain> = Client<Transport, chain, SmartAccount> & {
8+
readonly userAddress: Address;
9+
};
710

811
export const defaultClientConfig = {
912
pollingInterval: 250,

packages/entrykit/src/getSessionAccount.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export async function getSessionAccount<chain extends Chain>({
1010
client: Client<Transport, chain>;
1111
userAddress: Address;
1212
}): Promise<SmartAccount> {
13-
const sessionSigner = getSessionSigner(userAddress);
14-
return await toSimpleSmartAccount({ client, owner: sessionSigner });
13+
const signer = getSessionSigner(userAddress);
14+
const account = await toSimpleSmartAccount({ client, owner: signer });
15+
return account;
1516
}

0 commit comments

Comments
 (0)