Skip to content
This repository has been archived by the owner on Aug 4, 2023. It is now read-only.

Abi parser for Cairo smart contracts, based on wagmi abitype

License

Notifications You must be signed in to change notification settings

finiam/abi-wan-kanabi

 
 

Repository files navigation

ABI-WAN-KANABI

Table of Contents

About

Abi-wan-kanabi is an UNLICENSE standalone TypeScript parser for Cairo smart contracts. It enables on the fly typechecking and autocompletion for contracts call directly in typescript. Developers can now catch typing mistakes early, prior to executing the call on-chain, and thus enhancing the overall Dapp development experience.

Getting Started

Prerequisites

Abiwan is a standalone typescript library. Its only dependence is on typescript version 4.9.5 or higher. Also, it makes use of BigInt, so the tsconfig.json should target at least ES2020:

// tsconfig.json
{
  "compilerOptions": {
    "target": "ES2020",                         
    "lib": ["ES2020", "ESNext"],
  }
}

Build

To use abiwan, you must first generate types from your contracts' ABI json files, for example using the helper script (deprecated):

./scripts/extract_abi.sh <path>/<to>/<abi>.json <path>/<to>/<other_abi>.json ./

This will create a declaration file (.d.ts) for the abi. You can then import it in any script and you are set to go:

import abi from './abi_demo.ts'
import {call} from './kannabi.ts'
call(abi, "balance_of", 5n);

If you think that we should be able to import types directly from the json files, we think so too! See this typescript issue and thumb it up!

Demo

https://drive.google.com/file/d/1OpIgKlk-okvwJn-dkR2Pq2FvOVwlXTUJ/view?usp=sharing

Warning

Abiwan is still very young and has not yet been subject to an official release. We do not recommand using it in production yet.

Contributing

Contributions on abiwan are most welcome! If you are willing to contribute, please get in touch with one of the project lead or via the repositories Discussions

Acknowledgements

Authors and Contributors

For a full list of all authors and contributors, see the contributors page.

Special mentions

Big thanks and shoutout to Francesco! 👏 who is at the origin of the project!

Other projects

Abiwan is greatly influenced by the similar project for EVM-compatible contracts wagmi/abitype.

About

Abi parser for Cairo smart contracts, based on wagmi abitype

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 95.7%
  • JavaScript 2.7%
  • Shell 1.6%