To allow transactions execution in background, you need to ask user to create a background session
const { address } = useAccount();
const sessionConfig = usePrepareContractWrite({
address,
abi: SessionFacetABI,
functionName: 'createSession',
args: [
sessionPubKey,
[GAME_ADDRESS],
maxAllowance,
SessionPeriod.OneMonth,
],
});
const { data, isLoading, isSuccess, write } = useContractWrite(
sessionConfig.config,
);
This call triggers session creation request window in user wallet.
After user approve and transaction execution calls to the GAME_ADDRESS
will be executed without confirmation