-
Notifications
You must be signed in to change notification settings - Fork 3
feat: add get-transaction examples #361
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 8 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
9b64811
feat: add get-transaction examples
thibault-martinez 742007b
add python example
thibault-martinez df70322
add go example
thibault-martinez 4a04480
kotlin example (can't test it locally)
thibault-martinez 4453748
import digest
thibault-martinez 5af4e11
add tests
thibault-martinez 885fcc8
devnet
thibault-martinez 95a96e6
Merge branch 'develop' into add-get-tx-examples
thibault-martinez 1f00c69
remove signatures from TransactionBlockWithEffects
thibault-martinez 8140c2d
remove comment
thibault-martinez File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| // Copyright (c) 2025 IOTA Stiftung | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| package main | ||
|
|
||
| import ( | ||
| "fmt" | ||
| "log" | ||
|
|
||
| sdk "bindings/iota_sdk_ffi" | ||
| ) | ||
|
|
||
| func main() { | ||
| client := sdk.GraphQlClientNewDevnet() | ||
| digest, err := sdk.DigestFromBase58("Agug2GETToZj4Ncw3RJn2KgDUEpVQKG1WaTZVcLcqYnf") | ||
| if err != nil { | ||
| log.Fatalf("Failed to parse digest: %v", err) | ||
| } | ||
|
|
||
| signed_transaction, err := client.Transaction(digest) | ||
| if err.(*sdk.SdkFfiError) != nil { | ||
| log.Fatalf("Failed to get transaction: %v", err) | ||
| } | ||
| fmt.Printf("Signed Transaction: %v\n", signed_transaction); | ||
|
|
||
| transaction_effects, err := client.TransactionEffects(digest) | ||
| if err.(*sdk.SdkFfiError) != nil { | ||
| log.Fatalf("Failed to get transaction effects: %v", err) | ||
| } | ||
| fmt.Printf("Transaction Effects: %v\n", transaction_effects); | ||
|
|
||
| transaction_data_effects, err := client.TransactionDataEffects(digest) | ||
| if err.(*sdk.SdkFfiError) != nil { | ||
| log.Fatalf("Failed to get transaction data effects: %v", err) | ||
| } | ||
| fmt.Printf("Transaction Data Effects: %v\n", transaction_data_effects); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| // Copyright (c) 2025 IOTA Stiftung | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| import iota_sdk.GraphQlClient | ||
| import iota_sdk.Digest | ||
| import kotlinx.coroutines.runBlocking | ||
|
|
||
| fun main() = runBlocking { | ||
| try { | ||
| val client = GraphQlClient.newDevnet() | ||
| val digest = Digest.fromBase58("Agug2GETToZj4Ncw3RJn2KgDUEpVQKG1WaTZVcLcqYnf") | ||
|
|
||
| val signedTransaction = client.transaction(digest) | ||
| println("Signed Transaction: ${signedTransaction?.toString()}\n") | ||
|
|
||
| val transactionEffects = client.transactionEffects(digest) | ||
| println("Transaction Effects: ${transactionEffects?.toString()}\n") | ||
|
|
||
| val transactionDataEffects = client.transactionDataEffects(digest) | ||
| println("Transaction Data Effects: ${transactionDataEffects?.toString()}\n") | ||
| } catch (e: Exception) { | ||
| e.printStackTrace() | ||
| kotlin.system.exitProcess(1) | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| # Copyright (c) 2025 IOTA Stiftung | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| from lib.iota_sdk_ffi import * | ||
|
|
||
| import asyncio | ||
|
|
||
| async def main(): | ||
| client = GraphQlClient.new_devnet() | ||
| digest = Digest.from_base58("Agug2GETToZj4Ncw3RJn2KgDUEpVQKG1WaTZVcLcqYnf") | ||
|
|
||
| signed_transaction = await client.transaction(digest) | ||
| print(f"Signed Transaction: `{signed_transaction}`\n") | ||
|
|
||
| transaction_effects = await client.transaction_effects(digest) | ||
| print(f"Transaction Effects: `{transaction_effects}`\n") | ||
|
|
||
| transaction_data_effects = await client.transaction_data_effects(digest) | ||
| print(f"Transaction Data Effects: `{transaction_data_effects}`\n") | ||
|
|
||
| if __name__ == "__main__": | ||
| asyncio.run(main()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| // Copyright (c) 2025 IOTA Stiftung | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| use iota_graphql_client::{Client, error::Result}; | ||
| use iota_types::Digest; | ||
|
|
||
| #[tokio::main] | ||
| async fn main() -> Result<()> { | ||
| let client = Client::new_devnet(); | ||
| let digest = Digest::from_base58("Agug2GETToZj4Ncw3RJn2KgDUEpVQKG1WaTZVcLcqYnf")?; | ||
|
|
||
| let signed_transaction = client.transaction(digest).await?.expect("tx not found"); | ||
| println!("Signed Transaction: {signed_transaction:#?}\n"); | ||
|
|
||
| let transaction_effects = client | ||
| .transaction_effects(digest) | ||
| .await? | ||
| .expect("tx not found"); | ||
| println!("Transaction Effects: {transaction_effects:#?}\n"); | ||
|
|
||
| let transaction_data_effects = client | ||
| .transaction_data_effects(digest) | ||
| .await? | ||
| .expect("tx not found"); | ||
| println!("Transaction Data Effects: {transaction_data_effects:#?}"); | ||
|
|
||
| Ok(()) | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.