Interfaces

CreateAccountOptions

Defined in: client/solana/solana.types.ts:59 Options for creating a Solana account.

Properties

accountPolicy?
optional accountPolicy: string;
Defined in: client/solana/solana.types.ts:63 The policy ID to apply to the account.
idempotencyKey?
optional idempotencyKey: string;
Defined in: client/solana/solana.types.ts:65 The idempotency key.
name?
optional name: string;
Defined in: client/solana/solana.types.ts:61 The name of the account.

ExportAccountOptions

Defined in: client/solana/solana.types.ts:71 Options for exporting a Solana account.

Properties

address?
optional address: string;
Defined in: client/solana/solana.types.ts:73 The address of the account.
idempotencyKey?
optional idempotencyKey: string;
Defined in: client/solana/solana.types.ts:77 The idempotency key.
name?
optional name: string;
Defined in: client/solana/solana.types.ts:75 The name of the account.

GetAccountOptions

Defined in: client/solana/solana.types.ts:83 Options for getting a Solana account.

Properties

address?
optional address: string;
Defined in: client/solana/solana.types.ts:85 The address of the account.
name?
optional name: string;
Defined in: client/solana/solana.types.ts:87 The name of the account.

GetOrCreateAccountOptions

Defined in: client/solana/solana.types.ts:93 Options for getting a Solana account.

Properties

name
name: string;
Defined in: client/solana/solana.types.ts:95 The name of the account.

ImportAccountOptions

Defined in: client/solana/solana.types.ts:171 Options for importing a Solana account.

Properties

encryptionPublicKey?
optional encryptionPublicKey: string;
Defined in: client/solana/solana.types.ts:173 The public RSA key used to encrypt the private key when importing a Solana account.
idempotencyKey?
optional idempotencyKey: string;
Defined in: client/solana/solana.types.ts:177 The idempotency key.
name?
optional name: string;
Defined in: client/solana/solana.types.ts:175 The name of the account.
privateKey
privateKey: string | Uint8Array<ArrayBufferLike>;
Defined in: client/solana/solana.types.ts:179 The private key of the account - can be a base58 encoded string or raw bytes.

ListAccountsOptions

Defined in: client/solana/solana.types.ts:113 Options for listing Solana accounts.

Properties

pageSize?
optional pageSize: number;
Defined in: client/solana/solana.types.ts:115 The page size.
pageToken?
optional pageToken: string;
Defined in: client/solana/solana.types.ts:117 The page token.

ListAccountsResult

Defined in: client/solana/solana.types.ts:123 The result of listing Solana accounts.

Properties

accounts
accounts: {
  fund: (options: Omit<SolanaFundOptions, "address">) => Promise<FundOperationResult>;
  quoteFund: (options: Omit<SolanaQuoteFundOptions, "address">) => Promise<SolanaQuote>;
  requestFaucet: (options: Omit<RequestFaucetOptions, "address">) => Promise<SignatureResult>;
  sendTransaction: (options: Omit<SendTransactionOptions, "address">) => Promise<SendTransactionResult>;
  signMessage: (options: Omit<SignMessageOptions, "address">) => Promise<SignatureResult>;
  signTransaction: (options: Omit<SignTransactionOptions, "address">) => Promise<SignTransactionResult>;
  transfer: (options: Omit<TransferOptions, "from">) => Promise<SignatureResult>;
  waitForFundOperationReceipt: Promise<WaitForFundOperationResult>;
}[];
Defined in: client/solana/solana.types.ts:125 The accounts.
fund()
fund: (options: Omit<SolanaFundOptions, "address">) => Promise<FundOperationResult>;
Funds a Solana account with the specified token amount.
Parameters
options
Omit<SolanaFundOptions, "address"> The options for the fund operation.
Returns
Promise<FundOperationResult> A promise that resolves to the fund operation result containing the transfer details.
Example
const fundOperation = await account.fund({
  token: "usdc",
  amount: 1000000n,
});
quoteFund()
quoteFund: (options: Omit<SolanaQuoteFundOptions, "address">) => Promise<SolanaQuote>;
Gets a quote to fund a Solana account.
Parameters
options
Omit<SolanaQuoteFundOptions, "address"> The options for the quote fund.
Returns
Promise<SolanaQuote> A promise that resolves to a Quote object containing details about the funding operation.
Example
const quote = await account.quoteFund({
  token: "usdc",
  amount: 1000000n,
});
requestFaucet()
requestFaucet: (options: Omit<RequestFaucetOptions, "address">) => Promise<SignatureResult>;
Requests funds from a Solana faucet.
Parameters
options
Omit<RequestFaucetOptions, "address"> Parameters for requesting funds from the Solana faucet.
Returns
Promise<SignatureResult> A promise that resolves to the transaction hash.
Example
// Create a Solana account
const account = await cdp.solana.createAccount();

// Request funds from the Solana faucet
const result = await account.requestFaucet({
  token: "sol",
});
sendTransaction()
sendTransaction: (options: Omit<SendTransactionOptions, "address">) => Promise<SendTransactionResult>;
Sends a transaction.
Parameters
options
Omit<SendTransactionOptions, "address"> Parameters for sending the transaction.
Returns
Promise<SendTransactionResult> A promise that resolves to the transaction signature.
Example
// 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,
});
signMessage()
signMessage: (options: Omit<SignMessageOptions, "address">) => Promise<SignatureResult>;
Signs a message.
Parameters
options
Omit<SignMessageOptions, "address"> Parameters for signing the message.
Returns
Promise<SignatureResult> A promise that resolves to the signature.
Example
// Create a Solana account
const account = await cdp.solana.createAccount();

// Sign a message
const { signature } = await account.signMessage({
  message: "Hello, world!",
});
signTransaction()
signTransaction: (options: Omit<SignTransactionOptions, "address">) => Promise<SignTransactionResult>;
Signs a transaction.
Parameters
options
Omit<SignTransactionOptions, "address"> Parameters for signing the transaction.
Returns
Promise<SignTransactionResult> A promise that resolves to the signature.
Example
// 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,
});
transfer()
transfer: (options: Omit<TransferOptions, "from">) => Promise<SignatureResult>;
Transfers SOL or SPL tokens between accounts
Parameters
options
Omit<TransferOptions, "from"> Parameters for the transfer.
Returns
Promise<SignatureResult> A promise that resolves to the transaction signature, which can be used to wait for the transaction result.
Example
import { LAMPORTS_PER_SOL } from "@solana/web3.js";

const account = await cdp.solana.getAccount({ name: "Account" });

const { signature } = await account.transfer({
  token: "sol",
  amount: 5 * LAMPORTS_PER_SOL,
  to: "3KzDtddx4i53FBkvCzuDmRbaMozTZoJBb1TToWhz3JfE",
  network: "devnet",
});
waitForFundOperationReceipt()
waitForFundOperationReceipt(options: WaitForFundOperationOptions): Promise<WaitForFundOperationResult>;
Waits for a fund operation to complete and returns the transfer receipt.
Parameters
options
WaitForFundOperationOptions The options for the wait for fund operation.
Returns
Promise<WaitForFundOperationResult> A promise that resolves to the completed transfer receipt containing details about the funding operation.
Example
const completedTransfer = await account.waitForFundOperationReceipt({
  transferId: "transfer_123",
});
nextPageToken?
optional nextPageToken: string;
Defined in: client/solana/solana.types.ts:129 The token for the next page of accounts, if any.

ListTokenBalancesOptions

Defined in: client/solana/solana.types.ts:185 Options for listing Solana token balances.

Properties

address
address: string;
Defined in: client/solana/solana.types.ts:187 The address of the account.
network?
optional network: ListSolanaTokenBalancesNetwork;
Defined in: client/solana/solana.types.ts:189 The network to list token balances for.
pageSize?
optional pageSize: number;
Defined in: client/solana/solana.types.ts:191 The page size.
pageToken?
optional pageToken: string;
Defined in: client/solana/solana.types.ts:193 The page token.

ListTokenBalancesResult

Defined in: client/solana/solana.types.ts:245 The result of listing Solana token balances.

Properties

balances
balances: SolanaTokenBalance[];
Defined in: client/solana/solana.types.ts:247 The token balances.
nextPageToken?
optional nextPageToken: string;
Defined in: client/solana/solana.types.ts:252 The next page token to paginate through the token balances. If undefined, there are no more token balances to paginate through.

RequestFaucetOptions

Defined in: client/solana/solana.types.ts:135 Options for requesting funds from a Solana faucet.

Properties

address
address: string;
Defined in: client/solana/solana.types.ts:137 The address of the account.
idempotencyKey?
optional idempotencyKey: string;
Defined in: client/solana/solana.types.ts:141 The idempotency key.
token
token: "usdc" | "sol";
Defined in: client/solana/solana.types.ts:139 The token to request funds for.

SendTransactionOptions

Defined in: client/solana/solana.types.ts:199 Options for sending a Solana transaction.

Properties

idempotencyKey?
optional idempotencyKey: string;
Defined in: client/solana/solana.types.ts:205 The idempotency key.
network
network: SendSolanaTransactionBodyNetwork;
Defined in: client/solana/solana.types.ts:201 The network to send the transaction to.
transaction
transaction: string;
Defined in: client/solana/solana.types.ts:203 The base64 encoded transaction to send.

SignatureResult

Defined in: client/solana/solana.types.ts:51 A Solana signature result.

Properties

signature
signature: string;
Defined in: client/solana/solana.types.ts:53 The signature.

SignMessageOptions

Defined in: client/solana/solana.types.ts:147 Options for signing a Solana message.

Properties

address
address: string;
Defined in: client/solana/solana.types.ts:149 The address of the account.
idempotencyKey?
optional idempotencyKey: string;
Defined in: client/solana/solana.types.ts:153 The idempotency key.
message
message: string;
Defined in: client/solana/solana.types.ts:151 The message to sign.

SignTransactionOptions

Defined in: client/solana/solana.types.ts:159 Options for signing a Solana transaction.

Properties

address
address: string;
Defined in: client/solana/solana.types.ts:161 The address of the account.
idempotencyKey?
optional idempotencyKey: string;
Defined in: client/solana/solana.types.ts:165 The idempotency key.
transaction
transaction: string;
Defined in: client/solana/solana.types.ts:163 The base64 encoded transaction to sign.

SolanaToken

Defined in: client/solana/solana.types.ts:223

Properties

mintAddress
mintAddress: string;
Defined in: client/solana/solana.types.ts:225 The token address.
name?
optional name: string;
Defined in: client/solana/solana.types.ts:227 The token name.
symbol?
optional symbol: string;
Defined in: client/solana/solana.types.ts:229 The token symbol.

SolanaTokenAmount

Defined in: client/solana/solana.types.ts:216

Properties

amount
amount: bigint;
Defined in: client/solana/solana.types.ts:218 The amount of the token.
decimals
decimals: number;
Defined in: client/solana/solana.types.ts:220 The number of decimals in the token.

SolanaTokenBalance

Defined in: client/solana/solana.types.ts:235 A Solana token balance.

Properties

amount
amount: SolanaTokenAmount;
Defined in: client/solana/solana.types.ts:237 The amount of the token.
token
token: SolanaToken;
Defined in: client/solana/solana.types.ts:239 The token.

TransactionResult

Defined in: client/solana/solana.types.ts:211 The result of sending a Solana transaction.

Properties

signature
signature: string;
Defined in: client/solana/solana.types.ts:213 The signature of the transaction base58 encoded.

UpdateSolanaAccountOptions

Defined in: client/solana/solana.types.ts:101 Options for creating a SOL server account.

Properties

address
address: string;
Defined in: client/solana/solana.types.ts:103 The address of the account.
idempotencyKey?
optional idempotencyKey: string;
Defined in: client/solana/solana.types.ts:107 The idempotency key.
update
update: UpdateSolanaAccountBody;
Defined in: client/solana/solana.types.ts:105 The updates to apply to the account

Type Aliases

SolanaClientInterface

type SolanaClientInterface = Omit<typeof OpenApiSolanaMethods, 
  | "createSolanaAccount"
  | "getSolanaAccount"
  | "getSolanaAccountByName"
  | "updateSolanaAccount"
  | "listSolanaAccounts"
  | "requestSolanaFaucet"
  | "signSolanaMessage"
  | "signSolanaTransaction"
  | "updateSolanaAccount"
  | "exportSolanaAccount"
  | "exportSolanaAccountByName"
  | "importSolanaAccount"
  | "listSolanaTokenBalances"
  | "sendSolanaTransaction"> & {
  createAccount: (options: CreateAccountOptions) => Promise<Account>;
  exportAccount: (options: ExportAccountOptions) => Promise<string>;
  getAccount: (options: GetAccountOptions) => Promise<Account>;
  getOrCreateAccount: (options: GetOrCreateAccountOptions) => Promise<Account>;
  importAccount: (options: ImportAccountOptions) => Promise<SolanaAccount>;
  listAccounts: (options: ListAccountsOptions) => Promise<ListAccountsResult>;
  listTokenBalances: (options: ListTokenBalancesOptions) => Promise<ListTokenBalancesResult>;
  requestFaucet: (options: RequestFaucetOptions) => Promise<SignatureResult>;
  sendTransaction: (options: SendSolanaTransactionBody) => Promise<SignatureResult>;
  signMessage: (options: SignMessageOptions) => Promise<SignatureResult>;
  signTransaction: (options: SignTransactionOptions) => Promise<SignatureResult>;
  updateAccount: (options: UpdateSolanaAccountOptions) => Promise<Account>;
};
Defined in: client/solana/solana.types.ts:17 The SolanaClient type, where all OpenApiSolanaMethods methods are wrapped.

Type declaration

createAccount()
createAccount: (options: CreateAccountOptions) => Promise<Account>;
Parameters
options
CreateAccountOptions
Returns
Promise<Account>
exportAccount()
exportAccount: (options: ExportAccountOptions) => Promise<string>;
Parameters
options
ExportAccountOptions
Returns
Promise<string>
getAccount()
getAccount: (options: GetAccountOptions) => Promise<Account>;
Parameters
options
GetAccountOptions
Returns
Promise<Account>
getOrCreateAccount()
getOrCreateAccount: (options: GetOrCreateAccountOptions) => Promise<Account>;
Parameters
options
GetOrCreateAccountOptions
Returns
Promise<Account>
importAccount()
importAccount: (options: ImportAccountOptions) => Promise<SolanaAccount>;
Parameters
options
ImportAccountOptions
Returns
Promise<SolanaAccount>
listAccounts()
listAccounts: (options: ListAccountsOptions) => Promise<ListAccountsResult>;
Parameters
options
ListAccountsOptions
Returns
Promise<ListAccountsResult>
listTokenBalances()
listTokenBalances: (options: ListTokenBalancesOptions) => Promise<ListTokenBalancesResult>;
Parameters
options
ListTokenBalancesOptions
Returns
Promise<ListTokenBalancesResult>
requestFaucet()
requestFaucet: (options: RequestFaucetOptions) => Promise<SignatureResult>;
Parameters
options
RequestFaucetOptions
Returns
Promise<SignatureResult>
sendTransaction()
sendTransaction: (options: SendSolanaTransactionBody) => Promise<SignatureResult>;
Parameters
options
SendSolanaTransactionBody
Returns
Promise<SignatureResult>
signMessage()
signMessage: (options: SignMessageOptions) => Promise<SignatureResult>;
Parameters
options
SignMessageOptions
Returns
Promise<SignatureResult>
signTransaction()
signTransaction: (options: SignTransactionOptions) => Promise<SignatureResult>;
Parameters
options
SignTransactionOptions
Returns
Promise<SignatureResult>
updateAccount()
updateAccount: (options: UpdateSolanaAccountOptions) => Promise<Account>;
Parameters
options
UpdateSolanaAccountOptions
Returns
Promise<Account>