From 5a6c03c6bc02c980ca051dadd8e20560ac25c771 Mon Sep 17 00:00:00 2001 From: Kevin Ingersoll Date: Thu, 19 Sep 2024 14:17:11 +0000 Subject: [PATCH] fix(explorer): better observer decorator types (#3206) --- .changeset/perfect-parrots-wonder.md | 5 +++++ packages/explorer/src/observer/decorator.ts | 9 +++++---- 2 files changed, 10 insertions(+), 4 deletions(-) create mode 100644 .changeset/perfect-parrots-wonder.md diff --git a/.changeset/perfect-parrots-wonder.md b/.changeset/perfect-parrots-wonder.md new file mode 100644 index 0000000000..5c4d6cd035 --- /dev/null +++ b/.changeset/perfect-parrots-wonder.md @@ -0,0 +1,5 @@ +--- +"@latticexyz/explorer": patch +--- + +Fixed `observer` decorator types so it can be used in more places. diff --git a/packages/explorer/src/observer/decorator.ts b/packages/explorer/src/observer/decorator.ts index f23c15c203..c54394589e 100644 --- a/packages/explorer/src/observer/decorator.ts +++ b/packages/explorer/src/observer/decorator.ts @@ -13,10 +13,11 @@ export type ObserverOptions = { let writeCounter = 0; -export function observer({ - explorerUrl = "http://localhost:13690", - waitForStateChange, -}: ObserverOptions = {}): ( +export function observer({ explorerUrl = "http://localhost:13690", waitForStateChange }: ObserverOptions = {}): < + transport extends Transport, + chain extends Chain | undefined = Chain | undefined, + account extends Account | undefined = Account | undefined, +>( client: Client, ) => Pick, "writeContract"> { const emit = createBridge({ url: `${explorerUrl}/internal/observer-relay` });