anchorpy icon indicating copy to clipboard operation
anchorpy copied to clipboard

solders.SerdeJSONError: data did not match any variant of untagged enum IdlAccountItem at line 1 column 391

Open siyangyuandegit opened this issue 1 year ago • 4 comments

How can i fix the bug?

siyangyuandegit avatar Oct 28 '24 09:10 siyangyuandegit

from anchorpy import Program, Provider, Wallet, Idl from solana.rpc.async_api import AsyncClient from solders.keypair import Keypair import json

async def load_program():

connection = AsyncClient("https://api.mainnet-beta.solana.com")

wallet = Wallet(Keypair())

provider = Provider(connection, wallet)

with open("idls/pumpfun.json") as f:
    raw_idl = json.load(f)

idl = Idl.from_json(json.dumps(raw_idl))
print
program = Program(
    idl,
    "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P",
    provider
)

return program

async def main(): program = await load_program() print("Program loaded successfully!") print("Program ID:", program.program_id) print("Available instructions:", program.instruction_names) print("Available events:", [e.name for e in program.events])

if name == "main": import asyncio asyncio.run(main()) I want to init the program, but i can't

siyangyuandegit avatar Oct 28 '24 09:10 siyangyuandegit

@siyangyuandegit Reduce your Anchor version to 0.20.1 as well. 0.29.0 might work though.

ghost avatar Dec 06 '24 03:12 ghost

@Hari-hari-dev wdym "reduce" to 0.20.1, the latest version is 0.20.1? https://pypi.org/project/anchorpy/#history

UPDATE: nvm, I see which hash the anchor folder is pointed to ..

Note that the issue could also be this: https://github.com/kevinheavey/anchorpy/issues/147

roks0n avatar Dec 11 '24 20:12 roks0n

@Hari-hari-dev wdym "reduce" to 0.20.1, the latest version is 0.20.1? https://pypi.org/project/anchorpy/#history

UPDATE: nvm, I see which hash the anchor folder is pointed to ..

Note that the issue could also be this: #147

Yeah, #147 explains it. Anchor 0.27.0 works too. I think up to 0.29.0. 0.30.1 gives enum errors.

ghost avatar Dec 12 '24 04:12 ghost

How do I "reduce my Anchor version"? anchorpy doesn't install an anchor library does it?