import { PublicKey, TransactionInstruction } from "@solana/web3.js"; import { BN, Program } from "@coral-xyz/anchor"; import { Staking } from "../artifacts/staking"; import { StakingSpl } from "../artifacts/staking_spl"; export type StakeParams = { accounts: { user: PublicKey; mint?: PublicKey; }; inputs: { amount: BN; }; }; export async function stake( program: Program | Program, params: StakeParams, ): Promise { const { accounts, inputs } = params; const ix = await program.methods .stake(inputs.amount) .accounts({ ...accounts, }) .instruction(); return ix; }