Creates a new Solana account.
Parameters for creating the Solana account.
Options for creating a Solana account.
Optional
name?: stringThe name of the account.
Optional
accountPolicy?: stringThe policy ID to apply to the account.
Optional
idempotencyKey?: stringThe idempotency key.
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.
Optional
address?: stringThe address of the account.
Optional
name?: stringThe name of the account.
Optional
idempotencyKey?: stringThe idempotency key.
A promise that resolves to the exported account's full 64-byte private key as a base58 encoded string.
Imports a Solana account using a private key. The private key will be encrypted before being stored securely.
Parameters for importing the Solana account.
Options for importing a Solana account.
Optional
encryptionPublicKey?: stringThe public RSA key used to encrypt the private key when importing a Solana account.
Optional
name?: stringThe name of the account.
Optional
idempotencyKey?: stringThe idempotency key.
The private key of the account - can be a base58 encoded string or raw bytes.
A promise that resolves to the imported account.
const account = await cdp.solana.importAccount({
privateKey: "3Kzjw8qSxx8bQkV7EHrVFWYiPyNLbBVxtVe1Q5h2zKZY8DdcuT2dKxyz9kU5vQrP",
});
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.
Optional
address?: stringThe address of the account.
Optional
name?: stringThe name of the 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.
The name of the account.
A promise that resolves to the account.
Lists all Solana accounts.
Parameters for listing the Solana accounts.
Options for listing Solana accounts.
Optional
pageSize?: numberThe page size.
Optional
pageToken?: stringThe page token.
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.
The address of the account.
The token to request funds for.
Optional
idempotencyKey?: stringThe idempotency key.
A promise that resolves to the transaction signature.
Signs a message.
Parameters for signing the message.
Options for signing a Solana message.
The address of the account.
The message to sign.
Optional
idempotencyKey?: stringThe idempotency key.
A promise that resolves to the signature.
Signs a transaction.
Parameters for signing the transaction.
Options for signing a Solana transaction.
The address of the account.
The base64 encoded transaction to sign.
Optional
idempotencyKey?: stringThe 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 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.
The updates to apply to the account
Optional
idempotencyKey?: stringThe idempotency key.
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,
});
Sends a Solana transaction using the Coinbase API.
Parameters for sending the Solana transaction.
Options for sending a Solana transaction.
The network to send the transaction to.
The base64 encoded transaction to send.
Optional
idempotencyKey?: stringThe idempotency key.
A promise that resolves to the transaction result.
Lists the token balances for a Solana account.
Parameters for listing the Solana token balances.
Options for listing Solana token balances.
The address of the account.
Optional
network?: ListSolanaTokenBalancesNetworkThe network to list token balances for.
Optional
pageSize?: numberThe page size.
Optional
pageToken?: stringThe page token.
A promise that resolves to an array of Solana token balance instances.
The namespace containing all Solana methods.