rgb/lib.rs
1// Standard Library for RGB smart contracts
2//
3// SPDX-License-Identifier: Apache-2.0
4//
5// Designed in 2019-2025 by Dr Maxim Orlovsky <orlovsky@lnp-bp.org>
6// Written in 2024-2025 by Dr Maxim Orlovsky <orlovsky@lnp-bp.org>
7//
8// Copyright (C) 2019-2024 LNP/BP Standards Association, Switzerland.
9// Copyright (C) 2024-2025 LNP/BP Laboratories,
10// Institute for Distributed and Cognitive Systems (InDCS), Switzerland.
11// Copyright (C) 2025 RGB Consortium, Switzerland.
12// Copyright (C) 2019-2025 Dr Maxim Orlovsky.
13// All rights under the above copyrights are reserved.
14//
15// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
16// in compliance with the License. You may obtain a copy of the License at
17//
18// http://www.apache.org/licenses/LICENSE-2.0
19//
20// Unless required by applicable law or agreed to in writing, software distributed under the License
21// is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
22// or implied. See the License for the specific language governing permissions and limitations under
23// the License.
24
25// TODO: Activate once StrictEncoding will be no_std
26// #![cfg_attr(not(feature = "std"), no_std)]
27#![deny(
28 // TODO: Activate once StrictEncoding removes invalid unsafe fn modifiers from the raw reader
29 // unsafe_code,
30 dead_code,
31 // TODO: Complete documentation
32 // missing_docs,
33 unused_variables,
34 unused_mut,
35 unused_imports,
36 non_upper_case_globals,
37 non_camel_case_types,
38 non_snake_case
39)]
40#![cfg_attr(coverage_nightly, feature(coverage_attribute))]
41#![cfg_attr(docsrs, feature(doc_auto_cfg))]
42#![allow(clippy::type_complexity)]
43#![cfg_attr(feature = "async", allow(async_fn_in_trait))]
44
45extern crate alloc;
46
47#[macro_use]
48extern crate amplify;
49extern crate rgbcore as rgb;
50
51#[cfg(feature = "bitcoin")]
52#[macro_use]
53extern crate strict_encoding;
54#[cfg(all(feature = "serde", feature = "bitcoin"))]
55#[macro_use]
56extern crate serde;
57
58extern crate core;
59pub extern crate rgb_invoice as invoice;
60
61mod pile;
62mod stockpile;
63mod contract;
64mod consignment;
65mod contracts;
66pub mod popls;
67mod util;
68#[cfg(feature = "stl")]
69pub mod stl;
70
71#[cfg(feature = "bitcoin")]
72pub use bp::{Outpoint, Txid};
73pub use consignment::{parse_consignment, Consignment, MAX_CONSIGNMENT_OPS};
74pub use contract::{
75 Assignment, ConsumeError, Contract, ContractState, CreateParams, EitherSeal, ImmutableState,
76 OwnedState,
77};
78#[cfg(feature = "binfile")]
79pub use contracts::CONSIGN_MAGIC_NUMBER;
80pub use contracts::{
81 ContractStateName, Contracts, IssuerError, SyncError, WalletState, CONSIGN_VERSION,
82};
83pub use hypersonic::*;
84pub use pile::{OpRels, Pile, Witness, WitnessStatus};
85pub use rgb::*;
86pub use stockpile::Stockpile;
87pub use util::{ContractRef, InvalidContractRef};