Skip to content

Commit

Permalink
fix: add getChainId to abstract wallet client (#129)
Browse files Browse the repository at this point in the history
* add getChainId to wallet actions

* changeset
  • Loading branch information
coffeexcoin authored Dec 22, 2024
1 parent 3d7688c commit 7445977
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .changeset/wise-waves-attend.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@abstract-foundation/agw-client': patch
'@abstract-foundation/agw-react': patch
---

Add getChainId to abstract wallet client
4 changes: 4 additions & 0 deletions packages/agw-client/src/walletActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
type Address,
type Chain,
type Client,
type GetChainIdReturnType,
type PrepareTransactionRequestReturnType,
type PublicClient,
type SendTransactionRequest,
Expand All @@ -17,6 +18,7 @@ import {
type WalletClient,
type WriteContractParameters,
} from 'viem';
import { getChainId } from 'viem/actions';
import {
type ChainEIP712,
type Eip712WalletActions,
Expand Down Expand Up @@ -60,6 +62,7 @@ export type AbstractWalletActions<
chain extends ChainEIP712 | undefined = ChainEIP712 | undefined,
account extends Account | undefined = Account | undefined,
> = Eip712WalletActions<chain, account> & {
getChainId: () => Promise<GetChainIdReturnType>;
createSession: (
args: CreateSessionParameters,
) => Promise<CreateSessionReturnType>;
Expand Down Expand Up @@ -155,6 +158,7 @@ export function globalWalletActions<
return (
client: Client<Transport, ChainEIP712, Account>,
): AbstractWalletActions<Chain, Account> => ({
getChainId: () => getChainId(client),
createSession: (args) =>
createSession(client, signerClient, publicClient, args, isPrivyCrossApp),
revokeSessions: (args) =>
Expand Down

0 comments on commit 7445977

Please sign in to comment.