diff --git a/.changeset/wise-waves-attend.md b/.changeset/wise-waves-attend.md new file mode 100644 index 0000000..e8f2440 --- /dev/null +++ b/.changeset/wise-waves-attend.md @@ -0,0 +1,6 @@ +--- +'@abstract-foundation/agw-client': patch +'@abstract-foundation/agw-react': patch +--- + +Add getChainId to abstract wallet client diff --git a/packages/agw-client/src/walletActions.ts b/packages/agw-client/src/walletActions.ts index bc08a90..0569082 100644 --- a/packages/agw-client/src/walletActions.ts +++ b/packages/agw-client/src/walletActions.ts @@ -4,6 +4,7 @@ import { type Address, type Chain, type Client, + type GetChainIdReturnType, type PrepareTransactionRequestReturnType, type PublicClient, type SendTransactionRequest, @@ -17,6 +18,7 @@ import { type WalletClient, type WriteContractParameters, } from 'viem'; +import { getChainId } from 'viem/actions'; import { type ChainEIP712, type Eip712WalletActions, @@ -60,6 +62,7 @@ export type AbstractWalletActions< chain extends ChainEIP712 | undefined = ChainEIP712 | undefined, account extends Account | undefined = Account | undefined, > = Eip712WalletActions & { + getChainId: () => Promise; createSession: ( args: CreateSessionParameters, ) => Promise; @@ -155,6 +158,7 @@ export function globalWalletActions< return ( client: Client, ): AbstractWalletActions => ({ + getChainId: () => getChainId(client), createSession: (args) => createSession(client, signerClient, publicClient, args, isPrivyCrossApp), revokeSessions: (args) =>