Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add getChainId to abstract wallet client #129

Merged
merged 2 commits into from
Dec 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading