import { Keypair, VersionedTransaction } from '@solana/web3.js'; interface SignRequest { sessionSecrets: TaggedKeyPair[] | Keypair[]; session?: any[]; transactionPayload: TransactionPayload; provider?: SignerProvider; } interface SignAndSendRequest { sessionSecrets: TaggedKeyPair[] | Keypair[]; session?: any[]; transactionPayload: TransactionPayload; address: string; } interface SignatureResult { provider: SignerProvider; signature: string; publicKey: string; timestamp: number; } interface SignResult { signatures: SignatureResult[]; payload?: string; aggregatedSignature?: string; } interface TransactionPayload { transaction: string; transactionSigners: string[]; kmsPayloads: KmsPayload[]; } interface TransactionResponse extends BaseResponse { } declare enum KmsProvider { PRIVY = "privy", TURNKEY = "turnkey" } interface TurnkeyKmsSignedPayload { public_key: string; signature: string; timestamp_ms: string; } interface PrivyKmsSignedPayload { signature: string; } interface KmsSingature { provider: KmsProvider; kms_signed_payload?: TurnkeyKmsSignedPayload | PrivyKmsSignedPayload; signature?: string; } interface TransactionResult { transaction: string; kmsPayloads: KmsSingature[]; } declare class SigningManager { constructor(); private getUnsignedSigners; private isEmptySignature; private hasPublicKeySigned; sign(request: SignRequest): Promise; private signWithPrivyProvider; private signWithTurnkeyProvider; private signWithSolanaProvider; private signWithPasskeyProvider; private selectKeypairsFromSession; private selectKeypairsFromTransactionSigners; private aggregateSignatures; } interface PrivyInitAuthRequest extends InitAuthRequest { email?: string; provider?: string; } interface PrivyCompleteAuthRequest extends CompleteAuthRequest { email: string; otpCode: string; authPublicKey: string; smartAccountAddress?: string; } interface PrivyCompleteAuthResponse extends BaseResponse<{ address: string; policies?: AccountPolicies; gridUserId?: string; authentication: AuthenticationData; provider?: string; session?: PrivySession; }> { } interface PrivySession { userId: string; session: PrivyAuthenticateResponse; } interface PrivyAuthenticateResponse extends BaseResponse<{ encryptedAuthorizationKey?: EncryptedAuthorizationKey; authorizationKey?: string; expiresAt: number; wallets: PrivyWallet[]; }> { } interface PrivyWallet { id: string; address: string; chainType: string; chainId?: string; walletIndex?: number; walletClient: string; walletClientType?: string; connectorType?: string; delegated?: boolean; imported?: boolean; recoveryMethod?: string; verifiedAt: number; firstVerifiedAt: number; latestVerifiedAt: number; } interface TurnkeyInitAuthRequest extends InitAuthRequest { email?: string; appName?: string; appIconUrl?: string; provider?: 'privy' | 'turnkey'; } interface TurnkeyCompleteAuthRequest extends CompleteAuthRequest { email: string; mpcPrimaryId?: string; otpId: string; otpCode: string; authPublicKey: string; smartAccountAddress?: string; } interface TurnkeyCompleteAuthResponse extends BaseResponse<{ address: string; policies?: AccountPolicies; gridUserId?: string; authentication: AuthenticationData; }> { } interface GridErrorDetail { field: string; code: string; message: string; suggestion?: string; documentation?: string; } type GridEnvironment = "sandbox" | "production"; interface GridApiConfig { apiKey?: string; environment: GridEnvironment; baseUrl?: string; appId?: string; timeout?: number; retryAttempts?: number; solanaRpcUrl?: string; } declare class GridApiClient { private environment; private config; private baseUrl?; private utilityService; constructor(config: GridApiConfig); private generateIdempotencyKey; hasApiKey(): boolean; createPasskeySession(params: CreatePasskeySessionRequest, environment: string): Promise; authorizePasskeySession(params: AuthorizePasskeySessionRequest, environment: string): Promise; submitPasskeySession(params: SubmitPasskeySessionRequest, environment: string): Promise; findPasskeyAccount(params: FindPasskeyAccountRequest, environment: string): Promise; getPasskeyAccount(passkeyAddress: string, environment: string): Promise; createPasskeyAccount(params: CreatePasskeyAccountRequest, environment: string): Promise; initAuthWithTurnkey(request: TurnkeyInitAuthRequest): Promise; completeTurnkeyAuth(data: TurnkeyCompleteAuthRequest): Promise; completeTurnkeyAuthAndCreateAccount(data: TurnkeyCompleteAuthRequest): Promise; initAuthWithPrivy(request: PrivyInitAuthRequest): Promise; completePrivyAuthAndCreateAccount(data: PrivyCompleteAuthRequest): Promise; completePrivyAuth(data: PrivyCompleteAuthRequest): Promise; refreshSession(request: RefreshSessionRequest): Promise; sendTransaction(address: string, transactionId: string, payload: ConfirmPayload): Promise; submitPrivyTransaction(smartAccountAddress: string, submitPayload: any): Promise; submitTransaction(smartAccountAddress: string, submitPayload: any): Promise; getAccount(address: string): Promise; getTransactions(address: string): Promise; getAccountBalances(address: string, queryParams?: GetAccountBalancesQueryParams): Promise; getTransfers(address: string, options?: GetTransfersOptions): Promise; getBalance(address: string): Promise; createSpendingLimit(smartAccountAddress: string, request: SpendingLimitRequest): Promise; updateSpendingLimit(accountAddress: string, spendingLimitAddress: string, request: UpdateSpendingLimitRequest): Promise; deleteSpendingLimit(accountAddress: string, spendingLimitAddress: string): Promise; useSpendingLimit(accountAddress: string, spendingLimitAddress: string, request: UseSpendingLimitRequest): Promise; getSpendingLimit(accountAddress: string, spendingLimitAddress: string): Promise; getSpendingLimits(accountAddress: string): Promise; getPasskeys(accountAddress: string): Promise; addPasskey(accountAddress: string, request: AddPasskeyRequest, queryParams?: AddPasskeyQueryParams): Promise; removePasskey(accountAddress: string, passkeyAddress: string, transactionSigners?: string[], queryParams?: RemovePasskeyQueryParams): Promise; createAccount(request: CreateAccountRequest): Promise; updateAccount(accountAddress: string, request: UpdateAccountRequest, admin?: boolean): Promise; createPaymentIntent(accountAddress: string, request: CreatePaymentIntentRequest): Promise; requestKycLink(accountAddress: string, request: RequestKycLinkRequest): Promise; getKycStatus(accountAddress: string, kycId: string): Promise; prepareArbitraryTransaction(accountAddress: string, request: PrepareArbitraryTransactionRequest, queryParams?: PrepareArbitraryTransactionQueryParams): Promise; createProposal(accountAddress: string, request: CreateProposalRequest): Promise; voteProposal(accountAddress: string, proposalAddress: string, request: VoteProposalRequest): Promise; executeProposal(accountAddress: string, proposalAddress: string, request: ExecuteProposalRequest): Promise; createTradeSmartTransaction(accountAddress: string, request: CreateTradeSmartTransactionRequest): Promise; getTradeSmartTransactionQuote(accountAddress: string, smartTransactionAddress: string, request: TradeSmartTransactionQuoteRequest): Promise; prepareTradeSmartTransaction(accountAddress: string, smartTransactionAddress: string, request: PrepareTradeSmartTransactionRequest, queryParams?: PrepareTradeSmartTransactionQueryParams): Promise; getTradeSmartTransaction(accountAddress: string, smartTransactionAddress: string): Promise; requestVirtualAccount(accountAddress: string, request: RequestVirtualAccountRequest): Promise; getVirtualAccounts(accountAddress: string, queryParams?: GetVirtualAccountsQueryParams): Promise; createStandingOrder(accountAddress: string, request: CreateStandingOrderRequest): Promise; getStandingOrders(accountAddress: string, queryParams?: GetStandingOrdersQueryParams): Promise; getStandingOrder(accountAddress: string, standingOrderId: string): Promise; } type AuthProvider = 'turnkey' | 'passkey' | 'solana' | 'privy'; interface ErrorDetail { field?: string; code: string; message: string; suggestion: string; documentation: string; } declare class GridError extends Error { readonly code: string; readonly statusCode?: number; readonly details?: ErrorDetail[] | any; readonly timestamp?: string; readonly lastResponse?: any; constructor(message: string, code: string, statusCode?: number, details?: ErrorDetail[] | any, timestamp?: string, lastResponse?: any); getFormattedMessage(): string; toString(): string; } declare class AuthorizationError extends GridError { readonly provider?: AuthProvider; readonly cause?: Error; constructor(message: string, code: string, provider?: AuthProvider, cause?: Error, details?: ErrorDetail[], timestamp?: string, requestId?: string); toString(): string; } declare class ProviderError extends GridError { readonly provider: AuthProvider; readonly cause?: Error; constructor(message: string, provider: AuthProvider, statusCode?: number, cause?: Error, details?: ErrorDetail[], timestamp?: string, requestId?: string); toString(): string; } interface UniversalKeyPair { publicKey: string; privateKey: string; publicKeyUncompressed?: string; } type KeyPairTag = 'primary' | 'backup' | 'solana' | 'passkey'; interface TaggedKeyPair extends UniversalKeyPair { provider: SignerProvider; tag: KeyPairTag; } type SessionSecrets = TaggedKeyPair[]; type Env = 'devnet' | 'mainnet' | 'testnet'; interface InitAuthRequest { email?: string; expiration?: number; smartAccountAddress?: string; } interface InitAuthData { type: string; email: string; status: string; otpSent: boolean; otpId?: string; provider: 'privy' | 'dynamic' | 'passkey' | 'turnkey' | 'external'; createdAt: string; expiresAt: string; } interface InitAuthEOAData { authenticated: boolean; provider: string; publicKey: string; } interface LastResponse { requestId: string; statusCode: number; idempotencyKey?: string; headers: Record; } interface BaseResponse { data: T; lastResponse?: LastResponse; } interface InitAuthResponse extends BaseResponse { } interface CompleteAuthRequest { expiration?: number; } interface CompleteAuthRequestWithOtp extends CompleteAuthRequest { otpCode: string; user: GridClientUserContext; sessionSecrets: SessionSecrets; smartAccountAddress?: string; } interface CompleteAuthResponse extends BaseResponse<{ address: string; policies: AccountPolicies; gridUserId: string; authentication: AuthenticationData; }> { } interface CompleteAuthAndCreateAccountRequest { otpCode: string; otpId?: string; provider?: 'privy' | 'turnkey'; user: GridClientUserContext; sessionSecrets: SessionSecrets; } interface SendTransactionRequest { signedTransactionPayload: TransactionResult; address: string; } interface ConfirmPayload { intentPayload: string; mpcPayload: string; } type SpendingLimitPeriod = 'one_time' | 'daily' | 'weekly' | 'monthly'; interface SpendingLimitRequest { amount: string | number; mint: string; period: SpendingLimitPeriod; transactionSigners?: string[]; spendingLimitSigners: string[]; destinations?: string[]; expiration?: number; } interface TransactionSubmissionResponse extends BaseResponse<{ transactionSignature: string; confirmedAt: string; }> { } type PasskeyPermission = string; interface PasskeyInfo { address: string; role: string; permissions: PasskeyPermission[]; provider: string; addedAt: string; } interface GetPasskeysResponse extends BaseResponse<{ accountAddress: string; passkey: PasskeyInfo | null; }> { } interface PasskeyInput { address: string; role?: string; permissions?: PasskeyPermission[]; } interface AddPasskeyRequest { passkey: PasskeyInput; transactionSigners?: string[]; } interface AddPasskeyQueryParams { admin?: boolean; } interface AddPasskeyResponse extends BaseResponse<{ transaction: string; passkey: PasskeyInfo; threshold: number; status: string; expiresAt: string; }> { } type SignerRole = 'primary' | 'backup'; type SignerPermission = 'CAN_INITIATE' | 'CAN_EXECUTE' | 'CAN_VOTE'; interface AccountSigner { address: string; role?: SignerRole; permissions: SignerPermission[]; provider?: string; } interface UpdateAccountRequest { signers?: AccountSigner[]; threshold?: number; timeLock?: number; adminAddress?: string | null; transactionSigners?: string[]; } interface CreateAccountInput { email?: string; signer?: string; } type CreateAccountRequest = EmailAccountRequest | SignersAccountRequest | AccountPolicies; interface EmailAccountRequest { type: 'email'; email: string; } interface SignersAccountRequest { type: 'signers'; policies: AccountPolicies; memo?: string; } interface AccountPolicies { signers: AccountSigner[]; threshold: number; timeLock?: number | null; adminAddress?: string | null; } interface EmailAccountResponse extends BaseResponse<{ type: 'email'; email: string; status: string; otpSent: boolean; createdAt: string; expiresAt: string; memo?: string; address?: string; policies?: AccountPolicies; gridUserId?: string; }> { } interface SignersAccountResponse extends BaseResponse<{ type: 'signers'; address: string; policies: AccountPolicies; gridUserId: string; memo?: string; email?: string; status?: string; otpSent?: boolean; createdAt?: string; expiresAt?: string; }> { } type CreateAccountResponse = EmailAccountResponse | SignersAccountResponse; interface GetAccountResponse extends BaseResponse<{ type: 'signers' | 'email'; address: string; policies?: AccountPolicies; gridUserId: string; memo?: string; createdAt?: string; status?: string; }> { } interface AccountTransaction { id: string; signature: string; status: string; createdAt: string; confirmedAt?: string; } interface GetTransactionsResponse extends BaseResponse<{ transactions?: AccountTransaction[]; error?: string; }> { } interface TokenBalance { tokenAddress: string; amount: bigint; decimals: number; amountDecimal: string; symbol?: string; name?: string; logo?: string; } interface GetAccountBalancesQueryParams { limit?: number; page?: number; } interface AccountBalancesData { address: string; lamports: bigint; sol: number; tokens: TokenBalance[]; } interface AccountBalancesResponse extends BaseResponse { data: AccountBalancesData; } interface PaymentDetails { account?: string; address?: string; currency: string; paymentRail?: string; externalAccountId?: string; } interface CreatePaymentIntentRequest { amount: string; source: PaymentDetails; destination: PaymentDetails; feeConfig?: FeeConfig; } type CreatePaymentIntentApiResponse = any; interface CreatePaymentIntentResponse extends BaseResponse<{ transactionPayload?: TransactionPayload; error?: string; } & Omit> { } interface KmsPayload { provider: string; address: string; payload: string; } interface UpdateSpendingLimitRequest { amount?: string | number; mint?: string; period?: SpendingLimitPeriod; spendingLimitSigners?: string[]; destinations?: string[]; expiration?: number; transactionSigners?: string[]; } interface UseSpendingLimitRequest { amount: string | number; signerAddress: string; recipientAddress: string; } interface CreateSpendingLimitResponse extends BaseResponse<{ spendingLimitAddress: string; transaction: string; kmsPayloads: KmsPayload[]; transactionSigners: string[]; }> { } interface SpendingLimitTransactionResponse extends BaseResponse<{ transaction: string; transactionSigners: string[]; kmsPayloads: KmsPayload[]; }> { } interface SpendingLimit { address: string; settingsAddress: string; mainAccountAddress: string; environment: string; mint: string; amount: number; period: number; remainingAmount: number; status: string; lastReset: number; signers: string[]; destinations: string[]; expiration: number; slot: number; blockTime: string; lastModifiedSignature: string; } interface SpendingLimitResponse extends BaseResponse { } interface SpendingLimitsResponse extends BaseResponse { } type KycType = 'individual' | 'business'; type KycEndorsement = 'ach' | 'sepa'; interface RequestKycLinkRequest { type: KycType; email: string; fullName: string; endorsements?: KycEndorsement[]; redirectUri?: string; } interface KycLinkResponse extends BaseResponse { data: KycLink; } interface KycLink { id: string; fullName: string; email: string; type: KycType; kycLink: string; tosLink: string; kycStatus: KycStatus; rejectionReasons: string[]; tosStatus: TosStatus; createdAt: string; customerId: string; personaInquiryType: string; } type KycStatus = 'pending' | 'approved' | 'rejected' | 'under_review'; type TosStatus = 'pending' | 'approved' | 'rejected'; interface RejectionReason { code: string; message: string; } interface KycStatusResponse extends BaseResponse { data: KycStatusData; } interface KycStatusData { id: string; account: string; type: KycType; status: KycStatus; tosStatus: TosStatus; kycContinuationLink?: string; rejectionReasons: RejectionReason[]; requirementsDue: string[]; createdAt: string; updatedAt: string; } type Currency = 'sol' | 'usdc' | 'usdt' | 'pyusd' | 'eurc'; interface FeeConfig { currency: Currency; payerAddress: string; selfManagedFees?: boolean; } interface PrepareArbitraryTransactionRequest { transaction: string; transactionSigners?: string[]; accountSigners?: string[]; payerAddress?: string; feeConfig?: FeeConfig; } interface CreateProposalRequest { transaction: string; signer: string; rentPayer?: string; } interface CreateProposalResponse extends BaseResponse<{ transactions: string[]; signer: string; rentPayer?: string; }> { } type VoteAction = 'approve' | 'reject' | 'cancel'; interface VoteProposalRequest { signers: string[]; action: VoteAction; } interface VoteProposalResponse extends BaseResponse<{ transaction: string; transactionSigners: string[]; }> { } interface ExecuteProposalRequest { signer: string; } interface ExecuteProposalResponse extends BaseResponse<{ transactions: string[]; signer: string; }> { } interface PrepareArbitraryTransactionQueryParams { debug?: boolean; } type Period = 'OneTime' | 'Daily' | 'Weekly' | 'Monthly'; interface PolicyExpirationArgs { numPeriods: number; period: Period; } type PolicyPermission = 'CAN_INITIATE' | 'CAN_VOTE' | 'CAN_EXECUTE'; interface PolicySigner { address: string; permissions: PolicyPermission[]; } type TradeVenue = 'jupiter'; interface InputAllowance { amount: string | number; cadence: Period; } interface InputWithAllowance { mint: string; allowance?: InputAllowance; } interface TradeRules { allowedInputs: InputWithAllowance[]; allowedOutputs: string[]; maxSlippageBps: number; feesBps?: number; venue?: TradeVenue; } interface AccountPoliciesSmartTransaction { signers: PolicySigner[]; threshold: number; startTimestamp?: number; expirationArgs?: PolicyExpirationArgs; } interface CreateTradeSmartTransactionRequest { policies: AccountPoliciesSmartTransaction; rules: TradeRules; transactionSigners?: string[]; } interface CreateTradeSmartTransactionData { smartTransactionAddress: string; transaction: string; kmsPayloads: KmsPayload[]; transactionSigners: string[]; } interface CreateTradeSmartTransactionResponse extends BaseResponse { } interface GetTradeQuoteRequest { venue: TradeVenue; fromMint: string; toMint: string; amount: number | string; slippageBps: number; } interface GetTradeQuoteData { venue: TradeVenue; quote: any; } interface GetTradeQuoteResponse extends BaseResponse { } interface TradeSmartTransactionQuoteRequest { venue: TradeVenue; fromMint: string; toMint: string; amount: number | string; slippageBps: number; } interface TradeSmartTransactionQuoteData { venue: TradeVenue; quote: any; } interface TradeSmartTransactionQuoteResponse extends BaseResponse { } interface TradeDetails { input: string; output: string; amount: number | string; slippageBps: number; feeBps: number; } interface TradeQuote { quote: any; } type TradeArgs = ({ type: 'arguments'; } & TradeDetails) | { type: 'quote'; quote: any; }; interface PrepareTradeSmartTransactionRequest { tradeArgs: TradeArgs; transactionSigners?: string[]; payerAddress?: string; feeConfig?: FeeConfig; } interface PrepareTradeSmartTransactionQueryParams { debug?: boolean; } interface PrepareTradeSmartTransactionData { transaction: string; kmsPayloads: KmsPayload[]; simulationLogs?: string[]; transactionSigners: string[]; fee?: { amount: number; currency: string; breakdown: { computeFee: number; rentFee: number; }; }; } interface PrepareTradeSmartTransactionResponse extends BaseResponse { } interface AllowedInput { mint: string; allowance?: { amount: string; cadence: Period; remaining: string; }; } interface TradableAssets { allowedInputs: AllowedInput[]; allowedOutputs: string[]; } type PolicyStatus = 'active' | 'expired' | 'cancelled'; interface GetTradeSmartTransactionData { policyAddress: string; signers: any; threshold: number; tradableAssets: TradableAssets; maxSlippageBps?: number; status: PolicyStatus; } interface GetTradeSmartTransactionResponse extends BaseResponse { } interface RemovePasskeyRequest { transactionSigners?: string[]; } interface RemovePasskeyQueryParams { admin?: boolean; } interface RemovePasskeyResponse extends BaseResponse<{ transaction: string; removedPasskey: PasskeyInfo; threshold: number; status: string; expiresAt: string; }> { } type TransferState = 'awaiting_funds' | 'in_review' | 'funds_received' | 'payment_submitted' | 'payment_processed' | 'canceled' | 'error' | 'undeliverable' | 'returned' | 'refunded'; type ConfirmationStatus = 'pending' | 'confirmed'; type TransferDirection = 'inflow' | 'outflow'; interface Receipt { id: string; object: string; createdAt: string; } interface BridgeTransferSource { paymentRail: PaymentRail; currency: BridgeCurrency; externalAccountId?: string; bridgeWalletId?: string; fromAddress?: string; omad?: string; imad?: string; bankBeneficiaryName?: string; } interface BridgeTransferDestination { currency: BridgeCurrency; paymentRail: PaymentRail; externalAccountId?: string; bridgeWalletId?: string; fromAddress?: string; wireMessage?: string; sepaReference?: string; swiftReference?: string; } interface BridgeTransferSourceDepositInstructions { amount?: string; currency: BridgeCurrency; depositMessage?: string; paymentRail: PaymentRail; fromAddress?: string; toAddress?: string; bankName?: string; bankAddress?: string; bankCity?: string; bankCountry?: string; bankPostalCode?: string; iban?: string; swiftBic?: string; beneficiaryName?: string; beneficiaryAddress?: string; beneficiaryCity?: string; beneficiaryCountry?: string; beneficiaryPostalCode?: string; routingNumber?: string; accountNumber?: string; accountType?: string; } interface BridgeTransfer { id: string; state: TransferState; onBehalfOf: string; sourceDepositInstructions?: BridgeTransferSourceDepositInstructions; amount: string; clientReferenceId?: string; currency?: BridgeCurrency; developerFee: string; source: BridgeTransferSource; destination: BridgeTransferDestination; receipt: Receipt; blockchainMemo?: string; createdAt: string; updatedAt: string; } interface SplTransfer { id: string; gridUserId: string; mainAccountAddress: string; mint: string; isToken2022: boolean; signature: string; confirmationStatus: ConfirmationStatus; fromAddress: string; toAddress: string; amount: string; uiAmount: string; decimals: number; confirmedAt?: string; createdAt: string; updatedAt: string; direction?: TransferDirection; environment?: GridEnvironment; instructionIndex?: number; } interface TransferResponse extends BaseResponse<(BridgeTransfer | SplTransfer)[]> { data: (BridgeTransfer | SplTransfer)[]; nextCursor?: string; hasMore?: boolean; } interface GetTransfersOptions { paymentRail?: PaymentRail; status?: TransferState; currency?: BridgeCurrency; startDate?: string; endDate?: string; txHash?: string; limit?: number; cursor?: string; } type BridgeCurrency = 'usd' | 'eur'; interface RequestVirtualAccountRequest { currency: BridgeCurrency; } interface SourceDepositInstructions { currency: string; bankBeneficiaryName: string; bankName: string; bankAddress: string; bankRoutingNumber: string; bankAccountNumber: string; paymentRails: string[]; } interface VirtualAccountDestination { currency: string; paymentRail: string; address: string; } interface VirtualAccount { id: string; customerId: string; sourceDepositInstructions: SourceDepositInstructions; destination: VirtualAccountDestination; status: string; developerFeePercent: string; } interface VirtualAccountResponse extends BaseResponse { } interface VirtualAccountsResponse extends BaseResponse { } interface GetVirtualAccountsQueryParams { sourceCurrency?: BridgeCurrency; destinationCurrency?: BridgeCurrency; } type StandingOrderFrequency = 'weekly' | 'monthly'; type StandingOrderStatus = 'active' | 'inactive' | 'cancelled' | 'completed'; type PaymentRail = 'ach_push' | 'ach_pull' | 'sepa' | 'faster_payments' | 'wire' | 'solana' | 'smart_account'; interface GridAccountDetails { account: string; currency: string; transactionSigners?: string[]; } interface SolanaDetails { address: string; currency: string; } interface NewExternalAccountDetails { paymentRail: PaymentRail; currency: string; details: any; } interface ExistingExternalAccountDetails { paymentRail: PaymentRail; currency: string; externalAccountId: string; } type Details = GridAccountDetails | SolanaDetails | NewExternalAccountDetails | ExistingExternalAccountDetails; interface CreateStandingOrderRequest { amount: string; source: Details; destination: Details; frequency: StandingOrderFrequency; startDate: string; endDate?: string; } interface CreateStandingOrderResponse extends BaseResponse<{ id: string; amount: string; uiAmount: string; currency: BridgeCurrency; paymentRail: PaymentRail; source: Details; destination: Details; frequency: StandingOrderFrequency; startDate: string; endDate?: string; status: StandingOrderStatus; transaction: string; kmsPayloads: KmsPayload[]; transactionSigners: string[]; validUntil: string; createdAt: string; transactionPayload: TransactionPayload; }> { } interface GetStandingOrdersQueryParams { status?: StandingOrderStatus; currency?: string; startDate?: string; endDate?: string; txHash?: string; limit?: number; cursor?: string; } interface StandingOrder { id: string; amount: string; currency: string; period: StandingOrderFrequency; destinations: string[]; status: StandingOrderStatus; remainingAmount: string; lastExecutionDate?: string; nextExecutionDate: string; createdAt: string; } interface StandingOrderResponse extends BaseResponse { } interface StandingOrdersResponse extends BaseResponse { } type SignerProvider = 'privy' | 'turnkey' | 'solana' | 'passkey' | 'pending' | 'external'; interface GridClientSigner { address?: string; email?: string; sessionKey?: any; type: 'primary' | 'backup'; provider?: SignerProvider; } interface GridClientUserContext { address?: string; gridUserId?: string; signers?: GridClientSigner[]; session?: Session; email?: string; otpId?: string; provider?: SignerProvider | string; } interface EncryptedAuthorizationKey { encryption_type: string; encapsulated_key: string; ciphertext: string; } type WalletChainType = 'Solana' | 'Ethereum' | 'Cosmos' | 'Stellar' | 'Sui' | 'Tron' | 'bitcoin-segwit'; interface AdditionalSigner { signerId: string; overridePolicyIds?: string[]; } interface Wallet { id: string; address: string; publicKey?: string; createdAt: number; chainType: WalletChainType; policyIds: string[]; ownerId?: string; additionalSigners: AdditionalSigner[]; exportedAt?: number; importedAt?: number; } interface Session { encryptedAuthorizationKey?: EncryptedAuthorizationKey; authorizationKey?: string; expiresAt: number; wallets: Wallet[]; } interface PrivyRefreshSession { user_id: string; session: Session; token: string; privy_access_token: string; refresh_token: string; } interface TurnkeyRefreshSession { userId: string; api_key_id: string; credential_bundle: string; } type ProviderSessionData = { Privy: PrivyRefreshSession; } | { Turnkey: TurnkeyRefreshSession; }; interface SessionProvider { provider: string; session?: PrivyRefreshSession | TurnkeyRefreshSession | any; sessionKey?: { key: any; expiration: number; }; passkeyAccount?: string; pubkey?: string; relyingPartyId?: string; role?: string; permissions?: string[]; } type AuthenticationData = SessionProvider[]; interface RefreshSessionKmsProvider { provider: string; session: ProviderSessionData; } interface RefreshSessionRequest { kmsPayload?: RefreshSessionKmsProvider; encryptionPublicKey: string; } interface RefreshSessionResponse extends BaseResponse<{ kmsPayload: RefreshSessionKmsProvider; }> { } interface ClientContext { environment: GridEnvironment; config: GridApiConfig; solanaRpcUrl?: string; } interface GridClientContext { client: ClientContext; user: GridClientUserContext; } interface CompleteAuthAndCreateAccountResponse extends BaseResponse<{ address: string; status: string; policies: AccountPolicies; gridUserId: string; authentication: AuthenticationData; }> { } interface AccountState { accountAddress?: string; gridUserId?: string; isConnected: boolean; } interface CreatePasskeySessionRequest { sessionKey: SessionKey; env: Env | GridEnvironment; metaInfo: Record; } interface CreatePasskeySessionResponse extends BaseResponse<{ url: string; }> { } interface SessionKey { key: any; expiration: number; } interface SessionKeyBackend { key: number[]; expiration: number; } interface MetaInfo { appName: string; redirectUrl?: string; } type CeremonyType = 'create' | 'auth'; interface PasskeyRequest { env: Env; appName?: string; userId?: string; redirectUrl?: string; challenge: string; slotNumber: string; sessionKey: string; expirationInSeconds: string; } interface AuthorizePasskeySessionRequest { sessionKey?: SessionKey; metaInfo: MetaInfo; baseUrl?: string; } interface AuthorizePasskeySessionResponse extends BaseResponse<{ url: string; }> { } interface SubmitPasskeySessionRequest { ceremonyType: CeremonyType; sessionKey: SessionKeyBackend; slotNumber: number; authenticatorResponse: any; } interface SubmitPasskeySessionResponse extends BaseResponse<{ passkeyAccount: string; smartAccount: { address: string; }; sessionKey: SessionKey; }> { } interface FindPasskeyAccountRequest { sessionKey: SessionKey; authenticatorResponse: any; } interface FindPasskeyAccountResponse extends BaseResponse<{ passkeyAccount: string; address: string; sessionKey: SessionKey; }> { } interface GetPasskeySessionResponse extends BaseResponse<{ session?: any; }> { } interface GetPasskeyAccountResponse extends BaseResponse<{ relyingPartyId: string; pubkey: string; sessionKey?: SessionKey; }> { } interface CreatePasskeyAccountRequest { sessionKey: SessionKey; slotNumber: number; authenticatorResponse: any; adminAddress?: string; memo?: string; } interface PasskeyAccountPolicies { threshold: number; adminAddress?: string; } interface PasskeyAccountInfo { passkeyAccount: string; pubkey: string; relyingPartyId: string; sessionKey: SessionKey; } interface CreatePasskeyAccountResponse extends BaseResponse<{ address: string; type: string; status: string; policies: PasskeyAccountPolicies; authentication: AuthenticationData; createdAt: string; updatedAt: string; }> { } interface PasskeyCredentialData { id: ArrayBuffer; publicKey: string; credentialId: string; } interface PasskeyAssertionResponse { response: { signature: string; clientDataJSON: string; authenticatorData: string; publicKey?: string; }; } interface AuthenticationRequest { email?: string; keypair?: UniversalKeyPair; passkeyId?: string; provider?: SignerProvider; expiration?: number; smartAccountAddress?: string; } interface AuthenticationContext { provider: SignerProvider; sessionId?: string; authPublicKey?: string; email?: string; keypair?: UniversalKeyPair; } declare class AuthenticationManager { private gridApiClient; private currentContext?; constructor(apiClient: GridApiClient); authenticate(request: AuthenticationRequest): Promise; complete(request: CompleteAuthRequestWithOtp | CompleteAuthAndCreateAccountRequest): Promise; completeAndCreateAccount(request: CompleteAuthAndCreateAccountRequest): Promise; generateSessionSecrets(): Promise; generateKeyPair(provider: SignerProvider): Promise; private initiateEmailAuth; private validateEOAWallet; private initiatePasskeyAuth; private completePrivyAuth; private completeTurnkeyAuth; private completePrivyAuthAndCreateAccount; private determineAuthType; getCurrentProvider(): SignerProvider | undefined; getCurrentContext(): AuthenticationContext | undefined; clearContext(): void; } declare class AccountManager { private context; private eventEmitter; constructor(context: GridClientContext); get(): AccountState; set(address: string, gridUserId: string): void; disconnect(): void; on(event: 'change', handler: (state: AccountState) => void): void; off(event: 'change', handler: (state: AccountState) => void): void; _emitChange(): void; } interface GridClientInterface { readonly account: AccountManager; createAccount(input: CreateAccountInput | CreateAccountRequest): Promise; initAuth(request: AuthenticationRequest): Promise; completeAuth(request: CompleteAuthRequestWithOtp): Promise; completeAuthAndCreateAccount(request: CompleteAuthAndCreateAccountRequest): Promise; refreshSession(request: RefreshSessionRequest): Promise; getAccount(accountAddress: string): Promise; updateAccount(accountAddress: string, request: UpdateAccountRequest, admin?: boolean): Promise; getAccountBalances(accountAddress: string, queryParams?: GetAccountBalancesQueryParams): Promise; getTransfers(accountAddress: string, options?: GetTransfersOptions): Promise; getTransactions(accountAddress: string): Promise; createSpendingLimit(smartAccountAddress: string, request: SpendingLimitRequest): Promise; updateSpendingLimit(accountAddress: string, spendingLimitAddress: string, request: UpdateSpendingLimitRequest): Promise; deleteSpendingLimit(accountAddress: string, spendingLimitAddress: string): Promise; useSpendingLimit(accountAddress: string, spendingLimitAddress: string, request: UseSpendingLimitRequest): Promise; getSpendingLimit(accountAddress: string, spendingLimitAddress: string): Promise; getSpendingLimits(accountAddress: string): Promise; getPasskeys(accountAddress: string): Promise; addPasskey(accountAddress: string, request: AddPasskeyRequest, queryParams?: AddPasskeyQueryParams): Promise; removePasskey(accountAddress: string, passkeyAddress: string, transactionSigners?: string[], queryParams?: RemovePasskeyQueryParams): Promise; createPasskeySession(params: CreatePasskeySessionRequest, environment: string): Promise; authorizePasskeySession(params: AuthorizePasskeySessionRequest, environment: string): Promise; submitPasskeySession(params: SubmitPasskeySessionRequest, environment: string): Promise; findPasskeyAccount(params: FindPasskeyAccountRequest, environment: string): Promise; getPasskeyAccount(passkeyAddress: string, environment: string): Promise; createPasskeyAccount(params: CreatePasskeyAccountRequest, environment: string): Promise; createPaymentIntent(accountAddress: string, request: CreatePaymentIntentRequest): Promise; requestKycLink(accountAddress: string, request: RequestKycLinkRequest): Promise; getKycStatus(accountAddress: string, kycId: string): Promise; requestVirtualAccount(accountAddress: string, request: RequestVirtualAccountRequest): Promise; getVirtualAccounts(accountAddress: string, queryParams?: GetVirtualAccountsQueryParams): Promise; send(request: SendTransactionRequest): Promise; signAndSend(request: SignAndSendRequest): Promise; createStandingOrder(accountAddress: string, request: CreateStandingOrderRequest): Promise; getStandingOrders(accountAddress: string, queryParams?: GetStandingOrdersQueryParams): Promise; getStandingOrder(accountAddress: string, standingOrderId: string): Promise; prepareArbitraryTransaction(accountAddress: string, request: PrepareArbitraryTransactionRequest, queryParams?: PrepareArbitraryTransactionQueryParams): Promise; createTradeSmartTransaction(accountAddress: string, request: CreateTradeSmartTransactionRequest): Promise; getTradeSmartTransactionQuote(accountAddress: string, smartTransactionAddress: string, request: TradeSmartTransactionQuoteRequest): Promise; prepareTradeSmartTransaction(accountAddress: string, smartTransactionAddress: string, request: PrepareTradeSmartTransactionRequest, queryParams?: PrepareTradeSmartTransactionQueryParams): Promise; getTradeSmartTransaction(accountAddress: string, smartTransactionAddress: string): Promise; createProposal(accountAddress: string, request: CreateProposalRequest): Promise; voteProposal(accountAddress: string, proposalAddress: string, request: VoteProposalRequest): Promise; executeProposal(accountAddress: string, proposalAddress: string, request: ExecuteProposalRequest): Promise; generateKeyPair(provider?: SignerProvider): Promise; generateSessionSecrets(): Promise; extractSignableTransaction(transactionData: TransactionPayload): VersionedTransaction; setExternallySignedTransaction(transactionData: TransactionPayload, externallySignedTransaction: VersionedTransaction): TransactionPayload; sign(request: SignRequest): Promise; createPasskeyCredentials(params: PasskeyRequest): Promise; getPasskeyCredentials(params: PasskeyRequest, credentialData?: PasskeyCredentialData): Promise; extractPasskeyCreateParams(query: URLSearchParams): PasskeyRequest; extractPasskeyAuthParams(query: URLSearchParams): PasskeyRequest; bufferToBase64Url(buffer: ArrayBuffer): string; getSessionKeyObject(sessionKeyString: string, expirationInSeconds: string): SessionKey; getEnvironment(): 'sandbox' | 'production'; } declare class GridClient implements GridClientInterface { private apiClient; private authManager; private signingManager; private _accountManager; protected apiConfig: GridApiConfig; private solanaRpcUrl?; private context; private accountService; private authService; private transactionService; private passkeyService; private spendingLimitService; private bankingService; private utilityService; constructor(apiConfig: GridApiConfig); get account(): AccountManager; getConfig(): GridApiConfig; extractSignableTransaction(transactionData: TransactionPayload): VersionedTransaction; setExternallySignedTransaction(transactionData: TransactionPayload, externallySignedTransaction: VersionedTransaction): TransactionPayload; initAuth(request: InitAuthRequest | AuthenticationRequest): Promise; completeAuth(request: CompleteAuthRequestWithOtp): Promise; completeAuthAndCreateAccount(request: CompleteAuthAndCreateAccountRequest): Promise; refreshSession(request: RefreshSessionRequest): Promise; generateSessionSecrets(): Promise; generateKeyPair(provider?: SignerProvider): Promise; sign(request: SignRequest): Promise; signAndSend(request: SignAndSendRequest): Promise; send(request: SendTransactionRequest): Promise; createAccount(input: CreateAccountInput | CreateAccountRequest): Promise; getAccount(accountAddress: string): Promise; updateAccount(accountAddress: string, request: UpdateAccountRequest, admin?: boolean): Promise; getAccountBalances(accountAddress: string, queryParams?: GetAccountBalancesQueryParams): Promise; getTransfers(accountAddress: string, options?: GetTransfersOptions): Promise; getTransactions(accountAddress: string): Promise; createSpendingLimit(smartAccountAddress: string, request: SpendingLimitRequest): Promise; updateSpendingLimit(accountAddress: string, spendingLimitAddress: string, request: UpdateSpendingLimitRequest): Promise; deleteSpendingLimit(accountAddress: string, spendingLimitAddress: string): Promise; useSpendingLimit(accountAddress: string, spendingLimitAddress: string, request: UseSpendingLimitRequest): Promise; getSpendingLimit(accountAddress: string, spendingLimitAddress: string): Promise; getSpendingLimits(accountAddress: string): Promise; getPasskeys(accountAddress: string): Promise; addPasskey(accountAddress: string, request: AddPasskeyRequest, queryParams?: AddPasskeyQueryParams): Promise; removePasskey(accountAddress: string, passkeyAddress: string, transactionSigners?: string[], queryParams?: RemovePasskeyQueryParams): Promise; createPaymentIntent(accountAddress: string, request: CreatePaymentIntentRequest): Promise; requestKycLink(accountAddress: string, request: RequestKycLinkRequest): Promise; getKycStatus(accountAddress: string, kycId: string): Promise; prepareArbitraryTransaction(accountAddress: string, request: PrepareArbitraryTransactionRequest, queryParams?: PrepareArbitraryTransactionQueryParams): Promise; createTradeSmartTransaction(accountAddress: string, request: CreateTradeSmartTransactionRequest): Promise; getTradeSmartTransactionQuote(accountAddress: string, smartTransactionAddress: string, request: TradeSmartTransactionQuoteRequest): Promise; prepareTradeSmartTransaction(accountAddress: string, smartTransactionAddress: string, request: PrepareTradeSmartTransactionRequest, queryParams?: PrepareTradeSmartTransactionQueryParams): Promise; createProposal(accountAddress: string, request: CreateProposalRequest): Promise; voteProposal(accountAddress: string, proposalAddress: string, request: VoteProposalRequest): Promise; executeProposal(accountAddress: string, proposalAddress: string, request: ExecuteProposalRequest): Promise; getTradeSmartTransaction(accountAddress: string, smartTransactionAddress: string): Promise; requestVirtualAccount(accountAddress: string, request: RequestVirtualAccountRequest): Promise; getVirtualAccounts(accountAddress: string, queryParams?: GetVirtualAccountsQueryParams): Promise; createStandingOrder(accountAddress: string, request: CreateStandingOrderRequest): Promise; getStandingOrders(accountAddress: string, queryParams?: GetStandingOrdersQueryParams): Promise; getStandingOrder(accountAddress: string, standingOrderId: string): Promise; getContext(): GridClientContext; createPasskeyCredentials(params: PasskeyRequest): Promise; getPasskeyCredentials(params: PasskeyRequest, credentialData?: PasskeyCredentialData): Promise; extractPasskeyCreateParams(query: URLSearchParams): PasskeyRequest; extractPasskeyAuthParams(query: URLSearchParams): PasskeyRequest; bufferToBase64Url(buffer: ArrayBuffer): string; getSessionKeyObject(sessionKeyString: string, expirationInSeconds: string): SessionKey; createPasskeySession(params: CreatePasskeySessionRequest, environment: string): Promise; authorizePasskeySession(params: AuthorizePasskeySessionRequest, environment: string): Promise; submitPasskeySession(params: SubmitPasskeySessionRequest, environment: string): Promise; findPasskeyAccount(params: FindPasskeyAccountRequest, environment: string): Promise; getPasskeyAccount(passkeyAddress: string, environment: string): Promise; createPasskeyAccount(params: CreatePasskeyAccountRequest, environment: string): Promise; getEnvironment(): 'sandbox' | 'production'; } declare function base64ToBytes(base64: string): Uint8Array; declare function bytesToBase64(bytes: Uint8Array): string; declare function hexToBytes(hex: string): Uint8Array; declare function bytesToHex(bytes: Uint8Array): string; declare function base64ToUtf8(base64: string): string; declare function utf8ToBytes(str: string): Uint8Array; export { type AccountBalancesData, type AccountBalancesResponse, AccountManager, type AccountPolicies, type AccountPoliciesSmartTransaction, type AccountSigner, type AccountState, type AccountTransaction, type AddPasskeyQueryParams, type AddPasskeyRequest, type AddPasskeyResponse, type AllowedInput, type AuthenticationContext, type AuthenticationData, AuthenticationManager, type AuthenticationRequest, AuthorizationError, type AuthorizePasskeySessionRequest, type AuthorizePasskeySessionResponse, type BaseResponse, type BridgeCurrency, type BridgeTransfer, type BridgeTransferDestination, type BridgeTransferSource, type BridgeTransferSourceDepositInstructions, type CeremonyType, type CompleteAuthAndCreateAccountRequest, type CompleteAuthAndCreateAccountResponse, type CompleteAuthRequest, type CompleteAuthRequestWithOtp, type CompleteAuthResponse, type ConfirmationStatus, type CreateAccountInput, type CreateAccountRequest, type CreateAccountResponse, type CreatePasskeyAccountRequest, type CreatePasskeyAccountResponse, type CreatePasskeySessionRequest, type CreatePasskeySessionResponse, type CreatePaymentIntentRequest, type CreatePaymentIntentResponse, type CreateProposalRequest, type CreateProposalResponse, type CreateSpendingLimitResponse, type CreateStandingOrderRequest, type CreateStandingOrderResponse, type CreateTradeSmartTransactionData, type CreateTradeSmartTransactionRequest, type CreateTradeSmartTransactionResponse, type Currency, type EmailAccountRequest, type EmailAccountResponse, type Env, type ExecuteProposalRequest, type ExecuteProposalResponse, type FeeConfig, type FindPasskeyAccountRequest, type FindPasskeyAccountResponse, type GetAccountBalancesQueryParams, type GetAccountResponse, type GetPasskeyAccountResponse, type GetPasskeySessionResponse, type GetPasskeysResponse, type GetStandingOrdersQueryParams, type GetTradeQuoteData, type GetTradeQuoteRequest, type GetTradeQuoteResponse, type GetTradeSmartTransactionData, type GetTradeSmartTransactionResponse, type GetTransactionsResponse, type GetTransfersOptions, type GetVirtualAccountsQueryParams, GridApiClient, type GridApiConfig, GridClient, type GridClientContext, type GridClientInterface, type GridClientSigner, type GridClientUserContext, type GridEnvironment, GridError, type GridErrorDetail, type InitAuthData, type InitAuthEOAData, type InitAuthRequest, type InitAuthResponse, type InputAllowance, type InputWithAllowance, type KeyPairTag, type KycEndorsement, type KycLink, type KycLinkResponse, type KycStatus, type KycStatusData, type KycStatusResponse, type KycType, type LastResponse, type MetaInfo, type PasskeyAccountInfo, type PasskeyAccountPolicies, type PasskeyAssertionResponse, type PasskeyCredentialData, type PasskeyInfo, type PasskeyPermission, type PasskeyRequest, type PaymentDetails, type PaymentRail, type Period, type PolicyExpirationArgs, type PolicyPermission, type PolicySigner, type PolicyStatus, type PrepareArbitraryTransactionQueryParams, type PrepareArbitraryTransactionRequest, type PrepareTradeSmartTransactionData, type PrepareTradeSmartTransactionQueryParams, type PrepareTradeSmartTransactionRequest, type PrepareTradeSmartTransactionResponse, type PrivyRefreshSession, ProviderError, type ProviderSessionData, type Receipt, type RefreshSessionKmsProvider, type RefreshSessionRequest, type RefreshSessionResponse, type RemovePasskeyQueryParams, type RemovePasskeyRequest, type RemovePasskeyResponse, type RequestKycLinkRequest, type RequestVirtualAccountRequest, type SendTransactionRequest, type SessionKey, type SessionKeyBackend, type SessionProvider, type SessionSecrets, type SignAndSendRequest, type SignRequest, type SignResult, type SignatureResult, type SignerPermission, type SignerRole, type SignersAccountRequest, type SignersAccountResponse, SigningManager, type SourceDepositInstructions, type SpendingLimit, type SpendingLimitPeriod, type SpendingLimitRequest, type SpendingLimitResponse, type SpendingLimitTransactionResponse, type SpendingLimitsResponse, type SplTransfer, type StandingOrder, type StandingOrderResponse, type StandingOrdersResponse, type SubmitPasskeySessionRequest, type SubmitPasskeySessionResponse, type TokenBalance, type TosStatus, type TradableAssets, type TradeArgs, type TradeDetails, type TradeQuote, type TradeRules, type TradeSmartTransactionQuoteData, type TradeSmartTransactionQuoteRequest, type TradeSmartTransactionQuoteResponse, type TradeVenue, type TransactionPayload, type TransactionResponse, type TransactionResult, type TransactionSubmissionResponse, type TransferDirection, type TransferResponse, type TransferState, type TurnkeyRefreshSession, type UniversalKeyPair, type UpdateAccountRequest, type UpdateSpendingLimitRequest, type UseSpendingLimitRequest, type VirtualAccount, type VirtualAccountDestination, type VirtualAccountResponse, type VirtualAccountsResponse, type VoteAction, type VoteProposalRequest, type VoteProposalResponse, base64ToBytes, base64ToUtf8, bytesToBase64, bytesToHex, hexToBytes, utf8ToBytes };