Skip to main content
The main client class for the Grid SDK that provides comprehensive functionality for account management, authentication, and transaction processing.

Example

import { GridClient } from '@sqds/grid';

const client = new GridClient({
  apiKey: 'your-api-key',
  environment: 'sandbox',
  baseUrl: 'grid-api-base-url'
});

Properties

PropertyModifierType
apiConfigprotectedGridApiConfig

Methods

Account Management

createAccount()

createAccount(input): Promise<GridResponse<CreateAccountResponse>>;
Creates either an email-based account (requires OTP verification) or a signer-based account (immediately active).
Parameters
ParameterTypeDescription
input| CreateAccountRequest | CreateAccountInputAccount creation input (simplified) or full request object
Returns
Promise<GridResponse<CreateAccountResponse>> Promise resolving to created account information
Example
const emailAccount = await gridClient.createAccount({
  email: 'user@example.com'
});

const signerAccount = await gridClient.createAccount({
  signer: 'BKKjHs7kKsWFm8GKuFz3HzNKBjH4K4HhjhwxDHrRfKjj'
});

getAccount()

getAccount(accountAddress): Promise<GridResponse<GetAccountResponse>>;
Retrieves comprehensive account details including account type, policies, signers, thresholds, and metadata.
Parameters
ParameterTypeDescription
accountAddressstringThe account address to retrieve information for
Returns
Promise<GridResponse<GetAccountResponse>> Promise resolving to account details or error information
Example
const account = await gridClient.getAccount('account-address');

updateAccount()

updateAccount(
   accountAddress, 
   request, 
admin?): Promise<GridResponse<TransactionPayload>>;
Update account settings and configuration such as policies, signers, thresholds, and metadata.
Parameters
ParameterTypeDescription
accountAddressstringThe account address to update
requestUpdateAccountRequestUpdate request containing the fields to modify
admin?booleanWhether to perform the update with admin privileges (optional)
Returns
Promise<GridResponse<TransactionPayload>> Promise resolving to transaction response for the update operation
Example
const updateTx = await gridClient.updateAccount(accountAddress, {
  policies: {
    threshold: 2
  }
});

const adminUpdateTx = await gridClient.updateAccount(
  accountAddress,
  { policies: { threshold: 1 } },
  true
);

getAccountBalances()

getAccountBalances(accountAddress, queryParams?): Promise<GridResponse<AccountBalancesData>>;
Get account token balances Retrieves the current token balances for an account, including both native SOL and SPL token balances. Supports filtering and pagination.
Parameters
ParameterTypeDescription
accountAddressstringThe account address to get balances for
queryParams?GetAccountBalancesQueryParamsOptional query parameters for filtering and pagination
Returns
Promise<GridResponse<AccountBalancesData>> Promise resolving to account balances response
Example
const balances = await gridClient.getAccountBalances(accountAddress);

getTransfers()

getTransfers(accountAddress, options?): Promise<GridResponse<TransferResponse[]>>;
Retrieves the transaction history for an account, including incoming and outgoing transfers. Supports filtering by date range, token type, and pagination.
Parameters
ParameterTypeDescription
accountAddressstringThe account address to get transfers for
options?GetTransfersOptionsOptional filtering and pagination options
Returns
Promise<GridResponse<TransferResponse[]>> Promise resolving to transfers response with transaction history
Example
const transfers = await gridClient.getTransfers(accountAddress);

Authentication

initAuth()

initAuth(request): Promise<GridResponse<InitAuthResponse>>;
Initialize authentication for an existing user. This is the first step in the authentication process.
Note: For new users, you must call createAccount first to create an account before initializing authentication. This method is only for authenticating existing users.
Parameters
ParameterTypeDescription
request| InitAuthRequest | AuthenticationRequestAuthentication request containing email, keypair, or passkey information
Returns
Promise<GridResponse<InitAuthResponse>> Promise resolving to authentication initialization response with OTP details
Example
const response = await gridClient.initAuth({
  email: 'user@example.com'
});

completeAuth()

completeAuth(request): Promise<GridResponse<CompleteAuthResponse>>;
This is the second step in email-based authentication. Verifies the OTP code received via email and establishes an authenticated session.
Note: For new users who need to create an account, use completeAuthAndCreateAccount instead, which completes authentication and creates the account in one step.
Parameters
ParameterTypeDescription
requestCompleteAuthRequestWithOtpComplete authentication request with OTP code and user context
Returns
Promise<GridResponse<CompleteAuthResponse>> Promise resolving to authentication completion response with session data
Example
const sessionSecrets = await gridClient.generateSessionSecrets();
const response = await gridClient.completeAuth({
  otpCode: '123456',
  user: <user object received from initAuth>,
  sessionSecrets: sessionSecrets
});

completeAuthAndCreateAccount()

completeAuthAndCreateAccount(request): Promise<GridResponse<CompleteAuthAndCreateAccountResponse>>;
Combines authentication completion with account creation for streamlined onboarding. This is useful when you want to authenticate and immediately create an account.
Parameters
ParameterTypeDescription
requestCompleteAuthAndCreateAccountRequestComplete authentication and account creation request
Returns
Promise<GridResponse<CompleteAuthAndCreateAccountResponse>> Promise resolving to the created account information
Example
const sessionSecrets = await gridClient.generateSessionSecrets();

const account = await gridClient.completeAuthAndCreateAccount({
  otpCode: '123456',
  user: <user object received from createAccount>,
  sessionSecrets: sessionSecrets
});

Context Management

getContext()

getContext(): GridClientContext;
Retrieves the current context including client configuration.
Returns
GridClientContext Current Grid client context with client and user information
Example
const context = gridClient.getContext();

KYC Verification

requestKycLink(accountAddress, request): Promise<GridResponse<KycLink>>;
Generates a link for Know Your Customer (KYC) identity verification. Users complete the verification process through the provided link.
Parameters
ParameterTypeDescription
accountAddressstringThe account address to associate with KYC
requestRequestKycLinkRequestKYC link request with verification requirements
Returns
Promise<GridResponse<KycLink>> Promise resolving to KYC link response with verification URL
Example
const kycLink = await gridClient.requestKycLink(accountAddress, {
  grid_user_id: user.grid_user_id,
  type: 'individual',
  email: 'user@example.com',
  full_name: 'John Doe',
  endorsements: [],
  redirect_uri: 'https:/myapp.com/kyc-complete'
});

getKycStatus()

getKycStatus(accountAddress, kycId): Promise<GridResponse<KycStatusData>>;
Get KYC verification status Retrieves the current status of a KYC verification process, including completion status, verification level, and any required actions.
Parameters
ParameterTypeDescription
accountAddressstringThe account address associated with KYC
kycIdstringThe KYC verification identifier
Returns
Promise<GridResponse<KycStatusData>> Promise resolving to KYC status response
Example
const kycStatus = await gridClient.getKycStatus(accountAddress, kycId);
if (kycStatus.success) {
  console.log(kycStatus.data.status); / 'pending', 'approved', 'rejected'
  console.log(kycStatus.data.verificationLevel); / Verification tier achieved
}

Key Management

generateSessionSecrets()

generateSessionSecrets(): Promise<SessionSecrets>;
Generate session secrets for all supported providers
Returns
Promise<SessionSecrets> Promise resolving to an array of secrets for different providers
Example
const sessionSecrets = await gridClient.generateSessionSecrets();

Other

extractSignableTransaction()

extractSignableTransaction(transactionData): VersionedTransaction;
Extract a Solana VersionedTransaction ready to be signed using solana web3.js
Parameters
ParameterTypeDescription
transactionDataGridResponse<TransactionPayload>Grid transaction response containing the transaction
Returns
VersionedTransaction Deserialized VersionedTransaction ready for signing
Example
const preparedTx = await gridClient.prepareArbitraryTransaction(accountAddress, prepareRequest);
const signableTransaction = gridClient.extractSignableTransaction(preparedTx);

setExternallySignedTransaction()

setExternallySignedTransaction(transactionData, externallySignedTransaction): GridResponse<TransactionPayload>;
Set an externally signed transaction into Grid transaction object so you can submit it via grid api.
Parameters
ParameterTypeDescription
transactionDataGridResponse<TransactionPayload>Original Grid transaction data
externallySignedTransactionVersionedTransactionThe signed VersionedTransaction
Returns
GridResponse<TransactionPayload> Updated Grid transaction response with signed transaction data
Example
transaction.sign([externalSigner]); 

const signedTxData = gridClient.setExternallySignedTransaction(
  originalTxData,
  transaction
);

Passkey Management

getPasskeys()

getPasskeys(accountAddress): Promise<GridResponse<GetPasskeysResponse>>;
Retrieves all passkeys for an account
Parameters
ParameterTypeDescription
accountAddressstringThe account address to get passkeys for
Returns
Promise<GridResponse<GetPasskeysResponse>> Promise resolving to passkeys response with credential details
Example
const passkeys = await gridClient.getPasskeys(accountAddress);

addPasskey()

addPasskey(
   accountAddress, 
   request, 
queryParams?): Promise<GridResponse<AddPasskeyResponse>>;
Registers a new passkey for an account.
Parameters
ParameterTypeDescription
accountAddressstringThe account address to add the passkey to
requestAddPasskeyRequestPasskey registration request with credential data
queryParams?AddPasskeyQueryParamsOptional query parameters for the registration
Returns
Promise<GridResponse<AddPasskeyResponse>> Promise resolving to passkey addition response
Example
const passkeyResponse = await gridClient.addPasskey(accountAddress, {
  passkey: {
    address: "2W6cUhpELHYhTi3Cn6SmHfVhJFKgqmUJLJ5V2DQNcaXE",
    role: "secondary",
    permissions: ["CAN_INITIATE", "CAN_VOTE", "CAN_EXECUTE"]
  }
});

removePasskey()

removePasskey(
   accountAddress, 
   passkeyAddress, 
   transactionSigners?, 
queryParams?): Promise<GridResponse<RemovePasskeyResponse>>;
Removes an existing passkey credential from an account, revoking its ability to authorize transactions.
Parameters
ParameterTypeDescription
accountAddressstringThe account address that owns the passkey
passkeyAddressstringThe address of the passkey to remove
transactionSigners?string[]-
queryParams?RemovePasskeyQueryParamsOptional query parameters for the removal
Returns
Promise<GridResponse<RemovePasskeyResponse>> Promise resolving to passkey removal response
Throws
When required addresses are missing or removal fails
Example
const removeResponse = await gridClient.removePasskey(
  accountAddress,
  passkeyAddress
);

createPasskeyCredentials()

createPasskeyCredentials(params): Promise<PasskeyCredentialData>;
Initiates the WebAuthn credential creation process, prompting the user to register a new passkey using their device’s authenticator (fingerprint, face recognition, or security key).
Parameters
ParameterTypeDescription
paramsPasskeyRequestPasskey creation parameters including challenge and user info
Returns
Promise<PasskeyCredentialData> Promise resolving to credential data with public key and credential ID
Throws
When credential creation fails or is not supported
Example
const credentialData = await gridClient.createPasskeyCredentials({
  env: 'production',
  challenge: 'base64-encoded-challenge',
  slotNumber: '123',
  sessionKey: 'session-public-key-base58',
  expirationInSeconds: '3600',
  appName: 'My App',
  userId: 'user-identifier',
  redirectUrl: 'https:/myapp.com/callback'
});
Note: You can use extractPasskeyCreateParams to extract the parameters from the URL.

getPasskeyCredentials()

getPasskeyCredentials(params, credentialData?): Promise<PasskeyAssertionResponse>;
Initiates the WebAuthn authentication process, prompting the user to authenticate using their previously registered passkey.
Parameters
ParameterTypeDescription
paramsPasskeyRequestPasskey authentication parameters including challenge
credentialData?PasskeyCredentialDataOptional specific credential to authenticate with
Returns
Promise<PasskeyAssertionResponse> Promise resolving to assertion response with signature and authentication data
Throws
When authentication fails or passkey not found
Example
const assertion = await gridClient.getPasskeyCredentials({
  env: 'production',
  challenge: 'base64-encoded-challenge',
  slotNumber: '123',
  sessionKey: 'session-public-key-base58',
  expirationInSeconds: '3600',
  appName: 'My App',
  userId: 'user-identifier',
  redirectUrl: 'https:/myapp.com/callback'
});
console.log(assertion.response.signature); 
Note: You can use extractPasskeyAuthParams to extract the parameters from the URL.

extractPasskeyCreateParams()

extractPasskeyCreateParams(query): PasskeyRequest;
Parses URL search parameters to extract the necessary information for passkey credential creation.
Parameters
ParameterTypeDescription
queryURLSearchParamsURLSearchParams object containing passkey creation parameters
Returns
PasskeyRequest Parsed passkey request object ready for credential creation
Example
const urlParams = new URLSearchParams(window.location.search);
const passkeyParams = gridClient.extractPasskeyCreateParams(urlParams);

const credentials = await gridClient.createPasskeyCredentials(passkeyParams);

extractPasskeyAuthParams()

extractPasskeyAuthParams(query): PasskeyRequest;
Parses URL search parameters to extract the necessary information for passkey authentication.
Parameters
ParameterTypeDescription
queryURLSearchParamsURLSearchParams object containing passkey authentication parameters
Returns
PasskeyRequest Parsed passkey request object ready for authentication
Example
const urlParams = new URLSearchParams(window.location.search);
const authParams = gridClient.extractPasskeyAuthParams(urlParams);

const assertion = await gridClient.getPasskeyCredentials(authParams);

Passkey Sessions

createPasskeySession()

createPasskeySession(params, environment): Promise<CreatePasskeySessionResponse>;
Initiates a new passkey authentication session, preparing the necessary challenge and session data for WebAuthn authentication flow.
Parameters
ParameterTypeDescription
paramsCreatePasskeySessionRequestPasskey session creation parameters
environmentstringTarget environment (‘sandbox’ or ‘production’)
Returns
Promise<CreatePasskeySessionResponse> Promise resolving to passkey session creation response
Throws
When session creation fails
Example
await gridClient.createPasskeySession({
  action: 'create',
  sessionKey: 'session-public-key-base58',
  env: 'production',
}, 'production');

authorizePasskeySession()

authorizePasskeySession(params, environment): Promise<AuthorizePasskeySessionResponse>;
Submits passkey authentication data to authorize an existing session, completing the WebAuthn authentication flow.
Parameters
ParameterTypeDescription
paramsAuthorizePasskeySessionRequestPasskey session authorization parameters with authentication data
environmentstringTarget environment (‘sandbox’ or ‘production’)
Returns
Promise<AuthorizePasskeySessionResponse> Promise resolving to session authorization response
Throws
When session authorization fails
Example
const authorization = await gridClient.authorizePasskeySession({
  sessionKey: 'public-key-base58',
  metaInfo: {
    appName: 'My App',
    redirectUrl: 'https:/myapp.com/callback'
  },
  baseUrl: 'base-url'
}, 'sandbox');

submitPasskeySession()

submitPasskeySession(params, environment): Promise<SubmitPasskeySessionResponse>;
Finalizes a passkey authentication session, generating the final session tokens and account access credentials.
Parameters
ParameterTypeDescription
paramsSubmitPasskeySessionRequestPasskey session submission parameters
environmentstringTarget environment (‘sandbox’ or ‘production’)
Returns
Promise<SubmitPasskeySessionResponse> Promise resolving to session submission response with account details
Throws
When session submission fails
Example
const result = await gridClient.submitPasskeySession({
  authenticatorResponse: <attestationObject from getPasskeySession>,
  sessionKey: 'public-key-base58',
  ceremonyType: 'auth',
  slotNumber: 123
}, 'sandbox');

findPasskeyAccount()

findPasskeyAccount(params, environment): Promise<FindPasskeyAccountResponse>;
Searches for an existing passkey account using credential information, allowing users to recover access to their accounts.
Parameters
ParameterTypeDescription
paramsFindPasskeyAccountRequestPasskey account search parameters with credential data
environmentstringTarget environment (‘sandbox’ or ‘production’)
Returns
Promise<FindPasskeyAccountResponse> Promise resolving to found passkey account information
Throws
When account search fails or account not found
Example
const account = await gridClient.findPasskeyAccount({
  sessionKey: 'public-key-base58',
  authenticatorResponse: <attestationObject from getPasskeySession>
}, 'sandbox');

getPasskeyAccount()

getPasskeyAccount(passkeyAddress, environment): Promise<GetPasskeySessionResponse>;
Retrieves detailed information about a specific passkey account, including session status and account metadata.
Parameters
ParameterTypeDescription
passkeyAddressstringThe passkey account address to retrieve
environmentstringTarget environment (‘sandbox’ or ‘production’)
Returns
Promise<GetPasskeySessionResponse> Promise resolving to passkey account details
Throws
When passkey address is missing or request fails
Example
const account = await gridClient.getPasskeyAccount(
  'passkey-account-address',
  'sandbox'
);

Payment Processing

createPaymentIntent()

createPaymentIntent(accountAddress, request): Promise<GridResponse<CreatePaymentIntentResponse>>;
Initiates a payment intent that allows users to deposit fiat currency and receive cryptocurrency in their account. Handles the complete fiat-to-crypto conversion process.
Parameters
ParameterTypeDescription
accountAddressstringThe account address to receive the converted crypto
requestCreatePaymentIntentRequestPayment intent request with amount, currency, and payment method
Returns
Promise<GridResponse<CreatePaymentIntentResponse>> Promise resolving to payment intent response with transaction details
Example
const paymentIntent = await gridClient.createPaymentIntent(accountAddress, {
  amount: "100000",
  grid_user_id: user.grid_user_id,
  source: {
    account: accountAddress,
    currency: "usdc"
  },
  destination: {
    address: "3ciascNndLTBrDQXvs8nzZgWAiaL33tGM6fx3zzM7Fxt",
    currency: "usdc"
  }
});
console.log(paymentIntent.data.paymentUrl);

Spending Limits

createSpendingLimit()

createSpendingLimit(smartAccountAddress, request): Promise<GridResponse<CreateSpendingLimitResponsePayload>>;
Creates a new spending limit.
Parameters
ParameterTypeDescription
smartAccountAddressstringThe account address to create spending limit for
requestSpendingLimitRequestSpending limit configuration including amount, token, and period
Returns
Promise<GridResponse<CreateSpendingLimitResponsePayload>> Promise resolving to transaction response for spending limit creation
Example
const spendingLimitTx = await gridClient.createSpendingLimit(accountAddress, {
  amount: 10000000, 
  mint: '4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU',
  period: 'daily',
  spending_limit_signers: ['limit-signer-address']
});

updateSpendingLimit()

updateSpendingLimit(
   accountAddress, 
   spendingLimitAddress, 
request): Promise<GridResponse<SpendingLimitResponsePayload>>;
Modifies the parameters of an existing spending limit, such as the amount, time period, or associated signers.
Parameters
ParameterTypeDescription
accountAddressstringThe account address that owns the spending limit
spendingLimitAddressstringThe address of the spending limit to update
requestUpdateSpendingLimitRequestUpdate request with new spending limit parameters
Returns
Promise<GridResponse<SpendingLimitResponsePayload>> Promise resolving to transaction response for the update
Example
const updateTx = await gridClient.updateSpendingLimit(
  amount: "5000000",
  spending_limit_signers: ['signer-address']
);

deleteSpendingLimit()

deleteSpendingLimit(accountAddress, spendingLimitAddress): Promise<GridResponse<SpendingLimitResponsePayload>>;
Delete a spending limit Removes an existing spending limit from an account, allowing unrestricted spending for the associated token type.
Parameters
ParameterTypeDescription
accountAddressstringThe account address that owns the spending limit
spendingLimitAddressstringThe address of the spending limit to delete
Returns
Promise<GridResponse<SpendingLimitResponsePayload>> Promise resolving to transaction response for the deletion
Throws
When required addresses are missing or deletion fails
Example
const deleteTx = await gridClient.deleteSpendingLimit(
  accountAddress,
  spendingLimitAddress
);

useSpendingLimit()

useSpendingLimit(
   accountAddress, 
   spendingLimitAddress, 
request): Promise<GridResponse<SpendingLimitResponsePayload>>;
Use a spending limit for a transaction Utilizes an existing spending limit to authorize a transaction, automatically checking that the transaction amount is within the limit constraints.
Parameters
ParameterTypeDescription
accountAddressstringThe account address that owns the spending limit
spendingLimitAddressstringThe address of the spending limit to use
requestUseSpendingLimitRequestTransaction request to authorize against the spending limit
Returns
Promise<GridResponse<SpendingLimitResponsePayload>> Promise resolving to transaction response for the authorized transaction
Example
const limitTx = await gridClient.useSpendingLimit(
  accountAddress,
  spendingLimitAddress,
  {
    amount: 500000000, 
    signer_address: "signer-address",
    recipient_address: "recipient-address"
  }
);

Standing Orders

createStandingOrder()

createStandingOrder(accountAddress, request): Promise<GridResponse<CreateStandingOrderResponse>>;
Create a standing order.
Parameters
ParameterTypeDescription
accountAddressstringThe account address that will make the recurring payments
requestCreateStandingOrderRequestStanding order request with payment details and schedule
Returns
Promise<GridResponse<CreateStandingOrderResponse>> Promise resolving to standing order creation response
Example
const standingOrder = await gridClient.createStandingOrder(accountAddress, {
  amount: "500000",
  grid_user_id: "grid-user-id",
  source: {
    account: "source-address",
    currency: "usdc"
  },
  destination: {
    address: "destination-address",
    currency: "usdc"
  },
  frequency: "weekly",
  start_date: "2024-12-02T10:00:00Z",
  end_date: "2025-12-31T23:59:59Z"
});

getStandingOrders()

getStandingOrders(accountAddress, queryParams?): Promise<GridResponse<StandingOrder[]>>;
Retrieves all standing orders associated with an account, including active, paused, and completed recurring payment schedules.
Parameters
ParameterTypeDescription
accountAddressstringThe account address to get standing orders for
queryParams?GetStandingOrdersQueryParamsOptional query parameters for filtering and pagination
Returns
Promise<GridResponse<StandingOrder[]>> Promise resolving to standing orders response
Example
const standingOrders = await gridClient.getStandingOrders(accountAddress);

getStandingOrder()

getStandingOrder(accountAddress, standingOrderId): Promise<GridResponse<StandingOrder>>;
Retrieves detailed information about a specific standing order, including its current status, execution history, and next payment date.
Parameters
ParameterTypeDescription
accountAddressstringThe account address that owns the standing order
standingOrderIdstringThe unique identifier of the standing order
Returns
Promise<GridResponse<StandingOrder>> Promise resolving to standing order details response
Example
const order = await gridClient.getStandingOrder(accountAddress, orderId);

Transaction Processing

prepareArbitraryTransaction()

prepareArbitraryTransaction(
   accountAddress, 
   request, 
queryParams?): Promise<GridResponse<TransactionPayload>>;
Prepares any Solana transaction for signing by adding necessary account metadata, fee calculations, and smart account integration.
Parameters
ParameterTypeDescription
accountAddressstringThe account address that will sign the transaction
requestPrepareArbitraryTransactionRequestTransaction preparation request with the raw transaction
queryParams?PrepareArbitraryTransactionQueryParamsOptional query parameters for transaction preparation
Returns
Promise<GridResponse<TransactionPayload>> Promise resolving to prepared transaction response ready for signing
Example
const preparedTx = await gridClient.prepareArbitraryTransaction(accountAddress, {
  transaction: 'base64-encoded-solana-transaction'
});

const signedTx = await gridClient.sign({
  sessionSecrets: sessionSecrets,
  transactionPayload: preparedTx.data
});

Transaction Signing

sign()

sign(request): Promise<TransactionResult>;
Automatically selects the appropriate authentication provider based on the session context and available session secrets.
Parameters
ParameterTypeDescription
requestSignRequestSign request containing transaction payload and session secrets
Returns
Promise<TransactionResult> Promise resolving to transaction result with signatures and metadata
Throws
When signing fails or provider is unavailable
Example
const authResult = await gridClient.completeAuth(payload);
const preparedTx = await gridClient.prepareArbitraryTransaction(accountAddress, {
  transaction: 'base64-encoded-transaction'
});

const signResult = await gridClient.sign({
  sessionSecrets: sessionSecrets,
  transactionPayload: preparedTx.data,
  session: authResult.data.authentication
});

signAndSend()

signAndSend(request): Promise<TransactionSubmissionResponse>;
Sign and send a transaction. Automatically selects the appropriate authentication provider based on the session context and available session secrets
Parameters
ParameterTypeDescription
requestSignAndSendRequestSign and send request containing transaction payload and session secrets
Returns
Promise<TransactionSubmissionResponse> Promise resolving to transaction submission result with blockchain signature
Throws
When signing or submission fails
Example
const authResult = await gridClient.completeAuth(payload);
const preparedTx = await gridClient.prepareArbitraryTransaction(accountAddress, {
  transaction: 'base64-encoded-transaction'
});

const result = await gridClient.signAndSend({
  sessionSecrets: sessionSecrets,
  transactionPayload: preparedTx.data,
  session: authResult.data.authentication,
  address: accountAddress
});


send()

send(request): Promise<TransactionSubmissionResponse>;
Submits a previously signed transaction to the Solana blockchain through the Grid API.
Parameters
ParameterTypeDescription
requestSendTransactionRequestSend request containing the signed transaction and account address
Returns
Promise<TransactionSubmissionResponse> Promise resolving to transaction submission result with signature
Throws
When transaction submission fails or validation errors occur
Example
const signedTx = await gridClient.sign({ ... });
const result = await gridClient.send({
  signedTransactionPayload: signedTx,
  address: 'account-address'
});

Utilities

getSessionKeyObject()

getSessionKeyObject(sessionKeyString, expirationInSeconds): SessionKey;
Helper function to create session key object from string and expiration
Parameters
ParameterTypeDescription
sessionKeyStringstringBase58-encoded session key string
expirationInSecondsstringExpiration time as a string (seconds since epoch)
Returns
SessionKey SessionKey object with decoded key bytes and parsed expiration
Example
const sessionKey = gridClient.getSessionKeyObject(
  'base58-encoded-key',
  '900'
);

Virtual Accounts

requestVirtualAccount()

requestVirtualAccount(accountAddress, request): Promise<GridResponse<VirtualAccount>>;
Creates a virtual bank account that allows users to receive fiat deposits which are automatically converted to cryptocurrency in their Grid account.
Parameters
ParameterTypeDescription
accountAddressstringThe account address to associate with the virtual account
requestRequestVirtualAccountRequestVirtual account request with banking details and preferences
Returns
Promise<GridResponse<VirtualAccount>> Promise resolving to virtual account response with banking details
Example
const virtualAccount = await gridClient.requestVirtualAccount(accountAddress, {
  grid_user_id: 'grid-user-id',
  currency: 'usd' as const
});

getVirtualAccounts()

getVirtualAccounts(accountAddress, queryParams?): Promise<GridResponse<VirtualAccount[]>>;
Retrieves all virtual bank accounts associated with a Grid account, including their status, balances, and transaction history.
Parameters
ParameterTypeDescription
accountAddressstringThe account address to get virtual accounts for
queryParams?GetVirtualAccountsQueryParamsOptional query parameters for filtering and pagination
Returns
Promise<GridResponse<VirtualAccount[]>> Promise resolving to virtual accounts response
Example
const virtualAccounts = await gridClient.getVirtualAccounts(accountAddress);
I