Skip to main content

bp_idn/
lib.rs

1/*
2 * Copyright 2025 by Ideal Labs, LLC
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *     http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17//! Primitives of IDN runtime.
18
19#![cfg_attr(not(feature = "std"), no_std)]
20
21pub mod constants;
22pub mod impls;
23pub mod types;
24
25use frame_support::pallet_prelude::{Decode, Encode, TypeInfo};
26use types::{CreateSubParams, QuoteSubParams, SubInfoRequest, SubscriptionId, UpdateSubParams};
27
28/// A minimized version of `pallet-idn-manager::Call` that can be used without a runtime.
29#[derive(Encode, Decode, Debug, PartialEq, Clone, TypeInfo)]
30#[allow(non_camel_case_types)]
31pub enum IdnManagerCall {
32	/// `pallet-idn-manager::Call::create_subscription`
33	#[codec(index = 0)]
34	create_subscription { params: CreateSubParams },
35	/// `pallet-idn-manager::Call::pause_subscription`
36	#[codec(index = 1)]
37	pause_subscription { sub_id: SubscriptionId },
38	/// `pallet-idn-manager::Call::kill_subscription`
39	#[codec(index = 2)]
40	kill_subscription { sub_id: SubscriptionId },
41	/// `pallet-idn-manager::Call::update_subscription`
42	#[codec(index = 3)]
43	update_subscription { params: UpdateSubParams },
44	/// `pallet-idn-manager::Call::reactivate_subscription`
45	#[codec(index = 4)]
46	reactivate_subscription { sub_id: SubscriptionId },
47	/// `pallet-idn-manager::Call::quote_subscription`
48	#[codec(index = 5)]
49	quote_subscription { params: QuoteSubParams },
50	/// `pallet-idn-manager::Call::get_subscription_info`
51	#[codec(index = 6)]
52	get_subscription_info { req: SubInfoRequest },
53}
54
55/// `Idn` Runtime `Call` enum.
56///
57/// This enum is used to define the different calls that can be made to the IDN runtime.
58#[derive(Encode, Decode, Debug, PartialEq, Clone, TypeInfo)]
59pub enum Call {
60	// This must match the index of the IDN Manager pallet in the runtime
61	#[codec(index = 40)]
62	IdnManager(IdnManagerCall),
63}