Skip to main content

rgb/
lib.rs

1// RGB API library for smart contracts on Bitcoin & Lightning network
2//
3// SPDX-License-Identifier: Apache-2.0
4//
5// Written in 2019-2023 by
6//     Dr Maxim Orlovsky <orlovsky@lnp-bp.org>
7//
8// Copyright (C) 2019-2023 LNP/BP Standards Association. All rights reserved.
9//
10// Licensed under the Apache License, Version 2.0 (the "License");
11// you may not use this file except in compliance with the License.
12// You may obtain a copy of the License at
13//
14//     http://www.apache.org/licenses/LICENSE-2.0
15//
16// Unless required by applicable law or agreed to in writing, software
17// distributed under the License is distributed on an "AS IS" BASIS,
18// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19// See the License for the specific language governing permissions and
20// limitations under the License.
21
22#[macro_use]
23extern crate amplify;
24#[cfg(feature = "serde")]
25#[macro_use]
26extern crate serde_crate as serde;
27
28#[cfg(feature = "bdk")]
29mod bdk_provider;
30#[cfg(feature = "bp")]
31mod bp_provider;
32mod descriptor;
33mod filters;
34pub mod pay;
35mod errors;
36mod wallet;
37
38#[cfg(feature = "bp")]
39pub use descriptor::bp_wallet_integration;
40pub use descriptor::{DescriptorRgb, RgbDescr, TapretKey, WpkhDescr};
41pub use errors::{CompletionError, CompositionError, PayError, WalletError};
42pub use pay::{TransferParams, WalletProvider};
43pub use rgbstd::*;
44pub mod resolvers {
45    pub use rgbstd::indexers::AnyResolver;
46    #[cfg(any(
47        feature = "electrum_blocking",
48        feature = "esplora_blocking",
49        feature = "mempool_blocking"
50    ))]
51    pub use rgbstd::indexers::*;
52    use rgbstd::ChainNet;
53
54    use super::validation::{ResolveWitness, WitnessResolverError, WitnessStatus};
55    use super::Txid;
56
57    pub struct ContractIssueResolver;
58    impl ResolveWitness for ContractIssueResolver {
59        fn resolve_witness(&self, _: Txid) -> Result<WitnessStatus, WitnessResolverError> {
60            panic!("contract issue resolver must not be used for an already-existing contracts")
61        }
62        fn check_chain_net(&self, _: ChainNet) -> Result<(), WitnessResolverError> {
63            panic!("contract issue resolver must not be used for an already-existing contracts")
64        }
65    }
66}
67pub use filters::WalletFilter;
68pub use wallet::RgbWallet;