I deployed my website and now phantom or solflare or what ever is telling me always the same. My site is not secure or what ever.
const { connection } = useConnection();
const { publicKey, sendTransaction, signTransaction } = useWallet();
const createTransaction = async (
amount: number
): Promise<TransactionResponse | null> => {
if (!publicKey) {
throw new Error("Wallet not connected");
}
const latestBlockhash = await connection.getLatestBlockhash();
const transaction = new Transaction()
.add(
SystemProgram.transfer({
fromPubkey: publicKey,
toPubkey: new PublicKey(process.env.NEXT_PUBLIC_WALLET_ADDRESS || ""),
lamports: solToLamports(amount),
})
)
.add(PRIORITY_FEE_IX);
transaction.feePayer = publicKey;
transaction.recentBlockhash = latestBlockhash.blockhash;
transaction.lastValidBlockHeight = latestBlockhash.lastValidBlockHeight;
return { transaction, latestBlockhash };
};
async function signAndSendTransaction(
transaction: Transaction,
blockdetails: BlockDetails,
checkTransactionCallback: () => Promise<void>
) {
if (signTransaction) {
const res = await signTransaction(transaction);
await checkTransactionCallback();
toast.dismiss();
const signature = await sendTransaction(res, connection);
toast.loading(
"Verifying Transaction... Please DO NOT close the window..."
);
return { signature, blockdetails };
}
return null;
}