Skip to content

Commit

Permalink
add changeset for syncToStash
Browse files Browse the repository at this point in the history
  • Loading branch information
alvrs committed Sep 18, 2024
1 parent f655881 commit 295aec7
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions .changeset/lucky-cows-fail.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
"@latticexyz/store-sync": patch
"@latticexyz/world": patch
---

Added a `syncToStash` util to hydrate a `stash` client store from MUD contract state.

```ts
import config from "mud.config";
import { createStash } from "@latticexyz/stash/internal";
import { createClient, http } from "viem";
import { anvil } from "viem/chains";

const address = "0x...";
const stash = createStash(config);
const client = createClient({
chain: anvil,
transport: http(),
});

const sync = await syncToStash({ config, stash, client, address });
// subscribe to start the sync
sync.storedBlockLogs$.subscribe();
```

0 comments on commit 295aec7

Please sign in to comment.