Creates a new Solana account.
Parameters for creating the Solana account.
Options for creating a Solana account.
A promise that resolves to the newly created account.
Exports a CDP Solana account's private key. It is important to store the private key in a secure place after it's exported.
Parameters for exporting the Solana account.
Options for exporting a Solana account.
A promise that resolves to the exported account's full 64-byte private key as a base58 encoded string.
Gets a Solana account by its address.
Parameters for getting the Solana account.
Either address
or name
must be provided.
If both are provided, lookup will be done by address
and name
will be ignored.
Options for getting a Solana account.
A promise that resolves to the account.
Gets a Solana account by its address.
Parameters for getting or creating the Solana account.
Options for getting a Solana account.
A promise that resolves to the account.
Lists all Solana accounts.
Parameters for listing the Solana accounts.
Options for listing Solana accounts.
A promise that resolves to an array of Solana account instances.
Requests funds from a Solana faucet.
Parameters for requesting funds from the Solana faucet.
Options for requesting funds from a Solana faucet.
A promise that resolves to the transaction signature.
Signs a message.
Parameters for signing the message.
Options for signing a Solana message.
A promise that resolves to the signature.
Signs a transaction.
Parameters for signing the transaction.
Options for signing a Solana transaction.
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 signature = await cdp.solana.signTransaction({
address: account.address,
transaction,
});
Updates a CDP Solana account.
Optional
options: UpdateSolanaAccountOptionsOptional parameters for creating the account.
Options for creating a SOL server account.
The address of the account.
Optional
idempotencyKey?: stringThe idempotency key.
The updates to apply to the account
A promise that resolves to the updated account.
const account = await cdp.sol.updateAccount({ address: "...", update: { name: "New Name" } });
const account = await cdp.sol.updateAccount({ address: "...", update: { accountPolicy: "73bcaeeb-d7af-4615-b064-42b5fe83a31e" } });
const idempotencyKey = uuidv4();
// First call
await cdp.sol.updateAccount({
address: "0x...",
update: { accountPolicy: "73bcaeeb-d7af-4615-b064-42b5fe83a31e" },
idempotencyKey,
});
// Second call with the same idempotency key will not update
await cdp.sol.updateAccount({
address: '0x...',
update: { name: "" },
idempotencyKey,
});
The namespace containing all Solana methods.