Polkadart Logo
Ink

Ink ABI

Dart library for handling ink! smart contract metadata.

Dart library for handling ink! smart contract metadata.

Requirements

Ensure that your environment meets the following requirements:

  • Dart >=3.6.0
  • Compatible with Flutter and pure Dart projects

Installation

To install ink_abi in your Dart project, add the following dependency to your pubspec.yaml file:

dependencies:
  ink_abi: any

Then, run:

  dart pub get

or

  flutter pub get

ABI Support

Ink! smart contract metadata serves as a blueprint for how a contract is structured and interacts with external systems. It defines storage layouts, executable methods, and data types, ensuring seamless communication between the contract and its callers. This makes it easier for developers to build, analyze, and integrate contracts efficiently across different platforms.

Currently, ink_abi supports metadata versions: v3, v4, v5.

Example Usage

Below is an example demonstrating how to load and parse the metadata for a Flipper smart contract:


void main() {
  // Read and parse the Flipper contract metadata
  final json = jsonDecode(File('flipper.json').readAsStringSync());

  // Initialize InkAbi with Flipper metadata
  final InkAbi inkAbi = InkAbi(json);
}

This initializes an InkAbi instance using metadata from the Flipper contract JSON file, allowing interaction with the Flipper contract's flip and get methods in a structured manner.