1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
use subxt::{ClientBuilder, Config, DefaultConfig, PolkadotExtrinsicParams};
#[subxt::subxt(runtime_metadata_path = "metadata.scale")]
pub mod kilt {}
const _: () = {
use kilt::runtime_types::did::did_details::DidEncryptionKey;
impl PartialEq for DidEncryptionKey {
fn eq(&self, other: &Self) -> bool {
self == other
}
}
impl Eq for DidEncryptionKey {}
impl PartialOrd for DidEncryptionKey {
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
match self {
Self::X25519(x) => match other {
Self::X25519(y) => x.as_ref().partial_cmp(y.as_ref()),
},
}
}
}
impl Ord for DidEncryptionKey {
fn cmp(&self, other: &Self) -> std::cmp::Ordering {
match self {
Self::X25519(x) => match other {
Self::X25519(y) => x.as_ref().cmp(y.as_ref()),
},
}
}
}
};
pub use kilt::*;
#[derive(Clone, Debug, Default, Eq, PartialEq)]
pub struct KiltConfig;
impl Config for KiltConfig {
type Index = u64;
type BlockNumber = <DefaultConfig as Config>::BlockNumber;
type Hash = <DefaultConfig as Config>::Hash;
type Hashing = <DefaultConfig as Config>::Hashing;
type AccountId = <DefaultConfig as Config>::AccountId;
type Address = <DefaultConfig as Config>::Address;
type Header = <DefaultConfig as Config>::Header;
type Signature = <DefaultConfig as Config>::Signature;
type Extrinsic = <DefaultConfig as Config>::Extrinsic;
}
pub async fn connect<U: Into<String>>(
url: U,
) -> Result<kilt::RuntimeApi<KiltConfig, PolkadotExtrinsicParams<KiltConfig>>, subxt::BasicError> {
let api = ClientBuilder::new()
.set_url(url)
.build()
.await?
.to_runtime_api::<kilt::RuntimeApi<KiltConfig, PolkadotExtrinsicParams<KiltConfig>>>();
Ok(api)
}