Skip to main content
Grid SDK client for account management, authentication, and transactions

Example

Properties

Accessors

Account Management

account

Get Signature
Account manager for reactive state management Provides access to account state and event subscriptions for reactive updates. Subscribe to the ‘change’ event to receive notifications when the account state changes.
Example
Returns
AccountManager

Methods

Account Management

getAccount()

Retrieves comprehensive account details including account type, policies, signers, thresholds, and metadata.
Parameters
Returns
Promise<GetAccountResponse> Promise resolving to account details or error information
Example

updateAccount()

Update account settings and configuration such as policies, signers, thresholds, and metadata.
Parameters
Returns
Promise<TransactionResponse> Promise resolving to transaction response for the update operation
Example

getTransfers()

Retrieves the transaction history for an account, including incoming and outgoing transfers. Supports filtering by date range, token type, and pagination.
Parameters
Returns
Promise<TransferResponse> Promise resolving to transfers response with transaction history
Example

getTransactions()

Retrieves the blockchain transaction history for an account Returns a list of Solana blockchain transactions associated with the account, including transaction signatures, statuses, and timestamps. This includes all on-chain activity for the account.
Parameters
Returns
Promise<GetTransactionsResponse> Promise resolving to transaction history response
Example

Authentication

initAuth()

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
Returns
Promise<InitAuthResponse> Promise resolving to authentication initialization response with OTP details
Example

completeAuth()

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
Returns
Promise<CompleteAuthResponse> Promise resolving to authentication completion response with session data
Example

completeAuthAndCreateAccount()

Complete authentication and create account (streamlined onboarding)
Parameters
Returns
Promise<CompleteAuthAndCreateAccountResponse> Created account information
Example

refreshSession()

Refresh MPC provider session to extend lifetime
Note: Currently supports Privy only. Turnkey refresh not yet implemented.
Parameters
Returns
Promise<RefreshSessionResponse> Refreshed session data
Example

createAccount()

Creates either an email-based account (requires OTP verification) or a signer-based account (immediately active).
Parameters
Returns
Promise<CreateAccountResponse> Promise resolving to created account information
Note: When passing AccountPolicies with signers, role defaults to ‘primary’ and provider defaults to ‘external’ if not specified.
Examples

Configuration

getConfig()

Get client configuration
Returns
GridApiConfig
Example

KYC Verification

Generates a link for Know Your Customer (KYC) identity verification. Users complete the verification process through the provided link.
Parameters
Returns
Promise<KycLinkResponse> Promise resolving to KYC link response with verification URL
Example

getKycStatus()

Get KYC verification status Retrieves the current status of a KYC verification process, including completion status, verification level, and any required actions.
Parameters
Returns
Promise<KycStatusResponse> Promise resolving to KYC status response
Example

Key Management

generateSessionSecrets()

Generate session secrets for all supported providers
Returns
Promise<SessionSecrets>
Example

Other

extractSignableTransaction()

Extract a Solana VersionedTransaction ready to be signed using solana web3.js
Parameters
Returns
VersionedTransaction Deserialized VersionedTransaction ready for signing
Example

setExternallySignedTransaction()

Set an externally signed transaction into Grid transaction object so you can submit it via grid api.
Parameters
Returns
TransactionPayload Updated Grid transaction response with signed transaction data
Example

getAccountBalances()

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
Returns
Promise<AccountBalancesResponse> Promise resolving to account balances response
Example

Passkey Management

getPasskeys()

Retrieves all passkeys for an account
Parameters
Returns
Promise<GetPasskeysResponse> Promise resolving to passkeys response with credential details
Example

addPasskey()

Registers a new passkey for an account.
Parameters
Returns
Promise<AddPasskeyResponse> Promise resolving to passkey addition response
Example

removePasskey()

Removes an existing passkey credential from an account, revoking its ability to authorize transactions.
Parameters
Returns
Promise<RemovePasskeyResponse> Promise resolving to passkey removal response
Example

createPasskeyCredentials()

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
Returns
Promise<PasskeyCredentialData> Promise resolving to credential data with public key and credential ID
Example
Note: You can use extractPasskeyCreateParams to extract the parameters from the URL.

getPasskeyCredentials()

Initiates the WebAuthn authentication process, prompting the user to authenticate using their previously registered passkey.
Parameters
Returns
Promise<PasskeyAssertionResponse> Promise resolving to assertion response with signature and authentication data
Example
Note: You can use extractPasskeyAuthParams to extract the parameters from the URL.

extractPasskeyCreateParams()

Parses URL search parameters to extract the necessary information for passkey credential creation.
Parameters
Returns
PasskeyRequest Parsed passkey request object ready for credential creation
Example

extractPasskeyAuthParams()

Parses URL search parameters to extract the necessary information for passkey authentication.
Parameters
Returns
PasskeyRequest Parsed passkey request object ready for authentication
Example

createPasskeyAccount()

Creates both a passkey account (externally signed account) and smart account in one call. This combines the passkey creation ceremony with smart account initialization. Creates a 1/1 smart account with the passkey having full permissions.
Parameters
Returns
Promise<CreatePasskeyAccountResponse> Promise resolving to the created smart account details including passkey info
Example

Passkey Sessions

createPasskeySession()

Initiates a new passkey authentication session, preparing the necessary challenge and session data for WebAuthn authentication flow.
Parameters
Returns
Promise<CreatePasskeySessionResponse> Promise resolving to passkey session creation response
Example

authorizePasskeySession()

Submits passkey authentication data to authorize an existing session, completing the WebAuthn authentication flow.
Parameters
Returns
Promise<AuthorizePasskeySessionResponse> Promise resolving to session authorization response
Example

submitPasskeySession()

Finalizes a passkey authentication session, generating the final session tokens and account access credentials.
Parameters
Returns
Promise<SubmitPasskeySessionResponse> Promise resolving to session submission response with account details
Example

findPasskeyAccount()

Searches for an existing passkey account using credential information, allowing users to recover access to their accounts.
Parameters
Returns
Promise<FindPasskeyAccountResponse> Promise resolving to found passkey account information
Example

getPasskeyAccount()

Retrieves detailed information about a specific passkey account, including relying party ID, public key, and optional session key if not expired.
Parameters
Returns
Promise<GetPasskeyAccountResponse> Promise resolving to passkey account details with relying party ID, public key, and optional session key
Example

Payment Processing

createPaymentIntent()

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.
Note: Non-Enterprise customers must provide a feeConfig in the request.
Enterprise customers may omit it as fees are handled by their plan.
Parameters
Returns
Promise<CreatePaymentIntentResponse> Promise resolving to payment intent response with transaction details
Example

Proposal

createProposal()

Create a proposal
Parameters
Returns
Promise<CreateProposalResponse> Promise resolving to create proposal response
Example

voteProposal()

Vote on a proposal Vote to approve, reject, or cancel a proposal on a smart account.
Parameters
Returns
Promise<VoteProposalResponse> Promise resolving to vote proposal response with unsigned transaction
Example

executeProposal()

Execute a proposal Execute an approved proposal on a smart account. Important:
  • Signer must have CAN_EXECUTE permission
  • Proposal must be in Approved state
  • Returns unsigned transaction with signatures
  • The transactionSignatures array can contain multiple signatures
Parameters
Returns
Promise<ExecuteProposalResponse> Promise resolving to execute proposal response with unsigned transaction
Example

Spending Limits

createSpendingLimit()

Creates a new spending limit.
Parameters
Returns
Promise<CreateSpendingLimitResponse> Promise resolving to transaction response for spending limit creation
Example

updateSpendingLimit()

Modifies the parameters of an existing spending limit, such as the amount, time period, or associated signers.
Parameters
Returns
Promise<SpendingLimitTransactionResponse> Promise resolving to transaction response for the update
Example

deleteSpendingLimit()

Delete a spending limit Removes an existing spending limit from an account, allowing unrestricted spending for the associated token type.
Parameters
Returns
Promise<SpendingLimitTransactionResponse> Promise resolving to transaction response for the deletion
Example

useSpendingLimit()

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
Returns
Promise<SpendingLimitTransactionResponse> Promise resolving to transaction response for the authorized transaction
Example

getSpendingLimit()

Retrieves a spending limit by its address
Parameters
Returns
Promise<SpendingLimitResponse> Promise resolving to spending limit data
Example

getSpendingLimits()

Retrieves all spending limits for an account
Parameters
Returns
Promise<SpendingLimitsResponse> Promise resolving to array of spending limit data
Example

Standing Orders

createStandingOrder()

Create a standing order.
Parameters
Returns
Promise<CreateStandingOrderResponse> Promise resolving to standing order creation response
Example

getStandingOrders()

Retrieves all standing orders associated with an account, including active, paused, and completed recurring payment schedules.
Parameters
Returns
Promise<StandingOrdersResponse> Promise resolving to standing orders response
Example

getStandingOrder()

Retrieves detailed information about a specific standing order, including its current status, execution history, and next payment date.
Parameters
Returns
Promise<StandingOrderResponse> Promise resolving to standing order details response
Example

Transaction Processing

prepareArbitraryTransaction()

Prepares any Solana transaction for signing by adding necessary account metadata, fee calculations, and smart account integration.
Parameters
Returns
Promise<TransactionResponse> Promise resolving to prepared transaction response ready for signing
Example

Transaction Signing

sign()

Automatically selects the appropriate authentication provider based on the session context and available session secrets.
Parameters
Returns
Promise<TransactionResult> Promise resolving to transaction result with signatures and metadata
Example

signAndSend()

Sign and send a transaction. Automatically selects the appropriate authentication provider based on the session context and available session secrets
Parameters
Returns
Promise<TransactionSubmissionResponse> Promise resolving to transaction submission result with blockchain signature
Example

send()

Submits a previously signed transaction to the Solana blockchain through the Grid API.
Parameters
Returns
Promise<TransactionSubmissionResponse> Promise resolving to transaction submission result with signature
Example

Utilities

getSessionKeyObject()

Helper function to create session key object from string and expiration
Parameters
Returns
SessionKey SessionKey object with decoded key bytes and parsed expiration
Example

getEnvironment()

Get the current environment configuration Returns the environment the SDK is configured to use. This is useful for determining which network (devnet/mainnet) operations are targeting.
Returns
"sandbox" | "production" The current environment (‘sandbox’ for devnet, ‘production’ for mainnet)
Example

Virtual Accounts

requestVirtualAccount()

Creates a virtual bank account that allows users to receive fiat deposits which are automatically converted to cryptocurrency in their Grid account.
Parameters
Returns
Promise<VirtualAccountResponse> Promise resolving to virtual account response with banking details
Example

getVirtualAccounts()

Retrieves all virtual bank accounts associated with a Grid account, including their status, balances, and transaction history.
Parameters
Returns
Promise<VirtualAccountsResponse> Promise resolving to virtual accounts response
Example