GithubHelp home page GithubHelp logo

Comments (7)

kevinheavey avatar kevinheavey commented on August 15, 2024

Can you give a reproducible example please?

from anchorpy.

artaasd95 avatar artaasd95 commented on August 15, 2024

This was the main code. I am just trying to load the accounts from the main program and nothing more. I don't know what do you want exactly

from anchorpy.

kevinheavey avatar kevinheavey commented on August 15, 2024

I'm looking for a minimal reproducible example please https://stackoverflow.com/help/minimal-reproducible-example

from anchorpy.

artaasd95 avatar artaasd95 commented on August 15, 2024

Ok got it,
consider I have submitted multiple accounts using my wallet into the program. I have a program that makes the accounts containing three variables, var1, var2, and var3 (except the authority).
The web interface makes multiple instances of that account:
ac1: var1, var2, var3
ac2: var1, var2, var3
now the network contains the ac1 and ac2, meaning that the program has two accounts.
Now I have the publickey
pubkey = PublicKey("...")
of the program and I want to load and decode those variables(the three variables belong to ac1 and ac2) into my python program.

The client is connected to the program using publickey and tries to load the ac1 and ac2:

accounts = []

for x in http_client.get_program_accounts_json_parsed(pubkey).value:
	accounts.append(x.account)

from anchorpy.

kevinheavey avatar kevinheavey commented on August 15, 2024

This isn't reproducible since I don't know the pubkey you're using

from anchorpy.

artaasd95 avatar artaasd95 commented on August 15, 2024

The pubkey is a generated key, if this is the problem and having the key solves the problem, here it is:

E1g4fAGA38Q7yD2SuMZeemsm8T879jtqzrtch8ffMFHA
so the code:

pubkey = PublicKey("E1g4fAGA38Q7yD2SuMZeemsm8T879jtqzrtch8ffMFHA")

from anchorpy.

kevinheavey avatar kevinheavey commented on August 15, 2024

This runs fine on my machine with the latest solana-py and solders, though it prints an empty list (idk if that's what you expect):

from solana.rpc.api import Client
from solders.pubkey import Pubkey

http_client = Client("https://api.devnet.solana.com")
pubkey = Pubkey.from_string("E1g4fAGA38Q7yD2SuMZeemsm8T879jtqzrtch8ffMFHA")

accounts = []

for x in http_client.get_program_accounts_json_parsed(pubkey).value:
    accounts.append(x.account)

print(accounts)

If you update to the latest versions do you get the same behaviour?

Also this issue should be in the solana-py or solders repo, not here

from anchorpy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.