Giter Club home page Giter Club logo

abi's Introduction

NEAR ABI

ABI schema format and tooling to define interface to NEAR smart contracts.

โš ๏ธ Warning: Format and tooling are not final and changes are likely to happen.

What is an ABI?

An ABI (Application Binary Interface) traditionally defines the interface between two binary program modules. In the context of the NEAR ABI, this JSON schema defines the interface to the Wasm binary (smart contract) on the NEAR network, including parameter and result formats used through the NEAR runtime.

Why do we need ABI?

  • Human-readable format to easy indicate how to interact with the contract
  • Standard interface definition cross-language
    • Ability to be used with any combination of contract SDK and client libraries
  • Tooling built using the ABI to be able to generate code to interact with any contract easily

Usage

Rust

Ensure you have cargo-near installed

To generate an ABI for a contract within the directory containing contract's Cargo.toml

$ cargo near abi

Ensure that the project you are generating an ABI for depends on a version of near-sdk of 4.1.0 or later and has the abi feature enabled.

near-sdk = { version = "4.1.0", features = ["abi"] }

TypeScript

Ensure you have a near-sdk-js (version 0.7.0 or later) contract

To generate an ABI for a contract within the directory containing contract's package.json

$ npx near-sdk-js build --generateABI path/to/contract.ts

The ABI will be put in build/contract-abi.json

Supported tools:

ABI generation

  • near-sdk-rs (version 4.1.0 and above) and cargo-near (version 0.3.0 and above): cargo-near is a cargo extention that is used to build the contract and generate the ABI from a near-sdk-rs contract.
  • near-sdk-js (version 0.7.0 and above): invoke near-sdk-js build with --generateABI to generate the ABI from a TypeScript contract (pure JavaScript is not supported yet).

ABI clients

Utility Libraries

  • near-abi-rs: Common Rust types used across Rust ABI crates.
  • near-abi-js: Common types used across JavaScript ABI libraries.

abi's People

Contributors

austinabell avatar itegulov avatar charleslavon avatar austinbaggio avatar davidm-d avatar miraclx avatar

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.