I would like to be able to connect to my custom solana program without using any frontend object.
Currently, my provider method uses "window.solana" which I want to avoid.
The idea is to be able to sign transaction from a backend without having to retrieve object from a frontend. The transactions will be signed and paid directly by the program.
This how I am calling the my program now:
const network = clusterApiUrl("devnet");
const opts = {
preflightCommitment: "processed",
};
const { SystemProgram } = web3;
const getProvider = () => {
const connection = new Connection(network, opts.preflightCommitment);
const provider = new AnchorProvider(
connection,
window.solana,
opts.preflightCommitment
);
return provider;
};
const provider = getProvider();
const program = new Program(idl, programID, provider);