bity_ic_types/
lib.rs

1//! Common types and utilities for Internet Computer development.
2//!
3//! This crate provides a collection of commonly used types and type aliases
4//! for developing applications on the Internet Computer platform.
5
6use candid::{CandidType, Principal};
7use serde::{Deserialize, Serialize};
8
9mod build_version;
10
11pub use build_version::*;
12
13/// Represents an empty type, useful for functions that don't need to return data
14#[derive(CandidType, Serialize, Deserialize, Clone, Debug, Default)]
15pub struct Empty {}
16
17/// Type alias for an Internet Computer canister ID
18pub type CanisterId = Principal;
19/// Type alias for WebAssembly binary data representing a canister
20pub type CanisterWasm = Vec<u8>;
21/// Type alias for cycle amounts in the Internet Computer
22pub type Cycles = u64;
23/// Type alias for a 32-byte hash value
24pub type Hash = [u8; 32];
25/// Type alias for neuron maturity values
26pub type Maturity = u64;
27/// Type alias for time durations in milliseconds
28pub type Milliseconds = u64;
29/// Type alias for Network Nervous System neuron IDs
30pub type NnsNeuronId = u64;
31/// Type alias for proposal IDs
32pub type ProposalId = u64;
33/// Type alias for Service Nervous System neuron IDs
34pub type SnsNeuronId = [u8; 32];
35/// Type alias for Unix timestamps in seconds
36pub type TimestampSeconds = u64;
37/// Type alias for Unix timestamps in milliseconds
38pub type TimestampMillis = u64;
39/// Type alias for Unix timestamps in nanoseconds
40pub type TimestampNanos = u64;