4

So I wonna monitor an address or more to print in my terminal each time there's a transaction...

I used the solana-py library method

signatures = client.get_signature_for_address(address, limit=1).value[0].signature

and then

client.get_transaction(signature, max_supported....=0)

This seem not to detect transactions and if it does it only brings up failed transactions , is my approach not correct or there's some more stuff I need to do

EDIT:

from solana.rpc.api import Client from solders.pubkey import Pubkey client = Client("https://api.mainnet-beta.solana.com")

tkn_pub_key = Pubkey.from_string('DySLzKey6Aqwaydi3QgpauewUtKjURaAza4rJZxkznHN') #get signatures signatures = client.get_signatures_for_address(tkn_pub_key, limit=20).value[0].signature

tx_details = client.get_transaction(signatures, max_supported_transaction_version=0)

trx_meta = tx_details.value.transaction.meta

if trx_meta.inner_instructions and trx_meta.inner_instructions[0]: print(tx_details.value.transaction.meta)

i enclose this in a while loop with 5seconds sleep time

2
  • A reproducible example would help answer this
    – KevinH
    Commented Mar 1, 2023 at 18:47
  • from solana.rpc.api import Client from solders.pubkey import Pubkey client = Client("api.mainnet-beta.solana.com") tkn_pub_key = Pubkey.from_string('DySLzKey6Aqwaydi3QgpauewUtKjURaAza4rJZxkznHN') #get signatures signatures = client.get_signatures_for_address(tkn_pub_key, limit=20).value[0].signature tx_details = client.get_transaction(signatures, max_supported_transaction_version=0) trx_meta = tx_details.value.transaction.meta if trx_meta.inner_instructions and trx_meta.inner_instructions[0]: print(tx_details.value.transaction.meta)
    – thewise
    Commented Mar 1, 2023 at 21:42

1 Answer 1

2

To preface this answer, I am employed by Helius.

Depending on how you are using this, you could use a combination of webhooks + https://tailscale.com/blog/tailscale-vscode/ which would allow you to get a domain for your localhost. I.e you could get the data streamlined to your terminal.

Check out Helius to setup a webhook for free here, and just paste in the URL produced from tailscale: https://dev.helius.xyz/dashboard/app

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.