ワンクリックで
send-sol-transaction
Build and send SOL transfers with Phantom Connect SDK, including transaction construction, signing, and verification
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Build and send SOL transfers with Phantom Connect SDK, including transaction construction, signing, and verification
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
| name | send-sol-transaction |
| description | Build and send SOL transfers with Phantom Connect SDK, including transaction construction, signing, and verification |
import {
Connection,
PublicKey,
Transaction,
SystemProgram,
LAMPORTS_PER_SOL,
} from "@solana/web3.js";
const connection = new Connection("https://api.devnet.solana.com");
function buildTransferTransaction(
fromPubkey: PublicKey,
toPubkey: PublicKey,
solAmount: number
): Transaction {
const transaction = new Transaction().add(
SystemProgram.transfer({
fromPubkey,
toPubkey,
lamports: Math.round(solAmount * LAMPORTS_PER_SOL),
})
);
return transaction;
}
Always use LAMPORTS_PER_SOL for conversion. Never hardcode 1000000000.
import { useSolana, useAccounts } from "@phantom/react-sdk";
import { PublicKey, Transaction, SystemProgram, LAMPORTS_PER_SOL } from "@solana/web3.js";
function SendSol() {
const solana = useSolana();
const { accounts } = useAccounts();
const sendTransaction = async () => {
const solanaAccount = accounts.find((a) => a.chain === "solana");
if (!solanaAccount) {
console.error("No Solana account connected");
return;
}
const fromPubkey = new PublicKey(solanaAccount.address);
const toPubkey = new PublicKey("RECIPIENT_ADDRESS_HERE");
const transaction = new Transaction().add(
SystemProgram.transfer({
fromPubkey,
toPubkey,
lamports: Math.round(0.01 * LAMPORTS_PER_SOL),
})
);
try {
const { signature } = await solana.signAndSendTransaction(transaction);
console.log("Transaction signature:", signature);
console.log(
`View on Explorer: https://explorer.solana.com/tx/${signature}?cluster=devnet`
);
} catch (error) {
console.error("Transaction failed:", error);
}
};
return <button onClick={sendTransaction}>Send 0.01 SOL</button>;
}
import { PublicKey, Transaction, SystemProgram, LAMPORTS_PER_SOL } from "@solana/web3.js";
async function sendSol(sdk: BrowserSDK) {
const solanaAccount = sdk.accounts.find((a) => a.chain === "solana");
if (!solanaAccount) {
throw new Error("No Solana account connected");
}
const fromPubkey = new PublicKey(solanaAccount.address);
const toPubkey = new PublicKey("RECIPIENT_ADDRESS_HERE");
const transaction = new Transaction().add(
SystemProgram.transfer({
fromPubkey,
toPubkey,
lamports: Math.round(0.01 * LAMPORTS_PER_SOL),
})
);
try {
const { signature } = await sdk.solana.signAndSendTransaction(transaction);
console.log("Transaction signature:", signature);
console.log(
`View on Explorer: https://explorer.solana.com/tx/${signature}?cluster=devnet`
);
} catch (error) {
console.error("Transaction failed:", error);
}
}
async function verifyTransaction(signature: string) {
const connection = new Connection("https://api.devnet.solana.com");
const status = await connection.getSignatureStatus(signature);
if (status.value?.confirmationStatus === "confirmed" ||
status.value?.confirmationStatus === "finalized") {
console.log("Transaction confirmed!");
} else {
console.log("Transaction status:", status.value);
}
}
signAndSendTransaction — NOT signTransaction. Embedded wallets do not support signTransaction.LAMPORTS_PER_SOL for SOL-to-lamport conversion.https://api.devnet.solana.com) for testing, mainnet-beta (https://api.mainnet-beta.solana.com) for production.Build wallet-connected applications with the Phantom Connect SDK for Solana. Use when integrating Phantom wallets into React, React Native, or vanilla JS/TS apps — including wallet connection, social login (Google/Apple), transaction signing, message signing, token-gated access, crypto payments, and NFT minting. Covers @phantom/react-sdk, @phantom/react-native-sdk, and @phantom/browser-sdk.
Configure Google and Apple social login with Phantom Connect SDK to enable embedded wallet creation
Scaffold a vanilla JS/TS app with Phantom Browser SDK for wallet integration, without any framework dependency
Scaffold a React app with Phantom Connect SDK for wallet integration, including social login and Solana support
Scaffold a React Native (Expo) app with Phantom React Native SDK for mobile wallet integration, including polyfills and deep linking
Implement message signing with Phantom Connect SDK for Solana and EVM, including Sign-in with Solana (SIWS) authentication