Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

abitty

Package Overview
Dependencies
Maintainers
0
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

abitty

Abitty cherry-picks specific functions from your Solidity ABIs and saves them for individual importing. Stop using thicc JSON files, start shaking that tree.

  • 0.1.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
0
Weekly downloads
 
Created
Source

Abitty 👌

Abitty cherry-picks specific functions from your Solidity ABIs and saves them for individual importing. Stop using thicc JSON files, start shaking that tree.

Configuration

Create abitty.config.json in your project directory.

{
    "outputDir": "./src/types",
    "organize": true,
    "contracts": [
        {
            "name": "foo",
            "abiPath": "../out/Foo.sol/Foo.json",
            "pick": ["someFunction", "someOtherFunction", "amazingFunction"]
        },
        {
            "name": "bar",
            "abiPath": "../out/Bar.sol/Bar.json",
            "pick": ["excellentFunction"]
        }
    ]
}
Config spec
keyrequired
outputDirRelative path where the generated files will goYes
organizeIf true, organizes contract files in folders and creates a single entrypointNo
contractsAn array of Contracts 👇Yes
Contract.nameUsed for generating folder names, required if organize is set to trueSometimes
Contract.abiPathPath to your Solidity build artifact's JSON fileYes
Contract.pickFunctions you want to useYes

Generating your files

Install as a dev dependency and add to your package scripts

npm install abitty --save-dev
"scripts": {
    "gimme-them-abis": "abitty"
},

or skip this above and run with npx

npx abitty

The script will output an individual .ts file for each function, plus a helper type you can use to ensure arguments passed to that function satisfy the ABI.

If you are using a different configuration file, pass it to Abitty with the --config-file flag.

Using your exports

They work great with Viem / Wagmi which you should definitely be using.

import { doTheFooAbi, DoTheFooArgs } from 'yourOutputDir/foo/doTheFoo';

await publicClient.simulateContract({
    abi: [doTheFooAbi],
    address: fooAddress,
    functionName: 'doTheFoo',
    args: [myArg1, myArg2, myArg3],
    account: userAccount,
});

// You can use the generated argument typings like so:
const myArgs = [myArg1, myArg2, myArg3] satisfies DoTheFooArgs;

MIT license, do whatever you want with it. Contributions welcome.

Like it? Love it? Donate a few dollars to your local humane society for the fluffies 🐶🐱

Keywords

FAQs

Package last updated on 22 Jul 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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