sonicapi/lib.rs
1// SONIC: Standard library for formally-verifiable distributed contracts
2//
3// SPDX-License-Identifier: Apache-2.0
4//
5// Designed in 2019-2025 by Dr Maxim Orlovsky <orlovsky@ubideco.org>
6// Written in 2024-2025 by Dr Maxim Orlovsky <orlovsky@ubideco.org>
7//
8// Copyright (C) 2019-2024 LNP/BP Standards Association, Switzerland.
9// Copyright (C) 2024-2025 Laboratories for Ubiquitous Deterministic Computing (UBIDECO),
10// Institute for Distributed and Cognitive Systems (InDCS), Switzerland.
11// Copyright (C) 2019-2025 Dr Maxim Orlovsky.
12// All rights under the above copyrights are reserved.
13//
14// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
15// in compliance with the License. You may obtain a copy of the License at
16//
17// http://www.apache.org/licenses/LICENSE-2.0
18//
19// Unless required by applicable law or agreed to in writing, software distributed under the License
20// is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
21// or implied. See the License for the specific language governing permissions and limitations under
22// the License.
23
24#![cfg_attr(docsrs, feature(doc_auto_cfg))]
25
26// TODO: Activate once StrictEncoding will be no_std
27// #![cfg_attr(not(feature = "std"), no_std)]
28
29#[macro_use]
30extern crate core;
31extern crate alloc;
32
33#[macro_use]
34extern crate amplify;
35#[macro_use]
36extern crate strict_types;
37#[macro_use]
38extern crate commit_verify;
39
40#[cfg(feature = "serde")]
41#[macro_use]
42extern crate serde;
43
44mod state;
45mod api;
46mod adaptors;
47mod schema;
48mod articles;
49mod builders;
50mod util;
51
52pub use adaptors::{alu, embedded};
53pub use api::{
54 Api, ApiId, ApiInner, ApiVm, AppendApi, DestructibleApi, StateAdaptor, StateArithm, StateCalc, StateCalcError,
55 StateReader,
56};
57pub use articles::{Articles, MergeError, ARTICLES_MAGIC_NUMBER, ARTICLES_VERSION};
58pub use builders::{Builder, BuilderRef, CoreParams, IssueParams, NamedState, OpBuilder, OpBuilderRef};
59pub use schema::{Schema, SCHEMA_MAGIC_NUMBER, SCHEMA_VERSION};
60pub use sonic_callreq::*;
61pub use state::{DataCell, StateAtom, StateTy, StructData};
62pub use ultrasonic::*;
63pub use util::{sigs, AnnotationName, Annotations};
64
65#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug, Display)]
66#[repr(u8)]
67pub enum VmType {
68 #[display("Built-in")]
69 Embedded = 1,
70 #[display("AluVM")]
71 AluVM = 2,
72}