|
1 | 1 | //! TrUAPI trait and type definitions for the host product SDK. |
2 | 2 | //! |
3 | | -//! Concrete wire types live in per-version modules (currently [`v01`]). |
4 | | -//! Versioned envelopes are in [`versioned`]. |
| 3 | +//! Concrete wire types live in per-version modules. Versioned envelopes are in |
| 4 | +//! [`versioned`]. |
5 | 5 |
|
6 | 6 | #![forbid(unsafe_code)] |
7 | 7 | #![allow(async_fn_in_trait)] |
8 | 8 |
|
9 | | -use std::convert::Infallible; |
10 | | -use std::pin::Pin; |
| 9 | +use core::convert::Infallible; |
| 10 | +use core::pin::Pin; |
| 11 | +use core::task::{Context, Poll}; |
11 | 12 | use std::sync::Arc; |
12 | 13 | use std::sync::atomic::{AtomicBool, Ordering}; |
13 | | -use std::task::{Context, Poll}; |
14 | 14 |
|
15 | 15 | use futures::Stream; |
| 16 | +use parity_scale_codec::{Decode, Encode}; |
16 | 17 |
|
17 | 18 | pub mod api; |
18 | 19 | pub mod v01; |
| 20 | +#[cfg(debug_assertions)] |
| 21 | +pub mod v02; |
19 | 22 | pub mod versioned; |
20 | 23 |
|
| 24 | +pub mod latest { |
| 25 | + pub use crate::v01::{ |
| 26 | + AllocatableResource, GenericError, HostSignPayloadData, NotificationId, ProductAccountId, |
| 27 | + RawPayload, RemotePermission, ThemeVariant, |
| 28 | + }; |
| 29 | + |
| 30 | + pub type HostAccountGetAliasResponse = crate::v01::HostAccountGetAliasResponse; |
| 31 | + pub type HostDevicePermissionRequest = crate::v01::HostDevicePermissionRequest; |
| 32 | + pub type HostDevicePermissionResponse = crate::v01::HostDevicePermissionResponse; |
| 33 | + pub type HostFeatureSupportedRequest = crate::v01::HostFeatureSupportedRequest; |
| 34 | + pub type HostFeatureSupportedResponse = crate::v01::HostFeatureSupportedResponse; |
| 35 | + pub type HostLocalStorageReadError = crate::v01::HostLocalStorageReadError; |
| 36 | + pub type HostNavigateToError = crate::v01::HostNavigateToError; |
| 37 | + pub type HostPushNotificationRequest = crate::v01::HostPushNotificationRequest; |
| 38 | + pub type HostPushNotificationResponse = crate::v01::HostPushNotificationResponse; |
| 39 | + pub type HostRequestResourceAllocationRequest = |
| 40 | + crate::v01::HostRequestResourceAllocationRequest; |
| 41 | + pub type HostSignPayloadRequest = crate::v01::HostSignPayloadRequest; |
| 42 | + pub type HostSignPayloadWithLegacyAccountRequest = |
| 43 | + crate::v01::HostSignPayloadWithLegacyAccountRequest; |
| 44 | + pub type HostSignRawRequest = crate::v01::HostSignRawRequest; |
| 45 | + pub type HostSignRawWithLegacyAccountRequest = crate::v01::HostSignRawWithLegacyAccountRequest; |
| 46 | + pub type LegacyAccountTxPayload = crate::v01::LegacyAccountTxPayload; |
| 47 | + pub type PreimageSubmitError = crate::v01::PreimageSubmitError; |
| 48 | + pub type ProductAccountTxPayload = crate::v01::ProductAccountTxPayload; |
| 49 | + pub type RemotePermissionRequest = crate::v01::RemotePermissionRequest; |
| 50 | + pub type RemotePermissionResponse = crate::v01::RemotePermissionResponse; |
| 51 | +} |
| 52 | + |
21 | 53 | pub use truapi_macros::wire; |
22 | 54 |
|
23 | 55 | /// Per-message id carried from the transport frame. |
24 | 56 | pub type RequestId = String; |
25 | 57 |
|
26 | 58 | /// Framework-level outcomes shared by API methods. |
27 | | -#[derive(Debug, Clone, PartialEq, Eq)] |
| 59 | +#[derive(Debug, Clone, PartialEq, Eq, Encode, Decode)] |
28 | 60 | pub enum CallError<D> { |
29 | 61 | /// Method-specific failure. |
30 | 62 | Domain(D), |
|
0 commit comments