Ink ABI
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.
Getting Started with ink! Smart Contracts
The Polkadart ink! packages provide tools for interacting with ink! smart contracts from Dart and Flutter applications. You can use these packages to parse contract metadata, generate type-safe bindings, deploy contracts and interact with them.
Ink CLI
ink_cli is a Dart library designed to simplify the process of generating Dart classes and methods for interacting with ink! smart contracts. This documentation will show you how to use ink_cli with examples from a simple Flipper contract.