Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4,260 changes: 1,897 additions & 2,363 deletions bindings/python/lib/iota_sdk_ffi.py

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bindings/python/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ async def main():
my_address,
PaginationFilter(direction=Direction.FORWARD, cursor=None, limit=None)
)
for coin in coins.data():
for coin in coins.data:
print(f'ID = 0x{coin.id().to_hex()} Balance = {coin.balance()}')

balance = await client.balance(my_address)
Expand Down
2 changes: 1 addition & 1 deletion crates/iota-graphql-client/src/query_types/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ mod transaction;

pub use active_validators::{
ActiveValidatorsArgs, ActiveValidatorsQuery, EpochValidator, Validator, ValidatorConnection,
ValidatorSet,
ValidatorCredentials, ValidatorSet,
};
pub use balance::{Balance, BalanceArgs, BalanceQuery, Owner};
pub use chain::ChainIdentifierQuery;
Expand Down
1 change: 1 addition & 0 deletions crates/iota-sdk-ffi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ name = "iota_sdk_ffi"
crate-type = ["lib", "cdylib"]

[dependencies]
base64ct = { version = "1.6.0", features = ["alloc", "std"] }
derive_more = { version = "2.0", features = ["from", "deref"] }
rand = "0.8"
serde_json = "1.0.95"
Expand Down
58 changes: 24 additions & 34 deletions crates/iota-sdk-ffi/src/graphql.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

use std::sync::Arc;

use iota_graphql_client::pagination::PaginationFilter;
use iota_types::CheckpointSequenceNumber;
use tokio::sync::RwLock;

Expand All @@ -14,8 +15,8 @@ use crate::{
digest::{CheckpointContentsDigest, CheckpointDigest, TransactionDigest},
graphql::{
CoinMetadata, DryRunResult, DynamicFieldOutput, Epoch, EventFilter, MoveFunction,
MoveModule, ObjectFilter, PaginationFilter, ProtocolConfigs, ServiceConfig,
TransactionDataEffects, TransactionMetadata, TransactionsFilter,
MoveModule, ObjectFilter, ProtocolConfigs, ServiceConfig, TransactionDataEffects,
TransactionMetadata, TransactionsFilter,
},
object::{MovePackage, Object, ObjectId},
signature::UserSignature,
Expand Down Expand Up @@ -127,7 +128,7 @@ impl GraphQLClient {
.0
.read()
.await
.active_validators(epoch, pagination_filter.into())
.active_validators(epoch, pagination_filter)
.await?
.map(Into::into)
.into())
Expand Down Expand Up @@ -184,7 +185,7 @@ impl GraphQLClient {
.0
.read()
.await
.coins(**owner, coin_type, pagination_filter.into())
.coins(**owner, coin_type, pagination_filter)
.await?
.map(Into::into)
.into())
Expand Down Expand Up @@ -238,7 +239,7 @@ impl GraphQLClient {
.0
.read()
.await
.checkpoints(pagination_filter.into())
.checkpoints(pagination_filter)
.await?
.map(Into::into)
.into())
Expand Down Expand Up @@ -312,7 +313,7 @@ impl GraphQLClient {
.0
.read()
.await
.events(filter.map(|f| f.into()), pagination_filter.into())
.events(filter.map(|f| f.into()), pagination_filter)
.await?
.map(Into::into)
.into())
Expand Down Expand Up @@ -352,7 +353,7 @@ impl GraphQLClient {
///
/// ```rust,ignore
/// let filter = ObjectFilter {
/// type_: None,
/// type_tag: None,
/// owner: Some(Address::from_str("test").unwrap().into()),
/// object_ids: None,
/// };
Expand All @@ -363,13 +364,13 @@ impl GraphQLClient {
pub async fn objects(
&self,
pagination_filter: PaginationFilter,
filter: Option<Arc<ObjectFilter>>,
filter: Option<ObjectFilter>,
) -> Result<ObjectPage> {
Ok(self
.0
.read()
.await
.objects(filter.map(|f| f.0.clone()), pagination_filter.into())
.objects(filter.map(Into::into), pagination_filter)
.await?
.map(Into::into)
.into())
Expand Down Expand Up @@ -446,12 +447,7 @@ impl GraphQLClient {
.0
.read()
.await
.package_versions(
**address,
pagination_filter.into(),
after_version,
before_version,
)
.package_versions(**address, pagination_filter, after_version, before_version)
.await?
.map(Into::into)
.into())
Expand Down Expand Up @@ -489,11 +485,7 @@ impl GraphQLClient {
.0
.read()
.await
.packages(
pagination_filter.into(),
after_checkpoint,
before_checkpoint,
)
.packages(pagination_filter, after_checkpoint, before_checkpoint)
.await?
.map(Into::into)
.into())
Expand Down Expand Up @@ -559,7 +551,7 @@ impl GraphQLClient {
.0
.read()
.await
.transactions(filter.map(Into::into), pagination_filter.into())
.transactions(filter.map(Into::into), pagination_filter)
.await?
.map(Into::into)
.into())
Expand All @@ -576,7 +568,7 @@ impl GraphQLClient {
.0
.read()
.await
.transactions_effects(filter.map(Into::into), pagination_filter.into())
.transactions_effects(filter.map(Into::into), pagination_filter)
.await?
.map(Into::into)
.into())
Expand All @@ -594,7 +586,7 @@ impl GraphQLClient {
.0
.read()
.await
.transactions_data_effects(filter.map(Into::into), pagination_filter.into())
.transactions_data_effects(filter.map(Into::into), pagination_filter)
.await?
.map(Into::into)
.into())
Expand Down Expand Up @@ -687,10 +679,10 @@ impl GraphQLClient {
package,
module,
version,
pagination_filter_enums.into(),
pagination_filter_friends.into(),
pagination_filter_functions.into(),
pagination_filter_structs.into(),
pagination_filter_enums,
pagination_filter_friends,
pagination_filter_functions,
pagination_filter_structs,
)
.await?
.map(Into::into)
Expand Down Expand Up @@ -726,15 +718,14 @@ impl GraphQLClient {
address: &Address,
type_tag: &TypeTag,
name: serde_json::Value,
) -> Result<Option<Arc<DynamicFieldOutput>>> {
) -> Result<Option<DynamicFieldOutput>> {
Ok(self
.0
.read()
.await
.dynamic_field(**address, type_tag.0.clone(), name)
.await?
.map(Into::into)
.map(Arc::new))
.map(Into::into))
}

/// Access a dynamic object field on an object using its name. Names are
Expand All @@ -750,15 +741,14 @@ impl GraphQLClient {
address: &Address,
type_tag: &TypeTag,
name: serde_json::Value,
) -> Result<Option<Arc<DynamicFieldOutput>>> {
) -> Result<Option<DynamicFieldOutput>> {
Ok(self
.0
.read()
.await
.dynamic_object_field(**address, type_tag.0.clone(), name)
.await?
.map(Into::into)
.map(Arc::new))
.map(Into::into))
}

/// Get a page of dynamic fields for the provided address. Note that this
Expand All @@ -774,7 +764,7 @@ impl GraphQLClient {
.0
.read()
.await
.dynamic_fields(**address, pagination_filter.into())
.dynamic_fields(**address, pagination_filter)
.await?
.map(Into::into)
.into())
Expand Down
Loading