> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cdp.coinbase.com/llms.txt
> Use this file to discover all available pages before exploring further.

# SolanaClient

Defined in: [client/solana/solana.ts:53](https://github.com/coinbase/cdp-sdk/blob/59b6f4f714b6e359fb2390fa1df724c8c5419568/typescript/packages/cdp-sdk/src/client/solana/solana.ts#L53)

The namespace containing all Solana methods.

## Implements

* [`SolanaClientInterface`](/sdks/cdp-sdks-v2/typescript/solana/Types/SolanaClientInterface)

## Constructors

### Constructor

```ts theme={null}
new SolanaClient(): SolanaClient;
```

#### Returns

`SolanaClient`

## Methods

### createAccount()

```ts theme={null}
createAccount(options?: CreateAccountOptions): Promise<{
  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>;
}>;
```

Defined in: [client/solana/solana.ts:84](https://github.com/coinbase/cdp-sdk/blob/59b6f4f714b6e359fb2390fa1df724c8c5419568/typescript/packages/cdp-sdk/src/client/solana/solana.ts#L84)

Creates a new Solana account.

#### Parameters

##### options?

[`CreateAccountOptions`](/sdks/cdp-sdks-v2/typescript/solana/Types/index#createaccountoptions) = `{}`

Parameters for creating the Solana account.

#### Returns

`Promise`\<\{
`requestFaucet`: (`options`: `Omit`\<[`RequestFaucetOptions`](/sdks/cdp-sdks-v2/typescript/solana/Types/index#requestfaucetoptions), `"address"`>) => `Promise`\<[`SignatureResult`](/sdks/cdp-sdks-v2/typescript/solana/Types/index#signatureresult)>;
`sendTransaction`: (`options`: `Omit`\<[`SendTransactionOptions`](/sdks/cdp-sdks-v2/typescript/solana/Types/index#sendtransactionoptions), `"address"`>) => `Promise`\<`SendTransactionResult`>;
`signMessage`: (`options`: `Omit`\<[`SignMessageOptions`](/sdks/cdp-sdks-v2/typescript/solana/Types/index#signmessageoptions), `"address"`>) => `Promise`\<[`SignatureResult`](/sdks/cdp-sdks-v2/typescript/solana/Types/index#signatureresult)>;
`signTransaction`: (`options`: `Omit`\<[`SignTransactionOptions`](/sdks/cdp-sdks-v2/typescript/solana/Types/index#signtransactionoptions), `"address"`>) => `Promise`\<`SignTransactionResult`>;
`transfer`: (`options`: `Omit`\<`TransferOptions`, `"from"`>) => `Promise`\<[`SignatureResult`](/sdks/cdp-sdks-v2/typescript/solana/Types/index#signatureresult)>;
}>

A promise that resolves to the newly created account.

#### Examples

```ts theme={null}
         const account = await cdp.solana.createAccount();
```

```ts theme={null}
         const account = await cdp.solana.createAccount(&#123; name: "MyAccount" &#125;);
```

```ts theme={null}
         const idempotencyKey = uuidv4();

         // First call
         await cdp.solana.createAccount({ idempotencyKey });

         // Second call with the same idempotency key will return the same account
         await cdp.solana.createAccount({ idempotencyKey });
```

#### Implementation of

```ts theme={null}
SolanaClientInterface.createAccount
```

***

### exportAccount()

```ts theme={null}
exportAccount(options: ExportAccountOptions): Promise<string>;
```

Defined in: [client/solana/solana.ts:122](https://github.com/coinbase/cdp-sdk/blob/59b6f4f714b6e359fb2390fa1df724c8c5419568/typescript/packages/cdp-sdk/src/client/solana/solana.ts#L122)

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

##### options

[`ExportAccountOptions`](/sdks/cdp-sdks-v2/typescript/solana/Types/index#exportaccountoptions)

Parameters for exporting the Solana account.

#### Returns

`Promise`\<`string`>

A promise that resolves to the exported account's full 64-byte private key as a base58 encoded string.

#### Examples

```ts theme={null}
const privateKey = await cdp.solana.exportAccount({
  address: "1234567890123456789012345678901234567890",
});
```

```ts theme={null}
const privateKey = await cdp.solana.exportAccount({
  name: "MyAccount",
});
```

#### Implementation of

```ts theme={null}
SolanaClientInterface.exportAccount
```

***

### getAccount()

```ts theme={null}
getAccount(options: GetAccountOptions): Promise<{
  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>;
}>;
```

Defined in: [client/solana/solana.ts:283](https://github.com/coinbase/cdp-sdk/blob/59b6f4f714b6e359fb2390fa1df724c8c5419568/typescript/packages/cdp-sdk/src/client/solana/solana.ts#L283)

Gets a Solana account by its address.

#### Parameters

##### options

[`GetAccountOptions`](/sdks/cdp-sdks-v2/typescript/solana/Types/index#getaccountoptions)

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.

#### Returns

`Promise`\<\{
`requestFaucet`: (`options`: `Omit`\<[`RequestFaucetOptions`](/sdks/cdp-sdks-v2/typescript/solana/Types/index#requestfaucetoptions), `"address"`>) => `Promise`\<[`SignatureResult`](/sdks/cdp-sdks-v2/typescript/solana/Types/index#signatureresult)>;
`sendTransaction`: (`options`: `Omit`\<[`SendTransactionOptions`](/sdks/cdp-sdks-v2/typescript/solana/Types/index#sendtransactionoptions), `"address"`>) => `Promise`\<`SendTransactionResult`>;
`signMessage`: (`options`: `Omit`\<[`SignMessageOptions`](/sdks/cdp-sdks-v2/typescript/solana/Types/index#signmessageoptions), `"address"`>) => `Promise`\<[`SignatureResult`](/sdks/cdp-sdks-v2/typescript/solana/Types/index#signatureresult)>;
`signTransaction`: (`options`: `Omit`\<[`SignTransactionOptions`](/sdks/cdp-sdks-v2/typescript/solana/Types/index#signtransactionoptions), `"address"`>) => `Promise`\<`SignTransactionResult`>;
`transfer`: (`options`: `Omit`\<`TransferOptions`, `"from"`>) => `Promise`\<[`SignatureResult`](/sdks/cdp-sdks-v2/typescript/solana/Types/index#signatureresult)>;
}>

A promise that resolves to the account.

#### Examples

```ts theme={null}
         const account = await cdp.solana.getAccount({
           address: "1234567890123456789012345678901234567890",
         });
```

```ts theme={null}
         const account = await cdp.solana.getAccount({
           name: "MyAccount",
         });
```

#### Implementation of

```ts theme={null}
SolanaClientInterface.getAccount
```

***

### getOrCreateAccount()

```ts theme={null}
getOrCreateAccount(options: GetOrCreateAccountOptions): Promise<{
  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>;
}>;
```

Defined in: [client/solana/solana.ts:312](https://github.com/coinbase/cdp-sdk/blob/59b6f4f714b6e359fb2390fa1df724c8c5419568/typescript/packages/cdp-sdk/src/client/solana/solana.ts#L312)

Gets a Solana account by its address.

#### Parameters

##### options

[`GetOrCreateAccountOptions`](/sdks/cdp-sdks-v2/typescript/solana/Types/index#getorcreateaccountoptions)

Parameters for getting or creating the Solana account.

#### Returns

`Promise`\<\{
`requestFaucet`: (`options`: `Omit`\<[`RequestFaucetOptions`](/sdks/cdp-sdks-v2/typescript/solana/Types/index#requestfaucetoptions), `"address"`>) => `Promise`\<[`SignatureResult`](/sdks/cdp-sdks-v2/typescript/solana/Types/index#signatureresult)>;
`sendTransaction`: (`options`: `Omit`\<[`SendTransactionOptions`](/sdks/cdp-sdks-v2/typescript/solana/Types/index#sendtransactionoptions), `"address"`>) => `Promise`\<`SendTransactionResult`>;
`signMessage`: (`options`: `Omit`\<[`SignMessageOptions`](/sdks/cdp-sdks-v2/typescript/solana/Types/index#signmessageoptions), `"address"`>) => `Promise`\<[`SignatureResult`](/sdks/cdp-sdks-v2/typescript/solana/Types/index#signatureresult)>;
`signTransaction`: (`options`: `Omit`\<[`SignTransactionOptions`](/sdks/cdp-sdks-v2/typescript/solana/Types/index#signtransactionoptions), `"address"`>) => `Promise`\<`SignTransactionResult`>;
`transfer`: (`options`: `Omit`\<`TransferOptions`, `"from"`>) => `Promise`\<[`SignatureResult`](/sdks/cdp-sdks-v2/typescript/solana/Types/index#signatureresult)>;
}>

A promise that resolves to the account.

#### Example

```ts theme={null}
const account = await cdp.solana.getOrCreateAccount({
  name: "MyAccount",
});
```

#### Implementation of

```ts theme={null}
SolanaClientInterface.getOrCreateAccount
```

***

### importAccount()

```ts theme={null}
importAccount(options: ImportAccountOptions): Promise<{
  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>;
}>;
```

Defined in: [client/solana/solana.ts:203](https://github.com/coinbase/cdp-sdk/blob/59b6f4f714b6e359fb2390fa1df724c8c5419568/typescript/packages/cdp-sdk/src/client/solana/solana.ts#L203)

Imports a Solana account using a private key.
The private key will be encrypted before being stored securely.

#### Parameters

##### options

[`ImportAccountOptions`](/sdks/cdp-sdks-v2/typescript/solana/Types/index#importaccountoptions)

Parameters for importing the Solana account.

#### Returns

`Promise`\<\{
`requestFaucet`: (`options`: `Omit`\<[`RequestFaucetOptions`](/sdks/cdp-sdks-v2/typescript/solana/Types/index#requestfaucetoptions), `"address"`>) => `Promise`\<[`SignatureResult`](/sdks/cdp-sdks-v2/typescript/solana/Types/index#signatureresult)>;
`sendTransaction`: (`options`: `Omit`\<[`SendTransactionOptions`](/sdks/cdp-sdks-v2/typescript/solana/Types/index#sendtransactionoptions), `"address"`>) => `Promise`\<`SendTransactionResult`>;
`signMessage`: (`options`: `Omit`\<[`SignMessageOptions`](/sdks/cdp-sdks-v2/typescript/solana/Types/index#signmessageoptions), `"address"`>) => `Promise`\<[`SignatureResult`](/sdks/cdp-sdks-v2/typescript/solana/Types/index#signatureresult)>;
`signTransaction`: (`options`: `Omit`\<[`SignTransactionOptions`](/sdks/cdp-sdks-v2/typescript/solana/Types/index#signtransactionoptions), `"address"`>) => `Promise`\<`SignTransactionResult`>;
`transfer`: (`options`: `Omit`\<`TransferOptions`, `"from"`>) => `Promise`\<[`SignatureResult`](/sdks/cdp-sdks-v2/typescript/solana/Types/index#signatureresult)>;
}>

A promise that resolves to the imported account.

#### Examples

```ts theme={null}
         const account = await cdp.solana.importAccount({
           privateKey: "3Kzj...",
         });
```

```ts theme={null}
         const account = await cdp.solana.importAccount({
           privateKey: "3Kzj...",
           name: "ImportedAccount",
         });
```

```ts theme={null}
         const idempotencyKey = uuidv4();

         const account = await cdp.solana.importAccount({
           privateKey: "3Kzj...",
           name: "ImportedAccount",
           idempotencyKey,
         });
```

#### Implementation of

```ts theme={null}
SolanaClientInterface.importAccount
```

***

### listAccounts()

```ts theme={null}
listAccounts(options?: ListAccountsOptions): Promise<ListAccountsResult>;
```

Defined in: [client/solana/solana.ts:376](https://github.com/coinbase/cdp-sdk/blob/59b6f4f714b6e359fb2390fa1df724c8c5419568/typescript/packages/cdp-sdk/src/client/solana/solana.ts#L376)

Lists all Solana accounts.

#### Parameters

##### options?

[`ListAccountsOptions`](/sdks/cdp-sdks-v2/typescript/solana/Types/index#listaccountsoptions) = `{}`

Parameters for listing the Solana accounts.

#### Returns

`Promise`\<[`ListAccountsResult`](/sdks/cdp-sdks-v2/typescript/solana/Types/index#listaccountsresult)>

A promise that resolves to an array of Solana account instances.

#### Examples

```ts theme={null}
         const accounts = await cdp.solana.listAccounts();
```

```ts theme={null}
         let page = await cdp.solana.listAccounts();

         while (page.nextPageToken) {
           page = await cdp.solana.listAccounts(&#123; pageToken: page.nextPageToken &#125;);
         }

         page.accounts.forEach(account => console.log(account));
```

}

````

#### Implementation of

```ts
SolanaClientInterface.listAccounts
````

***

### listTokenBalances()

```ts theme={null}
listTokenBalances(options: ListTokenBalancesOptions): Promise<ListTokenBalancesResult>;
```

Defined in: [client/solana/solana.ts:664](https://github.com/coinbase/cdp-sdk/blob/59b6f4f714b6e359fb2390fa1df724c8c5419568/typescript/packages/cdp-sdk/src/client/solana/solana.ts#L664)

Lists the token balances for a Solana account.

#### Parameters

##### options

[`ListTokenBalancesOptions`](/sdks/cdp-sdks-v2/typescript/solana/Types/index#listtokenbalancesoptions)

Parameters for listing the Solana token balances.

#### Returns

`Promise`\<[`ListTokenBalancesResult`](/sdks/cdp-sdks-v2/typescript/solana/Types/index#listtokenbalancesresult)>

A promise that resolves to an array of Solana token balance instances.

#### Example

```ts theme={null}
const balances = await cdp.solana.listTokenBalances(&#123; address: "...", network: "solana-devnet" &#125;);
```

#### Implementation of

```ts theme={null}
SolanaClientInterface.listTokenBalances
```

***

### requestFaucet()

```ts theme={null}
requestFaucet(options: RequestFaucetOptions): Promise<SignatureResult>;
```

Defined in: [client/solana/solana.ts:422](https://github.com/coinbase/cdp-sdk/blob/59b6f4f714b6e359fb2390fa1df724c8c5419568/typescript/packages/cdp-sdk/src/client/solana/solana.ts#L422)

Requests funds from a Solana faucet.

#### Parameters

##### options

[`RequestFaucetOptions`](/sdks/cdp-sdks-v2/typescript/solana/Types/index#requestfaucetoptions)

Parameters for requesting funds from the Solana faucet.

#### Returns

`Promise`\<[`SignatureResult`](/sdks/cdp-sdks-v2/typescript/solana/Types/index#signatureresult)>

A promise that resolves to the transaction signature.

#### Example

```ts theme={null}
         const signature = await cdp.solana.requestFaucet({
           address: "1234567890123456789012345678901234567890",
           token: "sol",
         });
```

#### Implementation of

```ts theme={null}
SolanaClientInterface.requestFaucet
```

***

### sendTransaction()

```ts theme={null}
sendTransaction(options: SendTransactionOptions): Promise<SendTransactionResult>;
```

Defined in: [client/solana/solana.ts:630](https://github.com/coinbase/cdp-sdk/blob/59b6f4f714b6e359fb2390fa1df724c8c5419568/typescript/packages/cdp-sdk/src/client/solana/solana.ts#L630)

Sends a Solana transaction using the Coinbase API.

#### Parameters

##### options

[`SendTransactionOptions`](/sdks/cdp-sdks-v2/typescript/solana/Types/index#sendtransactionoptions)

Parameters for sending the Solana transaction.

#### Returns

`Promise`\<`SendTransactionResult`>

A promise that resolves to the transaction result.

#### Example

```ts theme={null}
const signature = await cdp.solana.sendTransaction({
  network: "solana-devnet",
  transaction: "...",
  useCdpSponsor: true,
});
```

#### Implementation of

```ts theme={null}
SolanaClientInterface.sendTransaction
```

***

### signMessage()

```ts theme={null}
signMessage(options: SignMessageOptions): Promise<SignatureResult>;
```

Defined in: [client/solana/solana.ts:458](https://github.com/coinbase/cdp-sdk/blob/59b6f4f714b6e359fb2390fa1df724c8c5419568/typescript/packages/cdp-sdk/src/client/solana/solana.ts#L458)

Signs a message.

#### Parameters

##### options

[`SignMessageOptions`](/sdks/cdp-sdks-v2/typescript/solana/Types/index#signmessageoptions)

Parameters for signing the message.

#### Returns

`Promise`\<[`SignatureResult`](/sdks/cdp-sdks-v2/typescript/solana/Types/index#signatureresult)>

A promise that resolves to the signature.

#### Example

```ts theme={null}
// Create a Solana account
const account = await cdp.solana.createAccount();

// When you want to sign a message, you can do so by address
const signature = await cdp.solana.signMessage({
  address: account.address,
  message: "Hello, world!",
});
```

#### Implementation of

```ts theme={null}
SolanaClientInterface.signMessage
```

***

### signTransaction()

```ts theme={null}
signTransaction(options: SignTransactionOptions): Promise<SignTransactionResult>;
```

Defined in: [client/solana/solana.ts:531](https://github.com/coinbase/cdp-sdk/blob/59b6f4f714b6e359fb2390fa1df724c8c5419568/typescript/packages/cdp-sdk/src/client/solana/solana.ts#L531)

Signs a transaction.

#### Parameters

##### options

[`SignTransactionOptions`](/sdks/cdp-sdks-v2/typescript/solana/Types/index#signtransactionoptions)

Parameters for signing the transaction.

#### Returns

`Promise`\<`SignTransactionResult`>

A promise that resolves to the signature.

#### Example

```ts theme={null}
// Create a Solana account
const account = await cdp.solana.createAccount();

// Build your transaction using @solana/kit
import {
  address as solanaAddress,
  appendTransactionMessageInstructions,
  compileTransaction,
  createNoopSigner,
  createSolanaRpc,
  createTransactionMessage,
  getBase64EncodedWireTransaction,
  pipe,
  setTransactionMessageFeePayer,
  setTransactionMessageLifetimeUsingBlockhash,
} from "@solana/kit";
import { getTransferSolInstruction } from "@solana-program/system";

const rpc = createSolanaRpc("https://api.devnet.solana.com");
const { value: { blockhash, lastValidBlockHeight } } = await rpc.getLatestBlockhash().send();

const txMsg = pipe(
  createTransactionMessage({ version: 0 }),
  (tx) => setTransactionMessageFeePayer(solanaAddress(account.address), tx),
  (tx) => setTransactionMessageLifetimeUsingBlockhash(
    { blockhash, lastValidBlockHeight },
    tx,
  ),
  (tx) => appendTransactionMessageInstructions([
    getTransferSolInstruction({
      source: createNoopSigner(solanaAddress(account.address)),
      destination: solanaAddress("3KzDtddx4i53FBkvCzuDmRbaMozTZoJBb1TToWhz3JfE"),
      amount: 10000n,
    }),
  ], tx),
);

// Base64 encode the compiled transaction
const transaction = getBase64EncodedWireTransaction(compileTransaction(txMsg));

// Sign the transaction via the CDP API
const signature = await cdp.solana.signTransaction({
  address: account.address,
  transaction,
});
```

#### Implementation of

```ts theme={null}
SolanaClientInterface.signTransaction
```

***

### updateAccount()

```ts theme={null}
updateAccount(options?: UpdateSolanaAccountOptions): Promise<{
  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>;
}>;
```

Defined in: [client/solana/solana.ts:586](https://github.com/coinbase/cdp-sdk/blob/59b6f4f714b6e359fb2390fa1df724c8c5419568/typescript/packages/cdp-sdk/src/client/solana/solana.ts#L586)

Updates a CDP Solana account.

#### Parameters

##### options?

[`UpdateSolanaAccountOptions`](/sdks/cdp-sdks-v2/typescript/solana/Types/index#updatesolanaaccountoptions)

Optional parameters for creating the account.

#### Returns

`Promise`\<\{
`requestFaucet`: (`options`: `Omit`\<[`RequestFaucetOptions`](/sdks/cdp-sdks-v2/typescript/solana/Types/index#requestfaucetoptions), `"address"`>) => `Promise`\<[`SignatureResult`](/sdks/cdp-sdks-v2/typescript/solana/Types/index#signatureresult)>;
`sendTransaction`: (`options`: `Omit`\<[`SendTransactionOptions`](/sdks/cdp-sdks-v2/typescript/solana/Types/index#sendtransactionoptions), `"address"`>) => `Promise`\<`SendTransactionResult`>;
`signMessage`: (`options`: `Omit`\<[`SignMessageOptions`](/sdks/cdp-sdks-v2/typescript/solana/Types/index#signmessageoptions), `"address"`>) => `Promise`\<[`SignatureResult`](/sdks/cdp-sdks-v2/typescript/solana/Types/index#signatureresult)>;
`signTransaction`: (`options`: `Omit`\<[`SignTransactionOptions`](/sdks/cdp-sdks-v2/typescript/solana/Types/index#signtransactionoptions), `"address"`>) => `Promise`\<`SignTransactionResult`>;
`transfer`: (`options`: `Omit`\<`TransferOptions`, `"from"`>) => `Promise`\<[`SignatureResult`](/sdks/cdp-sdks-v2/typescript/solana/Types/index#signatureresult)>;
}>

A promise that resolves to the updated account.

#### Examples

```ts theme={null}
         const account = await cdp.sol.updateAccount({ address: "...", update: { name: "New Name" } });
```

```ts theme={null}
         const account = await cdp.sol.updateAccount(&#123; address: "...", update: &#123; accountPolicy: "73bcaeeb-d7af-4615-b064-42b5fe83a31e" &#125; });
```

```ts theme={null}
         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,
         });
```

#### Implementation of

```ts theme={null}
SolanaClientInterface.updateAccount
```
