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
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
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
Parameter | Type | Description |
---|
accountAddress | string | The 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
Parameter | Type | Description |
---|
accountAddress | string | The account address to update |
request | UpdateAccountRequest | Update request containing the fields to modify |
admin? | boolean | Whether 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
Parameter | Type | Description |
---|
accountAddress | string | The account address to get balances for |
queryParams? | GetAccountBalancesQueryParams | Optional 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
Parameter | Type | Description |
---|
accountAddress | string | The account address to get transfers for |
options? | GetTransfersOptions | Optional 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
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
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
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()
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
Parameter | Type | Description |
---|
accountAddress | string | The account address to associate with KYC |
request | RequestKycLinkRequest | KYC 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
Parameter | Type | Description |
---|
accountAddress | string | The account address associated with KYC |
kycId | string | The 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(transactionData): VersionedTransaction;
Extract a Solana VersionedTransaction ready to be signed using solana web3.js
Parameters
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
Parameter | Type | Description |
---|
transactionData | GridResponse <TransactionPayload > | Original Grid transaction data |
externallySignedTransaction | VersionedTransaction | The 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
Parameter | Type | Description |
---|
accountAddress | string | The 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
Parameter | Type | Description |
---|
accountAddress | string | The account address to add the passkey to |
request | AddPasskeyRequest | Passkey registration request with credential data |
queryParams? | AddPasskeyQueryParams | Optional 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
Parameter | Type | Description |
---|
accountAddress | string | The account address that owns the passkey |
passkeyAddress | string | The address of the passkey to remove |
transactionSigners? | string [] | - |
queryParams? | RemovePasskeyQueryParams | Optional 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
Parameter | Type | Description |
---|
params | PasskeyRequest | Passkey 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
Parameter | Type | Description |
---|
params | PasskeyRequest | Passkey authentication parameters including challenge |
credentialData? | PasskeyCredentialData | Optional 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(query): PasskeyRequest;
Parses URL search parameters to extract the necessary information
for passkey credential creation.
Parameters
Parameter | Type | Description |
---|
query | URLSearchParams | URLSearchParams 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(query): PasskeyRequest;
Parses URL search parameters to extract the necessary information
for passkey authentication.
Parameters
Parameter | Type | Description |
---|
query | URLSearchParams | URLSearchParams 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
Parameter | Type | Description |
---|
params | CreatePasskeySessionRequest | Passkey session creation parameters |
environment | string | Target 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
Parameter | Type | Description |
---|
params | AuthorizePasskeySessionRequest | Passkey session authorization parameters with authentication data |
environment | string | Target 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
Parameter | Type | Description |
---|
params | SubmitPasskeySessionRequest | Passkey session submission parameters |
environment | string | Target 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
Parameter | Type | Description |
---|
params | FindPasskeyAccountRequest | Passkey account search parameters with credential data |
environment | string | Target 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
Parameter | Type | Description |
---|
passkeyAddress | string | The passkey account address to retrieve |
environment | string | Target 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
Parameter | Type | Description |
---|
accountAddress | string | The account address to receive the converted crypto |
request | CreatePaymentIntentRequest | Payment 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
Parameter | Type | Description |
---|
smartAccountAddress | string | The account address to create spending limit for |
request | SpendingLimitRequest | Spending 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
Parameter | Type | Description |
---|
accountAddress | string | The account address that owns the spending limit |
spendingLimitAddress | string | The address of the spending limit to update |
request | UpdateSpendingLimitRequest | Update 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
Parameter | Type | Description |
---|
accountAddress | string | The account address that owns the spending limit |
spendingLimitAddress | string | The 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
Parameter | Type | Description |
---|
accountAddress | string | The account address that owns the spending limit |
spendingLimitAddress | string | The address of the spending limit to use |
request | UseSpendingLimitRequest | Transaction 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
Parameter | Type | Description |
---|
accountAddress | string | The account address that will make the recurring payments |
request | CreateStandingOrderRequest | Standing 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
Parameter | Type | Description |
---|
accountAddress | string | The account address to get standing orders for |
queryParams? | GetStandingOrdersQueryParams | Optional 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
Parameter | Type | Description |
---|
accountAddress | string | The account address that owns the standing order |
standingOrderId | string | The 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
Parameter | Type | Description |
---|
accountAddress | string | The account address that will sign the transaction |
request | PrepareArbitraryTransactionRequest | Transaction preparation request with the raw transaction |
queryParams? | PrepareArbitraryTransactionQueryParams | Optional 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
Parameter | Type | Description |
---|
request | SignRequest | Sign 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
Parameter | Type | Description |
---|
request | SignAndSendRequest | Sign 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
Parameter | Type | Description |
---|
request | SendTransactionRequest | Send 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
Parameter | Type | Description |
---|
sessionKeyString | string | Base58-encoded session key string |
expirationInSeconds | string | Expiration 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
Parameter | Type | Description |
---|
accountAddress | string | The account address to associate with the virtual account |
request | RequestVirtualAccountRequest | Virtual 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
Parameter | Type | Description |
---|
accountAddress | string | The account address to get virtual accounts for |
queryParams? | GetVirtualAccountsQueryParams | Optional query parameters for filtering and pagination |
Returns
Promise
<GridResponse
<VirtualAccount
[]>>
Promise resolving to virtual accounts response
Example
const virtualAccounts = await gridClient.getVirtualAccounts(accountAddress);