Socket
Socket
Sign inDemoInstall

@latticexyz/abi-ts

Package Overview
Dependencies
Maintainers
3
Versions
909
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@latticexyz/abi-ts - npm Package Versions

1
8889

2.0.0-main-c4d5eb4e

Diff

alvarius
published 2.0.0-main-5408f61b •

alvarius
published 2.0.0-main-f70869ed •

alvarius
published 2.0.0-next.6 •

Changelog

Source

Version 2.0.0-next.6

Major changes

style(gas-report): rename mud-gas-report to gas-report (#1410) (@latticexyz/gas-report)

Renames mud-gas-report binary to gas-report, since it's no longer MUD specific.

Minor changes

docs: rework abi-ts changesets (#1413) (@latticexyz/abi-ts, @latticexyz/cli)

Added a new @latticexyz/abi-ts package to generate TS type declaration files (.d.ts) for each ABI JSON file.

This allows you to import your JSON ABI and use it directly with libraries like viem and abitype.

pnpm add @latticexyz/abi-ts
pnpm abi-ts

By default, abi-ts looks for files with the glob **/*.abi.json, but you can customize this glob with the --input argument, e.g.

pnpm abi-ts --input 'abi/IWorld.sol/IWorld.abi.json'

docs: rework abi-ts changesets (#1413) (create-mud)

We now use @latticexyz/abi-ts to generate TS type declaration files (.d.ts) for each ABI JSON file. This replaces our usage TypeChain everywhere.

If you have a MUD project created from an older template, you can replace TypeChain with abi-ts by first updating your contracts' package.json:

-"build": "pnpm run build:mud && pnpm run build:abi && pnpm run build:typechain",
+"build": "pnpm run build:mud && pnpm run build:abi && pnpm run build:abi-ts",
-"build:abi": "forge clean && forge build",
+"build:abi": "rimraf abi && forge build --extra-output-files abi --out abi --skip test script MudTest.sol",
+"build:abi-ts": "mud abi-ts --input 'abi/IWorld.sol/IWorld.abi.json' && prettier --write '**/*.abi.json.d.ts'",
 "build:mud": "mud tablegen && mud worldgen",
-"build:typechain": "rimraf types && typechain --target=ethers-v5 out/IWorld.sol/IWorld.json",

And update your client's setupNetwork.ts with:

-import { IWorld__factory } from "contracts/types/ethers-contracts/factories/IWorld__factory";
+import IWorldAbi from "contracts/abi/IWorld.sol/IWorld.abi.json";

 const worldContract = createContract({
   address: networkConfig.worldAddress as Hex,
-  abi: IWorld__factory.abi,
+  abi: IWorldAbi,

docs: rework abi-ts changesets (#1413) (@latticexyz/store, @latticexyz/world)

We now use @latticexyz/abi-ts to generate TS type declaration files (.d.ts) for each ABI JSON file. This replaces our usage TypeChain everywhere.

If you previously relied on TypeChain types from @latticexyz/store or @latticexyz/world, you will either need to migrate to viem or abitype using ABI JSON imports or generate TypeChain types from our exported ABI JSON files.

import { getContract } from "viem";
import IStoreAbi from "@latticexyz/store/abi/IStore.sol/IStore.abi.json";

const storeContract = getContract({
  abi: IStoreAbi,
  ...
});

await storeContract.write.setRecord(...);

alvarius
published 2.0.0-main-8025c350 •

alvarius
published 2.0.0-main-9af542d3 •

alvarius
published 2.0.0-main-46046395 •

alvarius
published 2.0.0-main-55377ffe •

1
8889
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc