Skip to content
Merged
12,431 changes: 9,168 additions & 3,263 deletions bindings/python/lib/iota_sdk_ffi.py

Large diffs are not rendered by default.

15 changes: 11 additions & 4 deletions bindings/python/test.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
from lib.iota_sdk_ffi import GraphQlClient, PaginationFilter, Address, Direction, TransactionsFilter, ObjectId, EventFilter
from lib.iota_sdk_ffi import GraphQlClient, PaginationFilter, Address, Direction, TransactionsFilter, ObjectId, EventFilter, TransactionDigest
import asyncio

async def main():
client = GraphQlClient.new_devnet()
chain_id = await client.chain_id()
print(chain_id)

my_address=Address.from_hex("0xb14f13f5343641e5b52d144fd6f106a7058efe2f1ad44598df5cda73acf0101f")
my_address = Address.from_hex("0xb14f13f5343641e5b52d144fd6f106a7058efe2f1ad44598df5cda73acf0101f")

coins = await client.coins(
my_address,
Expand All @@ -19,9 +19,16 @@ async def main():

print(f'Total Balance = {balance}')

filter=TransactionsFilter(at_checkpoint=3, input_object=ObjectId.from_hex("0xb14f13f5343641e5b52d144fd6f106a7058efe2f1ad44598df5cda73acf0101f"))
filter = TransactionsFilter(at_checkpoint=3, input_object=ObjectId.from_hex("0xb14f13f5343641e5b52d144fd6f106a7058efe2f1ad44598df5cda73acf0101f"))

filter=EventFilter(sender=my_address)
filter = EventFilter(sender=my_address)

txn = await client.transaction(TransactionDigest.from_base58("HT1wvebXV4LUisLa4aJQEyoxt1HEMqznjf5UtStmdxyM"))

if txn is not None:
for sig in txn.signatures():
print("Scheme: ", sig.scheme(), sig.scheme().value)
print("Sender: ", txn.transaction().sender().to_hex())

if __name__ == '__main__':
asyncio.run(main())
2 changes: 1 addition & 1 deletion crates/iota-sdk-ffi/src/types/checkpoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use std::sync::Arc;
use iota_types::GasCostSummary;

use crate::types::{
crypto::ValidatorCommitteeMember,
crypto::validator::ValidatorCommitteeMember,
digest::{CheckpointContentsDigest, CheckpointDigest, Digest},
};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,45 +1,16 @@
// Copyright (c) 2025 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

use std::sync::Arc;

use crate::error::Result;

/// A member of a Validator Committee
///
/// # BCS
///
/// The BCS serialized form for this type is defined by the following ABNF:
///
/// ```text
/// validator-committee-member = bls-public-key
/// u64 ; stake
/// ```
#[derive(Clone, Debug, uniffi::Record)]
pub struct ValidatorCommitteeMember {
pub public_key: Arc<Bls12381PublicKey>,
pub stake: u64,
}
pub mod multisig;
pub mod passkey;
pub mod validator;
pub mod zklogin;

impl From<iota_types::ValidatorCommitteeMember> for ValidatorCommitteeMember {
fn from(value: iota_types::ValidatorCommitteeMember) -> Self {
Self {
public_key: Arc::new(value.public_key.into()),
stake: value.stake,
}
}
}
use std::sync::Arc;

impl From<ValidatorCommitteeMember> for iota_types::ValidatorCommitteeMember {
fn from(value: ValidatorCommitteeMember) -> Self {
Self {
public_key: **value.public_key,
stake: value.stake,
}
}
}
use crate::{error::Result, types::signature::SimpleSignature};

macro_rules! impl_public_key {
macro_rules! impl_crypto_object {
($(#[$meta:meta])* $t:ident) => {
$(#[$meta])*
#[derive(Copy, Clone, Debug, derive_more::From, derive_more::Deref, uniffi::Object)]
Expand Down Expand Up @@ -70,7 +41,7 @@ macro_rules! impl_public_key {
};
}

impl_public_key!(
impl_crypto_object!(
/// A bls12381 min-sig public key.
///
/// # BCS
Expand All @@ -87,7 +58,7 @@ impl_public_key!(
/// binary form (in bcs) is 97 bytes long vs a more compact 96 bytes.
Bls12381PublicKey
);
impl_public_key!(
impl_crypto_object!(
/// An ed25519 public key.
///
/// # BCS
Expand All @@ -99,7 +70,7 @@ impl_public_key!(
/// ```
Ed25519PublicKey
);
impl_public_key!(
impl_crypto_object!(
/// A secp256k1 signature.
///
/// # BCS
Expand All @@ -111,7 +82,7 @@ impl_public_key!(
/// ```
Secp256k1PublicKey
);
impl_public_key!(
impl_crypto_object!(
/// A secp256r1 signature.
///
/// # BCS
Expand All @@ -123,3 +94,56 @@ impl_public_key!(
/// ```
Secp256r1PublicKey
);
impl_crypto_object!(
/// An ed25519 signature.
///
/// # BCS
///
/// The BCS serialized form for this type is defined by the following ABNF:
///
/// ```text
/// ed25519-signature = 64OCTECT
/// ```
Ed25519Signature
);
impl_crypto_object!(
/// A bls12381 min-sig public key.
///
/// # BCS
///
/// The BCS serialized form for this type is defined by the following ABNF:
///
/// ```text
/// bls-public-key = %x60 96OCTECT
/// ```
///
/// Due to historical reasons, even though a min-sig `Bls12381PublicKey` has a
/// fixed-length of 96, IOTA's binary representation of a min-sig
/// `Bls12381PublicKey` is prefixed with its length meaning its serialized
/// binary form (in bcs) is 97 bytes long vs a more compact 96 bytes.
Bls12381Signature
);
impl_crypto_object!(
/// A secp256k1 public key.
///
/// # BCS
///
/// The BCS serialized form for this type is defined by the following ABNF:
///
/// ```text
/// secp256k1-public-key = 33OCTECT
/// ```
Secp256k1Signature
);
impl_crypto_object!(
/// A secp256r1 public key.
///
/// # BCS
///
/// The BCS serialized form for this type is defined by the following ABNF:
///
/// ```text
/// secp256r1-public-key = 33OCTECT
/// ```
Secp256r1Signature
);
Loading