glin-contracts

Crates.ioglin-contracts
lib.rsglin-contracts
version0.1.4
created_at2025-10-05 04:27:07.766493+00
updated_at2025-10-10 14:49:25.61293+00
descriptionContract metadata, deployment, and interaction utilities for GLIN Network
homepagehttps://docs.glin.ai/sdk/rust/setup
repositoryhttps://github.com/glin-ai/glin-sdk-rust
max_upload_size
id1868607
size160,911
Irfan Eralp Kavakli (bulpara)

documentation

https://docs.glin.ai/sdk/rust/api-reference

README

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.

Related Crates

Documentation

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

License

Apache-2.0

Commit count: 0

cargo fmt