Skip to main content
Prepare transactions using Phantom’s guidance for the “This dApp could be malicious” simulation warning. Phantom may show this warning when it cannot reliably predict a transaction’s outcome. This recipe implements the transaction simulation guidance with a v0 SOL transfer.

Prepare and sign the transaction

Call runExample(rpcUrl, recipient) from a button handler to send 0.001 SOL on devnet.
Save connect.ts, usage.ts, and transaction.ts in the same directory.
connect.ts
The helper verifies that the RPC endpoint is on devnet before building a fresh, unsigned transaction and simulating it with sigVerify: false. It stops on errors, requests Phantom’s signature, and submits the transaction Phantom returns with preflight enabled.

Use your own instructions

Replace SystemProgram.transfer in usage.ts with your operation’s instructions. Include required setup, cleanup, and resource budget instructions before simulating. Use the connected wallet as the only signer when possible. If you need additional signers, pass them as the last argument to signAndSubmit. The helper collects their signatures after Phantom signs. Keep the wallet-returned message unchanged after signing. When splitting a large transaction, keep complete operation groups together. See the size and Address Lookup Table guidance.

Confirm and test

A signature indicates submission. Wait for confirmed or finalized status and check for execution errors before showing success. If submission is uncertain, check the existing signature before retrying. Submission errors from this example include a signature property. Test approval on your deployed domain. Phantom performs its own simulation and safety checks; a successful RPC simulation does not guarantee that the warning disappears.

Next steps