import { BN } from "@coral-xyz/anchor"; import { AccountInfo as Web3AccountInfo, Commitment, Keypair, PublicKey, TransactionInstruction, TransactionSignature, VersionedTransaction, AccountMeta } from "@solana/web3.js"; import { BaseClient, BaseTxBuilder, TxOptions, type ProtocolPolicyTxBuilder } from "../base"; import { LoopscaleLoan, LoopscaleMarketInformation, LoopscaleStrategy } from "../../deser"; import { LoopscaleBorrowPolicy, LoopscaleLendingPolicy, LoopscaleVaultPolicy } from "../../deser/integrationPolicies"; export declare const LOOPSCALE_BS_AUTH: PublicKey; export declare const LOOPSCALE_STRATEGY_DISCRIMINATOR: Buffer; export declare const LOOPSCALE_CREATE_LOAN_DISCRIMINATOR: Buffer; export declare const LOOPSCALE_CREATE_STRATEGY_DISCRIMINATOR: Buffer; export declare const LOOPSCALE_DEPOSIT_COLLATERAL_DISCRIMINATOR: Buffer; export declare const LOOPSCALE_BORROW_PRINCIPAL_DISCRIMINATOR: Buffer; export declare const LOOPSCALE_REPAY_PRINCIPAL_DISCRIMINATOR: Buffer; export declare const LOOPSCALE_WITHDRAW_COLLATERAL_DISCRIMINATOR: Buffer; export declare const LOOPSCALE_SELL_LEDGER_DISCRIMINATOR: Buffer; export declare const LOOPSCALE_DEPOSIT_STRATEGY_DISCRIMINATOR: Buffer; export declare const LOOPSCALE_UPDATE_STRATEGY_DISCRIMINATOR: Buffer; export declare const LOOPSCALE_WITHDRAW_STRATEGY_DISCRIMINATOR: Buffer; export declare const LOOPSCALE_CLOSE_STRATEGY_DISCRIMINATOR: Buffer; export declare const LOOPSCALE_UPDATE_STRATEGY_STANDARD_ACCOUNT_COUNT = 12; export type LoopscaleQuote = { apy: number; strategy: string; collateralIdentifier: string; ltv: number; lqt: number; amount: number; }; export type LoopscaleMaxQuoteParams = { principalMint: PublicKey; collateralMint: PublicKey; collateralAmount: BN; durationType: number; duration: number; borrowAmount?: BN; externalYieldSource?: number; }; export type LoopscaleMappedTransaction = { ixs: TransactionInstruction[]; additionalSigners: Keypair[]; }; export type LoopscaleApiCollateralTermUpdate = { addCollateral?: Record; }>; updateCollateral?: Record; }>; }; export type LoopscaleApiUpdateStrategyParams = { originationsEnabled?: boolean; liquidityBuffer?: number; interestFee?: number; originationFee?: number; principalFee?: number; originationCap?: number; externalYieldSource?: { newExternalYieldSource: number; }; }; export type LoopscaleApiTransaction = { message?: string; signatures?: unknown[]; }; export type LoopscaleApiTransactionResponse = LoopscaleApiTransaction & { transaction?: LoopscaleApiTransaction; transactions?: LoopscaleApiTransaction[]; loanAddress?: string; }; export type LoopscaleApiTransactionPayload = LoopscaleApiTransactionResponse | LoopscaleApiTransactionResponse[]; /** * Account inputs for a Loopscale borrow that are derived from on-chain market * and strategy state (see {@link LoopscaleCoreClient.resolveBorrowMarketAccounts}). */ export type BorrowMarketAccounts = { marketInformation: PublicKey; principalMint: PublicKey; durationIndex: number; assetIndexGuidance: Buffer; }; export type LoopscaleAssetIndexGuidance = { collateralAssetIndex: number; principalAssetIndex: number; ltvAssetIndex: number; }; export declare function encodeLoopscaleAssetIndexGuidance(guidance: LoopscaleAssetIndexGuidance): Buffer; export type LoopscaleSellLedgerAssetIndexGuidance = { principalAssetIndex: number; collateralAssetIndex: number; }; export declare function encodeLoopscaleSellLedgerAssetIndexGuidance(guidance: LoopscaleSellLedgerAssetIndexGuidance): Buffer; export type LoopscaleBorrowPrincipalTerms = { strategy: PublicKey; expectedLoanValues: LoopscaleExpectedLoanValues; assetIndexGuidance: Buffer; durationIndex: number; }; export type LoopscaleBorrowQuoteTerms = LoopscaleBorrowPrincipalTerms & { quote: LoopscaleQuote; }; export type LoopscaleSellLedgerTerms = { ledgerIndex: number; oldStrategy: PublicKey; newStrategy: PublicKey; oldStrategyMarketInformation: PublicKey; newStrategyMarketInformation: PublicKey; principalMint: PublicKey; assetIndexGuidance: Buffer; guidance: LoopscaleSellLedgerAssetIndexGuidance; remainingAccounts: AccountMeta[]; }; export type LoopscaleStrategyWithMarket = { strategy: LoopscaleStrategy; marketInfo: LoopscaleMarketInformation; }; export declare function getLoopscaleApiMessages(response: LoopscaleApiTransactionPayload): string[]; /** * Replaces signer-only setup accounts that Loopscale's API may include after * the standard accounts. * * Those API-provided signer pubkeys are not available to the GLAM caller. The * remapped ext_loopscale instruction only needs them to satisfy account signer * constraints for the generated setup path, so the SDK substitutes fresh local * keypairs and returns them for the caller to sign the transaction with. * * FIXME: When do we need to do this? Need a way to determine this dynamically. */ export declare function replaceLoopscaleApiExtraSigners(ix: TransactionInstruction, standardAccountCount: number): LoopscaleMappedTransaction; export declare function createVaultWsolAtaSetupIxs(params: { mint: PublicKey; payer: PublicKey; owner: PublicKey; ata: PublicKey; }): TransactionInstruction[]; export declare function createVaultTokenAtaSetupIx(params: { mint: PublicKey; payer: PublicKey; owner: PublicKey; ata: PublicKey; tokenProgram: PublicKey; }): TransactionInstruction; export declare function buildLoopscaleApiCollateralTermUpdates(strategy: LoopscaleStrategy, marketInfo: LoopscaleMarketInformation, collateralTerms: LoopscaleMultiCollateralTermsUpdateParams[]): LoopscaleApiCollateralTermUpdate | undefined; export type LoopscaleExpectedLoanValues = { expectedApy: BN; expectedLqt: [number, number, number, number, number]; }; export type LoopscaleExternalYieldSourceArgs = { newExternalYieldSource: number; createExternalYieldAccount: boolean; }; export type LoopscaleOnchainExternalYieldSourceArgs = { newExternalYieldSource: number; externalYieldVault: PublicKey; }; export type CreateLoanParams = { nonce: BN; }; export type LoopscaleLpParams = { exactIn: { amountIn: BN; minAmountOut: BN; }; } | { exactOut: { amountOut: BN; maxAmountIn: BN; }; }; export type LoopscaleVaultStakeParams = { amount: BN; principalAmount: BN; stakeAll: boolean | null; duration: number; durationType: number; actionType: number; }; export type LoopscaleVaultUnstakeParams = { actionType: number; principalAmount: BN; }; export type CreateStrategyParams = { originationCap: BN; liquidityBuffer: BN; interestFee: BN; originationFee: BN; principalFee: BN; originationsEnabled: boolean; externalYieldSourceArgs: LoopscaleOnchainExternalYieldSourceArgs | null; }; export type LoopscaleCollateralTermsIndices = { collateralIndex: number; durationIndex: number; }; export type LoopscaleMultiCollateralTermsUpdateParams = { apy: number; indices: LoopscaleCollateralTermsIndices[]; }; export type UpdateStrategyParams = { originationsEnabled?: boolean | null; liquidityBuffer?: BN | null; interestFee?: BN | null; originationFee?: BN | null; principalFee?: BN | null; originationCap?: BN | null; marketInformation?: PublicKey | null; externalYieldSourceArgs?: LoopscaleOnchainExternalYieldSourceArgs | null; }; export type DepositCollateralParams = { amount: BN; assetType: number; assetIdentifier: PublicKey; assetIndexGuidance: number[]; }; export type UpdateWeightMatrixParams = { collateralIndex: number; weightMatrix: [number, number, number, number, number]; expectedLoanValues: LoopscaleExpectedLoanValues; assetIndexGuidance: Buffer; }; export type BorrowPrincipalParams = { amount: BN; assetIndexGuidance: number[]; duration: number; expectedLoanValues: LoopscaleExpectedLoanValues; skipSolUnwrap: boolean; }; export type CreateLoanAccounts = { loan: PublicKey; }; export type CloseLoanAccounts = { loan: PublicKey; }; export type CreateStrategyAccounts = { nonce: PublicKey; strategy: PublicKey; marketInformation: PublicKey; principalMint: PublicKey; }; export type DepositStrategyAccounts = { strategy: PublicKey; principalMint: PublicKey; marketInformation: PublicKey; lenderTa?: PublicKey; strategyTa?: PublicKey; tokenProgram?: PublicKey; associatedTokenProgram?: PublicKey; }; export type UpdateStrategyAccounts = { strategy: PublicKey; marketInformation: PublicKey; principalMint: PublicKey; strategyTa?: PublicKey; tokenProgram?: PublicKey; associatedTokenProgram?: PublicKey; remainingAccounts?: AccountMeta[]; }; export type WithdrawStrategyAccounts = { strategy: PublicKey; principalMint: PublicKey; marketInformation: PublicKey; lenderTa?: PublicKey; strategyTa?: PublicKey; tokenProgram?: PublicKey; }; export type CloseStrategyAccounts = { strategy: PublicKey; principalMint: PublicKey; tokenProgram?: PublicKey; associatedTokenProgram?: PublicKey; }; export type DepositWithdrawUserVaultAccounts = { vault: PublicKey; strategy: PublicKey; marketInformation: PublicKey; lpMint: PublicKey; principalMint: PublicKey; lpTokenProgram: PublicKey; principalTokenProgram: PublicKey; }; export type StakeUserVaultLpAccounts = { nonce: PublicKey; vault: PublicKey; vaultStake: PublicKey; lpMint: PublicKey; }; export type UnstakeUserVaultLpAccounts = { vault: PublicKey; lpMint: PublicKey; vaultStake: PublicKey; }; export type ClaimVaultRewardsAccounts = { vault: PublicKey; vaultStake: PublicKey; vaultRewardsInfo?: PublicKey; userRewardsInfo?: PublicKey; associatedTokenProgram?: PublicKey; remainingAccounts?: AccountMeta[]; }; export type DepositCollateralAccounts = { loan: PublicKey; depositMint: PublicKey; assetIdentifier?: PublicKey; borrowerCollateralTa?: PublicKey; loanCollateralTa?: PublicKey; tokenProgram?: PublicKey; associatedTokenProgram?: PublicKey; }; export type UpdateWeightMatrixAccounts = { loan: PublicKey; }; export type BorrowPrincipalAccounts = { loan: PublicKey; strategy: PublicKey; }; export type WithdrawCollateralParams = { amount: BN; collateralIndex: number; assetIndexGuidance: number[]; expectedLoanValues: LoopscaleExpectedLoanValues; closeIfEligible: boolean; withdrawAll: boolean; }; export type WithdrawCollateralAccounts = { loan: PublicKey; assetMint: PublicKey; borrowerTa?: PublicKey; loanTa?: PublicKey; tokenProgram?: PublicKey; associatedTokenProgram?: PublicKey; remainingAccounts?: AccountMeta[]; }; export type RepayPrincipalParams = { amount: BN; ledgerIndex: number; repayAll: boolean; }; export type SellLedgerParams = { ledgerIndex: number; expectedSalePrice: BN; assetIndexGuidance: Buffer; }; export type RepayPrincipalAccounts = { loan: PublicKey; strategy: PublicKey; marketInformation?: PublicKey; principalMint?: PublicKey; borrowerTa?: PublicKey; strategyTa?: PublicKey; tokenProgram?: PublicKey; associatedTokenProgram?: PublicKey; remainingAccounts?: AccountMeta[]; }; export type SellLedgerAccounts = { loan: PublicKey; oldStrategy: PublicKey; newStrategy: PublicKey; oldStrategyMarketInformation: PublicKey; newStrategyMarketInformation: PublicKey; principalMint: PublicKey; newStrategyTa?: PublicKey; lenderAuthTa?: PublicKey; userVault?: PublicKey; oldStrategyTa?: PublicKey; tokenProgram?: PublicKey; associatedTokenProgram?: PublicKey; remainingAccounts?: AccountMeta[]; }; export declare function getLoopscaleEventAuthorityPda(programId?: PublicKey): PublicKey; export declare function getLoopscaleLoanPda(borrower: PublicKey, nonce: BN, programId?: PublicKey): PublicKey; export declare function getLoopscaleStrategyPda(nonce: PublicKey, programId?: PublicKey): PublicKey; export declare function getLoopscaleVaultPda(vaultNonce: PublicKey, programId?: PublicKey): PublicKey; export declare function getLoopscaleVaultStrategyPda(vault: PublicKey, programId?: PublicKey): PublicKey; export declare function getLoopscaleVaultRewardsInfoPda(vault: PublicKey, programId?: PublicKey): PublicKey; export declare function getLoopscaleVaultStakePda(stakeNonce: PublicKey, vault: PublicKey, programId?: PublicKey): PublicKey; export declare function getLoopscaleUserRewardsInfoPda(vaultStake: PublicKey, programId?: PublicKey): PublicKey; export type PriceLoansAccounts = { loanAccounts: PublicKey[]; oracleAccounts: PublicKey[]; solUsdOracle?: PublicKey; baseAssetOracle?: PublicKey; glamConfig?: PublicKey; }; export type PriceStrategiesAccounts = { strategyAccounts: PublicKey[]; oracleAccounts: PublicKey[]; solUsdOracle?: PublicKey; baseAssetOracle?: PublicKey; glamConfig?: PublicKey; }; export type PriceVaultsAccounts = { numVaults: number; vaultAccounts: PublicKey[]; strategyAccounts: PublicKey[]; userLpTokenAccounts: PublicKey[]; vaultStakeAccounts: PublicKey[]; oracleAccounts: PublicKey[]; solUsdOracle?: PublicKey; baseAssetOracle?: PublicKey; glamConfig?: PublicKey; }; export declare function isLoopscaleLoanAccountInfo(info: Web3AccountInfo | null): info is Web3AccountInfo; export declare function isLoopscaleStrategyAccountInfo(info: Web3AccountInfo | null): info is Web3AccountInfo; export declare function isLoopscaleVaultAccountInfo(info: Web3AccountInfo | null): info is Web3AccountInfo; export declare function isLoopscaleVaultStakeAccountInfo(info: Web3AccountInfo | null): info is Web3AccountInfo; export declare function readLoopscaleStrategyPrincipalMint(data: Buffer): PublicKey; export declare function readLoopscaleVaultLpMint(data: Buffer): PublicKey; export declare function readLoopscaleVaultPrincipalMint(data: Buffer): PublicKey; export declare function readLoopscaleVaultStakeVault(data: Buffer): PublicKey; export declare function readLoopscaleVaultStakeAmount(data: Buffer): BN; export declare function readTokenAccountAmount(data: Buffer): bigint; export declare function readLoopscaleOracleMints(data: Buffer): PublicKey[]; export declare class LoopscaleBorrowTxBuilder extends BaseTxBuilder implements ProtocolPolicyTxBuilder { setPolicyIx(policy: LoopscaleBorrowPolicy, signer?: PublicKey): Promise; setBorrowPolicyIx(policy: LoopscaleBorrowPolicy, signer?: PublicKey): Promise; setPolicyTx(policy: LoopscaleBorrowPolicy, txOptions?: TxOptions): Promise; setBorrowPolicyTx(policy: LoopscaleBorrowPolicy, txOptions?: TxOptions): Promise; clearPolicyIx(signer?: PublicKey): Promise; clearPolicyTx(txOptions?: TxOptions): Promise; closeLoanIx(loan: PublicKey, signer?: PublicKey): Promise; closeLoanTx(loan: PublicKey, txOptions?: TxOptions): Promise; depositCollateralIx(params: DepositCollateralParams, accounts: DepositCollateralAccounts, signer?: PublicKey): Promise; depositCollateralTx(params: DepositCollateralParams, accounts: DepositCollateralAccounts, txOptions?: TxOptions): Promise; /** @deprecated */ updateWeightMatrixIx(params: UpdateWeightMatrixParams, accounts: UpdateWeightMatrixAccounts, signer?: PublicKey): Promise; /** @deprecated */ updateWeightMatrixTx(params: UpdateWeightMatrixParams, accounts: UpdateWeightMatrixAccounts, txOptions?: TxOptions): Promise; } export declare class LoopscaleLendTxBuilder extends BaseTxBuilder { setPolicyIx(policy: LoopscaleLendingPolicy, signer?: PublicKey): Promise; setLendingPolicyIx(policy: LoopscaleLendingPolicy, signer?: PublicKey): Promise; setPolicyTx(policy: LoopscaleLendingPolicy, txOptions?: TxOptions): Promise; setLendingPolicyTx(policy: LoopscaleLendingPolicy, txOptions?: TxOptions): Promise; clearPolicyIx(signer?: PublicKey): Promise; clearLendingPolicyIx(signer?: PublicKey): Promise; clearPolicyTx(txOptions?: TxOptions): Promise; clearLendingPolicyTx(txOptions?: TxOptions): Promise; createStrategyIx(params: CreateStrategyParams, accounts: CreateStrategyAccounts, signer?: PublicKey): Promise; } export declare class LoopscaleVaultTxBuilder extends BaseTxBuilder implements ProtocolPolicyTxBuilder { setPolicyIx(policy: LoopscaleVaultPolicy, signer?: PublicKey): Promise; setVaultPolicyIx(policy: LoopscaleVaultPolicy, signer?: PublicKey): Promise; setPolicyTx(policy: LoopscaleVaultPolicy, txOptions?: TxOptions): Promise; setVaultPolicyTx(policy: LoopscaleVaultPolicy, txOptions?: TxOptions): Promise; clearPolicyIx(signer?: PublicKey): Promise; clearVaultPolicyIx(signer?: PublicKey): Promise; clearPolicyTx(txOptions?: TxOptions): Promise; clearVaultPolicyTx(txOptions?: TxOptions): Promise; depositUserVaultIx(params: LoopscaleLpParams, accounts: DepositWithdrawUserVaultAccounts, signer?: PublicKey): Promise; depositUserVaultSetupIxs(accounts: DepositWithdrawUserVaultAccounts, signer?: PublicKey): TransactionInstruction[]; depositUserVaultIxs(params: LoopscaleLpParams, accounts: DepositWithdrawUserVaultAccounts, signer?: PublicKey): Promise; depositUserVaultTx(params: LoopscaleLpParams, accounts: DepositWithdrawUserVaultAccounts, txOptions?: TxOptions): Promise; withdrawUserVaultIx(params: LoopscaleLpParams, accounts: DepositWithdrawUserVaultAccounts, signer?: PublicKey): Promise; withdrawUserVaultIxs(params: LoopscaleLpParams, accounts: DepositWithdrawUserVaultAccounts, signer?: PublicKey): Promise; withdrawUserVaultTx(params: LoopscaleLpParams, accounts: DepositWithdrawUserVaultAccounts, txOptions?: TxOptions): Promise; stakeUserVaultLpIx(params: LoopscaleVaultStakeParams, accounts: StakeUserVaultLpAccounts, signer?: PublicKey): Promise; stakeUserVaultLpSetupIxs(accounts: StakeUserVaultLpAccounts, signer?: PublicKey): TransactionInstruction[]; stakeUserVaultLpIxs(params: LoopscaleVaultStakeParams, accounts: StakeUserVaultLpAccounts, signer?: PublicKey): Promise; stakeUserVaultLpTx(params: LoopscaleVaultStakeParams, accounts: StakeUserVaultLpAccounts, txOptions?: TxOptions): Promise; unstakeUserVaultLpIx(params: LoopscaleVaultUnstakeParams, accounts: UnstakeUserVaultLpAccounts, signer?: PublicKey): Promise; unstakeUserVaultLpSetupIxs(accounts: UnstakeUserVaultLpAccounts, signer?: PublicKey): TransactionInstruction[]; unstakeUserVaultLpIxs(params: LoopscaleVaultUnstakeParams, accounts: UnstakeUserVaultLpAccounts, signer?: PublicKey): Promise; unstakeUserVaultLpTx(params: LoopscaleVaultUnstakeParams, accounts: UnstakeUserVaultLpAccounts, txOptions?: TxOptions): Promise; claimVaultRewardsIx(mints: PublicKey[], accounts: ClaimVaultRewardsAccounts, signer?: PublicKey): Promise; claimVaultRewardsTx(mints: PublicKey[], accounts: ClaimVaultRewardsAccounts, txOptions?: TxOptions): Promise; private depositWithdrawUserVaultSetupIxs; } export declare class LoopscaleCoreClient { readonly base: BaseClient; readonly borrowTxBuilder: LoopscaleBorrowTxBuilder; readonly lendTxBuilder: LoopscaleLendTxBuilder; readonly vaultTxBuilder: LoopscaleVaultTxBuilder; constructor(base: BaseClient); get programId(): PublicKey; get integrationAuthorityPda(): PublicKey; getEventAuthorityPda(): PublicKey; getLoanPda(nonce: BN, borrower?: PublicKey): PublicKey; getStrategyPda(nonce: PublicKey): PublicKey; getVaultPda(vaultNonce: PublicKey): PublicKey; getVaultStrategyPda(vault: PublicKey): PublicKey; getVaultRewardsInfoPda(vault: PublicKey): PublicKey; getVaultStakePda(stakeNonce: PublicKey, vault: PublicKey): PublicKey; getUserRewardsInfoPda(vaultStake: PublicKey): PublicKey; getLoanTokenAta(loan: PublicKey, mint: PublicKey, tokenProgram?: PublicKey): PublicKey; getStrategyTokenAta(strategy: PublicKey, mint: PublicKey, tokenProgram?: PublicKey): PublicKey; getVaultLpTokenAta(lpMint: PublicKey, owner?: PublicKey, tokenProgram?: PublicKey): PublicKey; getVaultStakeLpTokenAta(vaultStake: PublicKey, lpMint: PublicKey, tokenProgram?: PublicKey): PublicKey; fetchLoan(loan: PublicKey): Promise; fetchOwnedLoan(loan: PublicKey, borrower?: PublicKey): Promise; fetchRegisteredLoans(commitment?: Commitment): Promise; fetchRegisteredStrategies(commitment?: Commitment): Promise; fetchRegisteredVaultStakeAccountInfos(commitment?: Commitment): Promise<{ address: PublicKey; info: Web3AccountInfo; }[]>; private fetchRegisteredExternalPositions; fetchStrategy(strategy: PublicKey): Promise; fetchOwnedStrategy(strategy: PublicKey, lender?: PublicKey): Promise; fetchStrategyMarket(strategy: PublicKey | LoopscaleStrategy): Promise; fetchOwnedStrategyWithMarket(strategy: PublicKey, lender?: PublicKey): Promise; assertStrategyClosable(strategy: LoopscaleStrategy): void; assertStrategyPrincipalWithdrawable(strategy: LoopscaleStrategy, amount: BN, withdrawAll: boolean): void; /** Fetches, validates, and decodes a Loopscale MarketInformation account. */ fetchMarketInformation(marketInformation: PublicKey): Promise; /** * Resolves the market-derived account inputs for a borrow: the asset index * guidance and the strategy duration index that matches the quoted APY. */ resolveBorrowMarketAccounts(params: { strategy: PublicKey | LoopscaleStrategy; collateralMint: PublicKey; expectedApy: BN; }): Promise; /** * Resolves the market-derived inputs for sell_ledger. Loopscale's sell API * emits principal/collateral asset-index hints plus the matching price oracle * remaining accounts. */ resolveSellLedgerMarketAccounts(params: { loan: PublicKey | LoopscaleLoan; ledgerIndex: number; newStrategy: PublicKey | LoopscaleStrategy; }): Promise; /** * Resolves borrow terms for a known strategy and expected loan values, without * consulting the quote API. */ resolveBorrowTermsFromStrategy(params: { strategy: PublicKey | LoopscaleStrategy; principalMint: PublicKey; assetIdentifier: PublicKey; expectedApy: BN; expectedLqt: [number, number, number, number, number]; }): Promise; /** * Resolves borrow terms for a caller-selected strategy by reading its * collateral map directly. If multiple populated duration slots exist for the * collateral, the caller must provide `requestedDurationIndex`. */ resolveBorrowTermsFromTargetStrategy(params: { strategy: PublicKey | LoopscaleStrategy; principalMint: PublicKey; assetIdentifier: PublicKey; requestedDurationIndex?: number; }): Promise; /** * Fetches and selects a Loopscale quote, then resolves the borrow terms needed * for borrow_principal. */ resolveBorrowTermsFromQuote(params: { principalMint: PublicKey; collateralMint: PublicKey; assetIdentifier: PublicKey; collateralAmount: BN; borrowAmount: BN; durationType: number; duration: number; externalYieldSource?: number; }): Promise; private requireAssetIndex; private requireMarketAssetInfo; private requireDurationIndex; fetchMaxQuotes(params: LoopscaleMaxQuoteParams): Promise; /** * Selects the first quote with a usable strategy, optionally requiring it to * support at least `borrowAmount` base units. */ selectBestQuote(quotes: LoopscaleQuote[], externalYieldSource?: number, borrowAmount?: BN): Promise; /** * Fetches quotes from Loopscale and selects the best one. */ fetchBestQuote(params: LoopscaleMaxQuoteParams): Promise; decompileApiMessage(message: string): Promise; mapApiIx(ix: TransactionInstruction): TransactionInstruction; addUpdateStrategyValidationMarket(ix: TransactionInstruction, marketInformation: PublicKey): TransactionInstruction; addDepositCollateralLedgerAccounts(ixs: TransactionInstruction[]): TransactionInstruction[]; setDepositCollateralAssetIndexGuidance(ixs: TransactionInstruction[], assetIndexGuidance: number[]): TransactionInstruction[]; getApiUpdateWeightMatrixAssetIndexGuidance(ixs: TransactionInstruction[], loan: PublicKey): number[]; /** * Decompiles instructions from transaction messages and maps eligible ones to GLAM instructions * * @param messages Serialized transaction messages. * @param expectedDiscriminator Discriminator to look for in the instructions. * @returns */ mapApiMessagesToGlamIxs(messages: string[], expectedDiscriminator: Buffer): Promise; /** * Fetches a transaction from the Loopscale API * * @param path API endpoint path. * @param init Request initialization options. * @returns */ fetchApiTransaction(path: string, init: RequestInit): Promise; /** * Signs a built transaction with the client wallet, has it co-signed by the * Loopscale MPC, and returns the co-signed transaction. */ cosignTransaction(params: { tx: VersionedTransaction; identifier: string; }): Promise; coSignAndSend(ixs: TransactionInstruction[], txOptions?: TxOptions, additionalSigners?: Keypair[], identifierSuffix?: string): Promise; sendCosignedIxBatches(txs: LoopscaleMappedTransaction[], txOptions?: TxOptions): Promise; getBaseAssetOracle(): Promise; }