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.
Requests funds from a Solana faucet.