[][src]Crate solid

Basic usage of the crate without the "serde" nor "dervie" features would be using Builder and Selector.

let function = Builder::new()
    .name("transfer")
    .push("daniel")
    .push(10u128)
    .push(Bytes10([1u8; 10]))
    .build();

Usage with the "derive" feature would look like.

Use #[solid(contstructor)] if you're constructing a contract. Otherwise the name of the struct and the field types will be used to derive the function signature.

#[derive(Encode)]
#[solid(rename = "random_function")]
struct ContractCallComposite<'a> {
    to: (&'a str, u128),
    memos: &'a [&'a str],
    matrix: &'a [&'a [&'a [u8]]],
}

#[derive(Decode)]
struct ContractCallResponse<'a> {
    int: Uint256,
    bytes: Bytes<'a>,
    memo: &'a str,
    address: Address,
}

Usage with the "serde" feature would look like.

#[derive(Serialize)]
#[solid(rename = "random_function")]
struct ContractCallComposite<'a> {
    to: (&'a str, u128),
    memos: &'a [&'a str],
    matrix: &'a [&'a [&'a [u8]]],
}

#[derive(Deserialize)]
struct ContractCallResponse<'a> {
    // Uint256 is not supported.
    // int: Uint256,
    int: u128,
    bytes: Bytes<'a>,
    memo: &'a str,
    // Address is not supported.
    // address: Address,
}

Re-exports

pub use solid_derive as derive;

Structs

Address
Builder
Bytes
Bytes1
Bytes2
Bytes3
Bytes4
Bytes5
Bytes6
Bytes7
Bytes8
Bytes9
Bytes10
Bytes11
Bytes12
Bytes13
Bytes14
Bytes15
Bytes16
Bytes17
Bytes18
Bytes19
Bytes20
Bytes21
Bytes22
Bytes23
Bytes24
Bytes25
Bytes26
Bytes27
Bytes28
Bytes29
Bytes30
Bytes31
Bytes32
Function
Int24
Int40
Int48
Int56
Int72
Int80
Int88
Int96
Int104
Int112
Int120
Int136
Int144
Int152
Int160
Int168
Int176
Int184
Int192
Int200
Int208
Int216
Int224
Int232
Int240
Int248
Int256
Selector
Uint24
Uint40
Uint48
Uint56
Uint72
Uint80
Uint88
Uint96
Uint104
Uint112
Uint120
Uint136
Uint144
Uint152
Uint160
Uint168
Uint176
Uint184
Uint192
Uint200
Uint208
Uint216
Uint224
Uint232
Uint240
Uint248
Uint256

Enums

Error

Traits

Decode
Encode

Functions

to_bytes

Type Definitions

Result