Giter Club home page Giter Club logo

ape-cairo's Introduction

Quick Start

Ape compiler plugin around the Cairo language.

Dependencies

Installation

via pip

You can install the latest release via pip:

pip install ape-cairo

via setuptools

You can clone the repository and use setuptools for the most up-to-date version:

git clone https://github.com/ApeWorX/ape-cairo.git
cd ape-cairo
python3 setup.py install

Quick Usage

First, you will need to tell ape-cairo how to use the Cairo compiler. There are two ways to do this:

  1. Configure your Cairo manifest path in your ape-config.yaml.
  2. Build or add Cairo compiler binaries to your $PATH.

Both options require cloning the Cairo compiler source code:

git clone [email protected]:starkware-libs/cairo.git
cd cairo
git fetch --all
git checkout <tag>  # e.g. v1.0.0-alpha.6

To do the first option, add the following to your ape-config.yaml file:

cairo:
  manifest: /Users/home/path/to/cairo/Cargo.toml

Now, when compiling, Ape will use the command cargo run --bin <BIN> --manifest-path <CAIRO-MANIFEST>. To do the second option instead, build the release binaries for your OS:

cargo build --release

NOTE: This requires being in the same directory as Cairo.

After the build completes, add the target path to your global $PATH variable. (You may want to add this to your .zshrc / .bashrc file):

export PATH=$PATH:$HOME/path/to/cairo/target/release

Verify you have sierra-compile in your $PATH by doing:

which sierra-compile

WARN: Note that when using Cairo-lang the python package, it will add conflicting binaries with the same name. You will need to ensure you are using the correct binaries if you have cairo-lang the Python package installed.

which starknet-compile

Alternatively, the first approach avoids this problem.

Using the Compiler

In a project directory where there are .cairo files in your contracts/ directory, run the compile command:

ape compile

It should create ContractType objects in your .build/ folder containing the necessary Sierra code for contract declaration.

Development

This project is in development and should be considered a beta. Things might not be in their final state and breaking changes may occur. Comments, questions, criticisms and pull requests are welcomed.

ape-cairo's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.