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.
Installation
Add the following to your pubspec.yaml file:
dependencies:
ink_abi: any
ink_cli: any
Get the dependencies by running:
dart pub get
Sample usage
Future<void> main() async {
// Parse contract metadata
final json = jsonDecode(File('flipper.json').readAsStringSync());
final abi = InkAbi(json);
// Generate Dart bindings
final generator = TypeGenerator(
abiFilePath: 'flipper.json',
fileOutput: FileOutput('generated_flipper.dart')
);
generator.generate();
print('Contract ABI loaded and bindings generated');
}
This will load the Flipper contract metadata and generate type-safe Dart bindings for interacting with the contract.
The ink! packages allow you to work with smart contracts in a type-safe way, making contract interactions more reliable and maintainable.
SS58 Address Format
The SS58 address format is the standard for encoding and decoding addresses in the Polkadot ecosystem. It is based on the Bitcoin Base-58-check encoding, with a few modifications designed for the needs of Polkadot-based chains. With this format it is possible to identity to which network a given address belongs, and to encode and decode addresses for different networks.
Ink ABI
Dart library for handling ink! smart contract metadata.