Skip to content

Commit

Permalink
Add disconnect event
Browse files Browse the repository at this point in the history
  • Loading branch information
aryzing authored Sep 17, 2024
1 parent 58a1294 commit 02490d9
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sats-connect/core",
"version": "0.2.2",
"version": "0.3.0",
"main": "dist/index.mjs",
"module": "dist/index.mjs",
"types": "dist/index.d.mts",
Expand Down
14 changes: 13 additions & 1 deletion src/provider/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,19 @@ export const networkChangeSchema = v.object({
});
export type NetworkChangeEvent = v.InferOutput<typeof networkChangeSchema>;

export const walletEventSchema = v.variant('type', [accountChangeSchema, networkChangeSchema]);
// disconnect
export const disconnectEventName = 'disconnect';
export const disconnectSchema = v.object({
type: v.literal(disconnectEventName),
});
export type DisconnectEvent = v.InferOutput<typeof disconnectSchema>;

export const walletEventSchema = v.variant('type', [
accountChangeSchema,
networkChangeSchema,
disconnectSchema,
]);

export type WalletEvent = v.InferOutput<typeof walletEventSchema>;

export type AddListener = <const WalletEventName extends WalletEvent['type']>(
Expand Down

0 comments on commit 02490d9

Please sign in to comment.