linera-alloy-sol-types

Crates.iolinera-alloy-sol-types
lib.rslinera-alloy-sol-types
version0.7.4
sourcesrc
created_at2024-05-30 20:29:02.790235
updated_at2024-05-30 20:29:02.790235
descriptionCompile-time ABI and EIP-712 implementations
homepagehttps://github.com/MathieuDutSik/ethreum_core/tree/main/crates/sol-types
repositoryhttps://github.com/MathieuDutSik/ethreum_core
max_upload_size
id1257239
size282,810
Mathieu Baudet (ma2bd)

documentation

README

linera-alloy-sol-types

Compile-time representation of Ethereum's type system with ABI and EIP-712 support.

This crate provides a developer-friendly interface to Ethereum's type system, by representing Solidity types. See type_system.md for a rundown, and the crate docs for more information

Features

  • static representation of Solidity types
  • ABI encoding and decoding
  • EIP-712 encoding and decoding
  • EIP-712 Domain object w/ serde support

Usage

See the crate docs for more details.

// Declare a solidity type in standard solidity
sol! {
    struct Foo {
        bar: u256;
        baz: bool;
    }
}

// A corresponding Rust struct is generated!
let foo = Foo {
    bar: 42.into(),
    baz: true,
};

// Works for UDTs
sol! { type MyType is uint8; }
let my_type = MyType::from(42u8);

// For errors
sol! {
    error MyError(
        string message,
    );
}

// And for functions!
sol! { function myFunc() external returns (uint256); }

Licensing

This crate is an extensive rewrite of the ethabi crate by the parity team. That codebase is used under the terms of the MIT license. We have preserved the original license notice in files incorporating ethabi code.

Commit count: 520

cargo fmt