Its a CRUD app on seahorse. Its getting built and deployed but having errors in interacting with it.
anchor version 0.28.0Seahorse version 0.2.7solana-cli version 1.16.0
Here is the program
from seahorse.prelude import *# This is your program's public key and it will update# automatically when you build the project.declare_id('BAv1R7yGTcga43cjmsHMcZsXTsLTxdK4UT4nMg8qzhTh')class User(Account): owner: Pubkey note_count: u8 last_note: u8class Note(Account): owner: Pubkey index: u8 title: str content: str@instructiondef init_user(owner: Signer, user: Empty[User]): user = user.init( payer=owner, seeds=['user', owner] ) user.owner = owner.key() user.note_count = 0 user.last_note = 0
The testing script
import * as anchor from "@project-serum/anchor";import { Program, web3 } from "@project-serum/anchor";import { MyAwesomeApp } from "../target/types/my_awesome_app";import { assert } from "chai";import { findProgramAddressSync } from "@project-serum/anchor/dist/cjs/utils/pubkey";describe("my_awesome_app", () => { // Configure the client to use the local cluster. const provider = anchor.AnchorProvider.env(); anchor.setProvider(provider); const program = anchor.workspace.MyAwesomeApp as Program<MyAwesomeApp>; const myKey = provider.wallet.publicKey; const seed1 = Buffer.from("user"); const seed2 = myKey.toBuffer(); const [userPDA, _bump] = findProgramAddressSync( [seed1, seed2], program.programId ); const user = userPDA; it("Creating user", async () => { await program.methods.initUser().accounts({ user, owner: myKey }).rpc(); });});
Running the script with anchor test is giving this error.
Error: failed to send transaction: Transaction simulation failed: Error processing Instruction 0: Program failed to complete
I am not able to solve it.Github repo