Parameters for requesting funds from the Solana faucet.
The token to request funds for.
An idempotency key.
A promise that resolves to the transaction hash.
Signs a message.
Parameters for signing the message.
The address to sign the message for.
The message to sign.
An idempotency key.
A promise that resolves to the signature.
Signs a transaction.
Parameters for signing the transaction.
The address to sign the transaction for.
The transaction to sign.
An idempotency key.
A promise that resolves to the signature.
// Create a Solana account
const account = await cdp.solana.createAccount();
// Add your transaction instructions here
const transaction = new Transaction()
// Make sure to set requireAllSignatures to false, since signing will be done through the API
const serializedTransaction = transaction.serialize({
requireAllSignatures: false,
});
// Base64 encode the serialized transaction
const transaction = Buffer.from(serializedTransaction).toString("base64");
// When you want to sign a transaction, you can do so by address and base64 encoded transaction
const { signedTransaction } = await account.signTransaction({
transaction,
});
Sends a transaction.
Parameters for sending the transaction.
The address to send the transaction for.
The transaction to send.
An idempotency key.
A promise that resolves to the transaction signature.
// Create a Solana account
const account = await cdp.solana.createAccount();
// Add your transaction instructions here
const transaction = new Transaction()
// Make sure to set requireAllSignatures to false, since signing will be done through the API
const serializedTransaction = transaction.serialize({
requireAllSignatures: false,
});
// Base64 encode the serialized transaction
const transaction = Buffer.from(serializedTransaction).toString("base64");
// When you want to sign a transaction, you can do so by address and base64 encoded transaction
const { transactionSignature } = await account.sendTransaction({
transaction,
});
Transfers SOL or SPL tokens between accounts
Parameters for the transfer.
The base58 encoded Solana address of the destination account.
The token to transfer ("sol" or "usdc"), or mint address of the SPL token to transfer.
The amount to transfer in atomic units of the token. For example, 0.01 * LAMPORTS_PER_SOL would transfer 0.01 SOL.
The network identifier to use, or a Solana Connection object.
A promise that resolves to the transaction signature, which can be used to wait for the transaction result.
Gets a quote to fund a Solana account.
The options for the quote fund.
The token to fund the account with.
The amount of the token to fund represented as an atomic unit.
It's common to use parseUnits
utils from viem to convert to atomic units.
Otherwise, you can pass atomic units directly.
A promise that resolves to a Quote object containing details about the funding operation.
Funds a Solana account with the specified token amount.
The options for the fund operation.
The token to fund the account with (e.g., 'usdc').
The amount of the token to fund represented as an atomic unit.
It's common to use parseUnits
utils from viem to convert to atomic units.
Otherwise, you can pass atomic units directly.
A promise that resolves to the fund operation result containing the transfer details.
Waits for a fund operation to complete and returns the transfer receipt.
The options for the wait for fund operation.
The ID of the transfer to wait for.
A promise that resolves to the completed transfer receipt containing details about the funding operation.
Requests funds from a Solana faucet.