#![cfg_attr(not(feature = "std"), no_std)]
use parity_scale_codec::{Codec, Decode, Encode, MaxEncodedLen};
use scale_info::TypeInfo;
use sp_std::vec::Vec;
mod did_details;
mod service_endpoint;
pub use did_details::*;
pub use service_endpoint::*;
#[derive(Encode, Decode, TypeInfo, Eq, PartialEq)]
pub struct DidLinkedInfo<
DidIdentifier,
AccountId,
LinkableAccountId,
Web3Name,
Id,
Type,
Url,
Balance,
Key: Ord,
BlockNumber,
> {
pub identifier: DidIdentifier,
pub accounts: Vec<LinkableAccountId>,
pub w3n: Option<Web3Name>,
pub service_endpoints: Vec<ServiceEndpoint<Id, Type, Url>>,
pub details: DidDetails<Key, BlockNumber, AccountId, Balance>,
}
pub type RawDidLinkedInfo<DidIdentifier, AccountId, LinkableAccountId, Balance, Key, BlockNumber> = DidLinkedInfo<
DidIdentifier,
AccountId,
LinkableAccountId,
Vec<u8>,
Vec<u8>,
Vec<u8>,
Vec<u8>,
Balance,
Key,
BlockNumber,
>;
sp_api::decl_runtime_apis! {
#[api_version(2)]
pub trait Did<DidIdentifier, AccountId, LinkableAccountId, Balance, Key: Ord, BlockNumber: MaxEncodedLen> where
DidIdentifier: Codec,
AccountId: Codec,
LinkableAccountId: Codec,
BlockNumber: Codec,
Key: Codec,
Balance: Codec,
{
#[changed_in(2)]
fn query_by_web3_name(name: Vec<u8>) -> Option<RawDidLinkedInfo<DidIdentifier, AccountId, AccountId, Balance, Key, BlockNumber>>;
fn query_by_web3_name(name: Vec<u8>) -> Option<RawDidLinkedInfo<DidIdentifier, AccountId, LinkableAccountId, Balance, Key, BlockNumber>>;
#[changed_in(2)]
fn query_by_account(account: AccountId) -> Option<RawDidLinkedInfo<DidIdentifier, AccountId, AccountId, Balance, Key, BlockNumber>>;
fn query_by_account(account: LinkableAccountId) -> Option<RawDidLinkedInfo<DidIdentifier, AccountId, LinkableAccountId, Balance, Key, BlockNumber>>;
#[changed_in(2)]
fn query(did: DidIdentifier) -> Option<RawDidLinkedInfo<DidIdentifier, AccountId, AccountId, Balance, Key, BlockNumber>>;
fn query(did: DidIdentifier) -> Option<RawDidLinkedInfo<DidIdentifier, AccountId, LinkableAccountId, Balance, Key, BlockNumber>>;
}
}