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
5,911 changes: 0 additions & 5,911 deletions bindings/python/lib/iota_graphql_client.py

This file was deleted.

14,778 changes: 10,932 additions & 3,846 deletions bindings/python/lib/iota_sdk_ffi.py

Large diffs are not rendered by default.

13,539 changes: 0 additions & 13,539 deletions bindings/python/lib/iota_sdk_types.py

This file was deleted.

17 changes: 9 additions & 8 deletions bindings/python/test.py
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@
from lib.iota_graphql_client import Direction
from lib.iota_sdk_ffi import GraphQlClient, PaginationFilter
from lib.iota_sdk_types import address_from_hex, ObjectReference
from lib.iota_sdk_ffi import GraphQlClient, PaginationFilter, Address, Direction, TransactionsFilter, ObjectId, EventFilter
import asyncio

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

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

coins = await client.coins(
my_address,
PaginationFilter(direction=Direction.FORWARD, cursor=None, limit=None)
PaginationFilter(direction=Direction.forward(), cursor=None, limit=None)
)
my_coins = []
for coin in coins.data():
print(f'ID = 0x{coin.id.hex()} Balance = {coin.balance}')
print(f'ID = 0x{coin.id().to_hex()} Balance = {coin.balance()}')

balance = await client.balance(my_address)

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

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

filter=EventFilter(sender=my_address)


if __name__ == '__main__':
asyncio.run(main())
63 changes: 34 additions & 29 deletions crates/iota-graphql-client-build/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ input CheckpointId {
Some 0x2::coin::Coin Move object.
"""
type Coin implements IMoveObject & IObject & IOwner {
address: IotaAddress!
objectId: ObjectId!
"""
Objects owned by this object, optionally `filter`-ed.
"""
Expand Down Expand Up @@ -678,7 +678,7 @@ type CoinEdge {
The metadata for a coin type.
"""
type CoinMetadata implements IMoveObject & IObject & IOwner {
address: IotaAddress!
objectId: ObjectId!
"""
Objects owned by this object, optionally `filter`-ed.
"""
Expand Down Expand Up @@ -1646,11 +1646,11 @@ type Linkage {
"""
The ID on-chain of the first version of the dependency.
"""
originalId: IotaAddress!
originalId: ObjectId!
"""
The ID on-chain of the version of the dependency that this package depends on.
"""
upgradedId: IotaAddress!
upgradedId: ObjectId!
"""
The version of the dependency that this package depends on.
"""
Expand Down Expand Up @@ -1742,8 +1742,8 @@ The contents of a Move Value, corresponding to the following recursive type:

type MoveData =
{ Address: IotaAddress }
| { UID: IotaAddress }
| { ID: IotaAddress }
| { UID: ObjectId }
| { ID: ObjectId }
| { Bool: bool }
| { Number: BigInt }
| { String: string }
Expand Down Expand Up @@ -2048,7 +2048,7 @@ The representation of an object as a Move Object, which exposes additional infor
(content, module that governs it, version, is transferrable, etc.) about this object.
"""
type MoveObject implements IMoveObject & IObject & IOwner {
address: IotaAddress!
objectId: ObjectId!
"""
Objects owned by this object, optionally `filter`-ed.
"""
Expand Down Expand Up @@ -2658,7 +2658,7 @@ with fields) with additional metadata detailing its id, version, transaction dig
field indicating how this object can be accessed.
"""
type Object implements IObject & IOwner {
address: IotaAddress!
objectId: ObjectId!
"""
Objects owned by this object, optionally `filter`-ed.
"""
Expand Down Expand Up @@ -2796,7 +2796,7 @@ type ObjectChange {
"""
The address of the object that has changed.
"""
address: IotaAddress!
objectId: ObjectId!
"""
The contents of the object immediately before the transaction.
"""
Expand Down Expand Up @@ -2897,11 +2897,11 @@ input ObjectFilter {
"""
Filter for live objects by their IDs.
"""
objectIds: [IotaAddress!]
objectIds: [ObjectId!]
}

input ObjectKey {
objectId: IotaAddress!
objectId: ObjectId!
version: UInt53!
}

Expand All @@ -2926,7 +2926,7 @@ input ObjectRef {
"""
ID of the object.
"""
address: IotaAddress!
objectId: ObjectId!
"""
Version or sequence number of the object.
"""
Expand Down Expand Up @@ -2984,7 +2984,7 @@ type OwnedOrImmutable {
"""
ID of the object being read.
"""
address: IotaAddress!
objectId: ObjectId!
"""
Version of the object being read.
"""
Expand Down Expand Up @@ -3277,7 +3277,7 @@ type Query {
The object corresponding to the given address at the (optionally) given version.
When no version is given, the latest version is returned.
"""
object(address: IotaAddress!, version: UInt53): Object
object(objectId: ObjectId!, version: UInt53): Object
"""
The package corresponding to the given address (at the optionally given version).

Expand Down Expand Up @@ -3457,7 +3457,7 @@ type Receiving {
"""
ID of the object being read.
"""
address: IotaAddress!
objectId: ObjectId!
"""
Version of the object being read.
"""
Expand Down Expand Up @@ -3620,7 +3620,7 @@ type Shared {
A Move object that's shared.
"""
type SharedInput {
address: IotaAddress!
objectId: ObjectId!
"""
The version that this this object was shared at.
"""
Expand All @@ -3642,7 +3642,7 @@ type SharedObjectCancelled {
"""
ID of the shared object.
"""
address: IotaAddress!
objectId: ObjectId!
"""
The assigned shared object version. It is a special version indicating transaction cancellation reason.
"""
Expand All @@ -3657,7 +3657,7 @@ type SharedObjectDelete {
"""
ID of the shared object.
"""
address: IotaAddress!
objectId: ObjectId!
"""
The version of the shared object that was assigned to this transaction during by consensus,
during sequencing.
Expand All @@ -3677,7 +3677,7 @@ type SharedObjectRead {
"""
ID of the object being read.
"""
address: IotaAddress!
objectId: ObjectId!
"""
Version of the object being read.
"""
Expand Down Expand Up @@ -3760,7 +3760,7 @@ type StakeSubsidy {
Represents a `0x3::staking_pool::StakedIota` Move object on-chain.
"""
type StakedIota implements IMoveObject & IObject & IOwner {
address: IotaAddress!
objectId: ObjectId!
"""
Objects owned by this object, optionally `filter`-ed.
"""
Expand Down Expand Up @@ -3907,7 +3907,7 @@ type StakedIota implements IMoveObject & IObject & IOwner {
"""
The object id of the validator staking pool this stake belongs to.
"""
poolId: IotaAddress
poolId: ObjectId
"""
The IOTA that was initially staked.
"""
Expand Down Expand Up @@ -3987,8 +3987,13 @@ String containing 32B hex-encoded address, with a leading "0x". Leading zeroes c
"""
scalar IotaAddress

"""
String containing 32B hex-encoded address, with a leading "0x". Leading zeroes can be omitted on input but will always appear in outputs.
"""
scalar ObjectId

type IotaNSRegistration implements IMoveObject & IObject & IOwner {
address: IotaAddress!
objectId: ObjectId!
"""
Objects owned by this object, optionally `filter`-ed.
"""
Expand Down Expand Up @@ -4379,15 +4384,15 @@ input TransactionBlockFilter {
This filter will be removed with 1.36.0 (2024-10-14), or at least one release after
`affectedObject` is introduced, whichever is later.
"""
inputObject: IotaAddress
inputObject: ObjectId
"""
Limit to transactions that output a versioon of this object. NOTE: this input filter has
been deprecated in favor of `affectedObject` which offers an easier to understand behavor.

This filter will be removed with 1.36.0 (2024-10-14), or at least one release after
`affectedObject` is introduced, whichever is later.
"""
changedObject: IotaAddress
changedObject: ObjectId
"""
Select transactions by their digest.
"""
Expand Down Expand Up @@ -4601,7 +4606,7 @@ type Validator {
"""
The ID of this validator's `0x3::staking_pool::StakingPool`.
"""
stakingPoolId: IotaAddress!
stakingPoolId: ObjectId!
"""
The validator's current exchange object. The exchange rate is used to determine
the amount of IOTA tokens that each past IOTA staker can withdraw in the future.
Expand Down Expand Up @@ -4745,7 +4750,7 @@ type ValidatorSet {
"""
Object ID of the wrapped object `TableVec` storing the pending active validators.
"""
pendingActiveValidatorsId: IotaAddress
pendingActiveValidatorsId: ObjectId
"""
Size of the pending active validators table.
"""
Expand All @@ -4755,23 +4760,23 @@ type ValidatorSet {
of the corresponding validators. This is needed because a validator's address
can potentially change but the object ID of its pool will not.
"""
stakingPoolMappingsId: IotaAddress
stakingPoolMappingsId: ObjectId
"""
Size of the stake pool mappings `Table`.
"""
stakingPoolMappingsSize: Int
"""
Object ID of the `Table` storing the inactive staking pools.
"""
inactivePoolsId: IotaAddress
inactivePoolsId: ObjectId
"""
Size of the inactive pools `Table`.
"""
inactivePoolsSize: Int
"""
Object ID of the `Table` storing the validator candidates.
"""
validatorCandidatesId: IotaAddress
validatorCandidatesId: ObjectId
"""
Size of the validator candidates `Table`.
"""
Expand Down
5 changes: 0 additions & 5 deletions crates/iota-graphql-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ serde = { version = "1.0.144" }
serde_json = { version = "1.0.95" }
tokio = { version = "1.36.0", features = ["time"] }
tracing = "0.1.37"
uniffi = { version = "0.29", features = ["cli", "tokio"], optional = true }
url = "2.5.3"

[dev-dependencies]
Expand All @@ -34,7 +33,3 @@ tokio = { version = "1.40.0", features = ["full"] }

[build-dependencies]
iota-graphql-client-build = { version = "0.0.1", path = "../iota-graphql-client-build" }

[features]
default = []
uniffi = ["dep:uniffi", "iota-types/uniffi"]
10 changes: 0 additions & 10 deletions crates/iota-graphql-client/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ pub type Result<T, E = Error> = std::result::Result<T, E>;
/// General error type for the client. It is used to wrap all the possible
/// errors that can occur.
#[derive(Debug)]
#[cfg_attr(feature = "uniffi", derive(uniffi::Object), uniffi::export(Display))]
pub struct Error {
inner: Box<InnerError>,
}
Expand All @@ -33,7 +32,6 @@ struct InnerError {
}

#[derive(Debug, Copy, Clone)]
#[cfg_attr(feature = "uniffi", derive(uniffi::Enum))]
#[non_exhaustive]
pub enum Kind {
Deserialization,
Expand All @@ -48,14 +46,6 @@ impl std::error::Error for Error {
}
}

#[cfg_attr(feature = "uniffi", uniffi::export)]
impl Error {
/// Returns the kind of error.
pub fn kind(&self) -> Kind {
self.inner.kind
}
}

impl Error {
/// Original GraphQL query errors.
pub fn graphql_errors(&self) -> Option<&[GraphQlError]> {
Expand Down
5 changes: 0 additions & 5 deletions crates/iota-graphql-client/src/faucet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ struct BatchStatusFaucetResponse {
}

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
#[cfg_attr(feature = "uniffi", derive(uniffi::Enum))]
#[serde(rename_all = "UPPERCASE")]
pub enum BatchSendStatusType {
Inprogress,
Expand All @@ -46,21 +45,17 @@ pub enum BatchSendStatusType {
}

#[derive(Serialize, Deserialize, Debug, Clone)]
#[cfg_attr(feature = "uniffi", derive(uniffi::Record))]
pub struct BatchSendStatus {
pub status: BatchSendStatusType,
#[cfg_attr(feature = "uniffi", uniffi(default = None))]
pub transferred_gas_objects: Option<FaucetReceipt>,
}

#[derive(Serialize, Deserialize, Debug, Clone)]
#[cfg_attr(feature = "uniffi", derive(uniffi::Record))]
pub struct FaucetReceipt {
pub sent: Vec<CoinInfo>,
}

#[derive(Serialize, Deserialize, Debug, Clone)]
#[cfg_attr(feature = "uniffi", derive(uniffi::Record))]
#[serde(rename_all = "camelCase")]
pub struct CoinInfo {
pub amount: u64,
Expand Down
Loading
Loading