Skip to content

Commit 713bb80

Browse files
committed
Prepare public Identity interface for future wasm-bindings
1 parent 60fb304 commit 713bb80

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

identity_iota_core/src/rebased/assets/asset.rs

+5-6
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ use iota_sdk::types::base_types::SequenceNumber;
2424
use iota_sdk::types::id::UID;
2525
use iota_sdk::types::object::Owner;
2626
use iota_sdk::types::TypeTag;
27-
use iota_sdk::IotaClient;
2827
use move_core_types::ident_str;
2928
use move_core_types::language_storage::StructTag;
3029
use secret_storage::Signer;
@@ -69,7 +68,7 @@ where
6968
T: DeserializeOwned,
7069
{
7170
/// Resolves an [`AuthenticatedAsset`] by its ID `id`.
72-
pub async fn get_by_id(id: ObjectID, client: &IotaClient) -> Result<Self, Error> {
71+
pub async fn get_by_id<S>(id: ObjectID, client: &IdentityClient<S>) -> Result<Self, Error> {
7372
let res = client
7473
.read_api()
7574
.get_object_with_options(id, IotaObjectDataOptions::new().with_content())
@@ -89,7 +88,7 @@ where
8988
}
9089

9190
impl<T> AuthenticatedAsset<T> {
92-
async fn object_ref(&self, client: &IotaClient) -> Result<ObjectRef, Error> {
91+
async fn object_ref<S>(&self, client: &IdentityClient<S>) -> Result<ObjectRef, Error> {
9392
client
9493
.read_api()
9594
.get_object_with_options(self.id(), IotaObjectDataOptions::default())
@@ -259,7 +258,7 @@ impl MoveType for TransferProposal {
259258

260259
impl TransferProposal {
261260
/// Resolves a [`TransferProposal`] by its ID `id`.
262-
pub async fn get_by_id(id: ObjectID, client: &IotaClient) -> Result<Self, Error> {
261+
pub async fn get_by_id<S>(id: ObjectID, client: &IdentityClient<S>) -> Result<Self, Error> {
263262
let res = client
264263
.read_api()
265264
.get_object_with_options(id, IotaObjectDataOptions::new().with_content())
@@ -294,7 +293,7 @@ impl TransferProposal {
294293
})
295294
}
296295

297-
async fn asset_metadata(&self, client: &IotaClient) -> anyhow::Result<(ObjectRef, TypeTag)> {
296+
async fn asset_metadata<S>(&self, client: &IdentityClient<S>) -> anyhow::Result<(ObjectRef, TypeTag)> {
298297
let res = client
299298
.read_api()
300299
.get_object_with_options(self.asset_id, IotaObjectDataOptions::default().with_type())
@@ -318,7 +317,7 @@ impl TransferProposal {
318317
Ok((asset_ref, param_type))
319318
}
320319

321-
async fn initial_shared_version(&self, client: &IotaClient) -> anyhow::Result<SequenceNumber> {
320+
async fn initial_shared_version<S>(&self, client: &IdentityClient<S>) -> anyhow::Result<SequenceNumber> {
322321
let owner = client
323322
.read_api()
324323
.get_object_with_options(*self.id.object_id(), IotaObjectDataOptions::default().with_owner())

identity_iota_core/src/rebased/client/full_client.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ impl<S> Deref for IdentityClient<S> {
102102

103103
impl<S> IdentityClient<S>
104104
where
105-
S: Signer<IotaKeySignature>,
105+
S: Signer<IotaKeySignature> + Sync,
106106
{
107107
pub async fn new(client: IdentityClientReadOnly, signer: S) -> Result<Self, Error> {
108108
let public_key = signer

identity_iota_core/src/rebased/error.rs

+3
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,7 @@ pub enum Error {
6565
/// An error caused by either a connection issue or an invalid RPC call.
6666
#[error("RPC error: {0}")]
6767
RpcError(String),
68+
/// An error caused by a bcs serialization or deserialization.
69+
#[error("BCS error: {0}")]
70+
BcsError(#[from] bcs::Error),
6871
}

0 commit comments

Comments
 (0)