Have a question related to custom program development. I've testing this program
pub mod fluxtility {
use super::*;
pub fn buy_ticket(ctx: Context<Initialize>, lamports: u64) -> Result<()> {
buy_ticket::process_instructions(ctx, lamports)
}
}
How can I call this specific function from nodejs side? Have this code but throwing error -
const buyTicketInstructionData = struct([
u8("instruction"),
u64("lamports")
]);
const data = Buffer.alloc(buyTicketInstructionData.span);
buyTicketInstructionData.encode({
instruction: "buy_ticket",
lamports: BigInt(LAMPORTS_PER_SOL)
}, data);
const buyTicketInstruction = new TransactionInstruction({
programId,
keys: [
{
pubkey: ownerWallet.publicKey,
isSigner: true,
isWritable: false
},
{
pubkey: discordWallet.publicKey,
isSigner: false,
isWritable: false
},
{
pubkey: SystemProgram.programId,
isSigner: false,
isWritable: false
}
],
data: data
});
const transaction = new Transaction().add(buyTicketInstruction);
const tx = await sendAndConfirmTransaction(connection, transaction, [ ownerWallet ]);
console.log(tx);
And the error is -
logs: [
'Program FLUXGWc3HLGHt7AKHGJLohWYzQJrVpihhkzxXXZM38cm invoke [1]',
'Program log: AnchorError occurred. Error Code: InstructionFallbackNotFound. Error Number: 101. Error Message: Fallback functions are not supported.',
'Program FLUXGWc3HLGHt7AKHGJLohWYzQJrVpihhkzxXXZM38cm consumed 2865 of 200000 compute units',
'Program FLUXGWc3HLGHt7AKHGJLohWYzQJrVpihhkzxXXZM38cm failed: custom program error: 0x65'
]