Fix Python Solana transfer examples: imports, f-strings, and network …#625
Open
stackoverflowed1 wants to merge 1 commit intocoinbase:mainfrom
Open
Fix Python Solana transfer examples: imports, f-strings, and network …#625stackoverflowed1 wants to merge 1 commit intocoinbase:mainfrom
stackoverflowed1 wants to merge 1 commit intocoinbase:mainfrom
Conversation
…typo This PR fixes several issues in the Python Solana transfer examples to make them self-contained and functional: Added missing import: LAMPORTS_PER_SOL is now imported from solana.rpc.types to correctly compute SOL amounts. Fixed transaction confirmation printing: Removed JavaScript-style .toString() from confirmation.value.err. Fixed f-string in explorer URL: replaced https://explorer.solana.com/tx/${signature}?cluster=devnet with the correct Python f-string https://explorer.solana.com/tx/{signature}?cluster=devnet. Corrected network specification: In the SOL transfer example, network=connection is used to pass the actual SolanaClient instance. In the USDC transfer example, network="devnet" is specified, fixing the previous typo "devet". This ensures the SDK resolves the correct Devnet RPC endpoint. These changes ensure that both examples are functional, Pythonic, and match the intended usage of the SDK.
🟡 Heimdall Review Status
|
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
This PR fixes several issues in the Python Solana transfer examples to make them self-contained and functional:
Added missing import:
LAMPORTS_PER_SOLis now imported fromsolana.rpc.typesto correctly compute SOL amounts.Fixed transaction confirmation printing:
Removed JavaScript-style
.toString()fromconfirmation.value.err.Fixed f-string in explorer URL: replaced
https://explorer.solana.com/tx/${signature}?cluster=devnetwith the correct Python f-stringhttps://explorer.solana.com/tx/{signature}?cluster=devnet.Corrected network specification:
The USDC transfer example currently specifies
“network=devet”, which is a typo. I have corrected it to“network=devnet”Fixed
confirm_transactionargument formatting:Replaced the JS-style positional dict with a proper Python dictionary:
{ "signature": signature, "blockhash": blockhash, "lastValidBlockHeight": lastValidBlockHeight, }This ensures Python interprets the transaction confirmation parameters correctly, avoiding any runtime errors.
Checklist
A couple of things to include in your PR for completeness: