#contract #glin #ink #api-bindings

glin-contracts

Contract metadata, deployment, and interaction utilities for GLIN Network

4 releases

0.1.4 Oct 10, 2025
0.1.2 Oct 5, 2025
0.1.1 Oct 5, 2025
0.1.0 Oct 5, 2025

#25 in #ink

Download history 287/week @ 2025-10-01 193/week @ 2025-10-08 27/week @ 2025-10-15 3/week @ 2025-10-22

510 downloads per month
Used in glin-forge

Apache-2.0

99KB
1K SLoC

GLIN Logo

glin-contracts

crates.io docs.rs License

Contract metadata, deployment, and interaction utilities for GLIN Network.

Overview

This crate provides comprehensive tools for working with ink! smart contracts on GLIN Network:

  • Contract deployment: Deploy compiled contracts to the blockchain
  • Contract interaction: Call contract methods and query state
  • Metadata handling: Parse and work with contract metadata
  • Event decoding: Decode contract events from blockchain
  • Encoding utilities: SCALE encoding for contract calls

Usage

Add this to your Cargo.toml:

[dependencies]
glin-contracts = "0.1.0"
glin-client = "0.1.0"
tokio = { version = "1", features = ["full"] }

Example

use glin_client::{create_client, get_dev_account};
use glin_contracts::{deploy_contract, call_contract};

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    // Connect to network
    let client = create_client("ws://localhost:9944").await?;
    let signer = get_dev_account("alice")?;

    // Deploy contract
    let result = deploy_contract(
        &client,
        &signer,
        "path/to/contract.contract",
        vec![], // constructor args
        0,      // value
    ).await?;

    println!("Contract deployed at: {}", result.contract_address);

    // Call contract method
    call_contract(
        &client,
        &signer,
        &result.contract_address,
        "transfer",
        vec![], // method args
        0,      // value
    ).await?;

    Ok(())
}

Features

  • Metadata parsing: Extract ABI and constructor information from .contract files
  • Type-safe encoding: SCALE encoding for contract arguments
  • Gas estimation: Automatic gas limit calculation
  • Event monitoring: Listen and decode contract events
  • Error handling: Detailed error messages for contract operations

Contract Metadata

This crate works with ink! contract metadata format (.contract files), which includes:

  • Contract ABI (messages, constructors, events)
  • Contract WASM bytecode
  • Type definitions (SCALE info)

Part of GLIN SDK

This crate is part of the GLIN SDK for Rust, providing complete blockchain interaction capabilities for GLIN Network.

Documentation

For full SDK documentation, contract examples, and deployment guides, see the main repository.

License

Apache-2.0

Dependencies

~23–41MB
~656K SLoC