Module contracts

Module contracts 

Source
Expand description

Ink! smart contract deployment and interaction

This module provides functionality for deploying and interacting with ink! smart contracts on Substrate-based chains.

§Features

  • Deploy compiled ink! contracts (Wasm)
  • Call contract methods (read and write)
  • Parse contract metadata
  • Handle contract events
  • Gas estimation for contract calls

§Example

use apex_sdk_substrate::contracts::ContractClient;

// Deploy a contract
let contract = ContractClient::deploy(
    client,
    wasm_code,
    metadata,
    constructor_args,
).await?;

// Call a contract method
let result = contract
    .call("transfer")
    .args(&[recipient, amount])
    .execute(&wallet)
    .await?;

Structs§

ConstructorSpec
Constructor specification
ContractCallBuilder
Contract call builder
ContractClient
Contract client for interacting with deployed contracts
ContractMetadata
Contract metadata from the ink! compilation
ContractSpec
Contract specification
EventArg
Event argument
EventSpec
Event specification
Field
Field definition
GasLimit
Gas limit for contract calls
LayoutKey
Layout key
MessageArg
Message argument
MessageSpec
Message (method) specification
StorageLayout
Storage layout
TypeDef
Type definition
TypeParam
Type parameter
TypeRef
Type reference
Variant
Variant definition

Enums§

StorageDepositLimit
Storage deposit limit
TypeDefVariant
Type definition variant

Functions§

parse_metadata
Parse contract metadata from JSON

Type Aliases§

ContractAddress
Contract address type (32-byte account ID)