-
Notifications
You must be signed in to change notification settings - Fork 198
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main' into holic/system-deploys
- Loading branch information
Showing
18 changed files
with
170 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
"@latticexyz/cli": patch | ||
"@latticexyz/faucet": patch | ||
"@latticexyz/store-indexer": patch | ||
"@latticexyz/store-sync": patch | ||
"@latticexyz/world-modules": patch | ||
--- | ||
|
||
Upgrade `zod` to `3.23.8` to avoid issues with [excessively deep type instantiations](https://github.com/colinhacks/zod/issues/577). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,6 +34,6 @@ | |
"viem": "2.9.20", | ||
"vite": "^4.2.1", | ||
"vitest": "0.34.6", | ||
"zod": "^3.22.2" | ||
"zod": "3.23.8" | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { Hex } from "viem"; | ||
|
||
export type WorldFunction = { | ||
readonly signature: string; | ||
readonly selector: Hex; | ||
readonly systemId: Hex; | ||
readonly systemFunctionSignature: string; | ||
readonly systemFunctionSelector: Hex; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import createDebug from "debug"; | ||
|
||
export const debug = createDebug("mud:world"); | ||
export const error = createDebug("mud:world"); | ||
|
||
// Pipe debug output to stdout instead of stderr | ||
debug.log = console.debug.bind(console); | ||
|
||
// Pipe error output to stderr | ||
error.log = console.error.bind(console); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { AbiItem, parseAbiItem } from "viem"; | ||
|
||
export function functionSignatureToAbiItem(functionSignature: string): AbiItem { | ||
const formattedSignature = `function ${functionSignature}`; | ||
return parseAbiItem(formattedSignature); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { Client, Abi, Address, getAddress } from "viem"; | ||
import IBaseWorldAbi from "../out/IBaseWorld.sol/IBaseWorld.abi.json"; | ||
import { functionSignatureToAbiItem } from "./functionSignatureToAbiItem"; | ||
import { getFunctions } from "./getFunctions"; | ||
|
||
export async function getWorldAbi({ | ||
client, | ||
worldAddress, | ||
fromBlock, | ||
toBlock, | ||
}: { | ||
readonly client: Client; | ||
readonly worldAddress: Address; | ||
readonly fromBlock: bigint; | ||
readonly toBlock: bigint; | ||
}): Promise<Abi> { | ||
const worldFunctions = await getFunctions({ | ||
client, | ||
worldAddress: getAddress(worldAddress), | ||
fromBlock, | ||
toBlock, | ||
}); | ||
const worldFunctionsAbi = worldFunctions.map((func) => functionSignatureToAbiItem(func.signature)); | ||
const abi = [...IBaseWorldAbi, ...worldFunctionsAbi]; | ||
|
||
return abi; | ||
} |
Oops, something went wrong.