Skip to content

Commit

Permalink
docs(world): add changeset for system call helpers (#1747)
Browse files Browse the repository at this point in the history
Co-authored-by: alvarius <[email protected]>
  • Loading branch information
holic and alvrs authored Oct 12, 2023
1 parent 4fe0793 commit 7fa2ca1
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions .changeset/chatty-planets-heal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
"@latticexyz/world": minor
---

Added TS helpers for calling systems dynamically via the World.

- `encodeSystemCall` for `world.call`

```ts
worldContract.write.call(encodeSystemCall({
abi: worldContract.abi,
systemId: resourceToHex({ ... }),
functionName: "registerDelegation",
args: [ ... ],
}));
```

- `encodeSystemCallFrom` for `world.callFrom`

```ts
worldContract.write.callFrom(encodeSystemCallFrom({
abi: worldContract.abi,
from: "0x...",
systemId: resourceToHex({ ... }),
functionName: "registerDelegation",
args: [ ... ],
}));
```

- `encodeSystemCalls` for `world.batchCall`

```ts
worldContract.write.batchCall(encodeSystemCalls(abi, [{
systemId: resourceToHex({ ... }),
functionName: "registerDelegation",
args: [ ... ],
}]));
```

- `encodeSystemCallsFrom` for `world.batchCallFrom`
```ts
worldContract.write.batchCallFrom(encodeSystemCallsFrom(abi, "0x...", [{
systemId: resourceToHex({ ... }),
functionName: "registerDelegation",
args: [ ... ],
}]));
```

0 comments on commit 7fa2ca1

Please sign in to comment.