Skip to content
Open
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
17 changes: 11 additions & 6 deletions abstract-global-wallet/agw-react/hooks/useRevokeSessions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,32 @@ import { useRevokeSessions } from "@abstract-foundation/agw-react";

```tsx
import { useRevokeSessions } from "@abstract-foundation/agw-react";
import type { SessionConfig } from "@abstract-foundation/agw-client/sessions";
import { getSessionHash, type SessionConfig } from "@abstract-foundation/agw-client/sessions";

export default function RevokeSessionExample() {
const { revokeSessionsAsync } = useRevokeSessions();

const existingSessionConfig = {} as SessionConfig;
const anotherSessionConfig = {} as SessionConfig;

async function handleRevokeSession() {
// Revoke a single session using its configuration
await revokeSessionsAsync({
sessions: existingSessionConfig,
});

// Revoke a single session using its creation transaction hash
// Revoke a single session using its hash
const sessionHash = getSessionHash(existingSessionConfig);

await revokeSessionsAsync({
sessions: "0x1234...",
sessions: sessionHash,
});

// Revoke multiple sessions
await revokeSessionsAsync({
sessions: [
existingSessionConfig,
"0x1234...",
sessionHash,
anotherSessionConfig
],
});
Expand All @@ -53,8 +58,8 @@ export default function RevokeSessionExample() {
The session(s) to revoke. Can be provided as an array of:

- Session configuration objects
- Transaction hashes of when the sessions were created
- A mix of both session configs and transaction hashes
- Session hashes returned by `getSessionHash(sessionConfig)`
- A mix of both session configs and session hashes

</ResponseField>

Expand Down