UNPKG

@quartz-labs/sdk

Version:

SDK for interacting with the Quartz Protocol

75 lines 4.35 kB
import { BN } from "@drift-labs/sdk"; import type { PublicKey, AddressLookupTableAccount, MessageCompiledInstruction, Signer } from "@solana/web3.js"; import { QuartzUser } from "./QuartzUser.class.js"; import type { TransactionInstruction } from "@solana/web3.js"; import type { Keypair } from "@solana/web3.js"; import type { VersionedTransactionResponse } from "@solana/web3.js"; import type { WithdrawOrder, WithdrawOrderAccount } from "./types/accounts/WithdrawOrder.account.js"; import type { SpendLimitsOrder, SpendLimitsOrderAccount } from "./types/accounts/SpendLimitsOrder.account.js"; import type { MarketIndex } from "./index.browser.js"; import AdvancedConnection from "@quartz-labs/connection"; import type { Connection } from "@solana/web3.js"; export declare class QuartzClient { private connection; private program; private quartzLookupTable; private driftClient; private constructor(); private static getProgram; /** * Fetch a QuartzClient instance. * @param config - Configuration object, you must provide either `rpcUrls` or `connection`. * @param config.rpcUrls - Array of RPC URLs. * @param config.connection - AdvancedConnection instance (from @quartz-labs/connection) * @param config.pollingFrequency - Polling frequency in milliseconds. * @returns QuartzClient instance. */ static fetchClient(config: { rpcUrls?: string[]; connection?: AdvancedConnection; pollingFrequency?: number; }): Promise<QuartzClient>; static doesQuartzUserExist(connection: Connection, owner: PublicKey, attempts?: number): Promise<boolean>; getAllQuartzAccountOwnerPubkeys(): Promise<PublicKey[]>; getQuartzAccount(owner: PublicKey): Promise<QuartzUser>; getMultipleQuartzAccounts(owners: PublicKey[]): Promise<(QuartzUser | null)[]>; getDepositRate(marketIndex: MarketIndex): Promise<BN>; getBorrowRate(marketIndex: MarketIndex): Promise<BN>; getCollateralWeight(marketIndex: MarketIndex): Promise<number>; private getSpotMarketAccount; getOpenWithdrawOrders(user?: PublicKey): Promise<WithdrawOrderAccount[]>; getOpenSpendLimitsOrders(user?: PublicKey): Promise<SpendLimitsOrderAccount[]>; parseOpenWithdrawOrder(order: PublicKey, retries?: number): Promise<WithdrawOrder>; parseOpenSpendLimitsOrder(order: PublicKey, retries?: number): Promise<SpendLimitsOrder>; listenForInstruction(instructionName: string, onInstruction: (tx: VersionedTransactionResponse, ix: MessageCompiledInstruction, accountKeys: PublicKey[]) => void, ignoreErrors?: boolean): Promise<void>; static parseSpendIx(connection: AdvancedConnection, signature: string, owner: PublicKey): Promise<PublicKey>; /** * Creates instructions to initialize a new Quartz user account. * @param owner - The public key of Quartz account owner. * @param spendLimitPerTransaction - The card spend limit per transaction. * @param spendLimitPerTimeframe - The card spend limit per timeframe. * @param timeframeInSlots - The timeframe in slots (eg: 216,000 for ~1 day). * @returns {Promise<{ * ixs: TransactionInstruction[], * lookupTables: AddressLookupTableAccount[], * signers: Keypair[] * }>} Object containing: * - ixs: Array of instructions to initialize the Quartz user account. * - lookupTables: Array of lookup tables for building VersionedTransaction. * - signers: Array of signer keypairs that must sign the transaction the instructions are added to. * @throws Error if the RPC connection fails. The transaction will fail if the vault already exists, or the user does not have enough SOL. */ makeInitQuartzUserIxs(owner: PublicKey, spendLimitPerTransaction: BN, spendLimitPerTimeframe: BN, timeframeInSeconds: BN, nextTimeframeResetTimestamp: BN): Promise<{ ixs: TransactionInstruction[]; lookupTables: AddressLookupTableAccount[]; signers: Keypair[]; }>; admin: { makeReclaimBridgeRentIxs: (messageSentEventData: PublicKey, attestation: Buffer<ArrayBuffer>, rentReclaimer: Signer) => Promise<{ ixs: TransactionInstruction[]; lookupTables: AddressLookupTableAccount[]; signers: Signer[]; }>; }; } //# sourceMappingURL=QuartzClient.class.d.ts.map