@pyron-finance/pyron-client 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +179 -0
- package/dist/chunk-B9dir_RE.mjs +11 -0
- package/dist/common/index.d.mts +2 -0
- package/dist/common/index.d.ts +2 -0
- package/dist/common/index.js +68 -0
- package/dist/common/index.mjs +3 -0
- package/dist/index-DUhjh5_z.d.mts +10062 -0
- package/dist/index-DUhjh5_z.d.mts.map +1 -0
- package/dist/index-DoxqUMQW.d.ts +10064 -0
- package/dist/index-DoxqUMQW.d.ts.map +1 -0
- package/dist/index.d.mts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +224 -0
- package/dist/index.mjs +3 -0
- package/dist/src-DITEj1yC.mjs +22634 -0
- package/dist/src-DITEj1yC.mjs.map +1 -0
- package/dist/src-WLna_-6m.js +24357 -0
- package/package.json +75 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"src-DITEj1yC.mjs","names":["ldProgram: LendrProgram","accounts: {\n lendrGroup: PublicKey;\n lendrAccount: PublicKey;\n authority: PublicKey;\n feePayer: PublicKey;\n }","accounts","accountSeed: BN","accounts: {\n // Required accounts\n lendrAccount: PublicKey;\n signerTokenAccount: PublicKey;\n bank: PublicKey;\n tokenProgram: PublicKey;\n // Optional accounts - to override inference\n group?: PublicKey;\n authority?: PublicKey;\n liquidityVault?: PublicKey;\n }","args: {\n amount: BN;\n depositUpToLimit?: boolean;\n }","remainingAccounts: AccountMeta[]","accounts: LendingAccountDepositOrRepayWithSessionAccounts","args: {\n amount: BN;\n repayAll?: boolean;\n }","accounts: {\n // Required accounts\n lendrAccount: PublicKey;\n bank: PublicKey;\n destinationTokenAccount: PublicKey;\n tokenProgram: PublicKey;\n // Optional accounts - to override inference\n group?: PublicKey;\n authority?: PublicKey;\n }","args: {\n amount: BN;\n withdrawAll?: boolean;\n }","accounts: LendingAccountWithdrawOrBorrowWithSessionAccounts","args: {\n amount: BN;\n }","ldrProgram: LendrProgram","accounts: {\n // Required accounts\n assetBank: PublicKey;\n liabBank: PublicKey;\n liquidatorLendrAccount: PublicKey;\n liquidateeLendrAccount: PublicKey;\n tokenProgram: PublicKey;\n // Optional accounts - to override inference\n group?: PublicKey;\n authority?: PublicKey;\n }","args: {\n assetAmount: BN;\n }","accounts: {\n // Required accounts\n lendrAccount: PublicKey;\n destinationAccount: PublicKey;\n bank: PublicKey;\n tokenProgram: PublicKey;\n // Optional accounts - to override inference\n group?: PublicKey;\n authority?: PublicKey;\n emissionsMint?: PublicKey;\n }","accounts: {\n // Required accounts\n lendrAccount: PublicKey;\n // Optional accounts - to override inference\n group?: PublicKey;\n admin?: PublicKey;\n }","args: {\n flag: BN;\n }","makePoolConfigureBankIx","accounts: {\n // Required accounts\n bank: PublicKey;\n // Optional accounts - to override inference\n group?: PublicKey;\n admin?: PublicKey;\n }","args: {\n bankConfigOpt: BankConfigOptRaw;\n }","accounts: {\n // Required accounts\n lendrAccount: PublicKey;\n // Optional accounts - to override inference\n authority?: PublicKey;\n ixsSysvar?: PublicKey;\n }","args: {\n endIndex: BN;\n }","accounts: {\n // Required accounts\n lendrAccount: PublicKey;\n // Optional accounts - to override inference\n authority?: PublicKey;\n }","accounts: {\n // Required accounts\n lendrAccount: PublicKey;\n newAuthority: PublicKey;\n feePayer: PublicKey;\n // Optional accounts - to override inference\n group?: PublicKey;\n authority?: PublicKey;\n }","accounts: {\n lendrGroup: PublicKey;\n admin: PublicKey;\n }","args?: {\n isArenaGroup?: boolean;\n }","args: {\n /**\n * The oracle setup index, see {@link serializeOracleSetupToIndex}\n */\n setup: number;\n /**\n * The oracle feed id\n */\n feedId: PublicKey;\n }","accounts: {\n // Required accounts\n stakedSettings: PublicKey;\n feePayer: PublicKey;\n bankMint: PublicKey;\n solPool: PublicKey;\n stakePool: PublicKey;\n // Optional accounts - to override inference\n lendrGroup?: PublicKey;\n /**\n * The token program to use for this instruction, defaults to the SPL token program\n */\n tokenProgram?: PublicKey;\n }","args: {\n /**\n * The seed to use for the bank account. Defaults to 0 (new BN(0)).\n * If the seed is not specified, the seed is set to 0, and the bank account\n * will be created at the address {@link findPoolAddress} with the default\n * bump.\n */\n seed?: BN;\n }","BN","makePoolAddBankIx","accounts: {\n // Required accounts\n lendrGroup: PublicKey;\n feePayer: PublicKey;\n bankMint: PublicKey;\n bank: PublicKey;\n tokenProgram: PublicKey;\n // Optional accounts - to override inference\n admin?: PublicKey;\n globalFeeWallet?: PublicKey;\n }","args: {\n bankConfig: BankConfigCompactRaw;\n }","accounts: {\n // Required accounts\n lendrAccount: PublicKey;\n feePayer: PublicKey;\n // Optional accounts - to override inference\n authority?: PublicKey;\n }","accounts: {\n lendrAccount: PublicKey;\n }","makePulseHealthIx","instructions","DISABLED_FLAG: number","FLASHLOAN_ENABLED_FLAG: number","TRANSFER_ACCOUNT_AUTHORITY_FLAG: number","WSOL_EXTENDED_METADATA: BankExtendedMetadata","DEFAULT_COMMITMENT: Commitment","DEFAULT_SEND_OPTS: SendOptions","DEFAULT_CONFIRM_OPTS: ConfirmOptions","MAX_TX_SIZE","BUNDLE_TX_SIZE","PRIORITY_TX_SIZE","STAKE_CONFIG_ID","payer: Keypair","tx: T","txs: T[]","value: number","decimals: number","values: number[]","map: Record<string, T>","key: string","key","ms: number","array: T[]","size: number","duration: number","message: string","connection: Connection","pks: string[]","batchChunkSize: number","maxAccountsChunkSize: number","accountInfos: Array<AccountInfo<string[]> | null>","batchResults: Result[]","accounts","allAccountInfos: Array<AccountInfo<Buffer> | null>","allAccountInfos: Array<AccountInfo<Buffer>>","chunkSize: number","chunks: T[][]","chunks","TransactionConfigMap: Record<TransactionType, TransactionConfig>","TransactionArenaKeyMap: Partial<Record<TransactionType, PublicKey>>","tx: Transaction | VersionedTransaction","tx: VersionedTransaction | Transaction","lookupTableAccounts: AddressLookupTableAccount[]","idl: Idl","encoded: Buffer","tx: VersionedTransaction","transaction: Transaction","opts?: UpdateTxOptions","transaction: VersionedTransaction","instructions: TransactionInstruction[]","instructions","ix1: TransactionInstruction","ix2: TransactionInstruction","additionalInstructions: TransactionInstruction[]","replaceOnly?: boolean","updatedAdditionalIxs: TransactionInstruction[]","blockhash: string","transaction: T","options: ExtendedTransactionProperties","data: Buffer","instruction: TransactionInstruction","tx: SolanaTransaction","ui: number","limitCU: number","microLamports: number","mandatoryIxs: TransactionInstruction[]","ixs: TransactionInstruction[]","opts: {\n blockhash: string;\n payerKey: PublicKey;\n luts: AddressLookupTableAccount[];\n }","result: VersionedTransaction[]","buffer: TransactionInstruction[]","extraIxs: TransactionInstruction[]","opts: {\n blockhash: string;\n payerKey: PublicKey;\n luts: AddressLookupTableAccount[];\n }","opts","mandatoryIxs","MAX_TX_SIZE","connection: Connection","config: GetRecentPrioritizationFeesByPercentileConfig","slotsToReturn?: number","median","config: any","rpcRequest: any","accounts","key: { toBase58: () => any }","promises: Array<Promise<void>>","tritonRpcResponse: RpcResponse | undefined","fallbackRpcResponse: RpcResponse | undefined","recentPrioritizationFees: RecentPrioritizationFees[]","apy: number","compoundingFrequency: number","apr: number","apyCap: number","principal: number","durationInYears: number","interest: number","wrapped: WrappedI80F48","value: Amount","amount: Amount","amt: number","amount: Amount | BN","amt: BigNumber","decimals: number","pubkey: Address","bps: number","banksAndOracles: PublicKey[][]","locale: string | string[] | undefined","options: Intl.NumberFormatOptions | undefined","value: number | bigint","value: number","options: dynamicNumeralFormatterOptions","opts: { minFractionDigits: number; maxFractionDigits: number }","percentFormatter","price: number","style: \"currency\" | \"decimal\"","emodeTag: EmodeTag","timestamp: number","flags: EmodeFlags[]","emodeEntries: EmodeEntry[]","emodeSettingsRaw: EmodeSettingsRaw","encoded: Buffer","idl: LendrIdlType","address: PublicKey","accountParsed: BankRaw","feedIdMap?: PythPushFeedIdMap","bankMetadata?: BankMetadata","bankDto: BankTypeDto","emodeSettingsDto: EmodeSettingsDto","bankConfigDto: BankConfigDto","interestRateConfigDto: InterestRateConfigDto","bankDto: BankRawDto","BN","emodeSettingsDto: EmodeSettingsRawDto","bankConfigDto: BankConfigRawDto","key: string","bankConfigRaw: BankConfigRaw","riskTierRaw: RiskTierRaw","operationalStateRaw: OperationalStateRaw","oracleSetupRaw: OracleSetupRaw","flags: BN","activeFlags: EmodeFlags[]","flag: number","flags: number","activeFlags: EmodeEntryFlags[]","emodeTagRaw: number","name: string","expected: string","actual: any","str: string","range: string","received: number","value: any","value: number","length: number","buffer: Buffer","data: Buffer","parsePriceInfo","exponent: number","status: PriceStatus","corporateAction: CorpAction","AccountType","currentSlot?: number","priceType: PriceType","price: number | undefined","confidence: number | undefined","priceComponents: PriceComponent[]","data: Buffer","decoded: PriceUpdateV2","borsh","capConfidenceInterval","price: BigNumber","confidence: BigNumber","maxConfidence: BigNumber","data: Buffer","voteAccount: PublicKey","pool: PublicKey","userStakeAccount: PublicKey","userTokenAccount: PublicKey","userLamportAccount: PublicKey","userStakeAuthority: PublicKey","tokenAmount: BigNumber","BN","payer: PublicKey","authorizedWithdrawer: PublicKey","tokenName: string","tokenSymbol: string","tokenUri: string","programId: PublicKey","keys: AccountMeta[]","data: Buffer","baseAddress: PublicKey","prefix: string","voteAccountAddress: PublicKey","poolAddress: PublicKey","poolMintAddress: PublicKey","connection: Connection","instructions","instructions: TransactionInstruction[]","from: PublicKey","newAccount: PublicKey","lamports: number","space: number","programAddress: PublicKey","accounts","program: any","publicKey: anchor.web3.PublicKey","aggregator: { latestConfirmedRound: { numSuccess: any; result: { toBig: () => any } } }","obj: any","property: any","fields: { mantissa: any; scale: any }","property: any","obj: { mantissa: any; scale: any }","fields: any","obj: { mantissa: string | number | BN | number[] | Uint8Array | Buffer; scale: any }","BN","big: {\n round: (arg0: number) => any;\n c: {\n join: (arg0: string) => string | number | BN | number[] | Uint8Array | Buffer;\n slice: (arg0: number) => { (): any; new (): any; length: number };\n };\n e: number;\n s: string | number | BN | number[] | Uint8Array | Buffer;\n // sub: (arg0: Big) => {\n // (): any;\n // new (): any;\n // abs: {\n // (): { (): any; new (): any; gt: { (arg0: Big): any; new (): any } };\n // new (): any;\n // };\n // };\n toNumber: () => any;\n }","other: { mantissa: any; scale: any }","c: Array<number>","fields: any","item: any","property: any","obj: any","BN","item: PublicKeyInitData","item: { mantissa: string | number | BN | number[] | Uint8Array | Buffer; scale: any }","item: string | number | BN | number[] | Uint8Array | Buffer","fields: { data: any }","property: any","obj: { data: any }","fields: any","fields: any","item: any","data: any","SWB_ONDEMAND_IDL","provider: Provider","data: Buffer","type: BankVaultType","bankVaultType: BankVaultType","bankPk: PublicKey","programId: PublicKey","walletAddress: PublicKey","amount: BigNumber","address","blockhash: Blockhash","transaction: Transaction","payer: PublicKey","addressLookupTables?: AddressLookupTableAccount[]","priorityFeeMicro?: number","priorityFeeUi?: number","computeUnitsLimit?: number","priorityFeeIx: TransactionInstruction[]","microLamports: number","feedId: PublicKey","bankConfigs: BankConfigRaw[]","connection: Connection","feedIdMap: PythPushFeedIdMap","accountInfos: Array<AccountInfo<Buffer<ArrayBufferLike>> | null>","bankConfig: BankConfig","feedMap: PythPushFeedIdMap","oracleKey: PublicKey","shardId: number | undefined","feedId: Buffer","shardId: number","value: number","active: boolean","bankPk: PublicKey","assetShares: BigNumber","liabilityShares: BigNumber","emissionsOutstanding: BigNumber","lastUpdate: number","balanceRaw: BalanceRaw","balance: BalanceType","bank: Bank","oraclePrice: OraclePrice","currentTimestamp: number","PYTH_PUSH_ORACLE_IDL: PythPushOracle","PYTH_WORMHOLE_IDL: WormholeCoreBridgeSolana","PYTH_SOLANA_RECEIVER_PROGRAM_IDL: PythSolanaReceiver","vaa: Buffer","updateBytes: Buffer","data: Buffer","updates: Array<{\n message: Buffer<ArrayBufferLike>;\n proof: Array<number>[];\n }>","proof: Array<number[]>","wormhole: Program<WormholeCoreBridgeSolana>","initInstructions: InstructionWithEphemeralSigners[]","writeFirstPartInstructions: InstructionWithEphemeralSigners[]","writeSecondPartAndVerifyInstructions: InstructionWithEphemeralSigners[]","closeInstructions: InstructionWithEphemeralSigners[]","encodedVaaKeypair: Keypair","guardianSetIndex: number","wormholeProgramId: PublicKey","message: Buffer","program: LendrProgram","bankAddress: PublicKey","bankConfigOpt: BankConfigOpt","bankConfigRaw: BankConfigOptRaw","instructions","shardId: number","priceFeedId: Buffer | string","pushOracleProgramId?: PublicKey","treasuryId: number","receiverProgramId: PublicKey","oracles: { feedId: string; shardId: number }[]","provider: Provider","feedIdsByShardId: Record<number, string[]>","endpoint: string","postInstructions: InstructionWithEphemeralSigners[]","priceFeedIdToPriceUpdateAccount: Record<string, PublicKey>","closeInstructions: InstructionWithEphemeralSigners[]","priceDataArray: string[]","oraclePrice: OraclePrice","weighted: boolean","priceBias: PriceBias","weightedPrice: boolean","price: BigNumber","confidence: BigNumber","maxConfidence: BigNumber","oracleSetup: OracleSetup","rawData: Buffer","logger: TLogger","shardId?: number","dto: OraclePriceDto","banks: { address: PublicKey; data: BankRaw }[]","pythPushBanks: { address: PublicKey; data: BankRaw }[]","voteAccMintTuples: [string, string][]","pythFeedMapJson: PythFeedMapResponse","stakedCollatDataJson: Record<string, number>","connection: Connection","pythStakedCollateralBanks: { address: PublicKey; data: BankRaw }[]","bankMetadataMap: { [address: string]: BankMetadata }","voteAccCoeffs: Record<string, number>","priceCoeffByBank: Record<string, number>","pythLegacyBanks: { address: PublicKey; data: BankRaw }[]","pythFeedMap: PythPushFeedIdMap","pythOracleKeys: string[]","responseBody: Record<string, any>","oraclePrices: Record<string, OraclePrice>","bankMetadataMap: {\n [address: string]: BankMetadata;\n }","connection?: Connection","opts?: { useApiEndpoint?: boolean }","priceComponent: PriceWithConfidence","priceCoeff: number","oracleKeyMap: Record<string, { feedId: string }>","swbPullBanks: { address: PublicKey; data: BankRaw }[]","swbOracleKeyMapJson: Record<string, { feedId: string }>","swbFeedIds: string[]","oraclePrice: OraclePrice","depositBank: BankType","borrowBank: BankType","opts?: { assetWeightInit?: BigNumber; liabilityWeightInit?: BigNumber }","principal: Amount","targetLeverage: number","depositOracleInfo: OraclePrice","borrowOracleInfo: OraclePrice","bank: BankType","assetShares: BigNumber","liabilityShares: BigNumber","assetQuantity: BigNumber","liabilityQuantity: BigNumber","lendrRequirementType: LendrRequirementType","oraclePrice: OraclePrice","opts?: {\n ignoreSoftLimits?: boolean;\n assetWeightInitOverride?: BigNumber;\n }","config: BankConfigType","priceBias: PriceBias","quantity: BigNumber","weightedPrice: boolean","weight?: BigNumber","scaleToBase: boolean","SECONDS_PER_DAY","SECONDS_PER_YEAR","program: LendrProgram","opts?: { bankAddresses?: Address[]; groupAddress?: PublicKey }","bankDatas: { address: PublicKey; data: BankRaw }[]","bankConfigOpt: BankConfigOpt","value: BigNumber | null","BN","riskTier: RiskTier","operationalState: OperationalState","oracleSetup: OracleSetup","bank: BankType","emodeSettings: EmodeSettingsType","bankConfig: BankConfigType","interestRateConfig: InterestRateConfig","bankRaw: BankRaw","emodeSettingsRaw: EmodeSettingsRaw","bankConfigRaw: BankConfigRaw","address: PublicKey","mint: PublicKey","mintDecimals: number","group: PublicKey","assetShareValue: BigNumber","liabilityShareValue: BigNumber","liquidityVault: PublicKey","liquidityVaultBump: number","liquidityVaultAuthorityBump: number","insuranceVault: PublicKey","insuranceVaultBump: number","insuranceVaultAuthorityBump: number","collectedInsuranceFeesOutstanding: BigNumber","feeVault: PublicKey","feeVaultBump: number","feeVaultAuthorityBump: number","collectedGroupFeesOutstanding: BigNumber","lastUpdate: number","config: BankConfig","totalAssetShares: BigNumber","totalLiabilityShares: BigNumber","emissionsActiveBorrowing: boolean","emissionsActiveLending: boolean","emissionsRate: number","emissionsMint: PublicKey","emissionsRemaining: BigNumber","oracleKey: PublicKey","emode: EmodeSettings","pythShardId?: number","tokenSymbol?: string","extendedMetadata?: BankExtendedMetadata","owner?: PublicKey","encoded: Buffer","idl: LendrIdlType","bankPk: PublicKey","rawData: Buffer","feedIdMap: PythPushFeedIdMap","bankType: BankType","accountParsed: BankRaw","feedIdMap?: PythPushFeedIdMap","address","bank: Bank","emodeWeights: { assetWeightMaint: BigNumber; assetWeightInit: BigNumber }","oraclePrice: OraclePrice","priceBias: PriceBias","weightedPrice: boolean","usdValue: BigNumber","assetShares: BigNumber","liabilityShares: BigNumber","assetQuantity: BigNumber","liabilityQuantity: BigNumber","lendrRequirementType: LendrRequirementType","quantity: BigNumber","weight?: BigNumber","scaleToBase: boolean","ignoreSoftLimits: boolean","assetWeightInitOverride?: BigNumber","assetWeightInit: BigNumber","assetWeightMaint: BigNumber","liabilityWeightInit: BigNumber","liabilityWeightMaint: BigNumber","depositLimit: BigNumber","borrowLimit: BigNumber","riskTier: RiskTier","totalAssetValueInitLimit: BigNumber","assetTag: AssetTag","oracleSetup: OracleSetup","oracleKeys: PublicKey[]","oracleMaxAge: number","interestRateConfig: InterestRateConfig","operationalState: OperationalState","bankConfigRaw: BankConfigRaw","address: PublicKey","group: PublicKey","authority: PublicKey","balances: Balance[]","accountFlags: AccountFlags[]","emissionsDestinationAccount: PublicKey","healthCache: HealthCache","client: LendrClient","data: LendrAccountRaw","address","encoded: Buffer","idl: LendrIdlType","account: LendrAccountType","lendrAccountPk: PublicKey","accountData: LendrAccountRaw","program: Program<LendrIdlType>","bankMap: Map<string, Bank>","oraclePrices: Map<string, OraclePrice>","bankMetadataMap: BankMetadataMap","rawData: Buffer","bankPk: PublicKey","value: HealthCache","opts?: { clamped?: boolean }","banks: Map<string, BankType>","lendrReqType: LendrRequirementType","banks: Map<string, Bank>","excludedBanks: PublicKey[]","bankAddress: PublicKey","opts?: {\n emodeImpactStatus?: EmodeImpactStatus;\n volatilityFactor?: number;\n emodeWeights?: {\n assetWeightMaint: BigNumber;\n assetWeightInit: BigNumber;\n collateralTag: EmodeTag;\n };\n }","logger: TLogger","opts?: { volatilityFactor?: number }","priceLowestBias","liquidationPrice: BigNumber","opts?: {\n assetWeightMaint: BigNumber;\n }","isLending: boolean","amount: number","assetBankAddress: PublicKey","liabilityBankAddress: PublicKey","mandatoryBanks: PublicKey[]","emodePairs: EmodePair[]","banks: PublicKey[]","mintDatas: Map<string, MintData>","amount: Amount","opts: MakeDepositIxOpts","depositIxs: Array<TransactionInstruction>","program: LendrProgram","instructions","sessionKey: PublicKey","opts: MakeDepositWithSessionIxOpts","accounts","opts: MakeRepayIxOpts","repayIxs: Array<TransactionInstruction>","remainingAccounts: PublicKey[]","opts: MakeRepayWithSessionIxOpts","withdrawOpts: MakeWithdrawIxOpts & { createAtaPayer?: PublicKey }","withdrawIxs: Array<TransactionInstruction>","withdrawOpts: MakeWithdrawIxOpts","session: EstablishedSessionState","withdrawOpts: MakeWithdrawWithSessionIxOpts","borrowOpts: MakeBorrowIxOpts & { createAtaPayer?: PublicKey }","borrowIxs: TransactionInstruction[]","borrowOpts: MakeBorrowIxOpts","borrowOpts: MakeBorrowWithSessionIxOpts","ixs: Array<TransactionInstruction>","liquidateeLendrAccount: LendrAccount","assetQuantityUi: Amount","endIndex: number","BN","projectedActiveBalances: PublicKey[]","newAccountAuthority: PublicKey","instructions: TransactionInstruction[]","ix: TransactionInstruction","banks: BankMap","oraclePrices: OraclePriceMap","reqType: LendrRequirementType","lendrAccountPk: PublicKey","client: LendrClient","lendrAccount: LendrAccount","lendrAccountPk: Address","commitment?: Commitment","accountData: LendrAccountRaw","lendrAccountRawData: Buffer","idl: LendrIdlType","bankPk: PublicKey","lendrRequirement: LendrRequirementType","excludedBanks: PublicKey[]","opts?: { clamped?: boolean }","emodePairs: EmodePair[]","bankAddress: PublicKey","opts?: {\n volatilityFactor?: number;\n emodeWeights?: {\n assetWeightMaint: BigNumber;\n assetWeightInit: BigNumber;\n collateralTag: EmodeTag;\n };\n }","opts?: { volatilityFactor?: number }","assetBankAddress: PublicKey","liabilityBankAddress: PublicKey","isLending: boolean","amount: number","principal: Amount","targetLeverage: number","depositBankAddress: PublicKey","borrowBankAddress: PublicKey","cuRequestIxs: TransactionInstruction[]","banks: PublicKey[]","ixs: Array<TransactionInstruction>","amount: Amount","destinationAccountPk: PublicKey","processOpts?: ProcessTransactionsClientOpts","txOpts?: TransactionOptions","feedCrankTxs: ExtendedV0Transaction[]","props: RepayWithCollateralProps","additionalTxs: ExtendedV0Transaction[]","flashloanTx: ExtendedV0Transaction","MAX_TX_SIZE","PRIORITY_TX_SIZE","txSize","txToBig","props: LoopProps","instructions","depositOpts: MakeDepositIxOpts","sessionKey: PublicKey","depositOpts: MakeDepositWithSessionIxOpts","stakeAccountPk: PublicKey","validator: PublicKey","instructions: TransactionInstruction[]","signers: Signer[]","targetStakePubkey: PublicKey","stakeAccountSrc: PublicKey","stakeAccountDest: PublicKey","session: EstablishedSessionState","txs: (VersionedTransaction | Transaction)[]","banksToInspect: PublicKey[]","healthSimOptions?: {\n enabled: boolean;\n mandatoryBanks: PublicKey[];\n excludedBanks: PublicKey[];\n }","additionalTxs: VersionedTransaction[]","LendrClient","repayOpts: MakeRepayIxOpts","repayOpts: MakeRepayWithSessionIxOpts","withdrawOpts: MakeWithdrawIxOpts","withdrawOpts: MakeWithdrawWithSessionIxOpts","isWholePosition: boolean","withdrawStakeIx: TransactionInstruction","banks: {\n amount: Amount;\n bankAddress: PublicKey;\n }[]","withdrawIxsWrapped: InstructionsWrapper[]","borrowOpts: MakeBorrowIxOpts","borrowOpts: MakeBorrowWithSessionIxOpts","bankAddresses: PublicKey[]","withdrawEmissionsIxs: InstructionsWrapper[]","liquidateeLendrAccount: LendrAccount","assetQuantityUi: Amount","liabBankAddress: PublicKey","endIndex: number","projectedActiveBalances: PublicKey[]","args: FlashLoanArgs","lookupTables?: AddressLookupTableAccount[]","newAccountAuthority: PublicKey","newBanksPk: PublicKey[]","mandatoryBanks: PublicKey[]","accountAddress: Address","config: LendrConfig","program: LendrProgram","data: LendrAccountRaw","decoded: LendrAccountRaw","txs: VersionedTransaction[]","feePayer: PublicKey","broadcastType: TransactionBroadcastType","computeUnitsLimit?: number","bundleTipIx: TransactionInstruction | undefined","priorityFeeIx: TransactionInstruction","luts: AddressLookupTableAccount[]","address","assetValue: BigNumber","liabilityValue: BigNumber","assetValueMaint: BigNumber","liabilityValueMaint: BigNumber","assetValueEquity: BigNumber","liabilityValueEquity: BigNumber","timestamp: BigNumber","flags: HealthCacheFlags[]","prices: number[][]","simulationFailed?: boolean","healthCacheRaw: HealthCacheRaw","message: string","bundleId?: string","connection: Connection","base58Txs: string[]","tempBundleId?: string","bundleId: string","commitment: Commitment","message: string","logs?: string[]","cause?: unknown","status: number","statusText: string","error: unknown","index?: number","response: SimulatedTransactionResponse | RpcSimulateBundleTransactionResult[]","rpcEndpoint: string","transactions: VersionedTransaction[]","includeAccounts?: Array<PublicKey>","encodedTransactions: string[]","config: RpcSimulateBundleConfig","LENDR_IDL_V0_1_3_JSON","error: ProcessTransactionError","failedTxs: SolanaTransaction[]","LDR_ERROR_CODE_MAP: Map<number, string>","error: any","ldrProgramId: PublicKey","logs: string[]","errorMsg: string | undefined","log","TokenErrorCodeMap: Map<number, string>","JupiterErrorCodeMap: Map<number, string>","ERROR_CODE_MAPS: Map<string, Map<number, string>>","DEFAULT_PROCESS_TX_STRATEGY: ProcessTransactionStrategy","broadcastType: BroadcastMethodType","finalFallbackMethod: SpecificBroadcastMethod[]","versionedTransactions: VersionedTransaction[]","minContextSlot: number","blockhash: string","lastValidBlockHeight: number","mergedOpts: ConfirmOptions","updatedTransactions: SolanaTransaction[]","signatures: TransactionSignature[]","bundleSignature: string | undefined","base58Txs: string[]","simulateTxs: (() => Promise<SimulatedTransactionResponse | RpcSimulateBundleTransactionResult[]>) | null","throwError: boolean","bundleId?: string","temporaryBundleSignature: string | undefined","sig: string | undefined","sigs: string[] | undefined","error: any","processOpts: ProcessTransactionOpts","connection: Connection","solanaTransactions: VersionedTransaction[] | Transaction[] | SolanaTransaction[]","confirmOpts?: ConfirmOptions","txOpts?: {\n feePayer: PublicKey;\n blockhash: string;\n }","signature: string","commitment: Commitment","commitmentArray: Commitment[]","index: number","signatures: TransactionSignature[]","signature: TransactionSignature","tx: SolanaTransaction","transactions: SolanaTransaction[]","transactionsArg: SolanaTransaction[]","broadcastType: TransactionBroadcastType","blockhash: string","feeSettings: FeeSettings","addTransactionTags?: boolean","formattedTransactions: VersionedTransaction[]","txSizes: number[]","priorityIxs: TransactionInstruction[]","cuLimitIxs: (TransactionInstruction | undefined)[]","priorityFeeIndexes: number[]","requiredIxs: TransactionInstruction[]","newTransaction: VersionedTransaction","txWithTags: SolanaTransaction[]","solanaTx: SolanaTransaction","lendrAccount: LendrAccountType","opts?: { clamped?: boolean }","activeBalances: BalanceType[]","banks: Map<string, BankType>","oraclePrices: Map<string, OraclePrice>","lendrReqType: LendrRequirementType","excludedBanks: PublicKey[]","assets","liabilities","balance: BalanceType","bank: BankType","oraclePrice: OraclePrice","lendrRequirementType: LendrRequirementType","currentTimestamp: number","balanceAmount: BigNumber | null","balances: BalanceType[]","mandatoryBanks: PublicKey[]","bank","banksToInclude: BankType[]","bankMetadataMap?: BankMetadataMap","bankExtendedMetadata?: BankExtendedMetadata","banksAndOracles: PublicKey[][]","accounts","encoded: Buffer","idl: LendrIdlType","balanceRaw: BalanceRaw","lendrAccountPk: PublicKey","accountData: LendrAccountRaw","address","flags: BN","activeFlags: AccountFlags[]","flag: number","BN","flags: number","activeFlags: HealthCacheFlags[]","flag: HealthCacheFlags","lendrAccountDto: LendrAccountTypeDto","balanceDto: BalanceTypeDto","healthCacheDto: HealthCacheTypeDto","emodePairs: EmodePair[]","activeLiabilities: PublicKey[]","activeCollateral: PublicKey[]","allBanks: PublicKey[]","k: PublicKey","ps: EmodePair[]","before: EmodePair[]","after: EmodePair[]","bank: PublicKey","action: \"borrow\" | \"repay\" | \"supply\" | \"withdraw\"","bestPair: EmodePair | undefined","result: Record<string, ActionEmodeImpact>","impact: ActionEmodeImpact","byCollTag: Record<string, EmodePair[]>","program: LendrProgram","authority: PublicKey","group: PublicKey","lendrAccountPk: PublicKey","bankMap: Map<string, Bank>","oraclePrices: Map<string, OraclePrice>","bankMetadataMap: BankMetadataMap","lendrAccountRaw: LendrAccountRaw","flag: AccountFlags","BN","lendrAccount: LendrAccountType","balance: BalanceType","healthCache: HealthCacheType","message: string","lndrErr: number | null","internalErr: number | null","props: {\n program: Program<LendrIdlType>;\n bankMap: Map<string, Bank>;\n oraclePrices: Map<string, OraclePrice>;\n lendrAccount: LendrAccount;\n balances: Balance[];\n bankMetadataMap: BankMetadataMap;\n}","props: {\n program: Program<LendrIdlType>;\n bankMap: Map<string, Bank>;\n oraclePrices: Map<string, OraclePrice>;\n lendrAccountPk: PublicKey;\n balances: Balance[];\n bankMetadataMap: BankMetadataMap;\n}","crankPythIxs: {\n postInstructions: InstructionWithEphemeralSigners[];\n closeInstructions: InstructionWithEphemeralSigners[];\n keys: never[];\n lut: AddressLookupTableAccount | null;\n }","txs: Array<VersionedTransaction>","program: LendrProgram","lendrAccountPk: PublicKey","banks: Map<string, BankType>","balances: BalanceType[]","mandatoryBanks: PublicKey[]","excludedBanks: PublicKey[]","bankMetadataMap: BankMetadataMap","instructions","props: {\n swbPullOracles: PublicKey[];\n provider: AnchorProvider;\n}","props: {\n lendrAccount: LendrAccountWrapper | null;\n lendrClient: LendrClient;\n}","dummyBalances: BalanceRaw[]","BN","rawAccount: LendrAccountRaw","balances: Balance[]","banks: BankMap","additionalBanks: Bank[]","oraclePrices: OraclePriceMap","maxAgeOffset: number","stalePythFeeds: { feedId: string; shardId: number }[]","staleSwbOracles: { oracleKey: PublicKey }[]","program: LendrProgram","lendrAccountAddress: PublicKey","instructions","BN","bank: PublicKey","args: BankConfigOptRaw","group: PublicKey","voteAccountAddress: PublicKey","feePayer: PublicKey","pythOracle: PublicKey","bankMint: PublicKey","bankConfig: BankConfigOpt","tokenProgram: PublicKey","overrideOpt: { admin?: PublicKey; globalFeeWallet?: PublicKey }","groupDto: LendrGroupTypeDto","group: LendrGroupType","z","connection: Connection","overrides: Record<string, TMetadata>","mints: Array<PublicKey>","cached: Record<string, TMetadata>","toFetch: Array<string>","fetched: Record<string, TMetadata>","mint: PublicKey","meta","mints: Array<string>","validatorStakeGroupDto: ValidatorStakeGroupDto","connection: Connection","publicKey: PublicKey","opts: {\n filterInactive: boolean;\n }","accounts","validatorVoteAccounts: PublicKey[]","poolMintAddressRecord: Record<string, PublicKey>","poolStakeAddressRecord: Record<string, PublicKey>","data: Buffer","poolAddressRecord: Record<string, PublicKey>","onRampAddressRecord: Record<string, PublicKey>","mev: StakePoolMevMap","address","validatorStakeGroup: ValidatorStakeGroup","data: unknown","overrideMetadata","name","symbol","metadataMap: BankExtendedMetadataMap","admin: PublicKey","address: PublicKey","address","accountData: LendrGroupRaw","rawData: Buffer","idl: LendrIdlType","encoded: Buffer","decoded: LendrGroupRaw","program: LendrProgram","lendrAccountAddress: PublicKey","bank: PublicKey","args: BankConfigOptRaw","voteAccountAddress: PublicKey","feePayer: PublicKey","pythOracle: PublicKey","bankPubkey: PublicKey","bankMint: PublicKey","bankConfig: BankConfigOpt","feePayer?: PublicKey","connection: Connection","addressLookupTableAddresses?: PublicKey[]","logger: TLogger","accounts","address","banksRawData: { address: PublicKey; data: BankRaw }[]","mintKeys: Array<PublicKey>","emissionMintKeys: Array<PublicKey>","oracleKeys: Array<PublicKey>","pythStakedCollateralBanks: PublicKey[]","stakedCollatMap: Record<\n string,\n {\n bankAddress: PublicKey;\n mint: PublicKey;\n stakePoolAddress: PublicKey;\n poolAddress: PublicKey;\n }\n >","solPools: string[]","mints: string[]","metadata","emissionTokenProgram: PublicKey | null","parsePriceInfo","stakePoolsAis: StakeAccount[]","lstMintsAis: RawMint[]","lstMintRecord: Record<string, RawMint>","solPoolsRecord: Record<string, StakeAccount>","price: BigNumber","stakeActual: number","tokenSupply: bigint","tokenSupply","stakeActual","adjustPriceComponent","priceComponent: any","bankAccountsData","banksRawData: Array<{ address: PublicKey; data: BankRaw }>","pubkeys: PublicKey[]","authority?: Address","type: AccountType","bankAddress: Address","mint: Address","tokenSymbol: string","lendrAccountPk: PublicKey","instructions","session: EstablishedSessionState","accountSeed: BN","createOpts?: { newAccountKey?: PublicKey | undefined }","processOpts?: ProcessTransactionsClientOpts","txOpts?: TransactionOptions","commitment?: Commitment","customAccountSeed?: number | bigint","BN","createOpts?: { accountKeypair?: Keypair }","instructions: TransactionInstruction[]","payerKey: PublicKey","signers?: Array<Signer>","extraMetaData?: ExtendedTransactionProperties","lendrGroup: PublicKey","seed?: Keypair","additionalIxs?: TransactionInstruction[]","bankMint: PublicKey","bankConfig: BankConfigOpt","transactions: SolanaTransaction[]","options: ProcessTransactionOpts","transaction: SolanaTransaction","transactions: (Transaction | VersionedTransaction)[]","accountsToInspect: PublicKey[]","versionedTransactions: VersionedTransaction[]","blockhash: string","error: any","a: any"],"sources":["../src/instructions.ts","../src/logger.ts","../src/constants/bank.ts","../src/constants/misc.ts","../src/constants/flags.ts","../src/constants/tokens.ts","../src/constants/defaults.ts","../src/constants/programs.ts","../src/services/bank/types/bank.types.ts","../src/common/nodeWallet.ts","../src/common/math.ts","../src/common/misc.ts","../src/common/modules/transactions/transaction.types.ts","../src/common/modules/transactions/transaction.utils.ts","../src/common/priority.ts","../src/common/utils/accounting.utils.ts","../src/common/utils/conversion.utils.ts","../src/common/utils/formatters.utils.ts","../src/models/emode-settings.ts","../src/types.ts","../src/services/bank/utils/deserialize.utils.ts","../src/vendor/pyth_legacy/readBig.ts","../src/vendor/pyth_legacy/index.ts","../src/vendor/pyth_push_oracle/index.ts","../src/vendor/rpc-get-stake/index.ts","../src/vendor/single-spl-pool/index.ts","../src/vendor/switchboard_legacy/account.ts","../src/vendor/switchboard_legacy/aggregatorAccount.ts","../src/vendor/switchboard_legacy/AggregatorResolutionMode.ts","../src/vendor/switchboard_legacy/switchboardDecimal.ts","../src/vendor/switchboard_legacy/aggregatorRound.ts","../src/vendor/switchboard_legacy/Hash.ts","../src/vendor/switchboard_legacy/aggregatorAccountData.ts","../src/vendor/switchboard_pull/idl.json","../src/vendor/switchboard_pull/index.ts","../src/vendor/index.ts","../src/utils.ts","../src/services/price/types/price.types.ts","../src/models/balance.ts","../src/vendor/pyth_crank/idl/pyth_push_oracle.ts","../src/vendor/pyth_crank/idl/pyth_wormhole.ts","../src/vendor/pyth_crank/idl/receiver_program.ts","../src/vendor/pyth_crank/pyth.consts.ts","../src/vendor/pyth_crank/pyth.utils.ts","../src/services/bank/bank.service.ts","../src/services/price/utils/compute.utils.ts","../src/services/price/utils/deserialize.utils.ts","../src/services/price/utils/fetch.utils.ts","../src/services/price/utils/serialize.utils.ts","../src/services/bank/utils/compute.utils.ts","../src/services/bank/utils/fetch.utils.ts","../src/services/bank/utils/serialize.utils.ts","../src/models/bank.ts","../src/models/account/pure.ts","../src/models/account/wrapper.ts","../src/models/health-cache.ts","../src/services/transaction/helpers/bundle-sending.ts","../src/services/transaction/helpers/bundle-simulation.ts","../src/idl/lendr_0.1.3.json","../src/idl/index.ts","../src/errors.ts","../src/services/transaction/transaction.service.ts","../src/services/transaction/helpers/rpc-sending.ts","../src/services/transaction/helpers/tx-formatting.ts","../src/services/account/utils/compute.utils.ts","../src/services/account/types/account.types.ts","../src/services/account/utils/deserialize.utils.ts","../src/services/account/utils/emode.utils.ts","../src/services/account/utils/fetch.utils.ts","../src/services/account/utils/serialize.utils.ts","../src/services/account/account.service.ts","../src/services/group/group.service.ts","../src/services/group/utils/deserialize.utils.ts","../src/services/group/utils/serialize.utils.ts","../src/services/metadata.ts","../src/services/native-stake/utils/deserialize.utils.ts","../src/services/native-stake/utils/fetch.utils.ts","../src/services/native-stake/utils/serialize.utils.ts","../src/common/bank-metadata.ts","../src/config.ts","../src/idl/idl.utils.ts","../src/models/group.ts","../src/clients/client.ts"],"sourcesContent":["import type {AccountMeta, PublicKey} from \"@solana/web3.js\";\nimport BN from \"bn.js\";\n\nimport type {BankConfigCompactRaw, BankConfigOptRaw} from \"./services\";\nimport {TOKEN_PROGRAM_ID} from \"@solana/spl-token\";\nimport type { LendingAccountDepositOrRepayWithSessionAccounts, LendingAccountWithdrawOrBorrowWithSessionAccounts, LendrProgram } from \"./types\";\nimport type { EstablishedSessionState } from \"./common/session\";\n\nasync function makeInitLendrAccountIx(\n ldProgram: LendrProgram,\n accounts: {\n lendrGroup: PublicKey;\n lendrAccount: PublicKey;\n authority: PublicKey;\n feePayer: PublicKey;\n },\n) {\n return ldProgram.methods.lendrAccountInitialize().accounts(accounts).instruction();\n}\n\nasync function makeInitLendrAccountWithSessionIx(\n ldProgram: LendrProgram,\n { lendrGroup, session, feePayer }: {\n lendrGroup: PublicKey;\n session: EstablishedSessionState;\n feePayer: PublicKey;\n },\n accountSeed: BN,\n) {\n return ldProgram.methods\n .lendrAccountInitializeWithSession(session.walletPublicKey, accountSeed)\n .accounts({ lendrGroup, sessionKey: session.sessionPublicKey, feePayer })\n .instruction();\n}\n\nasync function makeDepositIx(\n ldProgram: LendrProgram,\n accounts: {\n // Required accounts\n lendrAccount: PublicKey;\n signerTokenAccount: PublicKey;\n bank: PublicKey;\n tokenProgram: PublicKey;\n // Optional accounts - to override inference\n group?: PublicKey;\n authority?: PublicKey;\n liquidityVault?: PublicKey;\n },\n args: {\n amount: BN;\n depositUpToLimit?: boolean;\n },\n remainingAccounts: AccountMeta[] = [],\n) {\n const { lendrAccount, signerTokenAccount, bank, tokenProgram, ...optionalAccounts } = accounts;\n\n return ldProgram.methods\n .lendingAccountDeposit(args.amount, args.depositUpToLimit ?? null)\n .accounts({\n lendrAccount,\n signerTokenAccount,\n bank,\n tokenProgram,\n })\n .accountsPartial(optionalAccounts)\n .remainingAccounts(remainingAccounts)\n .instruction();\n}\n\nexport async function makeDepositWithSessionIx(\n ldProgram: LendrProgram,\n accounts: LendingAccountDepositOrRepayWithSessionAccounts,\n args: {\n amount: BN;\n depositUpToLimit?: boolean;\n },\n remainingAccounts: AccountMeta[] = []\n) {\n const { lendrAccount, signerTokenAccount, bank, tokenProgram, sessionKey, ...optionalAccounts } = accounts;\n\n return ldProgram.methods\n .lendingAccountDepositWithSession(args.amount, args.depositUpToLimit ?? null)\n .accounts({\n sessionKey,\n lendrAccount,\n signerTokenAccount,\n bank,\n tokenProgram,\n })\n .accountsPartial(optionalAccounts)\n .remainingAccounts(remainingAccounts)\n .instruction();\n}\n\nasync function makeRepayIx(\n ldProgram: LendrProgram,\n accounts: {\n // Required accounts\n lendrAccount: PublicKey;\n signerTokenAccount: PublicKey;\n bank: PublicKey;\n tokenProgram: PublicKey;\n // Optional accounts - to override inference\n group?: PublicKey;\n authority?: PublicKey;\n liquidityVault?: PublicKey;\n },\n args: {\n amount: BN;\n repayAll?: boolean;\n },\n remainingAccounts: AccountMeta[] = [],\n) {\n const { lendrAccount, signerTokenAccount, bank, tokenProgram, ...optionalAccounts } = accounts;\n\n return ldProgram.methods\n .lendingAccountRepay(args.amount, args.repayAll ?? null)\n .accounts({\n lendrAccount,\n signerTokenAccount,\n bank,\n tokenProgram,\n })\n .accountsPartial(optionalAccounts)\n .remainingAccounts(remainingAccounts)\n .instruction();\n}\n\n\nasync function makeRepayWithSessionIx(\n ldProgram: LendrProgram,\n accounts: LendingAccountDepositOrRepayWithSessionAccounts,\n args: {\n amount: BN;\n repayAll?: boolean;\n },\n remainingAccounts: AccountMeta[] = [],\n) {\n const { lendrAccount, signerTokenAccount, bank, tokenProgram, sessionKey, ...optionalAccounts } = accounts;\n\n return ldProgram.methods\n .lendingAccountRepayWithSession(args.amount, args.repayAll ?? null)\n .accounts({\n sessionKey,\n lendrAccount,\n signerTokenAccount,\n bank,\n tokenProgram,\n })\n .accountsPartial(optionalAccounts)\n .remainingAccounts(remainingAccounts)\n .instruction();\n}\n\nasync function makeWithdrawIx(\n ldProgram: LendrProgram,\n accounts: {\n // Required accounts\n lendrAccount: PublicKey;\n bank: PublicKey;\n destinationTokenAccount: PublicKey;\n tokenProgram: PublicKey;\n // Optional accounts - to override inference\n group?: PublicKey;\n authority?: PublicKey;\n },\n args: {\n amount: BN;\n withdrawAll?: boolean;\n },\n remainingAccounts: AccountMeta[] = [],\n) {\n const { lendrAccount, bank, destinationTokenAccount, tokenProgram, ...optionalAccounts } = accounts;\n\n return ldProgram.methods\n .lendingAccountWithdraw(args.amount, args.withdrawAll ?? null)\n .accounts({\n lendrAccount,\n destinationTokenAccount,\n bank,\n tokenProgram,\n })\n .accountsPartial(optionalAccounts)\n .remainingAccounts(remainingAccounts)\n .instruction();\n}\n\n\nasync function makeWithdrawWithSessionIx(\n ldProgram: LendrProgram,\n accounts: LendingAccountWithdrawOrBorrowWithSessionAccounts,\n args: {\n amount: BN;\n withdrawAll?: boolean;\n },\n remainingAccounts: AccountMeta[] = [],\n) {\n const { lendrAccount, bank, destinationTokenAccount, tokenProgram, sessionKey, ...optionalAccounts } = accounts;\n\n return ldProgram.methods\n .lendingAccountWithdrawWithSession(args.amount, args.withdrawAll ?? null)\n .accounts({\n sessionKey,\n lendrAccount,\n destinationTokenAccount,\n bank,\n tokenProgram,\n })\n .accountsPartial(optionalAccounts)\n .remainingAccounts(remainingAccounts)\n .instruction();\n}\n\nasync function makeBorrowIx(\n ldProgram: LendrProgram,\n accounts: {\n // Required accounts\n lendrAccount: PublicKey;\n bank: PublicKey;\n destinationTokenAccount: PublicKey;\n tokenProgram: PublicKey;\n // Optional accounts - to override inference\n group?: PublicKey;\n authority?: PublicKey;\n },\n args: {\n amount: BN;\n },\n remainingAccounts: AccountMeta[] = [],\n) {\n const { lendrAccount, bank, destinationTokenAccount, tokenProgram, ...optionalAccounts } = accounts;\n\n return ldProgram.methods\n .lendingAccountBorrow(args.amount)\n .accounts({\n lendrAccount,\n destinationTokenAccount,\n bank,\n tokenProgram,\n })\n .accountsPartial(optionalAccounts)\n .remainingAccounts(remainingAccounts)\n .instruction();\n}\n\n\nasync function makeBorrowWithSessionIx(\n ldProgram: LendrProgram,\n accounts: LendingAccountWithdrawOrBorrowWithSessionAccounts,\n args: {\n amount: BN;\n },\n remainingAccounts: AccountMeta[] = [],\n) {\n const { lendrAccount, bank, destinationTokenAccount, tokenProgram, sessionKey, ...optionalAccounts } = accounts;\n\n return ldProgram.methods\n .lendingAccountBorrowWithSession(args.amount)\n .accounts({\n sessionKey,\n lendrAccount,\n destinationTokenAccount,\n bank,\n tokenProgram,\n })\n .accountsPartial(optionalAccounts)\n .remainingAccounts(remainingAccounts)\n .instruction();\n}\n\nfunction makeLendingAccountLiquidateIx(\n ldrProgram: LendrProgram,\n accounts: {\n // Required accounts\n assetBank: PublicKey;\n liabBank: PublicKey;\n liquidatorLendrAccount: PublicKey;\n liquidateeLendrAccount: PublicKey;\n tokenProgram: PublicKey;\n // Optional accounts - to override inference\n group?: PublicKey;\n authority?: PublicKey;\n },\n args: {\n assetAmount: BN;\n },\n remainingAccounts: AccountMeta[] = [],\n) {\n const { assetBank, liabBank, liquidatorLendrAccount, liquidateeLendrAccount, tokenProgram, ...optionalAccounts } =\n accounts;\n\n return ldrProgram.methods\n .lendingAccountLiquidate(args.assetAmount)\n .accounts({\n assetBank,\n liabBank,\n liquidatorLendrAccount,\n liquidateeLendrAccount,\n tokenProgram,\n })\n .accountsPartial(optionalAccounts)\n .remainingAccounts(remainingAccounts)\n .instruction();\n}\n\nfunction makelendingAccountWithdrawEmissionIx(\n ldrProgram: LendrProgram,\n accounts: {\n // Required accounts\n lendrAccount: PublicKey;\n destinationAccount: PublicKey;\n bank: PublicKey;\n tokenProgram: PublicKey;\n // Optional accounts - to override inference\n group?: PublicKey;\n authority?: PublicKey;\n emissionsMint?: PublicKey;\n },\n) {\n const { lendrAccount, destinationAccount, bank, tokenProgram, ...optionalAccounts } = accounts;\n\n return ldrProgram.methods\n .lendingAccountWithdrawEmissions()\n .accounts({\n lendrAccount,\n destinationAccount,\n bank,\n tokenProgram,\n })\n .accountsPartial(optionalAccounts)\n .instruction();\n}\n\nfunction makeSetAccountFlagIx(\n ldrProgram: LendrProgram,\n accounts: {\n // Required accounts\n lendrAccount: PublicKey;\n // Optional accounts - to override inference\n group?: PublicKey;\n admin?: PublicKey;\n },\n args: {\n flag: BN;\n },\n) {\n const { lendrAccount, ...optionalAccounts } = accounts;\n\n return ldrProgram.methods\n .setAccountFlag(args.flag)\n .accounts({\n lendrAccount,\n })\n .accountsPartial(optionalAccounts)\n .instruction();\n}\n\nfunction makeUnsetAccountFlagIx(\n ldrProgram: LendrProgram,\n accounts: {\n // Required accounts\n lendrAccount: PublicKey;\n // Optional accounts - to override inference\n group?: PublicKey;\n admin?: PublicKey;\n },\n args: {\n flag: BN;\n },\n) {\n const { lendrAccount, ...optionalAccounts } = accounts;\n\n return ldrProgram.methods\n .unsetAccountFlag(args.flag)\n .accounts({\n lendrAccount,\n })\n .accountsPartial(optionalAccounts)\n .instruction();\n}\n\nfunction makePoolConfigureBankIx(\n ldrProgram: LendrProgram,\n accounts: {\n // Required accounts\n bank: PublicKey;\n // Optional accounts - to override inference\n group?: PublicKey;\n admin?: PublicKey;\n },\n args: {\n bankConfigOpt: BankConfigOptRaw;\n },\n) {\n const { bank, ...optionalAccounts } = accounts;\n\n return ldrProgram.methods\n .lendingPoolConfigureBank(args.bankConfigOpt)\n .accounts({\n bank,\n })\n .accountsPartial(optionalAccounts)\n .instruction();\n}\n\nfunction makeBeginFlashLoanIx(\n ldrProgram: LendrProgram,\n accounts: {\n // Required accounts\n lendrAccount: PublicKey;\n // Optional accounts - to override inference\n authority?: PublicKey;\n ixsSysvar?: PublicKey;\n },\n args: {\n endIndex: BN;\n },\n) {\n const { lendrAccount, ...optionalAccounts } = accounts;\n\n return ldrProgram.methods\n .lendingAccountStartFlashloan(args.endIndex)\n .accounts({\n lendrAccount,\n })\n .accountsPartial(optionalAccounts)\n .instruction();\n}\n\nfunction makeEndFlashLoanIx(\n ldrProgram: LendrProgram,\n accounts: {\n // Required accounts\n lendrAccount: PublicKey;\n // Optional accounts - to override inference\n authority?: PublicKey;\n },\n remainingAccounts: AccountMeta[] = [],\n) {\n const { lendrAccount, ...optionalAccounts } = accounts;\n\n return ldrProgram.methods\n .lendingAccountEndFlashloan()\n .accounts({\n lendrAccount,\n })\n .accountsPartial(optionalAccounts)\n .remainingAccounts(remainingAccounts)\n .instruction();\n}\n\nasync function makeAccountAuthorityTransferIx(\n ldProgram: LendrProgram,\n accounts: {\n // Required accounts\n lendrAccount: PublicKey;\n newAuthority: PublicKey;\n feePayer: PublicKey;\n // Optional accounts - to override inference\n group?: PublicKey;\n authority?: PublicKey;\n },\n) {\n const { lendrAccount, newAuthority, feePayer, ...optionalAccounts } = accounts;\n\n return ldProgram.methods\n .setNewAccountAuthority()\n .accounts({\n lendrAccount,\n newAuthority,\n feePayer,\n })\n .accountsPartial(optionalAccounts)\n .instruction();\n}\n\nasync function makeGroupInitIx(\n ldProgram: LendrProgram,\n accounts: {\n lendrGroup: PublicKey;\n admin: PublicKey;\n },\n args?: {\n isArenaGroup?: boolean;\n },\n) {\n return ldProgram.methods\n .lendrGroupInitialize(args?.isArenaGroup ?? false)\n .accounts({\n lendrGroup: accounts.lendrGroup,\n admin: accounts.admin,\n })\n .instruction();\n}\n\n/**\n * Configure the oracle for a bank\n * @param ldProgram The lendr program\n * @param accounts The accounts required for this instruction\n * @param args The oracle setup index and feed id\n * @param remainingAccounts The remaining accounts required for this instruction, should include the feed oracle key\n */\nasync function makeLendingPoolConfigureBankOracleIx(\n ldProgram: LendrProgram,\n accounts: {\n // Required accounts\n bank: PublicKey;\n // Optional accounts - to override inference\n group?: PublicKey;\n admin?: PublicKey;\n },\n args: {\n /**\n * The oracle setup index, see {@link serializeOracleSetupToIndex}\n */\n setup: number;\n /**\n * The oracle feed id\n */\n feedId: PublicKey;\n },\n /**\n * The remaining accounts required for this instruction, should include the feed oracle key (non writable & signable)\n */\n remainingAccounts: AccountMeta[] = [],\n) {\n const { bank, ...optionalAccounts } = accounts;\n\n return ldProgram.methods\n .lendingPoolConfigureBankOracle(args.setup, args.feedId)\n .accounts({\n bank,\n })\n .accountsPartial(optionalAccounts)\n .remainingAccounts(remainingAccounts)\n .instruction();\n}\n\n/**\n * Creates an instruction to add a permissionless staked bank to a lending pool.\n * @param ldProgram - The lendr program instance\n * @param accounts - The accounts required for this instruction\n * @param remainingAccounts - The remaining accounts required for this instruction, including pythOracle, solPool and bankMint\n * @param args - Optional arguments for this instruction\n */\nasync function makePoolAddPermissionlessStakedBankIx(\n ldProgram: LendrProgram,\n accounts: {\n // Required accounts\n stakedSettings: PublicKey;\n feePayer: PublicKey;\n bankMint: PublicKey;\n solPool: PublicKey;\n stakePool: PublicKey;\n // Optional accounts - to override inference\n lendrGroup?: PublicKey;\n /**\n * The token program to use for this instruction, defaults to the SPL token program\n */\n tokenProgram?: PublicKey;\n },\n /**\n * The remaining accounts required for this instruction. Should include:\n * - pythOracle: The pyth oracle key (non writable & non signer)\n * - solPool: The sol pool key (non writable & non signer)\n * - bankMint: The bank mint key (non writable & non signer)\n */\n remainingAccounts: AccountMeta[] = [],\n args: {\n /**\n * The seed to use for the bank account. Defaults to 0 (new BN(0)).\n * If the seed is not specified, the seed is set to 0, and the bank account\n * will be created at the address {@link findPoolAddress} with the default\n * bump.\n */\n seed?: BN;\n },\n) {\n const {\n stakedSettings,\n feePayer,\n bankMint,\n solPool,\n stakePool,\n tokenProgram = TOKEN_PROGRAM_ID,\n ...optionalAccounts\n } = accounts;\n\n return ldProgram.methods\n .lendingPoolAddBankPermissionless(args.seed ?? new BN(0))\n .accounts({\n stakedSettings,\n feePayer,\n bankMint,\n solPool,\n stakePool,\n tokenProgram,\n })\n .accountsPartial(optionalAccounts)\n .remainingAccounts(remainingAccounts)\n .instruction();\n}\n\nasync function makePoolAddBankIx(\n ldProgram: LendrProgram,\n accounts: {\n // Required accounts\n lendrGroup: PublicKey;\n feePayer: PublicKey;\n bankMint: PublicKey;\n bank: PublicKey;\n tokenProgram: PublicKey;\n // Optional accounts - to override inference\n admin?: PublicKey;\n globalFeeWallet?: PublicKey;\n },\n args: {\n bankConfig: BankConfigCompactRaw;\n },\n) {\n const { lendrGroup, feePayer, bankMint, bank, tokenProgram, ...optionalAccounts } = accounts;\n\n return ldProgram.methods\n .lendingPoolAddBank({\n ...args.bankConfig,\n pad0: [0, 0, 0, 0, 0, 0, 0, 0],\n })\n .accounts({\n lendrGroup,\n feePayer,\n bankMint,\n bank,\n tokenProgram,\n })\n .accountsPartial(optionalAccounts)\n .instruction();\n}\n\nasync function makeCloseAccountIx(\n ldProgram: LendrProgram,\n accounts: {\n // Required accounts\n lendrAccount: PublicKey;\n feePayer: PublicKey;\n // Optional accounts - to override inference\n authority?: PublicKey;\n },\n) {\n const { lendrAccount, feePayer, ...optionalAccounts } = accounts;\n return ldProgram.methods\n .lendrAccountClose()\n .accounts({\n lendrAccount,\n feePayer,\n })\n .accountsPartial(optionalAccounts)\n .instruction();\n}\n\nasync function makeLendingAccountSortBalancesIx(\n ldProgram: LendrProgram,\n accounts: {\n lendrAccount: PublicKey;\n },\n) {\n return ldProgram.methods\n .lendingAccountSortBalances()\n .accounts({\n lendrAccount: accounts.lendrAccount,\n })\n .instruction();\n}\n\nasync function makePulseHealthIx(\n ldProgram: LendrProgram,\n accounts: {\n lendrAccount: PublicKey;\n },\n /**\n * The remaining accounts required for this instruction. Should include:\n * - For each balance the user has, pass bank and oracle: <bank1, oracle1, bank2, oracle2>\n */\n remainingAccounts: AccountMeta[] = [],\n) {\n return ldProgram.methods\n .lendingAccountPulseHealth()\n .accounts({\n lendrAccount: accounts.lendrAccount,\n })\n .remainingAccounts(remainingAccounts)\n .instruction();\n}\n\nconst instructions = {\n makeDepositIx,\n makeDepositWithSessionIx,\n makeRepayIx,\n makeRepayWithSessionIx,\n makeWithdrawIx,\n makeWithdrawWithSessionIx,\n makeBorrowIx,\n makeBorrowWithSessionIx,\n makeInitLendrAccountIx,\n makeInitLendrAccountWithSessionIx,\n makeLendingAccountLiquidateIx,\n makelendingAccountWithdrawEmissionIx,\n makeSetAccountFlagIx,\n makeUnsetAccountFlagIx,\n makePoolAddBankIx,\n makePoolConfigureBankIx,\n makeBeginFlashLoanIx,\n makeEndFlashLoanIx,\n makeAccountAuthorityTransferIx,\n makeGroupInitIx,\n makeCloseAccountIx,\n makePoolAddPermissionlessStakedBankIx,\n makeLendingPoolConfigureBankOracleIx,\n makePulseHealthIx,\n makeLendingAccountSortBalancesIx,\n};\n\nexport default instructions;\n","import type { TLogger } from \"@/types\";\n\nexport class NoopLogger implements TLogger {\n info() {}\n error() {}\n warn() {}\n debug() {}\n}\n","export const PDA_BANK_LIQUIDITY_VAULT_AUTH_SEED = Buffer.from(\n\t\"liquidity_vault_auth\",\n);\nexport const PDA_BANK_INSURANCE_VAULT_AUTH_SEED = Buffer.from(\n\t\"insurance_vault_auth\",\n);\nexport const PDA_BANK_FEE_VAULT_AUTH_SEED = Buffer.from(\"fee_vault_auth\");\n\nexport const PDA_BANK_LIQUIDITY_VAULT_SEED = Buffer.from(\"liquidity_vault\");\nexport const PDA_BANK_INSURANCE_VAULT_SEED = Buffer.from(\"insurance_vault\");\nexport const PDA_BANK_FEE_VAULT_SEED = Buffer.from(\"fee_vault\");\n","import { PublicKey } from \"@solana/web3.js\";\nimport BigNumber from \"bignumber.js\";\n\nexport const HOURS_PER_YEAR = 365.25 * 24;\nexport const MAX_U64 = BigInt(\"18446744073709551615\").toString();\n\nexport const PYTH_PRICE_CONF_INTERVALS = new BigNumber(2.12);\nexport const SWB_PRICE_CONF_INTERVALS = new BigNumber(1.96);\nexport const MAX_CONFIDENCE_INTERVAL_RATIO = new BigNumber(0.05);\nexport const PYTH_PUSH_ORACLE_ID = new PublicKey(\"pythWSnswVUd12oZpeFP8e9CVaEqJg25g1Vtc2biRsT\");\n\nexport const GROUP_PK = new PublicKey(process.env.LENDR_GROUP_PK ?? \"4vDRNkXaeAcwJULZCQFFdNBM295sD8hSKQt3RaMwsRFc\");\n\n// TODO)) change default program address to IDL\nexport const PROGRAM_ID = new PublicKey(process.env.LENDR_PROGRAM_ID ?? \"89ZQeCPwkzSPJyTpktCKWNY6hBWMKuYt47R85Jo36yyh\");\nexport const DEFAULT_CLUSTER = process.env.LENDR_CLUSTER_OVERRIDE ?? \"mainnet\";\n","export const DISABLED_FLAG: number = 1 << 0;\nexport const FLASHLOAN_ENABLED_FLAG: number = 1 << 2;\nexport const TRANSFER_ACCOUNT_AUTHORITY_FLAG: number = 1 << 3;\n","import { PublicKey } from \"@solana/web3.js\";\nimport type { BankExtendedMetadata } from \"@/common/bank-metadata\";\n\n//TODO_Change\nexport const WSOL_MINT = new PublicKey(\"So11111111111111111111111111111111111111112\");\n\nexport const WSOL_EXTENDED_METADATA: BankExtendedMetadata = {\n symbol: \"wSOL\",\n name: \"Wrapped SOL\",\n address: \"D7zkaUgFUDkhQHExySRxokL3Fa1GFnnuiVDTs9yMrFHY\",\n logoURI:\n \"https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/So11111111111111111111111111111111111111112/logo.png\",\n additionalMetadata: [],\n uri: \"\",\n mint: WSOL_MINT.toBase58(),\n};\n\nexport const LST_MINT = new PublicKey(\"LSTxxxnJzKDFSLr4dUkPcmCf5VyryEqzPLz5j4bpxFp\");\n\nexport const USDC_MINT = new PublicKey(\"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v\");\nexport const DUMMY_USDC_MINT = new PublicKey(\"JAiSLhTCvAhGM4SojCYGoTPuqjw7KaCsopvRuNryzbML\");\nexport const USDC_DECIMALS = 6;\n","import type { Commitment, ConfirmOptions, SendOptions } from \"@solana/web3.js\";\n\nexport const DEFAULT_COMMITMENT: Commitment = \"processed\";\n\nexport const DEFAULT_SEND_OPTS: SendOptions = {\n\tskipPreflight: false,\n\tpreflightCommitment: DEFAULT_COMMITMENT,\n};\n\nexport const DEFAULT_CONFIRM_OPTS: ConfirmOptions = {\n\tcommitment: DEFAULT_COMMITMENT,\n\t...DEFAULT_SEND_OPTS,\n};\n\nexport const MAX_TX_SIZE = 1232;\nexport const MAX_ACCOUNT_KEYS = 64;\nexport const BUNDLE_TX_SIZE = 81;\nexport const PRIORITY_TX_SIZE = 44;\n\nexport const SKIP_SIMULATION = false;\n\nexport const DEFAULT_ORACLE_MAX_AGE = 60; // seconds\n","import { PublicKey } from \"@solana/web3.js\";\n\nexport const LUT_PROGRAM_AUTHORITY_INDEX = 5;\nexport const JUPITER_V6_PROGRAM = new PublicKey(\"JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4\");\nexport const LENDR_PROGRAM = new PublicKey(\"89ZQeCPwkzSPJyTpktCKWNY6hBWMKuYt47R85Jo36yyh\");\nexport const SINGLE_POOL_PROGRAM_ID = new PublicKey(\"SVSPxpvHdN29nkVg9rPapPNDddN5DipNLRUFhyjFThE\");\nexport const STAKE_PROGRAM_ID = new PublicKey(\"Stake11111111111111111111111111111111111111\");\nexport const MPL_METADATA_PROGRAM_ID = new PublicKey(\"metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s\");\nexport const SYSTEM_PROGRAM_ID = new PublicKey(\"11111111111111111111111111111111\");\nexport const SYSVAR_RENT_ID = new PublicKey(\"SysvarRent111111111111111111111111111111111\");\nexport const SYSVAR_CLOCK_ID = new PublicKey(\"SysvarC1ock11111111111111111111111111111111\");\nexport const SYSVAR_STAKE_HISTORY_ID = new PublicKey(\"SysvarStakeHistory1111111111111111111111111\");\nexport const STAKE_CONFIG_ID = new PublicKey(\"StakeConfig11111111111111111111111111111111\");\n","import type { PublicKey } from \"@solana/web3.js\";\nimport type BigNumber from \"bignumber.js\";\n\nexport enum RiskTier {\n Collateral = \"Collateral\",\n Isolated = \"Isolated\",\n}\n\nexport enum OperationalState {\n Paused = \"Paused\",\n Operational = \"Operational\",\n ReduceOnly = \"ReduceOnly\",\n}\n\nexport interface InterestRateConfig {\n // Curve Params\n optimalUtilizationRate: BigNumber;\n plateauInterestRate: BigNumber;\n maxInterestRate: BigNumber;\n\n // Fees\n insuranceFeeFixedApr: BigNumber;\n insuranceIrFee: BigNumber;\n protocolFixedFeeApr: BigNumber;\n protocolIrFee: BigNumber;\n protocolOriginationFee: BigNumber;\n}\n\nexport enum OracleSetup {\n None = \"None\",\n PythLegacy = \"PythLegacy\",\n SwitchboardV2 = \"SwitchboardV2\",\n PythPushOracle = \"PythPushOracle\",\n SwitchboardPull = \"SwitchboardPull\",\n StakedWithPythPush = \"StakedWithPythPush\",\n}\nexport enum AssetTag {\n DEFAULT = 0,\n SOL = 1,\n STAKED = 2,\n}\n\n// BankConfigOpt Args\nexport interface BankConfigOpt {\n assetWeightInit: BigNumber | null;\n assetWeightMaint: BigNumber | null;\n\n liabilityWeightInit: BigNumber | null;\n liabilityWeightMaint: BigNumber | null;\n\n depositLimit: BigNumber | null;\n borrowLimit: BigNumber | null;\n riskTier: RiskTier | null;\n totalAssetValueInitLimit: BigNumber | null;\n assetTag: AssetTag | null;\n\n interestRateConfig: InterestRateConfig | null;\n operationalState: OperationalState | null;\n\n oracleMaxAge: number | null;\n permissionlessBadDebtSettlement: boolean | null;\n}\n\nexport interface BankConfigType {\n assetWeightInit: BigNumber;\n assetWeightMaint: BigNumber;\n\n liabilityWeightInit: BigNumber;\n liabilityWeightMaint: BigNumber;\n\n depositLimit: BigNumber;\n borrowLimit: BigNumber;\n\n riskTier: RiskTier;\n totalAssetValueInitLimit: BigNumber;\n assetTag: AssetTag;\n\n interestRateConfig: InterestRateConfig;\n operationalState: OperationalState;\n\n oracleSetup: OracleSetup;\n oracleKeys: PublicKey[];\n oracleMaxAge: number;\n}\n\nexport interface BankType {\n address: PublicKey;\n tokenSymbol?: string;\n group: PublicKey;\n mint: PublicKey;\n mintDecimals: number;\n\n assetShareValue: BigNumber;\n liabilityShareValue: BigNumber;\n\n liquidityVault: PublicKey;\n liquidityVaultBump: number;\n liquidityVaultAuthorityBump: number;\n\n insuranceVault: PublicKey;\n insuranceVaultBump: number;\n insuranceVaultAuthorityBump: number;\n collectedInsuranceFeesOutstanding: BigNumber;\n\n feeVault: PublicKey;\n feeVaultBump: number;\n feeVaultAuthorityBump: number;\n collectedGroupFeesOutstanding: BigNumber;\n\n lastUpdate: number;\n\n config: BankConfigType;\n\n totalAssetShares: BigNumber;\n totalLiabilityShares: BigNumber;\n\n emissionsActiveBorrowing: boolean;\n emissionsActiveLending: boolean;\n emissionsRate: number;\n emissionsMint: PublicKey;\n emissionsRemaining: BigNumber;\n\n oracleKey: PublicKey;\n pythShardId?: number;\n emode: EmodeSettingsType;\n}\n\n/**\n * Bitwise flags for EMode entry\n */\nexport enum EmodeEntryFlags {\n /**\n * If set, isolated banks with this tag also benefit.\n * If not set, isolated banks continue to offer zero collateral, even if they use this tag.\n * (NOT YET IMPLEMENTED)\n */\n APPLIES_TO_ISOLATED = 1 << 0, // 1\n /** Reserved for future use */\n RESERVED_1 = 1 << 1, // 2\n RESERVED_2 = 1 << 2, // 4\n RESERVED_3 = 1 << 3, // 8\n RESERVED_4 = 1 << 4, // 16\n RESERVED_5 = 1 << 5, // 32\n}\n\nexport interface EmodeEntry {\n collateralBankEmodeTag: EmodeTag;\n flags: EmodeEntryFlags[];\n assetWeightInit: BigNumber;\n assetWeightMaint: BigNumber;\n}\n\n/**\n * Bitwise flags for EMode settings\n */\nexport enum EmodeFlags {\n /** If set, at least one entry is configured */\n EMODE_ON = 1 << 0, // 1\n /** Reserved for future use */\n RESERVED_1 = 1 << 1, // 2\n RESERVED_2 = 1 << 2, // 4\n RESERVED_3 = 1 << 3, // 8\n}\n\nexport enum EmodeTag {\n UNSET = 0,\n SOL = 501,\n LST_T1 = 1571,\n LST_T2 = 1572,\n}\n\nexport interface EmodeSettingsType {\n emodeTag: EmodeTag;\n timestamp: number;\n flags: EmodeFlags[];\n emodeEntries: EmodeEntry[];\n}\n\nexport interface OracleConfigOpt {\n setup: OracleSetup;\n keys: PublicKey[];\n}\n\nexport type EmodePair = {\n collateralBanks: PublicKey[];\n collateralBankTag: EmodeTag;\n liabilityBank: PublicKey;\n liabilityBankTag: EmodeTag;\n assetWeightMaint: BigNumber;\n assetWeightInit: BigNumber;\n};\n\nexport enum EmodeImpactStatus {\n ActivateEmode,\n ExtendEmode,\n IncreaseEmode,\n ReduceEmode,\n RemoveEmode,\n InactiveEmode,\n}\n\nexport interface EmodeImpact {\n status: EmodeImpactStatus;\n resultingPairs: EmodePair[];\n activePair?: EmodePair;\n}\n\nexport interface ActionEmodeImpact {\n borrowImpact?: EmodeImpact;\n supplyImpact?: EmodeImpact;\n repayAllImpact?: EmodeImpact;\n withdrawAllImpact?: EmodeImpact;\n}\n","import type { Keypair, PublicKey, Transaction, VersionedTransaction } from \"@solana/web3.js\";\nimport type { Wallet } from \"./types\";\n\n/**\n * NodeWallet\n *\n * Anchor-compliant wallet implementation.\n */\nexport class NodeWallet implements Wallet {\n /**\n * @param payer Keypair of the associated payer\n */\n constructor(readonly payer: Keypair) {}\n\n async signTransaction<T extends Transaction | VersionedTransaction>(tx: T): Promise<T> {\n if (\"version\" in tx) {\n tx.sign([this.payer]);\n } else {\n tx.partialSign(this.payer);\n }\n return tx;\n }\n\n async signAllTransactions<T extends Transaction | VersionedTransaction>(txs: T[]): Promise<T[]> {\n return txs.map((tx) => {\n if (\"version\" in tx) {\n tx.sign([this.payer]);\n return tx;\n } else {\n tx.partialSign(this.payer);\n return tx;\n }\n });\n }\n\n get publicKey(): PublicKey {\n return this.payer.publicKey;\n }\n}\n","function floor(value: number, decimals: number): number {\n return Math.floor(value * 10 ** decimals) / 10 ** decimals;\n}\n\nfunction ceil(value: number, decimals: number): number {\n return Math.ceil(value * 10 ** decimals) / 10 ** decimals;\n}\n\nfunction median(values: number[]): number {\n if (values.length === 0) {\n throw new Error(\"Input array is empty\");\n }\n\n // Sorting values, preventing original array\n // from being mutated.\n values = [...values].sort((a, b) => a - b);\n\n const half = Math.floor(values.length / 2);\n\n return values.length % 2 ? values[half] : (values[half - 1] + values[half]) / 2;\n}\n\nexport { ceil, floor, median };\n","import { type AccountInfo, type Connection, PublicKey } from \"@solana/web3.js\";\n\nexport function getValueInsensitive<T>(map: Record<string, T>, key: string): T {\n const lowerCaseLabel = key.toLowerCase();\n for (const key in map) {\n if (key.toLowerCase() === lowerCaseLabel) {\n return map[key];\n }\n }\n throw new Error(`Token metadata not found for ${key}`);\n}\n\n/**\n * @internal\n */\nexport function sleep(ms: number) {\n return new Promise((resolve) => setTimeout(resolve, ms));\n}\n\nexport function chunks<T>(array: T[], size: number): T[][] {\n return Array.apply(0, new Array(Math.ceil(array.length / size))).map((_, index) =>\n array.slice(index * size, (index + 1) * size),\n );\n}\n\nexport function setTimeoutPromise(duration: number, message: string): Promise<Error> {\n return new Promise((_, reject) => setTimeout(() => reject(new Error(message)), duration));\n}\n\ninterface Result {\n jsonrpc: string;\n result: {\n context: { slot: number };\n value: Array<AccountInfo<string[]> | null>;\n };\n}\n\nexport async function chunkedGetRawMultipleAccountInfos(\n connection: Connection,\n pks: string[],\n batchChunkSize: number = 1000,\n maxAccountsChunkSize: number = 100,\n): Promise<[number, Map<string, AccountInfo<Buffer>>]> {\n const accountInfoMap = new Map<string, AccountInfo<Buffer>>();\n let contextSlot = 0;\n\n const batches = chunkArray(pks, batchChunkSize);\n\n for (let i = 0; i < batches.length; i++) {\n const batch = batches[i];\n\n const batchRequest = chunkArray(batch, maxAccountsChunkSize).map((pubkeys) => ({\n methodName: \"getMultipleAccounts\",\n args: connection._buildArgs([pubkeys], \"confirmed\", \"base64\"),\n }));\n\n let accountInfos: Array<AccountInfo<string[]> | null> = [];\n let retries = 0;\n const maxRetries = 3;\n\n while (retries < maxRetries && accountInfos.length === 0) {\n try {\n accountInfos = await connection\n // @ts-ignore\n ._rpcBatchRequest(batchRequest)\n .then((batchResults: Result[]) => {\n contextSlot = Math.max(...batchResults.map((res) => res.result.context.slot));\n\n const accounts = batchResults.reduce(\n (acc, res) => {\n acc.push(...res.result.value);\n return acc;\n },\n [] as Result[\"result\"][\"value\"],\n );\n\n return accounts;\n });\n } catch (error) {\n retries++;\n }\n }\n\n if (accountInfos.length === 0) {\n throw new Error(`Failed to fetch account infos after ${maxRetries} retries`);\n }\n\n accountInfos.forEach((item, index) => {\n const publicKey = batch[index];\n if (item) {\n accountInfoMap.set(publicKey, {\n ...item,\n owner: new PublicKey(item.owner),\n data: Buffer.from(item.data[0], \"base64\"),\n });\n }\n });\n }\n\n return [contextSlot, accountInfoMap];\n}\n\nexport async function chunkedGetRawMultipleAccountInfoOrderedWithNulls(\n connection: Connection,\n pks: string[],\n batchChunkSize: number = 1000,\n maxAccountsChunkSize: number = 100,\n): Promise<Array<AccountInfo<Buffer> | null>> {\n const allAccountInfos: Array<AccountInfo<Buffer> | null> = [];\n\n const batches = chunkArray(pks, batchChunkSize);\n\n for (let i = 0; i < batches.length; i++) {\n const batch = batches[i];\n\n const batchRequest = chunkArray(batch, maxAccountsChunkSize).map((pubkeys) => ({\n methodName: \"getMultipleAccounts\",\n args: connection._buildArgs([pubkeys], \"confirmed\", \"base64\"),\n }));\n\n let accountInfos: Array<AccountInfo<string[]> | null> = [];\n let retries = 0;\n const maxRetries = 3;\n\n while (retries < maxRetries && accountInfos.length === 0) {\n try {\n accountInfos = await connection\n // @ts-ignore\n ._rpcBatchRequest(batchRequest)\n .then((batchResults: Result[]) => {\n const accounts = batchResults.reduce(\n (acc, res) => {\n acc.push(...res.result.value);\n return acc;\n },\n [] as Result[\"result\"][\"value\"],\n );\n\n return accounts;\n });\n } catch (error) {\n retries++;\n }\n }\n\n if (accountInfos.length === 0) {\n throw new Error(`Failed to fetch account infos after ${maxRetries} retries`);\n }\n\n accountInfos.forEach((item) => {\n if (item) {\n allAccountInfos.push({\n ...item,\n owner: new PublicKey(item.owner),\n data: Buffer.from(item.data[0], \"base64\"),\n });\n } else {\n allAccountInfos.push(null);\n }\n });\n }\n\n return allAccountInfos;\n}\n\nexport async function chunkedGetRawMultipleAccountInfoOrdered(\n connection: Connection,\n pks: string[],\n batchChunkSize: number = 1000,\n maxAccountsChunkSize: number = 100,\n): Promise<Array<AccountInfo<Buffer>>> {\n const allAccountInfos: Array<AccountInfo<Buffer>> = [];\n\n const batches = chunkArray(pks, batchChunkSize);\n\n for (let i = 0; i < batches.length; i++) {\n const batch = batches[i];\n\n const batchRequest = chunkArray(batch, maxAccountsChunkSize).map((pubkeys) => ({\n methodName: \"getMultipleAccounts\",\n args: connection._buildArgs([pubkeys], \"confirmed\", \"base64\"),\n }));\n\n let accountInfos: Array<AccountInfo<string[]> | null> = [];\n let retries = 0;\n const maxRetries = 3;\n\n while (retries < maxRetries && accountInfos.length === 0) {\n try {\n accountInfos = await connection\n // @ts-ignore\n ._rpcBatchRequest(batchRequest)\n .then((batchResults: Result[]) => {\n const accounts = batchResults.reduce(\n (acc, res) => {\n acc.push(...res.result.value);\n return acc;\n },\n [] as Result[\"result\"][\"value\"],\n );\n\n return accounts;\n });\n } catch (error) {\n retries++;\n }\n }\n\n if (accountInfos.length === 0) {\n throw new Error(`Failed to fetch account infos after ${maxRetries} retries`);\n }\n\n accountInfos.forEach((item) => {\n if (item) {\n allAccountInfos.push({\n ...item,\n owner: new PublicKey(item.owner),\n data: Buffer.from(item.data[0], \"base64\"),\n });\n }\n });\n }\n\n return allAccountInfos;\n}\n\nfunction chunkArray<T>(array: T[], chunkSize: number): T[][] {\n const chunks: T[][] = [];\n for (let i = 0; i < array.length; i += chunkSize) {\n chunks.push(array.slice(i, i + chunkSize));\n }\n return chunks;\n}\n","import {\n type AddressLookupTableAccount,\n PublicKey,\n type Signer,\n type Transaction,\n type VersionedTransaction,\n} from \"@solana/web3.js\";\n\nexport enum TransactionType {\n // BASE LENDING ACTIONS\n DEPOSIT = \"DEPOSIT\",\n WITHDRAW = \"WITHDRAW\",\n REPAY = \"REPAY\",\n BORROW = \"BORROW\",\n\n // FLASHLOANS\n FLASHLOAN = \"FLASHLOAN\",\n LOOP = \"LOOP\",\n REPAY_COLLAT = \"REPAY_COLLAT\",\n LONG = \"LONG\",\n SHORT = \"SHORT\",\n\n // SETUP\n CREATE_ACCOUNT = \"CREATE_ACCOUNT\",\n CREATE_ATA = \"CREATE_ATA\",\n\n // ACCOUNT MANAGEMENT\n CLOSE_ACCOUNT = \"CLOSE_ACCOUNT\",\n CLOSE_POSITION = \"CLOSE_POSITION\",\n MOVE_POSITION_WITHDRAW = \"MOVE_POSITION_WITHDRAW\",\n MOVE_POSITION_DEPOSIT = \"MOVE_POSITION_DEPOSIT\",\n WITHDRAW_ALL = \"WITHDRAW_ALL\",\n TRANSFER_AUTH = \"TRANSFER_AUTH\",\n\n // SWB\n CRANK = \"CRANK\",\n\n // NATIVE STAKE ACTIONS\n DEPOSIT_STAKE = \"DEPOSIT_STAKE\",\n WITHDRAW_STAKE = \"WITHDRAW_STAKE\",\n INITIALIZE_STAKED_POOL = \"INITIALIZE_STAKED_POOL\",\n ADD_STAKED_BANK = \"ADD_STAKED_BANK\",\n\n MERGE_STAKE_ACCOUNTS = \"MERGE_STAKE_ACCOUNTS\",\n\n // LST\n STAKE_TO_STAKE = \"STAKE_TO_STAKE\",\n MINT_LST_NATIVE = \"MINT_LST_NATIVE\",\n SWAP_TO_SOL = \"SWAP_TO_SOL\",\n SOL_TO_LST = \"SOL_TO_LST\",\n UNSTAKE_LST = \"UNSTAKE_LST\",\n\n // EMISSIONS\n WITHDRAW_EMISSIONS = \"WITHDRAW_EMISSIONS\",\n\n // LIQUIDATE\n LIQUIDATE_ACCOUNT = \"LIQUIDATE_ACCOUNT\",\n\n // BANK and GROUPS\n CREATE_PERM_BANK = \"CREATE_PERM_BANK\",\n CREATE_GROUP = \"CREATE_GROUP\",\n JUPITER_SWAP = \"JUPITER_SWAP\",\n}\ninterface TransactionConfig {\n label: (infoProps?: Record<string, any>) => string; // Always a function\n fallback?: string; // Only for dynamic messages\n}\n\nexport const TransactionConfigMap: Record<TransactionType, TransactionConfig> = {\n // BASE LENDING ACTIONS\n [TransactionType.DEPOSIT]: {\n label: ({ amount, token } = {}) => (amount && token ? `Deposit ${amount} ${token}` : \"Deposit\"),\n },\n [TransactionType.WITHDRAW]: {\n label: ({ amount, token } = {}) => (amount && token ? `Withdraw ${amount} ${token}` : \"Withdraw\"),\n },\n [TransactionType.REPAY]: {\n label: ({ amount, token } = {}) => (amount && token ? `Repay ${amount} ${token}` : \"Repay\"),\n },\n [TransactionType.BORROW]: {\n label: ({ amount, token } = {}) => (amount && token ? `Borrow ${amount} ${token}` : \"Borrow\"),\n },\n\n // FLASHLOANS\n [TransactionType.FLASHLOAN]: { label: () => \"Executing Flashloan\" },\n [TransactionType.LOOP]: {\n label: ({ depositAmount, depositToken, borrowAmount, borrowToken } = {}) =>\n depositAmount && depositToken && borrowAmount && borrowToken\n ? `Loop ${depositAmount} ${depositToken} with ${borrowAmount} ${borrowToken}`\n : \"Loop\",\n },\n [TransactionType.REPAY_COLLAT]: {\n label: ({ repayAmount, repayToken, amount, token } = {}) =>\n repayAmount && repayToken && amount && token\n ? `Repay ${repayAmount} ${token} with ${amount} ${repayToken}`\n : \"Repay with collateral\",\n },\n [TransactionType.LONG]: {\n label: ({ depositToken, depositAmount, borrowToken } = {}) =>\n depositToken && depositAmount && borrowToken\n ? `Long ${depositToken} with ${depositAmount} ${borrowToken}`\n : \"Open long position\",\n },\n [TransactionType.SHORT]: {\n label: ({ borrowToken, depositAmount, depositToken } = {}) =>\n borrowToken && depositAmount && depositToken\n ? `Short ${borrowToken} with ${depositAmount} ${depositToken}`\n : \"Open short position\",\n },\n\n // SWB\n [TransactionType.CRANK]: { label: () => \"Updating latest prices\" },\n [TransactionType.JUPITER_SWAP]: {\n label: ({ originAmount, originToken, destinationAmount, destinationToken } = {}) =>\n originAmount && originToken && destinationAmount && destinationToken\n ? `Swap ${originAmount} ${originToken} for ${destinationAmount} ${destinationToken}`\n : \"Swap tokens\",\n },\n\n // SETUP\n [TransactionType.CREATE_ACCOUNT]: { label: () => \"Create lendr account\" },\n [TransactionType.CREATE_ATA]: { label: () => \"Configure token account\" },\n\n // ACCOUNT MANAGEMENT\n [TransactionType.CLOSE_ACCOUNT]: { label: () => \"Close lendr account\" },\n [TransactionType.CLOSE_POSITION]: { label: () => \"Close position\" },\n [TransactionType.MOVE_POSITION_WITHDRAW]: {\n label: ({ originAccountAddress } = {}) => `Move position from ${originAccountAddress}`,\n },\n [TransactionType.MOVE_POSITION_DEPOSIT]: {\n label: ({ destinationAccountAddress } = {}) => `Move position to ${destinationAccountAddress}`,\n },\n [TransactionType.TRANSFER_AUTH]: { label: () => \"Authorize account transfer\" },\n\n // NATIVE STAKE ACTIONS\n [TransactionType.DEPOSIT_STAKE]: {\n label: ({ amount, token } = {}) =>\n amount && token ? `Authorize stake account and deposit ${amount} ${token}` : \"Authorize stake and deposit\",\n },\n [TransactionType.WITHDRAW_STAKE]: {\n label: ({ amount, token } = {}) => \"Authorize stake account\",\n },\n [TransactionType.INITIALIZE_STAKED_POOL]: { label: () => \"Initialize stake pool\" },\n [TransactionType.ADD_STAKED_BANK]: { label: () => \"Create staked asset bank\" },\n [TransactionType.MERGE_STAKE_ACCOUNTS]: { label: () => \"Merge stake accounts\" },\n\n // LST (Liquid Staking Tokens)\n [TransactionType.STAKE_TO_STAKE]: { label: () => \"Convert stake\" },\n [TransactionType.MINT_LST_NATIVE]: { label: () => \"Mint LST\" },\n [TransactionType.SWAP_TO_SOL]: {\n label: ({ swapAmount, token } = {}) => (swapAmount && token ? `Swap ${swapAmount} ${token} to SOL` : \"Swap to SOL\"),\n },\n [TransactionType.SOL_TO_LST]: {\n label: ({ amount } = {}) => (amount ? `Mint LST with ${amount} SOL` : \"Mint LST with SOL\"),\n },\n [TransactionType.UNSTAKE_LST]: { label: ({ amount } = {}) => (amount ? `Unstake ${amount} LST` : \"Unstake LST\") },\n // EMISSIONS\n [TransactionType.WITHDRAW_EMISSIONS]: { label: () => \"Withdraw emissions\" },\n\n // LIQUIDATE\n [TransactionType.LIQUIDATE_ACCOUNT]: { label: () => \"Liquidate account\" },\n\n // BANK and GROUPS\n [TransactionType.CREATE_PERM_BANK]: { label: () => \"Create permissionless bank\" },\n [TransactionType.CREATE_GROUP]: { label: () => \"Create lendr group\" },\n [TransactionType.WITHDRAW_ALL]: {\n label: ({ amount, token } = {}) => (amount && token ? `Withdraw ${amount} ${token}` : \"Withdraw all\"),\n },\n};\n\nexport const TransactionArenaKeyMap: Partial<Record<TransactionType, PublicKey>> = {\n [TransactionType.DEPOSIT]: new PublicKey(\"ArenaDeposit1111111111111111111111111111111\"),\n [TransactionType.WITHDRAW]: new PublicKey(\"ArenaWithdraw111111111111111111111111111111\"),\n [TransactionType.BORROW]: new PublicKey(\"ArenaBorrow11111111111111111111111111111111\"),\n [TransactionType.REPAY]: new PublicKey(\"ArenaRepay111111111111111111111111111111111\"),\n [TransactionType.REPAY_COLLAT]: new PublicKey(\"ArenaRepayCo11at111111111111111111111111111\"),\n [TransactionType.LONG]: new PublicKey(\"ArenaLong1111111111111111111111111111111111\"),\n [TransactionType.SHORT]: new PublicKey(\"ArenaShort111111111111111111111111111111111\"),\n [TransactionType.CLOSE_POSITION]: new PublicKey(\"ArenaC1ose111111111111111111111111111111111\"),\n // Add more mappings if needed\n};\n\nexport type ExtendedTransactionProperties = {\n type: TransactionType;\n signers?: Array<Signer>;\n addressLookupTables?: AddressLookupTableAccount[];\n unitsConsumed?: number;\n};\n\nexport type ExtendedTransaction = Transaction & ExtendedTransactionProperties;\n\nexport type ExtendedV0Transaction = VersionedTransaction & ExtendedTransactionProperties;\n\nexport type SolanaTransaction = ExtendedTransaction | ExtendedV0Transaction;\n","import { BorshInstructionCoder, type Idl, type Instruction } from \"@coral-xyz/anchor\";\nimport {\n type AddressLookupTableAccount,\n ComputeBudgetProgram,\n LAMPORTS_PER_SOL,\n type PublicKey,\n type Transaction,\n type TransactionInstruction,\n TransactionMessage,\n VersionedTransaction,\n} from \"@solana/web3.js\";\nimport type { ExtendedTransactionProperties, SolanaTransaction } from \"./transaction.types\";\nimport {MAX_TX_SIZE} from \"@/constants\";\n\n/**\n * Determines if a given transaction is a VersionedTransaction.\n * This function checks for the presence of a 'message' property to identify\n * if the transaction is of type VersionedTransaction.\n *\n * @param tx - The transaction object, which can be either a VersionedTransaction or a Transaction.\n * @returns A boolean indicating whether the transaction is a VersionedTransaction.\n */\nexport function isV0Tx(tx: Transaction | VersionedTransaction): tx is VersionedTransaction {\n return \"message\" in tx;\n}\n\n/**\n * Calculates the size of a Solana transaction in bytes.\n * This function considers the number of required signatures and other transaction components.\n *\n * @param tx - The transaction object, which can be either a VersionedTransaction or a Transaction.\n * @returns The size of the transaction in bytes.\n */\nexport function getTxSize(tx: VersionedTransaction | Transaction): number {\n const isVersioned = isV0Tx(tx);\n const numSigners = tx.signatures.length;\n const numRequiredSignatures = isVersioned ? tx.message.header.numRequiredSignatures : 0;\n const feePayerSize = isVersioned || tx.feePayer ? 0 : 32;\n const signaturesSize = (numRequiredSignatures - numSigners) * 64 + 1;\n\n try {\n const baseTxSize = isVersioned\n ? tx.serialize().length\n : tx.serialize({ requireAllSignatures: false, verifySignatures: false }).length;\n return baseTxSize + feePayerSize + signaturesSize;\n } catch (error) {\n // tx is overflowing\n return 9999;\n }\n}\n\nexport function getAccountKeys(\n tx: VersionedTransaction | Transaction,\n lookupTableAccounts: AddressLookupTableAccount[],\n): number {\n const isVersioned = isV0Tx(tx);\n\n try {\n if (isVersioned) {\n const message = TransactionMessage.decompile(tx.message, { addressLookupTableAccounts: lookupTableAccounts });\n return message.compileToLegacyMessage().getAccountKeys().length;\n } else {\n return tx.compileMessage().getAccountKeys().length;\n }\n } catch (error) {\n return 9999;\n }\n}\n\n/**\n * Decodes a Solana transaction instruction using the provided Interface Definition Language (IDL).\n * This function utilizes the BorshInstructionCoder to interpret the encoded instruction data.\n *\n * @param idl - The Interface Definition Language object that defines the structure of the instruction.\n * @param encoded - The Buffer containing the encoded instruction data.\n * @returns The decoded instruction object.\n */\nexport function decodeInstruction(idl: Idl, encoded: Buffer): Instruction | null {\n const coder = new BorshInstructionCoder(idl);\n return coder.decode(encoded, \"base58\");\n}\n\n/**\n * Decompiles a VersionedTransaction into a TransactionMessage.\n *\n * @param tx - The VersionedTransaction to be decompiled.\n * @param lookupTableAccounts - An array of AddressLookupTableAccount used for decompiling the transaction message.\n * @returns A TransactionMessage object representing the decompiled transaction.\n */\nexport function decompileV0Transaction(tx: VersionedTransaction, lookupTableAccounts: AddressLookupTableAccount[]) {\n return TransactionMessage.decompile(tx.message, { addressLookupTableAccounts: lookupTableAccounts });\n}\n\n/**\n * Options for updating a transaction.\n * - `feePayer`: Optional public key of the fee payer. Defaults to the transaction's fee payer.\n * - `blockhash`: Optional blockhash for the transaction. Defaults to the transaction's recent blockhash.\n * - `addressLookupTables`: Optional array of address lookup table accounts for the transaction.\n * - `additionalIxs`: Optional array of additional transaction instructions to include.\n */\ntype UpdateTxOptions = {\n feePayer?: PublicKey;\n blockhash?: string;\n addressLookupTables?: AddressLookupTableAccount[];\n additionalIxs?: TransactionInstruction[];\n replaceOnly?: boolean;\n};\n\n/**\n * Converts a legacy Solana transaction to a versioned transaction. *\n * @param transaction - The legacy transaction to be converted.\n * @param opts - Optional parameters for the conversion process.\n * @returns A VersionedTransaction object representing the converted transaction.\n * @throws Will throw an error if the fee payer or blockhash is not provided.\n */\nexport function legacyTxToV0Tx(transaction: Transaction, opts?: UpdateTxOptions): VersionedTransaction {\n const feePayer = opts?.feePayer ?? transaction.feePayer;\n const blockhash = opts?.blockhash ?? transaction.recentBlockhash;\n const additionalIxs = opts?.additionalIxs ?? [];\n const addressLookupTables = opts?.addressLookupTables ?? [];\n\n if (!feePayer || !blockhash) {\n throw new Error(\"Fee payer and blockhash are required\");\n }\n\n const ixs = transaction.instructions;\n const versionedMessage = new TransactionMessage({\n instructions: [...additionalIxs, ...ixs],\n payerKey: feePayer,\n recentBlockhash: blockhash,\n });\n return new VersionedTransaction(versionedMessage.compileToV0Message(addressLookupTables));\n}\n\n/**\n * Updates a VersionedTransaction with new options.\n *\n * This function allows you to modify a given VersionedTransaction by providing\n * additional transaction instructions, address lookup tables, a new fee payer,\n * and a new blockhash. It decompiles the existing transaction, applies the updates,\n * and recompiles it into a new VersionedTransaction.\n *\n * @param transaction - The VersionedTransaction to be updated.\n * @param opts - Optional parameters for updating the transaction.\n * @returns A new VersionedTransaction object with the applied updates.\n * @throws Will throw an error if the fee payer or blockhash is not provided.\n */\nexport function updateV0Tx(transaction: VersionedTransaction, opts?: UpdateTxOptions): VersionedTransaction {\n const additionalIxs = opts?.additionalIxs ?? [];\n const addressLookupTables = opts?.addressLookupTables ?? [];\n let instructions: TransactionInstruction[] = [];\n\n const message = decompileV0Transaction(transaction, addressLookupTables);\n const feePayer = opts?.feePayer ?? message.payerKey;\n const blockhash = opts?.blockhash ?? message.recentBlockhash;\n\n if (additionalIxs.length > 0) {\n instructions = replaceV0TxInstructions(additionalIxs, message.instructions, opts?.replaceOnly);\n } else {\n instructions = message.instructions;\n }\n\n const versionedMessage = new TransactionMessage({\n instructions,\n payerKey: feePayer,\n recentBlockhash: blockhash,\n });\n return new VersionedTransaction(versionedMessage.compileToV0Message(addressLookupTables));\n}\n\n/**\n * Checks if two transaction instructions are identical by comparing their data, program IDs, and account keys.\n *\n * @param ix1 - First transaction instruction to compare\n * @param ix2 - Second transaction instruction to compare\n * @returns True if instructions are identical, false otherwise\n */\nexport function compareInstructions(ix1: TransactionInstruction, ix2: TransactionInstruction): boolean {\n const dataCompare = ix1.data.equals(ix2.data);\n const programIdCompare = ix1.programId.equals(ix2.programId);\n const keysCompare =\n ix1.keys.length === ix2.keys.length &&\n ix1.keys.every((key, index) => {\n const key2 = ix2.keys[index];\n return key.pubkey.equals(key2.pubkey) && key.isSigner === key2.isSigner && key.isWritable === key2.isWritable;\n });\n\n // Instructions are identical only if all components match\n return dataCompare && programIdCompare && keysCompare;\n}\n\nexport function replaceV0TxInstructions(\n additionalInstructions: TransactionInstruction[],\n instructions: TransactionInstruction[],\n replaceOnly?: boolean,\n): TransactionInstruction[] {\n let updatedAdditionalIxs: TransactionInstruction[] = additionalInstructions;\n\n const updatedInstructions = instructions.map((ix) => {\n const programId = ix.programId;\n const additionalIxs = additionalInstructions.filter((a) => a.programId.equals(programId));\n\n if (additionalIxs.length > 0) {\n // TODO add bundle tip check\n if (ix.programId.equals(ComputeBudgetProgram.programId)) {\n const decoded = decodeComputeBudgetInstruction(ix);\n const updatedCuPriceIx = additionalIxs.find(\n (a) => decodeComputeBudgetInstruction(a).instructionType === \"SetComputeUnitPrice\",\n );\n\n const updatedCuLimitIx = additionalIxs.find(\n (a) => decodeComputeBudgetInstruction(a).instructionType === \"SetComputeUnitLimit\",\n );\n // replace priority fee instruction\n if (decoded.instructionType === \"SetComputeUnitPrice\" && updatedCuPriceIx) {\n //subtract the additional instruction from the additional instructions array\n updatedAdditionalIxs = updatedAdditionalIxs.filter((a) => !compareInstructions(a, updatedCuPriceIx));\n return updatedCuPriceIx;\n }\n\n // replace compute budget instruction\n if (decoded.instructionType === \"SetComputeUnitLimit\" && updatedCuLimitIx) {\n //subtract the additional instruction from the additional instructions array\n updatedAdditionalIxs = updatedAdditionalIxs.filter((a) => !compareInstructions(a, updatedCuLimitIx));\n return updatedCuLimitIx;\n }\n }\n }\n return ix;\n });\n\n return [...(replaceOnly ? [] : updatedAdditionalIxs), ...updatedInstructions];\n}\n\nexport function replaceV0TxBlockhash(transaction: VersionedTransaction, blockhash: string): VersionedTransaction {\n const message = transaction.message;\n message.recentBlockhash = blockhash;\n return new VersionedTransaction(message);\n}\n\n/**\n * Enhances a given transaction with additional metadata.\n *\n * @param transaction - The transaction to be enhanced, can be either VersionedTransaction or Transaction.\n * @param options - An object containing optional metadata:\n * - signers: An array of Signer objects that are associated with the transaction.\n * - addressLookupTables: An array of AddressLookupTableAccount objects for address resolution.\n * - unitsConsumed: A number representing the compute units consumed by the transaction.\n * - type: The type of the transaction, as defined by TransactionType.\n * @returns A SolanaTransaction object that includes the original transaction and the additional metadata.\n */\nexport function addTransactionMetadata<T extends Transaction | VersionedTransaction>(\n transaction: T,\n options: ExtendedTransactionProperties,\n): T & ExtendedTransactionProperties {\n return Object.assign(transaction, options);\n}\n\ntype ComputeBudgetInstructionType =\n | \"RequestUnits\"\n | \"RequestHeapFrame\"\n | \"SetComputeUnitLimit\"\n | \"SetComputeUnitPrice\"\n | \"SetLoadedAccountsDataSizeLimit\";\n\nfunction identifyComputeBudgetInstruction(data: Buffer): ComputeBudgetInstructionType {\n const discriminator = data.readUInt8(0); // First byte identifies the instruction type\n\n switch (discriminator) {\n case 0:\n return \"RequestUnits\";\n case 1:\n return \"RequestHeapFrame\";\n case 2:\n return \"SetComputeUnitLimit\";\n case 3:\n return \"SetComputeUnitPrice\";\n case 4:\n return \"SetLoadedAccountsDataSizeLimit\";\n default:\n throw new Error(\"Unknown ComputeBudget instruction discriminator.\");\n }\n}\n\n/**\n * Decodes a ComputeBudget program instruction into a readable format.\n *\n * @param instruction - The ComputeBudget program instruction to decode\n * @returns An object containing the decoded instruction data with fields depending on the instruction type:\n * - RequestUnits: { instructionType: string, units: number, additionalFee: number }\n * - RequestHeapFrame: { instructionType: string, bytes: number }\n * - SetComputeUnitLimit: { instructionType: string, units: number }\n * - SetComputeUnitPrice: { instructionType: string, microLamports: string }\n * - SetLoadedAccountsDataSizeLimit: { instructionType: string, accountDataSizeLimit: number }\n * @throws Error if the instruction data is invalid or the instruction type is unknown\n */\nexport function decodeComputeBudgetInstruction(instruction: TransactionInstruction) {\n const data = Buffer.from(instruction.data || instruction);\n const instructionType = identifyComputeBudgetInstruction(data);\n switch (instructionType) {\n case \"RequestUnits\": {\n if (data.length !== 9) {\n throw new Error(\"Invalid data length for RequestUnits\");\n }\n const units = data.readUInt32LE(1);\n const additionalFee = data.readUInt32LE(5);\n return { instructionType, units, additionalFee };\n }\n case \"RequestHeapFrame\": {\n if (data.length !== 5) {\n throw new Error(\"Invalid data length for RequestHeapFrame\");\n }\n const bytes = data.readUInt32LE(1);\n return { instructionType, bytes };\n }\n case \"SetComputeUnitLimit\": {\n if (data.length !== 5) {\n throw new Error(\"Invalid data length for SetComputeUnitLimit\");\n }\n const units = data.readUInt32LE(1);\n return { instructionType, units };\n }\n case \"SetComputeUnitPrice\": {\n if (data.length !== 9) {\n throw new Error(\"Invalid data length for SetComputeUnitPrice\");\n }\n const microLamports = data.readBigUInt64LE(1);\n return { instructionType, microLamports: microLamports.toString() };\n }\n case \"SetLoadedAccountsDataSizeLimit\": {\n if (data.length !== 5) {\n throw new Error(\"Invalid data length for SetLoadedAccountsDataSizeLimit\");\n }\n const accountDataSizeLimit = data.readUInt32LE(1);\n return { instructionType, accountDataSizeLimit };\n }\n default:\n throw new Error(\"Unknown ComputeBudget instruction type.\");\n }\n}\n\nconst DEFAULT_COMPUTE_BUDGET_IX = 200_000;\n\nexport function getComputeBudgetUnits(tx: SolanaTransaction): number | undefined {\n let instructions: TransactionInstruction[] = [];\n\n if (isV0Tx(tx)) {\n const addressLookupTableAccounts = tx.addressLookupTables ?? [];\n const message = decompileV0Transaction(tx, addressLookupTableAccounts);\n instructions = message.instructions;\n } else {\n instructions = tx.instructions;\n }\n\n const computeBudgetIxs = instructions.filter((ix) => ix.programId.equals(ComputeBudgetProgram.programId));\n\n if (computeBudgetIxs.length === 0) {\n return Math.min(instructions.length * DEFAULT_COMPUTE_BUDGET_IX, 1_400_000);\n }\n\n const decoded = computeBudgetIxs.map((ix) => decodeComputeBudgetInstruction(ix));\n const limit = decoded.find((ix) => ix.instructionType === \"SetComputeUnitLimit\");\n\n return limit?.units ?? instructions.length * DEFAULT_COMPUTE_BUDGET_IX;\n}\n\n/**\n * Converts a priority fee from UI units (SOL) to micro-lamports per compute unit\n * @param ui - Priority fee amount in SOL\n * @param limitCU - Compute unit limit, defaults to 1.4M CU\n * @returns Priority fee in micro-lamports per compute unit\n */\nexport const uiToMicroLamports = (ui: number, limitCU: number = 1_400_000) => {\n const priorityFeeMicroLamports = ui * LAMPORTS_PER_SOL * 1_000_000;\n return priorityFeeMicroLamports / limitCU;\n};\n\n/**\n * Converts a priority fee from micro-lamports per compute unit to UI units (SOL)\n * @param microLamports - Priority fee in micro-lamports per compute unit\n * @param limitCU - Compute unit limit, defaults to 1.4M CU\n * @returns Priority fee amount in SOL, truncated to 9 decimal places\n */\nexport const microLamportsToUi = (microLamports: number, limitCU: number = 1_400_000) => {\n const priorityFeeMicroLamports = microLamports * limitCU;\n const priorityFeeUi = priorityFeeMicroLamports / (LAMPORTS_PER_SOL * 1_000_000);\n return Math.trunc(priorityFeeUi * LAMPORTS_PER_SOL) / LAMPORTS_PER_SOL;\n};\n\n/**\n * Splits your instructions into as many VersionedTransactions as needed\n * so that none exceed MAX_TX_SIZE.\n */\nexport function splitInstructionsToFitTransactions(\n mandatoryIxs: TransactionInstruction[],\n ixs: TransactionInstruction[],\n opts: {\n blockhash: string;\n payerKey: PublicKey;\n luts: AddressLookupTableAccount[];\n },\n): VersionedTransaction[] {\n const result: VersionedTransaction[] = [];\n let buffer: TransactionInstruction[] = [];\n\n function buildTx(\n mandatoryIxs: TransactionInstruction[],\n extraIxs: TransactionInstruction[],\n opts: {\n blockhash: string;\n payerKey: PublicKey;\n luts: AddressLookupTableAccount[];\n },\n ): VersionedTransaction {\n const messageV0 = new TransactionMessage({\n payerKey: opts.payerKey,\n recentBlockhash: opts.blockhash,\n instructions: [...mandatoryIxs, ...extraIxs],\n }).compileToV0Message(opts.luts);\n\n return new VersionedTransaction(messageV0);\n }\n\n for (const ix of ixs) {\n // Try adding this ix to the current buffer\n const trial = buildTx(mandatoryIxs, [...buffer, ix], opts);\n if (getTxSize(trial) <= MAX_TX_SIZE) {\n buffer.push(ix);\n } else {\n // If buffer is empty, this single ix won't fit even alone\n if (buffer.length === 0) {\n throw new Error(\"Single instruction too large to fit in a transaction\");\n }\n // Flush current buffer as its own tx\n const tx = buildTx(mandatoryIxs, buffer, opts);\n result.push(tx);\n\n // Start new buffer with this ix\n buffer = [ix];\n\n // And check if that alone fits\n const solo = buildTx(mandatoryIxs, buffer, opts);\n if (getTxSize(solo) > MAX_TX_SIZE) {\n throw new Error(\"Single instruction too large to fit in a transaction\");\n }\n }\n }\n\n // Flush any remaining\n if (buffer.length > 0) {\n const tx = buildTx(mandatoryIxs, buffer, opts);\n result.push(tx);\n }\n\n return result;\n}\n","import type { Connection, GetRecentPrioritizationFeesConfig, RecentPrioritizationFees } from \"@solana/web3.js\";\n\nexport type TransactionBroadcastType = \"BUNDLE\" | \"RPC\" | \"DYNAMIC\";\n\nexport type TransactionPriorityType = \"NORMAL\" | \"HIGH\" | \"MAMAS\";\n\nexport type MaxCapType = \"DYNAMIC\" | \"MANUAL\";\n\nexport type TransactionSettings = {\n broadcastType: TransactionBroadcastType;\n priorityType: TransactionPriorityType;\n maxCapType: MaxCapType;\n maxCap: number;\n};\n\n// easy to use values for user convenience\nexport enum PriotitizationFeeLevels {\n LOW = 2500,\n MEDIAN = 5000,\n HIGH = 7500,\n MAX = 10000,\n}\n\n// extending the original interface to include the percentile and fallback options and maintain compatibility\ninterface GetRecentPrioritizationFeesByPercentileConfig extends GetRecentPrioritizationFeesConfig {\n percentile?: PriotitizationFeeLevels | number;\n fallback?: boolean;\n}\n\ninterface RpcResponse {\n jsonrpc: string;\n id?: string;\n result?: [];\n error?: any;\n}\n\ntype PriorityFeeCapByPercentileResponse = {\n min: RecentPrioritizationFees;\n max: RecentPrioritizationFees;\n mean: number;\n median: number;\n};\n\nexport const getCalculatedPrioritizationFeeByPercentile = async (\n connection: Connection,\n config: GetRecentPrioritizationFeesByPercentileConfig,\n slotsToReturn?: number,\n): Promise<PriorityFeeCapByPercentileResponse> => {\n const fees = await getRecentPrioritizationFeesByPercentile(connection, config, slotsToReturn);\n\n // Calculate min, max, mean\n const { min, max, sum } = fees.reduce(\n (acc, fee) => ({\n min: fee.prioritizationFee < acc.min.prioritizationFee ? fee : acc.min,\n max: fee.prioritizationFee > acc.max.prioritizationFee ? fee : acc.max,\n sum: acc.sum + fee.prioritizationFee,\n }),\n { min: fees[0], max: fees[0], sum: 0 },\n );\n\n const mean = Math.ceil(sum / fees.length);\n\n // Calculate median\n const sortedFees = [...fees].sort((a, b) => a.prioritizationFee - b.prioritizationFee);\n const midIndex = Math.floor(fees.length / 2);\n\n const median =\n fees.length % 2 === 0\n ? Math.ceil((sortedFees[midIndex - 1].prioritizationFee + sortedFees[midIndex].prioritizationFee) / 2)\n : sortedFees[midIndex].prioritizationFee;\n\n return {\n min,\n max,\n mean,\n median,\n };\n};\n\nexport const getMinPrioritizationFeeByPercentile = async (\n connection: Connection,\n config: GetRecentPrioritizationFeesByPercentileConfig,\n slotsToReturn?: number,\n): Promise<number> => {\n const recentPrioritizationFees = await getRecentPrioritizationFeesByPercentile(connection, config, slotsToReturn);\n\n const minPriorityFee = recentPrioritizationFees.reduce((min, current) => {\n return current.prioritizationFee < min.prioritizationFee ? current : min;\n });\n\n return minPriorityFee.prioritizationFee;\n};\n\nexport const getMaxPrioritizationFeeByPercentile = async (\n connection: Connection,\n config: GetRecentPrioritizationFeesByPercentileConfig,\n slotsToReturn?: number,\n): Promise<number> => {\n const recentPrioritizationFees = await getRecentPrioritizationFeesByPercentile(connection, config, slotsToReturn);\n\n const maxPriorityFee = recentPrioritizationFees.reduce((max, current) => {\n return current.prioritizationFee > max.prioritizationFee ? current : max;\n });\n\n return maxPriorityFee.prioritizationFee;\n};\n\nexport const getMeanPrioritizationFeeByPercentile = async (\n connection: Connection,\n config: GetRecentPrioritizationFeesByPercentileConfig,\n slotsToReturn?: number,\n): Promise<number> => {\n const recentPrioritizationFees = await getRecentPrioritizationFeesByPercentile(connection, config, slotsToReturn);\n\n const mean = Math.ceil(\n recentPrioritizationFees.reduce((acc, fee) => acc + fee.prioritizationFee, 0) / recentPrioritizationFees.length,\n );\n\n return mean;\n};\n\nexport const getMedianPrioritizationFeeByPercentile = async (\n connection: Connection,\n config: GetRecentPrioritizationFeesByPercentileConfig,\n slotsToReturn?: number,\n): Promise<number> => {\n const recentPrioritizationFees = await getRecentPrioritizationFeesByPercentile(connection, config, slotsToReturn);\n\n recentPrioritizationFees.sort((a, b) => a.prioritizationFee - b.prioritizationFee);\n\n const half = Math.floor(recentPrioritizationFees.length / 2);\n\n if (recentPrioritizationFees.length % 2) {\n return recentPrioritizationFees[half].prioritizationFee;\n }\n\n return Math.ceil(\n (recentPrioritizationFees[half - 1].prioritizationFee + recentPrioritizationFees[half].prioritizationFee) / 2,\n );\n};\n\n// this function gets the recent prioritization fees from the RPC. The `rpcRequest` comes from webjs.Connection\nconst getRecentPrioritizationFeesFromRpc = async (config: any, rpcRequest: any) => {\n const accounts = config?.lockedWritableAccounts?.map((key: { toBase58: () => any }) => key.toBase58());\n const args = accounts?.length ? [accounts] : [[]];\n config.percentile && args.push({ percentile: config.percentile });\n\n const response = await rpcRequest(\"getRecentPrioritizationFees\", args);\n\n return response;\n};\n\nexport const getRecentPrioritizationFeesByPercentile = async (\n connection: Connection,\n config: GetRecentPrioritizationFeesByPercentileConfig,\n slotsToReturn?: number,\n): Promise<RecentPrioritizationFees[]> => {\n const { fallback = true, lockedWritableAccounts = [] } = config || {};\n slotsToReturn = slotsToReturn && Number.isInteger(slotsToReturn) ? slotsToReturn : -1;\n\n const promises: Array<Promise<void>> = [];\n\n let tritonRpcResponse: RpcResponse | undefined;\n let fallbackRpcResponse: RpcResponse | undefined;\n\n // @solana/web3.js uses the private method `_rpcRequest` internally to make RPC requests which is not exposed by TypeScript\n // it is available in JavaScript, however, TypeScript enforces it as unavailable and complains, the following line is a workaround\n\n /* @ts-ignore */\n const rpcRequest = connection._rpcRequest;\n\n // to save fallback roundtrips if your RPC is not Triton, both RPCs are called in parallel to minimize latency\n promises.push(\n getRecentPrioritizationFeesFromRpc(config, rpcRequest).then((result) => {\n tritonRpcResponse = result;\n }),\n );\n\n if (fallback) {\n promises.push(\n getRecentPrioritizationFeesFromRpc({ lockedWritableAccounts }, rpcRequest).then((result) => {\n fallbackRpcResponse = result;\n }),\n );\n }\n\n await Promise.all(promises);\n\n // satisfying typescript by casting the response to RpcResponse\n const tritonGRPFResponse = tritonRpcResponse as unknown as RpcResponse;\n const fallbackGRPFResponse = fallbackRpcResponse as unknown as RpcResponse;\n\n let recentPrioritizationFees: RecentPrioritizationFees[] = [];\n\n if (tritonGRPFResponse?.result) {\n recentPrioritizationFees = tritonGRPFResponse.result!;\n }\n\n if (fallbackGRPFResponse?.result && !tritonGRPFResponse?.result) {\n recentPrioritizationFees = fallbackGRPFResponse.result!;\n }\n\n if (fallback && fallbackGRPFResponse.error) {\n return fallbackGRPFResponse.error;\n }\n\n if (tritonGRPFResponse?.error) {\n return tritonGRPFResponse.error;\n }\n\n // sort the prioritization fees by slot\n recentPrioritizationFees.sort((a, b) => a.slot - b.slot);\n\n // return the first n prioritization fees\n if (slotsToReturn > 0) return recentPrioritizationFees.slice(0, slotsToReturn);\n\n return recentPrioritizationFees;\n};\n","import {HOURS_PER_YEAR} from \"@/constants\";\n\n// ================ interest rate helpers ================\n\n/**\n * Formula source: http://www.linked8.com/blog/158-apy-to-apr-and-apr-to-apy-calculation-methodologies\n *\n * @param apy {Number} APY (i.e. 0.06 for 6%)\n * @param compoundingFrequency {Number} Compounding frequency (times a year)\n * @returns {Number} APR (i.e. 0.0582 for APY of 0.06)\n */\nconst apyToApr = (apy: number, compoundingFrequency: number = HOURS_PER_YEAR): number =>\n ((1 + apy) ** (1 / compoundingFrequency) - 1) * compoundingFrequency;\n\n/**\n * Formula source: http://www.linked8.com/blog/158-apy-to-apr-and-apr-to-apy-calculation-methodologies\n *\n *\n * @param apr {Number} APR (i.e. 0.0582 for 5.82%)\n * @param compoundingFrequency {Number} Compounding frequency (times a year)\n * @returns {Number} APY (i.e. 0.06 for APR of 0.0582)\n */\nconst aprToApy = (apr: number, compoundingFrequency: number = HOURS_PER_YEAR, apyCap: number = 3): number =>\n Math.min((1 + apr / compoundingFrequency) ** compoundingFrequency - 1, apyCap);\n\nfunction calculateInterestFromApy(principal: number, durationInYears: number, apy: number): number {\n return principal * apy * durationInYears;\n}\n\nfunction calculateApyFromInterest(principal: number, durationInYears: number, interest: number): number {\n return interest / (principal * durationInYears);\n}\n\nexport { apyToApr, aprToApy, calculateInterestFromApy, calculateApyFromInterest };\n","import { type Address, BN } from \"@coral-xyz/anchor\";\nimport type { PublicKey } from \"@solana/web3.js\";\nimport BigNumber from \"bignumber.js\";\nimport { Decimal } from \"decimal.js\";\nimport type { Amount, WrappedI80F48 } from \"../types\";\n\nconst I80F48_FRACTIONAL_BYTES = 6;\nconst I80F48_TOTAL_BYTES = 16;\nconst I80F48_DIVISOR = new Decimal(2).pow(8 * I80F48_FRACTIONAL_BYTES);\n\nexport function wrappedI80F48toBigNumber(wrapped: WrappedI80F48): BigNumber {\n const bytesLE = wrapped.value;\n if (bytesLE.length !== I80F48_TOTAL_BYTES) {\n throw new Error(`Expected a ${I80F48_TOTAL_BYTES}-byte buffer`);\n }\n\n let bytesBE = bytesLE.slice();\n bytesBE.reverse();\n\n let signChar = \"\";\n const msb = bytesBE[0];\n if (msb & 0x80) {\n signChar = \"-\";\n bytesBE = bytesBE.map((v) => ~v & 0xff);\n }\n\n const hex = signChar + \"0x\" + bytesBE.map((v) => v.toString(16).padStart(2, \"0\")).join(\"\");\n const decoded = new Decimal(hex).dividedBy(I80F48_DIVISOR);\n\n return new BigNumber(decoded.toString());\n}\n\nexport function bigNumberToWrappedI80F48(value: Amount): WrappedI80F48 {\n let decimalValue = new Decimal(value.toString());\n const isNegative = decimalValue.isNegative();\n\n decimalValue = decimalValue.times(I80F48_DIVISOR);\n let wrappedValue = new BN(decimalValue.round().toFixed()).toArray();\n\n if (wrappedValue.length < I80F48_TOTAL_BYTES) {\n const padding = Array(I80F48_TOTAL_BYTES - wrappedValue.length).fill(0);\n wrappedValue.unshift(...padding);\n }\n\n if (isNegative) {\n wrappedValue[wrappedValue.length - 1] |= 0x80;\n wrappedValue = wrappedValue.map((v) => ~v & 0xff);\n }\n\n wrappedValue.reverse();\n\n return { value: wrappedValue };\n}\n\n/**\n * Converts a ui representation of a token amount into its native value as `BN`, given the specified mint decimal amount (default to 6 for USDC).\n */\nexport function toNumber(amount: Amount): number {\n let amt: number;\n if (typeof amount === \"number\") {\n amt = amount;\n } else if (typeof amount === \"string\") {\n amt = Number(amount);\n } else {\n amt = amount.toNumber();\n }\n return amt;\n}\n\n/**\n * Converts a ui representation of a token amount into its native value as `BN`, given the specified mint decimal amount (default to 6 for USDC).\n */\nexport function toBigNumber(amount: Amount | BN): BigNumber {\n let amt: BigNumber;\n if (amount instanceof BigNumber) {\n amt = amount;\n } else {\n amt = new BigNumber(amount.toString());\n }\n return amt;\n}\n\n/**\n * Converts a UI representation of a token amount into its native value as `BN`, given the specified mint decimal amount (default to 6 for USDC).\n */\nexport function uiToNative(amount: Amount, decimals: number): BN {\n const amt = toBigNumber(amount);\n return new BN(amt.times(10 ** decimals).toFixed(0, BigNumber.ROUND_FLOOR));\n}\n\nexport function uiToNativeBigNumber(amount: Amount, decimals: number): BigNumber {\n const amt = toBigNumber(amount);\n return amt.times(10 ** decimals);\n}\n\n/**\n * Converts a native representation of a token amount into its UI value as `number`, given the specified mint decimal amount.\n */\nexport function nativeToUi(amount: Amount | BN, decimals: number): number {\n const amt = toBigNumber(amount);\n return amt.div(10 ** decimals).toNumber();\n}\n\n// shorten the checksummed version of the input address to have 4 characters at start and end\nexport function shortenAddress(pubkey: Address, chars = 4): string {\n const pubkeyStr = pubkey.toString();\n return `${pubkeyStr.slice(0, chars)}...${pubkeyStr.slice(-chars)}`;\n}\n\n/**\n * Converts basis points (bps) to a decimal percentage value.\n */\nexport function bpsToPercentile(bps: number): number {\n return bps / 10000;\n}\n\n/**\n * Prepares transaction remaining accounts by processing bank-oracle groups:\n * 1. Sorts groups in descending order by bank public key (pushes inactive accounts to end)\n * 2. Flattens the structure into a single public key array\n *\n * Stable on most JS implementations (this shouldn't matter since we do not generally have duplicate\n * banks), in place, and uses the raw 32-byte value to sort in byte-wise lexicographical order (like\n * Rust's b.key.cmp(&a.key))\n *\n * @param banksAndOracles - Array where each element is a bank-oracle group: [bankPubkey,\n * oracle1Pubkey, oracle2Pubkey?, ...] Note: SystemProgram keys (111..111)\n * represent inactive accounts\n * @returns Flattened array of public keys with inactive accounts at the end, ready for transaction\n * composition\n */\nexport const composeRemainingAccounts = (banksAndOracles: PublicKey[][]): PublicKey[] => {\n banksAndOracles.sort((a, b) => {\n const A = a[0].toBytes();\n const B = b[0].toBytes();\n // find the first differing byte\n for (let i = 0; i < 32; i++) {\n if (A[i] !== B[i]) {\n // descending: bigger byte should come first\n return B[i] - A[i];\n }\n }\n return 0; // identical keys\n });\n\n // flatten out [bank, oracle…, oracle…] → [bank, oracle…, bank, oracle…, …]\n return banksAndOracles.flat();\n};\n","import numeral from \"numeral\";\n\nclass CustomNumberFormat extends Intl.NumberFormat {\n constructor(locale: string | string[] | undefined, options: Intl.NumberFormatOptions | undefined) {\n super(locale, options);\n }\n\n override format(value: number | bigint) {\n if (value === 0) {\n return \"-\";\n } else {\n return super.format(value);\n }\n }\n}\n\nconst groupedNumberFormatter = new CustomNumberFormat(\"en-US\", {\n useGrouping: true,\n minimumFractionDigits: 0,\n maximumFractionDigits: 2,\n});\n\nconst numeralFormatter = (value: number) => {\n if (value < 0.01) {\n return \"0\";\n } else {\n return numeral(value).format(\"0.00a\");\n }\n};\n\ninterface dynamicNumeralFormatterOptions {\n minDisplay?: number;\n tokenPrice?: number;\n forceDecimals?: boolean;\n maxDisplay?: number;\n logging?: boolean;\n ignoreMinDisplay?: boolean;\n}\n\nexport const dynamicNumeralFormatter = (value: number, options: dynamicNumeralFormatterOptions = {}) => {\n const {\n minDisplay = 0.00001, // Default minDisplay for backward compatibility\n maxDisplay = 10000, // Default maxDisplay for backward compatibility\n tokenPrice,\n logging = false,\n ignoreMinDisplay = false, // New flag to control ignoring minDisplay\n forceDecimals,\n } = options;\n\n if (value === 0 || isNaN(value)) return \"0\";\n\n const absValue = Math.abs(value);\n\n if (logging) {\n console.log({\n value,\n minDisplay,\n maxDisplay,\n tokenPrice,\n ignoreMinDisplay,\n absValue,\n });\n }\n\n // Backward compatibility: Below the minimum display threshold\n if (!ignoreMinDisplay && absValue < minDisplay) {\n return `<${minDisplay}`;\n }\n\n // Backward compatibility: Above the maximum display threshold\n if (absValue > maxDisplay) {\n return numeral(value).format(forceDecimals ? \"0,0.00a\" : \"0,0.[00]a\");\n }\n\n if (!ignoreMinDisplay && Math.abs(value) >= 0.01) {\n return numeral(value).format(forceDecimals && Math.abs(value) > 0.99 ? \"0,0.00a\" : \"0,0.[0000]a\");\n }\n\n // New behavior: Ensure 3 significant decimal digits when ignoreMinDisplay is true\n if (ignoreMinDisplay) {\n const decimalPart = absValue - Math.floor(absValue);\n const decimalPlaces = decimalPart > 0 ? 3 : 0;\n\n if (absValue >= 1) {\n // For values >= 1, format the number with 3 decimal digits\n return value.toFixed(decimalPlaces).replace(/\\.?0+$/, \"\");\n } else {\n // For values < 1, calculate the significant decimal digits precisely\n const exponent = Math.floor(Math.log10(absValue));\n const significantDecimals = Math.max(3, 2 - exponent); // Ensure 3 significant decimal digits\n return value.toFixed(significantDecimals).replace(/\\.?0+$/, \"\");\n }\n }\n\n if (Math.abs(value) >= minDisplay) {\n const decimalPlaces = Math.max(0, Math.ceil(-Math.log10(minDisplay)));\n return numeral(value).format(`0,0.[${\"0\".repeat(decimalPlaces)}]`);\n }\n\n // Case: Token price takes priority when defined\n if (tokenPrice) {\n const smallestUnit = minDisplay / tokenPrice;\n\n const significantDecimals = Math.max(3, Math.ceil(-Math.log10(smallestUnit)));\n\n return value.toFixed(significantDecimals).replace(/\\.?0+$/, \"\");\n }\n\n return \"0\";\n};\n\nconst groupedNumberFormatterDyn = new Intl.NumberFormat(\"en-US\", {\n useGrouping: true,\n minimumFractionDigits: 0,\n maximumFractionDigits: 2,\n});\n\nconst usdFormatter = new Intl.NumberFormat(\"en-US\", {\n style: \"currency\",\n currency: \"USD\",\n minimumFractionDigits: 2,\n maximumFractionDigits: 2,\n signDisplay: \"auto\",\n});\n\nconst usdFormatterDyn = new Intl.NumberFormat(\"en-US\", {\n style: \"currency\",\n currency: \"USD\",\n minimumFractionDigits: 0,\n maximumFractionDigits: 2,\n signDisplay: \"auto\",\n});\n\nconst percentFormatter = new Intl.NumberFormat(\"en-US\", {\n style: \"percent\",\n minimumFractionDigits: 2,\n maximumFractionDigits: 2,\n});\n\nconst percentFormatterDyn = new Intl.NumberFormat(\"en-US\", {\n style: \"percent\",\n minimumFractionDigits: 0,\n maximumFractionDigits: 2,\n});\n\nconst percentFormatterMod = (\n value: number,\n opts: { minFractionDigits: number; maxFractionDigits: number } = { minFractionDigits: 2, maxFractionDigits: 2 },\n) => {\n const percentFormatter = new Intl.NumberFormat(\"en-US\", {\n style: \"percent\",\n minimumFractionDigits: opts.minFractionDigits,\n maximumFractionDigits: opts.maxFractionDigits,\n });\n\n if (value === 0) {\n return \"0%\";\n } else {\n return percentFormatter.format(value);\n }\n};\n\nconst clampedNumeralFormatter = (value: number) => {\n if (value === 0) {\n return \"0\";\n } else if (value < 0.01) {\n return \"< 0.01\";\n } else {\n return numeral(value).format(\"0.00a\");\n }\n};\n\nconst tokenPriceFormatter = (price: number, style: \"currency\" | \"decimal\" = \"currency\") => {\n if (price === 0) {\n return 0;\n }\n const reformatNum = Number(price.toFixed(20));\n\n if (price === 0) {\n return 0;\n }\n\n if (reformatNum < 0.00000001) {\n return price.toExponential(2);\n }\n\n const { minFractionDigits, maxFractionDigits } =\n reformatNum > 1\n ? { minFractionDigits: 2, maxFractionDigits: 2 }\n : reformatNum > 0.000001\n ? { minFractionDigits: 2, maxFractionDigits: 7 }\n : { minFractionDigits: 7, maxFractionDigits: 10 };\n\n const formatter = new Intl.NumberFormat(\"en-US\", {\n style: style,\n currency: \"USD\",\n minimumFractionDigits: minFractionDigits,\n maximumFractionDigits: maxFractionDigits,\n signDisplay: \"auto\",\n });\n\n return formatter.format(price);\n};\n\nexport {\n CustomNumberFormat,\n groupedNumberFormatter,\n groupedNumberFormatterDyn,\n numeralFormatter,\n clampedNumeralFormatter,\n percentFormatter,\n percentFormatterDyn,\n percentFormatterMod,\n usdFormatter,\n usdFormatterDyn,\n tokenPriceFormatter,\n};\n","import { wrappedI80F48toBigNumber } from \"../common\";\nimport {\n type EmodeEntry,\n type EmodeFlags,\n type EmodeSettingsRaw,\n type EmodeSettingsType,\n type EmodeTag,\n getActiveEmodeEntryFlags,\n getActiveEmodeFlags,\n parseEmodeTag,\n} from \"../services\";\n\nexport class EmodeSettings implements EmodeSettingsType {\n constructor(\n public emodeTag: EmodeTag,\n public timestamp: number,\n public flags: EmodeFlags[],\n public emodeEntries: EmodeEntry[],\n ) {\n this.emodeTag = emodeTag;\n this.timestamp = timestamp;\n this.flags = flags;\n this.emodeEntries = emodeEntries;\n }\n\n static from(emodeSettingsRaw: EmodeSettingsRaw): EmodeSettings {\n const emodeTag = parseEmodeTag(emodeSettingsRaw.emodeTag);\n const timestamp = emodeSettingsRaw.timestamp.toNumber();\n const flags = getActiveEmodeFlags(emodeSettingsRaw.flags);\n const emodeEntries = emodeSettingsRaw.emodeConfig.entries\n .filter((entry) => entry.collateralBankEmodeTag !== 0)\n .map((entry) => {\n return {\n collateralBankEmodeTag: parseEmodeTag(entry.collateralBankEmodeTag),\n flags: getActiveEmodeEntryFlags(entry.flags),\n assetWeightInit: wrappedI80F48toBigNumber(entry.assetWeightInit),\n assetWeightMaint: wrappedI80F48toBigNumber(entry.assetWeightMaint),\n };\n });\n return new EmodeSettings(emodeTag, timestamp, flags, emodeEntries);\n }\n}\n","import type { PublicKey } from \"@solana/web3.js\";\nimport type { Program } from \"./common\";\nimport type { LendrIdlType } from \"./idl\";\n\nexport type LendrProgram = Program<LendrIdlType>;\n\n/**\n * Supported config environments.\n */\nexport type Environment = \"production\" | \"alpha\" | \"staging\" | \"dev\" | \"mainnet-test-1\" | \"dev.1\";\n\n/**\n * Lendr bank vault type\n */\nexport enum BankVaultType {\n LiquidityVault,\n InsuranceVault,\n FeeVault,\n}\n\nexport interface LendrConfig {\n environment: Environment;\n cluster: string;\n programId: PublicKey;\n groupPk: PublicKey;\n}\n\nexport interface BankAddress {\n label: string;\n address: PublicKey;\n}\n\n// --- On-chain account structs\n\nexport enum AccountType {\n LendrGroup = \"lendrGroup\",\n LendrAccount = \"lendrAccount\",\n Bank = \"bank\",\n}\n\nexport type LogFn = <T extends object>(obj: T, msg?: string) => void;\n\nexport interface TLogger {\n info: LogFn;\n error: LogFn;\n warn: LogFn;\n debug: LogFn;\n}\n\nexport type LendingAccountDepositOrRepayWithSessionAccounts = {\n sessionKey: PublicKey; // The session key\n lendrAccount: PublicKey; // (must match session user)\n bank: PublicKey;\n signerTokenAccount: PublicKey; // User's token account (source)\n tokenProgram: PublicKey; // SPL Token program (interface)\n group?: PublicKey;\n liquidityVault?: PublicKey;\n};\n\nexport type LendingAccountWithdrawOrBorrowWithSessionAccounts = {\n sessionKey: PublicKey;\n lendrAccount: PublicKey;\n bank: PublicKey;\n destinationTokenAccount: PublicKey;\n tokenProgram: PublicKey;\n\n group?: PublicKey;\n}","import { BorshCoder } from \"@coral-xyz/anchor\";\nimport { PublicKey } from \"@solana/web3.js\";\nimport BigNumber from \"bignumber.js\";\nimport BN from \"bn.js\";\nimport { DEFAULT_ORACLE_MAX_AGE } from \"~/constants\";\nimport type { LendrIdlType } from \"~/idl\";\nimport { EmodeSettings } from \"~/models/emode-settings\";\nimport { AccountType } from \"~/types\";\nimport { findOracleKey, type PythPushFeedIdMap } from \"~/utils\";\nimport { type BankMetadata, wrappedI80F48toBigNumber } from \"../../../common\";\n\nimport {\n type AssetTag,\n type BankConfigDto,\n type BankConfigRaw,\n type BankConfigRawDto,\n type BankConfigType,\n type BankRaw,\n type BankRawDto,\n type BankType,\n type BankTypeDto,\n EmodeEntryFlags,\n EmodeFlags,\n type EmodeSettingsDto,\n type EmodeSettingsRaw,\n type EmodeSettingsRawDto,\n type EmodeSettingsType,\n EmodeTag,\n type InterestRateConfig,\n type InterestRateConfigDto,\n OperationalState,\n type OperationalStateRaw,\n OracleSetup,\n type OracleSetupRaw,\n RiskTier,\n type RiskTierRaw,\n} from \"../types\";\n\n/*\n * Bank deserialization\n */\n\nexport function decodeBankRaw(encoded: Buffer, idl: LendrIdlType): BankRaw {\n const coder = new BorshCoder(idl);\n return coder.accounts.decode(AccountType.Bank, encoded);\n}\n\nexport function parseBankRaw(\n address: PublicKey,\n accountParsed: BankRaw,\n feedIdMap?: PythPushFeedIdMap,\n bankMetadata?: BankMetadata,\n): BankType {\n const flags = accountParsed.flags.toNumber();\n\n const mint = accountParsed.mint;\n const mintDecimals = accountParsed.mintDecimals;\n const group = accountParsed.group;\n\n const assetShareValue = wrappedI80F48toBigNumber(accountParsed.assetShareValue);\n const liabilityShareValue = wrappedI80F48toBigNumber(accountParsed.liabilityShareValue);\n\n const liquidityVault = accountParsed.liquidityVault;\n const liquidityVaultBump = accountParsed.liquidityVaultBump;\n const liquidityVaultAuthorityBump = accountParsed.liquidityVaultAuthorityBump;\n\n const insuranceVault = accountParsed.insuranceVault;\n const insuranceVaultBump = accountParsed.insuranceVaultBump;\n const insuranceVaultAuthorityBump = accountParsed.insuranceVaultAuthorityBump;\n\n const collectedInsuranceFeesOutstanding = wrappedI80F48toBigNumber(accountParsed.collectedInsuranceFeesOutstanding);\n\n const feeVault = accountParsed.feeVault;\n const feeVaultBump = accountParsed.feeVaultBump;\n const feeVaultAuthorityBump = accountParsed.feeVaultAuthorityBump;\n\n const collectedGroupFeesOutstanding = wrappedI80F48toBigNumber(accountParsed.collectedGroupFeesOutstanding);\n\n const config = parseBankConfigRaw(accountParsed.config);\n\n const lastUpdate = accountParsed.lastUpdate.toNumber();\n\n const totalAssetShares = wrappedI80F48toBigNumber(accountParsed.totalAssetShares);\n const totalLiabilityShares = wrappedI80F48toBigNumber(accountParsed.totalLiabilityShares);\n\n const emissionsActiveBorrowing = (flags & 1) > 0;\n const emissionsActiveLending = (flags & 2) > 0;\n\n // @todo existence checks here should be temporary - remove once all banks have emission configs\n const emissionsRate = accountParsed.emissionsRate.toNumber();\n const emissionsMint = accountParsed.emissionsMint;\n const emissionsRemaining = accountParsed.emissionsRemaining\n ? wrappedI80F48toBigNumber(accountParsed.emissionsRemaining)\n : new BigNumber(0);\n\n const { oracleKey, shardId: pythShardId } = feedIdMap\n ? findOracleKey(config, feedIdMap)\n : { oracleKey: config.oracleKeys[0] };\n const emode = EmodeSettings.from(accountParsed.emode);\n\n const tokenSymbol = bankMetadata?.tokenSymbol;\n\n return {\n address,\n group,\n mint,\n mintDecimals,\n assetShareValue,\n liabilityShareValue,\n liquidityVault,\n liquidityVaultBump,\n liquidityVaultAuthorityBump,\n insuranceVault,\n insuranceVaultBump,\n insuranceVaultAuthorityBump,\n collectedInsuranceFeesOutstanding,\n feeVault,\n feeVaultBump,\n feeVaultAuthorityBump,\n collectedGroupFeesOutstanding,\n lastUpdate,\n config,\n totalAssetShares,\n totalLiabilityShares,\n emissionsActiveBorrowing,\n emissionsActiveLending,\n emissionsRate,\n emissionsMint,\n emissionsRemaining,\n oracleKey,\n pythShardId,\n emode,\n tokenSymbol,\n };\n}\n\n/*\n * DTO Bank deserialization\n */\n\nexport function dtoToBank(bankDto: BankTypeDto): BankType {\n return {\n address: new PublicKey(bankDto.address),\n group: new PublicKey(bankDto.group),\n mint: new PublicKey(bankDto.mint),\n mintDecimals: bankDto.mintDecimals,\n assetShareValue: new BigNumber(bankDto.assetShareValue),\n liabilityShareValue: new BigNumber(bankDto.liabilityShareValue),\n liquidityVault: new PublicKey(bankDto.liquidityVault),\n liquidityVaultBump: bankDto.liquidityVaultBump,\n liquidityVaultAuthorityBump: bankDto.liquidityVaultAuthorityBump,\n insuranceVault: new PublicKey(bankDto.insuranceVault),\n insuranceVaultBump: bankDto.insuranceVaultBump,\n insuranceVaultAuthorityBump: bankDto.insuranceVaultAuthorityBump,\n collectedInsuranceFeesOutstanding: new BigNumber(bankDto.collectedInsuranceFeesOutstanding),\n feeVault: new PublicKey(bankDto.feeVault),\n feeVaultBump: bankDto.feeVaultBump,\n feeVaultAuthorityBump: bankDto.feeVaultAuthorityBump,\n collectedGroupFeesOutstanding: new BigNumber(bankDto.collectedGroupFeesOutstanding),\n lastUpdate: bankDto.lastUpdate,\n config: dtoToBankConfig(bankDto.config),\n totalAssetShares: new BigNumber(bankDto.totalAssetShares),\n totalLiabilityShares: new BigNumber(bankDto.totalLiabilityShares),\n emissionsActiveBorrowing: bankDto.emissionsActiveBorrowing,\n emissionsActiveLending: bankDto.emissionsActiveLending,\n emissionsRate: bankDto.emissionsRate,\n emissionsMint: new PublicKey(bankDto.emissionsMint),\n emissionsRemaining: new BigNumber(bankDto.emissionsRemaining),\n oracleKey: new PublicKey(bankDto.oracleKey),\n pythShardId: bankDto.pythShardId,\n emode: dtoToEmodeSettings(bankDto.emode),\n tokenSymbol: bankDto.tokenSymbol,\n };\n}\n\nexport function dtoToEmodeSettings(emodeSettingsDto: EmodeSettingsDto): EmodeSettingsType {\n return {\n emodeTag: emodeSettingsDto.emodeTag,\n timestamp: emodeSettingsDto.timestamp,\n flags: emodeSettingsDto.flags,\n emodeEntries: emodeSettingsDto.emodeEntries.map((entry) => {\n return {\n collateralBankEmodeTag: entry.collateralBankEmodeTag,\n flags: entry.flags,\n assetWeightInit: new BigNumber(entry.assetWeightInit),\n assetWeightMaint: new BigNumber(entry.assetWeightMaint),\n };\n }),\n };\n}\n\nexport function dtoToBankConfig(bankConfigDto: BankConfigDto): BankConfigType {\n return {\n assetWeightInit: new BigNumber(bankConfigDto.assetWeightInit),\n assetWeightMaint: new BigNumber(bankConfigDto.assetWeightMaint),\n liabilityWeightInit: new BigNumber(bankConfigDto.liabilityWeightInit),\n liabilityWeightMaint: new BigNumber(bankConfigDto.liabilityWeightMaint),\n depositLimit: new BigNumber(bankConfigDto.depositLimit),\n borrowLimit: new BigNumber(bankConfigDto.borrowLimit),\n riskTier: bankConfigDto.riskTier,\n operationalState: bankConfigDto.operationalState,\n totalAssetValueInitLimit: new BigNumber(bankConfigDto.totalAssetValueInitLimit),\n assetTag: bankConfigDto.assetTag,\n oracleSetup: bankConfigDto.oracleSetup,\n oracleKeys: bankConfigDto.oracleKeys.map((key) => new PublicKey(key)),\n oracleMaxAge: bankConfigDto.oracleMaxAge,\n interestRateConfig: dtoToInterestRateConfig(bankConfigDto.interestRateConfig),\n };\n}\n\nexport function dtoToInterestRateConfig(interestRateConfigDto: InterestRateConfigDto): InterestRateConfig {\n return {\n optimalUtilizationRate: new BigNumber(interestRateConfigDto.optimalUtilizationRate),\n plateauInterestRate: new BigNumber(interestRateConfigDto.plateauInterestRate),\n maxInterestRate: new BigNumber(interestRateConfigDto.maxInterestRate),\n insuranceFeeFixedApr: new BigNumber(interestRateConfigDto.insuranceFeeFixedApr),\n insuranceIrFee: new BigNumber(interestRateConfigDto.insuranceIrFee),\n protocolFixedFeeApr: new BigNumber(interestRateConfigDto.protocolFixedFeeApr),\n protocolIrFee: new BigNumber(interestRateConfigDto.protocolIrFee),\n protocolOriginationFee: new BigNumber(interestRateConfigDto.protocolOriginationFee),\n };\n}\n\nexport function dtoToBankRaw(bankDto: BankRawDto): BankRaw {\n return {\n group: new PublicKey(bankDto.group),\n mint: new PublicKey(bankDto.mint),\n mintDecimals: bankDto.mintDecimals,\n\n assetShareValue: bankDto.assetShareValue,\n liabilityShareValue: bankDto.liabilityShareValue,\n\n liquidityVault: new PublicKey(bankDto.liquidityVault),\n liquidityVaultBump: bankDto.liquidityVaultBump,\n liquidityVaultAuthorityBump: bankDto.liquidityVaultAuthorityBump,\n\n insuranceVault: new PublicKey(bankDto.insuranceVault),\n insuranceVaultBump: bankDto.insuranceVaultBump,\n insuranceVaultAuthorityBump: bankDto.insuranceVaultAuthorityBump,\n collectedInsuranceFeesOutstanding: bankDto.collectedInsuranceFeesOutstanding,\n\n feeVault: new PublicKey(bankDto.feeVault),\n feeVaultBump: bankDto.feeVaultBump,\n feeVaultAuthorityBump: bankDto.feeVaultAuthorityBump,\n collectedGroupFeesOutstanding: bankDto.collectedGroupFeesOutstanding,\n\n lastUpdate: new BN(bankDto.lastUpdate),\n\n config: dtoToBankConfigRaw(bankDto.config),\n\n totalAssetShares: bankDto.totalAssetShares,\n totalLiabilityShares: bankDto.totalLiabilityShares,\n\n flags: new BN(bankDto.flags),\n emissionsRate: new BN(bankDto.emissionsRate),\n emissionsRemaining: bankDto.emissionsRemaining,\n emissionsMint: new PublicKey(bankDto.emissionsMint),\n\n emode: dtoToEmodeSettingsRaw(bankDto.emode),\n };\n}\n\nexport function dtoToEmodeSettingsRaw(emodeSettingsDto: EmodeSettingsRawDto): EmodeSettingsRaw {\n return {\n emodeTag: emodeSettingsDto.emodeTag,\n timestamp: new BN(emodeSettingsDto.timestamp),\n flags: new BN(emodeSettingsDto.flags),\n emodeConfig: {\n entries: emodeSettingsDto.emodeConfig.entries.map((entry) => {\n return {\n collateralBankEmodeTag: entry.collateralBankEmodeTag,\n flags: entry.flags,\n assetWeightInit: entry.assetWeightInit,\n assetWeightMaint: entry.assetWeightMaint,\n };\n }),\n },\n };\n}\n\nexport function dtoToBankConfigRaw(bankConfigDto: BankConfigRawDto): BankConfigRaw {\n return {\n assetWeightInit: bankConfigDto.assetWeightInit,\n assetWeightMaint: bankConfigDto.assetWeightMaint,\n liabilityWeightInit: bankConfigDto.liabilityWeightInit,\n liabilityWeightMaint: bankConfigDto.liabilityWeightMaint,\n depositLimit: new BN(bankConfigDto.depositLimit),\n borrowLimit: new BN(bankConfigDto.borrowLimit),\n riskTier: bankConfigDto.riskTier,\n operationalState: bankConfigDto.operationalState,\n totalAssetValueInitLimit: new BN(bankConfigDto.totalAssetValueInitLimit),\n assetTag: bankConfigDto.assetTag,\n oracleSetup: bankConfigDto.oracleSetup,\n oracleKeys: bankConfigDto.oracleKeys.map((key: string) => new PublicKey(key)),\n oracleMaxAge: bankConfigDto.oracleMaxAge,\n interestRateConfig: bankConfigDto.interestRateConfig,\n };\n}\n\n/*\n * Bank config deserialization\n */\n\nexport function parseBankConfigRaw(bankConfigRaw: BankConfigRaw): BankConfigType {\n const assetWeightInit = wrappedI80F48toBigNumber(bankConfigRaw.assetWeightInit);\n const assetWeightMaint = wrappedI80F48toBigNumber(bankConfigRaw.assetWeightMaint);\n const liabilityWeightInit = wrappedI80F48toBigNumber(bankConfigRaw.liabilityWeightInit);\n const liabilityWeightMaint = wrappedI80F48toBigNumber(bankConfigRaw.liabilityWeightMaint);\n const depositLimit = BigNumber(bankConfigRaw.depositLimit.toString());\n const borrowLimit = BigNumber(bankConfigRaw.borrowLimit.toString());\n const riskTier = parseRiskTier(bankConfigRaw.riskTier);\n const operationalState = parseOperationalState(bankConfigRaw.operationalState);\n const totalAssetValueInitLimit = BigNumber(bankConfigRaw.totalAssetValueInitLimit.toString());\n const assetTag = bankConfigRaw.assetTag as AssetTag;\n const oracleSetup = parseOracleSetup(bankConfigRaw.oracleSetup);\n const oracleKeys = bankConfigRaw.oracleKeys;\n const oracleMaxAge = bankConfigRaw.oracleMaxAge === 0 ? DEFAULT_ORACLE_MAX_AGE : bankConfigRaw.oracleMaxAge;\n const interestRateConfig = {\n insuranceFeeFixedApr: wrappedI80F48toBigNumber(bankConfigRaw.interestRateConfig.insuranceFeeFixedApr),\n maxInterestRate: wrappedI80F48toBigNumber(bankConfigRaw.interestRateConfig.maxInterestRate),\n insuranceIrFee: wrappedI80F48toBigNumber(bankConfigRaw.interestRateConfig.insuranceIrFee),\n optimalUtilizationRate: wrappedI80F48toBigNumber(bankConfigRaw.interestRateConfig.optimalUtilizationRate),\n plateauInterestRate: wrappedI80F48toBigNumber(bankConfigRaw.interestRateConfig.plateauInterestRate),\n protocolFixedFeeApr: wrappedI80F48toBigNumber(bankConfigRaw.interestRateConfig.protocolFixedFeeApr),\n protocolIrFee: wrappedI80F48toBigNumber(bankConfigRaw.interestRateConfig.protocolIrFee),\n protocolOriginationFee: wrappedI80F48toBigNumber(bankConfigRaw.interestRateConfig.protocolOriginationFee),\n };\n\n return {\n assetWeightInit,\n assetWeightMaint,\n liabilityWeightInit,\n liabilityWeightMaint,\n depositLimit,\n borrowLimit,\n riskTier,\n operationalState,\n totalAssetValueInitLimit,\n assetTag,\n oracleSetup,\n oracleKeys,\n oracleMaxAge,\n interestRateConfig,\n };\n}\n\nexport function parseRiskTier(riskTierRaw: RiskTierRaw): RiskTier {\n switch (Object.keys(riskTierRaw)[0].toLowerCase()) {\n case \"collateral\":\n return RiskTier.Collateral;\n case \"isolated\":\n return RiskTier.Isolated;\n default:\n throw new Error(`Invalid risk tier \"${riskTierRaw}\"`);\n }\n}\n\nexport function parseOperationalState(operationalStateRaw: OperationalStateRaw): OperationalState {\n switch (Object.keys(operationalStateRaw)[0].toLowerCase()) {\n case \"paused\":\n return OperationalState.Paused;\n case \"operational\":\n return OperationalState.Operational;\n case \"reduceonly\":\n return OperationalState.ReduceOnly;\n default:\n throw new Error(`Invalid operational state \"${operationalStateRaw}\"`);\n }\n}\n\nexport function parseOracleSetup(oracleSetupRaw: OracleSetupRaw): OracleSetup {\n const oracleKey = Object.keys(oracleSetupRaw)[0].toLowerCase();\n switch (oracleKey) {\n case \"none\":\n return OracleSetup.None;\n case \"pythlegacy\":\n return OracleSetup.PythLegacy;\n case \"switchboardv2\":\n return OracleSetup.SwitchboardV2;\n case \"pythpushoracle\":\n return OracleSetup.PythPushOracle;\n case \"switchboardpull\":\n return OracleSetup.SwitchboardPull;\n case \"stakedwithpythpush\":\n return OracleSetup.StakedWithPythPush;\n default:\n return OracleSetup.None;\n }\n}\n\n/**\n * Get all active EMode flags as an array of flag names\n */\nexport function getActiveEmodeFlags(flags: BN): EmodeFlags[] {\n const activeFlags: EmodeFlags[] = [];\n\n for (const flagName in EmodeFlags) {\n const flag = EmodeFlags[flagName];\n\n if (typeof flag === \"number\" && hasEmodeFlag(flags, flag)) {\n activeFlags.push(flag);\n }\n }\n\n return activeFlags;\n}\n\n/**\n * Check if a specific EMode flag is set\n */\nexport function hasEmodeFlag(flags: BN, flag: number): boolean {\n return !flags.and(new BN(flag)).isZero();\n}\n\n/**\n * Get all active EMode entry flags as an array of flag names\n */\nexport function getActiveEmodeEntryFlags(flags: number): EmodeEntryFlags[] {\n const activeFlags: EmodeEntryFlags[] = [];\n\n for (const flagName in EmodeEntryFlags) {\n const flag = EmodeEntryFlags[flagName];\n\n if (typeof flag === \"number\" && hasEmodeEntryFlag(flags, flag)) {\n activeFlags.push(flag);\n }\n }\n\n return activeFlags;\n}\n\n/**\n * Check if a specific EMode entry flag is set\n */\nexport function hasEmodeEntryFlag(flags: number, flag: number): boolean {\n return (flags & flag) === flag;\n}\n\n/**\n * Parse a raw EMode tag number into the corresponding EmodeTag enum value\n */\nexport function parseEmodeTag(emodeTagRaw: number): EmodeTag {\n switch (emodeTagRaw) {\n case 501:\n return EmodeTag.SOL;\n case 1571:\n return EmodeTag.LST_T1;\n case 1572:\n return EmodeTag.LST_T2;\n case 0:\n default:\n return EmodeTag.UNSET;\n }\n}\n","import type { Buffer } from \"buffer\";\n\n// https://github.com/nodejs/node/blob/v14.17.0/lib/internal/errors.js#L758\nconst ERR_BUFFER_OUT_OF_BOUNDS = () => new Error(\"Attempt to access memory outside buffer bounds\");\n\n// https://github.com/nodejs/node/blob/v14.17.0/lib/internal/errors.js#L968\nconst ERR_INVALID_ARG_TYPE = (name: string, expected: string, actual: any) =>\n new Error(`The \"${name}\" argument must be of type ${expected}. Received ${actual}`);\n\n// https://github.com/nodejs/node/blob/v14.17.0/lib/internal/errors.js#L1262\nconst ERR_OUT_OF_RANGE = (str: string, range: string, received: number) =>\n new Error(`The value of \"${str} is out of range. It must be ${range}. Received ${received}`);\n\n// https://github.com/nodejs/node/blob/v14.17.0/lib/internal/validators.js#L127-L130\nfunction validateNumber(value: any, name: string) {\n if (typeof value !== \"number\") throw ERR_INVALID_ARG_TYPE(name, \"number\", value);\n}\n\n// https://github.com/nodejs/node/blob/v14.17.0/lib/internal/buffer.js#L68-L80\nfunction boundsError(value: number, length: number) {\n if (Math.floor(value) !== value) {\n validateNumber(value, \"offset\");\n throw ERR_OUT_OF_RANGE(\"offset\", \"an integer\", value);\n }\n\n if (length < 0) throw ERR_BUFFER_OUT_OF_BOUNDS();\n\n throw ERR_OUT_OF_RANGE(\"offset\", `>= 0 and <= ${length}`, value);\n}\n\n// https://github.com/nodejs/node/blob/v14.17.0/lib/internal/buffer.js#L129-L145\nexport function readBigInt64LE(buffer: Buffer, offset = 0): bigint {\n validateNumber(offset, \"offset\");\n const first = buffer[offset];\n const last = buffer[offset + 7];\n if (first === undefined || last === undefined) boundsError(offset, buffer.length - 8);\n // tslint:disable-next-line:no-bitwise\n const val = buffer[offset + 4] + buffer[offset + 5] * 2 ** 8 + buffer[offset + 6] * 2 ** 16 + (last << 24); // Overflow\n return (\n (BigInt(val) << BigInt(32)) + // tslint:disable-line:no-bitwise\n BigInt(first + buffer[++offset] * 2 ** 8 + buffer[++offset] * 2 ** 16 + buffer[++offset] * 2 ** 24)\n );\n}\n\n// https://github.com/nodejs/node/blob/v14.17.0/lib/internal/buffer.js#L89-L107\nexport function readBigUInt64LE(buffer: Buffer, offset = 0): bigint {\n validateNumber(offset, \"offset\");\n const first = buffer[offset];\n const last = buffer[offset + 7];\n if (first === undefined || last === undefined) boundsError(offset, buffer.length - 8);\n\n const lo = first + buffer[++offset] * 2 ** 8 + buffer[++offset] * 2 ** 16 + buffer[++offset] * 2 ** 24;\n\n const hi = buffer[++offset] + buffer[++offset] * 2 ** 8 + buffer[++offset] * 2 ** 16 + last * 2 ** 24;\n\n return BigInt(lo) + (BigInt(hi) << BigInt(32)); // tslint:disable-line:no-bitwise\n}\n","import { PublicKey } from \"@solana/web3.js\";\nimport { readBigInt64LE, readBigUInt64LE } from \"./readBig\";\n\n/** Number of slots that can pass before a publisher's price is no longer included in the aggregate. */\nexport const MAX_SLOT_DIFFERENCE = 25;\nconst empty32Buffer = Buffer.alloc(32);\nconst PKorNull = (data: Buffer) => (data.equals(empty32Buffer) ? null : new PublicKey(data));\n\nexport interface Price {\n priceComponent: bigint;\n price: number;\n confidenceComponent: bigint;\n confidence: number;\n status: PriceStatus;\n corporateAction: CorpAction;\n publishSlot: number;\n}\n\nexport enum PriceStatus {\n Unknown,\n Trading,\n Halted,\n Auction,\n Ignored,\n}\n\nexport enum CorpAction {\n NoCorpAct,\n}\n\nconst parsePriceInfo = (data: Buffer, exponent: number): Price => {\n // aggregate price\n const priceComponent = readBigInt64LE(data, 0);\n const price = Number(priceComponent) * 10 ** exponent;\n // aggregate confidence\n const confidenceComponent = readBigUInt64LE(data, 8);\n const confidence = Number(confidenceComponent) * 10 ** exponent;\n // aggregate status\n const status: PriceStatus = data.readUInt32LE(16);\n // aggregate corporate action\n const corporateAction: CorpAction = data.readUInt32LE(20);\n // aggregate publish slot. It is converted to number to be consistent with Solana's library interface (Slot there is number)\n const publishSlot = Number(readBigUInt64LE(data, 24));\n return {\n priceComponent,\n price,\n confidenceComponent,\n confidence,\n status,\n corporateAction,\n publishSlot,\n };\n};\n\nexport interface PriceData extends Base {\n priceType: PriceType;\n exponent: number;\n numComponentPrices: number;\n numQuoters: number;\n lastSlot: bigint;\n validSlot: bigint;\n emaPrice: Ema;\n emaConfidence: Ema;\n timestamp: bigint;\n minPublishers: number;\n drv2: number;\n drv3: number;\n drv4: number;\n productAccountKey: PublicKey;\n nextPriceAccountKey: PublicKey | null;\n previousSlot: bigint;\n previousPriceComponent: bigint;\n previousPrice: number;\n previousConfidenceComponent: bigint;\n previousConfidence: number;\n previousTimestamp: bigint;\n priceComponents: PriceComponent[];\n aggregate: Price;\n // The current price and confidence and status. The typical use of this interface is to consume these three fields.\n // If undefined, Pyth does not currently have price information for this product. This condition can\n // happen for various reasons (e.g., US equity market is closed, or insufficient publishers), and your\n // application should handle it gracefully. Note that other raw price information fields (such as\n // aggregate.price) may be defined even if this is undefined; you most likely should not use those fields,\n // as their value can be arbitrary when this is undefined.\n price: number | undefined;\n confidence: number | undefined;\n status: PriceStatus;\n}\n\nexport interface Base {\n magic: number;\n version: number;\n type: AccountType;\n size: number;\n}\n\nexport enum AccountType {\n Unknown,\n Mapping,\n Product,\n Price,\n Test,\n Permission,\n}\n\nexport enum PriceType {\n Unknown,\n Price,\n}\n\n/**\n * valueComponent = numerator / denominator\n * value = valueComponent * 10 ^ exponent (from PriceData)\n */\nexport interface Ema {\n valueComponent: bigint;\n value: number;\n numerator: bigint;\n denominator: bigint;\n}\n\nexport interface PriceComponent {\n publisher: PublicKey;\n aggregate: Price;\n latest: Price;\n}\n\n// Provide currentSlot when available to allow status to consider the case when price goes stale. It is optional because\n// it requires an extra request to get it when it is not available which is not always efficient.\nexport const parsePriceData = (data: Buffer, currentSlot?: number): PriceData => {\n // pyth magic number\n const magic = data.readUInt32LE(0);\n // program version\n const version = data.readUInt32LE(4);\n // account type\n const type = data.readUInt32LE(8);\n // price account size\n const size = data.readUInt32LE(12);\n // price or calculation type\n const priceType: PriceType = data.readUInt32LE(16);\n // price exponent\n const exponent = data.readInt32LE(20);\n // number of component prices\n const numComponentPrices = data.readUInt32LE(24);\n // number of quoters that make up aggregate\n const numQuoters = data.readUInt32LE(28);\n // slot of last valid (not unknown) aggregate price\n const lastSlot = readBigUInt64LE(data, 32);\n // valid on-chain slot of aggregate price\n const validSlot = readBigUInt64LE(data, 40);\n // exponential moving average price\n const emaPrice = parseEma(data.slice(48, 72), exponent);\n // exponential moving average confidence interval\n const emaConfidence = parseEma(data.slice(72, 96), exponent);\n // timestamp of the current price\n const timestamp = readBigInt64LE(data, 96);\n // minimum number of publishers for status to be TRADING\n const minPublishers = data.readUInt8(104);\n // space for future derived values\n const drv2 = data.readInt8(105);\n // space for future derived values\n const drv3 = data.readInt16LE(106);\n // space for future derived values\n const drv4 = data.readInt32LE(108);\n // product id / reference account\n const productAccountKey = new PublicKey(data.slice(112, 144));\n // next price account in list\n const nextPriceAccountKey = PKorNull(data.slice(144, 176));\n // valid slot of previous update\n const previousSlot = readBigUInt64LE(data, 176);\n // aggregate price of previous update\n const previousPriceComponent = readBigInt64LE(data, 184);\n const previousPrice = Number(previousPriceComponent) * 10 ** exponent;\n // confidence interval of previous update\n const previousConfidenceComponent = readBigUInt64LE(data, 192);\n const previousConfidence = Number(previousConfidenceComponent) * 10 ** exponent;\n // space for future derived values\n const previousTimestamp = readBigInt64LE(data, 200);\n const aggregate = parsePriceInfo(data.slice(208, 240), exponent);\n\n let status = aggregate.status;\n\n if (currentSlot && status === PriceStatus.Trading) {\n if (currentSlot - aggregate.publishSlot > MAX_SLOT_DIFFERENCE) {\n status = PriceStatus.Unknown;\n }\n }\n\n let price: number | undefined;\n let confidence: number | undefined;\n if (status === PriceStatus.Trading) {\n price = aggregate.price;\n confidence = aggregate.confidence;\n }\n\n // price components - up to 32\n const priceComponents: PriceComponent[] = [];\n let offset = 240;\n while (priceComponents.length < numComponentPrices) {\n const publisher = new PublicKey(data.slice(offset, offset + 32));\n offset += 32;\n const componentAggregate = parsePriceInfo(data.slice(offset, offset + 32), exponent);\n offset += 32;\n const latest = parsePriceInfo(data.slice(offset, offset + 32), exponent);\n offset += 32;\n priceComponents.push({ publisher, aggregate: componentAggregate, latest });\n }\n\n return {\n magic,\n version,\n type,\n size,\n priceType,\n exponent,\n numComponentPrices,\n numQuoters,\n lastSlot,\n validSlot,\n emaPrice,\n emaConfidence,\n timestamp,\n minPublishers,\n drv2,\n drv3,\n drv4,\n productAccountKey,\n nextPriceAccountKey,\n previousSlot,\n previousPriceComponent,\n previousPrice,\n previousConfidenceComponent,\n previousConfidence,\n previousTimestamp,\n aggregate,\n priceComponents,\n price,\n confidence,\n status,\n };\n};\n\nconst parseEma = (data: Buffer, exponent: number): Ema => {\n // current value of ema\n const valueComponent = readBigInt64LE(data, 0);\n const value = Number(valueComponent) * 10 ** exponent;\n // numerator state for next update\n const numerator = readBigInt64LE(data, 8);\n // denominator state for next update\n const denominator = readBigInt64LE(data, 16);\n return { valueComponent, value, numerator, denominator };\n};\n","import BigNumber from \"bignumber.js\";\nimport * as borsh from \"borsh\";\n\ntype PriceUpdateV2 = {\n writeAuthority: Buffer;\n verificationLevel: number;\n priceMessage: {\n feedId: Buffer;\n price: bigint;\n conf: bigint;\n exponent: number;\n publishTime: bigint;\n prevPublishTime: bigint;\n emaPrice: bigint;\n emaConf: bigint;\n };\n};\n\nconst priceUpdateV2Schema = {\n struct: {\n writeAuthority: {\n array: { type: \"u8\", len: 32 },\n },\n verificationLevel: \"u8\",\n priceMessage: {\n struct: {\n feedId: { array: { type: \"u8\", len: 32 } },\n price: \"i64\",\n conf: \"u64\",\n exponent: \"i32\",\n publishTime: \"i64\",\n prevPublishTime: \"i64\",\n emaPrice: \"i64\",\n emaConf: \"u64\",\n },\n },\n postedSlot: \"u64\",\n },\n};\n\nexport const parsePriceInfo = (data: Buffer): PriceUpdateV2 => {\n const decoded: PriceUpdateV2 = borsh.deserialize(priceUpdateV2Schema, data) as any;\n return decoded;\n};\n\nfunction capConfidenceInterval(price: BigNumber, confidence: BigNumber, maxConfidence: BigNumber): BigNumber {\n const maxConfidenceInterval = price.times(maxConfidence);\n\n return BigNumber.min(confidence, maxConfidenceInterval);\n}\n","import { PublicKey } from \"@solana/web3.js\";\n\n/**\n * Parsed content of an on-chain StakeAccount\n *\n * Copied from https://github.com/solana-developers/solana-rpc-get-stake-activation/blob/main/web3js-1.0/src/stake.ts\n * */\nexport type StakeAccount = {\n discriminant: bigint;\n meta: {\n rentExemptReserve: bigint;\n authorized: {\n staker: PublicKey;\n withdrawer: PublicKey;\n };\n lockup: {\n unixTimestamp: bigint;\n epoch: bigint;\n custodian: PublicKey;\n };\n };\n stake: {\n delegation: {\n voterPubkey: PublicKey;\n stake: bigint;\n activationEpoch: bigint;\n deactivationEpoch: bigint;\n };\n creditsObserved: bigint;\n };\n};\n\n/**\n * Decode a StakeAccount from parsed account data.\n *\n * Copied from https://github.com/solana-developers/solana-rpc-get-stake-activation/blob/main/web3js-1.0/src/stake.ts\n * */\nexport const getStakeAccount = (data: Buffer): StakeAccount => {\n let offset = 0;\n\n // Discriminant (4 bytes)\n const discriminant = data.readBigUInt64LE(offset);\n offset += 4;\n\n // Meta\n const rentExemptReserve = data.readBigUInt64LE(offset);\n offset += 8;\n\n // Authorized staker and withdrawer (2 public keys)\n const staker = new PublicKey(data.subarray(offset, offset + 32));\n offset += 32;\n const withdrawer = new PublicKey(data.subarray(offset, offset + 32));\n offset += 32;\n\n // Lockup: unixTimestamp, epoch, custodian\n const unixTimestamp = data.readBigUInt64LE(offset);\n offset += 8;\n const epoch = data.readBigUInt64LE(offset);\n offset += 8;\n const custodian = new PublicKey(data.subarray(offset, offset + 32));\n offset += 32;\n\n // Stake: Delegation\n const voterPubkey = new PublicKey(data.subarray(offset, offset + 32));\n offset += 32;\n const stake = data.readBigUInt64LE(offset);\n offset += 8;\n const activationEpoch = data.readBigUInt64LE(offset);\n offset += 8;\n const deactivationEpoch = data.readBigUInt64LE(offset);\n offset += 8;\n\n // Credits observed\n const creditsObserved = data.readBigUInt64LE(offset);\n\n // Return the parsed StakeAccount object\n return {\n discriminant,\n meta: {\n rentExemptReserve,\n authorized: {\n staker,\n withdrawer,\n },\n lockup: {\n unixTimestamp,\n epoch,\n custodian,\n },\n },\n stake: {\n delegation: {\n voterPubkey,\n stake,\n activationEpoch,\n deactivationEpoch,\n },\n creditsObserved,\n },\n };\n};\n","import {\n type Connection,\n LAMPORTS_PER_SOL,\n PublicKey,\n STAKE_CONFIG_ID,\n StakeProgram,\n SYSVAR_CLOCK_PUBKEY,\n SYSVAR_RENT_PUBKEY,\n SystemProgram,\n Transaction,\n TransactionInstruction,\n} from \"@solana/web3.js\";\nimport type BigNumber from \"bignumber.js\";\nimport { BN } from \"bn.js\";\nimport {\n MPL_METADATA_PROGRAM_ID,\n SINGLE_POOL_PROGRAM_ID,\n STAKE_PROGRAM_ID,\n SYSTEM_PROGRAM_ID,\n SYSVAR_CLOCK_ID,\n SYSVAR_RENT_ID,\n SYSVAR_STAKE_HISTORY_ID,\n} from \"@/constants\";\nimport {TOKEN_PROGRAM_ID} from \"@solana/spl-token\";\n\ninterface AccountMeta {\n pubkey: PublicKey;\n isSigner: boolean;\n isWritable: boolean;\n}\n\n// Instruction type enum\nenum SinglePoolInstructionType {\n InitializePool = 0,\n ReplenishPool,\n DepositStake,\n WithdrawStake,\n CreateTokenMetadata,\n UpdateTokenMetadata,\n InitializeOnRamp,\n}\n\nconst SinglePoolInstruction = {\n initializePool: (voteAccount: PublicKey): TransactionInstruction => {\n const pool = findPoolAddress(voteAccount);\n const stake = findPoolStakeAddress(pool);\n const mint = findPoolMintAddress(pool);\n const stakeAuthority = findPoolStakeAuthorityAddress(pool);\n const mintAuthority = findPoolMintAuthorityAddress(pool);\n\n return createTransactionInstruction(\n SINGLE_POOL_PROGRAM_ID,\n [\n { pubkey: voteAccount, isSigner: false, isWritable: false },\n { pubkey: pool, isSigner: false, isWritable: true },\n { pubkey: stake, isSigner: false, isWritable: true },\n { pubkey: mint, isSigner: false, isWritable: true },\n { pubkey: stakeAuthority, isSigner: false, isWritable: false },\n { pubkey: mintAuthority, isSigner: false, isWritable: false },\n { pubkey: SYSVAR_RENT_ID, isSigner: false, isWritable: false },\n { pubkey: SYSVAR_CLOCK_ID, isSigner: false, isWritable: false },\n { pubkey: SYSVAR_STAKE_HISTORY_ID, isSigner: false, isWritable: false },\n { pubkey: STAKE_CONFIG_ID, isSigner: false, isWritable: false },\n { pubkey: SYSTEM_PROGRAM_ID, isSigner: false, isWritable: false },\n { pubkey: TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },\n { pubkey: STAKE_PROGRAM_ID, isSigner: false, isWritable: false },\n ],\n Buffer.from([SinglePoolInstructionType.InitializePool]),\n );\n },\n\n initializeOnRamp: (pool: PublicKey): TransactionInstruction => {\n const onRamp = findPoolOnRampAddress(pool);\n const stakeAuthority = findPoolStakeAuthorityAddress(pool);\n\n return createTransactionInstruction(\n SINGLE_POOL_PROGRAM_ID,\n [\n { pubkey: pool, isSigner: false, isWritable: false },\n { pubkey: onRamp, isSigner: false, isWritable: true },\n { pubkey: stakeAuthority, isSigner: false, isWritable: false },\n { pubkey: SYSVAR_RENT_ID, isSigner: false, isWritable: false },\n { pubkey: SYSTEM_PROGRAM_ID, isSigner: false, isWritable: false },\n { pubkey: STAKE_PROGRAM_ID, isSigner: false, isWritable: false },\n ],\n Buffer.from([SinglePoolInstructionType.InitializeOnRamp]),\n );\n },\n\n depositStake: async (\n pool: PublicKey,\n userStakeAccount: PublicKey,\n userTokenAccount: PublicKey,\n userLamportAccount: PublicKey,\n ): Promise<TransactionInstruction> => {\n const stake = findPoolStakeAddress(pool);\n const mint = findPoolMintAddress(pool);\n const stakeAuthority = findPoolStakeAuthorityAddress(pool);\n const mintAuthority = findPoolMintAuthorityAddress(pool);\n\n return createTransactionInstruction(\n SINGLE_POOL_PROGRAM_ID,\n [\n { pubkey: pool, isSigner: false, isWritable: false },\n { pubkey: stake, isSigner: false, isWritable: true },\n { pubkey: mint, isSigner: false, isWritable: true },\n { pubkey: stakeAuthority, isSigner: false, isWritable: false },\n { pubkey: mintAuthority, isSigner: false, isWritable: false },\n { pubkey: userStakeAccount, isSigner: false, isWritable: true },\n { pubkey: userTokenAccount, isSigner: false, isWritable: true },\n { pubkey: userLamportAccount, isSigner: false, isWritable: true },\n { pubkey: SYSVAR_CLOCK_ID, isSigner: false, isWritable: false },\n { pubkey: SYSVAR_STAKE_HISTORY_ID, isSigner: false, isWritable: false },\n { pubkey: TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },\n { pubkey: STAKE_PROGRAM_ID, isSigner: false, isWritable: false },\n ],\n Buffer.from([SinglePoolInstructionType.DepositStake]),\n );\n },\n\n withdrawStake: async (\n pool: PublicKey,\n userStakeAccount: PublicKey,\n userStakeAuthority: PublicKey,\n userTokenAccount: PublicKey,\n tokenAmount: BigNumber,\n ): Promise<TransactionInstruction> => {\n const stake = findPoolStakeAddress(pool);\n const mint = findPoolMintAddress(pool);\n const stakeAuthority = findPoolStakeAuthorityAddress(pool);\n const mintAuthority = findPoolMintAuthorityAddress(pool);\n\n // Try using BigInt for more precise conversion\n const rawAmount = BigInt(tokenAmount.multipliedBy(1e9).toString());\n\n const data = Buffer.concat([\n Buffer.from([SinglePoolInstructionType.WithdrawStake]),\n userStakeAuthority.toBuffer(),\n Buffer.from(new BN(rawAmount.toString()).toArray(\"le\", 8)),\n ]);\n\n return createTransactionInstruction(\n SINGLE_POOL_PROGRAM_ID,\n [\n { pubkey: pool, isSigner: false, isWritable: false },\n { pubkey: stake, isSigner: false, isWritable: true },\n { pubkey: mint, isSigner: false, isWritable: true },\n { pubkey: stakeAuthority, isSigner: false, isWritable: false },\n { pubkey: mintAuthority, isSigner: false, isWritable: false },\n { pubkey: userStakeAccount, isSigner: false, isWritable: true },\n { pubkey: userTokenAccount, isSigner: false, isWritable: true },\n { pubkey: SYSVAR_CLOCK_ID, isSigner: false, isWritable: false },\n { pubkey: TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },\n { pubkey: STAKE_PROGRAM_ID, isSigner: false, isWritable: false },\n ],\n data,\n );\n },\n\n createTokenMetadata: async (pool: PublicKey, payer: PublicKey): Promise<TransactionInstruction> => {\n const mint = findPoolMintAddress(pool);\n const [mintAuthority, mplAuthority, mplMetadata] = await Promise.all([\n findPoolMintAuthorityAddress(pool),\n findPoolMplAuthorityAddress(pool),\n findMplMetadataAddress(mint),\n ]);\n\n return createTransactionInstruction(\n SINGLE_POOL_PROGRAM_ID,\n [\n { pubkey: pool, isSigner: false, isWritable: false },\n { pubkey: mint, isSigner: false, isWritable: false },\n { pubkey: mintAuthority, isSigner: false, isWritable: false },\n { pubkey: mplAuthority, isSigner: false, isWritable: false },\n { pubkey: payer, isSigner: true, isWritable: true },\n { pubkey: mplMetadata, isSigner: false, isWritable: true },\n { pubkey: MPL_METADATA_PROGRAM_ID, isSigner: false, isWritable: false },\n { pubkey: SYSTEM_PROGRAM_ID, isSigner: false, isWritable: false },\n ],\n Buffer.from([SinglePoolInstructionType.CreateTokenMetadata]),\n );\n },\n\n updateTokenMetadata: async (\n voteAccount: PublicKey,\n authorizedWithdrawer: PublicKey,\n tokenName: string,\n tokenSymbol: string,\n tokenUri: string = \"\",\n ): Promise<TransactionInstruction> => {\n if (tokenName.length > 32) {\n throw new Error(\"maximum token name length is 32 characters\");\n }\n if (tokenSymbol.length > 10) {\n throw new Error(\"maximum token symbol length is 10 characters\");\n }\n if (tokenUri.length > 200) {\n throw new Error(\"maximum token uri length is 200 characters\");\n }\n\n const pool = findPoolAddress(voteAccount);\n const [mint, mplAuthority] = await Promise.all([findPoolMintAddress(pool), findPoolMplAuthorityAddress(pool)]);\n const mplMetadata = await findMplMetadataAddress(mint);\n\n const data = Buffer.concat([\n Buffer.from([SinglePoolInstructionType.UpdateTokenMetadata]),\n Buffer.from(new Uint32Array([tokenName.length]).buffer),\n Buffer.from(tokenName),\n Buffer.from(new Uint32Array([tokenSymbol.length]).buffer),\n Buffer.from(tokenSymbol),\n Buffer.from(new Uint32Array([tokenUri.length]).buffer),\n Buffer.from(tokenUri),\n ]);\n\n return createTransactionInstruction(\n SINGLE_POOL_PROGRAM_ID,\n [\n { pubkey: voteAccount, isSigner: false, isWritable: false },\n { pubkey: pool, isSigner: false, isWritable: false },\n { pubkey: mplAuthority, isSigner: false, isWritable: false },\n { pubkey: authorizedWithdrawer, isSigner: true, isWritable: false },\n { pubkey: mplMetadata, isSigner: false, isWritable: true },\n { pubkey: MPL_METADATA_PROGRAM_ID, isSigner: false, isWritable: false },\n ],\n data,\n );\n },\n};\n\nconst createTransactionInstruction = (\n programId: PublicKey,\n keys: AccountMeta[],\n data: Buffer,\n): TransactionInstruction => {\n return {\n programId,\n keys,\n data,\n };\n};\n\nconst findPda = (baseAddress: PublicKey, prefix: string, programId: PublicKey = SINGLE_POOL_PROGRAM_ID): PublicKey => {\n const [pda] = PublicKey.findProgramAddressSync([Buffer.from(prefix), baseAddress.toBuffer()], programId);\n return pda;\n};\n\nconst findPoolMintAddressByVoteAccount = (voteAccountAddress: PublicKey): PublicKey =>\n findPda(findPoolAddress(voteAccountAddress), \"mint\");\nconst findPoolAddress = (voteAccountAddress: PublicKey): PublicKey => findPda(voteAccountAddress, \"pool\");\nconst findPoolMintAddress = (poolAddress: PublicKey): PublicKey => findPda(poolAddress, \"mint\");\nconst findPoolStakeAddress = (poolAddress: PublicKey): PublicKey => findPda(poolAddress, \"stake\");\nconst findPoolStakeAuthorityAddress = (poolAddress: PublicKey): PublicKey => findPda(poolAddress, \"stake_authority\");\nconst findPoolMintAuthorityAddress = (poolAddress: PublicKey): PublicKey => findPda(poolAddress, \"mint_authority\");\nconst findPoolMplAuthorityAddress = (poolAddress: PublicKey): PublicKey => findPda(poolAddress, \"mpl_authority\");\nconst findPoolOnRampAddress = (poolAddress: PublicKey): PublicKey => findPda(poolAddress, \"onramp\");\n\nconst findMplMetadataAddress = async (poolMintAddress: PublicKey): Promise<PublicKey> => {\n const [pda] = PublicKey.findProgramAddressSync(\n [Buffer.from(\"metadata\"), MPL_METADATA_PROGRAM_ID.toBuffer(), poolMintAddress.toBuffer()],\n MPL_METADATA_PROGRAM_ID,\n );\n return pda;\n};\n\nconst SINGLE_POOL_ACCOUNT_SIZE = BigInt(33);\nconst STAKE_ACCOUNT_SIZE = BigInt(200);\nconst MINT_SIZE = BigInt(82);\n\nasync function initializeStakedPoolTx(connection: Connection, payer: PublicKey, voteAccountAddress: PublicKey) {\n const instructions = await initializeStakedPoolIxs(connection, payer, voteAccountAddress);\n const tx = new Transaction().add(...instructions);\n return tx;\n}\n\nasync function initializeStakedPoolIxs(connection: Connection, payer: PublicKey, voteAccountAddress: PublicKey) {\n const poolAddress = findPoolAddress(voteAccountAddress);\n\n const stakeAddress = findPoolStakeAddress(poolAddress);\n const mintAddress = findPoolMintAddress(poolAddress);\n const onRampAddress = findPoolOnRampAddress(poolAddress);\n\n // get min rent\n const [poolRent, stakeRent, mintRent, minimumDelegationObj] = await Promise.all([\n connection.getMinimumBalanceForRentExemption(Number(SINGLE_POOL_ACCOUNT_SIZE), \"confirmed\"),\n connection.getMinimumBalanceForRentExemption(Number(STAKE_ACCOUNT_SIZE), \"confirmed\"),\n connection.getMinimumBalanceForRentExemption(Number(MINT_SIZE), \"confirmed\"),\n connection.getStakeMinimumDelegation(),\n ]);\n\n const minimumDelegation = minimumDelegationObj.value;\n\n const instructions: TransactionInstruction[] = [];\n\n // instructions\n instructions.push(SystemProgram.transfer({ fromPubkey: payer, toPubkey: poolAddress, lamports: poolRent }));\n instructions.push(\n SystemProgram.transfer({\n fromPubkey: payer,\n toPubkey: stakeAddress,\n lamports: stakeRent + minimumDelegation + LAMPORTS_PER_SOL * 1,\n }),\n );\n instructions.push(SystemProgram.transfer({ fromPubkey: payer, toPubkey: onRampAddress, lamports: stakeRent }));\n instructions.push(SystemProgram.transfer({ fromPubkey: payer, toPubkey: mintAddress, lamports: mintRent }));\n\n instructions.push(SinglePoolInstruction.initializePool(voteAccountAddress));\n instructions.push(SinglePoolInstruction.initializeOnRamp(poolAddress));\n instructions.push(await SinglePoolInstruction.createTokenMetadata(poolAddress, payer));\n\n return instructions;\n}\n\nconst createAccountIx = (\n from: PublicKey,\n newAccount: PublicKey,\n lamports: number,\n space: number,\n programAddress: PublicKey,\n) => {\n const data = Buffer.concat([\n Buffer.from([0]), // Assuming the first byte is an instruction type or similar\n Buffer.from(new BN(lamports).toArray(\"le\", 8)),\n Buffer.from(new BN(space).toArray(\"le\", 8)),\n programAddress.toBuffer(),\n ]);\n\n const accounts = [\n { pubkey: from, isSigner: true, isWritable: true },\n { pubkey: newAccount, isSigner: true, isWritable: true },\n ];\n\n return createTransactionInstruction(SYSTEM_PROGRAM_ID, accounts, data);\n};\n\nconst createPoolOnrampIx = (voteAccount: PublicKey): TransactionInstruction => {\n const poolAccount = findPoolAddress(voteAccount);\n const onRampAccount = findPoolOnRampAddress(poolAccount);\n const poolStakeAuthority = findPoolStakeAuthorityAddress(poolAccount);\n\n const keys = [\n { pubkey: poolAccount, isSigner: false, isWritable: false },\n { pubkey: onRampAccount, isSigner: false, isWritable: true },\n { pubkey: poolStakeAuthority, isSigner: false, isWritable: false },\n { pubkey: SYSVAR_RENT_PUBKEY, isSigner: false, isWritable: false },\n { pubkey: SystemProgram.programId, isSigner: false, isWritable: false },\n { pubkey: StakeProgram.programId, isSigner: false, isWritable: false },\n ];\n\n // TODO don't hard code the instruction index? (or why not, it's not gna change is it?)\n const data = Buffer.from(Uint8Array.of(6));\n\n return new TransactionInstruction({\n keys,\n programId: SINGLE_POOL_PROGRAM_ID,\n data,\n });\n};\n\nconst replenishPoolIx = (voteAccount: PublicKey): TransactionInstruction => {\n const poolAccount = findPoolAddress(voteAccount);\n const stakePool = findPoolStakeAddress(poolAccount);\n const onRampPool = findPoolOnRampAddress(poolAccount);\n const authority = findPoolStakeAuthorityAddress(poolAccount);\n\n const keys = [\n { pubkey: voteAccount, isSigner: false, isWritable: false },\n { pubkey: poolAccount, isSigner: false, isWritable: false },\n { pubkey: stakePool, isSigner: false, isWritable: true },\n { pubkey: onRampPool, isSigner: false, isWritable: true },\n { pubkey: authority, isSigner: false, isWritable: false },\n { pubkey: SYSVAR_CLOCK_PUBKEY, isSigner: false, isWritable: false },\n { pubkey: SYSVAR_STAKE_HISTORY_ID, isSigner: false, isWritable: false },\n { pubkey: STAKE_CONFIG_ID, isSigner: false, isWritable: false },\n { pubkey: StakeProgram.programId, isSigner: false, isWritable: false },\n ];\n\n // TODO don't hard code the instruction index? (or why not, it's not gna change is it?)\n const data = Buffer.from(Uint8Array.of(1));\n\n return createTransactionInstruction(SINGLE_POOL_PROGRAM_ID, keys, data);\n};\n\nexport {\n SinglePoolInstruction,\n initializeStakedPoolIxs,\n initializeStakedPoolTx,\n findPoolAddress,\n findPoolMintAddress,\n findPoolStakeAddress,\n findPoolStakeAuthorityAddress,\n findPoolMintAuthorityAddress,\n findPoolMplAuthorityAddress,\n findMplMetadataAddress,\n findPoolOnRampAddress,\n findPoolMintAddressByVoteAccount,\n createAccountIx,\n createPoolOnrampIx,\n replenishPoolIx,\n};\n","import * as anchor from \"@coral-xyz/anchor\";\n\nexport class Account {\n program;\n publicKey;\n /**\n * Account constructor\n * @param program SwitchboardProgram\n * @param publicKey PublicKey of the on-chain resource\n */\n constructor(program: any, publicKey: anchor.web3.PublicKey) {\n this.program = program;\n this.publicKey = typeof publicKey === \"string\" ? new anchor.web3.PublicKey(publicKey) : publicKey;\n }\n}\nexport const BUFFER_DISCRIMINATOR = Buffer.from([\n 66,\n 85,\n 70,\n 70,\n 69,\n 82,\n 120,\n 120, // BUFFERxx\n]);\n","import { Account } from \"./account\";\n\nexport class AggregatorAccount extends Account {\n static decodeLatestValue(aggregator: { latestConfirmedRound: { numSuccess: any; result: { toBig: () => any } } }) {\n if ((aggregator.latestConfirmedRound?.numSuccess ?? 0) === 0) {\n return null;\n }\n const result = aggregator.latestConfirmedRound.result.toBig();\n return result;\n }\n}\n","import * as borsh from \"@coral-xyz/borsh\";\n\nexport class ModeRoundResolution {\n static discriminator = 0;\n static kind = \"ModeRoundResolution\";\n discriminator = 0;\n kind = \"ModeRoundResolution\";\n toJSON() {\n return {\n kind: \"ModeRoundResolution\",\n };\n }\n toEncodable() {\n return {\n ModeRoundResolution: {},\n };\n }\n}\nexport class ModeSlidingResolution {\n static discriminator = 1;\n static kind = \"ModeSlidingResolution\";\n discriminator = 1;\n kind = \"ModeSlidingResolution\";\n toJSON() {\n return {\n kind: \"ModeSlidingResolution\",\n };\n }\n toEncodable() {\n return {\n ModeSlidingResolution: {},\n };\n }\n}\nexport function fromDecoded(obj: any) {\n if (typeof obj !== \"object\") {\n throw new Error(\"Invalid enum object\");\n }\n if (\"ModeRoundResolution\" in obj) {\n return new ModeRoundResolution();\n }\n if (\"ModeSlidingResolution\" in obj) {\n return new ModeSlidingResolution();\n }\n throw new Error(\"Invalid enum object\");\n}\nexport function fromJSON(obj: any) {\n switch (obj.kind) {\n case \"ModeRoundResolution\": {\n return new ModeRoundResolution();\n }\n case \"ModeSlidingResolution\": {\n return new ModeSlidingResolution();\n }\n }\n}\nexport function layout(property: any) {\n const ret = borsh.rustEnum([borsh.struct([], \"ModeRoundResolution\"), borsh.struct([], \"ModeSlidingResolution\")]);\n if (property !== undefined) {\n return ret.replicate(property);\n }\n return ret;\n}\n","import * as borsh from \"@coral-xyz/borsh\";\nimport Big from \"big.js\";\nimport BN from \"bn.js\";\n\n// import { Big, BN } from \"@switchboard-xyz/common\"; // eslint-disable-line @typescript-eslint/no-unused-vars\nexport class SwitchboardDecimal {\n /**\n * The part of a floating-point number that represents the significant digits of that number,\n * and that is multiplied by the base, 10, raised to the power of scale to give the actual value of the number.\n */\n mantissa;\n /** The number of decimal places to move to the left to yield the actual value. */\n scale;\n constructor(fields: { mantissa: any; scale: any }) {\n this.mantissa = fields.mantissa;\n this.scale = fields.scale;\n }\n static layout(property: any) {\n return borsh.struct([borsh.i128(\"mantissa\"), borsh.u32(\"scale\")], property);\n }\n static fromDecoded(obj: { mantissa: any; scale: any }) {\n return new SwitchboardDecimal({\n mantissa: obj.mantissa,\n scale: obj.scale,\n });\n }\n static toEncodable(fields: any) {\n return {\n mantissa: fields.mantissa,\n scale: fields.scale,\n };\n }\n toJSON() {\n return {\n mantissa: this.mantissa.toString(),\n scale: this.scale,\n };\n }\n static fromJSON(obj: { mantissa: string | number | BN | number[] | Uint8Array | Buffer; scale: any }) {\n return new SwitchboardDecimal({\n mantissa: new BN(obj.mantissa),\n scale: obj.scale,\n });\n }\n // toEncodable() {\n // return SwitchboardDecimal.toEncodable(this);\n // }\n /**\n * Convert untyped object to a Switchboard decimal, if possible.\n * @param obj raw object to convert from\n * @return SwitchboardDecimal\n */\n static from(obj: { mantissa: string | number | BN | number[] | Uint8Array | Buffer; scale: any }) {\n return new SwitchboardDecimal({\n mantissa: new BN(obj.mantissa),\n scale: obj.scale,\n });\n }\n /**\n * Convert a Big.js decimal to a Switchboard decimal.\n * @param big a Big.js decimal\n * @return a SwitchboardDecimal\n */\n static fromBig(big: {\n round: (arg0: number) => any;\n c: {\n join: (arg0: string) => string | number | BN | number[] | Uint8Array | Buffer;\n slice: (arg0: number) => { (): any; new (): any; length: number };\n };\n e: number;\n s: string | number | BN | number[] | Uint8Array | Buffer;\n // sub: (arg0: Big) => {\n // (): any;\n // new (): any;\n // abs: {\n // (): { (): any; new (): any; gt: { (arg0: Big): any; new (): any } };\n // new (): any;\n // };\n // };\n toNumber: () => any;\n }) {\n // Round to fit in Switchboard Decimal\n // TODO: smarter logic.\n big = big.round(20);\n let mantissa = new BN(big.c.join(\"\"), 10);\n // Set the scale. Big.exponenet sets scale from the opposite side\n // SwitchboardDecimal does.\n let scale = big.c.slice(1).length - big.e;\n if (scale < 0) {\n mantissa = mantissa.mul(new BN(10, 10).pow(new BN(Math.abs(scale), 10)));\n scale = 0;\n }\n if (scale < 0) {\n throw new Error(\"SwitchboardDecimal: Unexpected negative scale.\");\n }\n if (scale >= 28) {\n throw new Error(\"SwitchboardDecimalExcessiveScaleError\");\n }\n // Set sign for the coefficient (mantissa)\n mantissa = mantissa.mul(new BN(big.s, 10));\n const result = new SwitchboardDecimal({ mantissa, scale });\n // if (big.sub(result.toBig()).abs().gt(new Big(0.00005))) {\n // throw new Error(\n // \"SwitchboardDecimal: Converted decimal does not match original:\\n\" +\n // `out: ${result.toBig().toNumber()} vs in: ${big.toNumber()}\\n` +\n // `-- result mantissa and scale: ${result.mantissa.toString()} ${result.scale.toString()}\\n` +\n // `${result} ${result.toBig()}`\n // );\n // }\n return result;\n }\n /**\n * SwitchboardDecimal equality comparator.\n * @param other object to compare to.\n * @return true iff equal\n */\n eq(other: { mantissa: any; scale: any }) {\n return this.mantissa.eq(other.mantissa) && this.scale === other.scale;\n }\n /**\n * Convert SwitchboardDecimal to big.js Big type.\n * @return Big representation\n */\n toBig() {\n let mantissa = new BN(this.mantissa, 10);\n let s = 1;\n const c: Array<number> = [];\n const ZERO = new BN(0, 10);\n const TEN = new BN(10, 10);\n if (mantissa.lt(ZERO)) {\n s = -1;\n mantissa = mantissa.abs();\n }\n while (mantissa.gt(ZERO)) {\n c.unshift(mantissa.mod(TEN).toNumber());\n mantissa = mantissa.div(TEN);\n }\n const e = c.length - this.scale - 1;\n const result = new Big(0);\n if (c.length === 0) {\n return result;\n }\n result.s = s;\n result.c = c;\n result.e = e;\n return result;\n }\n // toString() {\n // return this.toBig().toString();\n // }\n}\n","// import * as types from \"../types/index.js\"; // eslint-disable-line @typescript-eslint/no-unused-vars\n\nimport BN from \"bn.js\"\nimport * as borsh from \"@coral-xyz/borsh\";\nimport { PublicKey, type PublicKeyInitData } from \"@solana/web3.js\";\n// import { BN } from \"@switchboard-xyz/common\"; // eslint-disable-line @typescript-eslint/no-unused-vars\nimport { SwitchboardDecimal } from \"./switchboardDecimal\";\n\nexport class AggregatorRound {\n /**\n * Maintains the number of successful responses received from nodes.\n * Nodes can submit one successful response per round.\n */\n numSuccess;\n /** Number of error responses. */\n numError;\n /** Whether an update request round has ended. */\n isClosed;\n /** Maintains the `solana_program::clock::Slot` that the round was opened at. */\n roundOpenSlot;\n /** Maintains the `solana_program::clock::UnixTimestamp;` the round was opened at. */\n roundOpenTimestamp;\n /** Maintains the current median of all successful round responses. */\n result;\n /** Standard deviation of the accepted results in the round. */\n stdDeviation;\n /** Maintains the minimum node response this round. */\n minResponse;\n /** Maintains the maximum node response this round. */\n maxResponse;\n /** Pubkeys of the oracles fulfilling this round. */\n oraclePubkeysData;\n /** Represents all successful node responses this round. `NaN` if empty. */\n mediansData;\n /** Current rewards/slashes oracles have received this round. */\n currentPayout;\n /** Keep track of which responses are fulfilled here. */\n mediansFulfilled;\n /** Keeps track of which errors are fulfilled here. */\n errorsFulfilled;\n constructor(fields: any) {\n this.numSuccess = fields.numSuccess;\n this.numError = fields.numError;\n this.isClosed = fields.isClosed;\n this.roundOpenSlot = fields.roundOpenSlot;\n this.roundOpenTimestamp = fields.roundOpenTimestamp;\n this.result = new SwitchboardDecimal({ ...fields.result });\n this.stdDeviation = new SwitchboardDecimal({\n ...fields.stdDeviation,\n });\n this.minResponse = new SwitchboardDecimal({ ...fields.minResponse });\n this.maxResponse = new SwitchboardDecimal({ ...fields.maxResponse });\n this.oraclePubkeysData = fields.oraclePubkeysData;\n this.mediansData = fields.mediansData.map((item: any) => new SwitchboardDecimal({ ...item }));\n this.currentPayout = fields.currentPayout;\n this.mediansFulfilled = fields.mediansFulfilled;\n this.errorsFulfilled = fields.errorsFulfilled;\n }\n static layout(property: any) {\n return borsh.struct(\n [\n borsh.u32(\"numSuccess\"),\n borsh.u32(\"numError\"),\n borsh.bool(\"isClosed\"),\n borsh.u64(\"roundOpenSlot\"),\n borsh.i64(\"roundOpenTimestamp\"),\n SwitchboardDecimal.layout(\"result\"),\n SwitchboardDecimal.layout(\"stdDeviation\"),\n SwitchboardDecimal.layout(\"minResponse\"),\n SwitchboardDecimal.layout(\"maxResponse\"),\n borsh.array(borsh.publicKey(), 16, \"oraclePubkeysData\"),\n borsh.array(SwitchboardDecimal.layout({}), 16, \"mediansData\"),\n borsh.array(borsh.i64(), 16, \"currentPayout\"),\n borsh.array(borsh.bool(), 16, \"mediansFulfilled\"),\n borsh.array(borsh.bool(), 16, \"errorsFulfilled\"),\n ],\n property,\n );\n }\n static fromDecoded(obj: any) {\n return new AggregatorRound({\n numSuccess: obj.numSuccess,\n numError: obj.numError,\n isClosed: obj.isClosed,\n roundOpenSlot: obj.roundOpenSlot,\n roundOpenTimestamp: obj.roundOpenTimestamp,\n result: SwitchboardDecimal.fromDecoded(obj.result),\n stdDeviation: SwitchboardDecimal.fromDecoded(obj.stdDeviation),\n minResponse: SwitchboardDecimal.fromDecoded(obj.minResponse),\n maxResponse: SwitchboardDecimal.fromDecoded(obj.maxResponse),\n oraclePubkeysData: obj.oraclePubkeysData,\n mediansData: obj.mediansData.map((item: any) => SwitchboardDecimal.fromDecoded(item)),\n currentPayout: obj.currentPayout,\n mediansFulfilled: obj.mediansFulfilled,\n errorsFulfilled: obj.errorsFulfilled,\n });\n }\n static toEncodable(fields: any) {\n return {\n numSuccess: fields.numSuccess,\n numError: fields.numError,\n isClosed: fields.isClosed,\n roundOpenSlot: fields.roundOpenSlot,\n roundOpenTimestamp: fields.roundOpenTimestamp,\n result: SwitchboardDecimal.toEncodable(fields.result),\n stdDeviation: SwitchboardDecimal.toEncodable(fields.stdDeviation),\n minResponse: SwitchboardDecimal.toEncodable(fields.minResponse),\n maxResponse: SwitchboardDecimal.toEncodable(fields.maxResponse),\n oraclePubkeysData: fields.oraclePubkeysData,\n mediansData: fields.mediansData.map((item: any) => SwitchboardDecimal.toEncodable(item)),\n currentPayout: fields.currentPayout,\n mediansFulfilled: fields.mediansFulfilled,\n errorsFulfilled: fields.errorsFulfilled,\n };\n }\n toJSON() {\n return {\n numSuccess: this.numSuccess,\n numError: this.numError,\n isClosed: this.isClosed,\n roundOpenSlot: this.roundOpenSlot.toString(),\n roundOpenTimestamp: this.roundOpenTimestamp.toString(),\n result: this.result.toJSON(),\n stdDeviation: this.stdDeviation.toJSON(),\n minResponse: this.minResponse.toJSON(),\n maxResponse: this.maxResponse.toJSON(),\n oraclePubkeysData: this.oraclePubkeysData.map((item: any) => item.toString()),\n mediansData: this.mediansData.map((item: any) => item.toJSON()),\n currentPayout: this.currentPayout.map((item: any) => item.toString()),\n mediansFulfilled: this.mediansFulfilled,\n errorsFulfilled: this.errorsFulfilled,\n };\n }\n static fromJSON(obj: any) {\n return new AggregatorRound({\n numSuccess: obj.numSuccess,\n numError: obj.numError,\n isClosed: obj.isClosed,\n roundOpenSlot: new BN(obj.roundOpenSlot),\n roundOpenTimestamp: new BN(obj.roundOpenTimestamp),\n result: SwitchboardDecimal.fromJSON(obj.result),\n stdDeviation: SwitchboardDecimal.fromJSON(obj.stdDeviation),\n minResponse: SwitchboardDecimal.fromJSON(obj.minResponse),\n maxResponse: SwitchboardDecimal.fromJSON(obj.maxResponse),\n oraclePubkeysData: obj.oraclePubkeysData.map((item: PublicKeyInitData) => new PublicKey(item)),\n mediansData: obj.mediansData.map(\n (item: { mantissa: string | number | BN | number[] | Uint8Array | Buffer; scale: any }) =>\n SwitchboardDecimal.fromJSON(item),\n ),\n currentPayout: obj.currentPayout.map(\n (item: string | number | BN | number[] | Uint8Array | Buffer) => new BN(item),\n ),\n mediansFulfilled: obj.mediansFulfilled,\n errorsFulfilled: obj.errorsFulfilled,\n });\n }\n toEncodable() {\n return AggregatorRound.toEncodable(this);\n }\n}\n","import * as borsh from \"@coral-xyz/borsh\";\n\nexport class Hash {\n /** The bytes used to derive the hash. */\n data;\n constructor(fields: { data: any }) {\n this.data = fields.data;\n }\n static layout(property: any) {\n return borsh.struct([borsh.array(borsh.u8(), 32, \"data\")], property);\n }\n static fromDecoded(obj: { data: any }) {\n return new Hash({\n data: obj.data,\n });\n }\n static toEncodable(fields: any) {\n return {\n data: fields.data,\n };\n }\n toJSON() {\n return {\n data: this.data,\n };\n }\n static fromJSON(obj: { data: any }) {\n return new Hash({\n data: obj.data,\n });\n }\n toEncodable() {\n return Hash.toEncodable(this);\n }\n}\n","import * as borsh from \"@coral-xyz/borsh\";\nimport * as AggregatorResolutionMode from \"./AggregatorResolutionMode\";\nimport { AggregatorRound } from \"./aggregatorRound\";\nimport { Hash } from \"./Hash\";\nimport { SwitchboardDecimal } from \"./switchboardDecimal\";\n\nexport class AggregatorAccountData {\n /** Name of the aggregator to store on-chain. */\n name;\n /** Metadata of the aggregator to store on-chain. */\n metadata;\n /** Reserved. */\n reserved1;\n /** Pubkey of the queue the aggregator belongs to. */\n queuePubkey;\n /**\n * CONFIGS\n * Number of oracles assigned to an update request.\n */\n oracleRequestBatchSize;\n /** Minimum number of oracle responses required before a round is validated. */\n minOracleResults;\n /** Minimum number of job results before an oracle accepts a result. */\n minJobResults;\n /** Minimum number of seconds required between aggregator rounds. */\n minUpdateDelaySeconds;\n /** Unix timestamp for which no feed update will occur before. */\n startAfter;\n /** Change percentage required between a previous round and the current round. If variance percentage is not met, reject new oracle responses. */\n varianceThreshold;\n /** Number of seconds for which, even if the variance threshold is not passed, accept new responses from oracles. */\n forceReportPeriod;\n /** Timestamp when the feed is no longer needed. */\n expiration;\n /** Counter for the number of consecutive failures before a feed is removed from a queue. If set to 0, failed feeds will remain on the queue. */\n consecutiveFailureCount;\n /** Timestamp when the next update request will be available. */\n nextAllowedUpdateTime;\n /** Flag for whether an aggregators configuration is locked for editing. */\n isLocked;\n /** Optional, public key of the crank the aggregator is currently using. Event based feeds do not need a crank. */\n crankPubkey;\n /** Latest confirmed update request result that has been accepted as valid. */\n latestConfirmedRound;\n /** Oracle results from the current round of update request that has not been accepted as valid yet. */\n currentRound;\n /** List of public keys containing the job definitions for how data is sourced off-chain by oracles. */\n jobPubkeysData;\n /** Used to protect against malicious RPC nodes providing incorrect task definitions to oracles before fulfillment. */\n jobHashes;\n /** Number of jobs assigned to an oracle. */\n jobPubkeysSize;\n /** Used to protect against malicious RPC nodes providing incorrect task definitions to oracles before fulfillment. */\n jobsChecksum;\n /** The account delegated as the authority for making account changes. */\n authority;\n /** Optional, public key of a history buffer account storing the last N accepted results and their timestamps. */\n historyBuffer;\n /** The previous confirmed round result. */\n previousConfirmedRoundResult;\n /** The slot when the previous confirmed round was opened. */\n previousConfirmedRoundSlot;\n /** Whether an aggregator is permitted to join a crank. */\n disableCrank;\n /** Job weights used for the weighted median of the aggregator's assigned job accounts. */\n jobWeights;\n /** Unix timestamp when the feed was created. */\n creationTimestamp;\n /**\n * Use sliding window or round based resolution\n * NOTE: This changes result propogation in latest_round_result\n */\n resolutionMode;\n basePriorityFee;\n priorityFeeBump;\n priorityFeeBumpPeriod;\n maxPriorityFeeMultiplier;\n /** Reserved for future info. */\n ebuf;\n static discriminator = Buffer.from([217, 230, 65, 101, 201, 162, 27, 125]);\n static layout = borsh.struct([\n borsh.array(borsh.u8(), 32, \"name\"),\n borsh.array(borsh.u8(), 128, \"metadata\"),\n borsh.array(borsh.u8(), 32, \"reserved1\"),\n borsh.publicKey(\"queuePubkey\"),\n borsh.u32(\"oracleRequestBatchSize\"),\n borsh.u32(\"minOracleResults\"),\n borsh.u32(\"minJobResults\"),\n borsh.u32(\"minUpdateDelaySeconds\"),\n borsh.i64(\"startAfter\"),\n SwitchboardDecimal.layout(\"varianceThreshold\"),\n borsh.i64(\"forceReportPeriod\"),\n borsh.i64(\"expiration\"),\n borsh.u64(\"consecutiveFailureCount\"),\n borsh.i64(\"nextAllowedUpdateTime\"),\n borsh.bool(\"isLocked\"),\n borsh.publicKey(\"crankPubkey\"),\n AggregatorRound.layout(\"latestConfirmedRound\"),\n AggregatorRound.layout(\"currentRound\"),\n borsh.array(borsh.publicKey(), 16, \"jobPubkeysData\"),\n borsh.array(Hash.layout({}), 16, \"jobHashes\"),\n borsh.u32(\"jobPubkeysSize\"),\n borsh.array(borsh.u8(), 32, \"jobsChecksum\"),\n borsh.publicKey(\"authority\"),\n borsh.publicKey(\"historyBuffer\"),\n SwitchboardDecimal.layout(\"previousConfirmedRoundResult\"),\n borsh.u64(\"previousConfirmedRoundSlot\"),\n borsh.bool(\"disableCrank\"),\n borsh.array(borsh.u8(), 16, \"jobWeights\"),\n borsh.i64(\"creationTimestamp\"),\n AggregatorResolutionMode.layout(\"resolutionMode\"),\n borsh.u32(\"basePriorityFee\"),\n borsh.u32(\"priorityFeeBump\"),\n borsh.u32(\"priorityFeeBumpPeriod\"),\n borsh.u32(\"maxPriorityFeeMultiplier\"),\n borsh.array(borsh.u8(), 122, \"ebuf\"),\n ]);\n constructor(fields: any) {\n this.name = fields.name;\n this.metadata = fields.metadata;\n this.reserved1 = fields.reserved1;\n this.queuePubkey = fields.queuePubkey;\n this.oracleRequestBatchSize = fields.oracleRequestBatchSize;\n this.minOracleResults = fields.minOracleResults;\n this.minJobResults = fields.minJobResults;\n this.minUpdateDelaySeconds = fields.minUpdateDelaySeconds;\n this.startAfter = fields.startAfter;\n this.varianceThreshold = new SwitchboardDecimal({\n ...fields.varianceThreshold,\n });\n this.forceReportPeriod = fields.forceReportPeriod;\n this.expiration = fields.expiration;\n this.consecutiveFailureCount = fields.consecutiveFailureCount;\n this.nextAllowedUpdateTime = fields.nextAllowedUpdateTime;\n this.isLocked = fields.isLocked;\n this.crankPubkey = fields.crankPubkey;\n this.latestConfirmedRound = new AggregatorRound({\n ...fields.latestConfirmedRound,\n });\n this.currentRound = new AggregatorRound({ ...fields.currentRound });\n this.jobPubkeysData = fields.jobPubkeysData;\n this.jobHashes = fields.jobHashes.map((item: any) => new Hash({ ...item }));\n this.jobPubkeysSize = fields.jobPubkeysSize;\n this.jobsChecksum = fields.jobsChecksum;\n this.authority = fields.authority;\n this.historyBuffer = fields.historyBuffer;\n this.previousConfirmedRoundResult = new SwitchboardDecimal({\n ...fields.previousConfirmedRoundResult,\n });\n this.previousConfirmedRoundSlot = fields.previousConfirmedRoundSlot;\n this.disableCrank = fields.disableCrank;\n this.jobWeights = fields.jobWeights;\n this.creationTimestamp = fields.creationTimestamp;\n this.resolutionMode = fields.resolutionMode;\n this.basePriorityFee = fields.basePriorityFee;\n this.priorityFeeBump = fields.priorityFeeBump;\n this.priorityFeeBumpPeriod = fields.priorityFeeBumpPeriod;\n this.maxPriorityFeeMultiplier = fields.maxPriorityFeeMultiplier;\n this.ebuf = fields.ebuf;\n }\n static decode(data: any) {\n if (!data.slice(0, 8).equals(AggregatorAccountData.discriminator)) {\n throw new Error(\"invalid account discriminator\");\n }\n const dec = AggregatorAccountData.layout.decode(data.slice(8));\n return new AggregatorAccountData({\n name: dec.name,\n metadata: dec.metadata,\n reserved1: dec.reserved1,\n queuePubkey: dec.queuePubkey,\n oracleRequestBatchSize: dec.oracleRequestBatchSize,\n minOracleResults: dec.minOracleResults,\n minJobResults: dec.minJobResults,\n minUpdateDelaySeconds: dec.minUpdateDelaySeconds,\n startAfter: dec.startAfter,\n varianceThreshold: SwitchboardDecimal.fromDecoded(dec.varianceThreshold),\n forceReportPeriod: dec.forceReportPeriod,\n expiration: dec.expiration,\n consecutiveFailureCount: dec.consecutiveFailureCount,\n nextAllowedUpdateTime: dec.nextAllowedUpdateTime,\n isLocked: dec.isLocked,\n crankPubkey: dec.crankPubkey,\n latestConfirmedRound: AggregatorRound.fromDecoded(dec.latestConfirmedRound),\n currentRound: AggregatorRound.fromDecoded(dec.currentRound),\n jobPubkeysData: dec.jobPubkeysData,\n jobHashes: dec.jobHashes.map((item: any) => Hash.fromDecoded(item)),\n jobPubkeysSize: dec.jobPubkeysSize,\n jobsChecksum: dec.jobsChecksum,\n authority: dec.authority,\n historyBuffer: dec.historyBuffer,\n previousConfirmedRoundResult: SwitchboardDecimal.fromDecoded(dec.previousConfirmedRoundResult),\n previousConfirmedRoundSlot: dec.previousConfirmedRoundSlot,\n disableCrank: dec.disableCrank,\n jobWeights: dec.jobWeights,\n creationTimestamp: dec.creationTimestamp,\n resolutionMode: AggregatorResolutionMode.fromDecoded(dec.resolutionMode),\n basePriorityFee: dec.basePriorityFee,\n priorityFeeBump: dec.priorityFeeBump,\n priorityFeeBumpPeriod: dec.priorityFeeBumpPeriod,\n maxPriorityFeeMultiplier: dec.maxPriorityFeeMultiplier,\n ebuf: dec.ebuf,\n });\n }\n}\n","{\n \"address\": \"SBondMDrcV3K4kxZR1HNVT7osZxAHVHgYXL5Ze1oMUv\",\n \"metadata\": {\n \"name\": \"sb_on_demand\",\n \"version\": \"0.1.0\",\n \"spec\": \"0.1.0\",\n \"description\": \"Created with Anchor\"\n },\n \"instructions\": [\n {\n \"name\": \"guardian_quote_verify\",\n \"discriminator\": [168, 36, 93, 156, 157, 150, 148, 45],\n \"accounts\": [\n {\n \"name\": \"guardian\",\n \"writable\": true\n },\n {\n \"name\": \"oracle\",\n \"writable\": true\n },\n {\n \"name\": \"authority\",\n \"signer\": true,\n \"relations\": [\"oracle\"]\n },\n {\n \"name\": \"guardian_queue\",\n \"writable\": true,\n \"relations\": [\"state\"]\n },\n {\n \"name\": \"state\"\n },\n {\n \"name\": \"recent_slothashes\",\n \"address\": \"SysvarS1otHashes111111111111111111111111111\"\n }\n ],\n \"args\": [\n {\n \"name\": \"params\",\n \"type\": {\n \"defined\": {\n \"name\": \"GuardianQuoteVerifyParams\"\n }\n }\n }\n ]\n },\n {\n \"name\": \"guardian_register\",\n \"discriminator\": [159, 76, 53, 117, 219, 29, 116, 135],\n \"accounts\": [\n {\n \"name\": \"oracle\",\n \"writable\": true\n },\n {\n \"name\": \"state\"\n },\n {\n \"name\": \"guardian_queue\",\n \"relations\": [\"state\"]\n },\n {\n \"name\": \"authority\",\n \"signer\": true,\n \"relations\": [\"state\"]\n }\n ],\n \"args\": [\n {\n \"name\": \"params\",\n \"type\": {\n \"defined\": {\n \"name\": \"GuardianRegisterParams\"\n }\n }\n }\n ]\n },\n {\n \"name\": \"guardian_unregister\",\n \"discriminator\": [215, 19, 61, 120, 155, 224, 120, 60],\n \"accounts\": [\n {\n \"name\": \"oracle\",\n \"writable\": true\n },\n {\n \"name\": \"state\"\n },\n {\n \"name\": \"guardian_queue\",\n \"writable\": true,\n \"relations\": [\"state\"]\n },\n {\n \"name\": \"authority\",\n \"signer\": true,\n \"relations\": [\"state\"]\n }\n ],\n \"args\": [\n {\n \"name\": \"params\",\n \"type\": {\n \"defined\": {\n \"name\": \"GuardianUnregisterParams\"\n }\n }\n }\n ]\n },\n {\n \"name\": \"oracle_heartbeat\",\n \"discriminator\": [10, 175, 217, 130, 111, 35, 117, 54],\n \"accounts\": [\n {\n \"name\": \"oracle\",\n \"writable\": true\n },\n {\n \"name\": \"oracle_stats\",\n \"writable\": true,\n \"pda\": {\n \"seeds\": [\n {\n \"kind\": \"const\",\n \"value\": [79, 114, 97, 99, 108, 101, 83, 116, 97, 116, 115]\n },\n {\n \"kind\": \"account\",\n \"path\": \"oracle\"\n }\n ]\n }\n },\n {\n \"name\": \"oracle_signer\",\n \"signer\": true\n },\n {\n \"name\": \"queue\",\n \"writable\": true,\n \"relations\": [\"oracle\", \"gc_node\"]\n },\n {\n \"name\": \"gc_node\",\n \"writable\": true\n },\n {\n \"name\": \"program_state\",\n \"writable\": true\n },\n {\n \"name\": \"payer\",\n \"writable\": true,\n \"signer\": true\n },\n {\n \"name\": \"system_program\",\n \"address\": \"11111111111111111111111111111111\"\n },\n {\n \"name\": \"token_program\",\n \"address\": \"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA\"\n },\n {\n \"name\": \"native_mint\",\n \"address\": \"So11111111111111111111111111111111111111112\"\n },\n {\n \"name\": \"queue_escrow\",\n \"writable\": true\n },\n {\n \"name\": \"stake_program\",\n \"address\": \"SBSTk6t52R89MmCdD739Rdd97HdbTQUFHe41vCX7pTt\",\n \"relations\": [\"program_state\"]\n },\n {\n \"name\": \"delegation_pool\",\n \"writable\": true\n },\n {\n \"name\": \"delegation_group\",\n \"writable\": true\n }\n ],\n \"args\": [\n {\n \"name\": \"params\",\n \"type\": {\n \"defined\": {\n \"name\": \"OracleHeartbeatParams\"\n }\n }\n }\n ]\n },\n {\n \"name\": \"oracle_init\",\n \"discriminator\": [21, 158, 66, 65, 60, 221, 148, 61],\n \"accounts\": [\n {\n \"name\": \"oracle\",\n \"writable\": true,\n \"signer\": true\n },\n {\n \"name\": \"oracle_stats\",\n \"writable\": true,\n \"pda\": {\n \"seeds\": [\n {\n \"kind\": \"const\",\n \"value\": [79, 114, 97, 99, 108, 101, 83, 116, 97, 116, 115]\n },\n {\n \"kind\": \"account\",\n \"path\": \"oracle\"\n }\n ]\n }\n },\n {\n \"name\": \"program_state\",\n \"writable\": true\n },\n {\n \"name\": \"payer\",\n \"writable\": true,\n \"signer\": true\n },\n {\n \"name\": \"system_program\",\n \"address\": \"11111111111111111111111111111111\"\n },\n {\n \"name\": \"token_program\",\n \"address\": \"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA\"\n },\n {\n \"name\": \"lut_signer\"\n },\n {\n \"name\": \"lut\",\n \"writable\": true\n },\n {\n \"name\": \"address_lookup_table_program\",\n \"address\": \"AddressLookupTab1e1111111111111111111111111\"\n },\n {\n \"name\": \"stake_program\",\n \"relations\": [\"program_state\"]\n },\n {\n \"name\": \"stake_pool\",\n \"relations\": [\"program_state\"]\n }\n ],\n \"args\": [\n {\n \"name\": \"params\",\n \"type\": {\n \"defined\": {\n \"name\": \"OracleInitParams\"\n }\n }\n }\n ]\n },\n {\n \"name\": \"oracle_set_configs\",\n \"discriminator\": [129, 111, 223, 4, 191, 188, 70, 180],\n \"accounts\": [\n {\n \"name\": \"oracle\"\n },\n {\n \"name\": \"authority\",\n \"signer\": true,\n \"relations\": [\"oracle\"]\n }\n ],\n \"args\": [\n {\n \"name\": \"params\",\n \"type\": {\n \"defined\": {\n \"name\": \"OracleSetConfigsParams\"\n }\n }\n }\n ]\n },\n {\n \"name\": \"oracle_update_delegation\",\n \"discriminator\": [46, 198, 113, 223, 160, 189, 118, 90],\n \"accounts\": [\n {\n \"name\": \"oracle\",\n \"writable\": true\n },\n {\n \"name\": \"oracle_stats\",\n \"pda\": {\n \"seeds\": [\n {\n \"kind\": \"const\",\n \"value\": [79, 114, 97, 99, 108, 101, 83, 116, 97, 116, 115]\n },\n {\n \"kind\": \"account\",\n \"path\": \"oracle\"\n }\n ]\n }\n },\n {\n \"name\": \"queue\",\n \"relations\": [\"oracle\"]\n },\n {\n \"name\": \"authority\",\n \"signer\": true\n },\n {\n \"name\": \"program_state\",\n \"writable\": true\n },\n {\n \"name\": \"payer\",\n \"writable\": true,\n \"signer\": true\n },\n {\n \"name\": \"system_program\",\n \"address\": \"11111111111111111111111111111111\"\n },\n {\n \"name\": \"token_program\",\n \"address\": \"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA\"\n },\n {\n \"name\": \"delegation_pool\",\n \"writable\": true\n },\n {\n \"name\": \"lut_signer\"\n },\n {\n \"name\": \"lut\",\n \"writable\": true\n },\n {\n \"name\": \"address_lookup_table_program\",\n \"address\": \"AddressLookupTab1e1111111111111111111111111\"\n },\n {\n \"name\": \"switch_mint\"\n },\n {\n \"name\": \"native_mint\",\n \"address\": \"So11111111111111111111111111111111111111112\"\n },\n {\n \"name\": \"wsol_vault\",\n \"writable\": true\n },\n {\n \"name\": \"switch_vault\",\n \"writable\": true\n },\n {\n \"name\": \"stake_program\",\n \"relations\": [\"program_state\"]\n },\n {\n \"name\": \"stake_pool\"\n },\n {\n \"name\": \"delegation_group\"\n }\n ],\n \"args\": [\n {\n \"name\": \"params\",\n \"type\": {\n \"defined\": {\n \"name\": \"OracleUpdateDelegationParams\"\n }\n }\n }\n ]\n },\n {\n \"name\": \"permission_set\",\n \"discriminator\": [211, 122, 185, 120, 129, 182, 55, 103],\n \"accounts\": [\n {\n \"name\": \"authority\",\n \"signer\": true\n },\n {\n \"name\": \"granter\"\n }\n ],\n \"args\": [\n {\n \"name\": \"params\",\n \"type\": {\n \"defined\": {\n \"name\": \"PermissionSetParams\"\n }\n }\n }\n ]\n },\n {\n \"name\": \"pull_feed_close\",\n \"discriminator\": [19, 134, 50, 142, 177, 215, 196, 83],\n \"accounts\": [\n {\n \"name\": \"pull_feed\",\n \"writable\": true\n },\n {\n \"name\": \"reward_escrow\",\n \"writable\": true\n },\n {\n \"name\": \"lut\",\n \"writable\": true\n },\n {\n \"name\": \"lut_signer\"\n },\n {\n \"name\": \"payer\",\n \"writable\": true,\n \"signer\": true\n },\n {\n \"name\": \"state\"\n },\n {\n \"name\": \"authority\",\n \"writable\": true,\n \"signer\": true,\n \"relations\": [\"pull_feed\"]\n },\n {\n \"name\": \"token_program\",\n \"address\": \"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA\"\n },\n {\n \"name\": \"associated_token_program\",\n \"address\": \"ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL\"\n },\n {\n \"name\": \"system_program\",\n \"address\": \"11111111111111111111111111111111\"\n },\n {\n \"name\": \"address_lookup_table_program\",\n \"address\": \"AddressLookupTab1e1111111111111111111111111\"\n }\n ],\n \"args\": [\n {\n \"name\": \"params\",\n \"type\": {\n \"defined\": {\n \"name\": \"PullFeedCloseParams\"\n }\n }\n }\n ]\n },\n {\n \"name\": \"pull_feed_init\",\n \"discriminator\": [198, 130, 53, 198, 235, 61, 143, 40],\n \"accounts\": [\n {\n \"name\": \"pull_feed\",\n \"writable\": true,\n \"signer\": true\n },\n {\n \"name\": \"queue\"\n },\n {\n \"name\": \"authority\"\n },\n {\n \"name\": \"payer\",\n \"writable\": true,\n \"signer\": true\n },\n {\n \"name\": \"system_program\",\n \"address\": \"11111111111111111111111111111111\"\n },\n {\n \"name\": \"program_state\"\n },\n {\n \"name\": \"reward_escrow\",\n \"writable\": true,\n \"pda\": {\n \"seeds\": [\n {\n \"kind\": \"account\",\n \"path\": \"pull_feed\"\n },\n {\n \"kind\": \"const\",\n \"value\": [\n 6, 221, 246, 225, 215, 101, 161, 147, 217, 203, 225, 70, 206, 235, 121, 172, 28, 180, 133, 237, 95,\n 91, 55, 145, 58, 140, 245, 133, 126, 255, 0, 169\n ]\n },\n {\n \"kind\": \"account\",\n \"path\": \"wrapped_sol_mint\"\n }\n ],\n \"program\": {\n \"kind\": \"const\",\n \"value\": [\n 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, 218, 255, 16,\n 132, 4, 142, 123, 216, 219, 233, 248, 89\n ]\n }\n }\n },\n {\n \"name\": \"token_program\",\n \"address\": \"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA\"\n },\n {\n \"name\": \"associated_token_program\",\n \"address\": \"ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL\"\n },\n {\n \"name\": \"wrapped_sol_mint\",\n \"address\": \"So11111111111111111111111111111111111111112\"\n },\n {\n \"name\": \"lut_signer\"\n },\n {\n \"name\": \"lut\",\n \"writable\": true\n },\n {\n \"name\": \"address_lookup_table_program\",\n \"address\": \"AddressLookupTab1e1111111111111111111111111\"\n }\n ],\n \"args\": [\n {\n \"name\": \"params\",\n \"type\": {\n \"defined\": {\n \"name\": \"PullFeedInitParams\"\n }\n }\n }\n ]\n },\n {\n \"name\": \"pull_feed_set_configs\",\n \"discriminator\": [217, 45, 11, 246, 64, 26, 82, 168],\n \"accounts\": [\n {\n \"name\": \"pull_feed\",\n \"writable\": true\n },\n {\n \"name\": \"authority\",\n \"signer\": true,\n \"relations\": [\"pull_feed\"]\n }\n ],\n \"args\": [\n {\n \"name\": \"params\",\n \"type\": {\n \"defined\": {\n \"name\": \"PullFeedSetConfigsParams\"\n }\n }\n }\n ]\n },\n {\n \"name\": \"pull_feed_submit_response\",\n \"discriminator\": [150, 22, 215, 166, 143, 93, 48, 137],\n \"accounts\": [\n {\n \"name\": \"feed\",\n \"writable\": true\n },\n {\n \"name\": \"queue\",\n \"relations\": [\"feed\"]\n },\n {\n \"name\": \"program_state\"\n },\n {\n \"name\": \"recent_slothashes\",\n \"address\": \"SysvarS1otHashes111111111111111111111111111\"\n },\n {\n \"name\": \"payer\",\n \"writable\": true,\n \"signer\": true\n },\n {\n \"name\": \"system_program\",\n \"address\": \"11111111111111111111111111111111\"\n },\n {\n \"name\": \"reward_vault\",\n \"writable\": true\n },\n {\n \"name\": \"token_program\",\n \"address\": \"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA\"\n },\n {\n \"name\": \"token_mint\",\n \"address\": \"So11111111111111111111111111111111111111112\"\n }\n ],\n \"args\": [\n {\n \"name\": \"params\",\n \"type\": {\n \"defined\": {\n \"name\": \"PullFeedSubmitResponseParams\"\n }\n }\n }\n ]\n },\n {\n \"name\": \"pull_feed_submit_response_many\",\n \"discriminator\": [47, 156, 45, 25, 200, 71, 37, 215],\n \"accounts\": [\n {\n \"name\": \"queue\"\n },\n {\n \"name\": \"program_state\"\n },\n {\n \"name\": \"recent_slothashes\",\n \"address\": \"SysvarS1otHashes111111111111111111111111111\"\n },\n {\n \"name\": \"payer\",\n \"writable\": true,\n \"signer\": true\n },\n {\n \"name\": \"system_program\",\n \"address\": \"11111111111111111111111111111111\"\n },\n {\n \"name\": \"reward_vault\",\n \"writable\": true\n },\n {\n \"name\": \"token_program\",\n \"address\": \"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA\"\n },\n {\n \"name\": \"token_mint\",\n \"address\": \"So11111111111111111111111111111111111111112\"\n }\n ],\n \"args\": [\n {\n \"name\": \"params\",\n \"type\": {\n \"defined\": {\n \"name\": \"PullFeedSubmitResponseManyParams\"\n }\n }\n }\n ]\n },\n {\n \"name\": \"pull_feed_submit_response_many_v2\",\n \"discriminator\": [135, 109, 121, 201, 47, 231, 8, 162],\n \"accounts\": [\n {\n \"name\": \"queue\"\n },\n {\n \"name\": \"program_state\"\n },\n {\n \"name\": \"recent_slothashes\",\n \"address\": \"SysvarS1otHashes111111111111111111111111111\"\n },\n {\n \"name\": \"payer\",\n \"writable\": true,\n \"signer\": true\n },\n {\n \"name\": \"system_program\",\n \"address\": \"11111111111111111111111111111111\"\n },\n {\n \"name\": \"reward_vault\",\n \"writable\": true\n },\n {\n \"name\": \"token_program\",\n \"address\": \"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA\"\n },\n {\n \"name\": \"token_mint\",\n \"address\": \"So11111111111111111111111111111111111111112\"\n },\n {\n \"name\": \"ix_sysvar\",\n \"address\": \"Sysvar1nstructions1111111111111111111111111\"\n }\n ],\n \"args\": [\n {\n \"name\": \"params\",\n \"type\": {\n \"defined\": {\n \"name\": \"PullFeedSubmitResponseManyParamsV2\"\n }\n }\n }\n ]\n },\n {\n \"name\": \"pull_feed_submit_response_v2\",\n \"discriminator\": [80, 42, 8, 149, 217, 20, 176, 249],\n \"accounts\": [\n {\n \"name\": \"feed\",\n \"writable\": true\n },\n {\n \"name\": \"queue\",\n \"relations\": [\"feed\"]\n },\n {\n \"name\": \"program_state\"\n },\n {\n \"name\": \"recent_slothashes\",\n \"address\": \"SysvarS1otHashes111111111111111111111111111\"\n },\n {\n \"name\": \"payer\",\n \"writable\": true,\n \"signer\": true\n },\n {\n \"name\": \"system_program\",\n \"address\": \"11111111111111111111111111111111\"\n },\n {\n \"name\": \"reward_vault\",\n \"writable\": true\n },\n {\n \"name\": \"token_program\",\n \"address\": \"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA\"\n },\n {\n \"name\": \"token_mint\",\n \"address\": \"So11111111111111111111111111111111111111112\"\n },\n {\n \"name\": \"ix_sysvar\",\n \"address\": \"Sysvar1nstructions1111111111111111111111111\"\n }\n ],\n \"args\": [\n {\n \"name\": \"params\",\n \"type\": {\n \"defined\": {\n \"name\": \"PullFeedSubmitResponseParamsV2\"\n }\n }\n }\n ]\n },\n {\n \"name\": \"queue_add_mr_enclave\",\n \"discriminator\": [199, 255, 81, 50, 60, 133, 171, 138],\n \"accounts\": [\n {\n \"name\": \"queue\",\n \"writable\": true\n },\n {\n \"name\": \"authority\",\n \"signer\": true,\n \"relations\": [\"queue\"]\n },\n {\n \"name\": \"program_authority\"\n },\n {\n \"name\": \"state\"\n }\n ],\n \"args\": [\n {\n \"name\": \"params\",\n \"type\": {\n \"defined\": {\n \"name\": \"QueueAddMrEnclaveParams\"\n }\n }\n }\n ]\n },\n {\n \"name\": \"queue_allow_subsidies\",\n \"discriminator\": [94, 203, 82, 157, 188, 138, 202, 108],\n \"accounts\": [\n {\n \"name\": \"queue\",\n \"writable\": true\n },\n {\n \"name\": \"authority\",\n \"signer\": true,\n \"relations\": [\"state\"]\n },\n {\n \"name\": \"state\",\n \"writable\": true\n }\n ],\n \"args\": [\n {\n \"name\": \"params\",\n \"type\": {\n \"defined\": {\n \"name\": \"QueueAllowSubsidiesParams\"\n }\n }\n }\n ]\n },\n {\n \"name\": \"queue_garbage_collect\",\n \"discriminator\": [187, 208, 104, 247, 16, 91, 96, 98],\n \"accounts\": [\n {\n \"name\": \"queue\",\n \"writable\": true\n },\n {\n \"name\": \"oracle\",\n \"writable\": true\n },\n {\n \"name\": \"authority\",\n \"signer\": true,\n \"relations\": [\"queue\"]\n }\n ],\n \"args\": [\n {\n \"name\": \"params\",\n \"type\": {\n \"defined\": {\n \"name\": \"QueueGarbageCollectParams\"\n }\n }\n }\n ]\n },\n {\n \"name\": \"queue_init\",\n \"discriminator\": [144, 18, 99, 145, 133, 27, 207, 13],\n \"accounts\": [\n {\n \"name\": \"queue\",\n \"writable\": true,\n \"signer\": true\n },\n {\n \"name\": \"queue_escrow\",\n \"writable\": true,\n \"pda\": {\n \"seeds\": [\n {\n \"kind\": \"account\",\n \"path\": \"queue\"\n },\n {\n \"kind\": \"const\",\n \"value\": [\n 6, 221, 246, 225, 215, 101, 161, 147, 217, 203, 225, 70, 206, 235, 121, 172, 28, 180, 133, 237, 95,\n 91, 55, 145, 58, 140, 245, 133, 126, 255, 0, 169\n ]\n },\n {\n \"kind\": \"account\",\n \"path\": \"native_mint\"\n }\n ],\n \"program\": {\n \"kind\": \"const\",\n \"value\": [\n 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, 218, 255, 16,\n 132, 4, 142, 123, 216, 219, 233, 248, 89\n ]\n }\n }\n },\n {\n \"name\": \"authority\"\n },\n {\n \"name\": \"payer\",\n \"writable\": true,\n \"signer\": true\n },\n {\n \"name\": \"system_program\",\n \"address\": \"11111111111111111111111111111111\"\n },\n {\n \"name\": \"token_program\",\n \"address\": \"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA\"\n },\n {\n \"name\": \"native_mint\",\n \"address\": \"So11111111111111111111111111111111111111112\"\n },\n {\n \"name\": \"program_state\"\n },\n {\n \"name\": \"lut_signer\",\n \"writable\": true\n },\n {\n \"name\": \"lut\",\n \"writable\": true\n },\n {\n \"name\": \"address_lookup_table_program\",\n \"address\": \"AddressLookupTab1e1111111111111111111111111\"\n },\n {\n \"name\": \"associated_token_program\",\n \"address\": \"ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL\"\n }\n ],\n \"args\": [\n {\n \"name\": \"params\",\n \"type\": {\n \"defined\": {\n \"name\": \"QueueInitParams\"\n }\n }\n }\n ]\n },\n {\n \"name\": \"queue_init_delegation_group\",\n \"discriminator\": [239, 146, 75, 158, 20, 166, 159, 14],\n \"accounts\": [\n {\n \"name\": \"queue\",\n \"writable\": true\n },\n {\n \"name\": \"payer\",\n \"writable\": true,\n \"signer\": true\n },\n {\n \"name\": \"system_program\",\n \"address\": \"11111111111111111111111111111111\"\n },\n {\n \"name\": \"program_state\"\n },\n {\n \"name\": \"lut_signer\"\n },\n {\n \"name\": \"lut\",\n \"writable\": true\n },\n {\n \"name\": \"address_lookup_table_program\",\n \"address\": \"AddressLookupTab1e1111111111111111111111111\"\n },\n {\n \"name\": \"delegation_group\",\n \"writable\": true\n },\n {\n \"name\": \"stake_program\",\n \"relations\": [\"program_state\"]\n },\n {\n \"name\": \"stake_pool\"\n }\n ],\n \"args\": [\n {\n \"name\": \"params\",\n \"type\": {\n \"defined\": {\n \"name\": \"QueueInitDelegationGroupParams\"\n }\n }\n }\n ]\n },\n {\n \"name\": \"queue_remove_mr_enclave\",\n \"discriminator\": [3, 64, 135, 33, 190, 133, 68, 252],\n \"accounts\": [\n {\n \"name\": \"queue\",\n \"writable\": true\n },\n {\n \"name\": \"authority\",\n \"signer\": true,\n \"relations\": [\"queue\"]\n },\n {\n \"name\": \"program_authority\"\n },\n {\n \"name\": \"state\"\n }\n ],\n \"args\": [\n {\n \"name\": \"params\",\n \"type\": {\n \"defined\": {\n \"name\": \"QueueRemoveMrEnclaveParams\"\n }\n }\n }\n ]\n },\n {\n \"name\": \"queue_set_configs\",\n \"discriminator\": [54, 183, 243, 199, 49, 103, 142, 48],\n \"accounts\": [\n {\n \"name\": \"queue\",\n \"writable\": true\n },\n {\n \"name\": \"authority\",\n \"signer\": true\n },\n {\n \"name\": \"state\"\n }\n ],\n \"args\": [\n {\n \"name\": \"params\",\n \"type\": {\n \"defined\": {\n \"name\": \"QueueSetConfigsParams\"\n }\n }\n }\n ]\n },\n {\n \"name\": \"randomness_commit\",\n \"discriminator\": [52, 170, 152, 201, 179, 133, 242, 141],\n \"accounts\": [\n {\n \"name\": \"randomness\",\n \"writable\": true\n },\n {\n \"name\": \"queue\",\n \"relations\": [\"randomness\", \"oracle\"]\n },\n {\n \"name\": \"oracle\",\n \"writable\": true\n },\n {\n \"name\": \"recent_slothashes\",\n \"address\": \"SysvarS1otHashes111111111111111111111111111\"\n },\n {\n \"name\": \"authority\",\n \"signer\": true,\n \"relations\": [\"randomness\"]\n }\n ],\n \"args\": [\n {\n \"name\": \"params\",\n \"type\": {\n \"defined\": {\n \"name\": \"RandomnessCommitParams\"\n }\n }\n }\n ]\n },\n {\n \"name\": \"randomness_init\",\n \"discriminator\": [9, 9, 204, 33, 50, 116, 113, 15],\n \"accounts\": [\n {\n \"name\": \"randomness\",\n \"writable\": true,\n \"signer\": true\n },\n {\n \"name\": \"reward_escrow\",\n \"writable\": true,\n \"pda\": {\n \"seeds\": [\n {\n \"kind\": \"account\",\n \"path\": \"randomness\"\n },\n {\n \"kind\": \"const\",\n \"value\": [\n 6, 221, 246, 225, 215, 101, 161, 147, 217, 203, 225, 70, 206, 235, 121, 172, 28, 180, 133, 237, 95,\n 91, 55, 145, 58, 140, 245, 133, 126, 255, 0, 169\n ]\n },\n {\n \"kind\": \"account\",\n \"path\": \"wrapped_sol_mint\"\n }\n ],\n \"program\": {\n \"kind\": \"const\",\n \"value\": [\n 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, 218, 255, 16,\n 132, 4, 142, 123, 216, 219, 233, 248, 89\n ]\n }\n }\n },\n {\n \"name\": \"authority\",\n \"signer\": true\n },\n {\n \"name\": \"queue\",\n \"writable\": true\n },\n {\n \"name\": \"payer\",\n \"writable\": true,\n \"signer\": true\n },\n {\n \"name\": \"system_program\",\n \"address\": \"11111111111111111111111111111111\"\n },\n {\n \"name\": \"token_program\",\n \"address\": \"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA\"\n },\n {\n \"name\": \"associated_token_program\",\n \"address\": \"ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL\"\n },\n {\n \"name\": \"wrapped_sol_mint\",\n \"address\": \"So11111111111111111111111111111111111111112\"\n },\n {\n \"name\": \"program_state\"\n },\n {\n \"name\": \"lut_signer\"\n },\n {\n \"name\": \"lut\",\n \"writable\": true\n },\n {\n \"name\": \"address_lookup_table_program\",\n \"address\": \"AddressLookupTab1e1111111111111111111111111\"\n }\n ],\n \"args\": [\n {\n \"name\": \"params\",\n \"type\": {\n \"defined\": {\n \"name\": \"RandomnessInitParams\"\n }\n }\n }\n ]\n },\n {\n \"name\": \"randomness_reveal\",\n \"discriminator\": [197, 181, 187, 10, 30, 58, 20, 73],\n \"accounts\": [\n {\n \"name\": \"randomness\",\n \"writable\": true\n },\n {\n \"name\": \"oracle\",\n \"relations\": [\"randomness\"]\n },\n {\n \"name\": \"queue\",\n \"relations\": [\"oracle\"]\n },\n {\n \"name\": \"stats\",\n \"writable\": true,\n \"pda\": {\n \"seeds\": [\n {\n \"kind\": \"const\",\n \"value\": [\n 79, 114, 97, 99, 108, 101, 82, 97, 110, 100, 111, 109, 110, 101, 115, 115, 83, 116, 97, 116, 115\n ]\n },\n {\n \"kind\": \"account\",\n \"path\": \"oracle\"\n }\n ]\n }\n },\n {\n \"name\": \"authority\",\n \"signer\": true,\n \"relations\": [\"randomness\"]\n },\n {\n \"name\": \"payer\",\n \"writable\": true,\n \"signer\": true\n },\n {\n \"name\": \"recent_slothashes\",\n \"address\": \"SysvarS1otHashes111111111111111111111111111\"\n },\n {\n \"name\": \"system_program\",\n \"address\": \"11111111111111111111111111111111\"\n },\n {\n \"name\": \"reward_escrow\",\n \"writable\": true\n },\n {\n \"name\": \"token_program\",\n \"address\": \"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA\"\n },\n {\n \"name\": \"wrapped_sol_mint\",\n \"address\": \"So11111111111111111111111111111111111111112\"\n },\n {\n \"name\": \"program_state\"\n }\n ],\n \"args\": [\n {\n \"name\": \"params\",\n \"type\": {\n \"defined\": {\n \"name\": \"RandomnessRevealParams\"\n }\n }\n }\n ]\n },\n {\n \"name\": \"state_init\",\n \"discriminator\": [103, 241, 106, 190, 217, 153, 87, 105],\n \"accounts\": [\n {\n \"name\": \"state\",\n \"writable\": true,\n \"pda\": {\n \"seeds\": [\n {\n \"kind\": \"const\",\n \"value\": [83, 84, 65, 84, 69]\n }\n ]\n }\n },\n {\n \"name\": \"payer\",\n \"writable\": true,\n \"signer\": true\n },\n {\n \"name\": \"system_program\",\n \"address\": \"11111111111111111111111111111111\"\n }\n ],\n \"args\": [\n {\n \"name\": \"params\",\n \"type\": {\n \"defined\": {\n \"name\": \"StateInitParams\"\n }\n }\n }\n ]\n },\n {\n \"name\": \"state_set_configs\",\n \"discriminator\": [40, 98, 76, 37, 206, 9, 47, 144],\n \"accounts\": [\n {\n \"name\": \"state\",\n \"writable\": true\n },\n {\n \"name\": \"authority\",\n \"signer\": true,\n \"relations\": [\"state\"]\n },\n {\n \"name\": \"queue\",\n \"writable\": true\n },\n {\n \"name\": \"payer\",\n \"writable\": true,\n \"signer\": true\n },\n {\n \"name\": \"system_program\",\n \"address\": \"11111111111111111111111111111111\"\n }\n ],\n \"args\": [\n {\n \"name\": \"params\",\n \"type\": {\n \"defined\": {\n \"name\": \"StateSetConfigsParams\"\n }\n }\n }\n ]\n }\n ],\n \"accounts\": [\n {\n \"name\": \"OracleAccountData\",\n \"discriminator\": [128, 30, 16, 241, 170, 73, 55, 54]\n },\n {\n \"name\": \"OracleStatsAccountData\",\n \"discriminator\": [180, 157, 178, 234, 240, 27, 152, 179]\n },\n {\n \"name\": \"PullFeedAccountData\",\n \"discriminator\": [196, 27, 108, 196, 10, 215, 219, 40]\n },\n {\n \"name\": \"QueueAccountData\",\n \"discriminator\": [217, 194, 55, 127, 184, 83, 138, 1]\n },\n {\n \"name\": \"RandomnessAccountData\",\n \"discriminator\": [10, 66, 229, 135, 220, 239, 217, 114]\n },\n {\n \"name\": \"State\",\n \"discriminator\": [216, 146, 107, 94, 104, 75, 182, 177]\n }\n ],\n \"events\": [\n {\n \"name\": \"GarbageCollectionEvent\",\n \"discriminator\": [232, 235, 2, 188, 8, 143, 145, 237]\n },\n {\n \"name\": \"GuardianQuoteVerifyEvent\",\n \"discriminator\": [31, 37, 39, 6, 214, 186, 33, 115]\n },\n {\n \"name\": \"OracleHeartbeatEvent\",\n \"discriminator\": [52, 29, 166, 2, 94, 7, 188, 13]\n },\n {\n \"name\": \"OracleInitEvent\",\n \"discriminator\": [89, 193, 219, 200, 1, 83, 167, 24]\n },\n {\n \"name\": \"OracleQuoteOverrideEvent\",\n \"discriminator\": [78, 204, 191, 210, 164, 196, 244, 65]\n },\n {\n \"name\": \"OracleQuoteRotateEvent\",\n \"discriminator\": [26, 189, 196, 192, 225, 127, 26, 228]\n },\n {\n \"name\": \"OracleQuoteVerifyRequestEvent\",\n \"discriminator\": [203, 209, 79, 0, 20, 71, 226, 202]\n },\n {\n \"name\": \"PermissionSetEvent\",\n \"discriminator\": [148, 86, 123, 0, 102, 20, 119, 206]\n },\n {\n \"name\": \"PullFeedErrorValueEvent\",\n \"discriminator\": [225, 80, 192, 95, 14, 12, 83, 192]\n },\n {\n \"name\": \"PullFeedValueEvents\",\n \"discriminator\": [86, 7, 231, 28, 122, 161, 117, 69]\n },\n {\n \"name\": \"QueueAddMrEnclaveEvent\",\n \"discriminator\": [170, 186, 175, 38, 216, 51, 69, 175]\n },\n {\n \"name\": \"QueueInitEvent\",\n \"discriminator\": [44, 137, 99, 227, 107, 8, 30, 105]\n },\n {\n \"name\": \"QueueRemoveMrEnclaveEvent\",\n \"discriminator\": [4, 105, 196, 60, 84, 122, 203, 196]\n },\n {\n \"name\": \"RandomnessCommitEvent\",\n \"discriminator\": [88, 60, 172, 90, 112, 10, 206, 147]\n }\n ],\n \"errors\": [\n {\n \"code\": 6000,\n \"name\": \"GenericError\"\n },\n {\n \"code\": 6001,\n \"name\": \"InvalidQuote\"\n },\n {\n \"code\": 6002,\n \"name\": \"InsufficientQueue\"\n },\n {\n \"code\": 6003,\n \"name\": \"QueueFull\"\n },\n {\n \"code\": 6004,\n \"name\": \"InvalidEnclaveSigner\"\n },\n {\n \"code\": 6005,\n \"name\": \"InvalidSigner\"\n },\n {\n \"code\": 6006,\n \"name\": \"MrEnclaveAlreadyExists\"\n },\n {\n \"code\": 6007,\n \"name\": \"MrEnclaveAtCapacity\"\n },\n {\n \"code\": 6008,\n \"name\": \"MrEnclaveDoesntExist\"\n },\n {\n \"code\": 6009,\n \"name\": \"PermissionDenied\"\n },\n {\n \"code\": 6010,\n \"name\": \"InvalidQueue\"\n },\n {\n \"code\": 6011,\n \"name\": \"IncorrectMrEnclave\"\n },\n {\n \"code\": 6012,\n \"name\": \"InvalidAuthority\"\n },\n {\n \"code\": 6013,\n \"name\": \"InvalidMrEnclave\"\n },\n {\n \"code\": 6014,\n \"name\": \"InvalidTimestamp\"\n },\n {\n \"code\": 6015,\n \"name\": \"InvalidOracleIdx\"\n },\n {\n \"code\": 6016,\n \"name\": \"InvalidSecpSignature\"\n },\n {\n \"code\": 6017,\n \"name\": \"InvalidGuardianQueue\"\n },\n {\n \"code\": 6018,\n \"name\": \"InvalidIndex\"\n },\n {\n \"code\": 6019,\n \"name\": \"InvalidOracleQueue\"\n },\n {\n \"code\": 6020,\n \"name\": \"InvalidPermission\"\n },\n {\n \"code\": 6021,\n \"name\": \"InvalidePermissionedAccount\"\n },\n {\n \"code\": 6022,\n \"name\": \"InvalidEpochRotate\"\n },\n {\n \"code\": 6023,\n \"name\": \"InvalidEpochFinalize\"\n },\n {\n \"code\": 6024,\n \"name\": \"InvalidEscrow\"\n },\n {\n \"code\": 6025,\n \"name\": \"IllegalOracle\"\n },\n {\n \"code\": 6026,\n \"name\": \"IllegalExecuteAttempt\"\n },\n {\n \"code\": 6027,\n \"name\": \"IllegalFeedValue\"\n },\n {\n \"code\": 6028,\n \"name\": \"InvalidOracleFeedStats\"\n },\n {\n \"code\": 6029,\n \"name\": \"InvalidStateAuthority\"\n },\n {\n \"code\": 6030,\n \"name\": \"NotEnoughSamples\"\n },\n {\n \"code\": 6031,\n \"name\": \"OracleIsVerified\"\n },\n {\n \"code\": 6032,\n \"name\": \"QueueIsEmpty\"\n },\n {\n \"code\": 6033,\n \"name\": \"SecpRecoverFailure\"\n },\n {\n \"code\": 6034,\n \"name\": \"StaleSample\"\n },\n {\n \"code\": 6035,\n \"name\": \"SwitchboardRandomnessTooOld\"\n },\n {\n \"code\": 6036,\n \"name\": \"EpochIdMismatch\"\n },\n {\n \"code\": 6037,\n \"name\": \"GuardianAlreadyVoted\"\n },\n {\n \"code\": 6038,\n \"name\": \"RandomnessNotRequested\"\n },\n {\n \"code\": 6039,\n \"name\": \"InvalidSlotNumber\"\n },\n {\n \"code\": 6040,\n \"name\": \"RandomnessOracleKeyExpired\"\n },\n {\n \"code\": 6041,\n \"name\": \"InvalidAdvisory\"\n },\n {\n \"code\": 6042,\n \"name\": \"InvalidOracleStats\"\n },\n {\n \"code\": 6043,\n \"name\": \"InvalidStakeProgram\"\n },\n {\n \"code\": 6044,\n \"name\": \"InvalidStakePool\"\n },\n {\n \"code\": 6045,\n \"name\": \"InvalidDelegationPool\"\n },\n {\n \"code\": 6046,\n \"name\": \"UnparsableAccount\"\n },\n {\n \"code\": 6047,\n \"name\": \"InvalidInstruction\"\n },\n {\n \"code\": 6048,\n \"name\": \"OracleAlreadyVerified\"\n },\n {\n \"code\": 6049,\n \"name\": \"GuardianNotVerified\"\n }\n ],\n \"types\": [\n {\n \"name\": \"CurrentResult\",\n \"serialization\": \"bytemuck\",\n \"repr\": {\n \"kind\": \"c\"\n },\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": [\n {\n \"name\": \"value\",\n \"docs\": [\"The median value of the submissions needed for quorom size\"],\n \"type\": \"i128\"\n },\n {\n \"name\": \"std_dev\",\n \"docs\": [\"The standard deviation of the submissions needed for quorom size\"],\n \"type\": \"i128\"\n },\n {\n \"name\": \"mean\",\n \"docs\": [\"The mean of the submissions needed for quorom size\"],\n \"type\": \"i128\"\n },\n {\n \"name\": \"range\",\n \"docs\": [\"The range of the submissions needed for quorom size\"],\n \"type\": \"i128\"\n },\n {\n \"name\": \"min_value\",\n \"docs\": [\"The minimum value of the submissions needed for quorom size\"],\n \"type\": \"i128\"\n },\n {\n \"name\": \"max_value\",\n \"docs\": [\"The maximum value of the submissions needed for quorom size\"],\n \"type\": \"i128\"\n },\n {\n \"name\": \"num_samples\",\n \"docs\": [\"The number of samples used to calculate this result\"],\n \"type\": \"u8\"\n },\n {\n \"name\": \"padding1\",\n \"type\": {\n \"array\": [\"u8\", 7]\n }\n },\n {\n \"name\": \"slot\",\n \"docs\": [\"The slot at which this value was signed.\"],\n \"type\": \"u64\"\n },\n {\n \"name\": \"min_slot\",\n \"docs\": [\"The slot at which the first considered submission was made\"],\n \"type\": \"u64\"\n },\n {\n \"name\": \"max_slot\",\n \"docs\": [\"The slot at which the last considered submission was made\"],\n \"type\": \"u64\"\n }\n ]\n }\n },\n {\n \"name\": \"GarbageCollectionEvent\",\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": [\n {\n \"name\": \"oracle\",\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"queue\",\n \"type\": \"pubkey\"\n }\n ]\n }\n },\n {\n \"name\": \"GuardianQuoteVerifyEvent\",\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": [\n {\n \"name\": \"quote\",\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"queue\",\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"oracle\",\n \"type\": \"pubkey\"\n }\n ]\n }\n },\n {\n \"name\": \"GuardianQuoteVerifyParams\",\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": [\n {\n \"name\": \"timestamp\",\n \"type\": \"i64\"\n },\n {\n \"name\": \"mr_enclave\",\n \"type\": {\n \"array\": [\"u8\", 32]\n }\n },\n {\n \"name\": \"idx\",\n \"type\": \"u32\"\n },\n {\n \"name\": \"ed25519_key\",\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"secp256k1_key\",\n \"type\": {\n \"array\": [\"u8\", 64]\n }\n },\n {\n \"name\": \"slot\",\n \"type\": \"u64\"\n },\n {\n \"name\": \"signature\",\n \"type\": {\n \"array\": [\"u8\", 64]\n }\n },\n {\n \"name\": \"recovery_id\",\n \"type\": \"u8\"\n },\n {\n \"name\": \"advisories\",\n \"type\": {\n \"vec\": \"u32\"\n }\n }\n ]\n }\n },\n {\n \"name\": \"GuardianRegisterParams\",\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": []\n }\n },\n {\n \"name\": \"GuardianUnregisterParams\",\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": []\n }\n },\n {\n \"name\": \"MegaSlotInfo\",\n \"serialization\": \"bytemuck\",\n \"repr\": {\n \"kind\": \"c\"\n },\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": [\n {\n \"name\": \"reserved1\",\n \"type\": \"u64\"\n },\n {\n \"name\": \"slot_end\",\n \"type\": \"u64\"\n },\n {\n \"name\": \"perf_goal\",\n \"type\": \"i64\"\n },\n {\n \"name\": \"current_signature_count\",\n \"type\": \"i64\"\n }\n ]\n }\n },\n {\n \"name\": \"MultiSubmission\",\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": [\n {\n \"name\": \"values\",\n \"type\": {\n \"vec\": \"i128\"\n }\n },\n {\n \"name\": \"signature\",\n \"type\": {\n \"array\": [\"u8\", 64]\n }\n },\n {\n \"name\": \"recovery_id\",\n \"type\": \"u8\"\n }\n ]\n }\n },\n {\n \"name\": \"MultiSubmissionV2\",\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": [\n {\n \"name\": \"values\",\n \"type\": {\n \"vec\": \"i128\"\n }\n },\n {\n \"name\": \"signature\",\n \"type\": {\n \"array\": [\"u8\", 64]\n }\n },\n {\n \"name\": \"recovery_id\",\n \"type\": \"u8\"\n }\n ]\n }\n },\n {\n \"name\": \"OracleAccountData\",\n \"serialization\": \"bytemuck\",\n \"repr\": {\n \"kind\": \"c\"\n },\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": [\n {\n \"name\": \"enclave\",\n \"docs\": [\"Represents the state of the quote verifiers enclave.\"],\n \"type\": {\n \"defined\": {\n \"name\": \"Quote\"\n }\n }\n },\n {\n \"name\": \"authority\",\n \"docs\": [\"The authority of the EnclaveAccount which is permitted to make account changes.\"],\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"queue\",\n \"docs\": [\"Queue used for attestation to verify a MRENCLAVE measurement.\"],\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"created_at\",\n \"docs\": [\"The unix timestamp when the quote was created.\"],\n \"type\": \"i64\"\n },\n {\n \"name\": \"last_heartbeat\",\n \"docs\": [\"The last time the quote heartbeated on-chain.\"],\n \"type\": \"i64\"\n },\n {\n \"name\": \"secp_authority\",\n \"type\": {\n \"array\": [\"u8\", 64]\n }\n },\n {\n \"name\": \"gateway_uri\",\n \"docs\": [\"URI location of the verifier's gateway.\"],\n \"type\": {\n \"array\": [\"u8\", 64]\n }\n },\n {\n \"name\": \"permissions\",\n \"type\": \"u64\"\n },\n {\n \"name\": \"is_on_queue\",\n \"docs\": [\"Whether the quote is located on the AttestationQueues buffer.\"],\n \"type\": \"u8\"\n },\n {\n \"name\": \"_padding1\",\n \"type\": {\n \"array\": [\"u8\", 7]\n }\n },\n {\n \"name\": \"lut_slot\",\n \"type\": \"u64\"\n },\n {\n \"name\": \"last_reward_epoch\",\n \"type\": \"u64\"\n },\n {\n \"name\": \"_ebuf4\",\n \"type\": {\n \"array\": [\"u8\", 16]\n }\n },\n {\n \"name\": \"_ebuf3\",\n \"type\": {\n \"array\": [\"u8\", 32]\n }\n },\n {\n \"name\": \"_ebuf2\",\n \"type\": {\n \"array\": [\"u8\", 64]\n }\n },\n {\n \"name\": \"_ebuf1\",\n \"type\": {\n \"array\": [\"u8\", 1024]\n }\n }\n ]\n }\n },\n {\n \"name\": \"OracleEpochInfo\",\n \"serialization\": \"bytemuck\",\n \"repr\": {\n \"kind\": \"c\"\n },\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": [\n {\n \"name\": \"id\",\n \"type\": \"u64\"\n },\n {\n \"name\": \"reserved1\",\n \"type\": \"u64\"\n },\n {\n \"name\": \"slot_end\",\n \"type\": \"u64\"\n },\n {\n \"name\": \"slash_score\",\n \"type\": \"u64\"\n },\n {\n \"name\": \"reward_score\",\n \"type\": \"u64\"\n },\n {\n \"name\": \"stake_score\",\n \"type\": \"u64\"\n }\n ]\n }\n },\n {\n \"name\": \"OracleHeartbeatEvent\",\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": [\n {\n \"name\": \"oracle\",\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"queue\",\n \"type\": \"pubkey\"\n }\n ]\n }\n },\n {\n \"name\": \"OracleHeartbeatParams\",\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": [\n {\n \"name\": \"gateway_uri\",\n \"type\": {\n \"option\": {\n \"array\": [\"u8\", 64]\n }\n }\n }\n ]\n }\n },\n {\n \"name\": \"OracleInitEvent\",\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": [\n {\n \"name\": \"oracle\",\n \"type\": \"pubkey\"\n }\n ]\n }\n },\n {\n \"name\": \"OracleInitParams\",\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": [\n {\n \"name\": \"recent_slot\",\n \"type\": \"u64\"\n },\n {\n \"name\": \"authority\",\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"queue\",\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"secp_authority\",\n \"type\": {\n \"option\": {\n \"array\": [\"u8\", 64]\n }\n }\n }\n ]\n }\n },\n {\n \"name\": \"OracleQuoteOverrideEvent\",\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": [\n {\n \"name\": \"oracle\",\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"queue\",\n \"type\": \"pubkey\"\n }\n ]\n }\n },\n {\n \"name\": \"OracleQuoteRotateEvent\",\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": [\n {\n \"name\": \"oracle\",\n \"type\": \"pubkey\"\n }\n ]\n }\n },\n {\n \"name\": \"OracleQuoteVerifyRequestEvent\",\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": [\n {\n \"name\": \"quote\",\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"oracle\",\n \"type\": \"pubkey\"\n }\n ]\n }\n },\n {\n \"name\": \"OracleSetConfigsParams\",\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": [\n {\n \"name\": \"new_authority\",\n \"type\": {\n \"option\": \"pubkey\"\n }\n },\n {\n \"name\": \"new_secp_authority\",\n \"type\": {\n \"option\": {\n \"array\": [\"u8\", 64]\n }\n }\n }\n ]\n }\n },\n {\n \"name\": \"OracleStatsAccountData\",\n \"serialization\": \"bytemuck\",\n \"repr\": {\n \"kind\": \"c\"\n },\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": [\n {\n \"name\": \"owner\",\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"oracle\",\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"finalized_epoch\",\n \"docs\": [\"The last epoch that has completed. cleared after registered with the\", \"staking program.\"],\n \"type\": {\n \"defined\": {\n \"name\": \"OracleEpochInfo\"\n }\n }\n },\n {\n \"name\": \"current_epoch\",\n \"docs\": [\n \"The current epoch info being used by the oracle. for stake. Will moved\",\n \"to finalized_epoch as soon as the epoch is over.\"\n ],\n \"type\": {\n \"defined\": {\n \"name\": \"OracleEpochInfo\"\n }\n }\n },\n {\n \"name\": \"mega_slot_info\",\n \"type\": {\n \"defined\": {\n \"name\": \"MegaSlotInfo\"\n }\n }\n },\n {\n \"name\": \"last_transfer_slot\",\n \"type\": \"u64\"\n },\n {\n \"name\": \"bump\",\n \"type\": \"u8\"\n },\n {\n \"name\": \"padding1\",\n \"type\": {\n \"array\": [\"u8\", 7]\n }\n },\n {\n \"name\": \"_ebuf\",\n \"docs\": [\"Reserved.\"],\n \"type\": {\n \"array\": [\"u8\", 1024]\n }\n }\n ]\n }\n },\n {\n \"name\": \"OracleSubmission\",\n \"serialization\": \"bytemuck\",\n \"repr\": {\n \"kind\": \"c\"\n },\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": [\n {\n \"name\": \"oracle\",\n \"docs\": [\"The public key of the oracle that submitted this value.\"],\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"slot\",\n \"docs\": [\"The slot at which this value was signed.\"],\n \"type\": \"u64\"\n },\n {\n \"name\": \"padding1\",\n \"type\": {\n \"array\": [\"u8\", 8]\n }\n },\n {\n \"name\": \"value\",\n \"docs\": [\"The value that was submitted.\"],\n \"type\": \"i128\"\n }\n ]\n }\n },\n {\n \"name\": \"OracleUpdateDelegationParams\",\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": [\n {\n \"name\": \"recent_slot\",\n \"type\": \"u64\"\n }\n ]\n }\n },\n {\n \"name\": \"PermissionSetEvent\",\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": [\n {\n \"name\": \"permission\",\n \"type\": \"pubkey\"\n }\n ]\n }\n },\n {\n \"name\": \"PermissionSetParams\",\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": [\n {\n \"name\": \"permission\",\n \"type\": \"u8\"\n },\n {\n \"name\": \"enable\",\n \"type\": \"bool\"\n }\n ]\n }\n },\n {\n \"name\": \"PullFeedAccountData\",\n \"docs\": [\"A representation of the data in a pull feed account.\"],\n \"serialization\": \"bytemuck\",\n \"repr\": {\n \"kind\": \"c\"\n },\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": [\n {\n \"name\": \"submissions\",\n \"docs\": [\"The oracle submissions for this feed.\"],\n \"type\": {\n \"array\": [\n {\n \"defined\": {\n \"name\": \"OracleSubmission\"\n }\n },\n 32\n ]\n }\n },\n {\n \"name\": \"authority\",\n \"docs\": [\n \"The public key of the authority that can update the feed hash that\",\n \"this account will use for registering updates.\"\n ],\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"queue\",\n \"docs\": [\n \"The public key of the queue which oracles must be bound to in order to\",\n \"submit data to this feed.\"\n ],\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"feed_hash\",\n \"docs\": [\"SHA-256 hash of the job schema oracles will execute to produce data\", \"for this feed.\"],\n \"type\": {\n \"array\": [\"u8\", 32]\n }\n },\n {\n \"name\": \"initialized_at\",\n \"docs\": [\"The slot at which this account was initialized.\"],\n \"type\": \"i64\"\n },\n {\n \"name\": \"permissions\",\n \"type\": \"u64\"\n },\n {\n \"name\": \"max_variance\",\n \"type\": \"u64\"\n },\n {\n \"name\": \"min_responses\",\n \"type\": \"u32\"\n },\n {\n \"name\": \"name\",\n \"type\": {\n \"array\": [\"u8\", 32]\n }\n },\n {\n \"name\": \"_padding1\",\n \"type\": {\n \"array\": [\"u8\", 3]\n }\n },\n {\n \"name\": \"min_sample_size\",\n \"type\": \"u8\"\n },\n {\n \"name\": \"last_update_timestamp\",\n \"type\": \"i64\"\n },\n {\n \"name\": \"lut_slot\",\n \"type\": \"u64\"\n },\n {\n \"name\": \"ipfs_hash\",\n \"type\": {\n \"array\": [\"u8\", 32]\n }\n },\n {\n \"name\": \"result\",\n \"type\": {\n \"defined\": {\n \"name\": \"CurrentResult\"\n }\n }\n },\n {\n \"name\": \"max_staleness\",\n \"type\": \"u32\"\n },\n {\n \"name\": \"_ebuf4\",\n \"type\": {\n \"array\": [\"u8\", 20]\n }\n },\n {\n \"name\": \"_ebuf3\",\n \"type\": {\n \"array\": [\"u8\", 24]\n }\n },\n {\n \"name\": \"_ebuf2\",\n \"type\": {\n \"array\": [\"u8\", 256]\n }\n },\n {\n \"name\": \"_ebuf1\",\n \"type\": {\n \"array\": [\"u8\", 512]\n }\n }\n ]\n }\n },\n {\n \"name\": \"PullFeedCloseParams\",\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": []\n }\n },\n {\n \"name\": \"PullFeedErrorValueEvent\",\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": [\n {\n \"name\": \"feed\",\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"oracle\",\n \"type\": \"pubkey\"\n }\n ]\n }\n },\n {\n \"name\": \"PullFeedInitParams\",\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": [\n {\n \"name\": \"feed_hash\",\n \"type\": {\n \"array\": [\"u8\", 32]\n }\n },\n {\n \"name\": \"max_variance\",\n \"type\": \"u64\"\n },\n {\n \"name\": \"min_responses\",\n \"type\": \"u32\"\n },\n {\n \"name\": \"name\",\n \"type\": {\n \"array\": [\"u8\", 32]\n }\n },\n {\n \"name\": \"recent_slot\",\n \"type\": \"u64\"\n },\n {\n \"name\": \"ipfs_hash\",\n \"type\": {\n \"array\": [\"u8\", 32]\n }\n },\n {\n \"name\": \"min_sample_size\",\n \"type\": \"u8\"\n },\n {\n \"name\": \"max_staleness\",\n \"type\": \"u32\"\n }\n ]\n }\n },\n {\n \"name\": \"PullFeedSetConfigsParams\",\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": [\n {\n \"name\": \"feed_hash\",\n \"type\": {\n \"option\": {\n \"array\": [\"u8\", 32]\n }\n }\n },\n {\n \"name\": \"authority\",\n \"type\": {\n \"option\": \"pubkey\"\n }\n },\n {\n \"name\": \"max_variance\",\n \"type\": {\n \"option\": \"u64\"\n }\n },\n {\n \"name\": \"min_responses\",\n \"type\": {\n \"option\": \"u32\"\n }\n },\n {\n \"name\": \"name\",\n \"type\": {\n \"option\": {\n \"array\": [\"u8\", 32]\n }\n }\n },\n {\n \"name\": \"ipfs_hash\",\n \"type\": {\n \"option\": {\n \"array\": [\"u8\", 32]\n }\n }\n },\n {\n \"name\": \"min_sample_size\",\n \"type\": {\n \"option\": \"u8\"\n }\n },\n {\n \"name\": \"max_staleness\",\n \"type\": {\n \"option\": \"u32\"\n }\n }\n ]\n }\n },\n {\n \"name\": \"PullFeedSubmitResponseManyParams\",\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": [\n {\n \"name\": \"slot\",\n \"type\": \"u64\"\n },\n {\n \"name\": \"submissions\",\n \"type\": {\n \"vec\": {\n \"defined\": {\n \"name\": \"MultiSubmission\"\n }\n }\n }\n }\n ]\n }\n },\n {\n \"name\": \"PullFeedSubmitResponseManyParamsV2\",\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": [\n {\n \"name\": \"slot\",\n \"type\": \"u64\"\n },\n {\n \"name\": \"submissions\",\n \"type\": {\n \"vec\": {\n \"defined\": {\n \"name\": \"MultiSubmissionV2\"\n }\n }\n }\n }\n ]\n }\n },\n {\n \"name\": \"PullFeedSubmitResponseParams\",\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": [\n {\n \"name\": \"slot\",\n \"type\": \"u64\"\n },\n {\n \"name\": \"submissions\",\n \"type\": {\n \"vec\": {\n \"defined\": {\n \"name\": \"Submission\"\n }\n }\n }\n }\n ]\n }\n },\n {\n \"name\": \"PullFeedSubmitResponseParamsV2\",\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": [\n {\n \"name\": \"slot\",\n \"type\": \"u64\"\n },\n {\n \"name\": \"submissions\",\n \"type\": {\n \"vec\": {\n \"defined\": {\n \"name\": \"SubmissionV2\"\n }\n }\n }\n }\n ]\n }\n },\n {\n \"name\": \"PullFeedValueEvents\",\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": [\n {\n \"name\": \"feeds\",\n \"type\": {\n \"vec\": \"pubkey\"\n }\n },\n {\n \"name\": \"oracles\",\n \"type\": {\n \"vec\": \"pubkey\"\n }\n },\n {\n \"name\": \"values\",\n \"type\": {\n \"vec\": {\n \"vec\": \"i128\"\n }\n }\n },\n {\n \"name\": \"reward\",\n \"type\": \"u32\"\n }\n ]\n }\n },\n {\n \"name\": \"QueueAccountData\",\n \"docs\": [\n \"An Queue represents a round-robin queue of oracle oracles who attest on-chain\",\n \"whether a Switchboard Function was executed within an enclave against an expected set of\",\n \"enclave measurements.\",\n \"\",\n \"For an oracle to join the queue, the oracle must first submit their enclave quote on-chain and\",\n \"wait for an existing oracle to attest their quote. If the oracle's quote matches an expected\",\n \"measurement within the queues mr_enclaves config, it is granted permissions and will start\",\n \"being assigned update requests.\"\n ],\n \"serialization\": \"bytemuck\",\n \"repr\": {\n \"kind\": \"c\"\n },\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": [\n {\n \"name\": \"authority\",\n \"docs\": [\"The address of the authority which is permitted to add/remove allowed enclave measurements.\"],\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"mr_enclaves\",\n \"docs\": [\"Allowed enclave measurements.\"],\n \"type\": {\n \"array\": [\n {\n \"array\": [\"u8\", 32]\n },\n 32\n ]\n }\n },\n {\n \"name\": \"oracle_keys\",\n \"docs\": [\n \"The addresses of the quote oracles who have a valid\",\n \"verification status and have heartbeated on-chain recently.\"\n ],\n \"type\": {\n \"array\": [\"pubkey\", 128]\n }\n },\n {\n \"name\": \"max_quote_verification_age\",\n \"docs\": [\"The maximum allowable time until a EnclaveAccount needs to be re-verified on-chain.\"],\n \"type\": \"i64\"\n },\n {\n \"name\": \"last_heartbeat\",\n \"docs\": [\"The unix timestamp when the last quote oracle heartbeated on-chain.\"],\n \"type\": \"i64\"\n },\n {\n \"name\": \"node_timeout\",\n \"type\": \"i64\"\n },\n {\n \"name\": \"oracle_min_stake\",\n \"docs\": [\n \"The minimum number of lamports a quote oracle needs to lock-up in order to heartbeat and verify other quotes.\"\n ],\n \"type\": \"u64\"\n },\n {\n \"name\": \"allow_authority_override_after\",\n \"type\": \"i64\"\n },\n {\n \"name\": \"mr_enclaves_len\",\n \"docs\": [\"The number of allowed enclave measurements.\"],\n \"type\": \"u32\"\n },\n {\n \"name\": \"oracle_keys_len\",\n \"docs\": [\"The length of valid quote oracles for the given attestation queue.\"],\n \"type\": \"u32\"\n },\n {\n \"name\": \"reward\",\n \"docs\": [\"The reward paid to quote oracles for attesting on-chain.\"],\n \"type\": \"u32\"\n },\n {\n \"name\": \"curr_idx\",\n \"docs\": [\"Incrementer used to track the current quote oracle permitted to run any available functions.\"],\n \"type\": \"u32\"\n },\n {\n \"name\": \"gc_idx\",\n \"docs\": [\"Incrementer used to garbage collect and remove stale quote oracles.\"],\n \"type\": \"u32\"\n },\n {\n \"name\": \"require_authority_heartbeat_permission\",\n \"type\": \"u8\"\n },\n {\n \"name\": \"require_authority_verify_permission\",\n \"type\": \"u8\"\n },\n {\n \"name\": \"require_usage_permissions\",\n \"type\": \"u8\"\n },\n {\n \"name\": \"signer_bump\",\n \"type\": \"u8\"\n },\n {\n \"name\": \"mint\",\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"lut_slot\",\n \"type\": \"u64\"\n },\n {\n \"name\": \"allow_subsidies\",\n \"type\": \"u8\"\n },\n {\n \"name\": \"_ebuf6\",\n \"docs\": [\"Reserved.\"],\n \"type\": {\n \"array\": [\"u8\", 23]\n }\n },\n {\n \"name\": \"_ebuf5\",\n \"type\": {\n \"array\": [\"u8\", 32]\n }\n },\n {\n \"name\": \"_ebuf4\",\n \"type\": {\n \"array\": [\"u8\", 64]\n }\n },\n {\n \"name\": \"_ebuf3\",\n \"type\": {\n \"array\": [\"u8\", 128]\n }\n },\n {\n \"name\": \"_ebuf2\",\n \"type\": {\n \"array\": [\"u8\", 256]\n }\n },\n {\n \"name\": \"_ebuf1\",\n \"type\": {\n \"array\": [\"u8\", 512]\n }\n }\n ]\n }\n },\n {\n \"name\": \"QueueAddMrEnclaveEvent\",\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": [\n {\n \"name\": \"queue\",\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"mr_enclave\",\n \"type\": {\n \"array\": [\"u8\", 32]\n }\n }\n ]\n }\n },\n {\n \"name\": \"QueueAddMrEnclaveParams\",\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": [\n {\n \"name\": \"mr_enclave\",\n \"type\": {\n \"array\": [\"u8\", 32]\n }\n }\n ]\n }\n },\n {\n \"name\": \"QueueAllowSubsidiesParams\",\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": [\n {\n \"name\": \"allow_subsidies\",\n \"type\": \"u8\"\n }\n ]\n }\n },\n {\n \"name\": \"QueueGarbageCollectParams\",\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": [\n {\n \"name\": \"idx\",\n \"type\": \"u32\"\n }\n ]\n }\n },\n {\n \"name\": \"QueueInitDelegationGroupParams\",\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": []\n }\n },\n {\n \"name\": \"QueueInitEvent\",\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": [\n {\n \"name\": \"queue\",\n \"type\": \"pubkey\"\n }\n ]\n }\n },\n {\n \"name\": \"QueueInitParams\",\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": [\n {\n \"name\": \"allow_authority_override_after\",\n \"type\": \"u32\"\n },\n {\n \"name\": \"require_authority_heartbeat_permission\",\n \"type\": \"bool\"\n },\n {\n \"name\": \"require_usage_permissions\",\n \"type\": \"bool\"\n },\n {\n \"name\": \"max_quote_verification_age\",\n \"type\": \"u32\"\n },\n {\n \"name\": \"reward\",\n \"type\": \"u32\"\n },\n {\n \"name\": \"node_timeout\",\n \"type\": \"u32\"\n },\n {\n \"name\": \"recent_slot\",\n \"type\": \"u64\"\n }\n ]\n }\n },\n {\n \"name\": \"QueueRemoveMrEnclaveEvent\",\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": [\n {\n \"name\": \"queue\",\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"mr_enclave\",\n \"type\": {\n \"array\": [\"u8\", 32]\n }\n }\n ]\n }\n },\n {\n \"name\": \"QueueRemoveMrEnclaveParams\",\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": [\n {\n \"name\": \"mr_enclave\",\n \"type\": {\n \"array\": [\"u8\", 32]\n }\n }\n ]\n }\n },\n {\n \"name\": \"QueueSetConfigsParams\",\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": [\n {\n \"name\": \"authority\",\n \"type\": {\n \"option\": \"pubkey\"\n }\n },\n {\n \"name\": \"reward\",\n \"type\": {\n \"option\": \"u32\"\n }\n },\n {\n \"name\": \"node_timeout\",\n \"type\": {\n \"option\": \"i64\"\n }\n }\n ]\n }\n },\n {\n \"name\": \"Quote\",\n \"serialization\": \"bytemuck\",\n \"repr\": {\n \"kind\": \"c\"\n },\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": [\n {\n \"name\": \"enclave_signer\",\n \"docs\": [\"The address of the signer generated within an enclave.\"],\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"mr_enclave\",\n \"docs\": [\"The quotes MRENCLAVE measurement dictating the contents of the secure enclave.\"],\n \"type\": {\n \"array\": [\"u8\", 32]\n }\n },\n {\n \"name\": \"verification_status\",\n \"docs\": [\"The VerificationStatus of the quote.\"],\n \"type\": \"u8\"\n },\n {\n \"name\": \"padding1\",\n \"type\": {\n \"array\": [\"u8\", 7]\n }\n },\n {\n \"name\": \"verification_timestamp\",\n \"docs\": [\"The unix timestamp when the quote was last verified.\"],\n \"type\": \"i64\"\n },\n {\n \"name\": \"valid_until\",\n \"docs\": [\"The unix timestamp when the quotes verification status expires.\"],\n \"type\": \"i64\"\n },\n {\n \"name\": \"quote_registry\",\n \"docs\": [\"The off-chain registry where the verifiers quote can be located.\"],\n \"type\": {\n \"array\": [\"u8\", 32]\n }\n },\n {\n \"name\": \"registry_key\",\n \"docs\": [\"Key to lookup the buffer data on IPFS or an alternative decentralized storage solution.\"],\n \"type\": {\n \"array\": [\"u8\", 64]\n }\n },\n {\n \"name\": \"secp256k1_signer\",\n \"docs\": [\"The secp256k1 public key of the enclave signer. Derived from the enclave_signer.\"],\n \"type\": {\n \"array\": [\"u8\", 64]\n }\n },\n {\n \"name\": \"last_ed25519_signer\",\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"last_secp256k1_signer\",\n \"type\": {\n \"array\": [\"u8\", 64]\n }\n },\n {\n \"name\": \"last_rotate_slot\",\n \"type\": \"u64\"\n },\n {\n \"name\": \"guardian_approvers\",\n \"type\": {\n \"array\": [\"pubkey\", 64]\n }\n },\n {\n \"name\": \"guardian_approvers_len\",\n \"type\": \"u8\"\n },\n {\n \"name\": \"padding2\",\n \"type\": {\n \"array\": [\"u8\", 7]\n }\n },\n {\n \"name\": \"staging_ed25519_signer\",\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"staging_secp256k1_signer\",\n \"type\": {\n \"array\": [\"u8\", 64]\n }\n },\n {\n \"name\": \"_ebuf4\",\n \"docs\": [\"Reserved.\"],\n \"type\": {\n \"array\": [\"u8\", 32]\n }\n },\n {\n \"name\": \"_ebuf3\",\n \"type\": {\n \"array\": [\"u8\", 128]\n }\n },\n {\n \"name\": \"_ebuf2\",\n \"type\": {\n \"array\": [\"u8\", 256]\n }\n },\n {\n \"name\": \"_ebuf1\",\n \"type\": {\n \"array\": [\"u8\", 512]\n }\n }\n ]\n }\n },\n {\n \"name\": \"RandomnessAccountData\",\n \"serialization\": \"bytemuck\",\n \"repr\": {\n \"kind\": \"c\"\n },\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": [\n {\n \"name\": \"authority\",\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"queue\",\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"seed_slothash\",\n \"type\": {\n \"array\": [\"u8\", 32]\n }\n },\n {\n \"name\": \"seed_slot\",\n \"type\": \"u64\"\n },\n {\n \"name\": \"oracle\",\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"reveal_slot\",\n \"type\": \"u64\"\n },\n {\n \"name\": \"value\",\n \"type\": {\n \"array\": [\"u8\", 32]\n }\n },\n {\n \"name\": \"lut_slot\",\n \"type\": \"u64\"\n },\n {\n \"name\": \"_ebuf3\",\n \"type\": {\n \"array\": [\"u8\", 24]\n }\n },\n {\n \"name\": \"_ebuf2\",\n \"type\": {\n \"array\": [\"u8\", 64]\n }\n },\n {\n \"name\": \"_ebuf1\",\n \"type\": {\n \"array\": [\"u8\", 128]\n }\n },\n {\n \"name\": \"active_secp256k1_signer\",\n \"type\": {\n \"array\": [\"u8\", 64]\n }\n },\n {\n \"name\": \"active_secp256k1_expiration\",\n \"type\": \"i64\"\n }\n ]\n }\n },\n {\n \"name\": \"RandomnessCommitEvent\",\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": [\n {\n \"name\": \"randomness_account\",\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"oracle\",\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"slot\",\n \"type\": \"u64\"\n },\n {\n \"name\": \"slothash\",\n \"type\": {\n \"array\": [\"u8\", 32]\n }\n }\n ]\n }\n },\n {\n \"name\": \"RandomnessCommitParams\",\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": []\n }\n },\n {\n \"name\": \"RandomnessInitParams\",\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": [\n {\n \"name\": \"recent_slot\",\n \"type\": \"u64\"\n }\n ]\n }\n },\n {\n \"name\": \"RandomnessRevealParams\",\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": [\n {\n \"name\": \"signature\",\n \"type\": {\n \"array\": [\"u8\", 64]\n }\n },\n {\n \"name\": \"recovery_id\",\n \"type\": \"u8\"\n },\n {\n \"name\": \"value\",\n \"type\": {\n \"array\": [\"u8\", 32]\n }\n }\n ]\n }\n },\n {\n \"name\": \"State\",\n \"serialization\": \"bytemuck\",\n \"repr\": {\n \"kind\": \"c\"\n },\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": [\n {\n \"name\": \"bump\",\n \"type\": \"u8\"\n },\n {\n \"name\": \"test_only_disable_mr_enclave_check\",\n \"type\": \"u8\"\n },\n {\n \"name\": \"enable_staking\",\n \"type\": \"u8\"\n },\n {\n \"name\": \"padding1\",\n \"type\": {\n \"array\": [\"u8\", 5]\n }\n },\n {\n \"name\": \"authority\",\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"guardian_queue\",\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"reserved1\",\n \"type\": \"u64\"\n },\n {\n \"name\": \"epoch_length\",\n \"type\": \"u64\"\n },\n {\n \"name\": \"current_epoch\",\n \"type\": {\n \"defined\": {\n \"name\": \"StateEpochInfo\"\n }\n }\n },\n {\n \"name\": \"next_epoch\",\n \"type\": {\n \"defined\": {\n \"name\": \"StateEpochInfo\"\n }\n }\n },\n {\n \"name\": \"finalized_epoch\",\n \"type\": {\n \"defined\": {\n \"name\": \"StateEpochInfo\"\n }\n }\n },\n {\n \"name\": \"stake_pool\",\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"stake_program\",\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"switch_mint\",\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"sgx_advisories\",\n \"type\": {\n \"array\": [\"u16\", 32]\n }\n },\n {\n \"name\": \"advisories_len\",\n \"type\": \"u8\"\n },\n {\n \"name\": \"padding2\",\n \"type\": \"u8\"\n },\n {\n \"name\": \"flat_reward_cut_percentage\",\n \"type\": \"u8\"\n },\n {\n \"name\": \"enable_slashing\",\n \"type\": \"u8\"\n },\n {\n \"name\": \"subsidy_amount\",\n \"type\": \"u32\"\n },\n {\n \"name\": \"lut_slot\",\n \"type\": \"u64\"\n },\n {\n \"name\": \"base_reward\",\n \"type\": \"u32\"\n },\n {\n \"name\": \"_ebuf6\",\n \"type\": {\n \"array\": [\"u8\", 28]\n }\n },\n {\n \"name\": \"_ebuf5\",\n \"type\": {\n \"array\": [\"u8\", 32]\n }\n },\n {\n \"name\": \"_ebuf4\",\n \"type\": {\n \"array\": [\"u8\", 64]\n }\n },\n {\n \"name\": \"_ebuf3\",\n \"type\": {\n \"array\": [\"u8\", 128]\n }\n },\n {\n \"name\": \"_ebuf2\",\n \"type\": {\n \"array\": [\"u8\", 512]\n }\n },\n {\n \"name\": \"_ebuf1\",\n \"type\": {\n \"array\": [\"u8\", 1024]\n }\n }\n ]\n }\n },\n {\n \"name\": \"StateEpochInfo\",\n \"serialization\": \"bytemuck\",\n \"repr\": {\n \"kind\": \"c\"\n },\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": [\n {\n \"name\": \"id\",\n \"type\": \"u64\"\n },\n {\n \"name\": \"_reserved1\",\n \"type\": \"u64\"\n },\n {\n \"name\": \"slot_end\",\n \"type\": \"u64\"\n }\n ]\n }\n },\n {\n \"name\": \"StateInitParams\",\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": []\n }\n },\n {\n \"name\": \"StateSetConfigsParams\",\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": [\n {\n \"name\": \"new_authority\",\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"test_only_disable_mr_enclave_check\",\n \"type\": \"u8\"\n },\n {\n \"name\": \"stake_pool\",\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"stake_program\",\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"add_advisory\",\n \"type\": \"u16\"\n },\n {\n \"name\": \"rm_advisory\",\n \"type\": \"u16\"\n },\n {\n \"name\": \"epoch_length\",\n \"type\": \"u32\"\n },\n {\n \"name\": \"reset_epochs\",\n \"type\": \"bool\"\n },\n {\n \"name\": \"switch_mint\",\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"enable_staking\",\n \"type\": \"u8\"\n },\n {\n \"name\": \"subsidy_amount\",\n \"type\": \"u32\"\n },\n {\n \"name\": \"base_reward\",\n \"type\": \"u32\"\n }\n ]\n }\n },\n {\n \"name\": \"Submission\",\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": [\n {\n \"name\": \"value\",\n \"type\": \"i128\"\n },\n {\n \"name\": \"signature\",\n \"type\": {\n \"array\": [\"u8\", 64]\n }\n },\n {\n \"name\": \"recovery_id\",\n \"type\": \"u8\"\n },\n {\n \"name\": \"offset\",\n \"type\": \"u8\"\n }\n ]\n }\n },\n {\n \"name\": \"SubmissionV2\",\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": [\n {\n \"name\": \"value\",\n \"type\": \"i128\"\n },\n {\n \"name\": \"signature\",\n \"type\": {\n \"array\": [\"u8\", 64]\n }\n },\n {\n \"name\": \"recovery_id\",\n \"type\": \"u8\"\n },\n {\n \"name\": \"offset\",\n \"type\": \"u8\"\n }\n ]\n }\n }\n ]\n}\n","import { type BN, BorshCoder, type Idl, Program, type Provider } from \"@coral-xyz/anchor\";\nimport type { PublicKey } from \"@solana/web3.js\";\nimport SWB_ONDEMAND_IDL from \"./idl.json\";\n\nexport const SWITCHBOARD_ONDEMANDE_PRICE_PRECISION = 18;\n\nexport interface CurrentResult {\n value: BN;\n std_dev: BN;\n mean: BN;\n range: BN;\n min_value: BN;\n max_vaalue: BN;\n slot: BN;\n min_slot: BN;\n max_slot: BN;\n}\n\nexport interface OracleSubmission {\n oracle: PublicKey;\n slot: BN;\n value: BN;\n}\n\nexport interface PullFeedAccountData {\n submissions: OracleSubmission[];\n authority: PublicKey;\n queue: PublicKey;\n feed_hash: Buffer;\n initialized_at: BN;\n permissions: BN;\n max_variance: BN;\n min_responses: number;\n name: Buffer;\n sample_size: number;\n last_update_timestamp: BN;\n lut_slot: BN;\n result: CurrentResult;\n max_staleness: number;\n min_sample_size: number;\n}\n\nexport type CrossbarSimulatePayload = FeedResponse[];\n\nexport interface FeedResponse {\n feedHash: string;\n results: number[];\n}\n\nexport const switchboardAccountCoder = new BorshCoder(SWB_ONDEMAND_IDL as unknown as Idl);\nexport function getSwitchboardProgram(provider: Provider): Program {\n return new Program(SWB_ONDEMAND_IDL as unknown as Idl, provider);\n}\n\nexport function decodeSwitchboardPullFeedData(data: Buffer): PullFeedAccountData {\n const pullFeedDAta = switchboardAccountCoder.accounts.decode(\"PullFeedAccountData\", data) as PullFeedAccountData;\n return pullFeedDAta;\n}\n","export * from \"./pyth_legacy\";\nexport * from \"./pyth_push_oracle\";\nexport * from \"./rpc-get-stake\";\nexport * from \"./single-spl-pool\";\nexport * from \"./switchboard_legacy\";\nexport * from \"./switchboard_pull\";\n","import {\n type AccountInfo,\n type AddressLookupTableAccount,\n type Blockhash,\n ComputeBudgetProgram,\n type Connection,\n LAMPORTS_PER_SOL,\n PublicKey,\n SystemProgram,\n type Transaction,\n type TransactionInstruction,\n TransactionMessage,\n VersionedTransaction,\n} from \"@solana/web3.js\";\nimport type BigNumber from \"bignumber.js\";\nimport {\n createAssociatedTokenAccountIdempotentInstruction,\n createCloseAccountInstruction,\n createSyncNativeInstruction,\n getAssociatedTokenAddressSync,\n NATIVE_MINT,\n} from \"@solana/spl-token\";\nimport {\n PDA_BANK_FEE_VAULT_AUTH_SEED,\n PDA_BANK_FEE_VAULT_SEED,\n PDA_BANK_INSURANCE_VAULT_AUTH_SEED,\n PDA_BANK_INSURANCE_VAULT_SEED,\n PDA_BANK_LIQUIDITY_VAULT_AUTH_SEED,\n PDA_BANK_LIQUIDITY_VAULT_SEED,\n PYTH_PUSH_ORACLE_ID,\n} from \"./constants\";\nimport type { BankConfig } from \"./models/bank\";\nimport type { BankConfigRaw } from \"./services\";\nimport { OracleSetup } from \"./services/bank/types/bank.types\";\nimport { parseOracleSetup } from \"./services/bank/utils/deserialize.utils\";\nimport { BankVaultType } from \"./types\";\nimport { parsePriceInfo } from \"./vendor\";\nimport {uiToNative} from \"@/common\";\n\nexport function getBankVaultSeeds(type: BankVaultType): Buffer {\n switch (type) {\n case BankVaultType.LiquidityVault:\n return PDA_BANK_LIQUIDITY_VAULT_SEED;\n case BankVaultType.InsuranceVault:\n return PDA_BANK_INSURANCE_VAULT_SEED;\n case BankVaultType.FeeVault:\n return PDA_BANK_FEE_VAULT_SEED;\n default:\n throw Error(`Unknown vault type ${type}`);\n }\n}\n\nfunction getBankVaultAuthoritySeeds(type: BankVaultType): Buffer {\n switch (type) {\n case BankVaultType.LiquidityVault:\n return PDA_BANK_LIQUIDITY_VAULT_AUTH_SEED;\n case BankVaultType.InsuranceVault:\n return PDA_BANK_INSURANCE_VAULT_AUTH_SEED;\n case BankVaultType.FeeVault:\n return PDA_BANK_FEE_VAULT_AUTH_SEED;\n default:\n throw Error(`Unknown vault type ${type}`);\n }\n}\n\n/**\n * Compute authority PDA for a specific lendr group bank vault\n */\nexport function getBankVaultAuthority(\n bankVaultType: BankVaultType,\n bankPk: PublicKey,\n programId: PublicKey,\n): [PublicKey, number] {\n return PublicKey.findProgramAddressSync([getBankVaultAuthoritySeeds(bankVaultType), bankPk.toBuffer()], programId);\n}\n\nexport function makeWrapSolIxs(walletAddress: PublicKey, amount: BigNumber): TransactionInstruction[] {\n const address = getAssociatedTokenAddressSync(NATIVE_MINT, walletAddress, true);\n const ixs = [createAssociatedTokenAccountIdempotentInstruction(walletAddress, address, walletAddress, NATIVE_MINT)];\n\n if (amount.gt(0)) {\n const nativeAmount = uiToNative(amount, 9).toNumber() + 10000;\n ixs.push(\n SystemProgram.transfer({ fromPubkey: walletAddress, toPubkey: address, lamports: nativeAmount }),\n createSyncNativeInstruction(address),\n );\n }\n\n return ixs;\n}\n\nexport function makeUnwrapSolIx(walletAddress: PublicKey): TransactionInstruction {\n const address = getAssociatedTokenAddressSync(NATIVE_MINT, walletAddress, true); // We allow off curve addresses here to support Fuse.\n return createCloseAccountInstruction(address, walletAddress, walletAddress);\n}\n\nexport async function makeVersionedTransaction(\n blockhash: Blockhash,\n transaction: Transaction,\n payer: PublicKey,\n addressLookupTables?: AddressLookupTableAccount[],\n): Promise<VersionedTransaction> {\n const message = new TransactionMessage({\n instructions: transaction.instructions,\n payerKey: payer,\n recentBlockhash: blockhash,\n });\n\n const versionedMessage = addressLookupTables\n ? message.compileToV0Message(addressLookupTables)\n : message.compileToLegacyMessage();\n\n return new VersionedTransaction(versionedMessage);\n}\n/**\n * Creates a compute budget instruction to set the priority fee for a transaction.\n * The priority fee is specified in micro-lamports per compute unit.\n *\n * @param priorityFeeMicro - Priority fee in micro-lamports per compute unit. If not provided, defaults to 1.\n * @returns A compute budget instruction with the specified priority fee\n */\nexport function makePriorityFeeMicroIx(priorityFeeMicro?: number): TransactionInstruction {\n return ComputeBudgetProgram.setComputeUnitPrice({\n microLamports: Math.floor(priorityFeeMicro ?? 1),\n });\n}\n\n/*\n deprecated use makePriorityFeeMicroIx instead\n*/\nexport function makePriorityFeeIx(priorityFeeUi?: number, computeUnitsLimit?: number): TransactionInstruction[] {\n const priorityFeeIx: TransactionInstruction[] = [];\n const limit = computeUnitsLimit ?? 1_400_000;\n\n let microLamports: number = 1;\n\n if (priorityFeeUi) {\n // if priority fee is above 0.2 SOL discard it for safety reasons\n const isAbsurdPriorityFee = priorityFeeUi > 0.1;\n\n if (!isAbsurdPriorityFee) {\n const priorityFeeMicroLamports = priorityFeeUi * LAMPORTS_PER_SOL * 1_000_000;\n microLamports = Math.round(priorityFeeMicroLamports / limit);\n }\n }\n\n priorityFeeIx.push(\n ComputeBudgetProgram.setComputeUnitPrice({\n microLamports,\n }),\n );\n\n return priorityFeeIx;\n}\n\nexport function feedIdToString(feedId: PublicKey): string {\n return feedId.toBuffer().toString(\"hex\");\n}\n\nexport type PythPushFeedIdMap = Map<string, { feedId: PublicKey; shardId?: number }>;\n\nexport async function buildFeedIdMap(bankConfigs: BankConfigRaw[], connection: Connection): Promise<PythPushFeedIdMap> {\n const feedIdMap: PythPushFeedIdMap = new Map<string, { feedId: PublicKey; shardId?: number }>();\n\n const feedIdsWithAddresses = bankConfigs\n .filter((bankConfig) => parseOracleSetup(bankConfig.oracleSetup) === OracleSetup.PythPushOracle)\n .flatMap((bankConfig) => {\n const feedId = bankConfig.oracleKeys[0].toBuffer();\n return {\n feedId,\n addresses: [\n findPythPushOracleAddress(feedId, PYTH_PUSH_ORACLE_ID, PYTH_SPONSORED_SHARD_ID),\n findPythPushOracleAddress(feedId, PYTH_PUSH_ORACLE_ID, LENDR_SPONSORED_SHARD_ID),\n ],\n };\n });\n\n const addressess = feedIdsWithAddresses.flatMap((feedIdWithAddress) => feedIdWithAddress.addresses);\n const accountInfos: Array<AccountInfo<Buffer<ArrayBufferLike>> | null> = [];\n\n const chunkSize = 25;\n for (let i = 0; i < addressess.length; i += chunkSize) {\n const chunk = addressess.slice(i, i + chunkSize);\n const accountInfosChunk = await connection.getMultipleAccountsInfo(chunk);\n accountInfos.push(...accountInfosChunk);\n }\n\n for (let i = 0; i < feedIdsWithAddresses.length; i++) {\n const oraclesStartIndex = i * 2;\n\n const pythSponsoredOracle = accountInfos[oraclesStartIndex];\n const ldrSponsoredOracle = accountInfos[oraclesStartIndex + 1];\n\n const feedId = feedIdsWithAddresses[i].feedId.toString(\"hex\");\n\n if (ldrSponsoredOracle && pythSponsoredOracle) {\n const pythPriceAccount = parsePriceInfo(pythSponsoredOracle.data.slice(8));\n const pythPublishTime = pythPriceAccount.priceMessage.publishTime;\n\n const ldrPriceAccount = parsePriceInfo(ldrSponsoredOracle.data.slice(8));\n const ldrPublishTime = ldrPriceAccount.priceMessage.publishTime;\n\n if (pythPublishTime > ldrPublishTime) {\n feedIdMap.set(feedId, { feedId: feedIdsWithAddresses[i].addresses[0], shardId: PYTH_SPONSORED_SHARD_ID });\n } else {\n feedIdMap.set(feedId, { feedId: feedIdsWithAddresses[i].addresses[1], shardId: LENDR_SPONSORED_SHARD_ID });\n }\n } else if (pythSponsoredOracle) {\n feedIdMap.set(feedId, { feedId: feedIdsWithAddresses[i].addresses[0], shardId: PYTH_SPONSORED_SHARD_ID });\n } else if (ldrSponsoredOracle) {\n feedIdMap.set(feedId, { feedId: feedIdsWithAddresses[i].addresses[1], shardId: LENDR_SPONSORED_SHARD_ID });\n } else {\n throw new Error(`No oracle found for feedId: ${feedId}, either Pyth or LDR sponsored oracle must exist`);\n }\n }\n\n return feedIdMap;\n}\n\nexport function findOracleKey(\n bankConfig: BankConfig,\n feedMap: PythPushFeedIdMap,\n): { oracleKey: PublicKey; shardId?: number } {\n try {\n const oracleSetup = bankConfig.oracleSetup;\n let oracleKey: PublicKey = bankConfig.oracleKeys[0];\n let shardId: number | undefined;\n\n if (oracleSetup === OracleSetup.PythPushOracle || oracleSetup === OracleSetup.StakedWithPythPush) {\n const feedId = feedIdToString(oracleKey);\n const maybeOracleKey = feedMap.get(feedId);\n if (!maybeOracleKey) {\n throw new Error(`No oracle key found for feedId: ${feedId}`);\n }\n oracleKey = maybeOracleKey.feedId;\n shardId = maybeOracleKey.shardId;\n }\n\n return { oracleKey, shardId };\n } catch (error) {\n console.error(\"Error finding oracle key\", error);\n console.log(\"oracleSetup\", bankConfig.oracleSetup);\n return { oracleKey: bankConfig.oracleKeys[0] };\n }\n}\n\nexport const PYTH_SPONSORED_SHARD_ID = 0;\nexport const LENDR_SPONSORED_SHARD_ID = 3301;\n\nexport function findPythPushOracleAddress(feedId: Buffer, programId: PublicKey, shardId: number): PublicKey {\n const shardBytes = u16ToArrayBufferLE(shardId);\n return PublicKey.findProgramAddressSync([shardBytes, feedId], programId)[0];\n}\n\nfunction u16ToArrayBufferLE(value: number): Uint8Array {\n // Create a buffer of 2 bytes\n const buffer = new ArrayBuffer(2);\n const dataView = new DataView(buffer);\n\n // Set the Uint16 value in little-endian order\n dataView.setUint16(0, value, true);\n\n // Return the buffer\n return new Uint8Array(buffer);\n}\n","import type BigNumber from \"bignumber.js\";\n\nexport interface PriceWithConfidence {\n price: BigNumber;\n confidence: BigNumber;\n lowestPrice: BigNumber;\n highestPrice: BigNumber;\n}\n\nexport interface OraclePrice {\n priceRealtime: PriceWithConfidence;\n priceWeighted: PriceWithConfidence;\n timestamp: BigNumber;\n pythShardId?: number;\n}\n\nexport enum PriceBias {\n Lowest = 0,\n None = 1,\n Highest = 2,\n}\n\nexport interface PriceWithConfidenceDto {\n price: string;\n confidence: string;\n lowestPrice: string;\n highestPrice: string;\n}\n\nexport interface OraclePriceDto {\n priceRealtime: PriceWithConfidenceDto;\n priceWeighted: PriceWithConfidenceDto;\n timestamp: string;\n pythShardId?: number;\n}\n","import type { PublicKey } from \"@solana/web3.js\";\nimport BigNumber from \"bignumber.js\";\n\nimport {\n type BalanceRaw,\n type BalanceType,\n computeBalanceUsdValue,\n computeClaimedEmissions,\n computeQuantity,\n computeQuantityUi,\n computeTotalOutstandingEmissions,\n getBalanceUsdValueWithPriceBias,\n LendrRequirementType,\n type OraclePrice,\n parseBalanceRaw,\n} from \"..\";\nimport type { Bank } from \"./bank\";\n\n// ----------------------------------------------------------------------------\n// Client types\n// ----------------------------------------------------------------------------\n\nclass Balance implements BalanceType {\n constructor(\n public active: boolean,\n public bankPk: PublicKey,\n public assetShares: BigNumber,\n public liabilityShares: BigNumber,\n public emissionsOutstanding: BigNumber,\n public lastUpdate: number,\n ) {}\n\n static from(balanceRaw: BalanceRaw): Balance {\n const props = parseBalanceRaw(balanceRaw);\n return new Balance(\n props.active,\n props.bankPk,\n props.assetShares,\n props.liabilityShares,\n props.emissionsOutstanding,\n props.lastUpdate,\n );\n }\n\n static fromBalanceType(balance: BalanceType): Balance {\n return new Balance(\n balance.active,\n balance.bankPk,\n balance.assetShares,\n balance.liabilityShares,\n balance.emissionsOutstanding,\n balance.lastUpdate,\n );\n }\n\n static createEmpty(bankPk: PublicKey): Balance {\n return new Balance(false, bankPk, new BigNumber(0), new BigNumber(0), new BigNumber(0), 0);\n }\n\n computeUsdValue(\n bank: Bank,\n oraclePrice: OraclePrice,\n lendrRequirementType = LendrRequirementType.Equity,\n ): {\n assets: BigNumber;\n liabilities: BigNumber;\n } {\n return computeBalanceUsdValue(this, bank, oraclePrice, lendrRequirementType);\n }\n\n getUsdValueWithPriceBias(\n bank: Bank,\n oraclePrice: OraclePrice,\n lendrRequirementType = LendrRequirementType.Equity,\n ): {\n assets: BigNumber;\n liabilities: BigNumber;\n } {\n return getBalanceUsdValueWithPriceBias(this, bank, oraclePrice, lendrRequirementType);\n }\n\n computeQuantity(bank: Bank): {\n assets: BigNumber;\n liabilities: BigNumber;\n } {\n return computeQuantity(this, bank);\n }\n\n computeQuantityUi(bank: Bank): {\n assets: BigNumber;\n liabilities: BigNumber;\n } {\n return computeQuantityUi(this, bank);\n }\n\n computeTotalOutstandingEmissions(bank: Bank): BigNumber {\n return computeTotalOutstandingEmissions(this, bank);\n }\n\n computeClaimedEmissions(bank: Bank, currentTimestamp: number): BigNumber {\n return computeClaimedEmissions(this, bank, currentTimestamp);\n }\n\n describe(bank: Bank, oraclePrice: OraclePrice): string {\n const { assets: assetsQt, liabilities: liabsQt } = this.computeQuantityUi(bank);\n const { assets: assetsUsd, liabilities: liabsUsd } = this.computeUsdValue(\n bank,\n oraclePrice,\n LendrRequirementType.Equity,\n );\n\n return `> ${bank.tokenSymbol ?? bank.address} balance:\n\\t- Deposits: ${assetsQt.toFixed(5)} (${assetsUsd.toFixed(5)} USD)\n\\t- Borrows: ${liabsQt.toFixed(5)} (${liabsUsd.toFixed(5)} USD)\n`;\n }\n}\n\nexport { Balance };\n","/**\n * Program IDL in camelCase format in order to be used in JS/TS.\n *\n * Note that this is only a type helper and is not the actual IDL. The original\n * IDL can be found at `target/idl/pyth_push_oracle.json`.\n */\nexport type PythPushOracle = {\n address: \"pythWSnswVUd12oZpeFP8e9CVaEqJg25g1Vtc2biRsT\";\n metadata: {\n name: \"pythPushOracle\";\n version: \"0.1.0\";\n spec: \"0.1.0\";\n };\n instructions: [\n {\n name: \"updatePriceFeed\";\n discriminator: [28, 9, 93, 150, 86, 153, 188, 115];\n accounts: [\n {\n name: \"payer\";\n writable: true;\n signer: true;\n },\n {\n name: \"pythSolanaReceiver\";\n },\n {\n name: \"encodedVaa\";\n },\n {\n name: \"config\";\n },\n {\n name: \"treasury\";\n writable: true;\n },\n {\n name: \"priceFeedAccount\";\n writable: true;\n },\n {\n name: \"systemProgram\";\n },\n ];\n args: [\n {\n name: \"params\";\n type: {\n defined: {\n name: \"postUpdateParams\";\n };\n };\n },\n {\n name: \"shardId\";\n type: \"u16\";\n },\n {\n name: \"feedId\";\n type: {\n array: [\"u8\", 32];\n };\n },\n ];\n },\n ];\n errors: [\n {\n code: 6000;\n name: \"updatesNotMonotonic\";\n msg: \"Updates must be monotonically increasing\";\n },\n {\n code: 6001;\n name: \"priceFeedMessageMismatch\";\n msg: \"Trying to update price feed with the wrong feed id\";\n },\n ];\n types: [\n {\n name: \"postUpdateParams\";\n type: {\n kind: \"struct\";\n fields: [\n {\n name: \"merklePriceUpdate\";\n type: {\n defined: {\n name: \"merklePriceUpdate\";\n };\n };\n },\n {\n name: \"treasuryId\";\n type: \"u8\";\n },\n ];\n };\n },\n {\n name: \"merklePriceUpdate\";\n type: {\n kind: \"struct\";\n fields: [\n {\n name: \"message\";\n type: \"bytes\";\n },\n {\n name: \"proof\";\n type: {\n vec: {\n array: [\"u8\", 20];\n };\n };\n },\n ];\n };\n },\n ];\n};\n\nexport const PYTH_PUSH_ORACLE_IDL: PythPushOracle = {\n address: \"pythWSnswVUd12oZpeFP8e9CVaEqJg25g1Vtc2biRsT\",\n metadata: {\n name: \"pythPushOracle\",\n version: \"0.1.0\",\n spec: \"0.1.0\",\n },\n instructions: [\n {\n name: \"updatePriceFeed\",\n discriminator: [28, 9, 93, 150, 86, 153, 188, 115],\n accounts: [\n {\n name: \"payer\",\n writable: true,\n signer: true,\n },\n {\n name: \"pythSolanaReceiver\",\n },\n {\n name: \"encodedVaa\",\n },\n {\n name: \"config\",\n },\n {\n name: \"treasury\",\n writable: true,\n },\n {\n name: \"priceFeedAccount\",\n writable: true,\n },\n {\n name: \"systemProgram\",\n },\n ],\n args: [\n {\n name: \"params\",\n type: {\n defined: {\n name: \"postUpdateParams\",\n },\n },\n },\n {\n name: \"shardId\",\n type: \"u16\",\n },\n {\n name: \"feedId\",\n type: {\n array: [\"u8\", 32],\n },\n },\n ],\n },\n ],\n errors: [\n {\n code: 6000,\n name: \"updatesNotMonotonic\",\n msg: \"Updates must be monotonically increasing\",\n },\n {\n code: 6001,\n name: \"priceFeedMessageMismatch\",\n msg: \"Trying to update price feed with the wrong feed id\",\n },\n ],\n types: [\n {\n name: \"postUpdateParams\",\n type: {\n kind: \"struct\",\n fields: [\n {\n name: \"merklePriceUpdate\",\n type: {\n defined: {\n name: \"merklePriceUpdate\",\n },\n },\n },\n {\n name: \"treasuryId\",\n type: \"u8\",\n },\n ],\n },\n },\n {\n name: \"merklePriceUpdate\",\n type: {\n kind: \"struct\",\n fields: [\n {\n name: \"message\",\n type: \"bytes\",\n },\n {\n name: \"proof\",\n type: {\n vec: {\n array: [\"u8\", 20],\n },\n },\n },\n ],\n },\n },\n ],\n};\n","/**\n * Program IDL in camelCase format in order to be used in JS/TS.\n *\n * Note that this is only a type helper and is not the actual IDL. The original\n * IDL can be found at `target/idl/wormhole_core_bridge_solana.json`.\n */\nexport type WormholeCoreBridgeSolana = {\n address: \"HDwcJBJXjL9FpJ7UBsYBtaDjsBUhuLCUYoz3zr8SWWaQ\";\n metadata: {\n name: \"wormholeCoreBridgeSolana\";\n version: \"0.0.1-alpha.5\";\n spec: \"0.1.0\";\n };\n instructions: [\n {\n name: \"initMessageV1\";\n docs: [\n \"Processor for initializing a new draft [PostedMessageV1](crate::state::PostedMessageV1)\",\n \"account for writing. The emitter authority is established at this point and the payload size\",\n \"is inferred from the size of the created account. This instruction handler also allows an\",\n \"integrator to publish Wormhole messages using his program's ID as the emitter address\",\n \"(by passing `Some(crate::ID)` to the [cpi_program_id](InitMessageV1Args::cpi_program_id)\",\n 'argument). **Be aware that the emitter authority\\'s seeds must only be \\\\[b\"emitter\"\\\\] in this',\n \"case.**\",\n \"\",\n \"This instruction should be followed up with `write_message_v1` and `finalize_message_v1` to\",\n \"write and indicate that the message is ready for publishing respectively (to prepare it for\",\n \"publishing via the\",\n \"[post message instruction](crate::legacy::instruction::LegacyInstruction::PostMessage)).\",\n \"\",\n \"NOTE: If you wish to publish a small message (one where the data does not overflow the\",\n \"Solana transaction size), it is recommended that you use an [sdk](crate::sdk::cpi) method to\",\n \"either prepare your message or post a message as a program ID emitter.\",\n ];\n discriminator: [247, 187, 26, 16, 122, 198, 106, 247];\n accounts: [\n {\n name: \"emitterAuthority\";\n docs: [\"This authority is the only one who can write to the draft message account.\"];\n signer: true;\n },\n {\n name: \"draftMessage\";\n docs: [\"Bridge.\"];\n writable: true;\n },\n ];\n args: [\n {\n name: \"args\";\n type: {\n defined: {\n name: \"initMessageV1Args\";\n };\n };\n },\n ];\n },\n {\n name: \"writeMessageV1\";\n docs: [\n \"Processor used to write to a draft [PostedMessageV1](crate::state::PostedMessageV1) account.\",\n \"This instruction requires an authority (the emitter authority) to interact with the message\",\n \"account.\",\n ];\n discriminator: [35, 67, 197, 233, 94, 117, 124, 143];\n accounts: [\n {\n name: \"emitterAuthority\";\n signer: true;\n },\n {\n name: \"draftMessage\";\n docs: [\"only be published when the message is finalized.\"];\n writable: true;\n },\n ];\n args: [\n {\n name: \"args\";\n type: {\n defined: {\n name: \"writeMessageV1Args\";\n };\n };\n },\n ];\n },\n {\n name: \"finalizeMessageV1\";\n docs: [\n \"Processor used to finalize a draft [PostedMessageV1](crate::state::PostedMessageV1) account.\",\n \"Once finalized, this message account cannot be written to again. A finalized message is the\",\n \"only state the legacy post message instruction can accept before publishing. This\",\n \"instruction requires an authority (the emitter authority) to interact with the message\",\n \"account.\",\n ];\n discriminator: [245, 208, 215, 228, 129, 56, 51, 251];\n accounts: [\n {\n name: \"emitterAuthority\";\n signer: true;\n },\n {\n name: \"draftMessage\";\n docs: [\"only be published when the message is finalized.\"];\n writable: true;\n },\n ];\n args: [];\n },\n {\n name: \"closeMessageV1\";\n docs: [\n \"Processor used to process a draft [PostedMessageV1](crate::state::PostedMessageV1) account.\",\n \"This instruction requires an authority (the emitter authority) to interact with the message\",\n \"account.\",\n ];\n discriminator: [36, 185, 40, 107, 239, 13, 51, 162];\n accounts: [\n {\n name: \"emitterAuthority\";\n signer: true;\n },\n {\n name: \"draftMessage\";\n docs: [\"only be published when the message is finalized.\"];\n writable: true;\n },\n {\n name: \"closeAccountDestination\";\n writable: true;\n },\n ];\n args: [];\n },\n {\n name: \"initEncodedVaa\";\n docs: [\n \"Processor used to intialize a created account as [EncodedVaa](crate::state::EncodedVaa). An\",\n \"authority (the write authority) is established with this instruction.\",\n ];\n discriminator: [209, 193, 173, 25, 91, 202, 181, 218];\n accounts: [\n {\n name: \"writeAuthority\";\n docs: [\"The authority who can write to the VAA account when it is being processed.\"];\n signer: true;\n },\n {\n name: \"encodedVaa\";\n docs: [\"Bridge.\"];\n writable: true;\n },\n ];\n args: [];\n },\n {\n name: \"closeEncodedVaa\";\n docs: [\n \"Processor used to close an [EncodedVaa](crate::state::EncodedVaa). This instruction requires\",\n \"an authority (the write authority) to interact witht he encoded VAA account.\",\n ];\n discriminator: [48, 221, 174, 198, 231, 7, 152, 38];\n accounts: [\n {\n name: \"writeAuthority\";\n docs: [\n \"This account is only required to be mutable for the `CloseVaaAccount` directive. This\",\n \"authority is the same signer that originally created the VAA accounts, so he is the one that\",\n \"will receive the lamports back for the closed accounts.\",\n ];\n writable: true;\n signer: true;\n },\n {\n name: \"encodedVaa\";\n docs: [\"written to and then verified.\"];\n writable: true;\n },\n ];\n args: [];\n },\n {\n name: \"writeEncodedVaa\";\n docs: [\n \"Processor used to write to an [EncodedVaa](crate::state::EncodedVaa) account. This\",\n \"instruction requires an authority (the write authority) to interact with the encoded VAA\",\n \"account.\",\n ];\n discriminator: [199, 208, 110, 177, 150, 76, 118, 42];\n accounts: [\n {\n name: \"writeAuthority\";\n docs: [\"The only authority that can write to the encoded VAA account.\"];\n signer: true;\n },\n {\n name: \"draftVaa\";\n docs: [\"written to and then verified.\"];\n writable: true;\n },\n ];\n args: [\n {\n name: \"args\";\n type: {\n defined: {\n name: \"writeEncodedVaaArgs\";\n };\n };\n },\n ];\n },\n {\n name: \"verifyEncodedVaaV1\";\n docs: [\n \"Processor used to verify an [EncodedVaa](crate::state::EncodedVaa) account as a version 1\",\n \"VAA (guardian signatures attesting to this observation). This instruction requires an\",\n \"authority (the write authority) to interact with the encoded VAA account.\",\n ];\n discriminator: [103, 56, 177, 229, 240, 103, 68, 73];\n accounts: [\n {\n name: \"writeAuthority\";\n signer: true;\n },\n {\n name: \"draftVaa\";\n docs: [\"written to and then verified.\"];\n writable: true;\n },\n {\n name: \"guardianSet\";\n docs: [\n \"Guardian set account, which should be the same one that was used to attest for the VAA. The\",\n \"signatures in the encoded VAA are verified against this guardian set.\",\n ];\n },\n ];\n args: [];\n },\n {\n name: \"postVaaV1\";\n docs: [\n \"Processor used to close an [EncodedVaa](crate::state::EncodedVaa) account to create a\",\n \"[PostedMessageV1](crate::state::PostedMessageV1) account in its place.\",\n \"\",\n \"NOTE: Because the legacy verify signatures instruction was not required for the Posted VAA\",\n \"account to exist, the encoded [SignatureSet](crate::state::SignatureSet) is the default\",\n \"[Pubkey].\",\n ];\n discriminator: [0, 57, 97, 3, 225, 37, 254, 31];\n accounts: [\n {\n name: \"payer\";\n docs: [\n \"Payer to create the posted VAA account. This instruction allows anyone with an encoded VAA\",\n \"to create a posted VAA account.\",\n ];\n writable: true;\n signer: true;\n },\n {\n name: \"encodedVaa\";\n docs: [\n \"Encoded VAA, whose body will be serialized into the posted VAA account.\",\n \"\",\n \"NOTE: This instruction handler only exists to support integrators that still rely on posted\",\n \"VAA accounts. While we encourage integrators to use the encoded VAA account instead, we\",\n \"allow a pathway to convert the encoded VAA into a posted VAA. However, the payload is\",\n \"restricted to 9.5KB, which is much larger than what was possible with the old implementation\",\n \"using the legacy post vaa instruction. The Core Bridge program will not support posting VAAs\",\n \"larger than this payload size.\",\n ];\n },\n {\n name: \"postedVaa\";\n writable: true;\n },\n {\n name: \"systemProgram\";\n },\n ];\n args: [];\n },\n {\n name: \"closeSignatureSet\";\n docs: [\n \"Processor used to close a [SignatureSet](crate::state::SignatureSet), which was used to\",\n \"verify the VAA using the legacy parse and verify procedure.\",\n ];\n discriminator: [64, 154, 185, 168, 234, 229, 218, 103];\n accounts: [\n {\n name: \"solDestination\";\n writable: true;\n signer: true;\n },\n {\n name: \"postedVaa\";\n docs: [\"Posted VAA.\"];\n },\n {\n name: \"signatureSet\";\n docs: [\n \"Signature set that may have been used to create the posted VAA account. If the `post_vaa_v1`\",\n \"instruction were used to create the posted VAA account, then the encoded signature set\",\n \"pubkey would be all zeroes.\",\n ];\n writable: true;\n },\n ];\n args: [];\n },\n ];\n accounts: [\n {\n name: \"guardianSet\";\n discriminator: [16, 67, 62, 123, 169, 90, 100, 60];\n },\n {\n name: \"signatureSet\";\n discriminator: [135, 116, 238, 4, 218, 116, 194, 143];\n },\n {\n name: \"encodedVaa\";\n discriminator: [73, 170, 26, 37, 21, 245, 172, 192];\n },\n ];\n errors: [\n {\n code: 6002;\n name: \"invalidInstructionArgument\";\n msg: \"invalidInstructionArgument\";\n },\n {\n code: 6003;\n name: \"accountNotZeroed\";\n msg: \"accountNotZeroed\";\n },\n {\n code: 6004;\n name: \"invalidDataConversion\";\n msg: \"invalidDataConversion\";\n },\n {\n code: 6006;\n name: \"u64Overflow\";\n msg: \"u64Overflow\";\n },\n {\n code: 6008;\n name: \"invalidComputeSize\";\n msg: \"invalidComputeSize\";\n },\n {\n code: 6016;\n name: \"invalidChain\";\n msg: \"invalidChain\";\n },\n {\n code: 6032;\n name: \"invalidGovernanceEmitter\";\n msg: \"invalidGovernanceEmitter\";\n },\n {\n code: 6034;\n name: \"invalidGovernanceAction\";\n msg: \"invalidGovernanceAction\";\n },\n {\n code: 6036;\n name: \"latestGuardianSetRequired\";\n msg: \"latestGuardianSetRequired\";\n },\n {\n code: 6038;\n name: \"governanceForAnotherChain\";\n msg: \"governanceForAnotherChain\";\n },\n {\n code: 6040;\n name: \"invalidGovernanceVaa\";\n msg: \"invalidGovernanceVaa\";\n },\n {\n code: 6256;\n name: \"insufficientFees\";\n msg: \"insufficientFees\";\n },\n {\n code: 6258;\n name: \"emitterMismatch\";\n msg: \"emitterMismatch\";\n },\n {\n code: 6260;\n name: \"notReadyForPublishing\";\n msg: \"notReadyForPublishing\";\n },\n {\n code: 6262;\n name: \"invalidPreparedMessage\";\n msg: \"invalidPreparedMessage\";\n },\n {\n code: 6264;\n name: \"executableEmitter\";\n msg: \"executableEmitter\";\n },\n {\n code: 6266;\n name: \"legacyEmitter\";\n msg: \"legacyEmitter\";\n },\n {\n code: 6512;\n name: \"invalidSignatureSet\";\n msg: \"invalidSignatureSet\";\n },\n {\n code: 6514;\n name: \"invalidMessageHash\";\n msg: \"invalidMessageHash\";\n },\n {\n code: 6515;\n name: \"noQuorum\";\n msg: \"noQuorum\";\n },\n {\n code: 6516;\n name: \"messageMismatch\";\n msg: \"messageMismatch\";\n },\n {\n code: 7024;\n name: \"notEnoughLamports\";\n msg: \"notEnoughLamports\";\n },\n {\n code: 7026;\n name: \"invalidFeeRecipient\";\n msg: \"invalidFeeRecipient\";\n },\n {\n code: 7280;\n name: \"implementationMismatch\";\n msg: \"implementationMismatch\";\n },\n {\n code: 7536;\n name: \"invalidGuardianSetIndex\";\n msg: \"invalidGuardianSetIndex\";\n },\n {\n code: 7792;\n name: \"guardianSetMismatch\";\n msg: \"guardianSetMismatch\";\n },\n {\n code: 7794;\n name: \"instructionAtWrongIndex\";\n msg: \"instructionAtWrongIndex\";\n },\n {\n code: 7795;\n name: \"emptySigVerifyInstruction\";\n msg: \"emptySigVerifyInstruction\";\n },\n {\n code: 7796;\n name: \"invalidSigVerifyInstruction\";\n msg: \"invalidSigVerifyInstruction\";\n },\n {\n code: 7798;\n name: \"guardianSetExpired\";\n msg: \"guardianSetExpired\";\n },\n {\n code: 7800;\n name: \"invalidGuardianKeyRecovery\";\n msg: \"invalidGuardianKeyRecovery\";\n },\n {\n code: 7802;\n name: \"signerIndicesMismatch\";\n msg: \"signerIndicesMismatch\";\n },\n {\n code: 8048;\n name: \"payloadSizeMismatch\";\n msg: \"payloadSizeMismatch\";\n },\n {\n code: 10112;\n name: \"zeroGuardians\";\n msg: \"zeroGuardians\";\n },\n {\n code: 10128;\n name: \"guardianZeroAddress\";\n msg: \"guardianZeroAddress\";\n },\n {\n code: 10144;\n name: \"duplicateGuardianAddress\";\n msg: \"duplicateGuardianAddress\";\n },\n {\n code: 10160;\n name: \"messageAlreadyPublished\";\n msg: \"messageAlreadyPublished\";\n },\n {\n code: 10176;\n name: \"vaaWritingDisallowed\";\n msg: \"vaaWritingDisallowed\";\n },\n {\n code: 10192;\n name: \"vaaAlreadyVerified\";\n msg: \"vaaAlreadyVerified\";\n },\n {\n code: 10208;\n name: \"invalidGuardianIndex\";\n msg: \"invalidGuardianIndex\";\n },\n {\n code: 10224;\n name: \"invalidSignature\";\n msg: \"invalidSignature\";\n },\n {\n code: 10256;\n name: \"unverifiedVaa\";\n msg: \"unverifiedVaa\";\n },\n {\n code: 10258;\n name: \"vaaStillProcessing\";\n msg: \"vaaStillProcessing\";\n },\n {\n code: 10260;\n name: \"inWritingStatus\";\n msg: \"inWritingStatus\";\n },\n {\n code: 10262;\n name: \"notInWritingStatus\";\n msg: \"notInWritingStatus\";\n },\n {\n code: 10264;\n name: \"invalidMessageStatus\";\n msg: \"invalidMessageStatus\";\n },\n {\n code: 10266;\n name: \"hashNotComputed\";\n msg: \"hashNotComputed\";\n },\n {\n code: 10268;\n name: \"invalidVaaVersion\";\n msg: \"invalidVaaVersion\";\n },\n {\n code: 10270;\n name: \"invalidCreatedAccountSize\";\n msg: \"invalidCreatedAccountSize\";\n },\n {\n code: 10272;\n name: \"dataOverflow\";\n msg: \"dataOverflow\";\n },\n {\n code: 10274;\n name: \"exceedsMaxPayloadSize\";\n msg: \"ExceedsMaxPayloadSize (30KB)\";\n },\n {\n code: 10276;\n name: \"cannotParseVaa\";\n msg: \"cannotParseVaa\";\n },\n {\n code: 10278;\n name: \"emitterAuthorityMismatch\";\n msg: \"emitterAuthorityMismatch\";\n },\n {\n code: 10280;\n name: \"invalidProgramEmitter\";\n msg: \"invalidProgramEmitter\";\n },\n {\n code: 10282;\n name: \"writeAuthorityMismatch\";\n msg: \"writeAuthorityMismatch\";\n },\n {\n code: 10284;\n name: \"postedVaaPayloadTooLarge\";\n msg: \"postedVaaPayloadTooLarge\";\n },\n {\n code: 10286;\n name: \"executableDisallowed\";\n msg: \"executableDisallowed\";\n },\n ];\n types: [\n {\n name: \"initializeArgs\";\n docs: [\"Arguments used to initialize the Core Bridge program.\"];\n type: {\n kind: \"struct\";\n fields: [\n {\n name: \"guardianSetTtlSeconds\";\n type: \"u32\";\n },\n {\n name: \"feeLamports\";\n type: \"u64\";\n },\n {\n name: \"initialGuardians\";\n type: {\n vec: {\n array: [\"u8\", 20];\n };\n };\n },\n ];\n };\n },\n {\n name: \"postMessageArgs\";\n docs: [\n \"Arguments used to post a new Wormhole (Core Bridge) message either using\",\n \"[post_message](crate::legacy::instruction::post_message) or\",\n \"[post_message_unreliable](crate::legacy::instruction::post_message_unreliable).\",\n ];\n type: {\n kind: \"struct\";\n fields: [\n {\n name: \"nonce\";\n docs: [\"Unique id for this message.\"];\n type: \"u32\";\n },\n {\n name: \"payload\";\n docs: [\"Encoded message.\"];\n type: \"bytes\";\n },\n {\n name: \"commitment\";\n docs: [\"Solana commitment level for Guardian observation.\"];\n type: {\n defined: {\n name: \"commitment\";\n };\n };\n },\n ];\n };\n },\n {\n name: \"postVaaArgs\";\n docs: [\n \"Arguments to post new VAA data after signature verification.\",\n \"\",\n \"NOTE: It is preferred to use the new process of verifying a VAA using the new Core Bridge Anchor\",\n \"instructions. See [init_encoded_vaa](crate::wormhole_core_bridge_solana::init_encoded_vaa) and\",\n \"[write_encoded_vaa](crate::wormhole_core_bridge_solana::write_encoded_vaa) for more info.\",\n ];\n type: {\n kind: \"struct\";\n fields: [\n {\n name: \"gap0\";\n docs: [\"Unused data.\"];\n type: {\n array: [\"u8\", 5];\n };\n },\n {\n name: \"timestamp\";\n docs: [\"Time the message was submitted.\"];\n type: \"u32\";\n },\n {\n name: \"nonce\";\n docs: [\"Unique ID for this message.\"];\n type: \"u32\";\n },\n {\n name: \"emitterChain\";\n docs: [\"The Wormhole chain ID denoting the origin of this message.\"];\n type: \"u16\";\n },\n {\n name: \"emitterAddress\";\n docs: [\"Emitter of the message.\"];\n type: {\n array: [\"u8\", 32];\n };\n },\n {\n name: \"sequence\";\n docs: [\"Sequence number of this message.\"];\n type: \"u64\";\n },\n {\n name: \"consistencyLevel\";\n docs: [\"Level of consistency requested by the emitter.\"];\n type: \"u8\";\n },\n {\n name: \"payload\";\n docs: [\"Message payload.\"];\n type: \"bytes\";\n },\n ];\n };\n },\n {\n name: \"verifySignaturesArgs\";\n docs: [\n \"Arguments to verify specific guardian indices.\",\n \"\",\n \"NOTE: It is preferred to use the new process of verifying a VAA using the new Core Bridge Anchor\",\n \"instructions. See [init_encoded_vaa](crate::wormhole_core_bridge_solana::init_encoded_vaa) and\",\n \"[write_encoded_vaa](crate::wormhole_core_bridge_solana::write_encoded_vaa) for more info.\",\n ];\n type: {\n kind: \"struct\";\n fields: [\n {\n name: \"signerIndices\";\n docs: [\n \"Indices of verified guardian signatures, where -1 indicates a missing value. There is a\",\n \"missing value if the guardian at this index is not expected to have its signature verified by\",\n \"the Sig Verify native program in the instruction invoked prior).\",\n \"\",\n \"NOTE: In the legacy implementation, this argument being a fixed-sized array of 19 only\",\n \"allows the first 19 guardians of any size guardian set to be verified. Because of this, it\",\n \"is absolutely important to use the new process of verifying a VAA.\",\n ];\n type: {\n array: [\"i8\", 19];\n };\n },\n ];\n };\n },\n {\n name: \"emptyArgs\";\n docs: [\"Unit struct used to represent an empty instruction argument.\"];\n type: {\n kind: \"struct\";\n };\n },\n {\n name: \"config\";\n docs: [\n \"Account used to store the current configuration of the bridge, including tracking Wormhole fee\",\n \"payments. For governance decrees, the guardian set index is used to determine whether a decree\",\n \"was attested for using the latest guardian set.\",\n ];\n type: {\n kind: \"struct\";\n fields: [\n {\n name: \"guardianSetIndex\";\n docs: [\"The current guardian set index, used to decide which signature sets to accept.\"];\n type: \"u32\";\n },\n {\n name: \"gap0\";\n docs: [\n \"Gap. In the old implementation, this was an amount that kept track of message fees that\",\n \"were paid to the program's fee collector.\",\n ];\n type: {\n array: [\"u8\", 8];\n };\n },\n {\n name: \"guardianSetTtl\";\n docs: [\n \"Period for how long a guardian set is valid after it has been replaced by a new one. This\",\n \"guarantees that VAAs issued by that set can still be submitted for a certain period. In\",\n \"this period we still trust the old guardian set.\",\n ];\n type: {\n defined: {\n name: \"duration\";\n };\n };\n },\n {\n name: \"feeLamports\";\n docs: [\"Amount of lamports that needs to be paid to the protocol to post a message\"];\n type: \"u64\";\n },\n ];\n };\n },\n {\n name: \"legacyEmitterSequence\";\n docs: [\"Account used to store the current sequence number for a given emitter.\"];\n type: {\n kind: \"struct\";\n fields: [\n {\n name: \"value\";\n docs: [\"Current sequence number, which will be used the next time this emitter publishes a message.\"];\n type: \"u64\";\n },\n ];\n };\n },\n {\n name: \"emitterSequence\";\n type: {\n kind: \"struct\";\n fields: [\n {\n name: \"legacy\";\n type: {\n defined: {\n name: \"legacyEmitterSequence\";\n };\n };\n },\n {\n name: \"bump\";\n type: \"u8\";\n },\n {\n name: \"emitterType\";\n type: {\n defined: {\n name: \"emitterType\";\n };\n };\n },\n ];\n };\n },\n {\n name: \"postedMessageV1Unreliable\";\n docs: [\"Account used to store a published (reusable) Wormhole message.\"];\n type: {\n kind: \"struct\";\n fields: [\n {\n name: \"data\";\n type: {\n defined: {\n name: \"postedMessageV1Data\";\n };\n };\n },\n ];\n };\n },\n {\n name: \"postedMessageV1Info\";\n docs: [\"Message metadata defining information about a published Wormhole message.\"];\n type: {\n kind: \"struct\";\n fields: [\n {\n name: \"consistencyLevel\";\n docs: [\"Level of consistency requested by the emitter.\"];\n type: \"u8\";\n },\n {\n name: \"emitterAuthority\";\n docs: [\"Authority used to write the message. This field is set to default when the message is\", \"posted.\"];\n type: \"pubkey\";\n },\n {\n name: \"status\";\n docs: [\n \"If a message is being written to, this status is used to determine which state this\",\n \"account is in (e.g. [MessageStatus::Writing] indicates that the emitter authority is still\",\n \"writing its message to this account). When this message is posted, this value will be\",\n \"set to [MessageStatus::Published].\",\n ];\n type: {\n defined: {\n name: \"messageStatus\";\n };\n };\n },\n {\n name: \"gap0\";\n docs: [\"No data is stored here.\"];\n type: {\n array: [\"u8\", 3];\n };\n },\n {\n name: \"postedTimestamp\";\n docs: [\"Time the posted message was created.\"];\n type: {\n defined: {\n name: \"timestamp\";\n };\n };\n },\n {\n name: \"nonce\";\n docs: [\"Unique id for this message.\"];\n type: \"u32\";\n },\n {\n name: \"sequence\";\n docs: [\"Sequence number of this message.\"];\n type: \"u64\";\n },\n {\n name: \"solanaChainId\";\n docs: [\n \"Always `1`.\",\n \"\",\n \"NOTE: Saving this value is silly, but we are keeping it to be consistent with how the posted\",\n \"message account is written.\",\n ];\n type: {\n defined: {\n name: \"chainIdSolanaOnly\";\n };\n };\n },\n {\n name: \"emitter\";\n docs: [\"Emitter of the message. This may either be the emitter authority or a program ID.\"];\n type: \"pubkey\";\n },\n ];\n };\n },\n {\n name: \"postedMessageV1Data\";\n docs: [\n \"Underlying data for either [PostedMessageV1](crate::legacy::state::PostedMessageV1) or\",\n \"[PostedMessageV1Unreliable](crate::legacy::state::PostedMessageV1Unreliable).\",\n ];\n type: {\n kind: \"struct\";\n fields: [\n {\n name: \"info\";\n docs: [\"Message metadata.\"];\n type: {\n defined: {\n name: \"postedMessageV1Info\";\n };\n };\n },\n {\n name: \"payload\";\n docs: [\"Encoded message.\"];\n type: \"bytes\";\n },\n ];\n };\n },\n {\n name: \"postedMessageV1\";\n docs: [\n \"Account used to store a published Wormhole message.\",\n \"\",\n \"NOTE: If your integration requires reusable message accounts, please see\",\n \"[PostedMessageV1Unreliable](crate::legacy::state::PostedMessageV1Unreliable).\",\n ];\n type: {\n kind: \"struct\";\n fields: [\n {\n name: \"data\";\n docs: [\"Message data.\"];\n type: {\n defined: {\n name: \"postedMessageV1Data\";\n };\n };\n },\n ];\n };\n },\n {\n name: \"postedVaaV1Info\";\n docs: [\"VAA metadata defining information about a Wormhole message attested for by an active guardian\", \"set.\"];\n type: {\n kind: \"struct\";\n fields: [\n {\n name: \"consistencyLevel\";\n docs: [\"Level of consistency requested by the emitter.\"];\n type: \"u8\";\n },\n {\n name: \"timestamp\";\n docs: [\"Time the message was submitted.\"];\n type: {\n defined: {\n name: \"timestamp\";\n };\n };\n },\n {\n name: \"signatureSet\";\n docs: [\n \"Pubkey of [SignatureSet](crate::state::SignatureSet) account that represents this VAA's\",\n \"signature verification.\",\n ];\n type: \"pubkey\";\n },\n {\n name: \"guardianSetIndex\";\n docs: [\n \"Guardian set index used to verify signatures for [SignatureSet](crate::state::SignatureSet).\",\n \"\",\n 'NOTE: In the previous implementation, this member was referred to as the \"posted timestamp\",',\n \"which is zero for VAA data (posted messages and VAAs resemble the same account schema). By\",\n \"changing this to the guardian set index, we patch a bug with verifying governance VAAs for\",\n \"the Core Bridge (other Core Bridge implementations require that the guardian set that\",\n \"attested for the governance VAA is the current one).\",\n ];\n type: \"u32\";\n },\n {\n name: \"nonce\";\n docs: [\"Unique ID for this message.\"];\n type: \"u32\";\n },\n {\n name: \"sequence\";\n docs: [\"Sequence number of this message.\"];\n type: \"u64\";\n },\n {\n name: \"emitterChain\";\n docs: [\"The Wormhole chain ID denoting the origin of this message.\"];\n type: \"u16\";\n },\n {\n name: \"emitterAddress\";\n docs: [\"Emitter of the message.\"];\n type: {\n array: [\"u8\", 32];\n };\n },\n ];\n };\n },\n {\n name: \"postedVaaV1\";\n docs: [\"Account used to store a verified VAA.\"];\n type: {\n kind: \"struct\";\n fields: [\n {\n name: \"info\";\n docs: [\"VAA metadata.\"];\n type: {\n defined: {\n name: \"postedVaaV1Info\";\n };\n };\n },\n {\n name: \"payload\";\n docs: [\"Message payload.\"];\n type: \"bytes\";\n },\n ];\n };\n },\n {\n name: \"writeEncodedVaaArgs\";\n docs: [\n \"Arguments for the [write_encoded_vaa](crate::wormhole_core_bridge_solana::write_encoded_vaa)\",\n \"instruction.\",\n ];\n type: {\n kind: \"struct\";\n fields: [\n {\n name: \"index\";\n docs: [\"Index of VAA buffer.\"];\n type: \"u32\";\n },\n {\n name: \"data\";\n docs: [\"Data representing subset of VAA buffer starting at specified index.\"];\n type: \"bytes\";\n },\n ];\n };\n },\n {\n name: \"initMessageV1Args\";\n docs: [\n \"Arguments for the [init_message_v1](crate::wormhole_core_bridge_solana::init_message_v1)\",\n \"instruction.\",\n ];\n type: {\n kind: \"struct\";\n fields: [\n {\n name: \"nonce\";\n docs: [\"Unique id for this message.\"];\n type: \"u32\";\n },\n {\n name: \"commitment\";\n docs: [\"Solana commitment level for Guardian observation.\"];\n type: {\n defined: {\n name: \"commitment\";\n };\n };\n },\n {\n name: \"cpiProgramId\";\n docs: [\n \"Optional program ID if the emitter address will be your program ID.\",\n \"\",\n 'NOTE: If `Some(program_id)`, your emitter authority seeds to be \\\\[b\"emitter\\\\].',\n ];\n type: {\n option: \"pubkey\";\n };\n },\n ];\n };\n },\n {\n name: \"writeMessageV1Args\";\n docs: [\n \"Arguments for the [write_message_v1](crate::wormhole_core_bridge_solana::write_message_v1)\",\n \"instruction.\",\n ];\n type: {\n kind: \"struct\";\n fields: [\n {\n name: \"index\";\n docs: [\"Index of message buffer.\"];\n type: \"u32\";\n },\n {\n name: \"data\";\n docs: [\"Data representing subset of message buffer starting at specified index.\"];\n type: \"bytes\";\n },\n ];\n };\n },\n {\n name: \"header\";\n docs: [\"`EncodedVaa` account header.\"];\n type: {\n kind: \"struct\";\n fields: [\n {\n name: \"status\";\n docs: [\n \"Processing status. **This encoded VAA is only considered usable when this status is set\",\n \"to [Verified](ProcessingStatus::Verified).**\",\n ];\n type: {\n defined: {\n name: \"processingStatus\";\n };\n };\n },\n {\n name: \"writeAuthority\";\n docs: [\"The authority that has write privilege to this account.\"];\n type: \"pubkey\";\n },\n {\n name: \"version\";\n docs: [\"VAA version. Only when the VAA is verified is this version set to a value.\"];\n type: \"u8\";\n },\n ];\n };\n },\n {\n name: \"timestamp\";\n docs: [\n \"This struct defines unix timestamp as u32 (as opposed to more modern systems that have adopted\",\n \"i64). Methods for this struct are meant to convert Solana's clock type to this type assuming we\",\n \"are far from year 2038.\",\n ];\n type: {\n kind: \"struct\";\n fields: [\n {\n name: \"value\";\n type: \"u32\";\n },\n ];\n };\n },\n {\n name: \"duration\";\n docs: [\"To be used with the [Timestamp] type, this struct defines a duration in seconds.\"];\n type: {\n kind: \"struct\";\n fields: [\n {\n name: \"seconds\";\n type: \"u32\";\n },\n ];\n };\n },\n {\n name: \"messageHash\";\n docs: [\"This type is used to represent a message hash (keccak).\"];\n type: {\n kind: \"struct\";\n fields: [\n {\n name: \"bytes\";\n type: {\n array: [\"u8\", 32];\n };\n },\n ];\n };\n },\n {\n name: \"chainIdSolanaOnly\";\n docs: [\n \"This type is kind of silly. But because [PostedMessageV1](crate::state::PostedMessageV1) has the\",\n \"emitter chain ID as a field, which is unnecessary since it is always Solana's chain ID, we use\",\n \"this type to guarantee that the encoded chain ID is always `1`.\",\n ];\n type: {\n kind: \"struct\";\n fields: [\n {\n name: \"chainId\";\n type: \"u16\";\n },\n ];\n };\n },\n {\n name: \"emitterInfo\";\n type: {\n kind: \"struct\";\n fields: [\n {\n name: \"chain\";\n type: \"u16\";\n },\n {\n name: \"address\";\n type: {\n array: [\"u8\", 32];\n };\n },\n {\n name: \"sequence\";\n type: \"u64\";\n },\n ];\n };\n },\n {\n name: \"legacyInstruction\";\n docs: [\n \"Legacy instruction selector.\",\n \"\",\n \"NOTE: No more instructions should be added to this enum. Instead, add them as Anchor instruction\",\n \"handlers, which will inevitably live in\",\n \"[wormhole_core_bridge_solana](crate::wormhole_core_bridge_solana).\",\n ];\n type: {\n kind: \"enum\";\n variants: [\n {\n name: \"initialize\";\n },\n {\n name: \"postMessage\";\n },\n {\n name: \"postVaa\";\n },\n {\n name: \"setMessageFee\";\n },\n {\n name: \"transferFees\";\n },\n {\n name: \"upgradeContract\";\n },\n {\n name: \"guardianSetUpdate\";\n },\n {\n name: \"verifySignatures\";\n },\n {\n name: \"postMessageUnreliable\";\n },\n ];\n };\n },\n {\n name: \"emitterType\";\n type: {\n kind: \"enum\";\n variants: [\n {\n name: \"unset\";\n },\n {\n name: \"legacy\";\n },\n {\n name: \"executable\";\n },\n ];\n };\n },\n {\n name: \"messageStatus\";\n docs: [\"Status of a message. When a message is posted, its status is\", \"[Published](MessageStatus::Published).\"];\n type: {\n kind: \"enum\";\n variants: [\n {\n name: \"published\";\n },\n {\n name: \"writing\";\n },\n {\n name: \"readyForPublishing\";\n },\n ];\n };\n },\n {\n name: \"publishMessageDirective\";\n docs: [\"Directive used to determine how to post a Core Bridge message.\"];\n type: {\n kind: \"enum\";\n variants: [\n {\n name: \"message\";\n fields: [\n {\n name: \"nonce\";\n type: \"u32\";\n },\n {\n name: \"payload\";\n type: \"bytes\";\n },\n {\n name: \"commitment\";\n type: {\n defined: {\n name: \"commitment\";\n };\n };\n },\n ];\n },\n {\n name: \"programMessage\";\n fields: [\n {\n name: \"programId\";\n type: \"pubkey\";\n },\n {\n name: \"nonce\";\n type: \"u32\";\n },\n {\n name: \"payload\";\n type: \"bytes\";\n },\n {\n name: \"commitment\";\n type: {\n defined: {\n name: \"commitment\";\n };\n };\n },\n ];\n },\n {\n name: \"preparedMessage\";\n },\n ];\n };\n },\n {\n name: \"processingStatus\";\n docs: [\"Encoded VAA's processing status.\"];\n type: {\n kind: \"enum\";\n variants: [\n {\n name: \"unset\";\n },\n {\n name: \"writing\";\n },\n {\n name: \"verified\";\n },\n ];\n };\n },\n {\n name: \"commitment\";\n docs: [\n \"Representation of Solana's commitment levels. This enum is not exhaustive because Wormhole only\",\n \"considers these two commitment levels in its Guardian observation.\",\n \"\",\n \"See <https://docs.solana.com/cluster/commitments> for more info.\",\n ];\n type: {\n kind: \"enum\";\n variants: [\n {\n name: \"confirmed\";\n },\n {\n name: \"finalized\";\n },\n ];\n };\n },\n {\n name: \"guardianSet\";\n docs: [\n \"Account used to store a guardian set. The keys encoded in this account are Ethereum pubkeys.\",\n \"Its expiration time is determined at the time a guardian set is updated to a new set, where the\",\n \"current network clock time is used with\",\n \"[guardian_set_ttl](crate::state::Config::guardian_set_ttl).\",\n \"\",\n \"NOTE: The account schema is the same as legacy guardian sets, but this account now has a\",\n \"discriminator generated by Anchor's [account] macro. When the Core Bridge program performs a\",\n \"guardian set update with this implementation, guardian sets will now have this Anchor-generated\",\n \"discriminator.\",\n ];\n type: {\n kind: \"struct\";\n fields: [\n {\n name: \"index\";\n docs: [\"Index representing an incrementing version number for this guardian set.\"];\n type: \"u32\";\n },\n {\n name: \"keys\";\n docs: [\"Ethereum-style public keys.\"];\n type: {\n vec: {\n array: [\"u8\", 20];\n };\n };\n },\n {\n name: \"creationTime\";\n docs: [\"Timestamp representing the time this guardian became active.\"];\n type: {\n defined: {\n name: \"timestamp\";\n };\n };\n },\n {\n name: \"expirationTime\";\n docs: [\"Expiration time when VAAs issued by this set are no longer valid.\"];\n type: {\n defined: {\n name: \"timestamp\";\n };\n };\n },\n ];\n };\n },\n {\n name: \"signatureSet\";\n docs: [\n \"Account used to store information about a guardian set used to sign a VAA. There is only one\",\n \"signature set for each verified VAA (associated with a\",\n \"[PostedVaaV1](crate::legacy::state::PostedVaaV1) account). This account is created using the\",\n \"verify signatures legacy instruction.\",\n \"\",\n \"NOTE: The account schema is the same as legacy signature sets, but this account now has a\",\n \"discriminator generated by Anchor's [account] macro. When the Core Bridge program upgrades to\",\n \"this implementation from the old one, integrators in the middle of verifying signatures will\",\n \"have to use a new keypair for this account and try again.\",\n ];\n type: {\n kind: \"struct\";\n fields: [\n {\n name: \"sigVerifySuccesses\";\n docs: [\"Signatures of validators\"];\n type: {\n vec: \"bool\";\n };\n },\n {\n name: \"messageHash\";\n docs: [\"Hash of the VAA message body.\"];\n type: {\n defined: {\n name: \"messageHash\";\n };\n };\n },\n {\n name: \"guardianSetIndex\";\n docs: [\"Index of the guardian set\"];\n type: \"u32\";\n },\n ];\n };\n },\n {\n name: \"encodedVaa\";\n docs: [\n \"Account used to warehouse VAA buffer.\",\n \"\",\n \"NOTE: This account should not be used by an external application unless the header's status is\",\n \"`Verified`. It is encouraged to use the `EncodedVaa` zero-copy account struct instead.\",\n ];\n type: {\n kind: \"struct\";\n fields: [\n {\n name: \"header\";\n docs: [\"Status, write authority and VAA version.\"];\n type: {\n defined: {\n name: \"header\";\n };\n };\n },\n {\n name: \"buf\";\n docs: [\"VAA buffer.\"];\n type: \"bytes\";\n },\n ];\n };\n },\n ];\n constants: [\n {\n name: \"solanaChain\";\n type: \"u16\";\n value: \"1\";\n },\n {\n name: \"feeCollectorSeedPrefix\";\n type: \"bytes\";\n value: \"[102, 101, 101, 95, 99, 111, 108, 108, 101, 99, 116, 111, 114]\";\n },\n {\n name: \"upgradeSeedPrefix\";\n type: \"bytes\";\n value: \"[117, 112, 103, 114, 97, 100, 101]\";\n },\n {\n name: \"programEmitterSeedPrefix\";\n type: \"bytes\";\n value: \"[101, 109, 105, 116, 116, 101, 114]\";\n },\n {\n name: \"maxMessagePayloadSize\";\n type: {\n defined: {\n name: \"usize\";\n };\n };\n value: \"30 * 1_024\";\n },\n ];\n};\n\nexport const PYTH_WORMHOLE_IDL: WormholeCoreBridgeSolana = {\n address: \"HDwcJBJXjL9FpJ7UBsYBtaDjsBUhuLCUYoz3zr8SWWaQ\",\n metadata: {\n name: \"wormholeCoreBridgeSolana\",\n version: \"0.0.1-alpha.5\",\n spec: \"0.1.0\",\n },\n instructions: [\n {\n name: \"initMessageV1\",\n docs: [\n \"Processor for initializing a new draft [PostedMessageV1](crate::state::PostedMessageV1)\",\n \"account for writing. The emitter authority is established at this point and the payload size\",\n \"is inferred from the size of the created account. This instruction handler also allows an\",\n \"integrator to publish Wormhole messages using his program's ID as the emitter address\",\n \"(by passing `Some(crate::ID)` to the [cpi_program_id](InitMessageV1Args::cpi_program_id)\",\n 'argument). **Be aware that the emitter authority\\'s seeds must only be \\\\[b\"emitter\"\\\\] in this',\n \"case.**\",\n \"\",\n \"This instruction should be followed up with `write_message_v1` and `finalize_message_v1` to\",\n \"write and indicate that the message is ready for publishing respectively (to prepare it for\",\n \"publishing via the\",\n \"[post message instruction](crate::legacy::instruction::LegacyInstruction::PostMessage)).\",\n \"\",\n \"NOTE: If you wish to publish a small message (one where the data does not overflow the\",\n \"Solana transaction size), it is recommended that you use an [sdk](crate::sdk::cpi) method to\",\n \"either prepare your message or post a message as a program ID emitter.\",\n ],\n discriminator: [247, 187, 26, 16, 122, 198, 106, 247],\n accounts: [\n {\n name: \"emitterAuthority\",\n docs: [\"This authority is the only one who can write to the draft message account.\"],\n signer: true,\n },\n {\n name: \"draftMessage\",\n docs: [\"Bridge.\"],\n writable: true,\n },\n ],\n args: [\n {\n name: \"args\",\n type: {\n defined: {\n name: \"initMessageV1Args\",\n },\n },\n },\n ],\n },\n {\n name: \"writeMessageV1\",\n docs: [\n \"Processor used to write to a draft [PostedMessageV1](crate::state::PostedMessageV1) account.\",\n \"This instruction requires an authority (the emitter authority) to interact with the message\",\n \"account.\",\n ],\n discriminator: [35, 67, 197, 233, 94, 117, 124, 143],\n accounts: [\n {\n name: \"emitterAuthority\",\n signer: true,\n },\n {\n name: \"draftMessage\",\n docs: [\"only be published when the message is finalized.\"],\n writable: true,\n },\n ],\n args: [\n {\n name: \"args\",\n type: {\n defined: {\n name: \"writeMessageV1Args\",\n },\n },\n },\n ],\n },\n {\n name: \"finalizeMessageV1\",\n docs: [\n \"Processor used to finalize a draft [PostedMessageV1](crate::state::PostedMessageV1) account.\",\n \"Once finalized, this message account cannot be written to again. A finalized message is the\",\n \"only state the legacy post message instruction can accept before publishing. This\",\n \"instruction requires an authority (the emitter authority) to interact with the message\",\n \"account.\",\n ],\n discriminator: [245, 208, 215, 228, 129, 56, 51, 251],\n accounts: [\n {\n name: \"emitterAuthority\",\n signer: true,\n },\n {\n name: \"draftMessage\",\n docs: [\"only be published when the message is finalized.\"],\n writable: true,\n },\n ],\n args: [],\n },\n {\n name: \"closeMessageV1\",\n docs: [\n \"Processor used to process a draft [PostedMessageV1](crate::state::PostedMessageV1) account.\",\n \"This instruction requires an authority (the emitter authority) to interact with the message\",\n \"account.\",\n ],\n discriminator: [36, 185, 40, 107, 239, 13, 51, 162],\n accounts: [\n {\n name: \"emitterAuthority\",\n signer: true,\n },\n {\n name: \"draftMessage\",\n docs: [\"only be published when the message is finalized.\"],\n writable: true,\n },\n {\n name: \"closeAccountDestination\",\n writable: true,\n },\n ],\n args: [],\n },\n {\n name: \"initEncodedVaa\",\n docs: [\n \"Processor used to intialize a created account as [EncodedVaa](crate::state::EncodedVaa). An\",\n \"authority (the write authority) is established with this instruction.\",\n ],\n discriminator: [209, 193, 173, 25, 91, 202, 181, 218],\n accounts: [\n {\n name: \"writeAuthority\",\n docs: [\"The authority who can write to the VAA account when it is being processed.\"],\n signer: true,\n },\n {\n name: \"encodedVaa\",\n docs: [\"Bridge.\"],\n writable: true,\n },\n ],\n args: [],\n },\n {\n name: \"closeEncodedVaa\",\n docs: [\n \"Processor used to close an [EncodedVaa](crate::state::EncodedVaa). This instruction requires\",\n \"an authority (the write authority) to interact witht he encoded VAA account.\",\n ],\n discriminator: [48, 221, 174, 198, 231, 7, 152, 38],\n accounts: [\n {\n name: \"writeAuthority\",\n docs: [\n \"This account is only required to be mutable for the `CloseVaaAccount` directive. This\",\n \"authority is the same signer that originally created the VAA accounts, so he is the one that\",\n \"will receive the lamports back for the closed accounts.\",\n ],\n writable: true,\n signer: true,\n },\n {\n name: \"encodedVaa\",\n docs: [\"written to and then verified.\"],\n writable: true,\n },\n ],\n args: [],\n },\n {\n name: \"writeEncodedVaa\",\n docs: [\n \"Processor used to write to an [EncodedVaa](crate::state::EncodedVaa) account. This\",\n \"instruction requires an authority (the write authority) to interact with the encoded VAA\",\n \"account.\",\n ],\n discriminator: [199, 208, 110, 177, 150, 76, 118, 42],\n accounts: [\n {\n name: \"writeAuthority\",\n docs: [\"The only authority that can write to the encoded VAA account.\"],\n signer: true,\n },\n {\n name: \"draftVaa\",\n docs: [\"written to and then verified.\"],\n writable: true,\n },\n ],\n args: [\n {\n name: \"args\",\n type: {\n defined: {\n name: \"writeEncodedVaaArgs\",\n },\n },\n },\n ],\n },\n {\n name: \"verifyEncodedVaaV1\",\n docs: [\n \"Processor used to verify an [EncodedVaa](crate::state::EncodedVaa) account as a version 1\",\n \"VAA (guardian signatures attesting to this observation). This instruction requires an\",\n \"authority (the write authority) to interact with the encoded VAA account.\",\n ],\n discriminator: [103, 56, 177, 229, 240, 103, 68, 73],\n accounts: [\n {\n name: \"writeAuthority\",\n signer: true,\n },\n {\n name: \"draftVaa\",\n docs: [\"written to and then verified.\"],\n writable: true,\n },\n {\n name: \"guardianSet\",\n docs: [\n \"Guardian set account, which should be the same one that was used to attest for the VAA. The\",\n \"signatures in the encoded VAA are verified against this guardian set.\",\n ],\n },\n ],\n args: [],\n },\n {\n name: \"postVaaV1\",\n docs: [\n \"Processor used to close an [EncodedVaa](crate::state::EncodedVaa) account to create a\",\n \"[PostedMessageV1](crate::state::PostedMessageV1) account in its place.\",\n \"\",\n \"NOTE: Because the legacy verify signatures instruction was not required for the Posted VAA\",\n \"account to exist, the encoded [SignatureSet](crate::state::SignatureSet) is the default\",\n \"[Pubkey].\",\n ],\n discriminator: [0, 57, 97, 3, 225, 37, 254, 31],\n accounts: [\n {\n name: \"payer\",\n docs: [\n \"Payer to create the posted VAA account. This instruction allows anyone with an encoded VAA\",\n \"to create a posted VAA account.\",\n ],\n writable: true,\n signer: true,\n },\n {\n name: \"encodedVaa\",\n docs: [\n \"Encoded VAA, whose body will be serialized into the posted VAA account.\",\n \"\",\n \"NOTE: This instruction handler only exists to support integrators that still rely on posted\",\n \"VAA accounts. While we encourage integrators to use the encoded VAA account instead, we\",\n \"allow a pathway to convert the encoded VAA into a posted VAA. However, the payload is\",\n \"restricted to 9.5KB, which is much larger than what was possible with the old implementation\",\n \"using the legacy post vaa instruction. The Core Bridge program will not support posting VAAs\",\n \"larger than this payload size.\",\n ],\n },\n {\n name: \"postedVaa\",\n writable: true,\n },\n {\n name: \"systemProgram\",\n },\n ],\n args: [],\n },\n {\n name: \"closeSignatureSet\",\n docs: [\n \"Processor used to close a [SignatureSet](crate::state::SignatureSet), which was used to\",\n \"verify the VAA using the legacy parse and verify procedure.\",\n ],\n discriminator: [64, 154, 185, 168, 234, 229, 218, 103],\n accounts: [\n {\n name: \"solDestination\",\n writable: true,\n signer: true,\n },\n {\n name: \"postedVaa\",\n docs: [\"Posted VAA.\"],\n },\n {\n name: \"signatureSet\",\n docs: [\n \"Signature set that may have been used to create the posted VAA account. If the `post_vaa_v1`\",\n \"instruction were used to create the posted VAA account, then the encoded signature set\",\n \"pubkey would be all zeroes.\",\n ],\n writable: true,\n },\n ],\n args: [],\n },\n ],\n accounts: [\n {\n name: \"guardianSet\",\n discriminator: [16, 67, 62, 123, 169, 90, 100, 60],\n },\n {\n name: \"signatureSet\",\n discriminator: [135, 116, 238, 4, 218, 116, 194, 143],\n },\n {\n name: \"encodedVaa\",\n discriminator: [73, 170, 26, 37, 21, 245, 172, 192],\n },\n ],\n errors: [\n {\n code: 6002,\n name: \"invalidInstructionArgument\",\n msg: \"invalidInstructionArgument\",\n },\n {\n code: 6003,\n name: \"accountNotZeroed\",\n msg: \"accountNotZeroed\",\n },\n {\n code: 6004,\n name: \"invalidDataConversion\",\n msg: \"invalidDataConversion\",\n },\n {\n code: 6006,\n name: \"u64Overflow\",\n msg: \"u64Overflow\",\n },\n {\n code: 6008,\n name: \"invalidComputeSize\",\n msg: \"invalidComputeSize\",\n },\n {\n code: 6016,\n name: \"invalidChain\",\n msg: \"invalidChain\",\n },\n {\n code: 6032,\n name: \"invalidGovernanceEmitter\",\n msg: \"invalidGovernanceEmitter\",\n },\n {\n code: 6034,\n name: \"invalidGovernanceAction\",\n msg: \"invalidGovernanceAction\",\n },\n {\n code: 6036,\n name: \"latestGuardianSetRequired\",\n msg: \"latestGuardianSetRequired\",\n },\n {\n code: 6038,\n name: \"governanceForAnotherChain\",\n msg: \"governanceForAnotherChain\",\n },\n {\n code: 6040,\n name: \"invalidGovernanceVaa\",\n msg: \"invalidGovernanceVaa\",\n },\n {\n code: 6256,\n name: \"insufficientFees\",\n msg: \"insufficientFees\",\n },\n {\n code: 6258,\n name: \"emitterMismatch\",\n msg: \"emitterMismatch\",\n },\n {\n code: 6260,\n name: \"notReadyForPublishing\",\n msg: \"notReadyForPublishing\",\n },\n {\n code: 6262,\n name: \"invalidPreparedMessage\",\n msg: \"invalidPreparedMessage\",\n },\n {\n code: 6264,\n name: \"executableEmitter\",\n msg: \"executableEmitter\",\n },\n {\n code: 6266,\n name: \"legacyEmitter\",\n msg: \"legacyEmitter\",\n },\n {\n code: 6512,\n name: \"invalidSignatureSet\",\n msg: \"invalidSignatureSet\",\n },\n {\n code: 6514,\n name: \"invalidMessageHash\",\n msg: \"invalidMessageHash\",\n },\n {\n code: 6515,\n name: \"noQuorum\",\n msg: \"noQuorum\",\n },\n {\n code: 6516,\n name: \"messageMismatch\",\n msg: \"messageMismatch\",\n },\n {\n code: 7024,\n name: \"notEnoughLamports\",\n msg: \"notEnoughLamports\",\n },\n {\n code: 7026,\n name: \"invalidFeeRecipient\",\n msg: \"invalidFeeRecipient\",\n },\n {\n code: 7280,\n name: \"implementationMismatch\",\n msg: \"implementationMismatch\",\n },\n {\n code: 7536,\n name: \"invalidGuardianSetIndex\",\n msg: \"invalidGuardianSetIndex\",\n },\n {\n code: 7792,\n name: \"guardianSetMismatch\",\n msg: \"guardianSetMismatch\",\n },\n {\n code: 7794,\n name: \"instructionAtWrongIndex\",\n msg: \"instructionAtWrongIndex\",\n },\n {\n code: 7795,\n name: \"emptySigVerifyInstruction\",\n msg: \"emptySigVerifyInstruction\",\n },\n {\n code: 7796,\n name: \"invalidSigVerifyInstruction\",\n msg: \"invalidSigVerifyInstruction\",\n },\n {\n code: 7798,\n name: \"guardianSetExpired\",\n msg: \"guardianSetExpired\",\n },\n {\n code: 7800,\n name: \"invalidGuardianKeyRecovery\",\n msg: \"invalidGuardianKeyRecovery\",\n },\n {\n code: 7802,\n name: \"signerIndicesMismatch\",\n msg: \"signerIndicesMismatch\",\n },\n {\n code: 8048,\n name: \"payloadSizeMismatch\",\n msg: \"payloadSizeMismatch\",\n },\n {\n code: 10112,\n name: \"zeroGuardians\",\n msg: \"zeroGuardians\",\n },\n {\n code: 10128,\n name: \"guardianZeroAddress\",\n msg: \"guardianZeroAddress\",\n },\n {\n code: 10144,\n name: \"duplicateGuardianAddress\",\n msg: \"duplicateGuardianAddress\",\n },\n {\n code: 10160,\n name: \"messageAlreadyPublished\",\n msg: \"messageAlreadyPublished\",\n },\n {\n code: 10176,\n name: \"vaaWritingDisallowed\",\n msg: \"vaaWritingDisallowed\",\n },\n {\n code: 10192,\n name: \"vaaAlreadyVerified\",\n msg: \"vaaAlreadyVerified\",\n },\n {\n code: 10208,\n name: \"invalidGuardianIndex\",\n msg: \"invalidGuardianIndex\",\n },\n {\n code: 10224,\n name: \"invalidSignature\",\n msg: \"invalidSignature\",\n },\n {\n code: 10256,\n name: \"unverifiedVaa\",\n msg: \"unverifiedVaa\",\n },\n {\n code: 10258,\n name: \"vaaStillProcessing\",\n msg: \"vaaStillProcessing\",\n },\n {\n code: 10260,\n name: \"inWritingStatus\",\n msg: \"inWritingStatus\",\n },\n {\n code: 10262,\n name: \"notInWritingStatus\",\n msg: \"notInWritingStatus\",\n },\n {\n code: 10264,\n name: \"invalidMessageStatus\",\n msg: \"invalidMessageStatus\",\n },\n {\n code: 10266,\n name: \"hashNotComputed\",\n msg: \"hashNotComputed\",\n },\n {\n code: 10268,\n name: \"invalidVaaVersion\",\n msg: \"invalidVaaVersion\",\n },\n {\n code: 10270,\n name: \"invalidCreatedAccountSize\",\n msg: \"invalidCreatedAccountSize\",\n },\n {\n code: 10272,\n name: \"dataOverflow\",\n msg: \"dataOverflow\",\n },\n {\n code: 10274,\n name: \"exceedsMaxPayloadSize\",\n msg: \"ExceedsMaxPayloadSize (30KB)\",\n },\n {\n code: 10276,\n name: \"cannotParseVaa\",\n msg: \"cannotParseVaa\",\n },\n {\n code: 10278,\n name: \"emitterAuthorityMismatch\",\n msg: \"emitterAuthorityMismatch\",\n },\n {\n code: 10280,\n name: \"invalidProgramEmitter\",\n msg: \"invalidProgramEmitter\",\n },\n {\n code: 10282,\n name: \"writeAuthorityMismatch\",\n msg: \"writeAuthorityMismatch\",\n },\n {\n code: 10284,\n name: \"postedVaaPayloadTooLarge\",\n msg: \"postedVaaPayloadTooLarge\",\n },\n {\n code: 10286,\n name: \"executableDisallowed\",\n msg: \"executableDisallowed\",\n },\n ],\n types: [\n {\n name: \"initializeArgs\",\n docs: [\"Arguments used to initialize the Core Bridge program.\"],\n type: {\n kind: \"struct\",\n fields: [\n {\n name: \"guardianSetTtlSeconds\",\n type: \"u32\",\n },\n {\n name: \"feeLamports\",\n type: \"u64\",\n },\n {\n name: \"initialGuardians\",\n type: {\n vec: {\n array: [\"u8\", 20],\n },\n },\n },\n ],\n },\n },\n {\n name: \"postMessageArgs\",\n docs: [\n \"Arguments used to post a new Wormhole (Core Bridge) message either using\",\n \"[post_message](crate::legacy::instruction::post_message) or\",\n \"[post_message_unreliable](crate::legacy::instruction::post_message_unreliable).\",\n ],\n type: {\n kind: \"struct\",\n fields: [\n {\n name: \"nonce\",\n docs: [\"Unique id for this message.\"],\n type: \"u32\",\n },\n {\n name: \"payload\",\n docs: [\"Encoded message.\"],\n type: \"bytes\",\n },\n {\n name: \"commitment\",\n docs: [\"Solana commitment level for Guardian observation.\"],\n type: {\n defined: {\n name: \"commitment\",\n },\n },\n },\n ],\n },\n },\n {\n name: \"postVaaArgs\",\n docs: [\n \"Arguments to post new VAA data after signature verification.\",\n \"\",\n \"NOTE: It is preferred to use the new process of verifying a VAA using the new Core Bridge Anchor\",\n \"instructions. See [init_encoded_vaa](crate::wormhole_core_bridge_solana::init_encoded_vaa) and\",\n \"[write_encoded_vaa](crate::wormhole_core_bridge_solana::write_encoded_vaa) for more info.\",\n ],\n type: {\n kind: \"struct\",\n fields: [\n {\n name: \"gap0\",\n docs: [\"Unused data.\"],\n type: {\n array: [\"u8\", 5],\n },\n },\n {\n name: \"timestamp\",\n docs: [\"Time the message was submitted.\"],\n type: \"u32\",\n },\n {\n name: \"nonce\",\n docs: [\"Unique ID for this message.\"],\n type: \"u32\",\n },\n {\n name: \"emitterChain\",\n docs: [\"The Wormhole chain ID denoting the origin of this message.\"],\n type: \"u16\",\n },\n {\n name: \"emitterAddress\",\n docs: [\"Emitter of the message.\"],\n type: {\n array: [\"u8\", 32],\n },\n },\n {\n name: \"sequence\",\n docs: [\"Sequence number of this message.\"],\n type: \"u64\",\n },\n {\n name: \"consistencyLevel\",\n docs: [\"Level of consistency requested by the emitter.\"],\n type: \"u8\",\n },\n {\n name: \"payload\",\n docs: [\"Message payload.\"],\n type: \"bytes\",\n },\n ],\n },\n },\n {\n name: \"verifySignaturesArgs\",\n docs: [\n \"Arguments to verify specific guardian indices.\",\n \"\",\n \"NOTE: It is preferred to use the new process of verifying a VAA using the new Core Bridge Anchor\",\n \"instructions. See [init_encoded_vaa](crate::wormhole_core_bridge_solana::init_encoded_vaa) and\",\n \"[write_encoded_vaa](crate::wormhole_core_bridge_solana::write_encoded_vaa) for more info.\",\n ],\n type: {\n kind: \"struct\",\n fields: [\n {\n name: \"signerIndices\",\n docs: [\n \"Indices of verified guardian signatures, where -1 indicates a missing value. There is a\",\n \"missing value if the guardian at this index is not expected to have its signature verified by\",\n \"the Sig Verify native program in the instruction invoked prior).\",\n \"\",\n \"NOTE: In the legacy implementation, this argument being a fixed-sized array of 19 only\",\n \"allows the first 19 guardians of any size guardian set to be verified. Because of this, it\",\n \"is absolutely important to use the new process of verifying a VAA.\",\n ],\n type: {\n array: [\"i8\", 19],\n },\n },\n ],\n },\n },\n {\n name: \"emptyArgs\",\n docs: [\"Unit struct used to represent an empty instruction argument.\"],\n type: {\n kind: \"struct\",\n },\n },\n {\n name: \"config\",\n docs: [\n \"Account used to store the current configuration of the bridge, including tracking Wormhole fee\",\n \"payments. For governance decrees, the guardian set index is used to determine whether a decree\",\n \"was attested for using the latest guardian set.\",\n ],\n type: {\n kind: \"struct\",\n fields: [\n {\n name: \"guardianSetIndex\",\n docs: [\"The current guardian set index, used to decide which signature sets to accept.\"],\n type: \"u32\",\n },\n {\n name: \"gap0\",\n docs: [\n \"Gap. In the old implementation, this was an amount that kept track of message fees that\",\n \"were paid to the program's fee collector.\",\n ],\n type: {\n array: [\"u8\", 8],\n },\n },\n {\n name: \"guardianSetTtl\",\n docs: [\n \"Period for how long a guardian set is valid after it has been replaced by a new one. This\",\n \"guarantees that VAAs issued by that set can still be submitted for a certain period. In\",\n \"this period we still trust the old guardian set.\",\n ],\n type: {\n defined: {\n name: \"duration\",\n },\n },\n },\n {\n name: \"feeLamports\",\n docs: [\"Amount of lamports that needs to be paid to the protocol to post a message\"],\n type: \"u64\",\n },\n ],\n },\n },\n {\n name: \"legacyEmitterSequence\",\n docs: [\"Account used to store the current sequence number for a given emitter.\"],\n type: {\n kind: \"struct\",\n fields: [\n {\n name: \"value\",\n docs: [\"Current sequence number, which will be used the next time this emitter publishes a message.\"],\n type: \"u64\",\n },\n ],\n },\n },\n {\n name: \"emitterSequence\",\n type: {\n kind: \"struct\",\n fields: [\n {\n name: \"legacy\",\n type: {\n defined: {\n name: \"legacyEmitterSequence\",\n },\n },\n },\n {\n name: \"bump\",\n type: \"u8\",\n },\n {\n name: \"emitterType\",\n type: {\n defined: {\n name: \"emitterType\",\n },\n },\n },\n ],\n },\n },\n {\n name: \"postedMessageV1Unreliable\",\n docs: [\"Account used to store a published (reusable) Wormhole message.\"],\n type: {\n kind: \"struct\",\n fields: [\n {\n name: \"data\",\n type: {\n defined: {\n name: \"postedMessageV1Data\",\n },\n },\n },\n ],\n },\n },\n {\n name: \"postedMessageV1Info\",\n docs: [\"Message metadata defining information about a published Wormhole message.\"],\n type: {\n kind: \"struct\",\n fields: [\n {\n name: \"consistencyLevel\",\n docs: [\"Level of consistency requested by the emitter.\"],\n type: \"u8\",\n },\n {\n name: \"emitterAuthority\",\n docs: [\"Authority used to write the message. This field is set to default when the message is\", \"posted.\"],\n type: \"pubkey\",\n },\n {\n name: \"status\",\n docs: [\n \"If a message is being written to, this status is used to determine which state this\",\n \"account is in (e.g. [MessageStatus::Writing] indicates that the emitter authority is still\",\n \"writing its message to this account). When this message is posted, this value will be\",\n \"set to [MessageStatus::Published].\",\n ],\n type: {\n defined: {\n name: \"messageStatus\",\n },\n },\n },\n {\n name: \"gap0\",\n docs: [\"No data is stored here.\"],\n type: {\n array: [\"u8\", 3],\n },\n },\n {\n name: \"postedTimestamp\",\n docs: [\"Time the posted message was created.\"],\n type: {\n defined: {\n name: \"timestamp\",\n },\n },\n },\n {\n name: \"nonce\",\n docs: [\"Unique id for this message.\"],\n type: \"u32\",\n },\n {\n name: \"sequence\",\n docs: [\"Sequence number of this message.\"],\n type: \"u64\",\n },\n {\n name: \"solanaChainId\",\n docs: [\n \"Always `1`.\",\n \"\",\n \"NOTE: Saving this value is silly, but we are keeping it to be consistent with how the posted\",\n \"message account is written.\",\n ],\n type: {\n defined: {\n name: \"chainIdSolanaOnly\",\n },\n },\n },\n {\n name: \"emitter\",\n docs: [\"Emitter of the message. This may either be the emitter authority or a program ID.\"],\n type: \"pubkey\",\n },\n ],\n },\n },\n {\n name: \"postedMessageV1Data\",\n docs: [\n \"Underlying data for either [PostedMessageV1](crate::legacy::state::PostedMessageV1) or\",\n \"[PostedMessageV1Unreliable](crate::legacy::state::PostedMessageV1Unreliable).\",\n ],\n type: {\n kind: \"struct\",\n fields: [\n {\n name: \"info\",\n docs: [\"Message metadata.\"],\n type: {\n defined: {\n name: \"postedMessageV1Info\",\n },\n },\n },\n {\n name: \"payload\",\n docs: [\"Encoded message.\"],\n type: \"bytes\",\n },\n ],\n },\n },\n {\n name: \"postedMessageV1\",\n docs: [\n \"Account used to store a published Wormhole message.\",\n \"\",\n \"NOTE: If your integration requires reusable message accounts, please see\",\n \"[PostedMessageV1Unreliable](crate::legacy::state::PostedMessageV1Unreliable).\",\n ],\n type: {\n kind: \"struct\",\n fields: [\n {\n name: \"data\",\n docs: [\"Message data.\"],\n type: {\n defined: {\n name: \"postedMessageV1Data\",\n },\n },\n },\n ],\n },\n },\n {\n name: \"postedVaaV1Info\",\n docs: [\"VAA metadata defining information about a Wormhole message attested for by an active guardian\", \"set.\"],\n type: {\n kind: \"struct\",\n fields: [\n {\n name: \"consistencyLevel\",\n docs: [\"Level of consistency requested by the emitter.\"],\n type: \"u8\",\n },\n {\n name: \"timestamp\",\n docs: [\"Time the message was submitted.\"],\n type: {\n defined: {\n name: \"timestamp\",\n },\n },\n },\n {\n name: \"signatureSet\",\n docs: [\n \"Pubkey of [SignatureSet](crate::state::SignatureSet) account that represents this VAA's\",\n \"signature verification.\",\n ],\n type: \"pubkey\",\n },\n {\n name: \"guardianSetIndex\",\n docs: [\n \"Guardian set index used to verify signatures for [SignatureSet](crate::state::SignatureSet).\",\n \"\",\n 'NOTE: In the previous implementation, this member was referred to as the \"posted timestamp\",',\n \"which is zero for VAA data (posted messages and VAAs resemble the same account schema). By\",\n \"changing this to the guardian set index, we patch a bug with verifying governance VAAs for\",\n \"the Core Bridge (other Core Bridge implementations require that the guardian set that\",\n \"attested for the governance VAA is the current one).\",\n ],\n type: \"u32\",\n },\n {\n name: \"nonce\",\n docs: [\"Unique ID for this message.\"],\n type: \"u32\",\n },\n {\n name: \"sequence\",\n docs: [\"Sequence number of this message.\"],\n type: \"u64\",\n },\n {\n name: \"emitterChain\",\n docs: [\"The Wormhole chain ID denoting the origin of this message.\"],\n type: \"u16\",\n },\n {\n name: \"emitterAddress\",\n docs: [\"Emitter of the message.\"],\n type: {\n array: [\"u8\", 32],\n },\n },\n ],\n },\n },\n {\n name: \"postedVaaV1\",\n docs: [\"Account used to store a verified VAA.\"],\n type: {\n kind: \"struct\",\n fields: [\n {\n name: \"info\",\n docs: [\"VAA metadata.\"],\n type: {\n defined: {\n name: \"postedVaaV1Info\",\n },\n },\n },\n {\n name: \"payload\",\n docs: [\"Message payload.\"],\n type: \"bytes\",\n },\n ],\n },\n },\n {\n name: \"writeEncodedVaaArgs\",\n docs: [\n \"Arguments for the [write_encoded_vaa](crate::wormhole_core_bridge_solana::write_encoded_vaa)\",\n \"instruction.\",\n ],\n type: {\n kind: \"struct\",\n fields: [\n {\n name: \"index\",\n docs: [\"Index of VAA buffer.\"],\n type: \"u32\",\n },\n {\n name: \"data\",\n docs: [\"Data representing subset of VAA buffer starting at specified index.\"],\n type: \"bytes\",\n },\n ],\n },\n },\n {\n name: \"initMessageV1Args\",\n docs: [\n \"Arguments for the [init_message_v1](crate::wormhole_core_bridge_solana::init_message_v1)\",\n \"instruction.\",\n ],\n type: {\n kind: \"struct\",\n fields: [\n {\n name: \"nonce\",\n docs: [\"Unique id for this message.\"],\n type: \"u32\",\n },\n {\n name: \"commitment\",\n docs: [\"Solana commitment level for Guardian observation.\"],\n type: {\n defined: {\n name: \"commitment\",\n },\n },\n },\n {\n name: \"cpiProgramId\",\n docs: [\n \"Optional program ID if the emitter address will be your program ID.\",\n \"\",\n 'NOTE: If `Some(program_id)`, your emitter authority seeds to be \\\\[b\"emitter\\\\].',\n ],\n type: {\n option: \"pubkey\",\n },\n },\n ],\n },\n },\n {\n name: \"writeMessageV1Args\",\n docs: [\n \"Arguments for the [write_message_v1](crate::wormhole_core_bridge_solana::write_message_v1)\",\n \"instruction.\",\n ],\n type: {\n kind: \"struct\",\n fields: [\n {\n name: \"index\",\n docs: [\"Index of message buffer.\"],\n type: \"u32\",\n },\n {\n name: \"data\",\n docs: [\"Data representing subset of message buffer starting at specified index.\"],\n type: \"bytes\",\n },\n ],\n },\n },\n {\n name: \"header\",\n docs: [\"`EncodedVaa` account header.\"],\n type: {\n kind: \"struct\",\n fields: [\n {\n name: \"status\",\n docs: [\n \"Processing status. **This encoded VAA is only considered usable when this status is set\",\n \"to [Verified](ProcessingStatus::Verified).**\",\n ],\n type: {\n defined: {\n name: \"processingStatus\",\n },\n },\n },\n {\n name: \"writeAuthority\",\n docs: [\"The authority that has write privilege to this account.\"],\n type: \"pubkey\",\n },\n {\n name: \"version\",\n docs: [\"VAA version. Only when the VAA is verified is this version set to a value.\"],\n type: \"u8\",\n },\n ],\n },\n },\n {\n name: \"timestamp\",\n docs: [\n \"This struct defines unix timestamp as u32 (as opposed to more modern systems that have adopted\",\n \"i64). Methods for this struct are meant to convert Solana's clock type to this type assuming we\",\n \"are far from year 2038.\",\n ],\n type: {\n kind: \"struct\",\n fields: [\n {\n name: \"value\",\n type: \"u32\",\n },\n ],\n },\n },\n {\n name: \"duration\",\n docs: [\"To be used with the [Timestamp] type, this struct defines a duration in seconds.\"],\n type: {\n kind: \"struct\",\n fields: [\n {\n name: \"seconds\",\n type: \"u32\",\n },\n ],\n },\n },\n {\n name: \"messageHash\",\n docs: [\"This type is used to represent a message hash (keccak).\"],\n type: {\n kind: \"struct\",\n fields: [\n {\n name: \"bytes\",\n type: {\n array: [\"u8\", 32],\n },\n },\n ],\n },\n },\n {\n name: \"chainIdSolanaOnly\",\n docs: [\n \"This type is kind of silly. But because [PostedMessageV1](crate::state::PostedMessageV1) has the\",\n \"emitter chain ID as a field, which is unnecessary since it is always Solana's chain ID, we use\",\n \"this type to guarantee that the encoded chain ID is always `1`.\",\n ],\n type: {\n kind: \"struct\",\n fields: [\n {\n name: \"chainId\",\n type: \"u16\",\n },\n ],\n },\n },\n {\n name: \"emitterInfo\",\n type: {\n kind: \"struct\",\n fields: [\n {\n name: \"chain\",\n type: \"u16\",\n },\n {\n name: \"address\",\n type: {\n array: [\"u8\", 32],\n },\n },\n {\n name: \"sequence\",\n type: \"u64\",\n },\n ],\n },\n },\n {\n name: \"legacyInstruction\",\n docs: [\n \"Legacy instruction selector.\",\n \"\",\n \"NOTE: No more instructions should be added to this enum. Instead, add them as Anchor instruction\",\n \"handlers, which will inevitably live in\",\n \"[wormhole_core_bridge_solana](crate::wormhole_core_bridge_solana).\",\n ],\n type: {\n kind: \"enum\",\n variants: [\n {\n name: \"initialize\",\n },\n {\n name: \"postMessage\",\n },\n {\n name: \"postVaa\",\n },\n {\n name: \"setMessageFee\",\n },\n {\n name: \"transferFees\",\n },\n {\n name: \"upgradeContract\",\n },\n {\n name: \"guardianSetUpdate\",\n },\n {\n name: \"verifySignatures\",\n },\n {\n name: \"postMessageUnreliable\",\n },\n ],\n },\n },\n {\n name: \"emitterType\",\n type: {\n kind: \"enum\",\n variants: [\n {\n name: \"unset\",\n },\n {\n name: \"legacy\",\n },\n {\n name: \"executable\",\n },\n ],\n },\n },\n {\n name: \"messageStatus\",\n docs: [\"Status of a message. When a message is posted, its status is\", \"[Published](MessageStatus::Published).\"],\n type: {\n kind: \"enum\",\n variants: [\n {\n name: \"published\",\n },\n {\n name: \"writing\",\n },\n {\n name: \"readyForPublishing\",\n },\n ],\n },\n },\n {\n name: \"publishMessageDirective\",\n docs: [\"Directive used to determine how to post a Core Bridge message.\"],\n type: {\n kind: \"enum\",\n variants: [\n {\n name: \"message\",\n fields: [\n {\n name: \"nonce\",\n type: \"u32\",\n },\n {\n name: \"payload\",\n type: \"bytes\",\n },\n {\n name: \"commitment\",\n type: {\n defined: {\n name: \"commitment\",\n },\n },\n },\n ],\n },\n {\n name: \"programMessage\",\n fields: [\n {\n name: \"programId\",\n type: \"pubkey\",\n },\n {\n name: \"nonce\",\n type: \"u32\",\n },\n {\n name: \"payload\",\n type: \"bytes\",\n },\n {\n name: \"commitment\",\n type: {\n defined: {\n name: \"commitment\",\n },\n },\n },\n ],\n },\n {\n name: \"preparedMessage\",\n },\n ],\n },\n },\n {\n name: \"processingStatus\",\n docs: [\"Encoded VAA's processing status.\"],\n type: {\n kind: \"enum\",\n variants: [\n {\n name: \"unset\",\n },\n {\n name: \"writing\",\n },\n {\n name: \"verified\",\n },\n ],\n },\n },\n {\n name: \"commitment\",\n docs: [\n \"Representation of Solana's commitment levels. This enum is not exhaustive because Wormhole only\",\n \"considers these two commitment levels in its Guardian observation.\",\n \"\",\n \"See <https://docs.solana.com/cluster/commitments> for more info.\",\n ],\n type: {\n kind: \"enum\",\n variants: [\n {\n name: \"confirmed\",\n },\n {\n name: \"finalized\",\n },\n ],\n },\n },\n {\n name: \"guardianSet\",\n docs: [\n \"Account used to store a guardian set. The keys encoded in this account are Ethereum pubkeys.\",\n \"Its expiration time is determined at the time a guardian set is updated to a new set, where the\",\n \"current network clock time is used with\",\n \"[guardian_set_ttl](crate::state::Config::guardian_set_ttl).\",\n \"\",\n \"NOTE: The account schema is the same as legacy guardian sets, but this account now has a\",\n \"discriminator generated by Anchor's [account] macro. When the Core Bridge program performs a\",\n \"guardian set update with this implementation, guardian sets will now have this Anchor-generated\",\n \"discriminator.\",\n ],\n type: {\n kind: \"struct\",\n fields: [\n {\n name: \"index\",\n docs: [\"Index representing an incrementing version number for this guardian set.\"],\n type: \"u32\",\n },\n {\n name: \"keys\",\n docs: [\"Ethereum-style public keys.\"],\n type: {\n vec: {\n array: [\"u8\", 20],\n },\n },\n },\n {\n name: \"creationTime\",\n docs: [\"Timestamp representing the time this guardian became active.\"],\n type: {\n defined: {\n name: \"timestamp\",\n },\n },\n },\n {\n name: \"expirationTime\",\n docs: [\"Expiration time when VAAs issued by this set are no longer valid.\"],\n type: {\n defined: {\n name: \"timestamp\",\n },\n },\n },\n ],\n },\n },\n {\n name: \"signatureSet\",\n docs: [\n \"Account used to store information about a guardian set used to sign a VAA. There is only one\",\n \"signature set for each verified VAA (associated with a\",\n \"[PostedVaaV1](crate::legacy::state::PostedVaaV1) account). This account is created using the\",\n \"verify signatures legacy instruction.\",\n \"\",\n \"NOTE: The account schema is the same as legacy signature sets, but this account now has a\",\n \"discriminator generated by Anchor's [account] macro. When the Core Bridge program upgrades to\",\n \"this implementation from the old one, integrators in the middle of verifying signatures will\",\n \"have to use a new keypair for this account and try again.\",\n ],\n type: {\n kind: \"struct\",\n fields: [\n {\n name: \"sigVerifySuccesses\",\n docs: [\"Signatures of validators\"],\n type: {\n vec: \"bool\",\n },\n },\n {\n name: \"messageHash\",\n docs: [\"Hash of the VAA message body.\"],\n type: {\n defined: {\n name: \"messageHash\",\n },\n },\n },\n {\n name: \"guardianSetIndex\",\n docs: [\"Index of the guardian set\"],\n type: \"u32\",\n },\n ],\n },\n },\n {\n name: \"encodedVaa\",\n docs: [\n \"Account used to warehouse VAA buffer.\",\n \"\",\n \"NOTE: This account should not be used by an external application unless the header's status is\",\n \"`Verified`. It is encouraged to use the `EncodedVaa` zero-copy account struct instead.\",\n ],\n type: {\n kind: \"struct\",\n fields: [\n {\n name: \"header\",\n docs: [\"Status, write authority and VAA version.\"],\n type: {\n defined: {\n name: \"header\",\n },\n },\n },\n {\n name: \"buf\",\n docs: [\"VAA buffer.\"],\n type: \"bytes\",\n },\n ],\n },\n },\n ],\n constants: [\n {\n name: \"solanaChain\",\n type: \"u16\",\n value: \"1\",\n },\n {\n name: \"feeCollectorSeedPrefix\",\n type: \"bytes\",\n value: \"[102, 101, 101, 95, 99, 111, 108, 108, 101, 99, 116, 111, 114]\",\n },\n {\n name: \"upgradeSeedPrefix\",\n type: \"bytes\",\n value: \"[117, 112, 103, 114, 97, 100, 101]\",\n },\n {\n name: \"programEmitterSeedPrefix\",\n type: \"bytes\",\n value: \"[101, 109, 105, 116, 116, 101, 114]\",\n },\n {\n name: \"maxMessagePayloadSize\",\n type: {\n defined: {\n name: \"usize\",\n },\n },\n value: \"30 * 1_024\",\n },\n ],\n};\n","/**\n * Program IDL in camelCase format in order to be used in JS/TS.\n *\n * Note that this is only a type helper and is not the actual IDL. The original\n * IDL can be found at `target/idl/pyth_solana_receiver.json`.\n */\nexport type PythSolanaReceiver = {\n address: \"rec5EKMGg6MxZYaMdyBfgwp4d5rB9T1VQH5pJv5LtFJ\";\n metadata: {\n name: \"pyth_solana_receiver\";\n version: \"0.2.0\";\n spec: \"0.1.0\";\n };\n instructions: [\n {\n name: \"initialize\";\n discriminator: [175, 175, 109, 31, 13, 152, 155, 237];\n accounts: [\n {\n name: \"payer\";\n writable: true;\n signer: true;\n },\n {\n name: \"config\";\n writable: true;\n },\n {\n name: \"systemProgram\";\n },\n ];\n args: [\n {\n name: \"initialConfig\";\n type: {\n defined: {\n name: \"config\";\n };\n };\n },\n ];\n },\n {\n name: \"requestGovernanceAuthorityTransfer\";\n discriminator: [92, 18, 67, 156, 27, 151, 183, 224];\n accounts: [\n {\n name: \"payer\";\n signer: true;\n },\n {\n name: \"config\";\n writable: true;\n },\n ];\n args: [\n {\n name: \"targetGovernanceAuthority\";\n type: \"pubkey\";\n },\n ];\n },\n {\n name: \"acceptGovernanceAuthorityTransfer\";\n discriminator: [254, 39, 222, 79, 64, 217, 205, 127];\n accounts: [\n {\n name: \"payer\";\n signer: true;\n },\n {\n name: \"config\";\n writable: true;\n },\n ];\n args: [];\n },\n {\n name: \"setDataSources\";\n discriminator: [107, 73, 15, 119, 195, 116, 91, 210];\n accounts: [\n {\n name: \"payer\";\n signer: true;\n },\n {\n name: \"config\";\n writable: true;\n },\n ];\n args: [\n {\n name: \"validDataSources\";\n type: {\n vec: {\n defined: {\n name: \"dataSource\";\n };\n };\n };\n },\n ];\n },\n {\n name: \"setFee\";\n discriminator: [18, 154, 24, 18, 237, 214, 19, 80];\n accounts: [\n {\n name: \"payer\";\n signer: true;\n },\n {\n name: \"config\";\n writable: true;\n },\n ];\n args: [\n {\n name: \"singleUpdateFeeInLamports\";\n type: \"u64\";\n },\n ];\n },\n {\n name: \"setWormholeAddress\";\n discriminator: [154, 174, 252, 157, 91, 215, 179, 156];\n accounts: [\n {\n name: \"payer\";\n signer: true;\n },\n {\n name: \"config\";\n writable: true;\n },\n ];\n args: [\n {\n name: \"wormhole\";\n type: \"pubkey\";\n },\n ];\n },\n {\n name: \"setMinimumSignatures\";\n discriminator: [5, 210, 206, 124, 43, 68, 104, 149];\n accounts: [\n {\n name: \"payer\";\n signer: true;\n },\n {\n name: \"config\";\n writable: true;\n },\n ];\n args: [\n {\n name: \"minimumSignatures\";\n type: \"u8\";\n },\n ];\n },\n {\n name: \"postUpdateAtomic\";\n docs: [\n \"Post a price update using a VAA and a MerklePriceUpdate.\",\n \"This function allows you to post a price update in a single transaction.\",\n \"Compared to post_update, it is less secure since you won't be able to verify all guardian signatures if you use this function because of transaction size limitations.\",\n \"Typically, you can fit 5 guardian signatures in a transaction that uses this.\",\n ];\n discriminator: [49, 172, 84, 192, 175, 180, 52, 234];\n accounts: [\n {\n name: \"payer\";\n writable: true;\n signer: true;\n },\n {\n name: \"guardianSet\";\n docs: [\"Instead we do the same steps in deserialize_guardian_set_checked.\"];\n },\n {\n name: \"config\";\n },\n {\n name: \"treasury\";\n writable: true;\n },\n {\n name: \"priceUpdateAccount\";\n docs: [\n \"The contraint is such that either the price_update_account is uninitialized or the payer is the write_authority.\",\n \"Pubkey::default() is the SystemProgram on Solana and it can't sign so it's impossible that price_update_account.write_authority == Pubkey::default() once the account is initialized\",\n ];\n writable: true;\n signer: true;\n },\n {\n name: \"systemProgram\";\n },\n {\n name: \"writeAuthority\";\n signer: true;\n },\n ];\n args: [\n {\n name: \"params\";\n type: {\n defined: {\n name: \"postUpdateAtomicParams\";\n };\n };\n },\n ];\n },\n {\n name: \"postUpdate\";\n docs: [\n \"Post a price update using an encoded_vaa account and a MerklePriceUpdate calldata.\",\n \"This should be called after the client has already verified the Vaa via the Wormhole contract.\",\n \"Check out target_chains/solana/cli/src/main.rs for an example of how to do this.\",\n ];\n discriminator: [133, 95, 207, 175, 11, 79, 118, 44];\n accounts: [\n {\n name: \"payer\";\n writable: true;\n signer: true;\n },\n {\n name: \"encodedVaa\";\n },\n {\n name: \"config\";\n },\n {\n name: \"treasury\";\n writable: true;\n },\n {\n name: \"priceUpdateAccount\";\n docs: [\n \"The contraint is such that either the price_update_account is uninitialized or the payer is the write_authority.\",\n \"Pubkey::default() is the SystemProgram on Solana and it can't sign so it's impossible that price_update_account.write_authority == Pubkey::default() once the account is initialized\",\n ];\n writable: true;\n signer: true;\n },\n {\n name: \"systemProgram\";\n },\n {\n name: \"writeAuthority\";\n signer: true;\n },\n ];\n args: [\n {\n name: \"params\";\n type: {\n defined: {\n name: \"postUpdateParams\";\n };\n };\n },\n ];\n },\n {\n name: \"postTwapUpdate\";\n docs: [\n \"Post a TWAP (time weighted average price) update for a given time window.\",\n \"This should be called after the client has already verified the VAAs via the Wormhole contract.\",\n \"Check out target_chains/solana/cli/src/main.rs for an example of how to do this.\",\n ];\n discriminator: [232, 176, 212, 105, 69, 121, 18, 30];\n accounts: [\n {\n name: \"payer\";\n writable: true;\n signer: true;\n },\n {\n name: \"startEncodedVaa\";\n },\n {\n name: \"endEncodedVaa\";\n },\n {\n name: \"config\";\n },\n {\n name: \"treasury\";\n writable: true;\n },\n {\n name: \"twapUpdateAccount\";\n docs: [\n \"The contraint is such that either the twap_update_account is uninitialized or the write_authority is the write_authority.\",\n \"Pubkey::default() is the SystemProgram on Solana and it can't sign so it's impossible that twap_update_account.write_authority == Pubkey::default() once the account is initialized\",\n ];\n writable: true;\n signer: true;\n },\n {\n name: \"systemProgram\";\n },\n {\n name: \"writeAuthority\";\n signer: true;\n },\n ];\n args: [\n {\n name: \"params\";\n type: {\n defined: {\n name: \"postTwapUpdateParams\";\n };\n };\n },\n ];\n },\n {\n name: \"reclaimRent\";\n discriminator: [218, 200, 19, 197, 227, 89, 192, 22];\n accounts: [\n {\n name: \"payer\";\n writable: true;\n signer: true;\n },\n {\n name: \"priceUpdateAccount\";\n writable: true;\n },\n ];\n args: [];\n },\n {\n name: \"reclaimTwapRent\";\n discriminator: [84, 3, 32, 238, 108, 217, 135, 39];\n accounts: [\n {\n name: \"payer\";\n writable: true;\n signer: true;\n },\n {\n name: \"twapUpdateAccount\";\n writable: true;\n },\n ];\n args: [];\n },\n ];\n accounts: [\n {\n name: \"config\";\n discriminator: [155, 12, 170, 224, 30, 250, 204, 130];\n },\n {\n name: \"priceUpdateV2\";\n discriminator: [70, 9, 59, 15, 151, 95, 3, 234];\n },\n {\n name: \"twapUpdate\";\n discriminator: [138, 162, 109, 54, 148, 149, 159, 138];\n },\n ];\n errors: [\n {\n code: 6000;\n name: \"invalidWormholeMessage\";\n msg: \"Received an invalid wormhole message\";\n },\n {\n code: 6001;\n name: \"deserializeMessageFailed\";\n msg: \"An error occurred when deserializing the message\";\n },\n {\n code: 6002;\n name: \"invalidPriceUpdate\";\n msg: \"Received an invalid price update\";\n },\n {\n code: 6003;\n name: \"unsupportedMessageType\";\n msg: \"This type of message is not supported currently\";\n },\n {\n code: 6004;\n name: \"invalidDataSource\";\n msg: \"The tuple emitter chain, emitter doesn't match one of the valid data sources.\";\n },\n {\n code: 6005;\n name: \"insufficientFunds\";\n msg: \"Funds are insufficient to pay the receiving fee\";\n },\n {\n code: 6006;\n name: \"wrongWriteAuthority\";\n msg: \"This signer can't write to price update account\";\n },\n {\n code: 6007;\n name: \"wrongVaaOwner\";\n msg: \"The posted VAA account has the wrong owner.\";\n },\n {\n code: 6008;\n name: \"deserializeVaaFailed\";\n msg: \"An error occurred when deserializing the VAA.\";\n },\n {\n code: 6009;\n name: \"insufficientGuardianSignatures\";\n msg: \"The number of guardian signatures is below the minimum\";\n },\n {\n code: 6010;\n name: \"invalidVaaVersion\";\n msg: \"Invalid VAA version\";\n },\n {\n code: 6011;\n name: \"guardianSetMismatch\";\n msg: \"Guardian set version in the VAA doesn't match the guardian set passed\";\n },\n {\n code: 6012;\n name: \"invalidGuardianOrder\";\n msg: \"Guardian signature indices must be increasing\";\n },\n {\n code: 6013;\n name: \"invalidGuardianIndex\";\n msg: \"Guardian index exceeds the number of guardians in the set\";\n },\n {\n code: 6014;\n name: \"invalidSignature\";\n msg: \"A VAA signature is invalid\";\n },\n {\n code: 6015;\n name: \"invalidGuardianKeyRecovery\";\n msg: \"The recovered guardian public key doesn't match the guardian set\";\n },\n {\n code: 6016;\n name: \"wrongGuardianSetOwner\";\n msg: \"The guardian set account is owned by the wrong program\";\n },\n {\n code: 6017;\n name: \"invalidGuardianSetPda\";\n msg: \"The Guardian Set account doesn't match the PDA derivation\";\n },\n {\n code: 6018;\n name: \"guardianSetExpired\";\n msg: \"The Guardian Set is expired\";\n },\n {\n code: 6019;\n name: \"governanceAuthorityMismatch\";\n msg: \"The signer is not authorized to perform this governance action\";\n },\n {\n code: 6020;\n name: \"targetGovernanceAuthorityMismatch\";\n msg: \"The signer is not authorized to accept the governance authority\";\n },\n {\n code: 6021;\n name: \"nonexistentGovernanceAuthorityTransferRequest\";\n msg: \"The governance authority needs to request a transfer first\";\n },\n ];\n types: [\n {\n name: \"priceFeedMessage\";\n type: {\n kind: \"struct\";\n fields: [\n {\n name: \"feedId\";\n type: {\n array: [\"u8\", 32];\n };\n },\n {\n name: \"price\";\n type: \"i64\";\n },\n {\n name: \"conf\";\n type: \"u64\";\n },\n {\n name: \"exponent\";\n type: \"i32\";\n },\n {\n name: \"publishTime\";\n type: \"i64\";\n },\n {\n name: \"prevPublishTime\";\n type: \"i64\";\n },\n {\n name: \"emaPrice\";\n type: \"i64\";\n },\n {\n name: \"emaConf\";\n type: \"u64\";\n },\n ];\n };\n },\n {\n name: \"twapPrice\";\n docs: [\n \"The time weighted average price & conf for a feed over the window [start_time, end_time].\",\n \"This type is used to persist the calculated TWAP in TwapUpdate accounts on Solana.\",\n ];\n type: {\n kind: \"struct\";\n fields: [\n {\n name: \"feedId\";\n type: {\n array: [\"u8\", 32];\n };\n },\n {\n name: \"startTime\";\n type: \"i64\";\n },\n {\n name: \"endTime\";\n type: \"i64\";\n },\n {\n name: \"price\";\n type: \"i64\";\n },\n {\n name: \"conf\";\n type: \"u64\";\n },\n {\n name: \"exponent\";\n type: \"i32\";\n },\n {\n name: \"downSlotsRatio\";\n docs: [\n \"Ratio out of 1_000_000, where a value of 1_000_000 represents\",\n \"all slots were missed and 0 represents no slots were missed.\",\n ];\n type: \"u32\";\n },\n ];\n };\n },\n {\n name: \"merklePriceUpdate\";\n type: {\n kind: \"struct\";\n fields: [\n {\n name: \"message\";\n type: \"bytes\";\n },\n {\n name: \"proof\";\n type: {\n vec: {\n array: [\"u8\", 20];\n };\n };\n },\n ];\n };\n },\n {\n name: \"dataSource\";\n type: {\n kind: \"struct\";\n fields: [\n {\n name: \"chain\";\n type: \"u16\";\n },\n {\n name: \"emitter\";\n type: \"pubkey\";\n },\n ];\n };\n },\n {\n name: \"postUpdateAtomicParams\";\n type: {\n kind: \"struct\";\n fields: [\n {\n name: \"vaa\";\n type: \"bytes\";\n },\n {\n name: \"merklePriceUpdate\";\n type: {\n defined: {\n name: \"merklePriceUpdate\";\n };\n };\n },\n {\n name: \"treasuryId\";\n type: \"u8\";\n },\n ];\n };\n },\n {\n name: \"postUpdateParams\";\n type: {\n kind: \"struct\";\n fields: [\n {\n name: \"merklePriceUpdate\";\n type: {\n defined: {\n name: \"merklePriceUpdate\";\n };\n };\n },\n {\n name: \"treasuryId\";\n type: \"u8\";\n },\n ];\n };\n },\n {\n name: \"postTwapUpdateParams\";\n type: {\n kind: \"struct\";\n fields: [\n {\n name: \"startMerklePriceUpdate\";\n type: {\n defined: {\n name: \"merklePriceUpdate\";\n };\n };\n },\n {\n name: \"endMerklePriceUpdate\";\n type: {\n defined: {\n name: \"merklePriceUpdate\";\n };\n };\n },\n {\n name: \"treasuryId\";\n type: \"u8\";\n },\n ];\n };\n },\n {\n name: \"verificationLevel\";\n docs: [\n \"* This enum represents how many guardian signatures were checked for a Pythnet price update\\n * If full, guardian quorum has been attained\\n * If partial, at least config.minimum signatures have been verified, but in the case config.minimum_signatures changes in the future we also include the number of signatures that were checked\",\n ];\n type: {\n kind: \"enum\";\n variants: [\n {\n name: \"partial\";\n fields: [\n {\n name: \"numSignatures\";\n type: \"u8\";\n },\n ];\n },\n {\n name: \"full\";\n },\n ];\n };\n },\n {\n name: \"config\";\n type: {\n kind: \"struct\";\n fields: [\n {\n name: \"governanceAuthority\";\n type: \"pubkey\";\n },\n {\n name: \"targetGovernanceAuthority\";\n type: {\n option: \"pubkey\";\n };\n },\n {\n name: \"wormhole\";\n type: \"pubkey\";\n },\n {\n name: \"validDataSources\";\n type: {\n vec: {\n defined: {\n name: \"dataSource\";\n };\n };\n };\n },\n {\n name: \"singleUpdateFeeInLamports\";\n type: \"u64\";\n },\n {\n name: \"minimumSignatures\";\n type: \"u8\";\n },\n ];\n };\n },\n {\n name: \"priceUpdateV2\";\n type: {\n kind: \"struct\";\n fields: [\n {\n name: \"writeAuthority\";\n type: \"pubkey\";\n },\n {\n name: \"verificationLevel\";\n type: {\n defined: {\n name: \"verificationLevel\";\n };\n };\n },\n {\n name: \"priceMessage\";\n type: {\n defined: {\n name: \"priceFeedMessage\";\n };\n };\n },\n {\n name: \"postedSlot\";\n type: \"u64\";\n },\n ];\n };\n },\n {\n name: \"twapUpdate\";\n type: {\n kind: \"struct\";\n fields: [\n {\n name: \"writeAuthority\";\n type: \"pubkey\";\n },\n {\n name: \"twap\";\n type: {\n defined: {\n name: \"twapPrice\";\n };\n };\n },\n ];\n };\n },\n ];\n};\n\nexport const PYTH_SOLANA_RECEIVER_PROGRAM_IDL: PythSolanaReceiver = {\n address: \"rec5EKMGg6MxZYaMdyBfgwp4d5rB9T1VQH5pJv5LtFJ\",\n metadata: {\n name: \"pyth_solana_receiver\",\n version: \"0.2.0\",\n spec: \"0.1.0\",\n },\n instructions: [\n {\n name: \"initialize\",\n discriminator: [175, 175, 109, 31, 13, 152, 155, 237],\n accounts: [\n {\n name: \"payer\",\n writable: true,\n signer: true,\n },\n {\n name: \"config\",\n writable: true,\n },\n {\n name: \"systemProgram\",\n },\n ],\n args: [\n {\n name: \"initialConfig\",\n type: {\n defined: {\n name: \"config\",\n },\n },\n },\n ],\n },\n {\n name: \"requestGovernanceAuthorityTransfer\",\n discriminator: [92, 18, 67, 156, 27, 151, 183, 224],\n accounts: [\n {\n name: \"payer\",\n signer: true,\n },\n {\n name: \"config\",\n writable: true,\n },\n ],\n args: [\n {\n name: \"targetGovernanceAuthority\",\n type: \"pubkey\",\n },\n ],\n },\n {\n name: \"acceptGovernanceAuthorityTransfer\",\n discriminator: [254, 39, 222, 79, 64, 217, 205, 127],\n accounts: [\n {\n name: \"payer\",\n signer: true,\n },\n {\n name: \"config\",\n writable: true,\n },\n ],\n args: [],\n },\n {\n name: \"setDataSources\",\n discriminator: [107, 73, 15, 119, 195, 116, 91, 210],\n accounts: [\n {\n name: \"payer\",\n signer: true,\n },\n {\n name: \"config\",\n writable: true,\n },\n ],\n args: [\n {\n name: \"validDataSources\",\n type: {\n vec: {\n defined: {\n name: \"dataSource\",\n },\n },\n },\n },\n ],\n },\n {\n name: \"setFee\",\n discriminator: [18, 154, 24, 18, 237, 214, 19, 80],\n accounts: [\n {\n name: \"payer\",\n signer: true,\n },\n {\n name: \"config\",\n writable: true,\n },\n ],\n args: [\n {\n name: \"singleUpdateFeeInLamports\",\n type: \"u64\",\n },\n ],\n },\n {\n name: \"setWormholeAddress\",\n discriminator: [154, 174, 252, 157, 91, 215, 179, 156],\n accounts: [\n {\n name: \"payer\",\n signer: true,\n },\n {\n name: \"config\",\n writable: true,\n },\n ],\n args: [\n {\n name: \"wormhole\",\n type: \"pubkey\",\n },\n ],\n },\n {\n name: \"setMinimumSignatures\",\n discriminator: [5, 210, 206, 124, 43, 68, 104, 149],\n accounts: [\n {\n name: \"payer\",\n signer: true,\n },\n {\n name: \"config\",\n writable: true,\n },\n ],\n args: [\n {\n name: \"minimumSignatures\",\n type: \"u8\",\n },\n ],\n },\n {\n name: \"postUpdateAtomic\",\n docs: [\n \"Post a price update using a VAA and a MerklePriceUpdate.\",\n \"This function allows you to post a price update in a single transaction.\",\n \"Compared to post_update, it is less secure since you won't be able to verify all guardian signatures if you use this function because of transaction size limitations.\",\n \"Typically, you can fit 5 guardian signatures in a transaction that uses this.\",\n ],\n discriminator: [49, 172, 84, 192, 175, 180, 52, 234],\n accounts: [\n {\n name: \"payer\",\n writable: true,\n signer: true,\n },\n {\n name: \"guardianSet\",\n docs: [\"Instead we do the same steps in deserialize_guardian_set_checked.\"],\n },\n {\n name: \"config\",\n },\n {\n name: \"treasury\",\n writable: true,\n },\n {\n name: \"priceUpdateAccount\",\n docs: [\n \"The contraint is such that either the price_update_account is uninitialized or the payer is the write_authority.\",\n \"Pubkey::default() is the SystemProgram on Solana and it can't sign so it's impossible that price_update_account.write_authority == Pubkey::default() once the account is initialized\",\n ],\n writable: true,\n signer: true,\n },\n {\n name: \"systemProgram\",\n },\n {\n name: \"writeAuthority\",\n signer: true,\n },\n ],\n args: [\n {\n name: \"params\",\n type: {\n defined: {\n name: \"postUpdateAtomicParams\",\n },\n },\n },\n ],\n },\n {\n name: \"postUpdate\",\n docs: [\n \"Post a price update using an encoded_vaa account and a MerklePriceUpdate calldata.\",\n \"This should be called after the client has already verified the Vaa via the Wormhole contract.\",\n \"Check out target_chains/solana/cli/src/main.rs for an example of how to do this.\",\n ],\n discriminator: [133, 95, 207, 175, 11, 79, 118, 44],\n accounts: [\n {\n name: \"payer\",\n writable: true,\n signer: true,\n },\n {\n name: \"encodedVaa\",\n },\n {\n name: \"config\",\n },\n {\n name: \"treasury\",\n writable: true,\n },\n {\n name: \"priceUpdateAccount\",\n docs: [\n \"The contraint is such that either the price_update_account is uninitialized or the payer is the write_authority.\",\n \"Pubkey::default() is the SystemProgram on Solana and it can't sign so it's impossible that price_update_account.write_authority == Pubkey::default() once the account is initialized\",\n ],\n writable: true,\n signer: true,\n },\n {\n name: \"systemProgram\",\n },\n {\n name: \"writeAuthority\",\n signer: true,\n },\n ],\n args: [\n {\n name: \"params\",\n type: {\n defined: {\n name: \"postUpdateParams\",\n },\n },\n },\n ],\n },\n {\n name: \"postTwapUpdate\",\n docs: [\n \"Post a TWAP (time weighted average price) update for a given time window.\",\n \"This should be called after the client has already verified the VAAs via the Wormhole contract.\",\n \"Check out target_chains/solana/cli/src/main.rs for an example of how to do this.\",\n ],\n discriminator: [232, 176, 212, 105, 69, 121, 18, 30],\n accounts: [\n {\n name: \"payer\",\n writable: true,\n signer: true,\n },\n {\n name: \"startEncodedVaa\",\n },\n {\n name: \"endEncodedVaa\",\n },\n {\n name: \"config\",\n },\n {\n name: \"treasury\",\n writable: true,\n },\n {\n name: \"twapUpdateAccount\",\n docs: [\n \"The contraint is such that either the twap_update_account is uninitialized or the write_authority is the write_authority.\",\n \"Pubkey::default() is the SystemProgram on Solana and it can't sign so it's impossible that twap_update_account.write_authority == Pubkey::default() once the account is initialized\",\n ],\n writable: true,\n signer: true,\n },\n {\n name: \"systemProgram\",\n },\n {\n name: \"writeAuthority\",\n signer: true,\n },\n ],\n args: [\n {\n name: \"params\",\n type: {\n defined: {\n name: \"postTwapUpdateParams\",\n },\n },\n },\n ],\n },\n {\n name: \"reclaimRent\",\n discriminator: [218, 200, 19, 197, 227, 89, 192, 22],\n accounts: [\n {\n name: \"payer\",\n writable: true,\n signer: true,\n },\n {\n name: \"priceUpdateAccount\",\n writable: true,\n },\n ],\n args: [],\n },\n {\n name: \"reclaimTwapRent\",\n discriminator: [84, 3, 32, 238, 108, 217, 135, 39],\n accounts: [\n {\n name: \"payer\",\n writable: true,\n signer: true,\n },\n {\n name: \"twapUpdateAccount\",\n writable: true,\n },\n ],\n args: [],\n },\n ],\n accounts: [\n {\n name: \"config\",\n discriminator: [155, 12, 170, 224, 30, 250, 204, 130],\n },\n {\n name: \"priceUpdateV2\",\n discriminator: [70, 9, 59, 15, 151, 95, 3, 234],\n },\n {\n name: \"twapUpdate\",\n discriminator: [138, 162, 109, 54, 148, 149, 159, 138],\n },\n ],\n errors: [\n {\n code: 6000,\n name: \"invalidWormholeMessage\",\n msg: \"Received an invalid wormhole message\",\n },\n {\n code: 6001,\n name: \"deserializeMessageFailed\",\n msg: \"An error occurred when deserializing the message\",\n },\n {\n code: 6002,\n name: \"invalidPriceUpdate\",\n msg: \"Received an invalid price update\",\n },\n {\n code: 6003,\n name: \"unsupportedMessageType\",\n msg: \"This type of message is not supported currently\",\n },\n {\n code: 6004,\n name: \"invalidDataSource\",\n msg: \"The tuple emitter chain, emitter doesn't match one of the valid data sources.\",\n },\n {\n code: 6005,\n name: \"insufficientFunds\",\n msg: \"Funds are insufficient to pay the receiving fee\",\n },\n {\n code: 6006,\n name: \"wrongWriteAuthority\",\n msg: \"This signer can't write to price update account\",\n },\n {\n code: 6007,\n name: \"wrongVaaOwner\",\n msg: \"The posted VAA account has the wrong owner.\",\n },\n {\n code: 6008,\n name: \"deserializeVaaFailed\",\n msg: \"An error occurred when deserializing the VAA.\",\n },\n {\n code: 6009,\n name: \"insufficientGuardianSignatures\",\n msg: \"The number of guardian signatures is below the minimum\",\n },\n {\n code: 6010,\n name: \"invalidVaaVersion\",\n msg: \"Invalid VAA version\",\n },\n {\n code: 6011,\n name: \"guardianSetMismatch\",\n msg: \"Guardian set version in the VAA doesn't match the guardian set passed\",\n },\n {\n code: 6012,\n name: \"invalidGuardianOrder\",\n msg: \"Guardian signature indices must be increasing\",\n },\n {\n code: 6013,\n name: \"invalidGuardianIndex\",\n msg: \"Guardian index exceeds the number of guardians in the set\",\n },\n {\n code: 6014,\n name: \"invalidSignature\",\n msg: \"A VAA signature is invalid\",\n },\n {\n code: 6015,\n name: \"invalidGuardianKeyRecovery\",\n msg: \"The recovered guardian public key doesn't match the guardian set\",\n },\n {\n code: 6016,\n name: \"wrongGuardianSetOwner\",\n msg: \"The guardian set account is owned by the wrong program\",\n },\n {\n code: 6017,\n name: \"invalidGuardianSetPda\",\n msg: \"The Guardian Set account doesn't match the PDA derivation\",\n },\n {\n code: 6018,\n name: \"guardianSetExpired\",\n msg: \"The Guardian Set is expired\",\n },\n {\n code: 6019,\n name: \"governanceAuthorityMismatch\",\n msg: \"The signer is not authorized to perform this governance action\",\n },\n {\n code: 6020,\n name: \"targetGovernanceAuthorityMismatch\",\n msg: \"The signer is not authorized to accept the governance authority\",\n },\n {\n code: 6021,\n name: \"nonexistentGovernanceAuthorityTransferRequest\",\n msg: \"The governance authority needs to request a transfer first\",\n },\n ],\n types: [\n {\n name: \"priceFeedMessage\",\n type: {\n kind: \"struct\",\n fields: [\n {\n name: \"feedId\",\n type: {\n array: [\"u8\", 32],\n },\n },\n {\n name: \"price\",\n type: \"i64\",\n },\n {\n name: \"conf\",\n type: \"u64\",\n },\n {\n name: \"exponent\",\n type: \"i32\",\n },\n {\n name: \"publishTime\",\n type: \"i64\",\n },\n {\n name: \"prevPublishTime\",\n type: \"i64\",\n },\n {\n name: \"emaPrice\",\n type: \"i64\",\n },\n {\n name: \"emaConf\",\n type: \"u64\",\n },\n ],\n },\n },\n {\n name: \"twapPrice\",\n docs: [\n \"The time weighted average price & conf for a feed over the window [start_time, end_time].\",\n \"This type is used to persist the calculated TWAP in TwapUpdate accounts on Solana.\",\n ],\n type: {\n kind: \"struct\",\n fields: [\n {\n name: \"feedId\",\n type: {\n array: [\"u8\", 32],\n },\n },\n {\n name: \"startTime\",\n type: \"i64\",\n },\n {\n name: \"endTime\",\n type: \"i64\",\n },\n {\n name: \"price\",\n type: \"i64\",\n },\n {\n name: \"conf\",\n type: \"u64\",\n },\n {\n name: \"exponent\",\n type: \"i32\",\n },\n {\n name: \"downSlotsRatio\",\n docs: [\n \"Ratio out of 1_000_000, where a value of 1_000_000 represents\",\n \"all slots were missed and 0 represents no slots were missed.\",\n ],\n type: \"u32\",\n },\n ],\n },\n },\n {\n name: \"merklePriceUpdate\",\n type: {\n kind: \"struct\",\n fields: [\n {\n name: \"message\",\n type: \"bytes\",\n },\n {\n name: \"proof\",\n type: {\n vec: {\n array: [\"u8\", 20],\n },\n },\n },\n ],\n },\n },\n {\n name: \"dataSource\",\n type: {\n kind: \"struct\",\n fields: [\n {\n name: \"chain\",\n type: \"u16\",\n },\n {\n name: \"emitter\",\n type: \"pubkey\",\n },\n ],\n },\n },\n {\n name: \"postUpdateAtomicParams\",\n type: {\n kind: \"struct\",\n fields: [\n {\n name: \"vaa\",\n type: \"bytes\",\n },\n {\n name: \"merklePriceUpdate\",\n type: {\n defined: {\n name: \"merklePriceUpdate\",\n },\n },\n },\n {\n name: \"treasuryId\",\n type: \"u8\",\n },\n ],\n },\n },\n {\n name: \"postUpdateParams\",\n type: {\n kind: \"struct\",\n fields: [\n {\n name: \"merklePriceUpdate\",\n type: {\n defined: {\n name: \"merklePriceUpdate\",\n },\n },\n },\n {\n name: \"treasuryId\",\n type: \"u8\",\n },\n ],\n },\n },\n {\n name: \"postTwapUpdateParams\",\n type: {\n kind: \"struct\",\n fields: [\n {\n name: \"startMerklePriceUpdate\",\n type: {\n defined: {\n name: \"merklePriceUpdate\",\n },\n },\n },\n {\n name: \"endMerklePriceUpdate\",\n type: {\n defined: {\n name: \"merklePriceUpdate\",\n },\n },\n },\n {\n name: \"treasuryId\",\n type: \"u8\",\n },\n ],\n },\n },\n {\n name: \"verificationLevel\",\n docs: [\n \"* This enum represents how many guardian signatures were checked for a Pythnet price update\\n * If full, guardian quorum has been attained\\n * If partial, at least config.minimum signatures have been verified, but in the case config.minimum_signatures changes in the future we also include the number of signatures that were checked\",\n ],\n type: {\n kind: \"enum\",\n variants: [\n {\n name: \"partial\",\n fields: [\n {\n name: \"numSignatures\",\n type: \"u8\",\n },\n ],\n },\n {\n name: \"full\",\n },\n ],\n },\n },\n {\n name: \"config\",\n type: {\n kind: \"struct\",\n fields: [\n {\n name: \"governanceAuthority\",\n type: \"pubkey\",\n },\n {\n name: \"targetGovernanceAuthority\",\n type: {\n option: \"pubkey\",\n },\n },\n {\n name: \"wormhole\",\n type: \"pubkey\",\n },\n {\n name: \"validDataSources\",\n type: {\n vec: {\n defined: {\n name: \"dataSource\",\n },\n },\n },\n },\n {\n name: \"singleUpdateFeeInLamports\",\n type: \"u64\",\n },\n {\n name: \"minimumSignatures\",\n type: \"u8\",\n },\n ],\n },\n },\n {\n name: \"priceUpdateV2\",\n type: {\n kind: \"struct\",\n fields: [\n {\n name: \"writeAuthority\",\n type: \"pubkey\",\n },\n {\n name: \"verificationLevel\",\n type: {\n defined: {\n name: \"verificationLevel\",\n },\n },\n },\n {\n name: \"priceMessage\",\n type: {\n defined: {\n name: \"priceFeedMessage\",\n },\n },\n },\n {\n name: \"postedSlot\",\n type: \"u64\",\n },\n ],\n },\n },\n {\n name: \"twapUpdate\",\n type: {\n kind: \"struct\",\n fields: [\n {\n name: \"writeAuthority\",\n type: \"pubkey\",\n },\n {\n name: \"twap\",\n type: {\n defined: {\n name: \"twapPrice\",\n },\n },\n },\n ],\n },\n },\n ],\n};\n","import { PublicKey } from \"@solana/web3.js\";\n\nexport const DEFAULT_RECEIVER_PROGRAM_ID = new PublicKey(\"rec5EKMGg6MxZYaMdyBfgwp4d5rB9T1VQH5pJv5LtFJ\");\nexport const DEFAULT_WORMHOLE_PROGRAM_ID = new PublicKey(\"HDwcJBJXjL9FpJ7UBsYBtaDjsBUhuLCUYoz3zr8SWWaQ\");\nexport const DEFAULT_PUSH_ORACLE_PROGRAM_ID = new PublicKey(\"pythWSnswVUd12oZpeFP8e9CVaEqJg25g1Vtc2biRsT\");\n\nexport const ACCUMULATOR_MAGIC = \"504e4155\";\nexport const MAJOR_VERSION = 1;\nexport const MINOR_VERSION = 0;\nexport const KECCAK160_HASH_SIZE = 20;\nexport const PRICE_FEED_MESSAGE_VARIANT = 0;\nexport const TWAP_MESSAGE_VARIANT = 1;\n\n/**\n * A hard-coded budget for the compute units required for the `verifyEncodedVaa` instruction in the Wormhole program.\n */\nexport const VERIFY_ENCODED_VAA_COMPUTE_BUDGET = 350000;\n/**\n * A hard-coded budget for the compute units required for the `postUpdateAtomic` instruction in the Pyth Solana Receiver program.\n */\nexport const POST_UPDATE_ATOMIC_COMPUTE_BUDGET = 170000;\n/**\n * A hard-coded budget for the compute units required for the `postUpdate` instruction in the Pyth Solana Receiver program.\n */\nexport const POST_UPDATE_COMPUTE_BUDGET = 35000;\n/**\n * A hard-coded budget for the compute units required for the `postTwapUpdate` instruction in the Pyth Solana Receiver program.\n */\nexport const POST_TWAP_UPDATE_COMPUTE_BUDGET = 50_000;\n/**\n * A hard-coded budget for the compute units required for the `updatePriceFeed` instruction in the Pyth Push Oracle program.\n */\nexport const UPDATE_PRICE_FEED_COMPUTE_BUDGET = 55000;\n/**\n * A hard-coded budget for the compute units required for the `initEncodedVaa` instruction in the Wormhole program.\n */\nexport const INIT_ENCODED_VAA_COMPUTE_BUDGET = 3000;\n/**\n * A hard-coded budget for the compute units required for the `writeEncodedVaa` instruction in the Wormhole program.\n */\nexport const WRITE_ENCODED_VAA_COMPUTE_BUDGET = 3000;\n/**\n * A hard-coded budget for the compute units required for the `closeEncodedVaa` instruction in the Wormhole program.\n */\nexport const CLOSE_ENCODED_VAA_COMPUTE_BUDGET = 30000;\n\nexport const VAA_SPLIT_INDEX = 721;\n\nexport const VAA_START = 46;\n","import { BN, type Program } from \"@coral-xyz/anchor\";\nimport { Keypair, PublicKey, type Signer, type TransactionInstruction } from \"@solana/web3.js\";\nimport type { WormholeCoreBridgeSolana } from \"./idl\";\nimport {\n ACCUMULATOR_MAGIC,\n CLOSE_ENCODED_VAA_COMPUTE_BUDGET,\n INIT_ENCODED_VAA_COMPUTE_BUDGET,\n KECCAK160_HASH_SIZE,\n MAJOR_VERSION,\n MINOR_VERSION,\n PRICE_FEED_MESSAGE_VARIANT,\n VAA_SPLIT_INDEX,\n VAA_START,\n VERIFY_ENCODED_VAA_COMPUTE_BUDGET,\n WRITE_ENCODED_VAA_COMPUTE_BUDGET,\n} from \"./pyth.consts\";\n\nexport function getGuardianSetIndex(vaa: Buffer) {\n return vaa.readUInt32BE(1);\n}\n\nexport const DEFAULT_REDUCED_GUARDIAN_SET_SIZE = 5;\nexport const VAA_SIGNATURE_SIZE = 66;\nexport function trimSignatures(vaa: Buffer, n = DEFAULT_REDUCED_GUARDIAN_SET_SIZE): Buffer {\n const currentNumSignatures = vaa[5];\n if (n > currentNumSignatures) {\n throw new Error(\"Resulting VAA can't have more signatures than the original VAA\");\n }\n\n const trimmedVaa = Buffer.concat([\n vaa.subarray(0, 6 + n * VAA_SIGNATURE_SIZE),\n vaa.subarray(6 + currentNumSignatures * VAA_SIGNATURE_SIZE),\n ]);\n\n trimmedVaa[5] = n;\n return trimmedVaa;\n}\n\nexport function isAccumulatorUpdateData(updateBytes: Buffer): boolean {\n return (\n updateBytes.toString(\"hex\").slice(0, 8) === ACCUMULATOR_MAGIC &&\n updateBytes[4] === MAJOR_VERSION &&\n updateBytes[5] === MINOR_VERSION\n );\n}\n\nexport type AccumulatorUpdateData = {\n vaa: Buffer;\n updates: { message: Buffer; proof: number[][] }[];\n};\n\nexport function parseAccumulatorUpdateData(data: Buffer): AccumulatorUpdateData {\n if (!isAccumulatorUpdateData(data)) {\n throw new Error(\"Invalid accumulator message\");\n }\n\n let cursor = 6;\n const trailingPayloadSize = data.readUint8(cursor);\n cursor += 1 + trailingPayloadSize;\n\n // const proofType = data.readUint8(cursor);\n cursor += 1;\n\n const vaaSize = data.readUint16BE(cursor);\n cursor += 2;\n\n const vaa = data.subarray(cursor, cursor + vaaSize);\n cursor += vaaSize;\n\n const numUpdates = data.readUInt8(cursor);\n const updates: Array<{\n message: Buffer<ArrayBufferLike>;\n proof: Array<number>[];\n }> = [];\n cursor += 1;\n\n for (let i = 0; i < numUpdates; i++) {\n const messageSize = data.readUint16BE(cursor);\n cursor += 2;\n const message = data.subarray(cursor, cursor + messageSize);\n cursor += messageSize;\n\n const numProofs = data.readUInt8(cursor);\n cursor += 1;\n const proof: Array<number[]> = [];\n for (let j = 0; j < numProofs; j++) {\n proof.push(Array.from(data.subarray(cursor, cursor + KECCAK160_HASH_SIZE)));\n cursor += KECCAK160_HASH_SIZE;\n }\n\n updates.push({ message, proof });\n }\n\n if (cursor !== data.length) {\n throw new Error(\"Didn't reach the end of the message\");\n }\n\n return { vaa, updates };\n}\n\n/**\n * An instruction with some extra information that will be used to build transactions.\n */\nexport type InstructionWithEphemeralSigners = {\n /** The instruction */\n instruction: TransactionInstruction;\n /** The ephemeral signers that need to sign the transaction where this instruction will be */\n signers: Signer[];\n /** The compute units that this instruction requires, useful if greater than `DEFAULT_COMPUTE_BUDGET_UNITS` */\n computeUnits?: number;\n};\ninterface VaaInstructionGroups {\n initInstructions: InstructionWithEphemeralSigners[];\n writeFirstPartInstructions: InstructionWithEphemeralSigners[];\n writeSecondPartAndVerifyInstructions: InstructionWithEphemeralSigners[];\n closeInstructions: InstructionWithEphemeralSigners[];\n encodedVaaAddress: PublicKey;\n}\n\nexport async function buildPostEncodedVaaInstructions(\n wormhole: Program<WormholeCoreBridgeSolana>,\n vaa: Buffer,\n): Promise<{\n encodedVaaAddress: PublicKey;\n postInstructions: InstructionWithEphemeralSigners[];\n closeInstructions: InstructionWithEphemeralSigners[];\n}> {\n const groups = await generateVaaInstructionGroups(wormhole, vaa);\n\n // Pack instructions for optimal 2-transaction pattern:\n // TX1: init + first write\n // TX2: second write + verify\n return {\n encodedVaaAddress: groups.encodedVaaAddress,\n postInstructions: [\n ...groups.initInstructions,\n ...groups.writeFirstPartInstructions,\n ...groups.writeSecondPartAndVerifyInstructions,\n ],\n closeInstructions: groups.closeInstructions,\n };\n}\n\nasync function generateVaaInstructionGroups(\n wormhole: Program<WormholeCoreBridgeSolana>,\n vaa: Buffer,\n): Promise<VaaInstructionGroups> {\n const encodedVaaKeypair = new Keypair();\n\n // Create and init instructions\n const initInstructions: InstructionWithEphemeralSigners[] = [\n await buildEncodedVaaCreateInstruction(wormhole, vaa, encodedVaaKeypair),\n {\n instruction: await wormhole.methods\n .initEncodedVaa()\n .accounts({\n encodedVaa: encodedVaaKeypair.publicKey,\n })\n .instruction(),\n signers: [],\n computeUnits: INIT_ENCODED_VAA_COMPUTE_BUDGET,\n },\n ];\n\n // First write instruction\n const writeFirstPartInstructions: InstructionWithEphemeralSigners[] = [\n {\n instruction: await wormhole.methods\n .writeEncodedVaa({\n index: 0,\n data: vaa.subarray(0, VAA_SPLIT_INDEX),\n })\n .accounts({\n draftVaa: encodedVaaKeypair.publicKey,\n })\n .instruction(),\n signers: [],\n computeUnits: WRITE_ENCODED_VAA_COMPUTE_BUDGET,\n },\n ];\n\n // Second write and verify instructions\n const writeSecondPartAndVerifyInstructions: InstructionWithEphemeralSigners[] = [\n {\n instruction: await wormhole.methods\n .writeEncodedVaa({\n index: VAA_SPLIT_INDEX,\n data: vaa.subarray(VAA_SPLIT_INDEX),\n })\n .accounts({\n draftVaa: encodedVaaKeypair.publicKey,\n })\n .instruction(),\n signers: [],\n computeUnits: WRITE_ENCODED_VAA_COMPUTE_BUDGET,\n },\n {\n instruction: await wormhole.methods\n .verifyEncodedVaaV1()\n .accounts({\n guardianSet: getGuardianSetPda(getGuardianSetIndex(vaa), wormhole.programId),\n draftVaa: encodedVaaKeypair.publicKey,\n })\n .instruction(),\n signers: [],\n computeUnits: VERIFY_ENCODED_VAA_COMPUTE_BUDGET,\n },\n ];\n\n // Close instructions\n const closeInstructions: InstructionWithEphemeralSigners[] = [\n {\n instruction: await wormhole.methods\n .closeEncodedVaa()\n .accounts({ encodedVaa: encodedVaaKeypair.publicKey })\n .instruction(),\n signers: [],\n computeUnits: CLOSE_ENCODED_VAA_COMPUTE_BUDGET,\n },\n ];\n\n return {\n initInstructions,\n writeFirstPartInstructions,\n writeSecondPartAndVerifyInstructions,\n closeInstructions,\n encodedVaaAddress: encodedVaaKeypair.publicKey,\n };\n}\n\n/**\n * Build an instruction to create an encoded VAA account.\n *\n * This is the first step to post a VAA to the Wormhole program.\n */\nexport async function buildEncodedVaaCreateInstruction(\n wormhole: Program<WormholeCoreBridgeSolana>,\n vaa: Buffer,\n encodedVaaKeypair: Keypair,\n): Promise<InstructionWithEphemeralSigners> {\n const encodedVaaSize = vaa.length + VAA_START;\n return {\n instruction: await wormhole.account.encodedVaa.createInstruction(encodedVaaKeypair, encodedVaaSize),\n signers: [encodedVaaKeypair],\n };\n}\n\n/**\n * Returns the address of a guardian set account from the Wormhole program.\n */\nexport const getGuardianSetPda = (guardianSetIndex: number, wormholeProgramId: PublicKey) => {\n const guardianSetIndexBuf = Buffer.alloc(4);\n guardianSetIndexBuf.writeUInt32BE(guardianSetIndex, 0);\n return PublicKey.findProgramAddressSync([Buffer.from(\"GuardianSet\"), guardianSetIndexBuf], wormholeProgramId)[0];\n};\n\nexport type PriceFeedMessage = {\n feedId: Buffer;\n price: BN;\n confidence: BN;\n exponent: number;\n publishTime: BN;\n prevPublishTime: BN;\n emaPrice: BN;\n emaConf: BN;\n};\n\nexport function parsePriceFeedMessage(message: Buffer): PriceFeedMessage {\n let cursor = 0;\n const variant = message.readUInt8(cursor);\n if (variant !== PRICE_FEED_MESSAGE_VARIANT) {\n throw new Error(\"Not a price feed message\");\n }\n cursor += 1;\n const feedId = message.subarray(cursor, cursor + 32);\n cursor += 32;\n const price = new BN(message.subarray(cursor, cursor + 8), \"be\");\n cursor += 8;\n const confidence = new BN(message.subarray(cursor, cursor + 8), \"be\");\n cursor += 8;\n const exponent = message.readInt32BE(cursor);\n cursor += 4;\n const publishTime = new BN(message.subarray(cursor, cursor + 8), \"be\");\n cursor += 8;\n const prevPublishTime = new BN(message.subarray(cursor, cursor + 8), \"be\");\n cursor += 8;\n const emaPrice = new BN(message.subarray(cursor, cursor + 8), \"be\");\n cursor += 8;\n const emaConf = new BN(message.subarray(cursor, cursor + 8), \"be\");\n cursor += 8;\n return {\n feedId,\n price,\n confidence,\n exponent,\n publishTime,\n prevPublishTime,\n emaPrice,\n emaConf,\n };\n}\n","import {Program, type Provider} from \"@coral-xyz/anchor\";\nimport {PublicKey} from \"@solana/web3.js\";\nimport instructions from \"~/instructions\";\nimport type {LendrProgram} from \"~/types\";\nimport {\n\tbuildPostEncodedVaaInstructions,\n\tDEFAULT_PUSH_ORACLE_PROGRAM_ID,\n\ttype InstructionWithEphemeralSigners,\n\tparseAccumulatorUpdateData,\n\tparsePriceFeedMessage,\n\tPYTH_PUSH_ORACLE_IDL,\n\tPYTH_SOLANA_RECEIVER_PROGRAM_IDL,\n\tPYTH_WORMHOLE_IDL,\n\tUPDATE_PRICE_FEED_COMPUTE_BUDGET,\n} from \"~/vendor/pyth_crank\";\nimport type {InstructionsWrapper} from \"../../common\";\n\nimport type {BankConfigOpt, BankConfigOptRaw, OracleSetup} from \"./types\";\nimport {serializeBankConfigOpt, serializeOracleSetupToIndex} from \"./utils\";\nimport {SYSTEM_PROGRAM_ID} from \"@/constants\";\n\nexport async function freezeBankConfigIx(\n program: LendrProgram,\n bankAddress: PublicKey,\n bankConfigOpt: BankConfigOpt,\n): Promise<InstructionsWrapper> {\n let bankConfigRaw: BankConfigOptRaw;\n if (!bankConfigOpt) {\n // todo: make bankConfigOpt optional and create function to get bankConfigOptRaw from bank\n }\n bankConfigRaw = serializeBankConfigOpt(bankConfigOpt);\n\n const ix = await instructions.makePoolConfigureBankIx(\n program,\n {\n bank: bankAddress,\n },\n {\n bankConfigOpt: {\n // ...bankConfigRaw,\n assetWeightInit: null,\n assetWeightMaint: null,\n\n liabilityWeightInit: null,\n liabilityWeightMaint: null,\n\n depositLimit: null,\n borrowLimit: null,\n riskTier: null,\n assetTag: null,\n totalAssetValueInitLimit: null,\n\n interestRateConfig: null,\n operationalState: null,\n\n oracleMaxAge: null,\n permissionlessBadDebtSettlement: null,\n freezeSettings: true,\n },\n },\n );\n\n return {\n instructions: [ix],\n keys: [],\n };\n}\n\ntype AddOracleToBanksIxArgs = {\n program: LendrProgram;\n bankAddress: PublicKey;\n feedId: PublicKey;\n oracleKey?: PublicKey;\n setup: OracleSetup;\n groupAddress?: PublicKey;\n adminAddress?: PublicKey;\n};\n\nexport async function addOracleToBanksIx({\n program,\n bankAddress,\n feedId,\n oracleKey,\n setup,\n groupAddress,\n adminAddress,\n}: AddOracleToBanksIxArgs): Promise<InstructionsWrapper> {\n const ix = await instructions.makeLendingPoolConfigureBankOracleIx(\n program,\n {\n bank: bankAddress,\n group: groupAddress,\n admin: adminAddress,\n },\n {\n setup: serializeOracleSetupToIndex(setup),\n feedId,\n },\n oracleKey ? [{ isSigner: false, isWritable: false, pubkey: oracleKey }] : [],\n );\n\n return {\n instructions: [ix],\n keys: [],\n };\n}\n\n/**\n * Derive the address of a price feed account\n * @param shardId The shard ID of the set of price feed accounts. This shard ID allows for multiple price feed accounts for the same price feed id to exist.\n * @param priceFeedId The price feed ID, as either a 32-byte buffer or hexadecimal string with or without a leading \"0x\" prefix.\n * @param pushOracleProgramId The program ID of the Pyth Push Oracle program. If not provided, the default deployment will be used.\n * @returns The address of the price feed account\n */\nexport function getPriceFeedAccountForProgram(\n shardId: number,\n priceFeedId: Buffer | string,\n pushOracleProgramId?: PublicKey,\n): PublicKey {\n if (typeof priceFeedId === \"string\") {\n if (priceFeedId.startsWith(\"0x\")) {\n priceFeedId = Buffer.from(priceFeedId.slice(2), \"hex\");\n } else {\n priceFeedId = Buffer.from(priceFeedId, \"hex\");\n }\n }\n\n if (priceFeedId.length !== 32) {\n throw new Error(\"Feed ID should be 32 bytes long\");\n }\n const shardBuffer = Buffer.alloc(2);\n shardBuffer.writeUint16LE(shardId, 0);\n\n return PublicKey.findProgramAddressSync(\n [shardBuffer, priceFeedId],\n pushOracleProgramId ?? DEFAULT_PUSH_ORACLE_PROGRAM_ID,\n )[0];\n}\n\nexport const getTreasuryPda = (treasuryId: number, receiverProgramId: PublicKey) => {\n return PublicKey.findProgramAddressSync([Buffer.from(\"treasury\"), Buffer.from([treasuryId])], receiverProgramId)[0];\n};\n\nexport const getConfigPda = (receiverProgramId: PublicKey) => {\n return PublicKey.findProgramAddressSync([Buffer.from(\"config\")], receiverProgramId)[0];\n};\n\nexport async function crankPythOracleIx(oracles: { feedId: string; shardId: number }[], provider: Provider) {\n const feedIdsByShardId: Record<number, string[]> = {};\n const wormholeProgram = new Program(PYTH_WORMHOLE_IDL, provider);\n const pushOracleProgram = new Program(PYTH_PUSH_ORACLE_IDL, provider);\n const receiverProgram = new Program(PYTH_SOLANA_RECEIVER_PROGRAM_IDL, provider);\n\n const addressLookupTableAccount = new PublicKey(\"5DNCErWQFBdvCxWQXaC1mrEFsvL3ftrzZ2gVZWNybaSX\");\n\n const lookupTableAccount = (await provider.connection.getAddressLookupTable(addressLookupTableAccount)).value;\n\n const buildURL = (endpoint: string) => {\n return new URL(`./v2/${endpoint}`, `https://hermes.pyth.network/`);\n };\n\n for (const oracle of oracles) {\n const { shardId, feedId } = oracle;\n if (!feedIdsByShardId[shardId]) {\n feedIdsByShardId[shardId] = [];\n }\n feedIdsByShardId[shardId].push(feedId);\n }\n const postInstructions: InstructionWithEphemeralSigners[] = [];\n const priceFeedIdToPriceUpdateAccount: Record<string, PublicKey> = {};\n const closeInstructions: InstructionWithEphemeralSigners[] = [];\n\n for (const [shardId, feedIds] of Object.entries(feedIdsByShardId)) {\n const url = buildURL(\"updates/price/latest\");\n for (const id of feedIds) {\n url.searchParams.append(\"ids[]\", id);\n }\n\n url.searchParams.append(\"encoding\", \"base64\");\n\n const response = await fetch(url);\n const priceDataArray: string[] = (await response.json()).binary.data;\n\n const treasuryId = 0;\n\n for (const priceData of priceDataArray) {\n const accumulatorUpdateData = parseAccumulatorUpdateData(Buffer.from(priceData, \"base64\"));\n\n const {\n postInstructions: postEncodedVaaInstructions,\n encodedVaaAddress: encodedVaa,\n closeInstructions: postEncodedVaacloseInstructions,\n } = await buildPostEncodedVaaInstructions(wormholeProgram, accumulatorUpdateData.vaa);\n postInstructions.push(...postEncodedVaaInstructions);\n closeInstructions.push(...postEncodedVaacloseInstructions);\n\n for (const update of accumulatorUpdateData.updates) {\n const feedId = parsePriceFeedMessage(update.message).feedId;\n postInstructions.push({\n instruction: await pushOracleProgram.methods\n .updatePriceFeed(\n {\n merklePriceUpdate: update,\n treasuryId,\n },\n Number(shardId),\n Array.from(feedId),\n )\n .accounts({\n pythSolanaReceiver: receiverProgram.programId,\n encodedVaa,\n priceFeedAccount: getPriceFeedAccountForProgram(Number(shardId), feedId, pushOracleProgram.programId),\n treasury: getTreasuryPda(treasuryId, receiverProgram.programId),\n config: getConfigPda(receiverProgram.programId),\n systemProgram: SYSTEM_PROGRAM_ID,\n })\n .instruction(),\n signers: [],\n computeUnits: UPDATE_PRICE_FEED_COMPUTE_BUDGET,\n });\n }\n }\n }\n\n return {\n postInstructions: postInstructions,\n closeInstructions: closeInstructions,\n keys: [],\n lut: lookupTableAccount,\n };\n}\n","import BigNumber from \"bignumber.js\";\nimport { NoopLogger } from \"@/logger\";\nimport type { TLogger } from \"@/types\";\nimport { MAX_CONFIDENCE_INTERVAL_RATIO, PYTH_PRICE_CONF_INTERVALS, SWB_PRICE_CONF_INTERVALS } from \"~/constants\";\nimport { OracleSetup } from \"~/services/bank\";\nimport { parsePriceData } from \"~/vendor/pyth_legacy\";\nimport { parsePriceInfo } from \"~/vendor/pyth_push_oracle\";\nimport { AggregatorAccount, AggregatorAccountData } from \"~/vendor/switchboard_legacy\";\nimport { decodeSwitchboardPullFeedData, SWITCHBOARD_ONDEMANDE_PRICE_PRECISION } from \"~/vendor/switchboard_pull\";\nimport { type OraclePrice, PriceBias, type PriceWithConfidence } from \"../types\";\n\nexport function getPriceWithConfidence(oraclePrice: OraclePrice, weighted: boolean): PriceWithConfidence {\n return weighted ? oraclePrice.priceWeighted : oraclePrice.priceRealtime;\n}\n\nexport function getPrice(\n oraclePrice: OraclePrice,\n priceBias: PriceBias = PriceBias.None,\n weightedPrice: boolean = false,\n): BigNumber {\n const price = getPriceWithConfidence(oraclePrice, weightedPrice);\n switch (priceBias) {\n case PriceBias.Lowest:\n return price.lowestPrice;\n case PriceBias.Highest:\n return price.highestPrice;\n case PriceBias.None:\n return price.price;\n }\n}\n\nfunction capConfidenceInterval(price: BigNumber, confidence: BigNumber, maxConfidence: BigNumber): BigNumber {\n const maxConfidenceInterval = price.times(maxConfidence);\n\n return BigNumber.min(confidence, maxConfidenceInterval);\n}\n\nfunction parseOraclePriceData(\n oracleSetup: OracleSetup,\n rawData: Buffer,\n logger: TLogger = new NoopLogger(),\n shardId?: number,\n): OraclePrice {\n switch (oracleSetup) {\n case OracleSetup.PythLegacy: {\n const pythPriceData = parsePriceData(rawData);\n\n let priceData = pythPriceData.price;\n if (priceData === undefined) {\n priceData = pythPriceData.previousPrice;\n }\n\n let confidenceData = pythPriceData.confidence;\n if (confidenceData === undefined) {\n confidenceData = pythPriceData.previousConfidence;\n }\n\n const pythPriceRealtime = new BigNumber(priceData!);\n const pythConfidenceRealtime = new BigNumber(confidenceData!).times(PYTH_PRICE_CONF_INTERVALS);\n const pythConfidenceRealtimeCapped = capConfidenceInterval(\n pythPriceRealtime,\n pythConfidenceRealtime,\n PYTH_PRICE_CONF_INTERVALS,\n );\n const pythLowestPriceRealtime = pythPriceRealtime.minus(pythConfidenceRealtimeCapped);\n const pythHighestPriceRealtime = pythPriceRealtime.plus(pythConfidenceRealtimeCapped);\n\n const pythPriceWeighted = new BigNumber(pythPriceData.emaPrice.value);\n const pythConfIntervalWeighted = new BigNumber(pythPriceData.emaConfidence.value).times(\n PYTH_PRICE_CONF_INTERVALS,\n );\n const pythConfIntervalWeightedCapped = capConfidenceInterval(\n pythPriceWeighted,\n pythConfIntervalWeighted,\n PYTH_PRICE_CONF_INTERVALS,\n );\n const pythLowestPrice = pythPriceWeighted.minus(pythConfIntervalWeightedCapped);\n const pythHighestPrice = pythPriceWeighted.plus(pythConfIntervalWeightedCapped);\n\n logger.debug(\n {\n pythPriceRealtime: pythPriceRealtime.toString(),\n pythConfidenceRealtimeCapped: pythConfidenceRealtimeCapped.toString(),\n pythPriceWeighted: pythPriceWeighted.toString(),\n pythConfIntervalWeightedCapped: pythConfIntervalWeightedCapped.toString(),\n },\n \"[lendr:oracle-loader] loaded pyth price\",\n );\n\n return {\n priceRealtime: {\n price: pythPriceRealtime,\n confidence: pythConfidenceRealtimeCapped,\n lowestPrice: pythLowestPriceRealtime,\n highestPrice: pythHighestPriceRealtime,\n },\n priceWeighted: {\n price: pythPriceWeighted,\n confidence: pythConfIntervalWeightedCapped,\n lowestPrice: pythLowestPrice,\n highestPrice: pythHighestPrice,\n },\n timestamp: new BigNumber(Number(pythPriceData.timestamp)),\n pythShardId: shardId,\n };\n }\n case OracleSetup.PythPushOracle:\n case OracleSetup.StakedWithPythPush: {\n const bytesWithoutDiscriminator = rawData.slice(8);\n const data = parsePriceInfo(bytesWithoutDiscriminator);\n\n const exponent = new BigNumber(10 ** data.priceMessage.exponent);\n\n const priceRealTime = new BigNumber(Number(data.priceMessage.price)).times(exponent);\n const confidenceRealTime = new BigNumber(Number(data.priceMessage.conf))\n .times(exponent)\n .times(PYTH_PRICE_CONF_INTERVALS);\n const cappedConfidenceRealTime = capConfidenceInterval(\n priceRealTime,\n confidenceRealTime,\n MAX_CONFIDENCE_INTERVAL_RATIO,\n );\n const lowestPriceRealTime = priceRealTime.minus(cappedConfidenceRealTime);\n const highestPriceRealTime = priceRealTime.plus(cappedConfidenceRealTime);\n\n const priceTimeWeighted = new BigNumber(Number(data.priceMessage.emaPrice)).times(exponent);\n const confidenceTimeWeighted = new BigNumber(Number(data.priceMessage.emaConf))\n .times(exponent)\n .times(PYTH_PRICE_CONF_INTERVALS);\n const cappedConfidenceWeighted = capConfidenceInterval(\n priceTimeWeighted,\n confidenceTimeWeighted,\n MAX_CONFIDENCE_INTERVAL_RATIO,\n );\n const lowestPriceWeighted = priceTimeWeighted.minus(cappedConfidenceWeighted);\n const highestPriceWeighted = priceTimeWeighted.plus(cappedConfidenceWeighted);\n\n return {\n priceRealtime: {\n price: priceRealTime,\n confidence: cappedConfidenceRealTime,\n lowestPrice: lowestPriceRealTime,\n highestPrice: highestPriceRealTime,\n },\n priceWeighted: {\n price: priceTimeWeighted,\n confidence: cappedConfidenceWeighted,\n lowestPrice: lowestPriceWeighted,\n highestPrice: highestPriceWeighted,\n },\n timestamp: new BigNumber(Number(data.priceMessage.publishTime)),\n pythShardId: shardId,\n };\n }\n\n case OracleSetup.SwitchboardV2: {\n const aggData = AggregatorAccountData.decode(rawData);\n\n const swbPrice = new BigNumber(AggregatorAccount.decodeLatestValue(aggData)!.toString());\n const swbConfidence = new BigNumber(aggData.latestConfirmedRound.stdDeviation.toBig().toString()).times(\n SWB_PRICE_CONF_INTERVALS,\n );\n const swbConfidenceCapped = capConfidenceInterval(swbPrice, swbConfidence, MAX_CONFIDENCE_INTERVAL_RATIO);\n const swbLowestPrice = swbPrice.minus(swbConfidenceCapped);\n const swbHighestPrice = swbPrice.plus(swbConfidenceCapped);\n\n logger.debug(\n {\n swbPrice: swbPrice.toString(),\n swbConfidenceCapped: swbConfidenceCapped.toString(),\n },\n \"[lendr:oracle-loader] loaded swb legacy price\",\n );\n\n return {\n priceRealtime: {\n price: swbPrice,\n confidence: swbConfidenceCapped,\n lowestPrice: swbLowestPrice,\n highestPrice: swbHighestPrice,\n },\n priceWeighted: {\n price: swbPrice,\n confidence: swbConfidenceCapped,\n lowestPrice: swbLowestPrice,\n highestPrice: swbHighestPrice,\n },\n timestamp: new BigNumber(aggData.latestConfirmedRound.roundOpenTimestamp),\n };\n }\n case OracleSetup.SwitchboardPull: {\n const pullFeedDAta = decodeSwitchboardPullFeedData(rawData);\n\n const swbPrice = new BigNumber(pullFeedDAta.result.value.toString()).div(\n 10 ** SWITCHBOARD_ONDEMANDE_PRICE_PRECISION,\n );\n const swbConfidence = new BigNumber(pullFeedDAta.result.std_dev.toString()).times(SWB_PRICE_CONF_INTERVALS);\n const swbConfidenceCapped = capConfidenceInterval(swbPrice, swbConfidence, MAX_CONFIDENCE_INTERVAL_RATIO);\n const swbLowestPrice = swbPrice.minus(swbConfidenceCapped);\n const swbHighestPrice = swbPrice.plus(swbConfidenceCapped);\n\n logger.debug(\n {\n swbPrice: swbPrice.toString(),\n swbConfidenceCapped: swbConfidenceCapped.toString(),\n },\n \"[lendr:oracle-loader] Loaded swb pull price\",\n );\n\n return {\n priceRealtime: {\n price: swbPrice,\n confidence: swbConfidenceCapped,\n lowestPrice: swbLowestPrice,\n highestPrice: swbHighestPrice,\n },\n priceWeighted: {\n price: swbPrice,\n confidence: swbConfidenceCapped,\n lowestPrice: swbLowestPrice,\n highestPrice: swbHighestPrice,\n },\n timestamp: new BigNumber(pullFeedDAta.last_update_timestamp.toString()),\n };\n }\n default:\n console.error(\"Invalid oracle setup\", oracleSetup);\n throw new Error(`Invalid oracle setup \"${oracleSetup}\"`);\n }\n}\n\nexport { parseOraclePriceData as parsePriceInfo };\n","import BigNumber from \"bignumber.js\";\n\nimport type { OraclePrice, OraclePriceDto } from \"../types\";\n\nexport function dtoToOraclePrice(dto: OraclePriceDto): OraclePrice {\n return {\n priceRealtime: {\n price: new BigNumber(dto.priceRealtime.price),\n confidence: new BigNumber(dto.priceRealtime.confidence),\n lowestPrice: new BigNumber(dto.priceRealtime.lowestPrice),\n highestPrice: new BigNumber(dto.priceRealtime.highestPrice),\n },\n priceWeighted: {\n price: new BigNumber(dto.priceWeighted.price),\n confidence: new BigNumber(dto.priceWeighted.confidence),\n lowestPrice: new BigNumber(dto.priceWeighted.lowestPrice),\n highestPrice: new BigNumber(dto.priceWeighted.highestPrice),\n },\n timestamp: new BigNumber(dto.timestamp),\n pythShardId: dto.pythShardId,\n };\n}\n","import { type Connection, PublicKey } from \"@solana/web3.js\";\nimport BigNumber from \"bignumber.js\";\nimport type { BankRaw } from \"~/services/bank\";\nimport { buildFeedIdMap, type PythPushFeedIdMap } from \"~/utils\";\nimport type { BankMetadata } from \"../../../common\";\n\nimport type { OraclePrice, PriceWithConfidence } from \"../types\";\n\n/**\n * =============================================================================\n * PYTH ORACLE UTILS\n * =============================================================================\n *\n * Utility functions for fetching Pyth oracle data\n */\n\ntype PythFeedMapResponse = Record<\n string,\n {\n feedId: string;\n shardId?: number;\n }\n>;\n\n/**\n * Categorizes banks by their oracle setup type\n */\nconst categorizePythBanks = (banks: { address: PublicKey; data: BankRaw }[]) => {\n const pythLegacyBanks = banks.filter(\n (bank) => bank.data.config.oracleSetup && \"pythLegacy\" in bank.data.config.oracleSetup,\n );\n const pythPushBanks = banks.filter(\n (bank) => bank.data.config.oracleSetup && \"pythPushOracle\" in bank.data.config.oracleSetup,\n );\n const pythStakedCollateralBanks = banks.filter(\n (bank) => bank.data.config.oracleSetup && \"stakedWithPythPush\" in bank.data.config.oracleSetup,\n );\n\n return { pythLegacyBanks, pythPushBanks, pythStakedCollateralBanks };\n};\n\n/**\n * Fetches Pyth feed map and staked collateral data via API endpoints\n */\nconst fetchPythDataViaAPI = async (\n pythPushBanks: { address: PublicKey; data: BankRaw }[],\n voteAccMintTuples: [string, string][],\n): Promise<{ pythFeedMap: PythPushFeedIdMap; priceCoeffByBank: Record<string, number> }> => {\n const pythFeedMapPromise = fetch(\n \"/api/bankData/pythFeedMap?feedIds=\" +\n pythPushBanks.map((bank) => bank.data.config.oracleKeys[0].toBase58()).join(\",\"),\n );\n const encodedQuery = encodeURIComponent(JSON.stringify(voteAccMintTuples));\n const stakedCollatDataPromise = fetch(`/api/stakeData/stakedCollatData?voteAccMintTuple=${encodedQuery}`);\n\n const [pythFeedMapResponse, stakedCollatDataResponse] = await Promise.all([\n pythFeedMapPromise,\n stakedCollatDataPromise,\n ]);\n\n if (!pythFeedMapResponse.ok) {\n throw new Error(\"Failed to fetch pyth feed map\");\n }\n if (!stakedCollatDataResponse.ok) {\n throw new Error(\"Failed to fetch staked collateral data\");\n }\n\n const pythFeedMapJson: PythFeedMapResponse = await pythFeedMapResponse.json();\n const stakedCollatDataJson: Record<string, number> = await stakedCollatDataResponse.json();\n\n // Build pythFeedMap\n const pythFeedMap = new Map<string, { feedId: PublicKey; shardId?: number }>();\n Object.entries(pythFeedMapJson).forEach(([feedId, { feedId: feedIdStr, shardId }]) => {\n pythFeedMap.set(feedId, { feedId: new PublicKey(feedIdStr), shardId });\n });\n\n return { pythFeedMap, priceCoeffByBank: stakedCollatDataJson };\n};\n\n/**\n * Fetches Pyth feed map via direct connection (non-API)\n */\nconst fetchPythDataDirect = async (\n banks: { address: PublicKey; data: BankRaw }[],\n connection: Connection,\n): Promise<{ pythFeedMap: PythPushFeedIdMap; priceCoeffByBank: Record<string, number> }> => {\n const pythFeedMap = await buildFeedIdMap(\n banks.map((bank) => bank.data.config),\n connection,\n );\n const priceCoeffByBank = {};\n\n return { pythFeedMap, priceCoeffByBank };\n};\n\n/**\n * Converts vote account coefficients to bank address coefficients\n */\nconst convertVoteAccCoeffsToBankCoeffs = (\n pythStakedCollateralBanks: { address: PublicKey; data: BankRaw }[],\n bankMetadataMap: { [address: string]: BankMetadata },\n voteAccCoeffs: Record<string, number>,\n): Record<string, number> => {\n const priceCoeffByBank: Record<string, number> = {};\n\n pythStakedCollateralBanks.forEach((bank) => {\n const voteAccount = bankMetadataMap[bank.address.toBase58()]?.validatorVoteAccount;\n if (voteAccount && voteAccCoeffs[voteAccount] !== undefined) {\n priceCoeffByBank[bank.address.toBase58()] = voteAccCoeffs[voteAccount];\n }\n });\n\n return priceCoeffByBank;\n};\n\n/**\n * Extracts oracle keys for Pyth price fetching\n */\nconst extractPythOracleKeys = (\n pythLegacyBanks: { address: PublicKey; data: BankRaw }[],\n pythPushBanks: { address: PublicKey; data: BankRaw }[],\n pythFeedMap: PythPushFeedIdMap,\n): string[] => {\n const legacyKeys = pythLegacyBanks.map((bank) => bank.data.config.oracleKeys[0].toBase58());\n\n const pushKeys = pythPushBanks.map((bank) => {\n const feed = pythFeedMap.get(bank.data.config.oracleKeys[0].toBuffer().toString(\"hex\"));\n if (!feed) {\n throw new Error(\"Feed not found\");\n }\n return feed.feedId.toBase58();\n });\n\n return [...legacyKeys, ...pushKeys];\n};\n\n/**\n * Fetches oracle prices via API endpoint\n */\nconst fetchPythOraclePricesViaAPI = async (pythOracleKeys: string[]): Promise<Record<string, OraclePrice>> => {\n const response = await fetch(\"/api/bankData/pythOracleData?pythOracleKeys=\" + pythOracleKeys.join(\",\"));\n\n if (!response.ok) {\n throw new Error(\"Failed to fetch pyth oracle data\");\n }\n\n const responseBody: Record<string, any> = await response.json();\n return Object.fromEntries(\n Object.entries(responseBody).map(([key, oraclePrice]) => [\n key,\n {\n priceRealtime: {\n price: BigNumber(oraclePrice.priceRealtime.price),\n confidence: BigNumber(oraclePrice.priceRealtime.confidence),\n lowestPrice: BigNumber(oraclePrice.priceRealtime.lowestPrice),\n highestPrice: BigNumber(oraclePrice.priceRealtime.highestPrice),\n },\n priceWeighted: {\n price: BigNumber(oraclePrice.priceWeighted.price),\n confidence: BigNumber(oraclePrice.priceWeighted.confidence),\n lowestPrice: BigNumber(oraclePrice.priceWeighted.lowestPrice),\n highestPrice: BigNumber(oraclePrice.priceWeighted.highestPrice),\n },\n timestamp: oraclePrice.timestamp ? BigNumber(oraclePrice.timestamp) : null,\n pythShardId: oraclePrice.pythShardId,\n },\n ]),\n ) as Record<string, OraclePrice>;\n};\n\n/**\n * Maps banks to their corresponding oracle prices\n */\nconst mapPythBanksToOraclePrices = (\n pythLegacyBanks: { address: PublicKey; data: BankRaw }[],\n pythPushBanks: { address: PublicKey; data: BankRaw }[],\n pythStakedCollateralBanks: { address: PublicKey; data: BankRaw }[],\n pythFeedMap: PythPushFeedIdMap,\n oraclePrices: Record<string, OraclePrice>,\n priceCoeffByBank: Record<string, number>,\n): Map<string, OraclePrice> => {\n const bankOraclePriceMap = new Map<string, OraclePrice>();\n\n // Map legacy banks\n pythLegacyBanks.forEach((bank) => {\n const oracleKey = bank.data.config.oracleKeys[0].toBase58();\n const oraclePrice = oraclePrices[oracleKey];\n if (oraclePrice) {\n bankOraclePriceMap.set(bank.address.toBase58(), oraclePrice);\n }\n });\n\n // Map push oracle banks\n pythPushBanks.forEach((bank) => {\n const feed = pythFeedMap.get(bank.data.config.oracleKeys[0].toBuffer().toString(\"hex\"));\n if (feed) {\n const oraclePrice = oraclePrices[feed.feedId.toBase58()];\n if (oraclePrice) {\n bankOraclePriceMap.set(bank.address.toBase58(), oraclePrice);\n }\n }\n });\n\n // Map staked collateral banks with price coefficient adjustment\n pythStakedCollateralBanks.forEach((bank) => {\n const priceCoeff = priceCoeffByBank[bank.address.toBase58()];\n const feed = pythFeedMap.get(bank.data.config.oracleKeys[0].toBuffer().toString(\"hex\"));\n\n if (feed && priceCoeff !== undefined) {\n const oraclePrice = oraclePrices[feed?.feedId.toBase58()];\n if (oraclePrice) {\n bankOraclePriceMap.set(bank.address.toBase58(), {\n timestamp: oraclePrice.timestamp,\n priceRealtime: adjustPriceComponent(oraclePrice.priceRealtime, priceCoeff),\n priceWeighted: adjustPriceComponent(oraclePrice.priceWeighted, priceCoeff),\n });\n }\n }\n });\n\n return bankOraclePriceMap;\n};\n\nexport const fetchPythOracleData = async (\n banks: { address: PublicKey; data: BankRaw }[],\n bankMetadataMap: {\n [address: string]: BankMetadata;\n },\n connection?: Connection,\n opts?: { useApiEndpoint?: boolean },\n): Promise<{\n pythFeedMap: PythPushFeedIdMap;\n bankOraclePriceMap: Map<string, OraclePrice>;\n}> => {\n // Step 1: Categorize banks by oracle type\n const { pythLegacyBanks, pythPushBanks, pythStakedCollateralBanks } = categorizePythBanks(banks);\n\n // Step 2: Prepare vote account mint tuples for staked collateral\n const voteAccMintTuples: [string, string][] = pythStakedCollateralBanks.map((bank) => [\n bankMetadataMap[bank.address.toBase58()]?.validatorVoteAccount ?? \"\",\n bank.data.mint?.toBase58() ?? \"\",\n ]);\n\n // Step 3: Fetch Pyth feed map and price coefficients\n let pythFeedMap: PythPushFeedIdMap;\n let priceCoeffByBank: Record<string, number>;\n\n if (opts?.useApiEndpoint || !connection) {\n const { pythFeedMap: feedMap, priceCoeffByBank: voteAccCoeffs } = await fetchPythDataViaAPI(\n pythPushBanks,\n voteAccMintTuples,\n );\n pythFeedMap = feedMap;\n priceCoeffByBank = convertVoteAccCoeffsToBankCoeffs(pythStakedCollateralBanks, bankMetadataMap, voteAccCoeffs);\n } else {\n const result = await fetchPythDataDirect(banks, connection);\n pythFeedMap = result.pythFeedMap;\n priceCoeffByBank = result.priceCoeffByBank;\n }\n\n // Step 4: Extract oracle keys for price fetching\n const pythOracleKeys = extractPythOracleKeys(pythLegacyBanks, pythPushBanks, pythFeedMap);\n\n // Step 5: Fetch oracle prices\n let oraclePrices: Record<string, OraclePrice>;\n if (opts?.useApiEndpoint) {\n oraclePrices = await fetchPythOraclePricesViaAPI(pythOracleKeys);\n } else {\n // Handle non-API endpoint case - placeholder for now\n oraclePrices = {};\n }\n\n // Step 6: Map banks to oracle prices\n const bankOraclePriceMap = mapPythBanksToOraclePrices(\n pythLegacyBanks,\n pythPushBanks,\n pythStakedCollateralBanks,\n pythFeedMap,\n oraclePrices,\n priceCoeffByBank,\n );\n\n return {\n pythFeedMap,\n bankOraclePriceMap,\n };\n};\n\nconst adjustPriceComponent = (priceComponent: PriceWithConfidence, priceCoeff: number) => ({\n price: priceComponent.price.multipliedBy(priceCoeff),\n confidence: priceComponent.confidence,\n lowestPrice: priceComponent.lowestPrice.multipliedBy(priceCoeff),\n highestPrice: priceComponent.highestPrice.multipliedBy(priceCoeff),\n});\n\n/**\n * =============================================================================\n * SWITCHBOARD ORACLE UTILS\n * =============================================================================\n *\n * Utility functions for fetching Switchboard oracle data\n */\n\nexport const fetchSwbOracleData = async (\n banks: { address: PublicKey; data: BankRaw }[],\n opts?: { useApiEndpoint?: boolean },\n): Promise<{\n bankOraclePriceMap: Map<string, OraclePrice>;\n}> => {\n // Step 1: Fetch Switchboard oracle map\n const switchboardBanks = banks.filter(\n (bank) =>\n bank.data.config.oracleSetup &&\n (\"switchboardPull\" in bank.data.config.oracleSetup || \"switchboardV2\" in bank.data.config.oracleSetup),\n );\n\n let oracleKeyMap: Record<string, { feedId: string }>;\n\n if (opts?.useApiEndpoint) {\n const { oracleKeyMap: swbOracleKeyMap } = await fetchSwbDataViaAPI(switchboardBanks);\n oracleKeyMap = swbOracleKeyMap;\n } else {\n oracleKeyMap = {};\n }\n\n // Step 4: Extract oracle keys for price fetching\n const swbFeedIds = Object.values(oracleKeyMap).map((oracleKey) => oracleKey.feedId);\n\n // Step 5: Fetch oracle prices\n let oraclePrices: Record<string, OraclePrice>;\n if (opts?.useApiEndpoint) {\n oraclePrices = await fetchSwbOraclePricesViaAPI(swbFeedIds);\n } else {\n // Handle non-API endpoint case - placeholder for now\n oraclePrices = {};\n }\n\n // Step 6: Map switchboardBanks to oracle prices\n const bankOraclePriceMap = mapSwbBanksToOraclePrices(switchboardBanks, oraclePrices, oracleKeyMap);\n\n return {\n bankOraclePriceMap,\n };\n};\n\n/**\n * Fetches Pyth feed map and staked collateral data via API endpoints\n */\nconst fetchSwbDataViaAPI = async (\n swbPullBanks: { address: PublicKey; data: BankRaw }[],\n): Promise<{ oracleKeyMap: Record<string, { feedId: string }> }> => {\n const swbOracleKeyMapResponse = await fetch(\n \"/api/bankData/swbOracleMap?oracleKeys=\" +\n swbPullBanks.map((bank) => bank.data.config.oracleKeys[0].toBase58()).join(\",\"),\n );\n\n if (!swbOracleKeyMapResponse.ok) {\n throw new Error(\"Failed to fetch swb oracle key map\");\n }\n\n const swbOracleKeyMapJson: Record<string, { feedId: string }> = await swbOracleKeyMapResponse.json();\n\n return { oracleKeyMap: swbOracleKeyMapJson };\n};\n\nconst fetchSwbOraclePricesViaAPI = async (swbFeedIds: string[]): Promise<Record<string, OraclePrice>> => {\n const response = await fetch(\"/api/bankData/swbOracleData?feedIds=\" + swbFeedIds.join(\",\"));\n\n if (!response.ok) {\n throw new Error(\"Failed to fetch swb oracle data\");\n }\n\n const responseBody: Record<string, any> = await response.json();\n return Object.fromEntries(\n Object.entries(responseBody).map(([key, oraclePrice]) => [\n key,\n {\n priceRealtime: {\n price: BigNumber(oraclePrice.priceRealtime.price),\n confidence: BigNumber(oraclePrice.priceRealtime.confidence),\n lowestPrice: BigNumber(oraclePrice.priceRealtime.lowestPrice),\n highestPrice: BigNumber(oraclePrice.priceRealtime.highestPrice),\n },\n priceWeighted: {\n price: BigNumber(oraclePrice.priceWeighted.price),\n confidence: BigNumber(oraclePrice.priceWeighted.confidence),\n lowestPrice: BigNumber(oraclePrice.priceWeighted.lowestPrice),\n highestPrice: BigNumber(oraclePrice.priceWeighted.highestPrice),\n },\n timestamp: oraclePrice.timestamp ? BigNumber(oraclePrice.timestamp) : null,\n },\n ]),\n ) as Record<string, OraclePrice>;\n};\n\n/**\n * Maps banks to their corresponding oracle prices\n */\nconst mapSwbBanksToOraclePrices = (\n banks: { address: PublicKey; data: BankRaw }[],\n oraclePrices: Record<string, OraclePrice>,\n oracleKeyMap: Record<string, { feedId: string }>,\n): Map<string, OraclePrice> => {\n const bankOraclePriceMap = new Map<string, OraclePrice>();\n\n // Map legacy banks\n banks.forEach((bank) => {\n const oracleKey = bank.data.config.oracleKeys[0].toBase58();\n const oracleFeed = oracleKeyMap[oracleKey];\n const oraclePrice = oracleFeed?.feedId ? oraclePrices[oracleFeed.feedId] : null;\n if (oraclePrice) {\n bankOraclePriceMap.set(bank.address.toBase58(), oraclePrice);\n }\n });\n\n return bankOraclePriceMap;\n};\n\n/**\n * =============================================================================\n * ORACLE UTILS\n * =============================================================================\n *\n * Utility functions for fetching all oracle data\n */\n\nexport const fetchOracleData = async (\n banks: { address: PublicKey; data: BankRaw }[],\n bankMetadataMap: {\n [address: string]: BankMetadata;\n },\n connection?: Connection,\n opts?: { useApiEndpoint?: boolean },\n): Promise<{\n bankOraclePriceMap: Map<string, OraclePrice>;\n pythFeedMap: PythPushFeedIdMap;\n}> => {\n const [pythData, swbData] = await Promise.all([\n fetchPythOracleData(banks, bankMetadataMap, connection, opts),\n fetchSwbOracleData(banks, opts),\n ]);\n\n const bankOraclePriceMap = new Map<string, OraclePrice>();\n\n // Map pyth data\n pythData.bankOraclePriceMap.forEach((oraclePrice, bankAddress) => {\n bankOraclePriceMap.set(bankAddress, oraclePrice);\n });\n\n // Map swb data\n swbData.bankOraclePriceMap.forEach((oraclePrice, bankAddress) => {\n bankOraclePriceMap.set(bankAddress, oraclePrice);\n });\n\n // check if any bank is missing an oracle price\n banks.forEach((bank) => {\n if (!bankOraclePriceMap.has(bank.address.toBase58())) {\n console.error(`Bank ${bank.address.toBase58()} is missing an oracle price`);\n\n bankOraclePriceMap.set(bank.address.toBase58(), {\n priceRealtime: {\n price: BigNumber(0),\n confidence: BigNumber(0),\n lowestPrice: BigNumber(0),\n highestPrice: BigNumber(0),\n },\n priceWeighted: {\n price: BigNumber(0),\n confidence: BigNumber(0),\n lowestPrice: BigNumber(0),\n highestPrice: BigNumber(0),\n },\n timestamp: BigNumber(0),\n });\n }\n });\n\n return {\n bankOraclePriceMap,\n pythFeedMap: pythData.pythFeedMap,\n };\n};\n","import type { OraclePrice, OraclePriceDto } from \"../types\";\n\nexport function oraclePriceToDto(oraclePrice: OraclePrice): OraclePriceDto {\n return {\n priceRealtime: {\n price: oraclePrice.priceRealtime.price.toString(),\n confidence: oraclePrice.priceRealtime.confidence.toString(),\n lowestPrice: oraclePrice.priceRealtime.lowestPrice.toString(),\n highestPrice: oraclePrice.priceRealtime.highestPrice.toString(),\n },\n priceWeighted: {\n price: oraclePrice.priceWeighted.price.toString(),\n confidence: oraclePrice.priceWeighted.confidence.toString(),\n lowestPrice: oraclePrice.priceWeighted.lowestPrice.toString(),\n highestPrice: oraclePrice.priceWeighted.highestPrice.toString(),\n },\n timestamp: oraclePrice.timestamp.toString(),\n pythShardId: oraclePrice.pythShardId,\n };\n}\n","import BigNumber from \"bignumber.js\";\nimport { isWeightedPrice, LendrRequirementType } from \"~/models/account\";\nimport { getPrice, type OraclePrice, PriceBias } from \"~/services/price\";\nimport { type Amount, toBigNumber } from \"../../../common\";\n\nimport type { BankConfigType, BankType } from \"../types\";\n\nexport function computeMaxLeverage(\n depositBank: BankType,\n borrowBank: BankType,\n opts?: { assetWeightInit?: BigNumber; liabilityWeightInit?: BigNumber },\n): { maxLeverage: number; ltv: number } {\n const assetWeightInit = opts?.assetWeightInit || depositBank.config.assetWeightInit;\n const liabilityWeightInit = opts?.liabilityWeightInit || borrowBank.config.liabilityWeightInit;\n\n const ltv = assetWeightInit.div(liabilityWeightInit).toNumber();\n const maxLeverage = 1 / (1 - ltv);\n\n return {\n maxLeverage,\n ltv,\n };\n}\n\nexport function computeLoopingParams(\n principal: Amount,\n targetLeverage: number,\n depositBank: BankType,\n borrowBank: BankType,\n depositOracleInfo: OraclePrice,\n borrowOracleInfo: OraclePrice,\n): { borrowAmount: BigNumber; totalDepositAmount: BigNumber } {\n const initialCollateral = toBigNumber(principal);\n const { maxLeverage } = computeMaxLeverage(depositBank, borrowBank);\n\n if (targetLeverage < 1) {\n throw Error(`Target leverage ${targetLeverage} needs to be greater than 1`);\n }\n\n if (targetLeverage > maxLeverage) {\n throw Error(`Target leverage ${targetLeverage} exceeds max leverage for banks ${maxLeverage}`);\n }\n\n const totalDepositAmount = initialCollateral.times(new BigNumber(targetLeverage));\n const additionalDepositAmount = totalDepositAmount.minus(initialCollateral);\n const borrowAmount = additionalDepositAmount\n .times(depositOracleInfo.priceWeighted.lowestPrice)\n .div(borrowOracleInfo.priceWeighted.highestPrice);\n\n return { borrowAmount, totalDepositAmount };\n}\n\n/** Small getters */\n\nexport function getTotalAssetQuantity(bank: BankType): BigNumber {\n return bank.totalAssetShares.times(bank.assetShareValue);\n}\n\nexport function getTotalLiabilityQuantity(bank: BankType): BigNumber {\n return bank.totalLiabilityShares.times(bank.liabilityShareValue);\n}\n\nexport function getAssetQuantity(bank: BankType, assetShares: BigNumber): BigNumber {\n return assetShares.times(bank.assetShareValue);\n}\n\nexport function getLiabilityQuantity(bank: BankType, liabilityShares: BigNumber): BigNumber {\n return liabilityShares.times(bank.liabilityShareValue);\n}\n\nexport function getAssetShares(bank: BankType, assetQuantity: BigNumber): BigNumber {\n return assetQuantity.times(bank.assetShareValue);\n}\n\nexport function getLiabilityShares(bank: BankType, liabilityQuantity: BigNumber): BigNumber {\n return liabilityQuantity.times(bank.liabilityShareValue);\n}\n\nexport function getAssetWeight(\n bank: BankType,\n lendrRequirementType: LendrRequirementType,\n oraclePrice: OraclePrice,\n opts?: {\n ignoreSoftLimits?: boolean;\n assetWeightInitOverride?: BigNumber;\n },\n): BigNumber {\n const assetWeightInit = opts?.assetWeightInitOverride ?? bank.config.assetWeightInit;\n\n switch (lendrRequirementType) {\n case LendrRequirementType.Initial: {\n const isSoftLimitDisabled = bank.config.totalAssetValueInitLimit.isZero();\n if (opts?.ignoreSoftLimits || isSoftLimitDisabled) return assetWeightInit;\n const totalBankCollateralValue = computeAssetUsdValue(\n bank,\n oraclePrice,\n bank.totalAssetShares,\n LendrRequirementType.Equity,\n PriceBias.Lowest,\n );\n if (totalBankCollateralValue.isGreaterThan(bank.config.totalAssetValueInitLimit)) {\n return bank.config.totalAssetValueInitLimit.div(totalBankCollateralValue).times(assetWeightInit);\n } else {\n return assetWeightInit;\n }\n }\n case LendrRequirementType.Maintenance:\n return bank.config.assetWeightMaint;\n case LendrRequirementType.Equity:\n return new BigNumber(1);\n default:\n throw new Error(\"Invalid lendr requirement type\");\n }\n}\n\nexport function getLiabilityWeight(config: BankConfigType, lendrRequirementType: LendrRequirementType): BigNumber {\n switch (lendrRequirementType) {\n case LendrRequirementType.Initial:\n return config.liabilityWeightInit;\n case LendrRequirementType.Maintenance:\n return config.liabilityWeightMaint;\n case LendrRequirementType.Equity:\n return new BigNumber(1);\n default:\n throw new Error(\"Invalid lendr requirement type\");\n }\n}\n\n/** Computes */\n\nexport function computeLiabilityUsdValue(\n bank: BankType,\n oraclePrice: OraclePrice,\n liabilityShares: BigNumber,\n lendrRequirementType: LendrRequirementType,\n priceBias: PriceBias,\n): BigNumber {\n const liabilityQuantity = getLiabilityQuantity(bank, liabilityShares);\n const liabilityWeight = getLiabilityWeight(bank.config, lendrRequirementType);\n const isWeighted = isWeightedPrice(lendrRequirementType);\n return computeUsdValue(bank, oraclePrice, liabilityQuantity, priceBias, isWeighted, liabilityWeight);\n}\n\nexport function computeAssetUsdValue(\n bank: BankType,\n oraclePrice: OraclePrice,\n assetShares: BigNumber,\n lendrRequirementType: LendrRequirementType,\n priceBias: PriceBias,\n): BigNumber {\n const assetQuantity = getAssetQuantity(bank, assetShares);\n const assetWeight = getAssetWeight(bank, lendrRequirementType, oraclePrice);\n const isWeighted = isWeightedPrice(lendrRequirementType);\n return computeUsdValue(bank, oraclePrice, assetQuantity, priceBias, isWeighted, assetWeight);\n}\n\nexport function computeUsdValue(\n bank: BankType,\n oraclePrice: OraclePrice,\n quantity: BigNumber,\n priceBias: PriceBias,\n weightedPrice: boolean,\n weight?: BigNumber,\n scaleToBase: boolean = true,\n): BigNumber {\n const price = getPrice(oraclePrice, priceBias, weightedPrice);\n return quantity\n .times(price)\n .times(weight ?? 1)\n .dividedBy(scaleToBase ? 10 ** bank.mintDecimals : 1);\n}\n\nexport function computeTvl(bank: BankType, oraclePrice: OraclePrice): BigNumber {\n return computeAssetUsdValue(\n bank,\n oraclePrice,\n bank.totalAssetShares,\n LendrRequirementType.Equity,\n PriceBias.None,\n ).minus(\n computeLiabilityUsdValue(bank, oraclePrice, bank.totalLiabilityShares, LendrRequirementType.Equity, PriceBias.None),\n );\n}\n\nexport function computeInterestRates(bank: BankType): {\n lendingRate: BigNumber;\n borrowingRate: BigNumber;\n} {\n const { insuranceFeeFixedApr, insuranceIrFee, protocolFixedFeeApr, protocolIrFee } = bank.config.interestRateConfig;\n\n const fixedFee = insuranceFeeFixedApr.plus(protocolFixedFeeApr);\n const rateFee = insuranceIrFee.plus(protocolIrFee);\n\n const baseInterestRate = computeBaseInterestRate(bank);\n const utilizationRate = computeUtilizationRate(bank);\n\n const lendingRate = baseInterestRate.times(utilizationRate);\n const borrowingRate = baseInterestRate.times(new BigNumber(1).plus(rateFee)).plus(fixedFee);\n\n return { lendingRate, borrowingRate };\n}\n\nexport function computeBaseInterestRate(bank: BankType): BigNumber {\n const { optimalUtilizationRate, plateauInterestRate, maxInterestRate } = bank.config.interestRateConfig;\n\n const utilizationRate = computeUtilizationRate(bank);\n\n if (utilizationRate.lte(optimalUtilizationRate)) {\n return utilizationRate.times(plateauInterestRate).div(optimalUtilizationRate);\n } else {\n return utilizationRate\n .minus(optimalUtilizationRate)\n .div(new BigNumber(1).minus(optimalUtilizationRate))\n .times(maxInterestRate.minus(plateauInterestRate))\n .plus(plateauInterestRate);\n }\n}\n\nexport function computeUtilizationRate(bank: BankType): BigNumber {\n const assets = getTotalAssetQuantity(bank);\n const liabilities = getTotalLiabilityQuantity(bank);\n if (assets.isZero()) return new BigNumber(0);\n return liabilities.div(assets);\n}\n\nconst SECONDS_PER_DAY = 24 * 60 * 60;\nconst SECONDS_PER_YEAR = SECONDS_PER_DAY * 365.25;\n\nexport function computeRemainingCapacity(bank: BankType): {\n depositCapacity: BigNumber;\n borrowCapacity: BigNumber;\n} {\n const totalDeposits = getTotalAssetQuantity(bank);\n const remainingCapacity = BigNumber.max(0, bank.config.depositLimit.minus(totalDeposits));\n\n const totalBorrows = getTotalLiabilityQuantity(bank);\n const remainingBorrowCapacity = BigNumber.max(0, bank.config.borrowLimit.minus(totalBorrows));\n\n const durationSinceLastAccrual = Date.now() / 1000 - bank.lastUpdate;\n\n const { lendingRate, borrowingRate } = computeInterestRates(bank);\n\n const outstandingLendingInterest = lendingRate\n .times(durationSinceLastAccrual)\n .dividedBy(SECONDS_PER_YEAR)\n .times(totalDeposits);\n const outstandingBorrowInterest = borrowingRate\n .times(durationSinceLastAccrual)\n .dividedBy(SECONDS_PER_YEAR)\n .times(totalBorrows);\n\n const depositCapacity = remainingCapacity.minus(outstandingLendingInterest.times(2));\n const borrowCapacity = remainingBorrowCapacity.minus(outstandingBorrowInterest.times(2));\n\n return {\n depositCapacity,\n borrowCapacity,\n };\n}\n","import type { Address } from \"@coral-xyz/anchor\";\nimport { PublicKey } from \"@solana/web3.js\";\n\nimport type { LendrProgram } from \"~/types\";\n\nimport type { BankRaw } from \"../types\";\n\nexport const fetchMultipleBanks = async (\n program: LendrProgram,\n opts?: { bankAddresses?: Address[]; groupAddress?: PublicKey },\n): Promise<{ address: PublicKey; data: BankRaw }[]> => {\n let bankDatas: { address: PublicKey; data: BankRaw }[] = [];\n\n if (opts?.bankAddresses && opts.bankAddresses.length > 0) {\n const addresses = opts.bankAddresses;\n const data = await program.account.bank.fetchMultiple(addresses);\n\n data.forEach((d, idx) => {\n if (d) {\n bankDatas.push({ address: new PublicKey(addresses[idx]), data: d });\n } else {\n console.error(`Bank ${addresses[idx]} not found`);\n }\n });\n } else {\n const bankOpts = opts?.groupAddress\n ? [{ memcmp: { offset: 8 + 32 + 1, bytes: opts.groupAddress.toBase58() } }]\n : [];\n const data = await program.account.bank.all(bankOpts);\n bankDatas = data.map((d) => ({ address: d.publicKey, data: d.account }));\n }\n\n return bankDatas;\n};\n","import type BigNumber from \"bignumber.js\";\nimport BN from \"bn.js\";\n\nimport { bigNumberToWrappedI80F48 } from \"../../../common\";\n\nimport {\n type BankConfigDto,\n type BankConfigOpt,\n type BankConfigOptRaw,\n type BankConfigRaw,\n type BankConfigRawDto,\n type BankConfigType,\n type BankRaw,\n type BankRawDto,\n type BankType,\n type BankTypeDto,\n type EmodeSettingsDto,\n type EmodeSettingsRaw,\n type EmodeSettingsRawDto,\n type EmodeSettingsType,\n type InterestRateConfig,\n type InterestRateConfigDto,\n OperationalState,\n OracleSetup,\n type OracleSetupRaw,\n RiskTier,\n type RiskTierRaw,\n} from \"../types\";\n\nfunction serializeBankConfigOpt(bankConfigOpt: BankConfigOpt): BankConfigOptRaw {\n const toWrappedI80F48 = (value: BigNumber | null) => value && bigNumberToWrappedI80F48(value);\n const toBN = (value: BigNumber | null) => value && new BN(value.toString());\n\n return {\n assetWeightInit: toWrappedI80F48(bankConfigOpt.assetWeightInit),\n assetWeightMaint: toWrappedI80F48(bankConfigOpt.assetWeightMaint),\n liabilityWeightInit: toWrappedI80F48(bankConfigOpt.liabilityWeightInit),\n liabilityWeightMaint: toWrappedI80F48(bankConfigOpt.liabilityWeightMaint),\n depositLimit: toBN(bankConfigOpt.depositLimit),\n borrowLimit: toBN(bankConfigOpt.borrowLimit),\n riskTier: bankConfigOpt.riskTier && serializeRiskTier(bankConfigOpt.riskTier),\n totalAssetValueInitLimit: toBN(bankConfigOpt.totalAssetValueInitLimit),\n assetTag: bankConfigOpt.assetTag !== null ? Number(bankConfigOpt.assetTag) : 0,\n interestRateConfig:\n bankConfigOpt.interestRateConfig &&\n ({\n insuranceFeeFixedApr: toWrappedI80F48(bankConfigOpt.interestRateConfig.insuranceFeeFixedApr),\n maxInterestRate: toWrappedI80F48(bankConfigOpt.interestRateConfig.maxInterestRate),\n insuranceIrFee: toWrappedI80F48(bankConfigOpt.interestRateConfig.insuranceIrFee),\n optimalUtilizationRate: toWrappedI80F48(bankConfigOpt.interestRateConfig.optimalUtilizationRate),\n plateauInterestRate: toWrappedI80F48(bankConfigOpt.interestRateConfig.plateauInterestRate),\n protocolFixedFeeApr: toWrappedI80F48(bankConfigOpt.interestRateConfig.protocolFixedFeeApr),\n protocolIrFee: toWrappedI80F48(bankConfigOpt.interestRateConfig.protocolIrFee),\n } as any),\n operationalState: bankConfigOpt.operationalState && serializeOperationalState(bankConfigOpt.operationalState),\n oracleMaxAge: bankConfigOpt.oracleMaxAge,\n permissionlessBadDebtSettlement: bankConfigOpt.permissionlessBadDebtSettlement,\n freezeSettings: null,\n };\n}\n\nfunction serializeRiskTier(riskTier: RiskTier): RiskTierRaw {\n switch (riskTier) {\n case RiskTier.Collateral:\n return { collateral: {} };\n case RiskTier.Isolated:\n return { isolated: {} };\n default:\n throw new Error(`Invalid risk tier \"${riskTier}\"`);\n }\n}\n\nfunction serializeOperationalState(\n operationalState: OperationalState,\n): { paused: {} } | { operational: {} } | { reduceOnly: {} } {\n switch (operationalState) {\n case OperationalState.Paused:\n return { paused: {} };\n case OperationalState.Operational:\n return { operational: {} };\n case OperationalState.ReduceOnly:\n return { reduceOnly: {} };\n default:\n throw new Error(`Invalid operational state \"${operationalState}\"`);\n }\n}\n\nfunction serializeOracleSetupToIndex(oracleSetup: OracleSetup): number {\n switch (oracleSetup) {\n case OracleSetup.None:\n return 0;\n case OracleSetup.PythLegacy:\n return 1;\n case OracleSetup.SwitchboardV2:\n return 2;\n case OracleSetup.PythPushOracle:\n return 3;\n case OracleSetup.SwitchboardPull:\n return 4;\n case OracleSetup.StakedWithPythPush:\n return 5;\n default:\n return 0;\n }\n}\n\nfunction serializeOracleSetup(oracleSetup: OracleSetup): OracleSetupRaw {\n switch (oracleSetup) {\n case OracleSetup.None:\n return { none: {} };\n case OracleSetup.PythLegacy:\n return { pythLegacy: {} };\n case OracleSetup.SwitchboardV2:\n return { switchboardV2: {} };\n case OracleSetup.PythPushOracle:\n return { pythPushOracle: {} };\n case OracleSetup.SwitchboardPull:\n return { switchboardPull: {} };\n case OracleSetup.StakedWithPythPush:\n return { stakedWithPythPush: {} };\n default:\n throw new Error(`Invalid oracle setup \"${oracleSetup}\"`);\n }\n}\n\nfunction toBankDto(bank: BankType): BankTypeDto {\n return {\n address: bank.address.toBase58(),\n group: bank.group.toBase58(),\n mint: bank.mint.toBase58(),\n mintDecimals: bank.mintDecimals,\n assetShareValue: bank.assetShareValue.toString(),\n liabilityShareValue: bank.liabilityShareValue.toString(),\n liquidityVault: bank.liquidityVault.toBase58(),\n liquidityVaultBump: bank.liquidityVaultBump,\n liquidityVaultAuthorityBump: bank.liquidityVaultAuthorityBump,\n insuranceVault: bank.insuranceVault.toBase58(),\n insuranceVaultBump: bank.insuranceVaultBump,\n insuranceVaultAuthorityBump: bank.insuranceVaultAuthorityBump,\n collectedInsuranceFeesOutstanding: bank.collectedInsuranceFeesOutstanding.toString(),\n feeVault: bank.feeVault.toBase58(),\n feeVaultBump: bank.feeVaultBump,\n feeVaultAuthorityBump: bank.feeVaultAuthorityBump,\n collectedGroupFeesOutstanding: bank.collectedGroupFeesOutstanding.toString(),\n lastUpdate: bank.lastUpdate,\n config: toBankConfigDto(bank.config),\n totalAssetShares: bank.totalAssetShares.toString(),\n totalLiabilityShares: bank.totalLiabilityShares.toString(),\n emissionsActiveBorrowing: bank.emissionsActiveBorrowing,\n emissionsActiveLending: bank.emissionsActiveLending,\n emissionsRate: bank.emissionsRate,\n emissionsMint: bank.emissionsMint.toBase58(),\n emissionsRemaining: bank.emissionsRemaining.toString(),\n oracleKey: bank.oracleKey.toBase58(),\n pythShardId: bank.pythShardId,\n emode: toEmodeSettingsDto(bank.emode),\n tokenSymbol: bank.tokenSymbol,\n };\n}\n\nfunction toEmodeSettingsDto(emodeSettings: EmodeSettingsType): EmodeSettingsDto {\n return {\n emodeTag: emodeSettings.emodeTag,\n timestamp: emodeSettings.timestamp,\n flags: emodeSettings.flags,\n emodeEntries: emodeSettings.emodeEntries.map((entry) => {\n return {\n collateralBankEmodeTag: entry.collateralBankEmodeTag,\n flags: entry.flags,\n assetWeightInit: entry.assetWeightInit.toString(),\n assetWeightMaint: entry.assetWeightMaint.toString(),\n };\n }),\n };\n}\n\nfunction toBankConfigDto(bankConfig: BankConfigType): BankConfigDto {\n return {\n assetWeightInit: bankConfig.assetWeightInit.toString(),\n assetWeightMaint: bankConfig.assetWeightMaint.toString(),\n liabilityWeightInit: bankConfig.liabilityWeightInit.toString(),\n liabilityWeightMaint: bankConfig.liabilityWeightMaint.toString(),\n depositLimit: bankConfig.depositLimit.toString(),\n borrowLimit: bankConfig.borrowLimit.toString(),\n riskTier: bankConfig.riskTier,\n operationalState: bankConfig.operationalState,\n totalAssetValueInitLimit: bankConfig.totalAssetValueInitLimit.toString(),\n assetTag: bankConfig.assetTag,\n oracleSetup: bankConfig.oracleSetup,\n oracleKeys: bankConfig.oracleKeys.map((key) => key.toBase58()),\n oracleMaxAge: bankConfig.oracleMaxAge,\n interestRateConfig: toInterestRateConfigDto(bankConfig.interestRateConfig),\n };\n}\n\nfunction toInterestRateConfigDto(interestRateConfig: InterestRateConfig): InterestRateConfigDto {\n return {\n optimalUtilizationRate: interestRateConfig.optimalUtilizationRate.toString(),\n plateauInterestRate: interestRateConfig.plateauInterestRate.toString(),\n maxInterestRate: interestRateConfig.maxInterestRate.toString(),\n insuranceFeeFixedApr: interestRateConfig.insuranceFeeFixedApr.toString(),\n insuranceIrFee: interestRateConfig.insuranceIrFee.toString(),\n protocolFixedFeeApr: interestRateConfig.protocolFixedFeeApr.toString(),\n protocolIrFee: interestRateConfig.protocolIrFee.toString(),\n protocolOriginationFee: interestRateConfig.protocolOriginationFee.toString(),\n };\n}\n\nexport function bankRawToDto(bankRaw: BankRaw): BankRawDto {\n return {\n group: bankRaw.group.toBase58(),\n mint: bankRaw.mint.toBase58(),\n mintDecimals: bankRaw.mintDecimals,\n\n assetShareValue: bankRaw.assetShareValue,\n liabilityShareValue: bankRaw.liabilityShareValue,\n\n liquidityVault: bankRaw.liquidityVault.toBase58(),\n liquidityVaultBump: bankRaw.liquidityVaultBump,\n liquidityVaultAuthorityBump: bankRaw.liquidityVaultAuthorityBump,\n\n insuranceVault: bankRaw.insuranceVault.toBase58(),\n insuranceVaultBump: bankRaw.insuranceVaultBump,\n insuranceVaultAuthorityBump: bankRaw.insuranceVaultAuthorityBump,\n collectedInsuranceFeesOutstanding: bankRaw.collectedInsuranceFeesOutstanding,\n\n feeVault: bankRaw.feeVault.toBase58(),\n feeVaultBump: bankRaw.feeVaultBump,\n feeVaultAuthorityBump: bankRaw.feeVaultAuthorityBump,\n collectedGroupFeesOutstanding: bankRaw.collectedGroupFeesOutstanding,\n\n lastUpdate: bankRaw.lastUpdate.toString(),\n\n config: bankConfigRawToDto(bankRaw.config),\n\n totalAssetShares: bankRaw.totalAssetShares,\n totalLiabilityShares: bankRaw.totalLiabilityShares,\n\n flags: bankRaw.flags.toString(),\n emissionsRate: bankRaw.emissionsRate.toString(),\n emissionsRemaining: bankRaw.emissionsRemaining,\n emissionsMint: bankRaw.emissionsMint.toBase58(),\n\n emode: emodeSettingsRawToDto(bankRaw.emode),\n };\n}\n\nexport function emodeSettingsRawToDto(emodeSettingsRaw: EmodeSettingsRaw): EmodeSettingsRawDto {\n return {\n emodeTag: emodeSettingsRaw.emodeTag,\n timestamp: emodeSettingsRaw.timestamp.toString(),\n flags: emodeSettingsRaw.flags.toString(),\n emodeConfig: {\n entries: emodeSettingsRaw.emodeConfig.entries.map((entry) => {\n return {\n collateralBankEmodeTag: entry.collateralBankEmodeTag,\n flags: entry.flags,\n assetWeightInit: entry.assetWeightInit,\n assetWeightMaint: entry.assetWeightMaint,\n };\n }),\n },\n };\n}\n\nexport function bankConfigRawToDto(bankConfigRaw: BankConfigRaw): BankConfigRawDto {\n return {\n assetWeightInit: bankConfigRaw.assetWeightInit,\n assetWeightMaint: bankConfigRaw.assetWeightMaint,\n liabilityWeightInit: bankConfigRaw.liabilityWeightInit,\n liabilityWeightMaint: bankConfigRaw.liabilityWeightMaint,\n depositLimit: bankConfigRaw.depositLimit.toString(),\n borrowLimit: bankConfigRaw.borrowLimit.toString(),\n riskTier: bankConfigRaw.riskTier,\n operationalState: bankConfigRaw.operationalState,\n totalAssetValueInitLimit: bankConfigRaw.totalAssetValueInitLimit.toString(),\n assetTag: bankConfigRaw.assetTag,\n oracleSetup: bankConfigRaw.oracleSetup,\n oracleKeys: bankConfigRaw.oracleKeys.map((key) => key.toBase58()),\n oracleMaxAge: bankConfigRaw.oracleMaxAge,\n interestRateConfig: bankConfigRaw.interestRateConfig,\n };\n}\n\nexport {\n serializeOracleSetupToIndex,\n serializeBankConfigOpt,\n serializeRiskTier,\n serializeOperationalState,\n serializeOracleSetup,\n toBankDto,\n toEmodeSettingsDto,\n toBankConfigDto,\n toInterestRateConfigDto,\n};\n","import type { PublicKey } from \"@solana/web3.js\";\nimport BigNumber from \"bignumber.js\";\nimport type { BankExtendedMetadata } from \"@/common/bank-metadata\";\nimport { type BankMetadata, nativeToUi } from \"../common\";\nimport type { LendrIdlType } from \"../idl\";\nimport {\n type AssetTag,\n type BankConfigRaw,\n type BankConfigType,\n type BankRaw,\n type BankType,\n getPrice,\n type InterestRateConfig,\n type OperationalState,\n type OraclePrice,\n type OracleSetup,\n type RiskTier,\n} from \"../services\";\nimport {\n computeAssetUsdValue,\n computeBaseInterestRate,\n computeInterestRates,\n computeLiabilityUsdValue,\n computeRemainingCapacity,\n computeTvl,\n computeUsdValue,\n computeUtilizationRate,\n decodeBankRaw,\n getAssetQuantity,\n getAssetShares,\n getAssetWeight,\n getLiabilityQuantity,\n getLiabilityShares,\n getLiabilityWeight,\n getTotalAssetQuantity,\n getTotalLiabilityQuantity,\n parseBankConfigRaw,\n parseBankRaw,\n} from \"../services/bank/utils\";\nimport { PriceBias } from \"../services/price/types\";\nimport type { PythPushFeedIdMap } from \"../utils\";\nimport { LendrRequirementType } from \"./account\";\nimport type { EmodeSettings } from \"./emode-settings\";\n\nconst SECONDS_PER_DAY = 24 * 60 * 60;\nconst SECONDS_PER_YEAR = SECONDS_PER_DAY * 365.25;\n\n// ----------------------------------------------------------------------------\n// Client types\n// ----------------------------------------------------------------------------\n\nclass Bank implements BankType {\n constructor(\n public readonly address: PublicKey,\n public readonly mint: PublicKey,\n public readonly mintDecimals: number,\n public readonly group: PublicKey,\n public readonly assetShareValue: BigNumber,\n public readonly liabilityShareValue: BigNumber,\n public readonly liquidityVault: PublicKey,\n public readonly liquidityVaultBump: number,\n public readonly liquidityVaultAuthorityBump: number,\n public readonly insuranceVault: PublicKey,\n public readonly insuranceVaultBump: number,\n public readonly insuranceVaultAuthorityBump: number,\n public readonly collectedInsuranceFeesOutstanding: BigNumber,\n public readonly feeVault: PublicKey,\n public readonly feeVaultBump: number,\n public readonly feeVaultAuthorityBump: number,\n public readonly collectedGroupFeesOutstanding: BigNumber,\n public readonly lastUpdate: number,\n public config: BankConfig,\n public readonly totalAssetShares: BigNumber,\n public readonly totalLiabilityShares: BigNumber,\n public readonly emissionsActiveBorrowing: boolean,\n public readonly emissionsActiveLending: boolean,\n public readonly emissionsRate: number,\n public readonly emissionsMint: PublicKey,\n public readonly emissionsRemaining: BigNumber,\n public readonly oracleKey: PublicKey,\n public readonly emode: EmodeSettings,\n public readonly pythShardId?: number,\n public readonly tokenSymbol?: string,\n public readonly extendedMetadata?: BankExtendedMetadata,\n public readonly owner?: PublicKey,\n ) {}\n\n static decodeBankRaw(encoded: Buffer, idl: LendrIdlType): BankRaw {\n return decodeBankRaw(encoded, idl);\n }\n\n static fromBuffer(bankPk: PublicKey, rawData: Buffer, idl: LendrIdlType, feedIdMap: PythPushFeedIdMap): Bank {\n const accountParsed = Bank.decodeBankRaw(rawData, idl);\n return Bank.fromAccountParsed(bankPk, accountParsed, feedIdMap);\n }\n\n static fromBankType(bankType: BankType): Bank {\n const config = new BankConfig(\n bankType.config.assetWeightInit,\n bankType.config.assetWeightMaint,\n bankType.config.liabilityWeightInit,\n bankType.config.liabilityWeightMaint,\n bankType.config.depositLimit,\n bankType.config.borrowLimit,\n bankType.config.riskTier,\n bankType.config.totalAssetValueInitLimit,\n bankType.config.assetTag,\n bankType.config.oracleSetup,\n bankType.config.oracleKeys,\n bankType.config.oracleMaxAge,\n bankType.config.interestRateConfig,\n bankType.config.operationalState,\n );\n return new Bank(\n bankType.address,\n bankType.mint,\n bankType.mintDecimals,\n bankType.group,\n bankType.assetShareValue,\n bankType.liabilityShareValue,\n bankType.liquidityVault,\n bankType.liquidityVaultBump,\n bankType.liquidityVaultAuthorityBump,\n bankType.insuranceVault,\n bankType.insuranceVaultBump,\n bankType.insuranceVaultAuthorityBump,\n bankType.collectedInsuranceFeesOutstanding,\n bankType.feeVault,\n bankType.feeVaultBump,\n bankType.feeVaultAuthorityBump,\n bankType.collectedGroupFeesOutstanding,\n bankType.lastUpdate,\n config,\n bankType.totalAssetShares,\n bankType.totalLiabilityShares,\n bankType.emissionsActiveBorrowing,\n bankType.emissionsActiveLending,\n bankType.emissionsRate,\n bankType.emissionsMint,\n bankType.emissionsRemaining,\n bankType.oracleKey,\n bankType.emode,\n bankType.pythShardId,\n bankType.tokenSymbol,\n );\n }\n\n static fromAccountParsed(\n address: PublicKey,\n accountParsed: BankRaw,\n feedIdMap?: PythPushFeedIdMap,\n // TODO)) [later] change these to non-optional\n extendedMetadata?: BankExtendedMetadata,\n owner?: PublicKey,\n ): Bank {\n const props = parseBankRaw(address, accountParsed, feedIdMap);\n return new Bank(\n props.address,\n props.mint,\n props.mintDecimals,\n props.group,\n props.assetShareValue,\n props.liabilityShareValue,\n props.liquidityVault,\n props.liquidityVaultBump,\n props.liquidityVaultAuthorityBump,\n props.insuranceVault,\n props.insuranceVaultBump,\n props.insuranceVaultAuthorityBump,\n props.collectedInsuranceFeesOutstanding,\n props.feeVault,\n props.feeVaultBump,\n props.feeVaultAuthorityBump,\n props.collectedGroupFeesOutstanding,\n props.lastUpdate,\n props.config,\n props.totalAssetShares,\n props.totalLiabilityShares,\n props.emissionsActiveBorrowing,\n props.emissionsActiveLending,\n props.emissionsRate,\n props.emissionsMint,\n props.emissionsRemaining,\n props.oracleKey,\n props.emode,\n props.pythShardId,\n extendedMetadata?.symbol,\n extendedMetadata,\n owner,\n );\n }\n\n static withEmodeWeights(bank: Bank, emodeWeights: { assetWeightMaint: BigNumber; assetWeightInit: BigNumber }): Bank {\n const newBank = Object.create(Bank.prototype);\n\n Object.assign(newBank, bank);\n\n newBank.config = Object.assign({}, bank.config);\n newBank.config.assetWeightInit = BigNumber.max(bank.config.assetWeightInit, emodeWeights.assetWeightInit);\n newBank.config.assetWeightMaint = BigNumber.max(bank.config.assetWeightMaint, emodeWeights.assetWeightMaint);\n\n return newBank;\n }\n\n static getPrice(\n oraclePrice: OraclePrice,\n priceBias: PriceBias = PriceBias.None,\n weightedPrice: boolean = false,\n ): BigNumber {\n return getPrice(oraclePrice, priceBias, weightedPrice);\n }\n\n static computeQuantityFromUsdValue(\n oraclePrice: OraclePrice,\n usdValue: BigNumber,\n priceBias: PriceBias,\n weightedPrice: boolean,\n ): BigNumber {\n const price = getPrice(oraclePrice, priceBias, weightedPrice);\n return usdValue.div(price);\n }\n\n getTotalAssetQuantity(): BigNumber {\n return getTotalAssetQuantity(this);\n }\n\n getTotalLiabilityQuantity(): BigNumber {\n return getTotalLiabilityQuantity(this);\n }\n\n getAssetQuantity(assetShares: BigNumber): BigNumber {\n return getAssetQuantity(this, assetShares);\n }\n\n getLiabilityQuantity(liabilityShares: BigNumber): BigNumber {\n return getLiabilityQuantity(this, liabilityShares);\n }\n\n getAssetShares(assetQuantity: BigNumber): BigNumber {\n return getAssetShares(this, assetQuantity);\n }\n\n getLiabilityShares(liabilityQuantity: BigNumber): BigNumber {\n return getLiabilityShares(this, liabilityQuantity);\n }\n\n computeAssetUsdValue(\n oraclePrice: OraclePrice,\n assetShares: BigNumber,\n lendrRequirementType: LendrRequirementType,\n priceBias: PriceBias,\n ): BigNumber {\n return computeAssetUsdValue(this, oraclePrice, assetShares, lendrRequirementType, priceBias);\n }\n\n computeLiabilityUsdValue(\n oraclePrice: OraclePrice,\n liabilityShares: BigNumber,\n lendrRequirementType: LendrRequirementType,\n priceBias: PriceBias,\n ): BigNumber {\n return computeLiabilityUsdValue(this, oraclePrice, liabilityShares, lendrRequirementType, priceBias);\n }\n\n computeUsdValue(\n oraclePrice: OraclePrice,\n quantity: BigNumber,\n priceBias: PriceBias,\n weightedPrice: boolean,\n weight?: BigNumber,\n scaleToBase: boolean = true,\n ): BigNumber {\n return computeUsdValue(this, oraclePrice, quantity, priceBias, weightedPrice, weight, scaleToBase);\n }\n\n getAssetWeight(\n lendrRequirementType: LendrRequirementType,\n oraclePrice: OraclePrice,\n ignoreSoftLimits: boolean = false,\n assetWeightInitOverride?: BigNumber,\n ): BigNumber {\n return getAssetWeight(this, lendrRequirementType, oraclePrice, {\n ignoreSoftLimits,\n assetWeightInitOverride,\n });\n }\n\n getLiabilityWeight(lendrRequirementType: LendrRequirementType): BigNumber {\n return getLiabilityWeight(this.config, lendrRequirementType);\n }\n\n computeTvl(oraclePrice: OraclePrice): BigNumber {\n return computeTvl(this, oraclePrice);\n }\n\n computeInterestRates(): {\n lendingRate: BigNumber;\n borrowingRate: BigNumber;\n } {\n return computeInterestRates(this);\n }\n\n computeBaseInterestRate(): BigNumber {\n return computeBaseInterestRate(this);\n }\n\n computeUtilizationRate(): BigNumber {\n return computeUtilizationRate(this);\n }\n\n computeRemainingCapacity(): {\n depositCapacity: BigNumber;\n borrowCapacity: BigNumber;\n } {\n return computeRemainingCapacity(this);\n }\n\n describe(oraclePrice: OraclePrice): string {\n return `\nBank address: ${this.address.toBase58()}\nMint: ${this.mint.toBase58()}, decimals: ${this.mintDecimals}\n\nTotal deposits: ${nativeToUi(this.getTotalAssetQuantity(), this.mintDecimals)}\nTotal borrows: ${nativeToUi(this.getTotalLiabilityQuantity(), this.mintDecimals)}\n\nTotal assets (USD value): ${this.computeAssetUsdValue(\n oraclePrice,\n this.totalAssetShares,\n LendrRequirementType.Equity,\n PriceBias.None,\n )}\nTotal liabilities (USD value): ${this.computeLiabilityUsdValue(\n oraclePrice,\n this.totalLiabilityShares,\n LendrRequirementType.Equity,\n PriceBias.None,\n )}\n\nAsset price (USD): ${Bank.getPrice(oraclePrice, PriceBias.None, false)}\nAsset price Weighted (USD): ${Bank.getPrice(oraclePrice, PriceBias.None, true)}\n\nConfig:\n- Asset weight init: ${this.config.assetWeightInit.toFixed(2)}\n- Asset weight maint: ${this.config.assetWeightMaint.toFixed(2)}\n- Liability weight init: ${this.config.liabilityWeightInit.toFixed(2)}\n- Liability weight maint: ${this.config.liabilityWeightMaint.toFixed(2)}\n\n- Deposit limit: ${this.config.depositLimit}\n- Borrow limit: ${this.config.borrowLimit}\n\nLTVs:\n- Initial: ${new BigNumber(1).div(this.config.liabilityWeightInit).times(100).toFixed(2)}%\n- Maintenance: ${new BigNumber(1).div(this.config.liabilityWeightMaint).times(100).toFixed(2)}%\n`;\n }\n}\n\nclass BankConfig implements BankConfigType {\n constructor(\n public assetWeightInit: BigNumber,\n public assetWeightMaint: BigNumber,\n public readonly liabilityWeightInit: BigNumber,\n public readonly liabilityWeightMaint: BigNumber,\n public readonly depositLimit: BigNumber,\n public readonly borrowLimit: BigNumber,\n public readonly riskTier: RiskTier,\n public readonly totalAssetValueInitLimit: BigNumber,\n public readonly assetTag: AssetTag,\n public readonly oracleSetup: OracleSetup,\n public readonly oracleKeys: PublicKey[],\n public readonly oracleMaxAge: number,\n public readonly interestRateConfig: InterestRateConfig,\n public readonly operationalState: OperationalState,\n ) {}\n\n static fromAccountParsed(bankConfigRaw: BankConfigRaw): BankConfig {\n const bankConfig = parseBankConfigRaw(bankConfigRaw);\n return new BankConfig(\n bankConfig.assetWeightInit,\n bankConfig.assetWeightMaint,\n bankConfig.liabilityWeightInit,\n bankConfig.liabilityWeightMaint,\n bankConfig.depositLimit,\n bankConfig.borrowLimit,\n bankConfig.riskTier,\n bankConfig.totalAssetValueInitLimit,\n bankConfig.assetTag,\n bankConfig.oracleSetup,\n bankConfig.oracleKeys,\n bankConfig.oracleMaxAge,\n bankConfig.interestRateConfig,\n bankConfig.operationalState,\n );\n }\n}\n\nexport { Bank, BankConfig };\n","import {BorshInstructionCoder} from \"@coral-xyz/anchor\";\nimport {ComputeBudgetProgram, PublicKey, type TransactionInstruction} from \"@solana/web3.js\";\nimport BigNumber from \"bignumber.js\";\nimport BN from \"bn.js\";\nimport {NoopLogger} from \"@/logger\";\nimport instructions from \"~/instructions\";\nimport type {LendrProgram, TLogger} from \"~/types\";\nimport {makeUnwrapSolIx, makeWrapSolIxs} from \"~/utils\";\nimport {type Amount, type BankMetadataMap, type InstructionsWrapper, type Program, uiToNative,} from \"../../common\";\nimport {\n\tcreateAssociatedTokenAccountIdempotentInstruction,\n\tgetAssociatedTokenAddressSync,\n\tNATIVE_MINT,\n\tTOKEN_2022_PROGRAM_ID,\n} from \"@solana/spl-token\"\nimport {type OraclePrice, PriceBias} from \"../../services/price/types\";\nimport {Balance} from \"../balance\";\nimport {Bank} from \"../bank\";\nimport type {HealthCache} from \"../health-cache\";\nimport {\n\tAccountFlags,\n\ttype ActionEmodeImpact,\n\ttype BankType,\n\tcomputeAccountValue,\n\tcomputeActiveEmodePairs,\n\tcomputeEmodeImpacts,\n\tcomputeFreeCollateral,\n\tcomputeFreeCollateralLegacy,\n\tcomputeHealthAccountMetas,\n\tcomputeHealthCheckAccounts,\n\tcomputeHealthComponents,\n\tcomputeHealthComponentsLegacy,\n\tcomputeHealthComponentsWithoutBiasLegacy,\n\tcomputeNetApy,\n\tdecodeAccountRaw,\n\ttype EmodeImpactStatus,\n\ttype EmodePair,\n\ttype EmodeTag,\n\tgetPrice,\n\ttype LendrAccountRaw,\n\ttype LendrAccountType,\n\tmakePulseHealthIx,\n\tparseLendrAccountRaw,\n\tRiskTier,\n\tsimulateAccountHealthCacheWithFallback\n} from \"@/services\";\nimport type LendrClient from \"@/clients/client\";\nimport type { BankMap, MintData, OraclePriceMap } from \"@/clients/client\";\nimport type {LendrIdlType} from \"@/idl\";\nimport type {EstablishedSessionState} from \"@/common/session\";\n\n// ----------------------------------------------------------------------------\n// Client types\n// ----------------------------------------------------------------------------\n\nclass LendrAccount implements LendrAccountType {\n constructor(\n public readonly address: PublicKey,\n public readonly group: PublicKey,\n public readonly authority: PublicKey,\n public readonly balances: Balance[],\n public readonly accountFlags: AccountFlags[],\n public readonly emissionsDestinationAccount: PublicKey,\n public healthCache: HealthCache,\n ) {}\n\n static async fetch(address: PublicKey, client: LendrClient): Promise<LendrAccount> {\n const data: LendrAccountRaw = await client.program.account.lendrAccount.fetch(address);\n return LendrAccount.fromAccountParsed(address, data);\n }\n\n /**\n * @deprecated use decodeAccountRaw instead\n */\n static decode(encoded: Buffer, idl: LendrIdlType): LendrAccountRaw {\n return decodeAccountRaw(encoded, idl);\n }\n\n static decodeAccountRaw(encoded: Buffer, idl: LendrIdlType): LendrAccountRaw {\n return decodeAccountRaw(encoded, idl);\n }\n\n static fromAccountType(account: LendrAccountType) {\n return new LendrAccount(\n account.address,\n account.group,\n account.authority,\n account.balances.map((b) => Balance.fromBalanceType(b)),\n account.accountFlags,\n account.emissionsDestinationAccount,\n account.healthCache,\n );\n }\n\n static fromAccountParsed(lendrAccountPk: PublicKey, accountData: LendrAccountRaw) {\n const props = parseLendrAccountRaw(lendrAccountPk, accountData);\n return new LendrAccount(\n props.address,\n props.group,\n props.authority,\n props.balances,\n props.accountFlags,\n props.emissionsDestinationAccount,\n props.healthCache,\n );\n }\n\n async simulateHealthCache(\n program: Program<LendrIdlType>,\n bankMap: Map<string, Bank>,\n oraclePrices: Map<string, OraclePrice>,\n bankMetadataMap: BankMetadataMap,\n ) {\n const accountWithHealthCache = await simulateAccountHealthCacheWithFallback({\n program,\n bankMap,\n oraclePrices,\n lendrAccount: this,\n balances: this.balances,\n bankMetadataMap: bankMetadataMap,\n });\n\n return accountWithHealthCache;\n }\n\n static fromAccountDataRaw(lendrAccountPk: PublicKey, rawData: Buffer, idl: LendrIdlType) {\n const lendrAccountData = LendrAccount.decodeAccountRaw(rawData, idl);\n return LendrAccount.fromAccountParsed(lendrAccountPk, lendrAccountData);\n }\n // ----------------------------------------------------------------------------\n // Attributes\n // ----------------------------------------------------------------------------\n\n get activeBalances(): Balance[] {\n return this.balances.filter((b) => b.active);\n }\n\n getBalance(bankPk: PublicKey): Balance {\n return this.activeBalances.find((b) => b.bankPk.equals(bankPk)) ?? Balance.createEmpty(bankPk);\n }\n\n get isDisabled(): boolean {\n return this.accountFlags.includes(AccountFlags.ACCOUNT_DISABLED);\n }\n\n get isFlashLoanEnabled(): boolean {\n return this.accountFlags.includes(AccountFlags.ACCOUNT_IN_FLASHLOAN);\n }\n\n get isTransferAccountAuthorityEnabled(): boolean {\n return this.accountFlags.includes(AccountFlags.ACCOUNT_TRANSFER_AUTHORITY_ALLOWED);\n }\n\n setHealthCache(value: HealthCache) {\n this.healthCache = value;\n }\n\n computeFreeCollateral(opts?: { clamped?: boolean }): BigNumber {\n return computeFreeCollateral(this, opts);\n }\n\n computeFreeCollateralLegacy(\n banks: Map<string, BankType>,\n oraclePrices: Map<string, OraclePrice>,\n opts?: { clamped?: boolean },\n ): BigNumber {\n return computeFreeCollateralLegacy(this.activeBalances, banks, oraclePrices, opts);\n }\n\n computeHealthComponents(lendrReqType: LendrRequirementType): {\n assets: BigNumber;\n liabilities: BigNumber;\n } {\n return computeHealthComponents(this, lendrReqType);\n }\n\n /**\n * @deprecated use computeHealthComponents instead\n */\n computeHealthComponentsLegacy(\n banks: Map<string, Bank>,\n oraclePrices: Map<string, OraclePrice>,\n lendrReqType: LendrRequirementType,\n excludedBanks: PublicKey[] = [],\n ): {\n assets: BigNumber;\n liabilities: BigNumber;\n } {\n return computeHealthComponentsLegacy(this.activeBalances, banks, oraclePrices, lendrReqType, excludedBanks);\n }\n\n /**\n * @deprecated use computeHealthComponents instead\n */\n computeHealthComponentsWithoutBiasLegacy(\n banks: Map<string, Bank>,\n oraclePrices: Map<string, OraclePrice>,\n lendrReqType: LendrRequirementType,\n ): {\n assets: BigNumber;\n liabilities: BigNumber;\n } {\n return computeHealthComponentsWithoutBiasLegacy(this.activeBalances, banks, oraclePrices, lendrReqType);\n }\n\n computeAccountValue(): BigNumber {\n return computeAccountValue(this);\n }\n\n computeNetApy(banks: Map<string, Bank>, oraclePrices: Map<string, OraclePrice>): number {\n return computeNetApy(this, this.activeBalances, banks, oraclePrices);\n }\n\n /**\n * Calculate the maximum amount of asset that can be withdrawn from a bank given existing deposits of the asset\n * and the untied collateral of the lendr account.\n *\n * fc = free collateral\n * ucb = untied collateral for bank\n *\n * q = (min(fc, ucb) / (price_lowest_bias * deposit_weight)) + (fc - min(fc, ucb)) / (price_highest_bias * liab_weight)\n *\n *\n *\n * NOTE FOR LIQUIDATORS\n * This function doesn't take into account the collateral received when liquidating an account.\n */\n computeMaxBorrowForBank(\n banks: Map<string, Bank>,\n oraclePrices: Map<string, OraclePrice>,\n bankAddress: PublicKey,\n opts?: {\n emodeImpactStatus?: EmodeImpactStatus;\n volatilityFactor?: number;\n emodeWeights?: {\n assetWeightMaint: BigNumber;\n assetWeightInit: BigNumber;\n collateralTag: EmodeTag;\n };\n },\n logger: TLogger = new NoopLogger(),\n ): BigNumber {\n const bank = banks.get(bankAddress.toBase58());\n\n if (!bank) throw Error(`Bank ${bankAddress.toBase58()} not found`);\n\n if (opts?.emodeWeights) {\n const emodeWeights = opts.emodeWeights; // Create a local reference to avoid null checks\n const collateralTag = emodeWeights.collateralTag;\n const modifiedBanks = new Map(banks);\n\n // Go through each bank and update the ones with matching tag\n banks.forEach((existingBank, bankKey) => {\n // Only apply to banks with matching tag\n if (existingBank.emode?.emodeTag === collateralTag) {\n modifiedBanks.set(\n bankKey,\n Bank.withEmodeWeights(existingBank, {\n assetWeightMaint: emodeWeights.assetWeightMaint,\n assetWeightInit: emodeWeights.assetWeightInit,\n }),\n );\n }\n });\n\n // Use the modified banks map for computation\n banks = modifiedBanks;\n }\n\n const priceInfo = oraclePrices.get(bankAddress.toBase58());\n if (!priceInfo) throw Error(`Price info for ${bankAddress.toBase58()} not found`);\n\n // -------------------------- //\n // isolated asset constraints //\n // -------------------------- //\n\n const hasLiabilitiesAlready =\n this.activeBalances.filter((b) => b.liabilityShares.gt(0) || !b.bankPk.equals(bankAddress)).length > 0;\n\n const attemptingToBorrowIsolatedAssetWithActiveDebt =\n bank.config.riskTier === RiskTier.Isolated && hasLiabilitiesAlready;\n logger.debug({ attemptingToBorrowIsolatedAssetWithActiveDebt }, \"[lendr:computeMaxBorrowForBank]\");\n\n const existingLiabilityBanks = this.activeBalances\n .filter((b) => b.liabilityShares.gt(0))\n .map((b) => banks.get(b.bankPk.toBase58())!);\n\n const attemptingToBorrowNewAssetWithExistingIsolatedDebt = existingLiabilityBanks.some(\n (b) => b.config.riskTier === RiskTier.Isolated && !b.address.equals(bankAddress),\n );\n logger.debug({ attemptingToBorrowNewAssetWithExistingIsolatedDebt }, \"[lendr:computeMaxBorrowForBank]\");\n\n if (attemptingToBorrowIsolatedAssetWithActiveDebt || attemptingToBorrowNewAssetWithExistingIsolatedDebt) {\n // User can only withdraw\n return this.computeMaxWithdrawForBank(banks, oraclePrices, bankAddress, opts);\n }\n\n // ------------- //\n // FC-based calc //\n // ------------- //\n\n const _volatilityFactor = opts?.volatilityFactor ?? 1;\n\n const balance = this.getBalance(bankAddress);\n\n const useCache = false;\n // opts?.emodeImpactStatus === EmodeImpactStatus.InactiveEmode ||\n // opts?.emodeImpactStatus === EmodeImpactStatus.ExtendEmode;\n\n const freeCollateral = useCache\n ? this.computeFreeCollateral().times(_volatilityFactor)\n : this.computeFreeCollateralLegacy(banks, oraclePrices);\n\n // Apply switchboard variance adjustment to free collateral only when using legacy computation\n // This reduces borrowing power by the amount of switchboard variance risk\n // if (!useCache) {\n // \tfreeCollateral = freeCollateral.minus(switchboardVarianceAdjustment);\n // }\n logger.debug({ freeCollateral: freeCollateral.toFixed(6) }, \"[lendr:computeMaxBorrowForBank] Free collateral\");\n // logger.debug(\n // \t{\n // \t\tswitchboardVarianceAdjustment: switchboardVarianceAdjustment.toFixed(6),\n // \t},\n // \t\"[lendr:computeMaxBorrowForBank] Switchboard variance adjustment\",\n // );\n\n const untiedCollateralForBank = BigNumber.min(\n bank.computeAssetUsdValue(priceInfo, balance.assetShares, LendrRequirementType.Initial, PriceBias.Lowest),\n freeCollateral,\n );\n\n const priceLowestBias = getPrice(priceInfo, PriceBias.Lowest, true);\n const priceHighestBias = getPrice(priceInfo, PriceBias.Highest, true);\n const assetWeight = bank.getAssetWeight(LendrRequirementType.Initial, priceInfo);\n const liabWeight = bank.getLiabilityWeight(LendrRequirementType.Initial);\n\n if (assetWeight.eq(0)) {\n return balance\n .computeQuantityUi(bank)\n .assets.plus(freeCollateral.minus(untiedCollateralForBank).div(priceHighestBias.times(liabWeight)));\n }\n\n return untiedCollateralForBank\n .div(priceLowestBias.times(assetWeight))\n .plus(freeCollateral.minus(untiedCollateralForBank).div(priceHighestBias.times(liabWeight)));\n }\n\n /**\n * Calculate the maximum amount that can be withdrawn form a bank without borrowing.\n */\n computeMaxWithdrawForBank(\n banks: Map<string, Bank>,\n oraclePrices: Map<string, OraclePrice>,\n bankAddress: PublicKey,\n opts?: { volatilityFactor?: number },\n ): BigNumber {\n const bank = banks.get(bankAddress.toBase58());\n if (!bank) throw Error(`Bank ${bankAddress.toBase58()} not found`);\n const priceInfo = oraclePrices.get(bankAddress.toBase58());\n if (!priceInfo) throw Error(`Price info for ${bankAddress.toBase58()} not found`);\n\n const _volatilityFactor = opts?.volatilityFactor ?? 1;\n\n const initAssetWeight = bank.getAssetWeight(LendrRequirementType.Initial, priceInfo);\n const maintAssetWeight = bank.getAssetWeight(LendrRequirementType.Maintenance, priceInfo);\n const balance = this.getBalance(bankAddress);\n\n const freeCollateral = this.computeFreeCollateral();\n const initCollateralForBank = bank.computeAssetUsdValue(\n priceInfo,\n balance.assetShares,\n LendrRequirementType.Initial,\n PriceBias.Lowest,\n );\n\n const entireBalance = balance.computeQuantityUi(bank).assets;\n\n const { liabilities: liabilitiesInit } = this.computeHealthComponents(LendrRequirementType.Initial);\n\n // -------------------------------------------------- //\n // isolated bank (=> init weight = maint weight = 0) //\n // or collateral bank with 0-weights (does not happen //\n // in practice) //\n // -------------------------------------------------- //\n\n if (bank.config.riskTier === RiskTier.Isolated || (initAssetWeight.isZero() && maintAssetWeight.isZero())) {\n if (freeCollateral.isZero() && !liabilitiesInit.isZero()) {\n // if account is already below init requirements and has active debt, prevent any withdrawal even if those don't count as collateral\n // inefficient, but reflective of contract which does not look at action delta, but only end state atm\n return new BigNumber(0);\n } else {\n return entireBalance;\n }\n }\n\n // ----------------------------- //\n // collateral bank being retired //\n // ----------------------------- //\n\n if (initAssetWeight.isZero() && !maintAssetWeight.isZero()) {\n if (liabilitiesInit.eq(0)) {\n return entireBalance;\n } else if (freeCollateral.isZero()) {\n return new BigNumber(0); // inefficient, but reflective of contract which does not look at action delta, but only end state\n } else {\n const { liabilities: maintLiabilities, assets: maintAssets } = this.computeHealthComponents(\n LendrRequirementType.Maintenance,\n );\n const maintUntiedCollateral = maintAssets.minus(maintLiabilities);\n\n const priceLowestBias = getPrice(priceInfo, PriceBias.Lowest, true);\n const maintWeightedPrice = priceLowestBias.times(maintAssetWeight);\n\n return maintUntiedCollateral.div(maintWeightedPrice);\n }\n }\n\n // ------------------------------------- //\n // collateral bank with positive weights //\n // ------------------------------------- //\n // bypass volatility factor if no liabilities or if all collateral is untied\n if (liabilitiesInit.isZero() || initCollateralForBank.lte(freeCollateral)) {\n return entireBalance;\n }\n\n // apply volatility factor to avoid failure due to price volatility / slippage\n const initUntiedCollateralForBank = freeCollateral.times(_volatilityFactor);\n\n const priceLowestBias = getPrice(priceInfo, PriceBias.Lowest, true);\n const initWeightedPrice = priceLowestBias.times(initAssetWeight);\n const maxWithdraw = initUntiedCollateralForBank.div(initWeightedPrice);\n\n return maxWithdraw;\n }\n\n /**\n * Calculate the price at which the user position for the given bank will lead to liquidation, all other prices constant.\n */\n public computeLiquidationPriceForBank(\n banks: Map<string, Bank>,\n oraclePrices: Map<string, OraclePrice>,\n bankAddress: PublicKey,\n ): number | null {\n const bank = banks.get(bankAddress.toBase58());\n if (!bank) throw Error(`Bank ${bankAddress.toBase58()} not found`);\n const priceInfo = oraclePrices.get(bankAddress.toBase58());\n if (!priceInfo) throw Error(`Price info for ${bankAddress.toBase58()} not found`);\n\n const balance = this.getBalance(bankAddress);\n\n if (!balance.active) return null;\n\n const { assets: assetBank, liabilities: liabilitiesBank } = balance.computeUsdValue(\n bank,\n priceInfo,\n LendrRequirementType.Maintenance,\n );\n\n const { assets: assetsAccount, liabilities: liabilitiesAccount } = this.computeHealthComponents(\n LendrRequirementType.Maintenance,\n );\n\n const assets = assetsAccount.minus(assetBank);\n const liabilities = liabilitiesAccount.minus(liabilitiesBank);\n\n const isLending = balance.liabilityShares.isZero();\n const { assets: assetQuantityUi, liabilities: liabQuantitiesUi } = balance.computeQuantityUi(bank);\n\n let liquidationPrice: BigNumber;\n if (isLending) {\n if (liabilities.eq(0)) return null;\n\n const assetWeight = bank.getAssetWeight(LendrRequirementType.Maintenance, priceInfo);\n const priceConfidence = getPrice(priceInfo, PriceBias.None, false).minus(\n getPrice(priceInfo, PriceBias.Lowest, false),\n );\n liquidationPrice = liabilities.minus(assets).div(assetQuantityUi.times(assetWeight)).plus(priceConfidence);\n } else {\n const liabWeight = bank.getLiabilityWeight(LendrRequirementType.Maintenance);\n const priceConfidence = getPrice(priceInfo, PriceBias.Highest, false).minus(\n getPrice(priceInfo, PriceBias.None, false),\n );\n liquidationPrice = assets.minus(liabilities).div(liabQuantitiesUi.times(liabWeight)).minus(priceConfidence);\n }\n if (liquidationPrice.isNaN() || liquidationPrice.lt(0) || !liquidationPrice.isFinite()) return null;\n return liquidationPrice.toNumber();\n }\n\n /**\n * Calculate the price at which the user position for the given bank will lead to liquidation, all other prices constant.\n */\n public computeLiquidationPriceForBankHealth(\n banks: Map<string, Bank>,\n oraclePrices: Map<string, OraclePrice>,\n bankAddress: PublicKey,\n opts?: {\n assetWeightMaint: BigNumber;\n },\n ): number | null {\n const bank = banks.get(bankAddress.toBase58());\n if (!bank) throw Error(`Bank ${bankAddress.toBase58()} not found`);\n const priceInfo = oraclePrices.get(bankAddress.toBase58());\n if (!priceInfo) throw Error(`Price info for ${bankAddress.toBase58()} not found`);\n\n const balance = this.getBalance(bankAddress);\n\n if (!balance.active) return null;\n\n const isLending = balance.liabilityShares.isZero();\n\n const assetValueMaint = this.healthCache.assetValueMaint;\n const liabValueMaint = this.healthCache.liabilityValueMaint;\n\n const { assets: assetQuantityUi, liabilities: liabQuantitiesUi } = balance.computeQuantityUi(bank);\n\n let liquidationPrice: BigNumber;\n if (isLending) {\n if (liabValueMaint.eq(0)) return null;\n\n const assetWeight = bank.getAssetWeight(\n LendrRequirementType.Maintenance,\n priceInfo,\n undefined,\n opts?.assetWeightMaint,\n );\n const priceConfidence = getPrice(priceInfo, PriceBias.None, false).minus(\n getPrice(priceInfo, PriceBias.Lowest, false),\n );\n liquidationPrice = liabValueMaint\n .minus(assetValueMaint)\n .div(assetQuantityUi.times(assetWeight))\n .plus(priceConfidence);\n } else {\n const liabWeight = bank.getLiabilityWeight(LendrRequirementType.Maintenance);\n const priceConfidence = getPrice(priceInfo, PriceBias.Highest, false).minus(\n getPrice(priceInfo, PriceBias.None, false),\n );\n liquidationPrice = assetValueMaint\n .minus(liabValueMaint)\n .div(liabQuantitiesUi.times(liabWeight))\n .minus(priceConfidence);\n }\n if (liquidationPrice.isNaN() || liquidationPrice.lt(0) || !liquidationPrice.isFinite()) return null;\n return liquidationPrice.toNumber();\n }\n\n /**\n * Calculate the price at which the user position for the given bank and amount will lead to liquidation, all other prices constant.\n */\n public computeLiquidationPriceForBankAmount(\n banks: Map<string, Bank>,\n oraclePrices: Map<string, OraclePrice>,\n bankAddress: PublicKey,\n isLending: boolean,\n amount: number,\n ): number | null {\n const bank = banks.get(bankAddress.toBase58());\n if (!bank) throw Error(`Bank ${bankAddress.toBase58()} not found`);\n const priceInfo = oraclePrices.get(bankAddress.toBase58());\n if (!priceInfo) throw Error(`Price info for ${bankAddress.toBase58()} not found`);\n\n const balance = this.getBalance(bankAddress);\n\n if (!balance.active) return null;\n\n const { assets: assetBank, liabilities: liabilitiesBank } = balance.computeUsdValue(\n bank,\n priceInfo,\n LendrRequirementType.Maintenance,\n );\n\n const { assets: assetsAccount, liabilities: liabilitiesAccount } = this.computeHealthComponents(\n LendrRequirementType.Maintenance,\n );\n\n const assets = assetsAccount.minus(assetBank);\n const liabilities = liabilitiesAccount.minus(liabilitiesBank);\n\n const amountBn = new BigNumber(amount);\n\n let liquidationPrice: BigNumber;\n if (isLending) {\n if (liabilities.eq(0)) return null;\n\n const assetWeight = bank.getAssetWeight(LendrRequirementType.Maintenance, priceInfo);\n const priceConfidence = getPrice(priceInfo, PriceBias.None, false).minus(\n getPrice(priceInfo, PriceBias.Lowest, false),\n );\n liquidationPrice = liabilities.minus(assets).div(amountBn.times(assetWeight)).plus(priceConfidence);\n } else {\n const liabWeight = bank.getLiabilityWeight(LendrRequirementType.Maintenance);\n const priceConfidence = getPrice(priceInfo, PriceBias.Highest, false).minus(\n getPrice(priceInfo, PriceBias.None, false),\n );\n liquidationPrice = assets.minus(liabilities).div(amountBn.times(liabWeight)).minus(priceConfidence);\n }\n if (liquidationPrice.isNaN() || liquidationPrice.lt(0)) return null;\n return liquidationPrice.toNumber();\n }\n\n // Calculate the max amount of collateral to liquidate to bring an account maint health to 0 (assuming negative health).\n //\n // The asset amount is bounded by 2 constraints,\n // (1) the amount of liquidated collateral cannot be more than the balance,\n // (2) the amount of covered liablity cannot be more than existing liablity.\n computeMaxLiquidatableAssetAmount(\n banks: Map<string, Bank>,\n oraclePrices: Map<string, OraclePrice>,\n assetBankAddress: PublicKey,\n liabilityBankAddress: PublicKey,\n logger: TLogger = new NoopLogger(),\n ): BigNumber {\n const assetBank = banks.get(assetBankAddress.toBase58());\n if (!assetBank) throw Error(`Bank ${assetBankAddress.toBase58()} not found`);\n const assetPriceInfo = oraclePrices.get(assetBankAddress.toBase58());\n if (!assetPriceInfo) throw Error(`Price info for ${assetBankAddress.toBase58()} not found`);\n\n const liabilityBank = banks.get(liabilityBankAddress.toBase58());\n if (!liabilityBank) throw Error(`Bank ${liabilityBankAddress.toBase58()} not found`);\n const liabilityPriceInfo = oraclePrices.get(liabilityBankAddress.toBase58());\n if (!liabilityPriceInfo) throw Error(`Price info for ${liabilityBankAddress.toBase58()} not found`);\n\n const { assets, liabilities } = this.computeHealthComponents(LendrRequirementType.Maintenance);\n const currentHealth = assets.minus(liabilities);\n\n const priceAssetLower = getPrice(assetPriceInfo, PriceBias.Lowest, false);\n const priceAssetMarket = getPrice(assetPriceInfo, PriceBias.None, false);\n const assetMaintWeight = assetBank.config.assetWeightMaint;\n\n const liquidationDiscount = new BigNumber(0.95);\n\n const priceLiabHighest = getPrice(liabilityPriceInfo, PriceBias.Highest, false);\n const priceLiabMarket = getPrice(liabilityPriceInfo, PriceBias.None, false);\n const liabMaintWeight = liabilityBank.config.liabilityWeightMaint;\n\n logger.debug(\n {\n currentHealth: currentHealth.toFixed(6),\n assetMaintWeight,\n liabMaintWeight,\n liquidationDiscount,\n },\n \"[lendr:getMaxLiquidatableAssetAmount]\",\n );\n\n const underwaterMaintUsdValue = currentHealth.div(\n assetMaintWeight.minus(liabMaintWeight.times(liquidationDiscount)),\n );\n\n logger.debug(\n { underwaterMaintUsdValue: underwaterMaintUsdValue.toFixed(6) },\n \"[lendr:getMaxLiquidatableAssetAmount] Underwater maint usd to adjust\",\n );\n\n // MAX asset amount bounded by available asset amount\n const assetBalance = this.getBalance(assetBankAddress);\n const assetsAmountUi = assetBalance.computeQuantityUi(assetBank).assets;\n const assetsUsdValue = assetsAmountUi.times(priceAssetLower);\n\n // MAX asset amount bounded by available liability amount\n const liabilityBalance = this.getBalance(liabilityBankAddress);\n const liabilitiesAmountUi = liabilityBalance.computeQuantityUi(liabilityBank).liabilities;\n const liabUsdValue = liabilitiesAmountUi.times(liquidationDiscount).times(priceLiabHighest);\n logger.debug(\n {\n assetsAmountUi: assetsAmountUi.toFixed(6),\n priceAssetMarket: priceAssetMarket.toFixed(6),\n assetsUsdValue: assetsUsdValue.times(priceAssetMarket).toFixed(6),\n liabilitiesAmountUi: liabilitiesAmountUi.toFixed(6),\n priceLiabMarket: priceLiabMarket.toFixed(6),\n liabUsdValue: liabUsdValue.toFixed(6),\n },\n \"[lendr:getMaxLiquidatableAssetAmount]\",\n );\n\n const maxLiquidatableUsdValue = BigNumber.min(assetsUsdValue, underwaterMaintUsdValue, liabUsdValue);\n logger.debug(\n {\n maxLiquidatableUsdValue: maxLiquidatableUsdValue.toFixed(6),\n },\n \"[lendr:getMaxLiquidatableAssetAmount] Max liquidatable usd value\",\n );\n\n return maxLiquidatableUsdValue.div(priceAssetLower);\n }\n\n getHealthCheckAccounts(\n banks: Map<string, Bank>,\n mandatoryBanks: PublicKey[] = [],\n excludedBanks: PublicKey[] = [],\n ): BankType[] {\n return computeHealthCheckAccounts(this.balances, banks, mandatoryBanks, excludedBanks);\n }\n\n /**\n * Determines which E-mode pairs are currently active for this account based on its balances\n *\n * @param emodePairs - All available E-mode pairs to check against the account's balances\n * @returns Array of active E-mode pairs for this account, or empty array if no E-mode is active\n */\n computeActiveEmodePairs(emodePairs: EmodePair[]): EmodePair[] {\n const activeLiabilities = this.activeBalances\n .filter((balance) => balance.liabilityShares.gt(0))\n .map((balance) => balance.bankPk);\n const activeCollateral = this.activeBalances\n .filter((balance) => balance.assetShares.gt(0))\n .map((balance) => balance.bankPk);\n return computeActiveEmodePairs(emodePairs, activeLiabilities, activeCollateral);\n }\n\n /**\n * Calculates the impact of different actions on E-mode status for each bank\n *\n * For each bank, this method simulates the following actions and their effect on E-mode:\n * - Borrowing from the bank (for banks not currently borrowed from)\n * - Supplying to the bank (for supported collateral banks not currently supplied)\n * - Repaying all borrowing from the bank (for banks with active liabilities)\n * - Withdrawing all supply from the bank (for banks with active collateral)\n *\n * @param emodePairs - All available E-mode pairs to check against\n * @param banks - Array of bank PublicKeys to calculate impacts for\n * @returns Object mapping bank PublicKey strings to impact analysis for each possible action\n */\n computeEmodeImpacts(emodePairs: EmodePair[], banks: PublicKey[]): Record<string, ActionEmodeImpact> {\n const activeLiabilities = this.activeBalances\n .filter((balance) => balance.liabilityShares.gt(0))\n .map((balance) => balance.bankPk);\n const activeCollateral = this.activeBalances\n .filter((balance) => balance.assetShares.gt(0))\n .map((balance) => balance.bankPk);\n\n return computeEmodeImpacts(emodePairs, activeLiabilities, activeCollateral, banks);\n }\n\n // ----------------------------------------------------------------------------\n // Actions\n // ----------------------------------------------------------------------------\n\n async prepareDepositIx(\n banks: Map<string, Bank>,\n mintDatas: Map<string, MintData>,\n amount: Amount,\n bankAddress: PublicKey,\n opts: MakeDepositIxOpts = {},\n ) {\n const bank = banks.get(bankAddress.toBase58());\n if (!bank) throw Error(`Bank ${bankAddress.toBase58()} not found`);\n const mintData = mintDatas.get(bankAddress.toBase58());\n if (!mintData) throw Error(`Mint for bank ${bankAddress.toBase58()} not found`);\n\n const wrapAndUnwrapSol = opts.wrapAndUnwrapSol ?? true;\n const wSolBalanceUi = opts.wSolBalanceUi ?? 0;\n\n const userTokenAtaPk = getAssociatedTokenAddressSync(bank.mint, this.authority, true, mintData.tokenProgram); // We allow off curve addresses here to support Fuse.\n\n const remainingAccounts = mintData.tokenProgram.equals(TOKEN_2022_PROGRAM_ID)\n ? [{ pubkey: mintData.mint, isSigner: false, isWritable: false }]\n : [];\n\n const depositIxs: Array<TransactionInstruction> = [];\n\n if (bank.mint.equals(NATIVE_MINT) && wrapAndUnwrapSol) {\n depositIxs.push(...makeWrapSolIxs(this.authority, new BigNumber(amount).minus(wSolBalanceUi)));\n }\n\n return {\n depositIxs,\n userTokenAtaPk,\n mintData,\n ixArguments: { amount: uiToNative(amount, bank.mintDecimals) },\n remainingAccounts,\n }\n }\n\n async makeDepositIx(\n program: LendrProgram,\n banks: Map<string, Bank>,\n mintDatas: Map<string, MintData>,\n amount: Amount,\n bankAddress: PublicKey,\n opts: MakeDepositIxOpts = {},\n ): Promise<InstructionsWrapper> {\n const { depositIxs, ixArguments, userTokenAtaPk, mintData, remainingAccounts } =\n await this.prepareDepositIx(banks, mintDatas, amount, bankAddress, opts);\n\n const depositIx = await instructions.makeDepositIx(\n program,\n {\n lendrAccount: this.address,\n signerTokenAccount: userTokenAtaPk,\n bank: bankAddress,\n tokenProgram: mintData.tokenProgram,\n authority: opts.overrideInferAccounts?.authority ?? this.authority,\n group: opts.overrideInferAccounts?.group ?? this.group,\n liquidityVault: opts.overrideInferAccounts?.liquidityVault,\n },\n ixArguments,\n remainingAccounts,\n );\n depositIxs.push(depositIx);\n\n return {\n instructions: depositIxs,\n keys: [],\n };\n }\n\n async makeDepositWithSessionIx(\n program: LendrProgram,\n banks: Map<string, Bank>,\n mintDatas: Map<string, MintData>,\n amount: Amount,\n bankAddress: PublicKey,\n sessionKey: PublicKey,\n opts: MakeDepositWithSessionIxOpts = {},\n ): Promise<InstructionsWrapper> {\n const { depositIxs, ixArguments, userTokenAtaPk, mintData, remainingAccounts } =\n await this.prepareDepositIx(banks, mintDatas, amount, bankAddress, opts);\n\n const accounts = {\n sessionKey,\n lendrAccount: this.address,\n bank: bankAddress,\n signerTokenAccount: userTokenAtaPk,\n tokenProgram: mintData.tokenProgram,\n group: opts.overrideInferAccounts?.group ?? this.group,\n liquidityVault: opts.overrideInferAccounts?.liquidityVault,\n };\n\n const depositIx = await instructions.makeDepositWithSessionIx(\n program,\n accounts,\n ixArguments,\n remainingAccounts,\n );\n depositIxs.push(depositIx);\n\n return {\n instructions: depositIxs,\n keys: [],\n };\n }\n\n async prepareRepayInstruction(\n program: LendrProgram,\n banks: Map<string, Bank>,\n mintDatas: Map<string, MintData>,\n amount: Amount,\n bankAddress: PublicKey,\n repayAll = false,\n opts: MakeRepayIxOpts = {},\n ) {\n const bank = banks.get(bankAddress.toBase58());\n if (!bank) throw Error(`Bank ${bankAddress.toBase58()} not found`);\n const mintData = mintDatas.get(bankAddress.toBase58());\n if (!mintData) throw Error(`Mint data for bank ${bankAddress.toBase58()} not found`);\n\n const wrapAndUnwrapSol = opts.wrapAndUnwrapSol ?? true;\n const wSolBalanceUi = opts.wSolBalanceUi ?? 0;\n\n const repayIxs: Array<TransactionInstruction> = [];\n\n // Add emissions-related instructions if necessary\n if (repayAll && !bank.emissionsMint.equals(PublicKey.default)) {\n repayIxs.push(...(await this.makeWithdrawEmissionsIx(program, banks, mintDatas, bankAddress)).instructions);\n }\n\n // Add repay-related instructions\n const userAta = getAssociatedTokenAddressSync(bank.mint, this.authority, true, mintData.tokenProgram); // We allow off curve addresses here to support Fuse.\n\n const remainingAccounts: PublicKey[] = [];\n\n if (mintData.tokenProgram.equals(TOKEN_2022_PROGRAM_ID)) {\n remainingAccounts.push(mintData.mint);\n }\n\n if (bank.mint.equals(NATIVE_MINT) && wrapAndUnwrapSol) {\n repayIxs.push(...makeWrapSolIxs(this.authority, new BigNumber(amount).minus(wSolBalanceUi)));\n }\n return {\n repayIxs,\n mintData,\n userAta,\n ixArguments: { amount: uiToNative(amount, bank.mintDecimals), repayAll },\n remainingAccounts,\n };\n }\n\n async makeRepayIx(\n program: LendrProgram,\n banks: Map<string, Bank>,\n mintDatas: Map<string, MintData>,\n amount: Amount,\n bankAddress: PublicKey,\n repayAll = false,\n opts: MakeRepayIxOpts = {},\n ): Promise<InstructionsWrapper> {\n const { repayIxs, ixArguments, userAta, mintData, remainingAccounts } =\n await this.prepareRepayInstruction(program, banks, mintDatas, amount, bankAddress, repayAll, opts);\n\n const repayIx = await instructions.makeRepayIx(\n program,\n {\n lendrAccount: this.address,\n signerTokenAccount: userAta,\n bank: bankAddress,\n tokenProgram: mintData.tokenProgram,\n authority: opts.overrideInferAccounts?.authority,\n group: opts.overrideInferAccounts?.group,\n liquidityVault: opts.overrideInferAccounts?.liquidityVault,\n },\n ixArguments,\n remainingAccounts.map((account) => ({\n pubkey: account,\n isSigner: false,\n isWritable: false,\n })),\n );\n repayIxs.push(repayIx);\n\n return {\n instructions: repayIxs,\n keys: [],\n };\n }\n\n async makeRepayWithSessionIx(\n program: LendrProgram,\n banks: Map<string, Bank>,\n mintDatas: Map<string, MintData>,\n amount: Amount,\n bankAddress: PublicKey,\n sessionKey: PublicKey,\n repayAll = false,\n opts: MakeRepayWithSessionIxOpts = {},\n ): Promise<InstructionsWrapper> {\n const { repayIxs, ixArguments, userAta, mintData, remainingAccounts } =\n await this.prepareRepayInstruction(program, banks, mintDatas, amount, bankAddress, repayAll, opts);\n\n const repayIx = await instructions.makeRepayWithSessionIx(\n program,\n {\n sessionKey,\n lendrAccount: this.address,\n signerTokenAccount: userAta,\n bank: bankAddress,\n tokenProgram: mintData.tokenProgram,\n group: opts.overrideInferAccounts?.group,\n liquidityVault: opts.overrideInferAccounts?.liquidityVault,\n },\n ixArguments,\n remainingAccounts.map((account) => ({\n pubkey: account,\n isSigner: false,\n isWritable: false,\n })),\n );\n repayIxs.push(repayIx);\n\n return {\n instructions: repayIxs,\n keys: [],\n };\n }\n\n async prepareWithdrawInstruction(\n program: LendrProgram,\n bankMap: Map<string, Bank>,\n mintDatas: Map<string, MintData>,\n bankAddress: PublicKey,\n withdrawAll = false,\n withdrawOpts: MakeWithdrawIxOpts & { createAtaPayer?: PublicKey }= {},\n ) {\n const bank = bankMap.get(bankAddress.toBase58());\n if (!bank) throw Error(`Bank ${bankAddress.toBase58()} not found`);\n const mintData = mintDatas.get(bankAddress.toBase58());\n if (!mintData) throw Error(`Mint data for bank ${bankAddress.toBase58()} not found`);\n\n const wrapAndUnwrapSol = withdrawOpts.wrapAndUnwrapSol ?? true;\n const createAtas = withdrawOpts.createAtas ?? true;\n\n const withdrawIxs: Array<TransactionInstruction> = [];\n\n // Add emissions-related instructions if necessary\n if (withdrawAll && !bank.emissionsMint.equals(PublicKey.default) && mintData.emissionTokenProgram) {\n withdrawIxs.push(...(await this.makeWithdrawEmissionsIx(program, bankMap, mintDatas, bankAddress)).instructions);\n }\n\n const userAta = getAssociatedTokenAddressSync(bank.mint, this.authority, true, mintData.tokenProgram); // We allow off curve addresses here to support Fuse.\n\n if (createAtas) {\n const createAtaIdempotentIx = createAssociatedTokenAccountIdempotentInstruction(\n withdrawOpts?.createAtaPayer ?? this.authority,\n userAta,\n this.authority,\n bank.mint,\n mintData.tokenProgram,\n );\n withdrawIxs.push(createAtaIdempotentIx);\n }\n\n const healthAccounts = withdrawAll\n ? this.getHealthCheckAccounts(bankMap, [], [bankAddress])\n : this.getHealthCheckAccounts(bankMap, [bankAddress], []);\n\n // Add withdraw-related instructions\n const remainingAccounts: PublicKey[] = [];\n if (mintData.tokenProgram.equals(TOKEN_2022_PROGRAM_ID)) {\n remainingAccounts.push(mintData.mint);\n }\n\n if (withdrawOpts.observationBanksOverride) {\n remainingAccounts.push(...withdrawOpts.observationBanksOverride);\n } else {\n // const accountMetas = computeHealthAccountMetas(healthAccounts, bankMetadataMap);\n const accountMetas = computeHealthAccountMetas(healthAccounts);\n remainingAccounts.push(...accountMetas);\n }\n\n return {\n withdrawIxs,\n wrapAndUnwrapSol,\n mintData,\n userAta,\n bank,\n remainingAccounts: remainingAccounts.map((account) => ({\n pubkey: account,\n isSigner: false,\n isWritable: false,\n })),\n }\n }\n\n async makeWithdrawIx(\n program: LendrProgram,\n bankMap: Map<string, Bank>,\n mintDatas: Map<string, MintData>,\n // bankMetadataMap: BankMetadataMap,\n amount: Amount,\n bankAddress: PublicKey,\n withdrawAll = false,\n withdrawOpts: MakeWithdrawIxOpts = {},\n ): Promise<InstructionsWrapper> {\n const { withdrawIxs, wrapAndUnwrapSol, userAta, mintData, bank, remainingAccounts } =\n await this.prepareWithdrawInstruction(program, bankMap, mintDatas, bankAddress, withdrawAll, withdrawOpts);\n\n const withdrawIx = await instructions.makeWithdrawIx(\n program,\n {\n lendrAccount: this.address,\n bank: bank.address,\n destinationTokenAccount: userAta,\n tokenProgram: mintData.tokenProgram,\n authority: withdrawOpts.overrideInferAccounts?.authority,\n group: withdrawOpts.overrideInferAccounts?.group,\n },\n { amount: uiToNative(amount, bank.mintDecimals), withdrawAll },\n remainingAccounts,\n );\n withdrawIxs.push(withdrawIx);\n\n if (wrapAndUnwrapSol && bank.mint.equals(NATIVE_MINT)) {\n withdrawIxs.push(makeUnwrapSolIx(this.authority));\n }\n\n return {\n instructions: withdrawIxs,\n keys: [],\n };\n }\n\n async makeWithdrawWithSessionIx(\n program: LendrProgram,\n bankMap: Map<string, Bank>,\n mintDatas: Map<string, MintData>,\n amount: Amount,\n bankAddress: PublicKey,\n session: EstablishedSessionState,\n withdrawAll = false,\n withdrawOpts: MakeWithdrawWithSessionIxOpts = {},\n ): Promise<InstructionsWrapper> {\n const { withdrawIxs, wrapAndUnwrapSol, userAta, mintData, bank, remainingAccounts } =\n await this.prepareWithdrawInstruction(\n program, bankMap, mintDatas, bankAddress, withdrawAll, { ...withdrawOpts, createAtaPayer: session.payer }\n );\n\n const withdrawIx = await instructions.makeWithdrawWithSessionIx(\n program,\n {\n sessionKey: session.sessionPublicKey,\n lendrAccount: this.address,\n bank: bank.address,\n destinationTokenAccount: userAta,\n tokenProgram: mintData.tokenProgram,\n group: withdrawOpts.overrideInferAccounts?.group,\n },\n { amount: uiToNative(amount, bank.mintDecimals), withdrawAll },\n remainingAccounts,\n );\n withdrawIxs.push(withdrawIx);\n\n if (wrapAndUnwrapSol && bank.mint.equals(NATIVE_MINT)) {\n // TODO: After we implement close_with_session instruction,\n // we need to write a unrapSolWithSessionIx method too, since it calls close instruction in the end.\n withdrawIxs.push(makeUnwrapSolIx(this.authority));\n }\n\n return {\n instructions: withdrawIxs,\n keys: [],\n };\n }\n\n async prepareBorrowInstrcution(\n bankMap: Map<string, Bank>,\n mintDatas: Map<string, MintData>,\n bankMetadataMap: BankMetadataMap,\n bankAddress: PublicKey,\n borrowOpts: MakeBorrowIxOpts & { createAtaPayer?: PublicKey } = {},\n ) {\n const bank = bankMap.get(bankAddress.toBase58());\n if (!bank) throw Error(`Bank ${bankAddress.toBase58()} not found`);\n const mintData = mintDatas.get(bankAddress.toBase58());\n if (!mintData) throw Error(`Mint data for bank ${bankAddress.toBase58()} not found`);\n\n const wrapAndUnwrapSol = borrowOpts.wrapAndUnwrapSol ?? true;\n const createAtas = borrowOpts.createAtas ?? true;\n\n const borrowIxs: TransactionInstruction[] = [];\n\n const userAta = getAssociatedTokenAddressSync(bank.mint, this.authority, true, mintData.tokenProgram); // We allow off curve addresses here to support Fuse.\n\n if (createAtas) {\n const createAtaIdempotentIx = createAssociatedTokenAccountIdempotentInstruction(\n borrowOpts?.createAtaPayer ?? this.authority,\n userAta,\n this.authority,\n bank.mint,\n mintData.tokenProgram,\n );\n borrowIxs.push(createAtaIdempotentIx);\n }\n\n const healthAccounts = this.getHealthCheckAccounts(bankMap, [bankAddress], []);\n\n const remainingAccounts: PublicKey[] = [];\n\n if (mintData.tokenProgram.equals(TOKEN_2022_PROGRAM_ID)) {\n remainingAccounts.push(mintData.mint);\n }\n if (borrowOpts?.observationBanksOverride) {\n remainingAccounts.push(...borrowOpts.observationBanksOverride);\n } else {\n const accountMetas = computeHealthAccountMetas(healthAccounts, bankMetadataMap);\n remainingAccounts.push(...accountMetas);\n }\n\n return {\n borrowIxs,\n bank,\n mintData,\n userAta,\n wrapAndUnwrapSol,\n remainingAccounts: remainingAccounts.map((account) => ({\n pubkey: account,\n isSigner: false,\n isWritable: false,\n }))\n }\n }\n\n async makeBorrowIx(\n program: LendrProgram,\n bankMap: Map<string, Bank>,\n mintDatas: Map<string, MintData>,\n bankMetadataMap: BankMetadataMap,\n amount: Amount,\n bankAddress: PublicKey,\n borrowOpts: MakeBorrowIxOpts = {},\n ): Promise<InstructionsWrapper> {\n const { borrowIxs, bank, mintData, userAta, remainingAccounts, wrapAndUnwrapSol } =\n await this.prepareBorrowInstrcution(bankMap, mintDatas, bankMetadataMap, bankAddress, borrowOpts);\n\n const borrowIx = await instructions.makeBorrowIx(\n program,\n {\n lendrAccount: this.address,\n bank: bank.address,\n destinationTokenAccount: userAta,\n tokenProgram: mintData.tokenProgram,\n authority: borrowOpts?.overrideInferAccounts?.authority,\n group: borrowOpts?.overrideInferAccounts?.group,\n },\n { amount: uiToNative(amount, bank.mintDecimals) },\n remainingAccounts,\n );\n borrowIxs.push(borrowIx);\n\n if (bank.mint.equals(NATIVE_MINT) && wrapAndUnwrapSol) {\n borrowIxs.push(makeUnwrapSolIx(this.authority));\n }\n\n return {\n instructions: borrowIxs,\n keys: [],\n };\n }\n\n async makeBorrowWithSessionIx(\n program: LendrProgram,\n bankMap: Map<string, Bank>,\n mintDatas: Map<string, MintData>,\n bankMetadataMap: BankMetadataMap,\n amount: Amount,\n bankAddress: PublicKey,\n session: EstablishedSessionState,\n borrowOpts: MakeBorrowWithSessionIxOpts = {},\n ): Promise<InstructionsWrapper> {\n const { borrowIxs, bank, mintData, userAta, remainingAccounts, wrapAndUnwrapSol } =\n await this.prepareBorrowInstrcution(\n bankMap, mintDatas, bankMetadataMap, bankAddress, { ...borrowOpts, createAtaPayer: session.payer }\n );\n\n const borrowIx = await instructions.makeBorrowWithSessionIx(\n program,\n {\n sessionKey: session.sessionPublicKey,\n lendrAccount: this.address,\n bank: bank.address,\n destinationTokenAccount: userAta,\n tokenProgram: mintData.tokenProgram,\n group: borrowOpts?.overrideInferAccounts?.group,\n },\n { amount: uiToNative(amount, bank.mintDecimals) },\n remainingAccounts,\n );\n borrowIxs.push(borrowIx);\n\n if (bank.mint.equals(NATIVE_MINT) && wrapAndUnwrapSol) {\n // TODO: After we implement close_with_session instruction, this needs updating...\n borrowIxs.push(makeUnwrapSolIx(this.authority));\n }\n\n return {\n instructions: borrowIxs,\n keys: [],\n };\n }\n\n async makeWithdrawEmissionsIx(\n program: LendrProgram,\n banks: Map<string, Bank>,\n mintDatas: Map<string, MintData>,\n bankAddress: PublicKey,\n ): Promise<InstructionsWrapper> {\n const bank = banks.get(bankAddress.toBase58());\n if (!bank) throw Error(`Bank ${bankAddress.toBase58()} not found`);\n const mintData = mintDatas.get(bankAddress.toBase58());\n if (!mintData) throw Error(`Mint data for bank ${bankAddress.toBase58()} not found`);\n if (!mintData.emissionTokenProgram) {\n throw Error(`Emission token program not found for bank ${bankAddress.toBase58()}`);\n }\n\n const ixs: Array<TransactionInstruction> = [];\n\n const userAta = getAssociatedTokenAddressSync(\n bank.emissionsMint,\n this.authority,\n true,\n mintData.emissionTokenProgram,\n ); // We allow off curve addresses here to support Fuse.\n const createAtaIdempotentIx = createAssociatedTokenAccountIdempotentInstruction(\n this.authority,\n userAta,\n this.authority,\n bank.emissionsMint,\n mintData.emissionTokenProgram,\n );\n ixs.push(createAtaIdempotentIx);\n\n const withdrawEmissionsIx = await instructions.makelendingAccountWithdrawEmissionIx(program, {\n lendrAccount: this.address,\n destinationAccount: userAta,\n bank: bank.address,\n tokenProgram: mintData.emissionTokenProgram,\n });\n ixs.push(withdrawEmissionsIx);\n\n return { instructions: ixs, keys: [] };\n }\n\n async makeLendingAccountLiquidateIx(\n liquidateeLendrAccount: LendrAccount,\n program: LendrProgram,\n bankMap: Map<string, Bank>,\n mintDatas: Map<string, MintData>,\n bankMetadataMap: BankMetadataMap,\n assetBankAddress: PublicKey,\n assetQuantityUi: Amount,\n liabilityBankAddress: PublicKey,\n ): Promise<InstructionsWrapper> {\n const assetBank = bankMap.get(assetBankAddress.toBase58());\n if (!assetBank) throw Error(`Asset bank ${assetBankAddress.toBase58()} not found`);\n const liabilityBank = bankMap.get(liabilityBankAddress.toBase58());\n if (!liabilityBank) throw Error(`Liability bank ${liabilityBankAddress.toBase58()} not found`);\n const liabilityMintData = mintDatas.get(liabilityBankAddress.toBase58());\n if (!liabilityMintData) throw Error(`Mint data for bank ${liabilityBankAddress.toBase58()} not found`);\n\n const ixs: Array<TransactionInstruction> = [];\n\n const healthAccounts = [\n ...this.getHealthCheckAccounts(bankMap, [liabilityBankAddress, assetBankAddress], []),\n ...liquidateeLendrAccount.getHealthCheckAccounts(bankMap, [], []),\n ];\n\n const remainingAccounts: PublicKey[] = [];\n\n if (liabilityMintData.tokenProgram.equals(TOKEN_2022_PROGRAM_ID)) {\n remainingAccounts.push(liabilityMintData.mint);\n }\n\n const accountMetas = computeHealthAccountMetas(healthAccounts, bankMetadataMap);\n remainingAccounts.push(...accountMetas);\n\n ixs.push(ComputeBudgetProgram.setComputeUnitLimit({ units: 1_400_000 }));\n const liquidateIx = await instructions.makeLendingAccountLiquidateIx(\n program,\n {\n assetBank: assetBankAddress,\n liabBank: liabilityBankAddress,\n liquidatorLendrAccount: this.address,\n liquidateeLendrAccount: liquidateeLendrAccount.address,\n tokenProgram: liabilityMintData.tokenProgram,\n },\n { assetAmount: uiToNative(assetQuantityUi, assetBank.mintDecimals) },\n remainingAccounts.map((account) => ({\n pubkey: account,\n isSigner: false,\n isWritable: false,\n })),\n );\n ixs.push(liquidateIx);\n\n return { instructions: ixs, keys: [] };\n }\n\n async makeBeginFlashLoanIx(program: LendrProgram, endIndex: number): Promise<InstructionsWrapper> {\n const ix = await instructions.makeBeginFlashLoanIx(\n program,\n {\n lendrAccount: this.address,\n },\n { endIndex: new BN(endIndex) },\n );\n return { instructions: [ix], keys: [] };\n }\n\n async makeEndFlashLoanIx(\n program: LendrProgram,\n bankMap: Map<string, Bank>,\n projectedActiveBalances: PublicKey[],\n ): Promise<InstructionsWrapper> {\n const banks = projectedActiveBalances.map((account) => {\n const b = bankMap.get(account.toBase58());\n if (!b) throw Error(`Bank ${account.toBase58()} not found`);\n return b;\n });\n const remainingAccounts = computeHealthAccountMetas(banks);\n const ix = await instructions.makeEndFlashLoanIx(\n program,\n {\n lendrAccount: this.address,\n },\n remainingAccounts.map((account) => ({\n pubkey: account,\n isSigner: false,\n isWritable: false,\n })),\n );\n\n return { instructions: [ix], keys: [] };\n }\n\n async makeAccountAuthorityTransferIx(\n program: LendrProgram,\n newAccountAuthority: PublicKey,\n ): Promise<InstructionsWrapper> {\n const accountAuthorityTransferIx = await instructions.makeAccountAuthorityTransferIx(program, {\n lendrAccount: this.address,\n newAuthority: newAccountAuthority,\n feePayer: this.authority,\n });\n return { instructions: [accountAuthorityTransferIx], keys: [] };\n }\n\n async makeCloseAccountIx(program: LendrProgram): Promise<InstructionsWrapper> {\n const ix = await instructions.makeCloseAccountIx(program, {\n lendrAccount: this.address,\n feePayer: this.authority,\n });\n return { instructions: [ix], keys: [] };\n }\n\n async makePulseHealthIx(\n program: LendrProgram,\n banks: Map<string, Bank>,\n mandatoryBanks: PublicKey[],\n excludedBanks: PublicKey[],\n bankMetadataMap: BankMetadataMap,\n ) {\n return makePulseHealthIx(\n program,\n this.address,\n banks,\n this.balances,\n mandatoryBanks,\n excludedBanks,\n bankMetadataMap,\n );\n }\n\n projectActiveBalancesNoCpi(program: LendrProgram, instructions: TransactionInstruction[]): PublicKey[] {\n const projectedBalances = [...this.balances.map((b) => ({ active: b.active, bankPk: b.bankPk }))];\n\n for (let index = 0; index < instructions.length; index++) {\n const ix = instructions[index];\n\n if (!ix.programId.equals(program.programId)) continue;\n\n const borshCoder = new BorshInstructionCoder(program.idl);\n const decoded = borshCoder.decode(ix.data, \"base58\");\n if (!decoded) continue;\n\n const ixArgs = decoded.data as any;\n\n if (decoded.name === \"lendingAccountBorrow\" || decoded.name === \"lendingAccountDeposit\") {\n const targetBank = new PublicKey(ix.keys[3].pubkey);\n const targetBalance = projectedBalances.find((b) => b.bankPk.equals(targetBank));\n if (!targetBalance) {\n const firstInactiveBalanceIndex = projectedBalances.findIndex((b) => !b.active);\n if (firstInactiveBalanceIndex === -1) {\n throw Error(\"No inactive balance found\");\n }\n\n projectedBalances[firstInactiveBalanceIndex].active = true;\n projectedBalances[firstInactiveBalanceIndex].bankPk = targetBank;\n }\n continue;\n }\n if (decoded.name === \"lendingAccountRepay\" || decoded.name === \"lendingAccountWithdraw\") {\n const targetBank = new PublicKey(ix.keys[3].pubkey);\n const targetBalance = projectedBalances.find((b) => b.bankPk.equals(targetBank));\n if (!targetBalance) {\n throw Error(\n `Balance for bank ${targetBank.toBase58()} should be projected active at this point (ix ${index}: ${\n decoded.name\n }))`,\n );\n }\n\n if (ixArgs.repayAll || ixArgs.withdrawAll) {\n targetBalance.active = false;\n targetBalance.bankPk = PublicKey.default;\n }\n }\n }\n\n return projectedBalances.filter((b) => b.active).map((b) => b.bankPk);\n }\n\n wrapInstructionForWSol(ix: TransactionInstruction, amount: Amount = new BigNumber(0)): TransactionInstruction[] {\n return [...makeWrapSolIxs(this.authority, new BigNumber(amount)), ix, makeUnwrapSolIx(this.authority)];\n }\n\n public describe(banks: BankMap, oraclePrices: OraclePriceMap): string {\n const { assets, liabilities } = this.computeHealthComponents(LendrRequirementType.Equity);\n const { assets: assetsMaint, liabilities: liabilitiesMaint } = this.computeHealthComponents(\n LendrRequirementType.Maintenance,\n );\n const { assets: assetsInit, liabilities: liabilitiesInit } = this.computeHealthComponents(\n LendrRequirementType.Initial,\n );\n let description = `\n- Lendr account: ${this.address}\n- Authority: ${this.authority}\n- Total deposits: $${assets.toFixed(6)}\n- Total liabilities: $${liabilities.toFixed(6)}\n- Equity: $${assets.minus(liabilities).toFixed(6)}\n- Health maint: ${assetsMaint.minus(liabilitiesMaint).div(assetsMaint).times(100).toFixed(2)}%\n- Health init: ${assetsInit.minus(liabilitiesInit).div(assetsInit).times(100).toFixed(2)}%\n- Balances:\\n`;\n\n for (const balance of this.activeBalances) {\n const bank = banks.get(balance.bankPk.toBase58())!;\n const priceInfo = oraclePrices.get(balance.bankPk.toBase58())!;\n description += balance.describe(bank, priceInfo);\n }\n return description;\n }\n}\n\nenum LendrRequirementType {\n Initial = 0,\n Maintenance = 1,\n Equity = 2,\n}\n\nexport interface MakeDepositIxOpts {\n wrapAndUnwrapSol?: boolean;\n wSolBalanceUi?: number;\n overrideInferAccounts?: {\n group?: PublicKey;\n authority?: PublicKey;\n liquidityVault?: PublicKey;\n };\n}\n\nexport interface MakeDepositWithSessionIxOpts extends MakeDepositIxOpts {\n overrideInferAccounts?: {\n group?: PublicKey;\n liquidityVault?: PublicKey;\n };\n}\n\nexport interface MakeRepayIxOpts {\n wrapAndUnwrapSol?: boolean;\n wSolBalanceUi?: number;\n overrideInferAccounts?: {\n group?: PublicKey;\n authority?: PublicKey;\n liquidityVault?: PublicKey;\n };\n}\n\nexport interface MakeRepayWithSessionIxOpts extends MakeRepayIxOpts {\n overrideInferAccounts?: {\n group?: PublicKey;\n liquidityVault?: PublicKey;\n };\n}\n\nexport interface MakeWithdrawIxOpts {\n observationBanksOverride?: PublicKey[];\n wrapAndUnwrapSol?: boolean;\n createAtas?: boolean;\n overrideInferAccounts?: {\n group?: PublicKey;\n authority?: PublicKey;\n };\n}\n\nexport interface MakeWithdrawWithSessionIxOpts extends MakeWithdrawIxOpts {\n overrideInferAccounts?: {\n group?: PublicKey;\n };\n}\nexport interface MakeBorrowIxOpts {\n observationBanksOverride?: PublicKey[];\n wrapAndUnwrapSol?: boolean;\n createAtas?: boolean;\n overrideInferAccounts?: {\n group?: PublicKey;\n authority?: PublicKey;\n };\n}\n\nexport interface MakeBorrowWithSessionIxOpts extends MakeBorrowIxOpts {\n overrideInferAccounts?: {\n group?: PublicKey;\n };\n}\n\nexport function isWeightedPrice(reqType: LendrRequirementType): boolean {\n return reqType === LendrRequirementType.Initial;\n}\n\nexport { LendrAccount, LendrRequirementType };\n","import {type Address, BorshCoder, translateAddress} from \"@coral-xyz/anchor\";\nimport {\n\tcreateApproveInstruction,\n\tcreateAssociatedTokenAccountIdempotentInstruction,\n\tcreateAssociatedTokenAccountInstruction,\n\tgetAssociatedTokenAddressSync,\n\tNATIVE_MINT,\n\tTOKEN_2022_PROGRAM_ID,\n\tTOKEN_PROGRAM_ID\n} from \"@solana/spl-token\";\nimport {\n\ttype AddressLookupTableAccount,\n\ttype Commitment,\n\tComputeBudgetProgram,\n\tKeypair,\n\tLAMPORTS_PER_SOL,\n\ttype ParsedAccountData,\n\tPublicKey,\n\ttype Signer,\n\tStakeAuthorizationLayout,\n\tStakeProgram,\n\tSystemProgram,\n\tTransaction,\n\ttype TransactionInstruction,\n\tTransactionMessage,\n\ttype TransactionSignature,\n\tVersionedTransaction,\n} from \"@solana/web3.js\";\nimport BigNumber from \"bignumber.js\";\nimport {\n\tDEFAULT_COMMITMENT,\n\tMAX_ACCOUNT_KEYS,\n\tMAX_TX_SIZE,\n\tPRIORITY_TX_SIZE,\n\tSTAKE_PROGRAM_ID,\n\tSYSVAR_CLOCK_ID,\n\tWSOL_MINT\n} from \"@/constants\"\nimport {\n\taddTransactionMetadata,\n\ttype Amount,\n\ttype ExtendedTransaction,\n\ttype ExtendedV0Transaction,\n\tgetAccountKeys,\n\tgetTxSize,\n\ttype InstructionsWrapper,\n\ttype TransactionBroadcastType,\n\ttype TransactionOptions,\n\tTransactionType,\n\ttype Wallet,\n} from \"../../common\";\nimport instructions from \"../../instructions\";\nimport {AccountType, type LendrConfig, type LendrProgram} from \"../../types\";\nimport {\n\tfindPoolAddress,\n\tfindPoolMintAddress,\n\tfindPoolMintAuthorityAddress,\n\tfindPoolStakeAddress,\n\tfindPoolStakeAuthorityAddress,\n\tSinglePoolInstruction,\n} from \"../../vendor\";\nimport type {Balance} from \"../balance\";\nimport {Bank} from \"../bank\";\nimport {\n\tLendrAccount,\n\tLendrRequirementType,\n\ttype MakeBorrowIxOpts, type MakeBorrowWithSessionIxOpts,\n\ttype MakeDepositIxOpts, type MakeDepositWithSessionIxOpts,\n\ttype MakeRepayIxOpts, type MakeRepayWithSessionIxOpts,\n\ttype MakeWithdrawIxOpts, type MakeWithdrawWithSessionIxOpts\n} from \"./pure\";\nimport LendrClient from \"@/clients/client\";\nimport {\n\ttype ActionEmodeImpact,\n\tcomputeLoopingParams,\n\ttype EmodePair,\n\tEmodeTag,\n\ttype LendrAccountRaw,\n\ttype ProcessTransactionsClientOpts\n} from \"@/services\";\nimport type {LendrIdlType} from \"@/idl\";\nimport type {LendrGroup} from \"@/models/group\";\nimport type {\n\tFlashloanActionResult,\n\tLoopProps,\n\tLoopTxProps,\n\tRepayWithCollateralProps,\n\tTransactionBuilderResult\n} from \"@/models/account/types\";\nimport {makePriorityFeeIx, makeWrapSolIxs} from \"@/utils\";\nimport type {EstablishedSessionState} from \"@/common/session\";\nimport type {TransactionResult} from \"@fogo/sessions-sdk\";\n\nexport interface SimulationResult {\n banks: Map<string, Bank>;\n lendrAccount: LendrAccountWrapper;\n}\n\nexport interface FlashLoanArgs {\n ixs: TransactionInstruction[];\n signers?: Signer[];\n addressLookupTableAccounts?: AddressLookupTableAccount[];\n blockhash?: string;\n}\n\nclass LendrAccountWrapper {\n public readonly address: PublicKey;\n\n private _lendrAccount: LendrAccount;\n\n // --------------------------------------------------------------------------\n // Factories\n // --------------------------------------------------------------------------\n\n /**\n * @internal\n */\n constructor(\n lendrAccountPk: PublicKey,\n readonly client: LendrClient,\n lendrAccount: LendrAccount,\n ) {\n this.address = lendrAccountPk;\n this._lendrAccount = lendrAccount;\n }\n\n static async fetch(\n lendrAccountPk: Address,\n client: LendrClient,\n commitment?: Commitment,\n ): Promise<LendrAccountWrapper> {\n const { config, program } = client;\n const _lendrAccountPk = translateAddress(lendrAccountPk);\n\n const accountData = await LendrAccountWrapper._fetchAccountData(_lendrAccountPk, config, program, commitment);\n const lendrAccount = LendrAccount.fromAccountParsed(_lendrAccountPk, accountData);\n\n const lendrAccountProxy = new LendrAccountWrapper(_lendrAccountPk, client, lendrAccount);\n\n client.logger.debug({ accountPk: _lendrAccountPk }, \"[lendr:lendr-account] Loaded lendr account\");\n\n return lendrAccountProxy;\n }\n\n static fromAccountParsed(lendrAccountPk: Address, client: LendrClient, accountData: LendrAccountRaw) {\n if (!accountData.group.equals(client.config.groupPk))\n throw Error(\n `Lendr account tied to group ${accountData.group.toBase58()}. Expected: ${client.config.groupPk.toBase58()}`,\n );\n\n const _lendrAccountPk = translateAddress(lendrAccountPk);\n const lendrAccount = LendrAccount.fromAccountParsed(_lendrAccountPk, accountData);\n return new LendrAccountWrapper(_lendrAccountPk, client, lendrAccount);\n }\n\n static fromAccountDataRaw(\n lendrAccountPk: PublicKey,\n client: LendrClient,\n lendrAccountRawData: Buffer,\n idl: LendrIdlType,\n ) {\n const lendrAccountData = LendrAccount.decode(lendrAccountRawData, idl);\n return LendrAccountWrapper.fromAccountParsed(lendrAccountPk, client, lendrAccountData);\n }\n\n // --------------------------------------------------------------------------\n // Attributes\n // --------------------------------------------------------------------------\n\n get authority(): PublicKey {\n return this._lendrAccount.authority;\n }\n\n get group(): LendrGroup {\n return this.client.group;\n }\n\n get balances(): Balance[] {\n return this._lendrAccount.balances;\n }\n\n get data(): LendrAccount {\n return this._lendrAccount;\n }\n\n get pureAccount(): LendrAccount {\n return this._lendrAccount;\n }\n\n /** @internal */\n private get _program() {\n return this.client.program;\n }\n\n /** @internal */\n private get _config() {\n return this.client.config;\n }\n\n get activeBalances(): Balance[] {\n return this._lendrAccount.balances.filter((la) => la.active);\n }\n\n get isDisabled(): boolean {\n return this._lendrAccount.isDisabled;\n }\n\n get isFlashLoanEnabled(): boolean {\n return this._lendrAccount.isFlashLoanEnabled;\n }\n\n get isTransferAccountAuthorityEnabled(): boolean {\n return this._lendrAccount.isTransferAccountAuthorityEnabled;\n }\n\n public getBalance(bankPk: PublicKey): Balance {\n return this._lendrAccount.getBalance(bankPk);\n }\n\n public async simulateHealthCache(): Promise<LendrAccountWrapper> {\n const { lendrAccount: account } = await this._lendrAccount.simulateHealthCache(\n this._program,\n this.client.banks,\n this.client.oraclePrices,\n this.client.bankMetadataMap ?? {},\n );\n return new LendrAccountWrapper(this.address, this.client, account);\n }\n\n public canBeLiquidated(): boolean {\n const { assets, liabilities } = this._lendrAccount.computeHealthComponents(LendrRequirementType.Maintenance);\n\n this.client.logger.debug(\n {\n address: this.address.toBase58(),\n assets,\n liabilities,\n },\n\t \"[lendr:lendr-account:canBeLiquidated]\",\n );\n\n return assets.lt(liabilities);\n }\n\n public computeHealthComponents(lendrRequirement: LendrRequirementType): {\n assets: BigNumber;\n liabilities: BigNumber;\n } {\n return this._lendrAccount.computeHealthComponents(lendrRequirement);\n }\n\n // TODO)) migrate to computeHealthComponents\n public computeHealthComponentsLegacy(\n lendrRequirement: LendrRequirementType,\n excludedBanks: PublicKey[] = [],\n ): {\n assets: BigNumber;\n liabilities: BigNumber;\n } {\n return this._lendrAccount.computeHealthComponentsLegacy(\n this.client.banks,\n this.client.oraclePrices,\n lendrRequirement,\n excludedBanks,\n );\n }\n\n public computeHealthComponentsWithoutBiasLegacy(lendrRequirement: LendrRequirementType): {\n assets: BigNumber;\n liabilities: BigNumber;\n } {\n return this._lendrAccount.computeHealthComponentsWithoutBiasLegacy(\n this.client.banks,\n this.client.oraclePrices,\n lendrRequirement,\n );\n }\n\n public computeFreeCollateral(opts?: { clamped?: boolean }): BigNumber {\n return this._lendrAccount.computeFreeCollateral(opts);\n }\n\n public computeFreeCollateralLegacy(opts?: { clamped?: boolean }): BigNumber {\n return this._lendrAccount.computeFreeCollateralLegacy(this.client.banks, this.client.oraclePrices, opts);\n }\n\n public computeAccountValue(): BigNumber {\n return this._lendrAccount.computeAccountValue();\n }\n\n public computeActiveEmodePairs(emodePairs: EmodePair[]): EmodePair[] {\n return this._lendrAccount.computeActiveEmodePairs(emodePairs);\n }\n\n public computeEmodeImpacts(emodePairs: EmodePair[]): Record<string, ActionEmodeImpact> {\n return this._lendrAccount.computeEmodeImpacts(\n emodePairs,\n Array.from(this.client.banks.keys()).map((b) => new PublicKey(b)),\n );\n }\n\n public computeMaxBorrowForBank(\n bankAddress: PublicKey,\n opts?: {\n volatilityFactor?: number;\n emodeWeights?: {\n assetWeightMaint: BigNumber;\n assetWeightInit: BigNumber;\n collateralTag: EmodeTag;\n };\n },\n ): BigNumber {\n return this._lendrAccount.computeMaxBorrowForBank(\n this.client.banks,\n this.client.oraclePrices,\n bankAddress,\n opts,\n this.client.logger,\n );\n }\n\n public computeMaxWithdrawForBank(bankAddress: PublicKey, opts?: { volatilityFactor?: number }): BigNumber {\n return this._lendrAccount.computeMaxWithdrawForBank(this.client.banks, this.client.oraclePrices, bankAddress, opts);\n }\n\n public computeMaxLiquidatableAssetAmount(assetBankAddress: PublicKey, liabilityBankAddress: PublicKey): BigNumber {\n return this._lendrAccount.computeMaxLiquidatableAssetAmount(\n this.client.banks,\n this.client.oraclePrices,\n assetBankAddress,\n liabilityBankAddress,\n this.client.logger,\n );\n }\n\n public computeLiquidationPriceForBank(bankAddress: PublicKey): number | null {\n return this._lendrAccount.computeLiquidationPriceForBank(this.client.banks, this.client.oraclePrices, bankAddress);\n }\n\n public computeLiquidationPriceForBankAmount(\n bankAddress: PublicKey,\n isLending: boolean,\n amount: number,\n ): number | null {\n return this._lendrAccount.computeLiquidationPriceForBankAmount(\n this.client.banks,\n this.client.oraclePrices,\n bankAddress,\n isLending,\n amount,\n );\n }\n\n public computeNetApy(): number {\n return this._lendrAccount.computeNetApy(this.client.banks, this.client.oraclePrices);\n }\n\n /** Todo move this into client */\n public computeLoopingParams(\n principal: Amount,\n targetLeverage: number,\n depositBankAddress: PublicKey,\n borrowBankAddress: PublicKey,\n ): { borrowAmount: BigNumber; totalDepositAmount: BigNumber } {\n const depositBank = this.client.banks.get(depositBankAddress.toBase58());\n if (!depositBank) throw Error(`Bank ${depositBankAddress.toBase58()} not found`);\n const depositPriceInfo = this.client.oraclePrices.get(depositBankAddress.toBase58());\n if (!depositPriceInfo) throw Error(`Price info for ${depositBankAddress.toBase58()} not found`);\n\n const borrowBank = this.client.banks.get(borrowBankAddress.toBase58());\n if (!borrowBank) throw Error(`Bank ${borrowBankAddress.toBase58()} not found`);\n const borrowPriceInfo = this.client.oraclePrices.get(borrowBankAddress.toBase58());\n if (!borrowPriceInfo) throw Error(`Price info for ${borrowBankAddress.toBase58()} not found`);\n\n return computeLoopingParams(principal, targetLeverage, depositBank, borrowBank, depositPriceInfo, borrowPriceInfo);\n }\n\n makeComputeBudgetIx(): TransactionInstruction[] {\n // Add additional CU request if necessary\n const cuRequestIxs: TransactionInstruction[] = [];\n const activeBalances = this.balances.filter((b) => b.active);\n if (activeBalances.length >= 4) {\n cuRequestIxs.push(ComputeBudgetProgram.setComputeUnitLimit({ units: 1_000_000 }));\n }\n\n return cuRequestIxs;\n }\n\n // --------------------------------------------------------------------------\n // User actions\n // --------------------------------------------------------------------------\n\n async makeSetupIx(banks: PublicKey[]) {\n this._lendrAccount.authority;\n\n if (this.client.bankMetadataMap === undefined) {\n return [];\n }\n\n try {\n const userAtas = banks.map((bankAddress) => {\n const bank = this.client.bankMetadataMap![bankAddress.toBase58()];\n const mintData = this.client.mintDatas.get(bankAddress.toBase58());\n if (!mintData) throw Error(`Token data for ${bank.tokenAddress} not found`);\n return getAssociatedTokenAddressSync(\n new PublicKey(bank.tokenAddress),\n this.authority,\n true,\n mintData.tokenProgram.equals(TOKEN_2022_PROGRAM_ID) ? TOKEN_2022_PROGRAM_ID : undefined,\n );\n });\n\n const ixs: Array<TransactionInstruction> = [];\n const userAtaAis = await this._program.provider.connection.getMultipleAccountsInfo(userAtas);\n\n for (const [i, userAta] of userAtaAis.entries()) {\n if (userAta === null) {\n const bankAddress = banks[i];\n const bank = this.client.bankMetadataMap![bankAddress.toBase58()];\n const mintData = this.client.mintDatas.get(bankAddress.toBase58());\n if (!mintData) throw Error(`Token data for ${bank.tokenAddress} not found`);\n ixs.push(\n createAssociatedTokenAccountIdempotentInstruction(\n this.authority,\n userAtas[i],\n this.authority,\n new PublicKey(bank.tokenAddress),\n mintData.tokenProgram.equals(TOKEN_2022_PROGRAM_ID) ? TOKEN_2022_PROGRAM_ID : undefined,\n ),\n );\n }\n }\n\n return ixs;\n } catch {\n return [];\n }\n }\n\n /**\n * Moves a position from one lendr account to another by withdrawing from source account and depositing to destination account.\n *\n * @param amount - The amount of tokens to move, can be a number or Amount object\n * @param bankAddress - The public key of the bank to move position from/to\n * @param destinationAccount - The lendr account to move the position to\n * @param processOpts - Optional transaction processing configuration\n * @param txOpts - Optional transaction options\n * @returns Array of transaction signatures - includes signatures for any required oracle feed updates, withdraw transaction, and deposit transaction\n */\n async movePosition(\n amount: Amount,\n bankAddress: PublicKey,\n destinationAccountPk: PublicKey,\n processOpts?: ProcessTransactionsClientOpts,\n txOpts?: TransactionOptions,\n ): Promise<TransactionSignature[]> {\n this.client.logger.debug({ from: this.address }, \"[lendr:lendr-account:move-position] Moving position\");\n\n const { transactions, actionTxIndex } = await this.makeMovePositionTx(amount, bankAddress, destinationAccountPk);\n\n const sigs = await this.client.processTransactions(transactions, processOpts, txOpts);\n\n this.client.logger.debug(\n { sigs: sigs[sigs.length - 1] },\n \"[lendr:lendr-account:move-position] Moving position successful\",\n );\n return sigs;\n }\n\n /**\n * Creates transactions for moving a position from one lendr account to another.\n *\n * @param amount - The amount of tokens to move, can be a number or Amount object\n * @param bankAddress - The public key of the bank to move position from/to\n * @param destinationAccount - The lendr account to move the position to\n * @returns Object containing feed crank transactions, withdraw transaction, and deposit transaction\n */\n async makeMovePositionTx(\n amount: Amount,\n bankAddress: PublicKey,\n destinationAccountPk: PublicKey,\n ): Promise<TransactionBuilderResult> {\n const cuRequestIxs = this.makeComputeBudgetIx();\n const { instructions: updateFeedIxs, luts: feedLuts } = await this.makeUpdateFeedIx([]);\n const withdrawIxs = await this.makeWithdrawIx(amount, bankAddress, true);\n\n const {\n value: { blockhash },\n } = await this._program.provider.connection.getLatestBlockhashAndContext(\"confirmed\");\n\n const feedCrankTxs: ExtendedV0Transaction[] = [];\n\n if (updateFeedIxs.length > 0) {\n feedCrankTxs.push(\n addTransactionMetadata(\n new VersionedTransaction(\n new TransactionMessage({\n instructions: [...updateFeedIxs],\n payerKey: this.authority,\n recentBlockhash: blockhash,\n }).compileToV0Message(feedLuts),\n ),\n {\n addressLookupTables: feedLuts,\n type: TransactionType.CRANK,\n },\n ),\n );\n }\n\n const lookupTables = await getClientAddressLookupTableAccounts(this.client);\n\n const withdrawTx = addTransactionMetadata(\n new VersionedTransaction(\n new TransactionMessage({\n instructions: [...cuRequestIxs, ...withdrawIxs.instructions],\n payerKey: this.authority,\n recentBlockhash: blockhash,\n }).compileToV0Message(lookupTables),\n ),\n {\n signers: withdrawIxs.keys,\n addressLookupTables: lookupTables,\n type: TransactionType.MOVE_POSITION_WITHDRAW,\n },\n );\n\n const destinationAccount = await LendrAccountWrapper.fetch(destinationAccountPk, this.client);\n\n const depositIx = await destinationAccount.makeDepositIx(amount, bankAddress);\n const tx = new Transaction().add(...depositIx.instructions);\n const depositTx = addTransactionMetadata(tx, {\n signers: depositIx.keys,\n addressLookupTables: lookupTables,\n type: TransactionType.MOVE_POSITION_DEPOSIT,\n });\n\n const transactions = [...feedCrankTxs, withdrawTx, depositTx];\n\n return { transactions, actionTxIndex: transactions.length - 1 };\n }\n\n /**\n * Repays a loan using collateral from another bank by:\n * 1. Withdrawing collateral from one bank\n * 2. Swapping it to the repayment asset\n * 3. Repaying the loan in another bank\n *\n * @param {RepayWithCollateralProps} props - Parameters for the repay with collateral transaction\n * @param {Amount} props.repayAmount - Amount to repay\n * @param {Amount} props.withdrawAmount - Amount of collateral to withdraw\n * @param {PublicKey} props.borrowBankAddress - Bank address where the loan is being repaid\n * @param {PublicKey} props.depositBankAddress - Bank address where collateral is being withdrawn from\n * @param {boolean} [props.withdrawAll=false] - Whether to withdraw all collateral from deposit bank\n * @param {boolean} [props.repayAll=false] - Whether to repay entire loan amount\n * @param {Object} props.swap - Swap configuration with instructions and lookup tables\n * @param {ProcessTransactionsClientOpts} [props.processOpts] - Optional transaction processing configuration\n * @param {TransactionOptions} [props.txOpts] - Optional transaction options\n * @returns {Promise<TransactionSignature[]>} Array of transaction signatures\n */\n async repayWithCollatV2(props: RepayWithCollateralProps): Promise<TransactionSignature[]> {\n this.client.logger.debug(\n {\n address: this.address.toBase58(),\n repayAmount: props.repayAmount,\n borrowBankAddress: props.borrowBankAddress,\n repayAll: props.repayAll,\n },\n \"[lendr:lendr-account:repayWithCollat] Repaying into lendr account\",\n );\n\n const { processOpts, txOpts, ...txProps } = props;\n const { transactions, actionTxIndex } = await this.makeRepayWithCollatTxV2({\n ...txProps,\n });\n\n const sigs = await this.client.processTransactions(transactions, processOpts, txOpts);\n this.client.logger.debug(\n { sig: sigs[sigs.length - 1] },\n \"[lendr:lendr-account:repayWithCollat] Repay with collateral successful\",\n );\n\n return sigs;\n }\n\n /**\n * Creates a transaction to repay a loan using collateral by:\n * 1. Withdrawing collateral from one bank\n * 2. Swapping it to the repayment asset\n * 3. Repaying the loan in another bank\n *\n * @param {RepayWithCollateralProps} params - Parameters for the repay with collateral transaction\n * @param {Amount} params.repayAmount - Amount to repay\n * @param {Amount} params.withdrawAmount - Amount of collateral to withdraw\n * @param {PublicKey} params.borrowBankAddress - Bank address where the loan is being repaid\n * @param {PublicKey} params.depositBankAddress - Bank address where collateral is being withdrawn from\n * @param {boolean} [params.withdrawAll=false] - Whether to withdraw all collateral from deposit bank\n * @param {boolean} [params.repayAll=false] - Whether to repay entire loan amount\n * @param {Object} params.swap - Swap configuration with instructions and lookup tables\n * @param {string} [params.blockhash] - Optional recent blockhash\n * @param {MakeWithdrawIxOpts} [params.withdrawOpts] - Optional withdraw configuration\n * @param {MakeRepayIxOpts} [params.repayOpts] - Optional repay configuration\n * @returns {Promise<RepayWithCollateralResult>} Result containing feed crank and flashloan transactions\n */\n async makeRepayWithCollatTxV2({\n repayAmount,\n withdrawAmount,\n borrowBankAddress,\n depositBankAddress,\n withdrawAll = false,\n repayAll = false,\n swap,\n blockhash: blockhashArg,\n }: RepayWithCollateralProps): Promise<FlashloanActionResult> {\n const blockhash =\n blockhashArg ?? (await this._program.provider.connection.getLatestBlockhash(\"confirmed\")).blockhash;\n\n // creates atas if needed\n const setupIxs = await this.makeSetupIx([borrowBankAddress, depositBankAddress]);\n const cuRequestIxs =\n this.makeComputeBudgetIx().length > 0\n ? this.makeComputeBudgetIx()\n : [ComputeBudgetProgram.setComputeUnitLimit({ units: 1_000_000 })];\n // tiny priority fee just in case bundle fails\n const [priorityFeeIx] = makePriorityFeeIx(0.00001);\n const withdrawIxs = await this.makeWithdrawIx(withdrawAmount, depositBankAddress, withdrawAll, {\n createAtas: false,\n wrapAndUnwrapSol: false,\n });\n const repayIxs = await this.makeRepayIx(repayAmount, borrowBankAddress, repayAll, {\n wrapAndUnwrapSol: false,\n });\n const { instructions: updateFeedIxs, luts: feedLuts } = await this.makeUpdateFeedIx([\n depositBankAddress,\n borrowBankAddress,\n ]);\n const { lookupTables: swapLookupTables, instructions: swapIxs } = swap;\n\n const additionalTxs: ExtendedV0Transaction[] = [];\n let flashloanTx: ExtendedV0Transaction;\n let txOverflown = false;\n\n // if atas are needed, add them\n if (setupIxs.length > 0) {\n const message = new TransactionMessage({\n payerKey: this.client.wallet.publicKey,\n recentBlockhash: blockhash,\n instructions: setupIxs,\n }).compileToLegacyMessage();\n\n additionalTxs.push(\n addTransactionMetadata(new VersionedTransaction(message), {\n type: TransactionType.CREATE_ATA,\n }),\n );\n }\n\n // if crank is needed, add it\n if (updateFeedIxs.length > 0) {\n const message = new TransactionMessage({\n payerKey: this.client.wallet.publicKey,\n recentBlockhash: blockhash,\n instructions: updateFeedIxs,\n }).compileToV0Message(feedLuts);\n\n additionalTxs.push(\n addTransactionMetadata(new VersionedTransaction(message), {\n addressLookupTables: feedLuts,\n type: TransactionType.CRANK,\n }),\n );\n }\n\n const clientLookupTables = await getClientAddressLookupTableAccounts(this.client);\n\n const addressLookupTableAccounts = [...clientLookupTables, ...swapLookupTables];\n\n // if cuRequestIxs are not present, priority fee ix is needed\n // wallets add a priority fee ix by default breaking the flashloan tx so we need to add a placeholder priority fee ix\n // docs: https://docs.phantom.app/developer-powertools/solana-priority-fees\n flashloanTx = await this.buildFlashLoanTx({\n ixs: [...cuRequestIxs, priorityFeeIx, ...withdrawIxs.instructions, ...swapIxs, ...repayIxs.instructions],\n addressLookupTableAccounts,\n blockhash,\n });\n\n const txSize = getTxSize(flashloanTx);\n const accountKeys = getAccountKeys(flashloanTx, addressLookupTableAccounts);\n const txToManyKeys = accountKeys > MAX_ACCOUNT_KEYS;\n const txToBig = txSize > MAX_TX_SIZE;\n const canBeDownsized = txToManyKeys && txToBig && txSize - PRIORITY_TX_SIZE <= MAX_TX_SIZE;\n\n if (canBeDownsized) {\n // wallets won't add a priority fee if tx space is limited\n // this will decrease landing rate for non-rpc calls\n flashloanTx = await this.buildFlashLoanTx({\n ixs: [...cuRequestIxs, ...withdrawIxs.instructions, ...swapIxs, ...repayIxs.instructions],\n addressLookupTableAccounts,\n blockhash,\n });\n\n const txSize = getTxSize(flashloanTx);\n const txToBig = txSize > MAX_TX_SIZE;\n\n // this shouldn't trigger, but just in case\n if (txToBig) {\n txOverflown = true;\n }\n } else if (txToBig || txToManyKeys) {\n txOverflown = true;\n }\n\n flashloanTx = addTransactionMetadata(flashloanTx, {\n type: TransactionType.REPAY_COLLAT,\n addressLookupTables: flashloanTx.addressLookupTables,\n });\n\n const transactions = [...additionalTxs, flashloanTx];\n\n // TODO throw tx overflown error and cath\n return {\n transactions,\n actionTxIndex: transactions.length - 1,\n txOverflown,\n };\n }\n\n async loopV2(props: LoopProps): Promise<TransactionSignature[]> {\n this.client.logger.debug(\n {\n address: this.address.toBase58(),\n depositAmount: props.borrowAmount,\n depositBankAddress: props.depositBankAddress.toBase58(),\n borrowAmount: props.borrowAmount,\n borrowBankAddress: props.borrowBankAddress.toBase58(),\n },\n \"[lendr:lendr-account:loop] Looping into Lendr account\",\n );\n\n const depositBank = this.client.banks.get(props.depositBankAddress.toBase58());\n if (!depositBank) throw Error(\"Deposit bank not found\");\n const borrowBank = this.client.banks.get(props.borrowBankAddress.toBase58());\n if (!borrowBank) throw Error(\"Borrow bank not found\");\n\n const { processOpts, txOpts, ...txProps } = props;\n\n const { transactions, actionTxIndex } = await this.makeLoopTxV2(txProps);\n\n const sigs = await this.client.processTransactions(transactions, processOpts, txOpts);\n this.client.logger.debug(\n {\n address: this.address.toBase58(),\n sig: sigs[sigs.length - 1],\n },\n \"[lendr:lendr-account:loop] Looping successful\",\n );\n\n return sigs;\n }\n\n async makeLoopTxV2({\n depositAmount,\n inputDepositAmount,\n borrowAmount,\n depositBankAddress,\n borrowBankAddress,\n swap,\n blockhash: blockhashArg,\n setupBankAddresses,\n overrideInferAccounts,\n }: LoopTxProps): Promise<FlashloanActionResult> {\n const depositBank = this.client.banks.get(depositBankAddress.toBase58());\n if (!depositBank) throw Error(\"Deposit bank not found\");\n const borrowBank = this.client.banks.get(borrowBankAddress.toBase58());\n if (!borrowBank) throw Error(\"Borrow bank not found\");\n\n const blockhash =\n blockhashArg ?? (await this._program.provider.connection.getLatestBlockhash(\"confirmed\")).blockhash;\n\n // creates atas if needed\n const setupIxs = await this.makeSetupIx(setupBankAddresses ?? [borrowBankAddress, depositBankAddress]);\n const cuRequestIxs =\n this.makeComputeBudgetIx().length > 0\n ? this.makeComputeBudgetIx()\n : [ComputeBudgetProgram.setComputeUnitLimit({ units: 500_000 })];\n // tiny priority fee just in case bundle fails\n const [priorityFeeIx] = makePriorityFeeIx(0.00001);\n const borrowIxs = await this.makeBorrowIx(borrowAmount, borrowBankAddress, {\n createAtas: false,\n wrapAndUnwrapSol: false,\n overrideInferAccounts,\n });\n const depositIxs = await this.makeDepositIx(depositAmount, depositBankAddress, {\n wrapAndUnwrapSol: false,\n overrideInferAccounts,\n });\n\n // unwrap if deposit bank is native\n // const unwrapIx = depositBank.mint.equals(NATIVE_MINT) ? [makeUnwrapSolIx(this.authority)] : [];\n\n const { instructions: updateFeedIxs, luts: feedLuts } = await this.makeUpdateFeedIx([\n depositBankAddress,\n borrowBankAddress,\n ]);\n const { lookupTables: swapLookupTables, instructions: swapIxs } = swap;\n\n const additionalTxs: ExtendedV0Transaction[] = [];\n let flashloanTx: ExtendedV0Transaction;\n let txOverflown = false;\n\n // wrap sol if needed\n if (depositBank.mint.equals(NATIVE_MINT) && inputDepositAmount) {\n setupIxs.push(...makeWrapSolIxs(this.authority, new BigNumber(inputDepositAmount)));\n }\n\n // if atas are needed, add them\n if (setupIxs.length > 0) {\n const message = new TransactionMessage({\n payerKey: this.client.wallet.publicKey,\n recentBlockhash: blockhash,\n instructions: setupIxs,\n }).compileToLegacyMessage();\n\n additionalTxs.push(\n addTransactionMetadata(new VersionedTransaction(message), {\n type: TransactionType.CREATE_ATA,\n }),\n );\n }\n\n // if crank is needed, add it\n if (updateFeedIxs.length > 0) {\n const message = new TransactionMessage({\n payerKey: this.client.wallet.publicKey,\n recentBlockhash: blockhash,\n instructions: updateFeedIxs,\n }).compileToV0Message(feedLuts);\n\n additionalTxs.push(\n addTransactionMetadata(new VersionedTransaction(message), {\n addressLookupTables: feedLuts,\n type: TransactionType.CRANK,\n }),\n );\n }\n\n const clientLookupTables = await getClientAddressLookupTableAccounts(this.client);\n const addressLookupTableAccounts = [...clientLookupTables, ...swapLookupTables];\n\n // if cuRequestIxs are not present, priority fee ix is needed\n // wallets add a priority fee ix by default breaking the flashloan tx so we need to add a placeholder priority fee ix\n // docs: https://docs.phantom.app/developer-powertools/solana-priority-fees\n flashloanTx = await this.buildFlashLoanTx({\n ixs: [...cuRequestIxs, priorityFeeIx, ...borrowIxs.instructions, ...swapIxs, ...depositIxs.instructions],\n addressLookupTableAccounts,\n blockhash,\n });\n\n const txSize = getTxSize(flashloanTx);\n const accountKeys = getAccountKeys(flashloanTx, addressLookupTableAccounts);\n const txToManyKeys = accountKeys > MAX_ACCOUNT_KEYS;\n const txToBig = txSize > MAX_TX_SIZE;\n const canBeDownsized = txToManyKeys && txToBig && txSize - PRIORITY_TX_SIZE <= MAX_TX_SIZE;\n\n if (canBeDownsized) {\n // wallets won't add a priority fee if tx space is limited\n // this will decrease landing rate for non-rpc calls ...unwrapIx,\n flashloanTx = await this.buildFlashLoanTx({\n ixs: [...cuRequestIxs, ...borrowIxs.instructions, ...swapIxs, ...depositIxs.instructions],\n addressLookupTableAccounts,\n blockhash,\n });\n const txSize = getTxSize(flashloanTx);\n const txToBig = txSize > MAX_TX_SIZE;\n\n // this shouldn't trigger, but just in case\n if (txToBig) {\n txOverflown = true;\n }\n } else if (txToBig || txToManyKeys) {\n txOverflown = true;\n }\n\n flashloanTx = addTransactionMetadata(flashloanTx, {\n type: TransactionType.LOOP,\n addressLookupTables: flashloanTx.addressLookupTables,\n });\n\n const transactions = [...additionalTxs, flashloanTx];\n return {\n transactions,\n actionTxIndex: transactions.length - 1,\n txOverflown,\n };\n }\n\n /**\n * Creates instructions for closing a lendr account.\n * The account must have no active positions or balances to be closed.\n * Closing an account will return any remaining SOL to the fee payer.\n *\n * @returns An InstructionsWrapper containing the close account instruction\n */\n async makeCloseAccountIx(): Promise<InstructionsWrapper> {\n const ix = await instructions.makeCloseAccountIx(this._program, {\n lendrAccount: this.address,\n feePayer: this.client.wallet.publicKey,\n });\n return { instructions: [ix], keys: [] };\n }\n\n /**\n * Closes a lendr account. The account must have no active positions or balances to be closed.\n * Closing an account will return any remaining SOL to the fee payer.\n *\n * @param processOpts - Optional transaction processing configuration\n * @param txOpts - Optional transaction options\n * @returns The transaction signature of the close account operation\n */\n async closeAccount(\n processOpts?: ProcessTransactionsClientOpts,\n txOpts?: TransactionOptions,\n ): Promise<TransactionSignature> {\n const tx = await this.makeCloseAccountTx();\n return this.client.processTransaction(tx, processOpts, txOpts);\n }\n\n /**\n * Creates a transaction for closing a lendr account.\n * The account must have no active positions or balances to be closed.\n *\n * @returns A transaction configured to close the lendr account\n */\n async makeCloseAccountTx(): Promise<ExtendedTransaction> {\n const ix = await this.makeCloseAccountIx();\n const tx = new Transaction().add(...ix.instructions);\n const clientLookupTables = await getClientAddressLookupTableAccounts(this.client);\n return addTransactionMetadata(tx, {\n signers: ix.keys,\n addressLookupTables: clientLookupTables,\n type: TransactionType.CLOSE_ACCOUNT,\n });\n }\n\n /**\n * Creates instructions for depositing tokens into a lendr bank account.\n *\n * @param amount - The amount of tokens to deposit, can be a number or Amount object\n * @param bankAddress - The public key of the bank to deposit into\n * @param depositOpts - Optional deposit configuration parameters\n * @returns An InstructionsWrapper containing the deposit instructions\n */\n async makeDepositIx(\n amount: Amount,\n bankAddress: PublicKey,\n depositOpts: MakeDepositIxOpts = {},\n ): Promise<InstructionsWrapper> {\n return this._lendrAccount.makeDepositIx(\n this._program,\n this.client.banks,\n this.client.mintDatas,\n amount,\n bankAddress,\n depositOpts,\n );\n }\n\n async makeDepositWithSessionIx(\n amount: Amount,\n bankAddress: PublicKey,\n sessionKey: PublicKey,\n depositOpts: MakeDepositWithSessionIxOpts = {},\n ): Promise<InstructionsWrapper> {\n return this._lendrAccount.makeDepositWithSessionIx(\n this._program,\n this.client.banks,\n this.client.mintDatas,\n amount,\n bankAddress,\n sessionKey,\n depositOpts,\n );\n }\n\n// ... existing code ...\n /**\n * Creates a transaction for depositing native stake into a lendr staked asset bank account.\n * - Split stake account if required\n * - Authorize stake account to single spl pool pogram\n * - Deposit stake into pool for LST\n * - Deposit LST into lendr bank\n *\n * @param amount - The amount of tokens to deposit, can be a number or Amount object\n * @param bankAddress - The public key of the bank to deposit into\n * @param stakeAccountPk - The public key of the stake account to delegate\n * @param validator - The public key of the validator to delegate to\n * @param depositOpts - Optional deposit configuration parameters\n * @returns A transaction object ready to be signed and sent\n */\n async makeDepositStakedTx(\n amount: Amount,\n bankAddress: PublicKey,\n stakeAccountPk: PublicKey,\n validator: PublicKey,\n depositOpts: MakeDepositIxOpts = {},\n ): Promise<ExtendedTransaction> {\n // derive addresses\n const pool = findPoolAddress(validator);\n const poolStakeAddress = findPoolStakeAddress(pool);\n const lstMint = findPoolMintAddress(pool);\n const auth = findPoolStakeAuthorityAddress(pool);\n const lstAta = getAssociatedTokenAddressSync(lstMint, this.authority);\n\n // fetch account info\n const [lstAccInfo, stakeAccountInfo, stakeAccInfoParsed] = await Promise.all([\n this.client.provider.connection.getAccountInfo(lstAta),\n this._program.provider.connection.getAccountInfo(stakeAccountPk),\n this._program.provider.connection.getParsedAccountInfo(stakeAccountPk),\n ]);\n const stakeAccParsed = stakeAccInfoParsed?.value?.data as ParsedAccountData;\n\n // calculate amounts and thresholds\n const [rentExemptReserve, minimumDelegation] = await Promise.all([\n this._program.provider.connection.getMinimumBalanceForRentExemption(StakeProgram.space),\n this._program.provider.connection.getStakeMinimumDelegation().then((res) => {\n return Math.max(res.value, LAMPORTS_PER_SOL);\n }),\n ]);\n\n // calculate if full stake or requires splitting\n const amountLamports = Math.round(Number(amount) * LAMPORTS_PER_SOL);\n const stakeAccLamports = Number(stakeAccParsed.parsed.info.stake?.delegation?.stake ?? 0);\n const isFullStake = amountLamports >= stakeAccLamports;\n\n // calculate pool tokens\n const poolStakeAccLamports =\n (await this._program.provider.connection.getAccountInfo(poolStakeAddress))?.lamports ?? 0;\n const prePoolStake = Math.max(poolStakeAccLamports - minimumDelegation - rentExemptReserve, 0);\n\n const tokenSupply = Number.parseInt(\n (await this._program.provider.connection.getTokenSupply(lstMint)).value.amount,\n 10,\n );\n const stakeAddedNative = Number(amount) * 1e9;\n\n const newPoolTokens =\n prePoolStake > 0 && tokenSupply > 0\n ? Math.floor((stakeAddedNative * tokenSupply) / prePoolStake)\n : stakeAddedNative;\n\n if (newPoolTokens <= 0) {\n throw new Error(\"Deposit too small or calculation error.\");\n }\n\n // build instructions\n const instructions: TransactionInstruction[] = [];\n const signers: Signer[] = [];\n\n // create ata if needed\n if (!lstAccInfo) {\n instructions.push(createAssociatedTokenAccountInstruction(this.authority, lstAta, this.authority, lstMint));\n }\n\n // handle stake splitting if needed\n let targetStakePubkey: PublicKey;\n if (!isFullStake) {\n const splitStakeAccount = Keypair.generate();\n signers.push(splitStakeAccount);\n targetStakePubkey = splitStakeAccount.publicKey;\n\n instructions.push(\n ...StakeProgram.split(\n {\n stakePubkey: stakeAccountPk,\n authorizedPubkey: this.authority,\n splitStakePubkey: splitStakeAccount.publicKey,\n lamports: amountLamports,\n },\n rentExemptReserve,\n ).instructions,\n );\n } else {\n targetStakePubkey = stakeAccountPk;\n }\n\n // authorization instructions\n const [authorizeStakerIx, authorizeWithdrawIx] = await Promise.all([\n StakeProgram.authorize({\n stakePubkey: targetStakePubkey,\n authorizedPubkey: this.authority,\n newAuthorizedPubkey: auth,\n stakeAuthorizationType: StakeAuthorizationLayout.Staker,\n }).instructions,\n StakeProgram.authorize({\n stakePubkey: targetStakePubkey,\n authorizedPubkey: this.authority,\n newAuthorizedPubkey: auth,\n stakeAuthorizationType: StakeAuthorizationLayout.Withdrawer,\n }).instructions,\n ]);\n\n // fix SYSVAR_CLOCK_ID writability\n [authorizeStakerIx[0], authorizeWithdrawIx[0]].forEach((ix) => {\n ix.keys = ix.keys.map((key) => ({\n ...key,\n isWritable: key.pubkey.equals(SYSVAR_CLOCK_ID) ? false : key.isWritable,\n }));\n });\n\n instructions.push(...authorizeStakerIx, ...authorizeWithdrawIx);\n\n // deposit stake instructions\n const depositStakeIx = await SinglePoolInstruction.depositStake(pool, targetStakePubkey, lstAta, this.authority);\n\n // deposit bank instructions\n const lendrDepositIxs = await this.makeDepositIx(newPoolTokens / 1e9, bankAddress, depositOpts);\n\n instructions.push(depositStakeIx, ...lendrDepositIxs.instructions);\n\n // build transaction\n const transaction = new Transaction().add(...instructions);\n return addTransactionMetadata(transaction, {\n type: TransactionType.DEPOSIT_STAKE,\n signers: [...signers, ...lendrDepositIxs.keys],\n addressLookupTables: this.client.addressLookupTables,\n });\n }\n\n async makeMergeStakeAccountsTx(\n stakeAccountSrc: PublicKey,\n stakeAccountDest: PublicKey,\n ): Promise<ExtendedTransaction> {\n // Create the merge instruction\n const mergeInstruction = StakeProgram.merge({\n stakePubkey: stakeAccountDest, // Public key of the destination stake account\n sourceStakePubKey: stakeAccountSrc, // Public key of the source stake account\n authorizedPubkey: this.authority, // Public key of the stake authority\n });\n\n // Build the transaction\n const transaction = new Transaction().add(mergeInstruction);\n\n // Get client lookup tables for consistency with other functions\n const clientLookupTables = await getClientAddressLookupTableAccounts(this.client);\n\n return addTransactionMetadata(transaction, {\n type: TransactionType.MERGE_STAKE_ACCOUNTS,\n signers: [],\n addressLookupTables: clientLookupTables,\n });\n }\n\n /**\n * Deposits tokens into a lendr bank account.\n *\n * @param amount - The amount of tokens to deposit, can be a number or Amount object\n * @param bankAddress - The public key of the bank to deposit into\n * @param depositOpts - Optional deposit configuration parameters\n * @param processOpts - Optional transaction processing configuration\n * @param txOpts - Optional transaction options\n * @returns The transaction signature of the deposit\n */\n async deposit(\n amount: Amount,\n bankAddress: PublicKey,\n depositOpts: MakeDepositIxOpts = {},\n processOpts?: ProcessTransactionsClientOpts,\n txOpts?: TransactionOptions,\n ): Promise<TransactionSignature> {\n this.client.logger.debug(\n {\n address: this.address.toBase58(),\n amount,\n bankAddress: bankAddress.toBase58(),\n },\n \"[lendr:lendr-account:deposit] Depositing into lendr account\",\n );\n\n const tx = await this.makeDepositTx(amount, bankAddress, depositOpts);\n\n const sig = await this.client.processTransaction(tx, processOpts, txOpts);\n this.client.logger.debug(\n {\n address: this.address.toBase58(),\n sig,\n },\n \"[lendr:lendr-account:deposit] Depositing successful\",\n );\n return sig;\n }\n\n async depositWithSession(\n amount: Amount,\n bankAddress: PublicKey,\n session: EstablishedSessionState,\n depositOpts: MakeDepositWithSessionIxOpts = {},\n ): Promise<TransactionResult> {\n this.client.logger.debug(\n {\n address: this.address.toBase58(),\n amount,\n bankAddress: bankAddress.toBase58(),\n sessionKey: session.sessionPublicKey,\n },\n \"[lendr:lendr-account:depositWithSession] Depositing into lendr account, using sessions.\",\n );\n const { instructions } = await this.makeDepositWithSessionTx(amount, bankAddress, session.sessionPublicKey, depositOpts);\n\n const txResult = await session.sendTransaction(instructions);\n this.client.logger.debug(\n {\n address: this.address.toBase58(),\n txResult,\n },\n \"[lendr:lendr-account:depositWithSession] WithSession-Deposit was successful\",\n );\n return txResult;\n }\n\n /**\n * Creates a transaction for depositing tokens into a lendr bank account.\n *\n * @param amount - The amount of tokens to deposit, can be a number or Amount object\n * @param bankAddress - The public key of the bank to deposit into\n * @param depositOpts - Optional deposit configuration parameters\n * @returns A transaction object ready to be signed and sent\n */\n async makeDepositTx(\n amount: Amount,\n bankAddress: PublicKey,\n depositOpts: MakeDepositIxOpts = {},\n ): Promise<ExtendedTransaction> {\n const ixs = await this.makeDepositIx(amount, bankAddress, depositOpts);\n const tx = new Transaction().add(...ixs.instructions);\n const clientLookupTables = await getClientAddressLookupTableAccounts(this.client);\n const solanaTx = addTransactionMetadata(tx, {\n type: TransactionType.DEPOSIT,\n signers: ixs.keys,\n addressLookupTables: clientLookupTables,\n });\n\n return solanaTx;\n }\n\n async makeDepositWithSessionTx(\n amount: Amount,\n bankAddress: PublicKey,\n sessionKey: PublicKey,\n depositOpts: MakeDepositWithSessionIxOpts = {},\n ): Promise<ExtendedTransaction> {\n const ixs = await this.makeDepositWithSessionIx(amount, bankAddress, sessionKey, depositOpts);\n const tx = new Transaction().add(...ixs.instructions);\n const clientLookupTables = await getClientAddressLookupTableAccounts(this.client);\n const solanaTx = addTransactionMetadata(tx, {\n type: TransactionType.DEPOSIT,\n signers: ixs.keys,\n addressLookupTables: clientLookupTables,\n });\n\n return solanaTx;\n }\n\n /**\n * Simulates a lendr transaction to preview its effects.\n *\n * @param txs - Array of transactions to simulate, can be either VersionedTransaction or Transaction\n * @param bankAddress - The public key of the bank to inspect\n * @param additionalAccountsToInspect - Optional array of additional account public keys to inspect during simulation\n * @returns A SimulationResult containing the preview state of both the lendr account and bank\n * @throws Will throw an error if simulation fails\n */\n async simulateBorrowLendTransaction(\n txs: (VersionedTransaction | Transaction)[],\n banksToInspect: PublicKey[],\n healthSimOptions?: {\n enabled: boolean;\n mandatoryBanks: PublicKey[];\n excludedBanks: PublicKey[];\n },\n ): Promise<SimulationResult> {\n const additionalTxs: VersionedTransaction[] = [];\n\n if (healthSimOptions?.enabled) {\n const computeIx = ComputeBudgetProgram.setComputeUnitLimit({\n units: 1_400_000,\n });\n const updateFeedIx = await this.makeUpdateFeedIx(healthSimOptions.mandatoryBanks);\n const healthPulseIx = await this.makePulseHealthIx(\n healthSimOptions.mandatoryBanks,\n healthSimOptions.excludedBanks,\n );\n\n const blockhash = (await this.client.provider.connection.getLatestBlockhash(\"confirmed\")).blockhash;\n\n const tx = new VersionedTransaction(\n new TransactionMessage({\n instructions: [computeIx, ...updateFeedIx.instructions, ...healthPulseIx.instructions],\n payerKey: this.client.provider.publicKey,\n recentBlockhash: blockhash,\n }).compileToV0Message([...this.client.addressLookupTables, ...updateFeedIx.luts]),\n );\n\n additionalTxs.push(tx);\n }\n\n const [ldrAccountData, ...bankData] = await this.client.simulateTransactions(\n [...txs, ...additionalTxs],\n [this.address, ...banksToInspect],\n );\n\n if (!ldrAccountData) throw new Error(\"Failed to simulate\");\n const ldrAccount = LendrAccount.decode(ldrAccountData, this._program.idl);\n console.log(\"ldrAccount\", ldrAccount);\n if (!bankData) throw new Error(\"Failed to simulate\");\n const previewBanks = new Map(this.client.banks);\n\n banksToInspect.forEach((bankAddress, idx) => {\n const data = bankData[idx];\n if (!data) throw new Error(\"Failed to simulate\");\n previewBanks.set(\n bankAddress.toBase58(),\n Bank.fromBuffer(bankAddress, data, this._program.idl, this.client.feedIdMap),\n );\n });\n\n const previewClient = new LendrClient({\n config: this._config,\n program: this.client.program,\n wallet: {} as Wallet,\n isReadOnly: true,\n group: this.client.group,\n banks: this.client.banks,\n priceInfos: this.client.oraclePrices,\n mintDatas: this.client.mintDatas,\n feedIdMap: this.client.feedIdMap,\n });\n const previewLendrAccount = LendrAccountWrapper.fromAccountDataRaw(\n this.address,\n previewClient,\n ldrAccountData,\n this._program.idl,\n );\n\n return {\n banks: previewBanks,\n lendrAccount: previewLendrAccount,\n };\n }\n\n /**\n * Creates a transaction instruction for repaying a loan.\n *\n * @param amount - The amount to repay, can be a number or Amount object\n * @param bankAddress - The public key of the bank to repay to\n * @param repayAll - Whether to repay the entire loan balance, defaults to false\n * @param repayOpts - Optional parameters for the repay instruction\n * @returns An InstructionsWrapper containing the deposit instructions\n * @throws Will throw an error if the repay mint is not found\n */\n async makeRepayIx(\n amount: Amount,\n bankAddress: PublicKey,\n repayAll = false,\n repayOpts: MakeRepayIxOpts = {},\n ): Promise<InstructionsWrapper> {\n const tokenProgramAddress = this.client.mintDatas.get(bankAddress.toBase58())?.tokenProgram;\n if (!tokenProgramAddress) throw Error(\"Repay mint not found\");\n\n return this._lendrAccount.makeRepayIx(\n this._program,\n this.client.banks,\n this.client.mintDatas,\n amount,\n bankAddress,\n repayAll,\n repayOpts,\n );\n }\n\n /**\n * Creates a transaction instruction for repaying a loan.\n *\n * @param amount - The amount to repay, can be a number or Amount object\n * @param bankAddress - The public key of the bank to repay to\n * @param sessionKey - The session key of the logged in user (with session)\n * @param repayAll - Whether to repay the entire loan balance, defaults to false\n * @param repayOpts - Optional parameters for the repay instruction\n * @returns An InstructionsWrapper containing the deposit instructions\n * @throws Will throw an error if the repay mint is not found\n */\n async makeRepayWithSessionIx(\n amount: Amount,\n bankAddress: PublicKey,\n sessionKey: PublicKey,\n repayAll = false,\n repayOpts: MakeRepayWithSessionIxOpts = {},\n ): Promise<InstructionsWrapper> {\n const tokenProgramAddress = this.client.mintDatas.get(bankAddress.toBase58())?.tokenProgram;\n if (!tokenProgramAddress) throw Error(\"Repay mint not found\");\n\n return this._lendrAccount.makeRepayWithSessionIx(\n this._program,\n this.client.banks,\n this.client.mintDatas,\n amount,\n bankAddress,\n sessionKey,\n repayAll,\n repayOpts,\n );\n }\n\n /**\n * Repays a loan in a lendr bank account.\n *\n * @param amount - The amount to repay, can be a number or Amount object\n * @param bankAddress - The public key of the bank to repay to\n * @param repayAll - Whether to repay the entire loan balance, defaults to false\n * @param repayOpts - Optional parameters for the repay instruction\n * @param processOpts - Optional transaction processing configuration\n * @param txOpts - Optional transaction options\n * @returns The transaction signature of the repayment\n */\n async repay(\n amount: Amount,\n bankAddress: PublicKey,\n repayAll = false,\n repayOpts: MakeRepayIxOpts = {},\n processOpts?: ProcessTransactionsClientOpts,\n txOpts?: TransactionOptions,\n ): Promise<TransactionSignature> {\n this.client.logger.debug(\n {\n address: this.address.toBase58(),\n amount,\n bankAddress,\n repayAll,\n },\n \"[lendr:lendr-account:repay] Repaying into lendr account\",\n );\n\n const tx = await this.makeRepayTx(amount, bankAddress, repayAll, repayOpts);\n\n const sig = await this.client.processTransaction(tx, processOpts, txOpts);\n this.client.logger.debug(\n {\n address: this.address.toBase58(),\n sig,\n },\n \"[lendr:lendr-account:repay] Repaying successful\",\n );\n\n return sig;\n }\n\n /**\n * Repays a loan in a lendr bank account.\n *\n * @param amount - The amount to repay, can be a number or Amount object\n * @param bankAddress - The public key of the bank to repay to\n * @param session: Session object in Established state (o.w. sendTransaction method won't work!)\n * @param repayAll - Whether to repay the entire loan balance, defaults to false\n * @param repayOpts - Optional parameters for the repay instruction\n * @returns The transaction signature of the repayment\n */\n async repayWithSession(\n amount: Amount,\n bankAddress: PublicKey,\n session: EstablishedSessionState,\n repayAll = false,\n repayOpts: MakeRepayWithSessionIxOpts = {},\n ): Promise<TransactionResult> {\n this.client.logger.debug(\n {\n address: this.address.toBase58(),\n sessionKey: session.sessionPublicKey,\n amount,\n bankAddress,\n repayAll,\n },\n \"[lendr:lendr-account:repayWithSession] Repaying into lendr account\",\n );\n\n const tx = await this.makeRepayWithSessionTx(amount, bankAddress, session.sessionPublicKey, repayAll, repayOpts);\n\n const result = await session.sendTransaction(tx.instructions);\n\n this.client.logger.debug(\n {\n address: this.address.toBase58(),\n result,\n },\n \"[lendr:lendr-account:repayWithSession] Repaying successful\",\n );\n\n return result;\n }\n\n /**\n * Creates a transaction for repaying a loan in a lendr bank account.\n *\n * @param amount - The amount to repay, can be a number or Amount object\n * @param bankAddress - The public key of the bank to repay to\n * @param repayAll - Whether to repay the entire loan balance, defaults to false\n * @param repayOpts - Optional parameters for the repay instruction\n * @returns A transaction object containing the repay instructions\n */\n async makeRepayTx(\n amount: Amount,\n bankAddress: PublicKey,\n repayAll = false,\n repayOpts: MakeRepayIxOpts = {},\n ): Promise<ExtendedTransaction> {\n const ixs = await this.makeRepayIx(amount, bankAddress, repayAll, repayOpts);\n const tx = new Transaction().add(...ixs.instructions);\n const clientLookupTables = await getClientAddressLookupTableAccounts(this.client);\n const solanaTx = addTransactionMetadata(tx, {\n type: TransactionType.REPAY,\n signers: ixs.keys,\n addressLookupTables: clientLookupTables,\n });\n return solanaTx;\n }\n\n /**\n * Creates a transaction for repaying a loan in a lendr bank account.\n *\n * @param amount - The amount to repay, can be a number or Amount object\n * @param bankAddress - The public key of the bank to repay to\n * @param repayAll - Whether to repay the entire loan balance, defaults to false\n * @param repayOpts - Optional parameters for the repay instruction\n * @returns A transaction object containing the repay instructions\n */\n async makeRepayWithSessionTx(\n amount: Amount,\n bankAddress: PublicKey,\n sessionKey: PublicKey,\n repayAll = false,\n repayOpts: MakeRepayWithSessionIxOpts = {},\n ): Promise<ExtendedTransaction> {\n const ixs = await this.makeRepayWithSessionIx(amount, bankAddress, sessionKey, repayAll, repayOpts);\n const tx = new Transaction().add(...ixs.instructions);\n const clientLookupTables = await getClientAddressLookupTableAccounts(this.client);\n const solanaTx = addTransactionMetadata(tx, {\n type: TransactionType.REPAY,\n signers: ixs.keys,\n addressLookupTables: clientLookupTables,\n });\n return solanaTx;\n }\n\n /**\n * Creates instructions for withdrawing tokens from a lendr bank account.\n *\n * @param amount - The amount of tokens to withdraw, can be a number or Amount object\n * @param bankAddress - The public key of the bank to withdraw from\n * @param withdrawAll - Whether to withdraw the entire balance, defaults to false\n * @param withdrawOpts - Optional parameters for the withdraw instruction\n * @returns An InstructionsWrapper containing the withdraw instructions and signers\n * @throws Will throw an error if the withdraw mint is not found\n */\n async makeWithdrawIx(\n amount: Amount,\n bankAddress: PublicKey,\n withdrawAll = false,\n withdrawOpts: MakeWithdrawIxOpts = {},\n ): Promise<InstructionsWrapper> {\n const tokenProgramAddress = this.client.mintDatas.get(bankAddress.toBase58())?.tokenProgram;\n if (!tokenProgramAddress) throw Error(\"Withdraw mint not found\");\n\n // TODO)) this.client.getExtendedMetadata()\n // if (!this.client.bankMetadataMap)\n // \tthrow Error(\"Bank metadata map not found\");\n\n return this._lendrAccount.makeWithdrawIx(\n this._program,\n this.client.banks,\n this.client.mintDatas,\n amount,\n bankAddress,\n withdrawAll,\n withdrawOpts,\n );\n }\n\n /**\n * Creates instructions for withdrawing tokens from a lendr bank account.\n *\n * @param amount - The amount of tokens to withdraw, can be a number or Amount object\n * @param bankAddress - The public key of the bank to withdraw from\n * @param session - User's logged in session object in Established state.\n * @param withdrawAll - Whether to withdraw the entire balance, defaults to false\n * @param withdrawOpts - Optional parameters for the withdraw instruction\n * @returns An InstructionsWrapper containing the withdraw instructions and signers\n * @throws Will throw an error if the withdraw mint is not found\n */\n async makeWithdrawWithSessionIx(\n amount: Amount,\n bankAddress: PublicKey,\n session: EstablishedSessionState,\n withdrawAll = false,\n withdrawOpts: MakeWithdrawWithSessionIxOpts = {},\n ): Promise<InstructionsWrapper> {\n const tokenProgramAddress = this.client.mintDatas.get(bankAddress.toBase58())?.tokenProgram;\n if (!tokenProgramAddress) throw Error(\"Withdraw mint not found\");\n\n // TODO)) this.client.getExtendedMetadata()\n // if (!this.client.bankMetadataMap)\n // \tthrow Error(\"Bank metadata map not found\");\n\n return this._lendrAccount.makeWithdrawWithSessionIx(\n this._program,\n this.client.banks,\n this.client.mintDatas,\n amount,\n bankAddress,\n session,\n withdrawAll,\n withdrawOpts,\n );\n }\n\n /**\n * Creates a transaction for withdrawing tokens from a lendr bank account and staking them.\n * - Withdraw from lendr bank\n * - Create stake account\n * - Approve mint authority to burn tokens\n * - Delegate stake account\n *\n * @param amount - The amount of tokens to withdraw, can be a number or Amount object\n * @param bankAddress - The public key of the bank to withdraw from\n * @param isWholePosition - Whether to withdraw the entire position, defaults to false\n * @returns A transaction object ready to be signed and sent\n */\n async makeWithdrawStakedTx(\n amount: Amount,\n bankAddress: PublicKey,\n isWholePosition: boolean,\n ): Promise<TransactionBuilderResult> {\n // get bank and metadata\n const bank = this.client.getBankByPk(bankAddress);\n const solBank = this.client.getBankByMint(WSOL_MINT);\n const bankMetadata = this.client.bankMetadataMap![bankAddress.toBase58()];\n\n if (!bank || !solBank) {\n throw new Error(\"Banks not found\");\n }\n\n if (!bankMetadata.validatorVoteAccount) {\n throw new Error(\"Validator vote account not found\");\n }\n\n // derive addresses\n const pool = findPoolAddress(new PublicKey(bankMetadata.validatorVoteAccount));\n const lstMint = findPoolMintAddress(pool);\n const mintAuthority = findPoolMintAuthorityAddress(pool);\n const lstAta = getAssociatedTokenAddressSync(lstMint, this.authority);\n\n // calculate amounts and thresholds\n const rentExemption = await this._program.provider.connection.getMinimumBalanceForRentExemption(200);\n\n const stakeAmount = new BigNumber(new BigNumber(amount).toString());\n\n // withdraw from lendr bank\n const withdrawIxs = await this.makeWithdrawIx(amount, bankAddress, isWholePosition, {\n createAtas: true,\n wrapAndUnwrapSol: true,\n });\n\n // create stake account\n const stakeAccount = Keypair.generate();\n const createStakeAccountIx = SystemProgram.createAccount({\n fromPubkey: this.authority,\n newAccountPubkey: stakeAccount.publicKey,\n lamports: rentExemption,\n space: 200,\n programId: STAKE_PROGRAM_ID,\n });\n\n const approveAccountAuthorityIx = createApproveInstruction(\n lstAta,\n mintAuthority,\n this.authority,\n stakeAmount.multipliedBy(1e9).toNumber(),\n [],\n // TODO)) test and see if this should be 2022\n TOKEN_PROGRAM_ID,\n );\n\n // delegate stake account\n const withdrawStakeIx: TransactionInstruction = await SinglePoolInstruction.withdrawStake(\n pool,\n stakeAccount.publicKey,\n this.authority,\n lstAta,\n stakeAmount,\n );\n\n // build transaction\n const {\n value: { blockhash },\n } = await this._program.provider.connection.getLatestBlockhashAndContext(\"confirmed\");\n\n const withdrawMessage = new TransactionMessage({\n payerKey: this.client.wallet.publicKey,\n recentBlockhash: blockhash,\n instructions: [...withdrawIxs.instructions],\n }).compileToV0Message(this.client.addressLookupTables);\n const withdrawTxn = addTransactionMetadata(new VersionedTransaction(withdrawMessage), {\n signers: withdrawIxs.keys,\n addressLookupTables: this.client.addressLookupTables,\n type: TransactionType.WITHDRAW,\n });\n\n const stakeMessage = new TransactionMessage({\n payerKey: this.client.wallet.publicKey,\n recentBlockhash: blockhash,\n instructions: [createStakeAccountIx, approveAccountAuthorityIx, withdrawStakeIx],\n }).compileToV0Message(this.client.addressLookupTables);\n const stakeTxn = addTransactionMetadata(new VersionedTransaction(stakeMessage), {\n signers: [stakeAccount],\n addressLookupTables: this.client.addressLookupTables,\n type: TransactionType.WITHDRAW_STAKE,\n });\n\n return { transactions: [withdrawTxn, stakeTxn], actionTxIndex: 1 };\n }\n\n /**\n * Creates a transaction for withdrawing all tokens from multiple lendr banks.\n *\n * @param banks - Array of objects containing amount and bank address for each withdrawal\n * @param withdrawOpts - Optional parameters for the withdraw instructions\n * @returns A transaction object ready to be signed and sent\n */\n async makeWithdrawAllTx(\n banks: {\n amount: Amount;\n bankAddress: PublicKey;\n }[],\n withdrawOpts: MakeWithdrawIxOpts = {},\n ): Promise<ExtendedTransaction> {\n this.client.logger.debug(\n { address: this.address.toBase58() },\n \"[lendr:lendr-account:withdraw-all] Withdrawing all from lendr account\",\n );\n\n const withdrawIxsWrapped = await Promise.all(banks.map((bank) =>\n this.makeWithdrawIx(bank.amount, bank.bankAddress, true, withdrawOpts),\n ));\n return this.finalizeWithdrawAllTransaction(withdrawIxsWrapped);\n }\n\n /**\n * Creates a transaction for withdrawing all tokens from multiple lendr banks.\n *\n * @param banks - Array of objects containing amount and bank address for each withdrawal\n * @param session - user session object (in Established state)\n * @param withdrawOpts - Optional parameters for the withdraw instructions\n * @returns A transaction object ready to be signed and sent\n */\n async makeWithdrawAllWithSessionTx(\n banks: {\n amount: Amount;\n bankAddress: PublicKey;\n }[],\n session: EstablishedSessionState,\n withdrawOpts: MakeWithdrawWithSessionIxOpts = {},\n ): Promise<ExtendedTransaction> {\n this.client.logger.debug(\n { address: this.address.toBase58() },\n \"[lendr:lendr-account:withdraw-all-with-session] Withdrawing all from lendr account\",\n );\n\n const withdrawIxsWrapped = await Promise.all(banks.map((bank) =>\n this.makeWithdrawWithSessionIx(bank.amount, bank.bankAddress, session, true, withdrawOpts),\n ));\n\n return this.finalizeWithdrawAllTransaction(withdrawIxsWrapped)\n }\n\n async finalizeWithdrawAllTransaction(withdrawIxsWrapped: InstructionsWrapper[]) {\n // TODO add crank\n const cuRequestIxs = this.makeComputeBudgetIx();\n const withdrawIxs = withdrawIxsWrapped.flatMap((ix) => ix.instructions);\n // make sure all signers are unique\n const filteredSigners = withdrawIxsWrapped\n .flatMap((ix) => ix.keys)\n .filter((key, index, self) => index === self.findIndex((k) => k.publicKey.equals(key.publicKey)));\n\n const tx = new Transaction().add(...cuRequestIxs, ...withdrawIxs);\n const clientLookupTables = await getClientAddressLookupTableAccounts(this.client);\n\n const solanaTx = addTransactionMetadata(tx, {\n signers: filteredSigners,\n addressLookupTables: clientLookupTables,\n type: TransactionType.WITHDRAW_ALL,\n });\n return solanaTx;\n }\n\n /**\n * Withdraws tokens from a lendr bank account.\n *\n * @param amount - The amount of tokens to withdraw, can be a number or Amount object\n * @param bankAddress - The public key of the bank to withdraw from\n * @param withdrawAll - If true, withdraws entire balance from the bank\n * @param withdrawOpts - Optional withdraw configuration parameters\n * @param processOpts - Optional transaction processing configuration\n * @param txOpts - Optional transaction options\n * @returns Array of transaction signatures - includes signatures for any required oracle feed updates followed by the withdraw transaction\n */\n async withdraw(\n amount: Amount,\n bankAddress: PublicKey,\n withdrawAll = false,\n withdrawOpts: MakeWithdrawIxOpts = {},\n processOpts?: ProcessTransactionsClientOpts,\n txOpts?: TransactionOptions,\n ): Promise<TransactionSignature[]> {\n this.client.logger.debug(\n { address: this.address.toBase58(), amount },\n \"[lendr:lendr-account:withdraw] Withdrawing from lendr account\",\n );\n\n const { transactions } = await this.makeWithdrawTx(amount, bankAddress, withdrawAll, withdrawOpts);\n\n // process multiple transactions if feed updates required\n const sigs = await this.client.processTransactions([...transactions], processOpts, txOpts);\n this.client.logger.debug(\n { address: this.address.toBase58(), sig: sigs[sigs.length - 1] },\n \"[lendr:lendr-account:withdraw] Withdrawing successful\",\n );\n\n return sigs;\n }\n\n /**\n * Withdraws tokens from a lendr bank account.\n *\n * @param amount - The amount of tokens to withdraw, can be a number or Amount object\n * @param bankAddress - The public key of the bank to withdraw from\n * @param withdrawAll - If true, withdraws entire balance from the bank\n * @param withdrawOpts - Optional withdraw configuration parameters\n * @returns Array of transaction signatures - includes signatures for any required oracle feed updates followed by the withdraw transaction\n */\n async withdrawWithSession(\n amount: Amount,\n bankAddress: PublicKey,\n session: EstablishedSessionState,\n withdrawAll = false,\n withdrawOpts: MakeWithdrawWithSessionIxOpts = {},\n ) {\n this.client.logger.debug(\n { address: this.address.toBase58(), amount, sessionKey: session.sessionPublicKey },\n \"[lendr:lendr-account:withdrawWithSession] Withdrawing from lendr account\",\n );\n\n const { instructions } = await this.makeWithdrawWithSessionTx(amount, bankAddress, session, withdrawAll, withdrawOpts);\n\n // TODO: CHECK: For now this codebase returns empty array for updateFeedIxs; I don't know if this completely works without user sign\n // In case makeUpdateFeedIx returns actual instructions!\n const txResult = await session.sendTransaction(instructions);\n\n this.client.logger.debug(\n { address: this.address.toBase58(), txResult },\n \"[lendr:lendr-account:withdraw-with-session] Withdrawing successful\",\n );\n\n return txResult;\n }\n\n /**\n * Creates a versioned transaction for withdrawing tokens from a lendr bank account.\n *\n * @param amount - The amount of tokens to withdraw, can be a number or Amount object\n * @param bankAddress - The public key of the bank to withdraw from\n * @param withdrawAll - If true, withdraws entire balance from the bank\n * @param withdrawOpts - Optional withdraw configuration parameters\n * @returns Object containing feed crank transactions and the withdraw transaction\n */\n async makeWithdrawTx(\n amount: Amount,\n bankAddress: PublicKey,\n withdrawAll = false,\n withdrawOpts: MakeWithdrawIxOpts = {},\n ): Promise<TransactionBuilderResult> {\n const cuRequestIxs = this.makeComputeBudgetIx();\n const { instructions: updateFeedIxs, luts: feedLuts } = await this.makeUpdateFeedIx([]);\n const withdrawIxs = await this.makeWithdrawIx(amount, bankAddress, withdrawAll, withdrawOpts);\n\n const {\n value: { blockhash },\n } = await this._program.provider.connection.getLatestBlockhashAndContext(\"confirmed\");\n\n const feedCrankTxs: ExtendedV0Transaction[] = [];\n\n if (updateFeedIxs.length > 0) {\n feedCrankTxs.push(\n addTransactionMetadata(\n new VersionedTransaction(\n new TransactionMessage({\n instructions: [...updateFeedIxs],\n payerKey: this.authority,\n recentBlockhash: blockhash,\n }).compileToV0Message(feedLuts),\n ),\n {\n addressLookupTables: feedLuts,\n type: TransactionType.CRANK,\n },\n ),\n );\n }\n\n const clientLookupTables = await getClientAddressLookupTableAccounts(this.client);\n\n const withdrawTx = addTransactionMetadata(\n new VersionedTransaction(\n new TransactionMessage({\n instructions: [...cuRequestIxs, ...withdrawIxs.instructions],\n payerKey: this.authority,\n recentBlockhash: blockhash,\n }).compileToV0Message(clientLookupTables),\n ),\n {\n signers: withdrawIxs.keys,\n addressLookupTables: clientLookupTables,\n type: TransactionType.WITHDRAW,\n },\n );\n\n const transactions = [...feedCrankTxs, withdrawTx];\n\n return { transactions, actionTxIndex: transactions.length - 1 };\n }\n\n /**\n * Creates a versioned transaction for withdrawing tokens from a lendr bank account.\n *\n * @param amount - The amount of tokens to withdraw, can be a number or Amount object\n * @param bankAddress - The public key of the bank to withdraw from\n * @param session - Logged in user session object in Established state.\n * @param withdrawAll - If true, withdraws entire balance from the bank\n * @param withdrawOpts - Optional withdraw configuration parameters\n * @returns Object containing feed crank transactions and the withdraw transaction\n */\n async makeWithdrawWithSessionTx(\n amount: Amount,\n bankAddress: PublicKey,\n session: EstablishedSessionState,\n withdrawAll = false,\n withdrawOpts: MakeWithdrawWithSessionIxOpts = {},\n ) {\n const cuRequestIxs = this.makeComputeBudgetIx();\n const { instructions: updateFeedIxs, luts: feedLuts } = await this.makeUpdateFeedIx([]);\n const withdrawIxs = await this.makeWithdrawWithSessionIx(amount, bankAddress, session, withdrawAll, withdrawOpts);\n\n const {\n value: { blockhash },\n } = await this._program.provider.connection.getLatestBlockhashAndContext(\"confirmed\");\n\n const feedCrankTxs: ExtendedV0Transaction[] = [];\n\n if (updateFeedIxs.length > 0) {\n feedCrankTxs.push(\n addTransactionMetadata(\n new VersionedTransaction(\n new TransactionMessage({\n instructions: [...updateFeedIxs],\n payerKey: this.authority,\n recentBlockhash: blockhash,\n }).compileToV0Message(feedLuts),\n ),\n {\n addressLookupTables: feedLuts,\n type: TransactionType.CRANK,\n },\n ),\n );\n }\n\n const clientLookupTables = await getClientAddressLookupTableAccounts(this.client);\n\n const withdrawTx = addTransactionMetadata(\n new VersionedTransaction(\n new TransactionMessage({\n instructions: [...cuRequestIxs, ...withdrawIxs.instructions],\n payerKey: this.authority,\n recentBlockhash: blockhash,\n }).compileToV0Message(clientLookupTables),\n ),\n {\n signers: withdrawIxs.keys,\n addressLookupTables: clientLookupTables,\n type: TransactionType.WITHDRAW,\n },\n );\n\n const transactions = [...feedCrankTxs, withdrawTx];\n\n return {\n transactions,\n instructions: [...updateFeedIxs, ...cuRequestIxs, ...withdrawIxs.instructions],\n actionTxIndex: transactions.length - 1\n };\n }\n\n /**\n * Creates instructions for borrowing tokens from a lendr bank account.\n *\n * @param amount - The amount of tokens to borrow, can be a number or Amount object\n * @param bankAddress - The public key of the bank to borrow from\n * @param borrowOpts - Optional borrow configuration parameters\n * @returns An InstructionsWrapper containing the borrow instructions\n */\n async makeBorrowIx(\n amount: Amount,\n bankAddress: PublicKey,\n borrowOpts: MakeBorrowIxOpts = {},\n ): Promise<InstructionsWrapper> {\n const tokenProgramAddress = this.client.mintDatas.get(bankAddress.toBase58())?.tokenProgram;\n if (!tokenProgramAddress) throw Error(\"Borrow mint not found\");\n\n if (!this.client.bankMetadataMap) throw Error(\"Bank metadata map not found\");\n\n return this._lendrAccount.makeBorrowIx(\n this._program,\n this.client.banks,\n this.client.mintDatas,\n this.client.bankMetadataMap,\n amount,\n bankAddress,\n borrowOpts,\n );\n }\n\n /**\n * Creates instructions for borrowing tokens from a lendr bank account.\n *\n * @param amount - The amount of tokens to borrow, can be a number or Amount object\n * @param bankAddress - The public key of the bank to borrow from\n * @param session\n * @param borrowOpts - Optional borrow configuration parameters\n * @returns An InstructionsWrapper containing the borrow instructions\n */\n async makeBorrowWithSessionIx(\n amount: Amount,\n bankAddress: PublicKey,\n session: EstablishedSessionState,\n borrowOpts: MakeBorrowWithSessionIxOpts = {},\n ): Promise<InstructionsWrapper> {\n const tokenProgramAddress = this.client.mintDatas.get(bankAddress.toBase58())?.tokenProgram;\n if (!tokenProgramAddress) throw Error(\"Borrow mint not found\");\n\n if (!this.client.bankMetadataMap) throw Error(\"Bank metadata map not found\");\n\n return this._lendrAccount.makeBorrowWithSessionIx(\n this._program,\n this.client.banks,\n this.client.mintDatas,\n this.client.bankMetadataMap,\n amount,\n bankAddress,\n session,\n borrowOpts,\n );\n }\n\n /**\n * Borrows tokens from a lendr bank account.\n *\n * @param amount - The amount of tokens to borrow, can be a number or Amount object\n * @param bankAddress - The public key of the bank to borrow from\n * @param borrowOpts - Optional borrow configuration parameters\n * @param processOpts - Optional transaction processing configuration\n * @param txOpts - Optional transaction configuration parameters\n * @returns Array of transaction signatures from the borrow operation\n */\n async borrow(\n amount: Amount,\n bankAddress: PublicKey,\n borrowOpts: MakeBorrowIxOpts = {},\n processOpts?: ProcessTransactionsClientOpts,\n txOpts?: TransactionOptions,\n ): Promise<TransactionSignature[]> {\n this.client.logger.debug(\n { address: this.address.toBase58(), amount },\n \"[lendr:lendr-account:borrow] Borrowing from lendr account\",\n );\n\n const { transactions } = await this.makeBorrowTx(amount, bankAddress, borrowOpts);\n\n const sigs = await this.client.processTransactions([...transactions], processOpts, txOpts);\n this.client.logger.debug(\n { address: this.address.toBase58(), sigs },\n \"[lendr:lendr-account:borrow] Borrowing successful\",\n );\n return sigs;\n }\n\n /**\n * Borrows tokens from a lendr bank account.\n *\n * @param amount - The amount of tokens to borrow, can be a number or Amount object\n * @param bankAddress - The public key of the bank to borrow from\n * @param session - Fogo session object in Established state.\n * @param borrowOpts - Optional borrow configuration parameters\n * @returns Array of transaction signatures from the borrow operation\n */\n async borrowWithSession(\n amount: Amount,\n bankAddress: PublicKey,\n session: EstablishedSessionState,\n borrowOpts: MakeBorrowWithSessionIxOpts = {},\n ): Promise<TransactionResult> {\n this.client.logger.debug(\n { address: this.address.toBase58(), amount, sessionKey: session.sessionPublicKey },\n \"[lendr:lendr-account:borrowWithSession] Borrowing from lendr account\",\n );\n\n const { instructions } = await this.makeBorrowWithSessionTx(amount, bankAddress, session, borrowOpts);\n\n const txResult = await session.sendTransaction(instructions);\n\n this.client.logger.debug(\n { address: this.address.toBase58(), txResult },\n \"[lendr:lendr-account:borrowWithSession] Borrowing successful\",\n );\n return txResult;\n }\n\n /**\n * Creates a versioned transaction for borrowing tokens from a lendr bank account.\n *\n * @param amount - The amount of tokens to borrow, can be a number or Amount object\n * @param bankAddress - The public key of the bank to borrow from\n * @param borrowOpts - Optional borrow configuration parameters\n * @returns Object containing feed crank transactions and the borrow transaction\n */\n async makeBorrowTx(\n amount: Amount,\n bankAddress: PublicKey,\n borrowOpts: MakeBorrowIxOpts = {},\n ): Promise<TransactionBuilderResult> {\n const cuRequestIxs = this.makeComputeBudgetIx();\n\n // if banks are stale and using switchboard pull, we need to crank the feed\n const { instructions: updateFeedIxs, luts: feedLuts } = await this.makeUpdateFeedIx([bankAddress]);\n const borrowIxs = await this.makeBorrowIx(amount, bankAddress, borrowOpts);\n\n const {\n value: { blockhash },\n } = await this._program.provider.connection.getLatestBlockhashAndContext(\"confirmed\");\n\n const feedCrankTxs: ExtendedV0Transaction[] = [];\n\n if (updateFeedIxs.length > 0) {\n feedCrankTxs.push(\n addTransactionMetadata(\n new VersionedTransaction(\n new TransactionMessage({\n instructions: updateFeedIxs,\n payerKey: this.authority,\n recentBlockhash: blockhash,\n }).compileToV0Message(feedLuts),\n ),\n {\n type: TransactionType.CRANK,\n addressLookupTables: feedLuts,\n },\n ),\n );\n }\n\n const clientLookupTables = await getClientAddressLookupTableAccounts(this.client);\n\n const borrowTx = addTransactionMetadata(\n new VersionedTransaction(\n new TransactionMessage({\n instructions: [...cuRequestIxs, ...borrowIxs.instructions],\n payerKey: this.authority,\n recentBlockhash: blockhash,\n }).compileToV0Message(clientLookupTables),\n ),\n {\n signers: borrowIxs.keys,\n type: TransactionType.BORROW,\n addressLookupTables: clientLookupTables,\n },\n );\n\n const transactions = [...feedCrankTxs, borrowTx];\n return { transactions, actionTxIndex: transactions.length - 1 };\n }\n\n /**\n * Creates a versioned transaction for borrowing tokens from a lendr bank account.\n *\n * @param amount - The amount of tokens to borrow, can be a number or Amount object\n * @param bankAddress - The public key of the bank to borrow from\n * @param session\n * @param borrowOpts - Optional borrow configuration parameters\n * @returns Object containing feed crank transactions and the borrow transaction\n */\n async makeBorrowWithSessionTx(\n amount: Amount,\n bankAddress: PublicKey,\n session: EstablishedSessionState,\n borrowOpts: MakeBorrowWithSessionIxOpts = {},\n ) {\n const cuRequestIxs = this.makeComputeBudgetIx();\n\n // if banks are stale and using switchboard pull, we need to crank the feed\n const { instructions: updateFeedIxs, luts: feedLuts } = await this.makeUpdateFeedIx([bankAddress]);\n const borrowIxs = await this.makeBorrowWithSessionIx(amount, bankAddress, session, borrowOpts);\n\n const {\n value: { blockhash },\n } = await this._program.provider.connection.getLatestBlockhashAndContext(\"confirmed\");\n\n const feedCrankTxs: ExtendedV0Transaction[] = [];\n\n if (updateFeedIxs.length > 0) {\n feedCrankTxs.push(\n addTransactionMetadata(\n new VersionedTransaction(\n new TransactionMessage({\n instructions: updateFeedIxs,\n payerKey: this.authority,\n recentBlockhash: blockhash,\n }).compileToV0Message(feedLuts),\n ),\n {\n type: TransactionType.CRANK,\n addressLookupTables: feedLuts,\n },\n ),\n );\n }\n\n const clientLookupTables = await getClientAddressLookupTableAccounts(this.client);\n\n const borrowTx = addTransactionMetadata(\n new VersionedTransaction(\n new TransactionMessage({\n instructions: [...cuRequestIxs, ...borrowIxs.instructions],\n payerKey: this.authority,\n recentBlockhash: blockhash,\n }).compileToV0Message(clientLookupTables),\n ),\n {\n signers: borrowIxs.keys,\n type: TransactionType.BORROW,\n addressLookupTables: clientLookupTables,\n },\n );\n\n const transactions = [...feedCrankTxs, borrowTx];\n return {\n transactions,\n instructions: [...updateFeedIxs, ...cuRequestIxs, ...borrowIxs.instructions],\n actionTxIndex: transactions.length - 1\n };\n }\n\n /**\n * Creates instructions for withdrawing emissions rewards from a lendr bank account.\n *\n * @param bankAddress - The public key of the bank to withdraw emissions from\n * @returns An InstructionsWrapper containing the withdraw emissions instructions\n */\n async makeWithdrawEmissionsIx(bankAddress: PublicKey): Promise<InstructionsWrapper> {\n return this._lendrAccount.makeWithdrawEmissionsIx(\n this._program,\n this.client.banks,\n this.client.mintDatas,\n bankAddress,\n );\n }\n\n /**\n * Creates a versioned transaction for withdrawing emissions rewards from multiple lendr bank accounts.\n *\n * @param bankAddresses - Array of public keys for the banks to withdraw emissions from\n * @returns A versioned transaction containing the withdraw emissions instructions\n */\n async makeWithdrawEmissionsTx(bankAddresses: PublicKey[]): Promise<ExtendedV0Transaction> {\n const {\n value: { blockhash },\n } = await this._program.provider.connection.getLatestBlockhashAndContext(\"confirmed\");\n\n const withdrawEmissionsIxs: InstructionsWrapper[] = [];\n await Promise.all(\n bankAddresses.map(async (bankAddress) => {\n const ix = await this.makeWithdrawEmissionsIx(bankAddress);\n if (!ix) return;\n withdrawEmissionsIxs.push(ix);\n }),\n );\n\n const clientLookupTables = await getClientAddressLookupTableAccounts(this.client);\n\n const emissionsTx = addTransactionMetadata(\n new VersionedTransaction(\n new TransactionMessage({\n instructions: withdrawEmissionsIxs.flatMap((ix) => ix.instructions),\n payerKey: this.authority,\n recentBlockhash: blockhash,\n }).compileToV0Message(clientLookupTables),\n ),\n {\n signers: withdrawEmissionsIxs.flatMap((ix) => ix.keys),\n type: TransactionType.WITHDRAW_EMISSIONS,\n addressLookupTables: clientLookupTables,\n },\n );\n\n return emissionsTx;\n }\n\n /**\n * Withdraws emissions rewards from multiple lendr bank accounts.\n *\n * @param bankAddresses - Array of public keys for the banks to withdraw emissions from\n * @param processOpts - Optional processing options for the transaction\n * @param txOpts - Optional transaction options\n * @returns The transaction signature of the withdraw emissions transaction\n */\n async withdrawEmissions(\n bankAddresses: PublicKey[],\n processOpts?: ProcessTransactionsClientOpts,\n txOpts?: TransactionOptions,\n ): Promise<TransactionSignature> {\n this.client.logger.debug(\n {\n address: this.address.toBase58(),\n banks: bankAddresses.map((b) => b.toBase58()),\n },\n \"[lendr:lendr-account:withdraw-emissions] Withdrawing emission from lendr account\",\n );\n\n const withdrawEmissionsTx = await this.makeWithdrawEmissionsTx(bankAddresses);\n const sig = await this.client.processTransaction(withdrawEmissionsTx, processOpts, txOpts);\n this.client.logger.debug(\n { address: this.address.toBase58(), sig },\n \"[lendr:lendr-account:withdraw-emissions] Withdrawing emission from lendr account\",\n );\n\n return sig;\n }\n\n /**\n * Creates an instruction wrapper for liquidating a lending account position.\n *\n * @param liquidateeLendrAccount - The lendr account to be liquidated\n * @param assetBankAddress - Public key of the bank containing the asset to receive in liquidation\n * @param assetQuantityUi - Amount of the asset to receive, in UI units\n * @param liabBankAddress - Public key of the bank containing the liability to repay\n * @returns An instruction wrapper containing the liquidation instructions\n */\n public async makeLendingAccountLiquidateIx(\n liquidateeLendrAccount: LendrAccount,\n assetBankAddress: PublicKey,\n assetQuantityUi: Amount,\n liabBankAddress: PublicKey,\n ): Promise<InstructionsWrapper> {\n const liabTokenProgramAddress = this.client.mintDatas.get(liabBankAddress.toBase58())?.tokenProgram;\n if (!liabTokenProgramAddress) throw Error(\"Liability mint not found\");\n\n if (!this.client.bankMetadataMap) throw Error(\"Bank metadata map not found\");\n\n return this._lendrAccount.makeLendingAccountLiquidateIx(\n liquidateeLendrAccount,\n this._program,\n this.client.banks,\n this.client.mintDatas,\n this.client.bankMetadataMap,\n assetBankAddress,\n assetQuantityUi,\n liabBankAddress,\n );\n }\n\n /**\n * Liquidates a lending account position.\n *\n * @param liquidateeLendrAccount - The lendr account to be liquidated\n * @param assetBankAddress - Public key of the bank containing the asset to receive in liquidation\n * @param assetQuantityUi - Amount of the asset to receive, in UI units\n * @param liabBankAddress - Public key of the bank containing the liability to repay\n * @param processOpts - Optional processing options for the transaction\n * @param txOpts - Optional transaction options\n * @returns The transaction signature of the liquidation transaction\n */\n public async lendingAccountLiquidate(\n liquidateeLendrAccount: LendrAccount,\n assetBankAddress: PublicKey,\n assetQuantityUi: Amount,\n liabBankAddress: PublicKey,\n processOpts?: ProcessTransactionsClientOpts,\n txOpts?: TransactionOptions,\n ): Promise<TransactionSignature> {\n this.client.logger.debug(\n {\n address: this.address.toBase58(),\n liquidateeLendrAccount: liquidateeLendrAccount.address.toBase58(),\n },\n \"[lendr:lendr-account:liquidation] Liquidating lendr account\",\n );\n\n const liquidationIxs = await this.makeLendingAccountLiquidateIx(\n liquidateeLendrAccount,\n assetBankAddress,\n assetQuantityUi,\n liabBankAddress,\n );\n const tx = new Transaction().add(...liquidationIxs.instructions);\n const clientLookupTables = await getClientAddressLookupTableAccounts(this.client);\n const solanaTx = addTransactionMetadata(tx, {\n signers: liquidationIxs.keys,\n addressLookupTables: clientLookupTables,\n type: TransactionType.LIQUIDATE_ACCOUNT,\n });\n const sig = await this.client.processTransaction(solanaTx, processOpts, txOpts);\n this.client.logger.debug(\n { address: this.address.toBase58(), sig },\n \"[lendr:lendr-account:liquidation] Liquidation successful\",\n );\n\n return sig;\n }\n\n /**\n * Creates an instruction to begin a flash loan operation.\n *\n * @param endIndex - The index where the flash loan instructions end in the transaction\n * @returns An InstructionsWrapper containing the begin flash loan instruction\n */\n public async makeBeginFlashLoanIx(endIndex: number): Promise<InstructionsWrapper> {\n return this._lendrAccount.makeBeginFlashLoanIx(this._program, endIndex);\n }\n\n /**\n * Creates an instruction to end a flash loan operation.\n *\n * @param projectedActiveBalances - Array of PublicKeys representing the projected active balance accounts after flash loan\n * @returns An InstructionsWrapper containing the end flash loan instruction\n */\n public async makeEndFlashLoanIx(projectedActiveBalances: PublicKey[]): Promise<InstructionsWrapper> {\n return this._lendrAccount.makeEndFlashLoanIx(this._program, this.client.banks, projectedActiveBalances);\n }\n\n public async flashLoan(\n args: FlashLoanArgs,\n processOpts?: ProcessTransactionsClientOpts,\n txOpts?: TransactionOptions,\n ): Promise<TransactionSignature> {\n this.client.logger.debug(\n { address: this.address.toBase58() },\n \"[lendr:lendr-account:flashLoan] Executing flashloan from lendr account\",\n );\n\n const clientLookupTables = await getClientAddressLookupTableAccounts(this.client);\n const tx = await this.buildFlashLoanTx(args, clientLookupTables);\n const sig = await this.client.processTransaction(tx, processOpts, txOpts);\n this.client.logger.debug(\n { address: this.address.toBase58(), sig },\n \"[lendr:lendr-account:flashLoan] Flashloan successful\",\n );\n\n return sig;\n }\n\n public async buildFlashLoanTx(\n args: FlashLoanArgs,\n lookupTables?: AddressLookupTableAccount[],\n ): Promise<ExtendedV0Transaction> {\n const endIndex = args.ixs.length + 1;\n\n const projectedActiveBalances: PublicKey[] = this._lendrAccount.projectActiveBalancesNoCpi(this._program, args.ixs);\n\n const beginFlashLoanIx = await this.makeBeginFlashLoanIx(endIndex);\n const endFlashLoanIx = await this.makeEndFlashLoanIx(projectedActiveBalances);\n\n const flashloanIxs = [...beginFlashLoanIx.instructions, ...args.ixs, ...endFlashLoanIx.instructions];\n const totalLookupTables = [...(lookupTables ?? []), ...(args.addressLookupTableAccounts ?? [])];\n\n const blockhash =\n args.blockhash ?? (await this._program.provider.connection.getLatestBlockhash(\"confirmed\")).blockhash;\n const message = new TransactionMessage({\n payerKey: this.client.wallet.publicKey,\n recentBlockhash: blockhash,\n instructions: flashloanIxs,\n }).compileToV0Message(totalLookupTables);\n\n const tx = addTransactionMetadata(new VersionedTransaction(message), {\n addressLookupTables: totalLookupTables,\n type: TransactionType.FLASHLOAN,\n });\n\n if (args.signers) {\n tx.sign(args.signers);\n }\n\n return tx;\n }\n\n public async makeTransferAccountAuthorityIx(newAccountAuthority: PublicKey): Promise<InstructionsWrapper> {\n return this._lendrAccount.makeAccountAuthorityTransferIx(this._program, newAccountAuthority);\n }\n\n async transferAccountAuthority(\n newAccountAuthority: PublicKey,\n processOpts?: ProcessTransactionsClientOpts,\n txOpts?: TransactionOptions,\n ): Promise<string> {\n this.client.logger.debug(\n { from: this.address.toBase58(), to: newAccountAuthority.toBase58() },\n \"[lendr:lendr-account:transfer-authority] Transferring account\",\n );\n\n const ixs = await this.makeTransferAccountAuthorityIx(newAccountAuthority);\n const tx = new Transaction().add(...ixs.instructions);\n const solanaTx = addTransactionMetadata(tx, {\n type: TransactionType.TRANSFER_AUTH,\n });\n const sig = await this.client.processTransaction(solanaTx, processOpts, txOpts);\n this.client.logger.debug({ sig }, \"[lendr:lendr-account:transfer-authority] Transfer successful\");\n\n return sig;\n }\n\n async makeUpdateFeedIx(\n newBanksPk: PublicKey[],\n txLandingBuffer = 0,\n ): Promise<{\n instructions: TransactionInstruction[];\n luts: AddressLookupTableAccount[];\n }> {\n // filter active and newly opening balances\n const activeBanksPk = this._lendrAccount.balances\n .filter((balance) => balance.active)\n .map((balance) => balance.bankPk);\n const activeBanks = activeBanksPk.map((pk) => this.client.banks.get(pk.toBase58())!);\n const newBanks = newBanksPk.map((pk) => this.client.banks.get(pk.toBase58())!);\n\n return { instructions: [], luts: [] };\n }\n\n async makePulseHealthIx(mandatoryBanks: PublicKey[] = [], excludedBanks: PublicKey[] = []) {\n return this._lendrAccount.makePulseHealthIx(\n this._program,\n this.client.banks,\n mandatoryBanks,\n excludedBanks,\n this.client.bankMetadataMap || {},\n );\n }\n\n // --------------------------------------------------------------------------\n // Helpers\n // --------------------------------------------------------------------------\n\n private static async _fetchAccountData(\n accountAddress: Address,\n config: LendrConfig,\n program: LendrProgram,\n commitment?: Commitment,\n ): Promise<LendrAccountRaw> {\n const mergedCommitment = commitment ?? program.provider.connection.commitment ?? DEFAULT_COMMITMENT;\n\n const data: LendrAccountRaw = (await program.account.lendrAccount.fetch(accountAddress, mergedCommitment)) as any;\n\n if (!data.group.equals(config.groupPk))\n throw Error(`Lendr account tied to group ${data.group.toBase58()}. Expected: ${config.groupPk.toBase58()}`);\n\n return data;\n }\n\n static async encode(decoded: LendrAccountRaw, idl: LendrIdlType): Promise<Buffer> {\n const coder = new BorshCoder(idl);\n return await coder.accounts.encode(AccountType.LendrAccount, decoded);\n }\n\n async reload() {\n this.client.logger.debug(\n { address: this.address.toBase58() },\n \"[lendr:lendr-account:reload] Reloading account data\",\n );\n\n const lendrAccountAi = await this._program.account.lendrAccount.getAccountInfo(this.address);\n if (!lendrAccountAi) throw new Error(`Failed to fetch data for lendr account ${this.address.toBase58()}`);\n const lendrAccountParsed = LendrAccount.decode(lendrAccountAi.data, this._program.idl);\n if (!lendrAccountParsed.group.equals(this._config.groupPk))\n throw Error(\n `Lendr account tied to group ${lendrAccountParsed.group.toBase58()}. Expected: ${this._config.groupPk.toBase58()}`,\n );\n\n this._updateFromAccountParsed(lendrAccountParsed);\n }\n\n private _updateFromAccountParsed(data: LendrAccountRaw) {\n this._lendrAccount = LendrAccount.fromAccountParsed(this.address, data);\n }\n\n public describe(): string {\n return this._lendrAccount.describe(this.client.banks, this.client.oraclePrices);\n }\n\n // --------------------------------------------------------------------------\n // DEPRECATED METHODS\n // --------------------------------------------------------------------------\n\n /**\n * @deprecated This method is deprecated. Please use simulateBorrowLendTransaction instead.\n */\n async simulateDeposit(amount: Amount, bankAddress: PublicKey): Promise<SimulationResult> {\n const ixs = await this.makeDepositIx(amount, bankAddress);\n const tx = new Transaction().add(...ixs.instructions);\n try {\n return this.simulateBorrowLendTransaction([tx], [bankAddress]);\n } catch (e) {\n throw new Error(\"Failed to simulate deposit\");\n }\n }\n\n /**\n * @deprecated This method is deprecated. Please use simulateBorrowLendTransaction instead.\n */\n async simulateWithdraw(bankAddress: PublicKey, txs: VersionedTransaction[]): Promise<SimulationResult> {\n try {\n return this.simulateBorrowLendTransaction(txs, [bankAddress]);\n } catch (e) {\n throw new Error(\"Failed to simulate withdraw\");\n }\n }\n\n /**\n * @deprecated This method is deprecated. Please use simulateBorrowLendTransaction instead.\n */\n async simulateBorrow(bankAddress: PublicKey, txs: VersionedTransaction[]): Promise<SimulationResult> {\n try {\n return this.simulateBorrowLendTransaction(txs, [bankAddress]);\n } catch (e) {\n throw new Error(\"Failed to simulate borrow\");\n }\n }\n\n /**\n * @deprecated This method is deprecated. Please use simulateBorrowLendTransaction instead.\n */\n async simulateRepay(amount: Amount, bankAddress: PublicKey, repayAll = false): Promise<SimulationResult> {\n const ixs = await this.makeRepayIx(amount, bankAddress, repayAll);\n const tx = new Transaction().add(...ixs.instructions);\n try {\n return this.simulateBorrowLendTransaction([tx], [bankAddress]);\n } catch (e) {\n throw new Error(\"Failed to simulate repay\");\n }\n }\n}\n\n/**\n * @deprecated This method is deprecated.\n */\nexport function makeTxPriorityIx(\n feePayer: PublicKey,\n feeUi = 0,\n broadcastType: TransactionBroadcastType = \"BUNDLE\",\n computeUnitsLimit?: number,\n) {\n let bundleTipIx: TransactionInstruction | undefined;\n let priorityFeeIx: TransactionInstruction = makePriorityFeeIx()[0];\n\n if (broadcastType === \"BUNDLE\") {\n bundleTipIx = makeBundleTipIx(feePayer, Math.trunc(feeUi * LAMPORTS_PER_SOL));\n } else {\n priorityFeeIx = makePriorityFeeIx(feeUi, computeUnitsLimit)[0];\n }\n\n return {\n bundleTipIx,\n priorityFeeIx,\n };\n}\n\nexport function makeBundleTipIx(feePayer: PublicKey, bundleTip = 100_000): TransactionInstruction {\n // they have remained constant so function not used (for now)\n const getTipAccounts = async () => {\n const response = await fetch(\"https://mainnet.block-engine.jito.wtf/api/v1/bundles\", {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify({\n jsonrpc: \"2.0\",\n id: 1,\n method: \"getTipAccounts\",\n params: [],\n }),\n });\n\n const data = await response.json();\n return data.result;\n };\n\n const tipAccounts = [\n \"96gYZGLnJYVFmbjzopPSU6QiEV5fGqZNyN9nmNhvrZU5\",\n \"HFqU5x63VTqvQss8hp11i4wVV8bD44PvwucfZ2bU7gRe\",\n \"Cw8CFyM9FkoMi7K7Crf6HNQqf4uEMzpKw6QNghXLvLkY\",\n \"ADaUMid9yfUytqMBgopwjb2DTLSokTSzL1zt6iGPaS49\",\n \"DfXygSm4jCyNCybVYYK6DwvWqjKee8pbDmJGcLWNDXjh\",\n \"ADuUkR4vqLUMWXxW9gh6D6L8pMSawimctcNZ5pGwDcEt\",\n \"DttWaMuVvTiduZRnguLF7jNxTgiMBZ1hyAumKUiL2KRL\",\n \"3AVi9Tg9Uo68tJfuvoKvqKNWKkC5wPdSSdeBnizKZ6jT\",\n ];\n const randomTipAccount = tipAccounts[Math.floor(Math.random() * tipAccounts.length)];\n\n return SystemProgram.transfer({\n fromPubkey: feePayer,\n toPubkey: new PublicKey(randomTipAccount),\n lamports: bundleTip, // 100_000 lamports = 0.0001 SOL\n });\n}\n\nasync function getClientAddressLookupTableAccounts(client: LendrClient) {\n const addresses = client.lookupTablesAddresses;\n const luts: AddressLookupTableAccount[] = client.addressLookupTables;\n\n for (const address of addresses) {\n const lut = await client.provider.connection.getAddressLookupTable(address);\n if (lut.value) {\n luts.push(lut.value);\n }\n }\n\n return luts;\n}\n\nexport { LendrAccountWrapper };\n","import type BigNumber from \"bignumber.js\";\nimport { toBigNumber, wrappedI80F48toBigNumber } from \"../common\";\nimport {\n getActiveHealthCacheFlags,\n type HealthCacheFlags,\n type HealthCacheRaw,\n type HealthCacheType,\n} from \"../services\";\n\nexport class HealthCache implements HealthCacheType {\n constructor(\n public assetValue: BigNumber,\n public liabilityValue: BigNumber,\n public assetValueMaint: BigNumber,\n public liabilityValueMaint: BigNumber,\n public assetValueEquity: BigNumber,\n public liabilityValueEquity: BigNumber,\n public timestamp: BigNumber,\n public flags: HealthCacheFlags[],\n public prices: number[][],\n public simulationFailed?: boolean,\n ) {\n this.assetValue = assetValue;\n this.liabilityValue = liabilityValue;\n this.assetValueMaint = assetValueMaint;\n this.liabilityValueMaint = liabilityValueMaint;\n this.assetValueEquity = assetValueEquity;\n this.liabilityValueEquity = liabilityValueEquity;\n this.timestamp = timestamp;\n this.flags = flags;\n this.prices = prices;\n this.simulationFailed = simulationFailed;\n }\n\n static from(healthCacheRaw: HealthCacheRaw): HealthCache {\n const assetValue = wrappedI80F48toBigNumber(healthCacheRaw.assetValue);\n const liabilityValue = wrappedI80F48toBigNumber(healthCacheRaw.liabilityValue);\n const assetValueMaint = wrappedI80F48toBigNumber(healthCacheRaw.assetValueMaint);\n const liabilityValueMaint = wrappedI80F48toBigNumber(healthCacheRaw.liabilityValueMaint);\n const assetValueEquity = wrappedI80F48toBigNumber(healthCacheRaw.assetValueEquity);\n const liabilityValueEquity = wrappedI80F48toBigNumber(healthCacheRaw.liabilityValueEquity);\n const timestamp = toBigNumber(healthCacheRaw.timestamp);\n const flags = getActiveHealthCacheFlags(healthCacheRaw.flags);\n const prices = healthCacheRaw.prices;\n return new HealthCache(\n assetValue,\n liabilityValue,\n assetValueMaint,\n liabilityValueMaint,\n assetValueEquity,\n liabilityValueEquity,\n timestamp,\n flags,\n prices,\n );\n }\n}\n","import type { Commitment, Connection } from \"@solana/web3.js\";\n\nimport { setTimeoutPromise, sleep } from \"../../../common\";\n\nexport class SendBundleError extends Error {\n public readonly bundleId?: string;\n\n constructor(message: string, bundleId?: string) {\n super(message);\n Object.setPrototypeOf(this, new.target.prototype); // Restore prototype chain\n this.bundleId = bundleId;\n\n Error.captureStackTrace(this, this.constructor);\n }\n}\n\nconst GRPC_ERROR_TAG = \"GRPC bundle failed:\";\n\nexport async function sendTransactionAsGrpcBundle(\n connection: Connection,\n base58Txs: string[],\n throwError = false,\n): Promise<string | undefined> {\n try {\n const sendBundleResponse = await fetch(\"/api/bundles/sendBundle\", {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({\n transactions: base58Txs,\n }),\n });\n\n const sendBundleResult = await sendBundleResponse.json();\n if (sendBundleResult.error) throw new SendBundleError(sendBundleResult.error, sendBundleResult?.bundleId);\n const bundleId = sendBundleResult.bundleId;\n\n // confirm bundle\n try {\n await confirmBundle(connection, bundleId);\n } catch (error) {\n return bundleId;\n }\n\n return bundleId;\n } catch (error) {\n if (throwError) {\n if (error instanceof SendBundleError) throw error;\n throw new SendBundleError(`${GRPC_ERROR_TAG} unknown error`);\n }\n }\n}\n\nconst API_ERROR_TAG = \"API bundle failed:\";\n\nexport async function sendTransactionAsBundle(\n connection: Connection,\n base58Txs: string[],\n throwError = false,\n tempBundleId?: string,\n): Promise<string | undefined> {\n try {\n const sendBundleResponse = await fetch(\"https://mainnet.block-engine.jito.wtf/api/v1/bundles\", {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({\n jsonrpc: \"2.0\",\n id: 1,\n method: \"sendBundle\",\n params: [base58Txs],\n }),\n });\n\n const sendBundleResult = await sendBundleResponse.json();\n if (sendBundleResult.error) {\n if (sendBundleResult.error.message.includes(\"already processed\")) {\n return tempBundleId ?? \"0x0\"; // todo add proper bundle id\n }\n\n throw new SendBundleError(`${API_ERROR_TAG} ${sendBundleResult.error.message}`);\n }\n\n const bundleId = sendBundleResult.result as string;\n await sleep(500);\n\n for (let attempt = 0; attempt < 10; attempt++) {\n const getBundleStatusResponse = await fetch(\"https://mainnet.block-engine.jito.wtf/api/v1/bundles\", {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({\n jsonrpc: \"2.0\",\n id: 1,\n method: \"getBundleStatuses\",\n params: [[bundleId]],\n }),\n });\n\n const getBundleStatusResult = await getBundleStatusResponse.json();\n\n const status = getBundleStatusResult.result?.value[0]?.confirmation_status;\n\n if (getBundleStatusResult.result?.value[0]?.err) {\n const error = getBundleStatusResult.result?.value[0].err;\n if (error?.Ok !== null) {\n throw new Error(error);\n }\n }\n\n /**\n * Bundle status values:\n * - Failed: All regions marked bundle as failed, not forwarded\n * - Pending: Bundle has not failed, landed, or been deemed invalid\n * - Landed: Bundle successfully landed on-chain (verified via RPC/bundles_landed table)\n * - Invalid: Bundle is no longer in the system\n */\n if (status === \"Failed\") {\n throw new SendBundleError(`${API_ERROR_TAG} unknown error`);\n } else if (status === \"confirmed\" || status === \"finalized\") {\n await confirmBundle(connection, bundleId);\n return bundleId;\n }\n\n await sleep(1000); // Wait before retrying\n }\n } catch (error) {\n if (throwError) {\n if (error instanceof SendBundleError) throw error;\n\n throw new SendBundleError(`${API_ERROR_TAG} unknown error`);\n }\n }\n}\n\nexport async function confirmBundle(connection: Connection, bundleId: string, commitment: Commitment = \"confirmed\") {\n const getStatus = async () => {\n let attempts = 0;\n const maxAttempts = 5;\n\n while (attempts < maxAttempts) {\n await sleep(2000);\n attempts += 1;\n\n const getBundleStatus = await fetch(\"https://mainnet.block-engine.jito.wtf/api/v1/bundles\", {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({\n jsonrpc: \"2.0\",\n id: 1,\n method: \"getBundleStatuses\",\n params: [[bundleId]],\n }),\n });\n\n const bundleStatus = await getBundleStatus.json();\n if (bundleStatus.result.value) {\n if (bundleStatus.result.value[0].bundle_id) {\n const commitmentStatus = bundleStatus.result.value[0].confirmation_status;\n\n if (commitmentStatus === \"confirmed\") {\n return bundleId;\n }\n }\n }\n\n console.log(\"🔄 Waiting for confirmation...\");\n }\n console.log(\"❌ Transaction failed to confirm in time.\");\n throw new Error(\"Transaction failed to confirm in time.\");\n };\n\n const result = await Promise.race([getStatus(), setTimeoutPromise(20000, `Transaction failed to confirm in time.`)]);\n\n if (result instanceof Error) {\n throw result;\n }\n\n return result;\n}\n","import {\n type PublicKey,\n type RpcResponseAndContext,\n type SimulatedTransactionResponse,\n SolanaJSONRPCError,\n type TransactionError,\n type VersionedTransaction,\n} from \"@solana/web3.js\";\n\nexport class BundleSimulationError extends Error {\n constructor(\n message: string,\n public readonly logs?: string[],\n public readonly cause?: unknown,\n ) {\n super(message);\n this.name = \"BundleSimulationError\";\n }\n\n static fromHttpError(status: number, statusText: string): BundleSimulationError {\n return new BundleSimulationError(`HTTP error ${status}: ${statusText}`);\n }\n\n static fromEncodingError(error: unknown, index?: number): BundleSimulationError {\n return new BundleSimulationError(`Failed to encode transaction${index !== undefined ? ` at index ${index}` : \"s\"}`);\n }\n}\n\ntype JsonRpcResponse<T> =\n | {\n id: number;\n jsonrpc: string;\n result: RpcResponseAndContext<T>;\n }\n | {\n id: number;\n jsonrpc: string;\n error: SolanaJSONRPCError;\n };\n\ninterface RpcSimulateBundleResult {\n summary:\n | \"succeeded\"\n | {\n failed: {\n error: any;\n txSignature?: string;\n };\n };\n transactionResults: RpcSimulateBundleTransactionResult[];\n}\n\nexport function isSimulatedTransactionResponse(\n response: SimulatedTransactionResponse | RpcSimulateBundleTransactionResult[],\n): response is SimulatedTransactionResponse {\n return !Array.isArray(response) && \"err\" in response;\n}\n\nexport interface RpcSimulateBundleTransactionResult {\n err?: TransactionError;\n logs: string[];\n preExecutionAccounts?: any; //UiAccount[],\n postExecutionAccounts?: any; //UiAccount[],\n unitsConsumed?: string;\n returnData?: any; //UiTransactionReturnData,\n}\n\ninterface RpcSimulateBundleConfig {\n preExecutionAccountsConfigs: (RpcSimulateTransactionAccountsConfig | undefined)[];\n postExecutionAccountsConfigs: (RpcSimulateTransactionAccountsConfig | undefined)[];\n transactionEncoding?: any;\n simulationBank?: SimulationSlotConfig;\n skipSigVerify?: boolean;\n replaceRecentBlockhash?: boolean;\n}\n\ninterface RpcSimulateTransactionAccountsConfig {\n encoding?: any; // UiAccountEncoding,\n addresses: string[];\n}\n\ntype SimulationSlotConfig = \"confirmed\" | \"processed\" | number;\n\nexport async function simulateBundle(\n rpcEndpoint: string,\n transactions: VersionedTransaction[],\n includeAccounts?: Array<PublicKey>,\n): Promise<RpcSimulateBundleTransactionResult[]> {\n // Validate input\n if (!transactions.length) {\n throw new BundleSimulationError(\"No bundle provided for simulation\");\n }\n\n try {\n // Prepare transaction data\n const encodedTransactions = encodeTransactions(transactions);\n const config = createBundleConfig(transactions, includeAccounts);\n\n // Execute simulation\n const result = await executeBundleSimulation(rpcEndpoint, encodedTransactions, config);\n\n return result;\n } catch (error) {\n // If it's already a SolanaJSONRPCError or BundleSimulationError, rethrow it\n if (error instanceof SolanaJSONRPCError || error instanceof BundleSimulationError) {\n throw error;\n } else {\n throw new BundleSimulationError(\"Failed to execute bundle simulation\", undefined, error);\n }\n }\n}\n\nfunction encodeTransactions(transactions: VersionedTransaction[]): string[] {\n try {\n return transactions.map((tx, index) => {\n try {\n const serialized = tx.serialize();\n return Buffer.from(serialized).toString(\"base64\");\n } catch (error) {\n throw BundleSimulationError.fromEncodingError(error, index);\n }\n });\n } catch (error) {\n if (error instanceof BundleSimulationError) throw error;\n throw BundleSimulationError.fromEncodingError(error);\n }\n}\n\nfunction createBundleConfig(\n transactions: VersionedTransaction[],\n includeAccounts?: Array<PublicKey>,\n): RpcSimulateBundleConfig {\n return {\n skipSigVerify: true,\n replaceRecentBlockhash: true,\n preExecutionAccountsConfigs: transactions.map(() => ({ addresses: [] })),\n postExecutionAccountsConfigs: transactions.map((_, index) => ({\n addresses:\n index === transactions.length - 1 && includeAccounts\n ? includeAccounts.map((account) => account.toBase58())\n : [],\n })),\n };\n}\n\nasync function executeBundleSimulation(\n rpcEndpoint: string,\n encodedTransactions: string[],\n config: RpcSimulateBundleConfig,\n): Promise<RpcSimulateBundleTransactionResult[]> {\n const response = await fetch(rpcEndpoint, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({\n jsonrpc: \"2.0\",\n id: 1,\n method: \"simulateBundle\",\n params: [{ encodedTransactions }, config],\n }),\n });\n\n if (!response.ok) {\n throw BundleSimulationError.fromHttpError(response.status, response.statusText);\n }\n\n const jsonResponse = (await response.json()) as JsonRpcResponse<RpcSimulateBundleResult>;\n\n if (\"error\" in jsonResponse) {\n throw jsonResponse.error;\n }\n\n const value = jsonResponse.result.value;\n\n if (value.summary !== \"succeeded\") {\n const logs = value.transactionResults.flatMap((tx) => tx.logs);\n\n throw new BundleSimulationError(JSON.stringify(value.summary.failed.error), logs);\n }\n\n return value.transactionResults;\n}\n","{\n \"address\": \"PyRon8FBSDSk6MxNKsZj2uZweBsa2nH5amyKnN6eN57\",\n \"metadata\": {\n \"name\": \"lendr\",\n \"version\": \"0.1.3\",\n \"spec\": \"0.1.0\",\n \"description\": \"Created with Anchor\"\n },\n \"instructions\": [\n {\n \"name\": \"config_group_fee\",\n \"docs\": [\n \"(global fee admin only) Enable or disable program fees for any group. Does not require the\",\n \"group admin to sign: the global fee state admin can turn program fees on or off for any\",\n \"group\"\n ],\n \"discriminator\": [\n 231,\n 205,\n 66,\n 242,\n 220,\n 87,\n 145,\n 38\n ],\n \"accounts\": [\n {\n \"name\": \"lendr_group\",\n \"writable\": true\n },\n {\n \"name\": \"global_fee_admin\",\n \"docs\": [\n \"`global_fee_admin` of the FeeState\"\n ],\n \"signer\": true,\n \"relations\": [\n \"fee_state\"\n ]\n },\n {\n \"name\": \"fee_state\",\n \"pda\": {\n \"seeds\": [\n {\n \"kind\": \"const\",\n \"value\": [\n 102,\n 101,\n 101,\n 115,\n 116,\n 97,\n 116,\n 101\n ]\n }\n ]\n }\n }\n ],\n \"args\": [\n {\n \"name\": \"enable_program_fee\",\n \"type\": \"bool\"\n }\n ]\n },\n {\n \"name\": \"edit_global_fee_state\",\n \"docs\": [\n \"(global fee admin only) Adjust fees, admin, or the destination wallet\"\n ],\n \"discriminator\": [\n 52,\n 62,\n 35,\n 129,\n 93,\n 69,\n 165,\n 202\n ],\n \"accounts\": [\n {\n \"name\": \"global_fee_admin\",\n \"docs\": [\n \"Admin of the global FeeState\"\n ],\n \"writable\": true,\n \"signer\": true,\n \"relations\": [\n \"fee_state\"\n ]\n },\n {\n \"name\": \"fee_state\",\n \"writable\": true,\n \"pda\": {\n \"seeds\": [\n {\n \"kind\": \"const\",\n \"value\": [\n 102,\n 101,\n 101,\n 115,\n 116,\n 97,\n 116,\n 101\n ]\n }\n ]\n }\n }\n ],\n \"args\": [\n {\n \"name\": \"admin\",\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"fee_wallet\",\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"bank_init_flat_sol_fee\",\n \"type\": \"u32\"\n },\n {\n \"name\": \"program_fee_fixed\",\n \"type\": {\n \"defined\": {\n \"name\": \"WrappedI80F48\"\n }\n }\n },\n {\n \"name\": \"program_fee_rate\",\n \"type\": {\n \"defined\": {\n \"name\": \"WrappedI80F48\"\n }\n }\n }\n ]\n },\n {\n \"name\": \"edit_staked_settings\",\n \"discriminator\": [\n 11,\n 108,\n 215,\n 87,\n 240,\n 9,\n 66,\n 241\n ],\n \"accounts\": [\n {\n \"name\": \"lendr_group\",\n \"relations\": [\n \"staked_settings\"\n ]\n },\n {\n \"name\": \"admin\",\n \"signer\": true,\n \"relations\": [\n \"lendr_group\"\n ]\n },\n {\n \"name\": \"staked_settings\",\n \"writable\": true\n }\n ],\n \"args\": [\n {\n \"name\": \"settings\",\n \"type\": {\n \"defined\": {\n \"name\": \"StakedSettingsEditConfig\"\n }\n }\n }\n ]\n },\n {\n \"name\": \"init_global_fee_state\",\n \"docs\": [\n \"(Runs once per program) Configures the fee state account, where the global admin sets fees\",\n \"that are assessed to the protocol\"\n ],\n \"discriminator\": [\n 82,\n 48,\n 247,\n 59,\n 220,\n 109,\n 231,\n 44\n ],\n \"accounts\": [\n {\n \"name\": \"payer\",\n \"docs\": [\n \"Pays the init fee\"\n ],\n \"writable\": true,\n \"signer\": true\n },\n {\n \"name\": \"fee_state\",\n \"writable\": true,\n \"pda\": {\n \"seeds\": [\n {\n \"kind\": \"const\",\n \"value\": [\n 102,\n 101,\n 101,\n 115,\n 116,\n 97,\n 116,\n 101\n ]\n }\n ]\n }\n },\n {\n \"name\": \"rent\",\n \"address\": \"SysvarRent111111111111111111111111111111111\"\n },\n {\n \"name\": \"system_program\",\n \"address\": \"11111111111111111111111111111111\"\n }\n ],\n \"args\": [\n {\n \"name\": \"admin\",\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"fee_wallet\",\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"bank_init_flat_sol_fee\",\n \"type\": \"u32\"\n },\n {\n \"name\": \"program_fee_fixed\",\n \"type\": {\n \"defined\": {\n \"name\": \"WrappedI80F48\"\n }\n }\n },\n {\n \"name\": \"program_fee_rate\",\n \"type\": {\n \"defined\": {\n \"name\": \"WrappedI80F48\"\n }\n }\n }\n ]\n },\n {\n \"name\": \"init_staked_settings\",\n \"docs\": [\n \"(group admin only) Init the Staked Settings account, which is used to create staked\",\n \"collateral banks, and must run before any staked collateral bank can be created with\",\n \"`add_pool_permissionless`. Running this ix effectively opts the group into the staked\",\n \"collateral feature.\"\n ],\n \"discriminator\": [\n 52,\n 35,\n 149,\n 44,\n 69,\n 86,\n 69,\n 80\n ],\n \"accounts\": [\n {\n \"name\": \"lendr_group\"\n },\n {\n \"name\": \"admin\",\n \"signer\": true,\n \"relations\": [\n \"lendr_group\"\n ]\n },\n {\n \"name\": \"fee_payer\",\n \"docs\": [\n \"Pays the init fee\"\n ],\n \"writable\": true,\n \"signer\": true\n },\n {\n \"name\": \"staked_settings\",\n \"writable\": true,\n \"pda\": {\n \"seeds\": [\n {\n \"kind\": \"const\",\n \"value\": [\n 115,\n 116,\n 97,\n 107,\n 101,\n 100,\n 95,\n 115,\n 101,\n 116,\n 116,\n 105,\n 110,\n 103,\n 115\n ]\n },\n {\n \"kind\": \"account\",\n \"path\": \"lendr_group\"\n }\n ]\n }\n },\n {\n \"name\": \"rent\",\n \"address\": \"SysvarRent111111111111111111111111111111111\"\n },\n {\n \"name\": \"system_program\",\n \"address\": \"11111111111111111111111111111111\"\n }\n ],\n \"args\": [\n {\n \"name\": \"settings\",\n \"type\": {\n \"defined\": {\n \"name\": \"StakedSettingsConfig\"\n }\n }\n }\n ]\n },\n {\n \"name\": \"lending_account_borrow\",\n \"discriminator\": [\n 4,\n 126,\n 116,\n 53,\n 48,\n 5,\n 212,\n 31\n ],\n \"accounts\": [\n {\n \"name\": \"group\",\n \"relations\": [\n \"lendr_account\",\n \"bank\"\n ]\n },\n {\n \"name\": \"lendr_account\",\n \"writable\": true\n },\n {\n \"name\": \"authority\",\n \"signer\": true,\n \"relations\": [\n \"lendr_account\"\n ]\n },\n {\n \"name\": \"bank\",\n \"writable\": true\n },\n {\n \"name\": \"destination_token_account\",\n \"writable\": true\n },\n {\n \"name\": \"bank_liquidity_vault_authority\",\n \"writable\": true,\n \"pda\": {\n \"seeds\": [\n {\n \"kind\": \"const\",\n \"value\": [\n 108,\n 105,\n 113,\n 117,\n 105,\n 100,\n 105,\n 116,\n 121,\n 95,\n 118,\n 97,\n 117,\n 108,\n 116,\n 95,\n 97,\n 117,\n 116,\n 104\n ]\n },\n {\n \"kind\": \"account\",\n \"path\": \"bank\"\n }\n ]\n }\n },\n {\n \"name\": \"liquidity_vault\",\n \"writable\": true,\n \"relations\": [\n \"bank\"\n ]\n },\n {\n \"name\": \"token_program\"\n }\n ],\n \"args\": [\n {\n \"name\": \"amount\",\n \"type\": \"u64\"\n }\n ]\n },\n {\n \"name\": \"lending_account_borrow_with_session\",\n \"discriminator\": [\n 179,\n 232,\n 186,\n 64,\n 240,\n 164,\n 38,\n 239\n ],\n \"accounts\": [\n {\n \"name\": \"group\",\n \"relations\": [\n \"lendr_account\",\n \"bank\"\n ]\n },\n {\n \"name\": \"lendr_account\",\n \"writable\": true\n },\n {\n \"name\": \"session_key\",\n \"signer\": true\n },\n {\n \"name\": \"bank\",\n \"writable\": true\n },\n {\n \"name\": \"destination_token_account\",\n \"writable\": true\n },\n {\n \"name\": \"bank_liquidity_vault_authority\",\n \"writable\": true,\n \"pda\": {\n \"seeds\": [\n {\n \"kind\": \"const\",\n \"value\": [\n 108,\n 105,\n 113,\n 117,\n 105,\n 100,\n 105,\n 116,\n 121,\n 95,\n 118,\n 97,\n 117,\n 108,\n 116,\n 95,\n 97,\n 117,\n 116,\n 104\n ]\n },\n {\n \"kind\": \"account\",\n \"path\": \"bank\"\n }\n ]\n }\n },\n {\n \"name\": \"liquidity_vault\",\n \"writable\": true,\n \"relations\": [\n \"bank\"\n ]\n },\n {\n \"name\": \"token_program\"\n }\n ],\n \"args\": [\n {\n \"name\": \"amount\",\n \"type\": \"u64\"\n }\n ]\n },\n {\n \"name\": \"lending_account_close_balance\",\n \"discriminator\": [\n 245,\n 54,\n 41,\n 4,\n 243,\n 202,\n 31,\n 17\n ],\n \"accounts\": [\n {\n \"name\": \"group\",\n \"relations\": [\n \"lendr_account\",\n \"bank\"\n ]\n },\n {\n \"name\": \"lendr_account\",\n \"writable\": true\n },\n {\n \"name\": \"authority\",\n \"signer\": true,\n \"relations\": [\n \"lendr_account\"\n ]\n },\n {\n \"name\": \"bank\",\n \"writable\": true\n }\n ],\n \"args\": []\n },\n {\n \"name\": \"lending_account_deposit\",\n \"discriminator\": [\n 171,\n 94,\n 235,\n 103,\n 82,\n 64,\n 212,\n 140\n ],\n \"accounts\": [\n {\n \"name\": \"group\",\n \"relations\": [\n \"lendr_account\",\n \"bank\"\n ]\n },\n {\n \"name\": \"lendr_account\",\n \"writable\": true\n },\n {\n \"name\": \"authority\",\n \"signer\": true,\n \"relations\": [\n \"lendr_account\"\n ]\n },\n {\n \"name\": \"bank\",\n \"writable\": true\n },\n {\n \"name\": \"signer_token_account\",\n \"writable\": true\n },\n {\n \"name\": \"liquidity_vault\",\n \"writable\": true,\n \"relations\": [\n \"bank\"\n ]\n },\n {\n \"name\": \"token_program\"\n }\n ],\n \"args\": [\n {\n \"name\": \"amount\",\n \"type\": \"u64\"\n },\n {\n \"name\": \"deposit_up_to_limit\",\n \"type\": {\n \"option\": \"bool\"\n }\n }\n ]\n },\n {\n \"name\": \"lending_account_deposit_with_session\",\n \"discriminator\": [\n 153,\n 216,\n 61,\n 80,\n 90,\n 79,\n 231,\n 9\n ],\n \"accounts\": [\n {\n \"name\": \"session_key\",\n \"signer\": true\n },\n {\n \"name\": \"program_signer\",\n \"pda\": {\n \"seeds\": [\n {\n \"kind\": \"const\",\n \"value\": [\n 102,\n 111,\n 103,\n 111,\n 95,\n 115,\n 101,\n 115,\n 115,\n 105,\n 111,\n 110,\n 95,\n 112,\n 114,\n 111,\n 103,\n 114,\n 97,\n 109,\n 95,\n 115,\n 105,\n 103,\n 110,\n 101,\n 114\n ]\n }\n ]\n }\n },\n {\n \"name\": \"group\",\n \"relations\": [\n \"lendr_account\",\n \"bank\"\n ]\n },\n {\n \"name\": \"lendr_account\",\n \"writable\": true\n },\n {\n \"name\": \"bank\",\n \"writable\": true\n },\n {\n \"name\": \"signer_token_account\",\n \"writable\": true\n },\n {\n \"name\": \"liquidity_vault\",\n \"writable\": true,\n \"relations\": [\n \"bank\"\n ]\n },\n {\n \"name\": \"token_program\"\n }\n ],\n \"args\": [\n {\n \"name\": \"amount\",\n \"type\": \"u64\"\n },\n {\n \"name\": \"deposit_up_to_limit\",\n \"type\": {\n \"option\": \"bool\"\n }\n }\n ]\n },\n {\n \"name\": \"lending_account_end_flashloan\",\n \"discriminator\": [\n 105,\n 124,\n 201,\n 106,\n 153,\n 2,\n 8,\n 156\n ],\n \"accounts\": [\n {\n \"name\": \"lendr_account\",\n \"writable\": true\n },\n {\n \"name\": \"authority\",\n \"signer\": true,\n \"relations\": [\n \"lendr_account\"\n ]\n }\n ],\n \"args\": []\n },\n {\n \"name\": \"lending_account_liquidate\",\n \"docs\": [\n \"Liquidate a lending account balance of an unhealthy lendr account\"\n ],\n \"discriminator\": [\n 214,\n 169,\n 151,\n 213,\n 251,\n 167,\n 86,\n 219\n ],\n \"accounts\": [\n {\n \"name\": \"group\",\n \"relations\": [\n \"asset_bank\",\n \"liab_bank\",\n \"liquidator_lendr_account\",\n \"liquidatee_lendr_account\"\n ]\n },\n {\n \"name\": \"asset_bank\",\n \"writable\": true\n },\n {\n \"name\": \"liab_bank\",\n \"writable\": true\n },\n {\n \"name\": \"liquidator_lendr_account\",\n \"writable\": true\n },\n {\n \"name\": \"authority\",\n \"signer\": true,\n \"relations\": [\n \"liquidator_lendr_account\"\n ]\n },\n {\n \"name\": \"liquidatee_lendr_account\",\n \"writable\": true\n },\n {\n \"name\": \"bank_liquidity_vault_authority\",\n \"writable\": true,\n \"pda\": {\n \"seeds\": [\n {\n \"kind\": \"const\",\n \"value\": [\n 108,\n 105,\n 113,\n 117,\n 105,\n 100,\n 105,\n 116,\n 121,\n 95,\n 118,\n 97,\n 117,\n 108,\n 116,\n 95,\n 97,\n 117,\n 116,\n 104\n ]\n },\n {\n \"kind\": \"account\",\n \"path\": \"liab_bank\"\n }\n ]\n }\n },\n {\n \"name\": \"bank_liquidity_vault\",\n \"writable\": true,\n \"pda\": {\n \"seeds\": [\n {\n \"kind\": \"const\",\n \"value\": [\n 108,\n 105,\n 113,\n 117,\n 105,\n 100,\n 105,\n 116,\n 121,\n 95,\n 118,\n 97,\n 117,\n 108,\n 116\n ]\n },\n {\n \"kind\": \"account\",\n \"path\": \"liab_bank\"\n }\n ]\n }\n },\n {\n \"name\": \"bank_insurance_vault\",\n \"writable\": true,\n \"pda\": {\n \"seeds\": [\n {\n \"kind\": \"const\",\n \"value\": [\n 105,\n 110,\n 115,\n 117,\n 114,\n 97,\n 110,\n 99,\n 101,\n 95,\n 118,\n 97,\n 117,\n 108,\n 116\n ]\n },\n {\n \"kind\": \"account\",\n \"path\": \"liab_bank\"\n }\n ]\n }\n },\n {\n \"name\": \"token_program\"\n }\n ],\n \"args\": [\n {\n \"name\": \"asset_amount\",\n \"type\": \"u64\"\n }\n ]\n },\n {\n \"name\": \"lending_account_pulse_health\",\n \"docs\": [\n \"(Permissionless) Refresh the internal risk engine health cache. Useful for liquidators and\",\n \"other consumers that want to see the internal risk state of a user account. This cache is\",\n \"read-only and serves no purpose except being populated by this ix.\",\n \"* remaining accounts expected in the same order as borrow, etc. I.e., for each balance the\",\n \"user has, pass bank and oracle: <bank1, oracle1, bank2, oracle2>\"\n ],\n \"discriminator\": [\n 186,\n 52,\n 117,\n 97,\n 34,\n 74,\n 39,\n 253\n ],\n \"accounts\": [\n {\n \"name\": \"lendr_account\",\n \"writable\": true\n }\n ],\n \"args\": []\n },\n {\n \"name\": \"lending_account_repay\",\n \"discriminator\": [\n 79,\n 209,\n 172,\n 177,\n 222,\n 51,\n 173,\n 151\n ],\n \"accounts\": [\n {\n \"name\": \"group\",\n \"relations\": [\n \"lendr_account\",\n \"bank\"\n ]\n },\n {\n \"name\": \"lendr_account\",\n \"writable\": true\n },\n {\n \"name\": \"authority\",\n \"signer\": true,\n \"relations\": [\n \"lendr_account\"\n ]\n },\n {\n \"name\": \"bank\",\n \"writable\": true\n },\n {\n \"name\": \"signer_token_account\",\n \"writable\": true\n },\n {\n \"name\": \"liquidity_vault\",\n \"writable\": true,\n \"relations\": [\n \"bank\"\n ]\n },\n {\n \"name\": \"token_program\"\n }\n ],\n \"args\": [\n {\n \"name\": \"amount\",\n \"type\": \"u64\"\n },\n {\n \"name\": \"repay_all\",\n \"type\": {\n \"option\": \"bool\"\n }\n }\n ]\n },\n {\n \"name\": \"lending_account_repay_with_session\",\n \"discriminator\": [\n 51,\n 20,\n 37,\n 1,\n 21,\n 34,\n 99,\n 220\n ],\n \"accounts\": [\n {\n \"name\": \"group\",\n \"relations\": [\n \"lendr_account\",\n \"bank\"\n ]\n },\n {\n \"name\": \"lendr_account\",\n \"writable\": true\n },\n {\n \"name\": \"session_key\",\n \"signer\": true\n },\n {\n \"name\": \"program_signer\",\n \"pda\": {\n \"seeds\": [\n {\n \"kind\": \"const\",\n \"value\": [\n 102,\n 111,\n 103,\n 111,\n 95,\n 115,\n 101,\n 115,\n 115,\n 105,\n 111,\n 110,\n 95,\n 112,\n 114,\n 111,\n 103,\n 114,\n 97,\n 109,\n 95,\n 115,\n 105,\n 103,\n 110,\n 101,\n 114\n ]\n }\n ]\n }\n },\n {\n \"name\": \"bank\",\n \"writable\": true\n },\n {\n \"name\": \"signer_token_account\",\n \"writable\": true\n },\n {\n \"name\": \"liquidity_vault\",\n \"writable\": true,\n \"relations\": [\n \"bank\"\n ]\n },\n {\n \"name\": \"token_program\"\n }\n ],\n \"args\": [\n {\n \"name\": \"amount\",\n \"type\": \"u64\"\n },\n {\n \"name\": \"repay_all\",\n \"type\": {\n \"option\": \"bool\"\n }\n }\n ]\n },\n {\n \"name\": \"lending_account_settle_emissions\",\n \"discriminator\": [\n 161,\n 58,\n 136,\n 174,\n 242,\n 223,\n 156,\n 176\n ],\n \"accounts\": [\n {\n \"name\": \"lendr_account\",\n \"writable\": true\n },\n {\n \"name\": \"bank\",\n \"writable\": true\n }\n ],\n \"args\": []\n },\n {\n \"name\": \"lending_account_sort_balances\",\n \"docs\": [\n \"(Permissionless) Sorts the lending account balances in descending order and removes the \\\"gaps\\\"\",\n \"(i.e. inactive balances in between the active ones), if any.\",\n \"This is necessary to ensure any legacy lendr accounts are compliant with the\",\n \"\\\"gapless and sorted\\\" requirements we now have.\"\n ],\n \"discriminator\": [\n 187,\n 194,\n 110,\n 84,\n 82,\n 170,\n 204,\n 9\n ],\n \"accounts\": [\n {\n \"name\": \"lendr_account\",\n \"writable\": true\n }\n ],\n \"args\": []\n },\n {\n \"name\": \"lending_account_start_flashloan\",\n \"discriminator\": [\n 14,\n 131,\n 33,\n 220,\n 81,\n 186,\n 180,\n 107\n ],\n \"accounts\": [\n {\n \"name\": \"lendr_account\",\n \"writable\": true\n },\n {\n \"name\": \"authority\",\n \"signer\": true,\n \"relations\": [\n \"lendr_account\"\n ]\n },\n {\n \"name\": \"ixs_sysvar\",\n \"address\": \"Sysvar1nstructions1111111111111111111111111\"\n }\n ],\n \"args\": [\n {\n \"name\": \"end_index\",\n \"type\": \"u64\"\n }\n ]\n },\n {\n \"name\": \"lending_account_withdraw\",\n \"discriminator\": [\n 36,\n 72,\n 74,\n 19,\n 210,\n 210,\n 192,\n 192\n ],\n \"accounts\": [\n {\n \"name\": \"group\",\n \"relations\": [\n \"lendr_account\",\n \"bank\"\n ]\n },\n {\n \"name\": \"lendr_account\",\n \"writable\": true\n },\n {\n \"name\": \"authority\",\n \"signer\": true,\n \"relations\": [\n \"lendr_account\"\n ]\n },\n {\n \"name\": \"bank\",\n \"writable\": true\n },\n {\n \"name\": \"destination_token_account\",\n \"writable\": true\n },\n {\n \"name\": \"bank_liquidity_vault_authority\",\n \"pda\": {\n \"seeds\": [\n {\n \"kind\": \"const\",\n \"value\": [\n 108,\n 105,\n 113,\n 117,\n 105,\n 100,\n 105,\n 116,\n 121,\n 95,\n 118,\n 97,\n 117,\n 108,\n 116,\n 95,\n 97,\n 117,\n 116,\n 104\n ]\n },\n {\n \"kind\": \"account\",\n \"path\": \"bank\"\n }\n ]\n }\n },\n {\n \"name\": \"liquidity_vault\",\n \"writable\": true,\n \"relations\": [\n \"bank\"\n ]\n },\n {\n \"name\": \"token_program\"\n }\n ],\n \"args\": [\n {\n \"name\": \"amount\",\n \"type\": \"u64\"\n },\n {\n \"name\": \"withdraw_all\",\n \"type\": {\n \"option\": \"bool\"\n }\n }\n ]\n },\n {\n \"name\": \"lending_account_withdraw_emissions\",\n \"discriminator\": [\n 234,\n 22,\n 84,\n 214,\n 118,\n 176,\n 140,\n 170\n ],\n \"accounts\": [\n {\n \"name\": \"group\",\n \"relations\": [\n \"lendr_account\",\n \"bank\"\n ]\n },\n {\n \"name\": \"lendr_account\",\n \"writable\": true\n },\n {\n \"name\": \"authority\",\n \"signer\": true,\n \"relations\": [\n \"lendr_account\"\n ]\n },\n {\n \"name\": \"bank\",\n \"writable\": true\n },\n {\n \"name\": \"emissions_mint\",\n \"relations\": [\n \"bank\"\n ]\n },\n {\n \"name\": \"emissions_auth\",\n \"pda\": {\n \"seeds\": [\n {\n \"kind\": \"const\",\n \"value\": [\n 101,\n 109,\n 105,\n 115,\n 115,\n 105,\n 111,\n 110,\n 115,\n 95,\n 97,\n 117,\n 116,\n 104,\n 95,\n 115,\n 101,\n 101,\n 100\n ]\n },\n {\n \"kind\": \"account\",\n \"path\": \"bank\"\n },\n {\n \"kind\": \"account\",\n \"path\": \"emissions_mint\"\n }\n ]\n }\n },\n {\n \"name\": \"emissions_vault\",\n \"writable\": true,\n \"pda\": {\n \"seeds\": [\n {\n \"kind\": \"const\",\n \"value\": [\n 101,\n 109,\n 105,\n 115,\n 115,\n 105,\n 111,\n 110,\n 115,\n 95,\n 116,\n 111,\n 107,\n 101,\n 110,\n 95,\n 97,\n 99,\n 99,\n 111,\n 117,\n 110,\n 116,\n 95,\n 115,\n 101,\n 101,\n 100\n ]\n },\n {\n \"kind\": \"account\",\n \"path\": \"bank\"\n },\n {\n \"kind\": \"account\",\n \"path\": \"emissions_mint\"\n }\n ]\n }\n },\n {\n \"name\": \"destination_account\",\n \"writable\": true\n },\n {\n \"name\": \"token_program\"\n }\n ],\n \"args\": []\n },\n {\n \"name\": \"lending_account_withdraw_emissions_permissionless\",\n \"discriminator\": [\n 4,\n 174,\n 124,\n 203,\n 44,\n 49,\n 145,\n 150\n ],\n \"accounts\": [\n {\n \"name\": \"group\",\n \"relations\": [\n \"lendr_account\",\n \"bank\"\n ]\n },\n {\n \"name\": \"lendr_account\",\n \"writable\": true\n },\n {\n \"name\": \"bank\",\n \"writable\": true\n },\n {\n \"name\": \"emissions_mint\",\n \"relations\": [\n \"bank\"\n ]\n },\n {\n \"name\": \"emissions_auth\",\n \"pda\": {\n \"seeds\": [\n {\n \"kind\": \"const\",\n \"value\": [\n 101,\n 109,\n 105,\n 115,\n 115,\n 105,\n 111,\n 110,\n 115,\n 95,\n 97,\n 117,\n 116,\n 104,\n 95,\n 115,\n 101,\n 101,\n 100\n ]\n },\n {\n \"kind\": \"account\",\n \"path\": \"bank\"\n },\n {\n \"kind\": \"account\",\n \"path\": \"emissions_mint\"\n }\n ]\n }\n },\n {\n \"name\": \"emissions_vault\",\n \"writable\": true,\n \"pda\": {\n \"seeds\": [\n {\n \"kind\": \"const\",\n \"value\": [\n 101,\n 109,\n 105,\n 115,\n 115,\n 105,\n 111,\n 110,\n 115,\n 95,\n 116,\n 111,\n 107,\n 101,\n 110,\n 95,\n 97,\n 99,\n 99,\n 111,\n 117,\n 110,\n 116,\n 95,\n 115,\n 101,\n 101,\n 100\n ]\n },\n {\n \"kind\": \"account\",\n \"path\": \"bank\"\n },\n {\n \"kind\": \"account\",\n \"path\": \"emissions_mint\"\n }\n ]\n }\n },\n {\n \"name\": \"destination_account\",\n \"docs\": [\n \"registered on `lendr_account`\"\n ],\n \"writable\": true\n },\n {\n \"name\": \"token_program\"\n }\n ],\n \"args\": []\n },\n {\n \"name\": \"lending_account_withdraw_with_session\",\n \"discriminator\": [\n 216,\n 198,\n 219,\n 161,\n 103,\n 159,\n 134,\n 6\n ],\n \"accounts\": [\n {\n \"name\": \"group\",\n \"relations\": [\n \"lendr_account\",\n \"bank\"\n ]\n },\n {\n \"name\": \"lendr_account\",\n \"writable\": true\n },\n {\n \"name\": \"session_key\",\n \"signer\": true\n },\n {\n \"name\": \"bank\",\n \"writable\": true\n },\n {\n \"name\": \"destination_token_account\",\n \"writable\": true\n },\n {\n \"name\": \"bank_liquidity_vault_authority\",\n \"pda\": {\n \"seeds\": [\n {\n \"kind\": \"const\",\n \"value\": [\n 108,\n 105,\n 113,\n 117,\n 105,\n 100,\n 105,\n 116,\n 121,\n 95,\n 118,\n 97,\n 117,\n 108,\n 116,\n 95,\n 97,\n 117,\n 116,\n 104\n ]\n },\n {\n \"kind\": \"account\",\n \"path\": \"bank\"\n }\n ]\n }\n },\n {\n \"name\": \"liquidity_vault\",\n \"writable\": true,\n \"relations\": [\n \"bank\"\n ]\n },\n {\n \"name\": \"token_program\"\n }\n ],\n \"args\": [\n {\n \"name\": \"amount\",\n \"type\": \"u64\"\n },\n {\n \"name\": \"withdraw_all\",\n \"type\": {\n \"option\": \"bool\"\n }\n }\n ]\n },\n {\n \"name\": \"lending_pool_accrue_bank_interest\",\n \"discriminator\": [\n 108,\n 201,\n 30,\n 87,\n 47,\n 65,\n 97,\n 188\n ],\n \"accounts\": [\n {\n \"name\": \"group\",\n \"relations\": [\n \"bank\"\n ]\n },\n {\n \"name\": \"bank\",\n \"writable\": true\n }\n ],\n \"args\": []\n },\n {\n \"name\": \"lending_pool_add_bank\",\n \"discriminator\": [\n 215,\n 68,\n 72,\n 78,\n 208,\n 218,\n 103,\n 182\n ],\n \"accounts\": [\n {\n \"name\": \"lendr_group\",\n \"writable\": true\n },\n {\n \"name\": \"admin\",\n \"writable\": true,\n \"signer\": true,\n \"relations\": [\n \"lendr_group\"\n ]\n },\n {\n \"name\": \"fee_payer\",\n \"docs\": [\n \"Pays to init accounts and pays `fee_state.bank_init_flat_sol_fee` lamports to the protocol\"\n ],\n \"writable\": true,\n \"signer\": true\n },\n {\n \"name\": \"fee_state\",\n \"pda\": {\n \"seeds\": [\n {\n \"kind\": \"const\",\n \"value\": [\n 102,\n 101,\n 101,\n 115,\n 116,\n 97,\n 116,\n 101\n ]\n }\n ]\n }\n },\n {\n \"name\": \"global_fee_wallet\",\n \"writable\": true,\n \"relations\": [\n \"fee_state\"\n ]\n },\n {\n \"name\": \"bank_mint\"\n },\n {\n \"name\": \"bank\",\n \"writable\": true,\n \"signer\": true\n },\n {\n \"name\": \"liquidity_vault_authority\",\n \"pda\": {\n \"seeds\": [\n {\n \"kind\": \"const\",\n \"value\": [\n 108,\n 105,\n 113,\n 117,\n 105,\n 100,\n 105,\n 116,\n 121,\n 95,\n 118,\n 97,\n 117,\n 108,\n 116,\n 95,\n 97,\n 117,\n 116,\n 104\n ]\n },\n {\n \"kind\": \"account\",\n \"path\": \"bank\"\n }\n ]\n }\n },\n {\n \"name\": \"liquidity_vault\",\n \"writable\": true,\n \"pda\": {\n \"seeds\": [\n {\n \"kind\": \"const\",\n \"value\": [\n 108,\n 105,\n 113,\n 117,\n 105,\n 100,\n 105,\n 116,\n 121,\n 95,\n 118,\n 97,\n 117,\n 108,\n 116\n ]\n },\n {\n \"kind\": \"account\",\n \"path\": \"bank\"\n }\n ]\n }\n },\n {\n \"name\": \"insurance_vault_authority\",\n \"pda\": {\n \"seeds\": [\n {\n \"kind\": \"const\",\n \"value\": [\n 105,\n 110,\n 115,\n 117,\n 114,\n 97,\n 110,\n 99,\n 101,\n 95,\n 118,\n 97,\n 117,\n 108,\n 116,\n 95,\n 97,\n 117,\n 116,\n 104\n ]\n },\n {\n \"kind\": \"account\",\n \"path\": \"bank\"\n }\n ]\n }\n },\n {\n \"name\": \"insurance_vault\",\n \"writable\": true,\n \"pda\": {\n \"seeds\": [\n {\n \"kind\": \"const\",\n \"value\": [\n 105,\n 110,\n 115,\n 117,\n 114,\n 97,\n 110,\n 99,\n 101,\n 95,\n 118,\n 97,\n 117,\n 108,\n 116\n ]\n },\n {\n \"kind\": \"account\",\n \"path\": \"bank\"\n }\n ]\n }\n },\n {\n \"name\": \"fee_vault_authority\",\n \"pda\": {\n \"seeds\": [\n {\n \"kind\": \"const\",\n \"value\": [\n 102,\n 101,\n 101,\n 95,\n 118,\n 97,\n 117,\n 108,\n 116,\n 95,\n 97,\n 117,\n 116,\n 104\n ]\n },\n {\n \"kind\": \"account\",\n \"path\": \"bank\"\n }\n ]\n }\n },\n {\n \"name\": \"fee_vault\",\n \"writable\": true,\n \"pda\": {\n \"seeds\": [\n {\n \"kind\": \"const\",\n \"value\": [\n 102,\n 101,\n 101,\n 95,\n 118,\n 97,\n 117,\n 108,\n 116\n ]\n },\n {\n \"kind\": \"account\",\n \"path\": \"bank\"\n }\n ]\n }\n },\n {\n \"name\": \"rent\",\n \"address\": \"SysvarRent111111111111111111111111111111111\"\n },\n {\n \"name\": \"token_program\"\n },\n {\n \"name\": \"system_program\",\n \"address\": \"11111111111111111111111111111111\"\n }\n ],\n \"args\": [\n {\n \"name\": \"bank_config\",\n \"type\": {\n \"defined\": {\n \"name\": \"BankConfigCompact\"\n }\n }\n }\n ]\n },\n {\n \"name\": \"lending_pool_add_bank_permissionless\",\n \"discriminator\": [\n 127,\n 187,\n 121,\n 34,\n 187,\n 167,\n 238,\n 102\n ],\n \"accounts\": [\n {\n \"name\": \"lendr_group\",\n \"writable\": true,\n \"relations\": [\n \"staked_settings\"\n ]\n },\n {\n \"name\": \"staked_settings\"\n },\n {\n \"name\": \"fee_payer\",\n \"writable\": true,\n \"signer\": true\n },\n {\n \"name\": \"bank_mint\",\n \"docs\": [\n \"Mint of the spl-single-pool LST (a PDA derived from `stake_pool`)\",\n \"\",\n \"because the sol_pool and stake_pool will not derive to a valid PDA which is also owned by\",\n \"the staking program and spl-single-pool program.\"\n ]\n },\n {\n \"name\": \"sol_pool\"\n },\n {\n \"name\": \"stake_pool\",\n \"docs\": [\n \"this key.\",\n \"\",\n \"If derives the same `bank_mint`, then this must be the correct stake pool for that mint, and\",\n \"we can subsequently use it to validate the `sol_pool`\"\n ]\n },\n {\n \"name\": \"bank\",\n \"writable\": true,\n \"pda\": {\n \"seeds\": [\n {\n \"kind\": \"account\",\n \"path\": \"lendr_group\"\n },\n {\n \"kind\": \"account\",\n \"path\": \"bank_mint\"\n },\n {\n \"kind\": \"arg\",\n \"path\": \"bank_seed\"\n }\n ]\n }\n },\n {\n \"name\": \"liquidity_vault_authority\",\n \"pda\": {\n \"seeds\": [\n {\n \"kind\": \"const\",\n \"value\": [\n 108,\n 105,\n 113,\n 117,\n 105,\n 100,\n 105,\n 116,\n 121,\n 95,\n 118,\n 97,\n 117,\n 108,\n 116,\n 95,\n 97,\n 117,\n 116,\n 104\n ]\n },\n {\n \"kind\": \"account\",\n \"path\": \"bank\"\n }\n ]\n }\n },\n {\n \"name\": \"liquidity_vault\",\n \"writable\": true,\n \"pda\": {\n \"seeds\": [\n {\n \"kind\": \"const\",\n \"value\": [\n 108,\n 105,\n 113,\n 117,\n 105,\n 100,\n 105,\n 116,\n 121,\n 95,\n 118,\n 97,\n 117,\n 108,\n 116\n ]\n },\n {\n \"kind\": \"account\",\n \"path\": \"bank\"\n }\n ]\n }\n },\n {\n \"name\": \"insurance_vault_authority\",\n \"pda\": {\n \"seeds\": [\n {\n \"kind\": \"const\",\n \"value\": [\n 105,\n 110,\n 115,\n 117,\n 114,\n 97,\n 110,\n 99,\n 101,\n 95,\n 118,\n 97,\n 117,\n 108,\n 116,\n 95,\n 97,\n 117,\n 116,\n 104\n ]\n },\n {\n \"kind\": \"account\",\n \"path\": \"bank\"\n }\n ]\n }\n },\n {\n \"name\": \"insurance_vault\",\n \"writable\": true,\n \"pda\": {\n \"seeds\": [\n {\n \"kind\": \"const\",\n \"value\": [\n 105,\n 110,\n 115,\n 117,\n 114,\n 97,\n 110,\n 99,\n 101,\n 95,\n 118,\n 97,\n 117,\n 108,\n 116\n ]\n },\n {\n \"kind\": \"account\",\n \"path\": \"bank\"\n }\n ]\n }\n },\n {\n \"name\": \"fee_vault_authority\",\n \"pda\": {\n \"seeds\": [\n {\n \"kind\": \"const\",\n \"value\": [\n 102,\n 101,\n 101,\n 95,\n 118,\n 97,\n 117,\n 108,\n 116,\n 95,\n 97,\n 117,\n 116,\n 104\n ]\n },\n {\n \"kind\": \"account\",\n \"path\": \"bank\"\n }\n ]\n }\n },\n {\n \"name\": \"fee_vault\",\n \"writable\": true,\n \"pda\": {\n \"seeds\": [\n {\n \"kind\": \"const\",\n \"value\": [\n 102,\n 101,\n 101,\n 95,\n 118,\n 97,\n 117,\n 108,\n 116\n ]\n },\n {\n \"kind\": \"account\",\n \"path\": \"bank\"\n }\n ]\n }\n },\n {\n \"name\": \"rent\",\n \"address\": \"SysvarRent111111111111111111111111111111111\"\n },\n {\n \"name\": \"token_program\"\n },\n {\n \"name\": \"system_program\",\n \"address\": \"11111111111111111111111111111111\"\n }\n ],\n \"args\": [\n {\n \"name\": \"bank_seed\",\n \"type\": \"u64\"\n }\n ]\n },\n {\n \"name\": \"lending_pool_add_bank_with_seed\",\n \"docs\": [\n \"A copy of lending_pool_add_bank with an additional bank seed.\",\n \"This seed is used to create a PDA for the bank's signature.\",\n \"lending_pool_add_bank is preserved for backwards compatibility.\"\n ],\n \"discriminator\": [\n 76,\n 211,\n 213,\n 171,\n 117,\n 78,\n 158,\n 76\n ],\n \"accounts\": [\n {\n \"name\": \"lendr_group\",\n \"writable\": true\n },\n {\n \"name\": \"admin\",\n \"writable\": true,\n \"signer\": true,\n \"relations\": [\n \"lendr_group\"\n ]\n },\n {\n \"name\": \"fee_payer\",\n \"docs\": [\n \"Pays to init accounts and pays `fee_state.bank_init_flat_sol_fee` lamports to the protocol\"\n ],\n \"writable\": true,\n \"signer\": true\n },\n {\n \"name\": \"fee_state\",\n \"pda\": {\n \"seeds\": [\n {\n \"kind\": \"const\",\n \"value\": [\n 102,\n 101,\n 101,\n 115,\n 116,\n 97,\n 116,\n 101\n ]\n }\n ]\n }\n },\n {\n \"name\": \"global_fee_wallet\",\n \"writable\": true,\n \"relations\": [\n \"fee_state\"\n ]\n },\n {\n \"name\": \"bank_mint\"\n },\n {\n \"name\": \"bank\",\n \"writable\": true,\n \"pda\": {\n \"seeds\": [\n {\n \"kind\": \"account\",\n \"path\": \"lendr_group\"\n },\n {\n \"kind\": \"account\",\n \"path\": \"bank_mint\"\n },\n {\n \"kind\": \"arg\",\n \"path\": \"bank_seed\"\n }\n ]\n }\n },\n {\n \"name\": \"liquidity_vault_authority\",\n \"pda\": {\n \"seeds\": [\n {\n \"kind\": \"const\",\n \"value\": [\n 108,\n 105,\n 113,\n 117,\n 105,\n 100,\n 105,\n 116,\n 121,\n 95,\n 118,\n 97,\n 117,\n 108,\n 116,\n 95,\n 97,\n 117,\n 116,\n 104\n ]\n },\n {\n \"kind\": \"account\",\n \"path\": \"bank\"\n }\n ]\n }\n },\n {\n \"name\": \"liquidity_vault\",\n \"writable\": true,\n \"pda\": {\n \"seeds\": [\n {\n \"kind\": \"const\",\n \"value\": [\n 108,\n 105,\n 113,\n 117,\n 105,\n 100,\n 105,\n 116,\n 121,\n 95,\n 118,\n 97,\n 117,\n 108,\n 116\n ]\n },\n {\n \"kind\": \"account\",\n \"path\": \"bank\"\n }\n ]\n }\n },\n {\n \"name\": \"insurance_vault_authority\",\n \"pda\": {\n \"seeds\": [\n {\n \"kind\": \"const\",\n \"value\": [\n 105,\n 110,\n 115,\n 117,\n 114,\n 97,\n 110,\n 99,\n 101,\n 95,\n 118,\n 97,\n 117,\n 108,\n 116,\n 95,\n 97,\n 117,\n 116,\n 104\n ]\n },\n {\n \"kind\": \"account\",\n \"path\": \"bank\"\n }\n ]\n }\n },\n {\n \"name\": \"insurance_vault\",\n \"writable\": true,\n \"pda\": {\n \"seeds\": [\n {\n \"kind\": \"const\",\n \"value\": [\n 105,\n 110,\n 115,\n 117,\n 114,\n 97,\n 110,\n 99,\n 101,\n 95,\n 118,\n 97,\n 117,\n 108,\n 116\n ]\n },\n {\n \"kind\": \"account\",\n \"path\": \"bank\"\n }\n ]\n }\n },\n {\n \"name\": \"fee_vault_authority\",\n \"pda\": {\n \"seeds\": [\n {\n \"kind\": \"const\",\n \"value\": [\n 102,\n 101,\n 101,\n 95,\n 118,\n 97,\n 117,\n 108,\n 116,\n 95,\n 97,\n 117,\n 116,\n 104\n ]\n },\n {\n \"kind\": \"account\",\n \"path\": \"bank\"\n }\n ]\n }\n },\n {\n \"name\": \"fee_vault\",\n \"writable\": true,\n \"pda\": {\n \"seeds\": [\n {\n \"kind\": \"const\",\n \"value\": [\n 102,\n 101,\n 101,\n 95,\n 118,\n 97,\n 117,\n 108,\n 116\n ]\n },\n {\n \"kind\": \"account\",\n \"path\": \"bank\"\n }\n ]\n }\n },\n {\n \"name\": \"rent\",\n \"address\": \"SysvarRent111111111111111111111111111111111\"\n },\n {\n \"name\": \"token_program\"\n },\n {\n \"name\": \"system_program\",\n \"address\": \"11111111111111111111111111111111\"\n }\n ],\n \"args\": [\n {\n \"name\": \"bank_config\",\n \"type\": {\n \"defined\": {\n \"name\": \"BankConfigCompact\"\n }\n }\n },\n {\n \"name\": \"bank_seed\",\n \"type\": \"u64\"\n }\n ]\n },\n {\n \"name\": \"lending_pool_collect_bank_fees\",\n \"discriminator\": [\n 201,\n 5,\n 215,\n 116,\n 230,\n 92,\n 75,\n 150\n ],\n \"accounts\": [\n {\n \"name\": \"group\",\n \"relations\": [\n \"bank\"\n ]\n },\n {\n \"name\": \"bank\",\n \"writable\": true\n },\n {\n \"name\": \"liquidity_vault_authority\",\n \"pda\": {\n \"seeds\": [\n {\n \"kind\": \"const\",\n \"value\": [\n 108,\n 105,\n 113,\n 117,\n 105,\n 100,\n 105,\n 116,\n 121,\n 95,\n 118,\n 97,\n 117,\n 108,\n 116,\n 95,\n 97,\n 117,\n 116,\n 104\n ]\n },\n {\n \"kind\": \"account\",\n \"path\": \"bank\"\n }\n ]\n }\n },\n {\n \"name\": \"liquidity_vault\",\n \"writable\": true,\n \"pda\": {\n \"seeds\": [\n {\n \"kind\": \"const\",\n \"value\": [\n 108,\n 105,\n 113,\n 117,\n 105,\n 100,\n 105,\n 116,\n 121,\n 95,\n 118,\n 97,\n 117,\n 108,\n 116\n ]\n },\n {\n \"kind\": \"account\",\n \"path\": \"bank\"\n }\n ]\n }\n },\n {\n \"name\": \"insurance_vault\",\n \"writable\": true,\n \"pda\": {\n \"seeds\": [\n {\n \"kind\": \"const\",\n \"value\": [\n 105,\n 110,\n 115,\n 117,\n 114,\n 97,\n 110,\n 99,\n 101,\n 95,\n 118,\n 97,\n 117,\n 108,\n 116\n ]\n },\n {\n \"kind\": \"account\",\n \"path\": \"bank\"\n }\n ]\n }\n },\n {\n \"name\": \"fee_vault\",\n \"writable\": true,\n \"pda\": {\n \"seeds\": [\n {\n \"kind\": \"const\",\n \"value\": [\n 102,\n 101,\n 101,\n 95,\n 118,\n 97,\n 117,\n 108,\n 116\n ]\n },\n {\n \"kind\": \"account\",\n \"path\": \"bank\"\n }\n ]\n }\n },\n {\n \"name\": \"fee_state\",\n \"pda\": {\n \"seeds\": [\n {\n \"kind\": \"const\",\n \"value\": [\n 102,\n 101,\n 101,\n 115,\n 116,\n 97,\n 116,\n 101\n ]\n }\n ]\n }\n },\n {\n \"name\": \"fee_ata\",\n \"docs\": [\n \"(validated in handler). Must already exist, may require initializing the ATA if it does not\",\n \"already exist prior to this ix.\"\n ],\n \"writable\": true\n },\n {\n \"name\": \"token_program\"\n }\n ],\n \"args\": []\n },\n {\n \"name\": \"lending_pool_configure_bank\",\n \"discriminator\": [\n 121,\n 173,\n 156,\n 40,\n 93,\n 148,\n 56,\n 237\n ],\n \"accounts\": [\n {\n \"name\": \"group\",\n \"writable\": true,\n \"relations\": [\n \"bank\"\n ]\n },\n {\n \"name\": \"admin\",\n \"signer\": true,\n \"relations\": [\n \"group\"\n ]\n },\n {\n \"name\": \"bank\",\n \"writable\": true\n }\n ],\n \"args\": [\n {\n \"name\": \"bank_config_opt\",\n \"type\": {\n \"defined\": {\n \"name\": \"BankConfigOpt\"\n }\n }\n }\n ]\n },\n {\n \"name\": \"lending_pool_configure_bank_emode\",\n \"discriminator\": [\n 17,\n 175,\n 91,\n 57,\n 239,\n 86,\n 49,\n 71\n ],\n \"accounts\": [\n {\n \"name\": \"group\",\n \"relations\": [\n \"bank\"\n ]\n },\n {\n \"name\": \"emode_admin\",\n \"signer\": true,\n \"relations\": [\n \"group\"\n ]\n },\n {\n \"name\": \"bank\",\n \"writable\": true\n }\n ],\n \"args\": [\n {\n \"name\": \"emode_tag\",\n \"type\": \"u16\"\n },\n {\n \"name\": \"entries\",\n \"type\": {\n \"array\": [\n {\n \"defined\": {\n \"name\": \"EmodeEntry\"\n }\n },\n 10\n ]\n }\n }\n ]\n },\n {\n \"name\": \"lending_pool_configure_bank_oracle\",\n \"discriminator\": [\n 209,\n 82,\n 255,\n 171,\n 124,\n 21,\n 71,\n 81\n ],\n \"accounts\": [\n {\n \"name\": \"group\",\n \"relations\": [\n \"bank\"\n ]\n },\n {\n \"name\": \"admin\",\n \"signer\": true,\n \"relations\": [\n \"group\"\n ]\n },\n {\n \"name\": \"bank\",\n \"writable\": true\n }\n ],\n \"args\": [\n {\n \"name\": \"setup\",\n \"type\": \"u8\"\n },\n {\n \"name\": \"oracle\",\n \"type\": \"pubkey\"\n }\n ]\n },\n {\n \"name\": \"lending_pool_handle_bankruptcy\",\n \"docs\": [\n \"Handle bad debt of a bankrupt lendr account for a given bank.\"\n ],\n \"discriminator\": [\n 162,\n 11,\n 56,\n 139,\n 90,\n 128,\n 70,\n 173\n ],\n \"accounts\": [\n {\n \"name\": \"group\",\n \"relations\": [\n \"bank\",\n \"lendr_account\"\n ]\n },\n {\n \"name\": \"signer\",\n \"docs\": [\n \"PERMISSIONLESS_BAD_DEBT_SETTLEMENT_FLAG is not set\"\n ],\n \"signer\": true\n },\n {\n \"name\": \"bank\",\n \"writable\": true\n },\n {\n \"name\": \"lendr_account\",\n \"writable\": true\n },\n {\n \"name\": \"liquidity_vault\",\n \"writable\": true,\n \"pda\": {\n \"seeds\": [\n {\n \"kind\": \"const\",\n \"value\": [\n 108,\n 105,\n 113,\n 117,\n 105,\n 100,\n 105,\n 116,\n 121,\n 95,\n 118,\n 97,\n 117,\n 108,\n 116\n ]\n },\n {\n \"kind\": \"account\",\n \"path\": \"bank\"\n }\n ]\n }\n },\n {\n \"name\": \"insurance_vault\",\n \"writable\": true,\n \"pda\": {\n \"seeds\": [\n {\n \"kind\": \"const\",\n \"value\": [\n 105,\n 110,\n 115,\n 117,\n 114,\n 97,\n 110,\n 99,\n 101,\n 95,\n 118,\n 97,\n 117,\n 108,\n 116\n ]\n },\n {\n \"kind\": \"account\",\n \"path\": \"bank\"\n }\n ]\n }\n },\n {\n \"name\": \"insurance_vault_authority\",\n \"pda\": {\n \"seeds\": [\n {\n \"kind\": \"const\",\n \"value\": [\n 105,\n 110,\n 115,\n 117,\n 114,\n 97,\n 110,\n 99,\n 101,\n 95,\n 118,\n 97,\n 117,\n 108,\n 116,\n 95,\n 97,\n 117,\n 116,\n 104\n ]\n },\n {\n \"kind\": \"account\",\n \"path\": \"bank\"\n }\n ]\n }\n },\n {\n \"name\": \"token_program\"\n }\n ],\n \"args\": []\n },\n {\n \"name\": \"lending_pool_setup_emissions\",\n \"discriminator\": [\n 206,\n 97,\n 120,\n 172,\n 113,\n 204,\n 169,\n 70\n ],\n \"accounts\": [\n {\n \"name\": \"group\",\n \"writable\": true,\n \"relations\": [\n \"bank\"\n ]\n },\n {\n \"name\": \"admin\",\n \"writable\": true,\n \"signer\": true,\n \"relations\": [\n \"group\"\n ]\n },\n {\n \"name\": \"bank\",\n \"writable\": true\n },\n {\n \"name\": \"emissions_mint\"\n },\n {\n \"name\": \"emissions_auth\",\n \"pda\": {\n \"seeds\": [\n {\n \"kind\": \"const\",\n \"value\": [\n 101,\n 109,\n 105,\n 115,\n 115,\n 105,\n 111,\n 110,\n 115,\n 95,\n 97,\n 117,\n 116,\n 104,\n 95,\n 115,\n 101,\n 101,\n 100\n ]\n },\n {\n \"kind\": \"account\",\n \"path\": \"bank\"\n },\n {\n \"kind\": \"account\",\n \"path\": \"emissions_mint\"\n }\n ]\n }\n },\n {\n \"name\": \"emissions_token_account\",\n \"writable\": true,\n \"pda\": {\n \"seeds\": [\n {\n \"kind\": \"const\",\n \"value\": [\n 101,\n 109,\n 105,\n 115,\n 115,\n 105,\n 111,\n 110,\n 115,\n 95,\n 116,\n 111,\n 107,\n 101,\n 110,\n 95,\n 97,\n 99,\n 99,\n 111,\n 117,\n 110,\n 116,\n 95,\n 115,\n 101,\n 101,\n 100\n ]\n },\n {\n \"kind\": \"account\",\n \"path\": \"bank\"\n },\n {\n \"kind\": \"account\",\n \"path\": \"emissions_mint\"\n }\n ]\n }\n },\n {\n \"name\": \"emissions_funding_account\",\n \"docs\": [\n \"NOTE: This is a TokenAccount, spl transfer will validate it.\",\n \"\"\n ],\n \"writable\": true\n },\n {\n \"name\": \"token_program\"\n },\n {\n \"name\": \"system_program\",\n \"address\": \"11111111111111111111111111111111\"\n }\n ],\n \"args\": [\n {\n \"name\": \"flags\",\n \"type\": \"u64\"\n },\n {\n \"name\": \"rate\",\n \"type\": \"u64\"\n },\n {\n \"name\": \"total_emissions\",\n \"type\": \"u64\"\n }\n ]\n },\n {\n \"name\": \"lending_pool_update_emissions_parameters\",\n \"discriminator\": [\n 55,\n 213,\n 224,\n 168,\n 153,\n 53,\n 197,\n 40\n ],\n \"accounts\": [\n {\n \"name\": \"group\",\n \"writable\": true,\n \"relations\": [\n \"bank\"\n ]\n },\n {\n \"name\": \"admin\",\n \"writable\": true,\n \"signer\": true,\n \"relations\": [\n \"group\"\n ]\n },\n {\n \"name\": \"bank\",\n \"writable\": true\n },\n {\n \"name\": \"emissions_mint\"\n },\n {\n \"name\": \"emissions_token_account\",\n \"writable\": true,\n \"pda\": {\n \"seeds\": [\n {\n \"kind\": \"const\",\n \"value\": [\n 101,\n 109,\n 105,\n 115,\n 115,\n 105,\n 111,\n 110,\n 115,\n 95,\n 116,\n 111,\n 107,\n 101,\n 110,\n 95,\n 97,\n 99,\n 99,\n 111,\n 117,\n 110,\n 116,\n 95,\n 115,\n 101,\n 101,\n 100\n ]\n },\n {\n \"kind\": \"account\",\n \"path\": \"bank\"\n },\n {\n \"kind\": \"account\",\n \"path\": \"emissions_mint\"\n }\n ]\n }\n },\n {\n \"name\": \"emissions_funding_account\",\n \"writable\": true\n },\n {\n \"name\": \"token_program\"\n }\n ],\n \"args\": [\n {\n \"name\": \"emissions_flags\",\n \"type\": {\n \"option\": \"u64\"\n }\n },\n {\n \"name\": \"emissions_rate\",\n \"type\": {\n \"option\": \"u64\"\n }\n },\n {\n \"name\": \"additional_emissions\",\n \"type\": {\n \"option\": \"u64\"\n }\n }\n ]\n },\n {\n \"name\": \"lending_pool_update_fees_destination_account\",\n \"discriminator\": [\n 102,\n 4,\n 121,\n 243,\n 237,\n 110,\n 95,\n 13\n ],\n \"accounts\": [\n {\n \"name\": \"group\",\n \"relations\": [\n \"bank\"\n ]\n },\n {\n \"name\": \"bank\",\n \"writable\": true\n },\n {\n \"name\": \"admin\",\n \"signer\": true,\n \"relations\": [\n \"group\"\n ]\n },\n {\n \"name\": \"destination_account\",\n \"docs\": [\n \"Bank fees will be sent to this account which must be an ATA of the bank's mint.\"\n ]\n }\n ],\n \"args\": []\n },\n {\n \"name\": \"lending_pool_withdraw_fees\",\n \"discriminator\": [\n 92,\n 140,\n 215,\n 254,\n 170,\n 0,\n 83,\n 174\n ],\n \"accounts\": [\n {\n \"name\": \"group\",\n \"relations\": [\n \"bank\"\n ]\n },\n {\n \"name\": \"bank\"\n },\n {\n \"name\": \"admin\",\n \"signer\": true,\n \"relations\": [\n \"group\"\n ]\n },\n {\n \"name\": \"fee_vault\",\n \"writable\": true,\n \"pda\": {\n \"seeds\": [\n {\n \"kind\": \"const\",\n \"value\": [\n 102,\n 101,\n 101,\n 95,\n 118,\n 97,\n 117,\n 108,\n 116\n ]\n },\n {\n \"kind\": \"account\",\n \"path\": \"bank\"\n }\n ]\n }\n },\n {\n \"name\": \"fee_vault_authority\",\n \"pda\": {\n \"seeds\": [\n {\n \"kind\": \"const\",\n \"value\": [\n 102,\n 101,\n 101,\n 95,\n 118,\n 97,\n 117,\n 108,\n 116,\n 95,\n 97,\n 117,\n 116,\n 104\n ]\n },\n {\n \"kind\": \"account\",\n \"path\": \"bank\"\n }\n ]\n }\n },\n {\n \"name\": \"dst_token_account\",\n \"writable\": true\n },\n {\n \"name\": \"token_program\"\n }\n ],\n \"args\": [\n {\n \"name\": \"amount\",\n \"type\": \"u64\"\n }\n ]\n },\n {\n \"name\": \"lending_pool_withdraw_fees_permissionless\",\n \"discriminator\": [\n 57,\n 245,\n 1,\n 208,\n 130,\n 18,\n 145,\n 113\n ],\n \"accounts\": [\n {\n \"name\": \"group\",\n \"relations\": [\n \"bank\"\n ]\n },\n {\n \"name\": \"bank\"\n },\n {\n \"name\": \"fee_vault\",\n \"writable\": true,\n \"pda\": {\n \"seeds\": [\n {\n \"kind\": \"const\",\n \"value\": [\n 102,\n 101,\n 101,\n 95,\n 118,\n 97,\n 117,\n 108,\n 116\n ]\n },\n {\n \"kind\": \"account\",\n \"path\": \"bank\"\n }\n ]\n }\n },\n {\n \"name\": \"fee_vault_authority\",\n \"pda\": {\n \"seeds\": [\n {\n \"kind\": \"const\",\n \"value\": [\n 102,\n 101,\n 101,\n 95,\n 118,\n 97,\n 117,\n 108,\n 116,\n 95,\n 97,\n 117,\n 116,\n 104\n ]\n },\n {\n \"kind\": \"account\",\n \"path\": \"bank\"\n }\n ]\n }\n },\n {\n \"name\": \"fees_destination_account\",\n \"writable\": true,\n \"relations\": [\n \"bank\"\n ]\n },\n {\n \"name\": \"token_program\"\n }\n ],\n \"args\": [\n {\n \"name\": \"amount\",\n \"type\": \"u64\"\n }\n ]\n },\n {\n \"name\": \"lending_pool_withdraw_insurance\",\n \"discriminator\": [\n 108,\n 60,\n 60,\n 246,\n 104,\n 79,\n 159,\n 243\n ],\n \"accounts\": [\n {\n \"name\": \"group\",\n \"relations\": [\n \"bank\"\n ]\n },\n {\n \"name\": \"bank\"\n },\n {\n \"name\": \"admin\",\n \"signer\": true,\n \"relations\": [\n \"group\"\n ]\n },\n {\n \"name\": \"insurance_vault\",\n \"writable\": true,\n \"pda\": {\n \"seeds\": [\n {\n \"kind\": \"const\",\n \"value\": [\n 105,\n 110,\n 115,\n 117,\n 114,\n 97,\n 110,\n 99,\n 101,\n 95,\n 118,\n 97,\n 117,\n 108,\n 116\n ]\n },\n {\n \"kind\": \"account\",\n \"path\": \"bank\"\n }\n ]\n }\n },\n {\n \"name\": \"insurance_vault_authority\",\n \"pda\": {\n \"seeds\": [\n {\n \"kind\": \"const\",\n \"value\": [\n 105,\n 110,\n 115,\n 117,\n 114,\n 97,\n 110,\n 99,\n 101,\n 95,\n 118,\n 97,\n 117,\n 108,\n 116,\n 95,\n 97,\n 117,\n 116,\n 104\n ]\n },\n {\n \"kind\": \"account\",\n \"path\": \"bank\"\n }\n ]\n }\n },\n {\n \"name\": \"dst_token_account\",\n \"writable\": true\n },\n {\n \"name\": \"token_program\"\n }\n ],\n \"args\": [\n {\n \"name\": \"amount\",\n \"type\": \"u64\"\n }\n ]\n },\n {\n \"name\": \"lendr_account_close\",\n \"discriminator\": [\n 203,\n 215,\n 173,\n 188,\n 202,\n 55,\n 182,\n 204\n ],\n \"accounts\": [\n {\n \"name\": \"lendr_account\",\n \"writable\": true\n },\n {\n \"name\": \"authority\",\n \"signer\": true,\n \"relations\": [\n \"lendr_account\"\n ]\n },\n {\n \"name\": \"fee_payer\",\n \"writable\": true,\n \"signer\": true\n }\n ],\n \"args\": []\n },\n {\n \"name\": \"lendr_account_initialize\",\n \"docs\": [\n \"Initialize a lendr account for a given group\"\n ],\n \"discriminator\": [\n 217,\n 101,\n 115,\n 142,\n 249,\n 248,\n 219,\n 231\n ],\n \"accounts\": [\n {\n \"name\": \"lendr_group\"\n },\n {\n \"name\": \"lendr_account\",\n \"writable\": true,\n \"signer\": true\n },\n {\n \"name\": \"authority\",\n \"signer\": true\n },\n {\n \"name\": \"fee_payer\",\n \"writable\": true,\n \"signer\": true\n },\n {\n \"name\": \"system_program\",\n \"address\": \"11111111111111111111111111111111\"\n }\n ],\n \"args\": []\n },\n {\n \"name\": \"lendr_account_initialize_with_session\",\n \"discriminator\": [\n 21,\n 30,\n 139,\n 134,\n 11,\n 140,\n 196,\n 191\n ],\n \"accounts\": [\n {\n \"name\": \"session_key\",\n \"signer\": true\n },\n {\n \"name\": \"lendr_group\"\n },\n {\n \"name\": \"lendr_account\",\n \"writable\": true,\n \"pda\": {\n \"seeds\": [\n {\n \"kind\": \"const\",\n \"value\": [\n 112,\n 121,\n 114,\n 111,\n 110,\n 101,\n 114,\n 115\n ]\n },\n {\n \"kind\": \"arg\",\n \"path\": \"user\"\n },\n {\n \"kind\": \"account\",\n \"path\": \"lendr_group\"\n },\n {\n \"kind\": \"arg\",\n \"path\": \"account_seed\"\n }\n ]\n }\n },\n {\n \"name\": \"fee_payer\",\n \"writable\": true,\n \"signer\": true\n },\n {\n \"name\": \"system_program\",\n \"address\": \"11111111111111111111111111111111\"\n }\n ],\n \"args\": [\n {\n \"name\": \"user\",\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"account_seed\",\n \"type\": \"u64\"\n }\n ]\n },\n {\n \"name\": \"lendr_account_update_emissions_destination_account\",\n \"discriminator\": [\n 48,\n 227,\n 199,\n 18,\n 196,\n 171,\n 163,\n 42\n ],\n \"accounts\": [\n {\n \"name\": \"lendr_account\",\n \"writable\": true\n },\n {\n \"name\": \"authority\",\n \"signer\": true,\n \"relations\": [\n \"lendr_account\"\n ]\n },\n {\n \"name\": \"destination_account\",\n \"docs\": [\n \"User's earned emissions will be sent to the canonical ATA of this wallet.\",\n \"\"\n ]\n }\n ],\n \"args\": []\n },\n {\n \"name\": \"lendr_group_configure\",\n \"discriminator\": [\n 183,\n 161,\n 137,\n 197,\n 184,\n 134,\n 129,\n 175\n ],\n \"accounts\": [\n {\n \"name\": \"lendr_group\",\n \"writable\": true\n },\n {\n \"name\": \"admin\",\n \"signer\": true,\n \"relations\": [\n \"lendr_group\"\n ]\n }\n ],\n \"args\": [\n {\n \"name\": \"new_admin\",\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"new_emode_admin\",\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"is_arena_group\",\n \"type\": \"bool\"\n }\n ]\n },\n {\n \"name\": \"lendr_group_initialize\",\n \"discriminator\": [\n 5,\n 158,\n 152,\n 80,\n 123,\n 114,\n 246,\n 42\n ],\n \"accounts\": [\n {\n \"name\": \"lendr_group\",\n \"writable\": true,\n \"signer\": true\n },\n {\n \"name\": \"admin\",\n \"writable\": true,\n \"signer\": true\n },\n {\n \"name\": \"fee_state\",\n \"pda\": {\n \"seeds\": [\n {\n \"kind\": \"const\",\n \"value\": [\n 102,\n 101,\n 101,\n 115,\n 116,\n 97,\n 116,\n 101\n ]\n }\n ]\n }\n },\n {\n \"name\": \"system_program\",\n \"address\": \"11111111111111111111111111111111\"\n }\n ],\n \"args\": [\n {\n \"name\": \"is_arena_group\",\n \"type\": \"bool\"\n }\n ]\n },\n {\n \"name\": \"propagate_fee_state\",\n \"docs\": [\n \"(Permissionless) Force any group to adopt the current FeeState settings\"\n ],\n \"discriminator\": [\n 64,\n 3,\n 166,\n 194,\n 129,\n 21,\n 101,\n 155\n ],\n \"accounts\": [\n {\n \"name\": \"fee_state\",\n \"pda\": {\n \"seeds\": [\n {\n \"kind\": \"const\",\n \"value\": [\n 102,\n 101,\n 101,\n 115,\n 116,\n 97,\n 116,\n 101\n ]\n }\n ]\n }\n },\n {\n \"name\": \"lendr_group\",\n \"docs\": [\n \"Any group, this ix is permisionless and can propogate the fee to any group\"\n ],\n \"writable\": true\n }\n ],\n \"args\": []\n },\n {\n \"name\": \"propagate_staked_settings\",\n \"discriminator\": [\n 210,\n 30,\n 152,\n 69,\n 130,\n 99,\n 222,\n 170\n ],\n \"accounts\": [\n {\n \"name\": \"lendr_group\",\n \"relations\": [\n \"staked_settings\"\n ]\n },\n {\n \"name\": \"staked_settings\"\n },\n {\n \"name\": \"bank\",\n \"writable\": true\n }\n ],\n \"args\": []\n },\n {\n \"name\": \"set_account_flag\",\n \"discriminator\": [\n 56,\n 238,\n 18,\n 207,\n 193,\n 82,\n 138,\n 174\n ],\n \"accounts\": [\n {\n \"name\": \"group\",\n \"relations\": [\n \"lendr_account\"\n ]\n },\n {\n \"name\": \"lendr_account\",\n \"writable\": true\n },\n {\n \"name\": \"admin\",\n \"signer\": true,\n \"relations\": [\n \"group\"\n ]\n }\n ],\n \"args\": [\n {\n \"name\": \"flag\",\n \"type\": \"u64\"\n }\n ]\n },\n {\n \"name\": \"set_new_account_authority\",\n \"discriminator\": [\n 153,\n 162,\n 50,\n 84,\n 182,\n 201,\n 74,\n 179\n ],\n \"accounts\": [\n {\n \"name\": \"lendr_account\",\n \"writable\": true\n },\n {\n \"name\": \"group\",\n \"relations\": [\n \"lendr_account\"\n ]\n },\n {\n \"name\": \"authority\",\n \"signer\": true,\n \"relations\": [\n \"lendr_account\"\n ]\n },\n {\n \"name\": \"new_authority\"\n },\n {\n \"name\": \"fee_payer\",\n \"writable\": true,\n \"signer\": true\n }\n ],\n \"args\": []\n },\n {\n \"name\": \"unset_account_flag\",\n \"discriminator\": [\n 56,\n 81,\n 56,\n 85,\n 92,\n 49,\n 255,\n 70\n ],\n \"accounts\": [\n {\n \"name\": \"group\",\n \"relations\": [\n \"lendr_account\"\n ]\n },\n {\n \"name\": \"lendr_account\",\n \"writable\": true\n },\n {\n \"name\": \"admin\",\n \"signer\": true,\n \"relations\": [\n \"group\"\n ]\n }\n ],\n \"args\": [\n {\n \"name\": \"flag\",\n \"type\": \"u64\"\n }\n ]\n }\n ],\n \"accounts\": [\n {\n \"name\": \"Bank\",\n \"discriminator\": [\n 142,\n 49,\n 166,\n 242,\n 50,\n 66,\n 97,\n 188\n ]\n },\n {\n \"name\": \"FeeState\",\n \"discriminator\": [\n 63,\n 224,\n 16,\n 85,\n 193,\n 36,\n 235,\n 220\n ]\n },\n {\n \"name\": \"LendrAccount\",\n \"discriminator\": [\n 126,\n 68,\n 241,\n 123,\n 184,\n 73,\n 247,\n 201\n ]\n },\n {\n \"name\": \"LendrGroup\",\n \"discriminator\": [\n 85,\n 220,\n 158,\n 127,\n 241,\n 82,\n 192,\n 93\n ]\n },\n {\n \"name\": \"StakedSettings\",\n \"discriminator\": [\n 157,\n 140,\n 6,\n 77,\n 89,\n 173,\n 173,\n 125\n ]\n }\n ],\n \"events\": [\n {\n \"name\": \"EditStakedSettingsEvent\",\n \"discriminator\": [\n 29,\n 58,\n 155,\n 191,\n 75,\n 220,\n 145,\n 206\n ]\n },\n {\n \"name\": \"HealthPulseEvent\",\n \"discriminator\": [\n 183,\n 159,\n 218,\n 110,\n 61,\n 220,\n 65,\n 1\n ]\n },\n {\n \"name\": \"LendingAccountBorrowEvent\",\n \"discriminator\": [\n 223,\n 96,\n 81,\n 10,\n 156,\n 99,\n 26,\n 59\n ]\n },\n {\n \"name\": \"LendingAccountDepositEvent\",\n \"discriminator\": [\n 161,\n 54,\n 237,\n 217,\n 105,\n 248,\n 122,\n 151\n ]\n },\n {\n \"name\": \"LendingAccountLiquidateEvent\",\n \"discriminator\": [\n 166,\n 160,\n 249,\n 154,\n 183,\n 39,\n 23,\n 242\n ]\n },\n {\n \"name\": \"LendingAccountRepayEvent\",\n \"discriminator\": [\n 16,\n 220,\n 55,\n 111,\n 7,\n 80,\n 16,\n 25\n ]\n },\n {\n \"name\": \"LendingAccountWithdrawEvent\",\n \"discriminator\": [\n 3,\n 220,\n 148,\n 243,\n 33,\n 249,\n 54,\n 88\n ]\n },\n {\n \"name\": \"LendingPoolBankAccrueInterestEvent\",\n \"discriminator\": [\n 104,\n 117,\n 187,\n 156,\n 111,\n 154,\n 106,\n 186\n ]\n },\n {\n \"name\": \"LendingPoolBankCollectFeesEvent\",\n \"discriminator\": [\n 101,\n 119,\n 97,\n 250,\n 169,\n 175,\n 156,\n 253\n ]\n },\n {\n \"name\": \"LendingPoolBankConfigureEvent\",\n \"discriminator\": [\n 246,\n 35,\n 233,\n 110,\n 93,\n 152,\n 235,\n 40\n ]\n },\n {\n \"name\": \"LendingPoolBankConfigureFrozenEvent\",\n \"discriminator\": [\n 24,\n 10,\n 55,\n 18,\n 49,\n 150,\n 157,\n 179\n ]\n },\n {\n \"name\": \"LendingPoolBankConfigureOracleEvent\",\n \"discriminator\": [\n 119,\n 140,\n 110,\n 253,\n 150,\n 64,\n 210,\n 62\n ]\n },\n {\n \"name\": \"LendingPoolBankCreateEvent\",\n \"discriminator\": [\n 236,\n 220,\n 201,\n 63,\n 239,\n 126,\n 136,\n 249\n ]\n },\n {\n \"name\": \"LendingPoolBankHandleBankruptcyEvent\",\n \"discriminator\": [\n 166,\n 77,\n 41,\n 140,\n 36,\n 94,\n 10,\n 57\n ]\n },\n {\n \"name\": \"LendrAccountCreateEvent\",\n \"discriminator\": [\n 45,\n 202,\n 13,\n 28,\n 196,\n 186,\n 30,\n 233\n ]\n },\n {\n \"name\": \"LendrAccountTransferAccountAuthorityEvent\",\n \"discriminator\": [\n 186,\n 180,\n 209,\n 100,\n 217,\n 14,\n 199,\n 109\n ]\n },\n {\n \"name\": \"LendrGroupConfigureEvent\",\n \"discriminator\": [\n 60,\n 189,\n 196,\n 227,\n 79,\n 115,\n 240,\n 47\n ]\n },\n {\n \"name\": \"LendrGroupCreateEvent\",\n \"discriminator\": [\n 207,\n 165,\n 250,\n 216,\n 174,\n 39,\n 85,\n 225\n ]\n }\n ],\n \"errors\": [\n {\n \"code\": 6000,\n \"name\": \"InternalLogicError\",\n \"msg\": \"Internal Lendr logic error\"\n },\n {\n \"code\": 6001,\n \"name\": \"BankNotFound\",\n \"msg\": \"Invalid bank index\"\n },\n {\n \"code\": 6002,\n \"name\": \"LendingAccountBalanceNotFound\",\n \"msg\": \"Lending account balance not found\"\n },\n {\n \"code\": 6003,\n \"name\": \"BankAssetCapacityExceeded\",\n \"msg\": \"Bank deposit capacity exceeded\"\n },\n {\n \"code\": 6004,\n \"name\": \"InvalidTransfer\",\n \"msg\": \"Invalid transfer\"\n },\n {\n \"code\": 6005,\n \"name\": \"MissingPythOrBankAccount\",\n \"msg\": \"Missing Oracle, Bank, LST mint, or Sol Pool\"\n },\n {\n \"code\": 6006,\n \"name\": \"MissingPythAccount\",\n \"msg\": \"Missing Pyth account\"\n },\n {\n \"code\": 6007,\n \"name\": \"MissingBankAccount\",\n \"msg\": \"Missing Bank account\"\n },\n {\n \"code\": 6008,\n \"name\": \"InvalidBankAccount\",\n \"msg\": \"Invalid Bank account\"\n },\n {\n \"code\": 6009,\n \"name\": \"RiskEngineInitRejected\",\n \"msg\": \"RiskEngine rejected due to either bad health or stale oracles\"\n },\n {\n \"code\": 6010,\n \"name\": \"LendingAccountBalanceSlotsFull\",\n \"msg\": \"Lending account balance slots are full\"\n },\n {\n \"code\": 6011,\n \"name\": \"BankAlreadyExists\",\n \"msg\": \"Bank already exists\"\n },\n {\n \"code\": 6012,\n \"name\": \"ZeroLiquidationAmount\",\n \"msg\": \"Amount to liquidate must be positive\"\n },\n {\n \"code\": 6013,\n \"name\": \"AccountNotBankrupt\",\n \"msg\": \"Account is not bankrupt\"\n },\n {\n \"code\": 6014,\n \"name\": \"BalanceNotBadDebt\",\n \"msg\": \"Account balance is not bad debt\"\n },\n {\n \"code\": 6015,\n \"name\": \"InvalidConfig\",\n \"msg\": \"Invalid group config\"\n },\n {\n \"code\": 6016,\n \"name\": \"BankPaused\",\n \"msg\": \"Bank paused\"\n },\n {\n \"code\": 6017,\n \"name\": \"BankReduceOnly\",\n \"msg\": \"Bank is ReduceOnly mode\"\n },\n {\n \"code\": 6018,\n \"name\": \"BankAccountNotFound\",\n \"msg\": \"Bank is missing\"\n },\n {\n \"code\": 6019,\n \"name\": \"OperationDepositOnly\",\n \"msg\": \"Operation is deposit-only\"\n },\n {\n \"code\": 6020,\n \"name\": \"OperationWithdrawOnly\",\n \"msg\": \"Operation is withdraw-only\"\n },\n {\n \"code\": 6021,\n \"name\": \"OperationBorrowOnly\",\n \"msg\": \"Operation is borrow-only\"\n },\n {\n \"code\": 6022,\n \"name\": \"OperationRepayOnly\",\n \"msg\": \"Operation is repay-only\"\n },\n {\n \"code\": 6023,\n \"name\": \"NoAssetFound\",\n \"msg\": \"No asset found\"\n },\n {\n \"code\": 6024,\n \"name\": \"NoLiabilityFound\",\n \"msg\": \"No liability found\"\n },\n {\n \"code\": 6025,\n \"name\": \"InvalidOracleSetup\",\n \"msg\": \"Invalid oracle setup\"\n },\n {\n \"code\": 6026,\n \"name\": \"IllegalUtilizationRatio\",\n \"msg\": \"Invalid bank utilization ratio\"\n },\n {\n \"code\": 6027,\n \"name\": \"BankLiabilityCapacityExceeded\",\n \"msg\": \"Bank borrow cap exceeded\"\n },\n {\n \"code\": 6028,\n \"name\": \"InvalidPrice\",\n \"msg\": \"Invalid Price\"\n },\n {\n \"code\": 6029,\n \"name\": \"IsolatedAccountIllegalState\",\n \"msg\": \"Account can have only one liability when account is under isolated risk\"\n },\n {\n \"code\": 6030,\n \"name\": \"EmissionsAlreadySetup\",\n \"msg\": \"Emissions already setup\"\n },\n {\n \"code\": 6031,\n \"name\": \"OracleNotSetup\",\n \"msg\": \"Oracle is not set\"\n },\n {\n \"code\": 6032,\n \"name\": \"InvalidSwitchboardDecimalConversion\",\n \"msg\": \"Invalid switchboard decimal conversion\"\n },\n {\n \"code\": 6033,\n \"name\": \"CannotCloseOutstandingEmissions\",\n \"msg\": \"Cannot close balance because of outstanding emissions\"\n },\n {\n \"code\": 6034,\n \"name\": \"EmissionsUpdateError\",\n \"msg\": \"Update emissions error\"\n },\n {\n \"code\": 6035,\n \"name\": \"AccountDisabled\",\n \"msg\": \"Account disabled\"\n },\n {\n \"code\": 6036,\n \"name\": \"AccountTempActiveBalanceLimitExceeded\",\n \"msg\": \"Account can't temporarily open 3 balances, please close a balance first\"\n },\n {\n \"code\": 6037,\n \"name\": \"AccountInFlashloan\",\n \"msg\": \"Illegal action during flashloan\"\n },\n {\n \"code\": 6038,\n \"name\": \"IllegalFlashloan\",\n \"msg\": \"Illegal flashloan\"\n },\n {\n \"code\": 6039,\n \"name\": \"IllegalFlag\",\n \"msg\": \"Illegal flag\"\n },\n {\n \"code\": 6040,\n \"name\": \"IllegalBalanceState\",\n \"msg\": \"Illegal balance state\"\n },\n {\n \"code\": 6041,\n \"name\": \"IllegalAccountAuthorityTransfer\",\n \"msg\": \"Illegal account authority transfer\"\n },\n {\n \"code\": 6042,\n \"name\": \"Unauthorized\",\n \"msg\": \"Unauthorized\"\n },\n {\n \"code\": 6043,\n \"name\": \"IllegalAction\",\n \"msg\": \"Invalid account authority\"\n },\n {\n \"code\": 6044,\n \"name\": \"T22MintRequired\",\n \"msg\": \"Token22 Banks require mint account as first remaining account\"\n },\n {\n \"code\": 6045,\n \"name\": \"InvalidFeeAta\",\n \"msg\": \"Invalid ATA for global fee account\"\n },\n {\n \"code\": 6046,\n \"name\": \"AddedStakedPoolManually\",\n \"msg\": \"Use add pool permissionless instead\"\n },\n {\n \"code\": 6047,\n \"name\": \"AssetTagMismatch\",\n \"msg\": \"Staked SOL accounts can only deposit staked assets and borrow SOL\"\n },\n {\n \"code\": 6048,\n \"name\": \"StakePoolValidationFailed\",\n \"msg\": \"Stake pool validation failed: check the stake pool, mint, or sol pool\"\n },\n {\n \"code\": 6049,\n \"name\": \"SwitchboardStalePrice\",\n \"msg\": \"Switchboard oracle: stale price\"\n },\n {\n \"code\": 6050,\n \"name\": \"PythPushStalePrice\",\n \"msg\": \"Pyth Push oracle: stale price\"\n },\n {\n \"code\": 6051,\n \"name\": \"WrongNumberOfOracleAccounts\",\n \"msg\": \"Oracle error: wrong number of accounts\"\n },\n {\n \"code\": 6052,\n \"name\": \"WrongOracleAccountKeys\",\n \"msg\": \"Oracle error: wrong account keys\"\n },\n {\n \"code\": 6053,\n \"name\": \"PythPushWrongAccountOwner\",\n \"msg\": \"Pyth Push oracle: wrong account owner\"\n },\n {\n \"code\": 6054,\n \"name\": \"StakedPythPushWrongAccountOwner\",\n \"msg\": \"Staked Pyth Push oracle: wrong account owner\"\n },\n {\n \"code\": 6055,\n \"name\": \"PythPushMismatchedFeedId\",\n \"msg\": \"Pyth Push oracle: mismatched feed id\"\n },\n {\n \"code\": 6056,\n \"name\": \"PythPushInsufficientVerificationLevel\",\n \"msg\": \"Pyth Push oracle: insufficient verification level\"\n },\n {\n \"code\": 6057,\n \"name\": \"PythPushFeedIdMustBe32Bytes\",\n \"msg\": \"Pyth Push oracle: feed id must be 32 Bytes\"\n },\n {\n \"code\": 6058,\n \"name\": \"PythPushFeedIdNonHexCharacter\",\n \"msg\": \"Pyth Push oracle: feed id contains non-hex characters\"\n },\n {\n \"code\": 6059,\n \"name\": \"SwitchboardWrongAccountOwner\",\n \"msg\": \"Switchboard oracle: wrong account owner\"\n },\n {\n \"code\": 6060,\n \"name\": \"PythPushInvalidAccount\",\n \"msg\": \"Pyth Push oracle: invalid account\"\n },\n {\n \"code\": 6061,\n \"name\": \"SwitchboardInvalidAccount\",\n \"msg\": \"Switchboard oracle: invalid account\"\n },\n {\n \"code\": 6062,\n \"name\": \"MathError\",\n \"msg\": \"Math error\"\n },\n {\n \"code\": 6063,\n \"name\": \"InvalidEmissionsDestinationAccount\",\n \"msg\": \"Invalid emissions destination account\"\n },\n {\n \"code\": 6064,\n \"name\": \"SameAssetAndLiabilityBanks\",\n \"msg\": \"Asset and liability bank cannot be the same\"\n },\n {\n \"code\": 6065,\n \"name\": \"OverliquidationAttempt\",\n \"msg\": \"Trying to withdraw more assets than available\"\n },\n {\n \"code\": 6066,\n \"name\": \"NoLiabilitiesInLiabilityBank\",\n \"msg\": \"Liability bank has no liabilities\"\n },\n {\n \"code\": 6067,\n \"name\": \"AssetsInLiabilityBank\",\n \"msg\": \"Liability bank has assets\"\n },\n {\n \"code\": 6068,\n \"name\": \"HealthyAccount\",\n \"msg\": \"Account is healthy and cannot be liquidated\"\n },\n {\n \"code\": 6069,\n \"name\": \"ExhaustedLiability\",\n \"msg\": \"Liability payoff too severe, exhausted liability\"\n },\n {\n \"code\": 6070,\n \"name\": \"TooSeverePayoff\",\n \"msg\": \"Liability payoff too severe, liability balance has assets\"\n },\n {\n \"code\": 6071,\n \"name\": \"TooSevereLiquidation\",\n \"msg\": \"Liquidation too severe, account above maintenance requirement\"\n },\n {\n \"code\": 6072,\n \"name\": \"WorseHealthPostLiquidation\",\n \"msg\": \"Liquidation would worsen account health\"\n },\n {\n \"code\": 6073,\n \"name\": \"ArenaBankLimit\",\n \"msg\": \"Arena groups can only support two banks\"\n },\n {\n \"code\": 6074,\n \"name\": \"ArenaSettingCannotChange\",\n \"msg\": \"Arena groups cannot return to non-arena status\"\n },\n {\n \"code\": 6075,\n \"name\": \"BadEmodeConfig\",\n \"msg\": \"The Emode config was invalid\"\n },\n {\n \"code\": 6076,\n \"name\": \"PythPushInvalidWindowSize\",\n \"msg\": \"TWAP window size does not match expected duration\"\n },\n {\n \"code\": 6077,\n \"name\": \"InvalidFeesDestinationAccount\",\n \"msg\": \"Invalid fees destination account\"\n }\n ],\n \"types\": [\n {\n \"name\": \"AccountEventHeader\",\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": [\n {\n \"name\": \"signer\",\n \"type\": {\n \"option\": \"pubkey\"\n }\n },\n {\n \"name\": \"lendr_account\",\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"lendr_account_authority\",\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"lendr_group\",\n \"type\": \"pubkey\"\n }\n ]\n }\n },\n {\n \"name\": \"Balance\",\n \"repr\": {\n \"kind\": \"c\"\n },\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": [\n {\n \"name\": \"active\",\n \"type\": \"u8\"\n },\n {\n \"name\": \"bank_pk\",\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"bank_asset_tag\",\n \"docs\": [\n \"Inherited from the bank when the position is first created and CANNOT BE CHANGED after that.\",\n \"Note that all balances created before the addition of this feature use `ASSET_TAG_DEFAULT`\"\n ],\n \"type\": \"u8\"\n },\n {\n \"name\": \"_pad0\",\n \"type\": {\n \"array\": [\n \"u8\",\n 6\n ]\n }\n },\n {\n \"name\": \"asset_shares\",\n \"type\": {\n \"defined\": {\n \"name\": \"WrappedI80F48\"\n }\n }\n },\n {\n \"name\": \"liability_shares\",\n \"type\": {\n \"defined\": {\n \"name\": \"WrappedI80F48\"\n }\n }\n },\n {\n \"name\": \"emissions_outstanding\",\n \"type\": {\n \"defined\": {\n \"name\": \"WrappedI80F48\"\n }\n }\n },\n {\n \"name\": \"last_update\",\n \"type\": \"u64\"\n },\n {\n \"name\": \"_padding\",\n \"type\": {\n \"array\": [\n \"u64\",\n 1\n ]\n }\n }\n ]\n }\n },\n {\n \"name\": \"Bank\",\n \"serialization\": \"bytemuck\",\n \"repr\": {\n \"kind\": \"c\"\n },\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": [\n {\n \"name\": \"mint\",\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"mint_decimals\",\n \"type\": \"u8\"\n },\n {\n \"name\": \"group\",\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"_pad0\",\n \"type\": {\n \"array\": [\n \"u8\",\n 7\n ]\n }\n },\n {\n \"name\": \"asset_share_value\",\n \"type\": {\n \"defined\": {\n \"name\": \"WrappedI80F48\"\n }\n }\n },\n {\n \"name\": \"liability_share_value\",\n \"type\": {\n \"defined\": {\n \"name\": \"WrappedI80F48\"\n }\n }\n },\n {\n \"name\": \"liquidity_vault\",\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"liquidity_vault_bump\",\n \"type\": \"u8\"\n },\n {\n \"name\": \"liquidity_vault_authority_bump\",\n \"type\": \"u8\"\n },\n {\n \"name\": \"insurance_vault\",\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"insurance_vault_bump\",\n \"type\": \"u8\"\n },\n {\n \"name\": \"insurance_vault_authority_bump\",\n \"type\": \"u8\"\n },\n {\n \"name\": \"_pad1\",\n \"type\": {\n \"array\": [\n \"u8\",\n 4\n ]\n }\n },\n {\n \"name\": \"collected_insurance_fees_outstanding\",\n \"docs\": [\n \"Fees collected and pending withdraw for the `insurance_vault`\"\n ],\n \"type\": {\n \"defined\": {\n \"name\": \"WrappedI80F48\"\n }\n }\n },\n {\n \"name\": \"fee_vault\",\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"fee_vault_bump\",\n \"type\": \"u8\"\n },\n {\n \"name\": \"fee_vault_authority_bump\",\n \"type\": \"u8\"\n },\n {\n \"name\": \"_pad2\",\n \"type\": {\n \"array\": [\n \"u8\",\n 6\n ]\n }\n },\n {\n \"name\": \"collected_group_fees_outstanding\",\n \"docs\": [\n \"Fees collected and pending withdraw for the `fee_vault`\"\n ],\n \"type\": {\n \"defined\": {\n \"name\": \"WrappedI80F48\"\n }\n }\n },\n {\n \"name\": \"total_liability_shares\",\n \"type\": {\n \"defined\": {\n \"name\": \"WrappedI80F48\"\n }\n }\n },\n {\n \"name\": \"total_asset_shares\",\n \"type\": {\n \"defined\": {\n \"name\": \"WrappedI80F48\"\n }\n }\n },\n {\n \"name\": \"last_update\",\n \"type\": \"i64\"\n },\n {\n \"name\": \"config\",\n \"type\": {\n \"defined\": {\n \"name\": \"BankConfig\"\n }\n }\n },\n {\n \"name\": \"flags\",\n \"docs\": [\n \"Bank Config Flags\",\n \"\",\n \"- EMISSIONS_FLAG_BORROW_ACTIVE: 1\",\n \"- EMISSIONS_FLAG_LENDING_ACTIVE: 2\",\n \"- PERMISSIONLESS_BAD_DEBT_SETTLEMENT: 4\",\n \"- FREEZE_SETTINGS: 8\",\n \"\"\n ],\n \"type\": \"u64\"\n },\n {\n \"name\": \"emissions_rate\",\n \"docs\": [\n \"Emissions APR. Number of emitted tokens (emissions_mint) per 1e(bank.mint_decimal) tokens\",\n \"(bank mint) (native amount) per 1 YEAR.\"\n ],\n \"type\": \"u64\"\n },\n {\n \"name\": \"emissions_remaining\",\n \"type\": {\n \"defined\": {\n \"name\": \"WrappedI80F48\"\n }\n }\n },\n {\n \"name\": \"emissions_mint\",\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"collected_program_fees_outstanding\",\n \"docs\": [\n \"Fees collected and pending withdraw for the `FeeState.global_fee_wallet`'s canonical ATA for `mint`\"\n ],\n \"type\": {\n \"defined\": {\n \"name\": \"WrappedI80F48\"\n }\n }\n },\n {\n \"name\": \"emode\",\n \"docs\": [\n \"Controls this bank's emode configuration, which enables some banks to treat the assets of\",\n \"certain other banks more preferentially as collateral.\"\n ],\n \"type\": {\n \"defined\": {\n \"name\": \"EmodeSettings\"\n }\n }\n },\n {\n \"name\": \"fees_destination_account\",\n \"docs\": [\n \"Set with `update_fees_destination_account`. This should be an ATA for the bank's mint. If\",\n \"pubkey default, the bank doesn't support this feature, and the fees must be collected\",\n \"manually (withdraw_fees).\"\n ],\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"_padding_0\",\n \"type\": {\n \"array\": [\n \"u8\",\n 8\n ]\n }\n },\n {\n \"name\": \"_padding_1\",\n \"type\": {\n \"array\": [\n {\n \"array\": [\n \"u64\",\n 2\n ]\n },\n 30\n ]\n }\n }\n ]\n }\n },\n {\n \"name\": \"BankConfig\",\n \"docs\": [\n \"TODO: Convert weights to (u64, u64) to avoid precision loss (maybe?)\"\n ],\n \"repr\": {\n \"kind\": \"c\"\n },\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": [\n {\n \"name\": \"asset_weight_init\",\n \"type\": {\n \"defined\": {\n \"name\": \"WrappedI80F48\"\n }\n }\n },\n {\n \"name\": \"asset_weight_maint\",\n \"type\": {\n \"defined\": {\n \"name\": \"WrappedI80F48\"\n }\n }\n },\n {\n \"name\": \"liability_weight_init\",\n \"type\": {\n \"defined\": {\n \"name\": \"WrappedI80F48\"\n }\n }\n },\n {\n \"name\": \"liability_weight_maint\",\n \"type\": {\n \"defined\": {\n \"name\": \"WrappedI80F48\"\n }\n }\n },\n {\n \"name\": \"deposit_limit\",\n \"type\": \"u64\"\n },\n {\n \"name\": \"interest_rate_config\",\n \"type\": {\n \"defined\": {\n \"name\": \"InterestRateConfig\"\n }\n }\n },\n {\n \"name\": \"operational_state\",\n \"type\": {\n \"defined\": {\n \"name\": \"BankOperationalState\"\n }\n }\n },\n {\n \"name\": \"oracle_setup\",\n \"type\": {\n \"defined\": {\n \"name\": \"OracleSetup\"\n }\n }\n },\n {\n \"name\": \"oracle_keys\",\n \"type\": {\n \"array\": [\n \"pubkey\",\n 5\n ]\n }\n },\n {\n \"name\": \"_pad0\",\n \"type\": {\n \"array\": [\n \"u8\",\n 6\n ]\n }\n },\n {\n \"name\": \"borrow_limit\",\n \"type\": \"u64\"\n },\n {\n \"name\": \"risk_tier\",\n \"type\": {\n \"defined\": {\n \"name\": \"RiskTier\"\n }\n }\n },\n {\n \"name\": \"asset_tag\",\n \"docs\": [\n \"Determines what kinds of assets users of this bank can interact with.\",\n \"Options:\",\n \"* ASSET_TAG_DEFAULT (0) - A regular asset that can be comingled with any other regular asset\",\n \"or with `ASSET_TAG_SOL`\",\n \"* ASSET_TAG_SOL (1) - Accounts with a SOL position can comingle with **either**\",\n \"`ASSET_TAG_DEFAULT` or `ASSET_TAG_STAKED` positions, but not both\",\n \"* ASSET_TAG_STAKED (2) - Staked SOL assets. Accounts with a STAKED position can only deposit\",\n \"other STAKED assets or SOL (`ASSET_TAG_SOL`) and can only borrow SOL\"\n ],\n \"type\": \"u8\"\n },\n {\n \"name\": \"_pad1\",\n \"type\": {\n \"array\": [\n \"u8\",\n 6\n ]\n }\n },\n {\n \"name\": \"total_asset_value_init_limit\",\n \"docs\": [\n \"USD denominated limit for calculating asset value for initialization lendr requirements.\",\n \"Example, if total SOL deposits are equal to $1M and the limit it set to $500K,\",\n \"then SOL assets will be discounted by 50%.\",\n \"\",\n \"In other words the max value of liabilities that can be backed by the asset is $500K.\",\n \"This is useful for limiting the damage of orcale attacks.\",\n \"\",\n \"Value is UI USD value, for example value 100 -> $100\"\n ],\n \"type\": \"u64\"\n },\n {\n \"name\": \"oracle_max_age\",\n \"docs\": [\n \"Time window in seconds for the oracle price feed to be considered live.\"\n ],\n \"type\": \"u16\"\n },\n {\n \"name\": \"_padding0\",\n \"type\": {\n \"array\": [\n \"u8\",\n 6\n ]\n }\n },\n {\n \"name\": \"_padding1\",\n \"type\": {\n \"array\": [\n \"u8\",\n 32\n ]\n }\n }\n ]\n }\n },\n {\n \"name\": \"BankConfigCompact\",\n \"docs\": [\n \"TODO: Convert weights to (u64, u64) to avoid precision loss (maybe?)\"\n ],\n \"repr\": {\n \"kind\": \"c\"\n },\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": [\n {\n \"name\": \"asset_weight_init\",\n \"type\": {\n \"defined\": {\n \"name\": \"WrappedI80F48\"\n }\n }\n },\n {\n \"name\": \"asset_weight_maint\",\n \"type\": {\n \"defined\": {\n \"name\": \"WrappedI80F48\"\n }\n }\n },\n {\n \"name\": \"liability_weight_init\",\n \"type\": {\n \"defined\": {\n \"name\": \"WrappedI80F48\"\n }\n }\n },\n {\n \"name\": \"liability_weight_maint\",\n \"type\": {\n \"defined\": {\n \"name\": \"WrappedI80F48\"\n }\n }\n },\n {\n \"name\": \"deposit_limit\",\n \"type\": \"u64\"\n },\n {\n \"name\": \"interest_rate_config\",\n \"type\": {\n \"defined\": {\n \"name\": \"InterestRateConfigCompact\"\n }\n }\n },\n {\n \"name\": \"operational_state\",\n \"type\": {\n \"defined\": {\n \"name\": \"BankOperationalState\"\n }\n }\n },\n {\n \"name\": \"borrow_limit\",\n \"type\": \"u64\"\n },\n {\n \"name\": \"risk_tier\",\n \"type\": {\n \"defined\": {\n \"name\": \"RiskTier\"\n }\n }\n },\n {\n \"name\": \"asset_tag\",\n \"docs\": [\n \"Determines what kinds of assets users of this bank can interact with.\",\n \"Options:\",\n \"* ASSET_TAG_DEFAULT (0) - A regular asset that can be comingled with any other regular asset\",\n \"or with `ASSET_TAG_SOL`\",\n \"* ASSET_TAG_SOL (1) - Accounts with a SOL position can comingle with **either**\",\n \"`ASSET_TAG_DEFAULT` or `ASSET_TAG_STAKED` positions, but not both\",\n \"* ASSET_TAG_STAKED (2) - Staked SOL assets. Accounts with a STAKED position can only deposit\",\n \"other STAKED assets or SOL (`ASSET_TAG_SOL`) and can only borrow SOL\"\n ],\n \"type\": \"u8\"\n },\n {\n \"name\": \"_pad0\",\n \"type\": {\n \"array\": [\n \"u8\",\n 6\n ]\n }\n },\n {\n \"name\": \"total_asset_value_init_limit\",\n \"docs\": [\n \"USD denominated limit for calculating asset value for initialization lendr requirements.\",\n \"Example, if total SOL deposits are equal to $1M and the limit it set to $500K,\",\n \"then SOL assets will be discounted by 50%.\",\n \"\",\n \"In other words the max value of liabilities that can be backed by the asset is $500K.\",\n \"This is useful for limiting the damage of orcale attacks.\",\n \"\",\n \"Value is UI USD value, for example value 100 -> $100\"\n ],\n \"type\": \"u64\"\n },\n {\n \"name\": \"oracle_max_age\",\n \"docs\": [\n \"Time window in seconds for the oracle price feed to be considered live.\"\n ],\n \"type\": \"u16\"\n }\n ]\n }\n },\n {\n \"name\": \"BankConfigOpt\",\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": [\n {\n \"name\": \"asset_weight_init\",\n \"type\": {\n \"option\": {\n \"defined\": {\n \"name\": \"WrappedI80F48\"\n }\n }\n }\n },\n {\n \"name\": \"asset_weight_maint\",\n \"type\": {\n \"option\": {\n \"defined\": {\n \"name\": \"WrappedI80F48\"\n }\n }\n }\n },\n {\n \"name\": \"liability_weight_init\",\n \"type\": {\n \"option\": {\n \"defined\": {\n \"name\": \"WrappedI80F48\"\n }\n }\n }\n },\n {\n \"name\": \"liability_weight_maint\",\n \"type\": {\n \"option\": {\n \"defined\": {\n \"name\": \"WrappedI80F48\"\n }\n }\n }\n },\n {\n \"name\": \"deposit_limit\",\n \"type\": {\n \"option\": \"u64\"\n }\n },\n {\n \"name\": \"borrow_limit\",\n \"type\": {\n \"option\": \"u64\"\n }\n },\n {\n \"name\": \"operational_state\",\n \"type\": {\n \"option\": {\n \"defined\": {\n \"name\": \"BankOperationalState\"\n }\n }\n }\n },\n {\n \"name\": \"interest_rate_config\",\n \"type\": {\n \"option\": {\n \"defined\": {\n \"name\": \"InterestRateConfigOpt\"\n }\n }\n }\n },\n {\n \"name\": \"risk_tier\",\n \"type\": {\n \"option\": {\n \"defined\": {\n \"name\": \"RiskTier\"\n }\n }\n }\n },\n {\n \"name\": \"asset_tag\",\n \"type\": {\n \"option\": \"u8\"\n }\n },\n {\n \"name\": \"total_asset_value_init_limit\",\n \"type\": {\n \"option\": \"u64\"\n }\n },\n {\n \"name\": \"oracle_max_age\",\n \"type\": {\n \"option\": \"u16\"\n }\n },\n {\n \"name\": \"permissionless_bad_debt_settlement\",\n \"type\": {\n \"option\": \"bool\"\n }\n },\n {\n \"name\": \"freeze_settings\",\n \"type\": {\n \"option\": \"bool\"\n }\n }\n ]\n }\n },\n {\n \"name\": \"BankOperationalState\",\n \"repr\": {\n \"kind\": \"rust\"\n },\n \"type\": {\n \"kind\": \"enum\",\n \"variants\": [\n {\n \"name\": \"Paused\"\n },\n {\n \"name\": \"Operational\"\n },\n {\n \"name\": \"ReduceOnly\"\n }\n ]\n }\n },\n {\n \"name\": \"EditStakedSettingsEvent\",\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": [\n {\n \"name\": \"group\",\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"settings\",\n \"type\": {\n \"defined\": {\n \"name\": \"StakedSettingsEditConfig\"\n }\n }\n }\n ]\n }\n },\n {\n \"name\": \"EmodeConfig\",\n \"docs\": [\n \"An emode configuration. Each bank has one such configuration, but this may also be the\",\n \"intersection of many configurations (see `reconcile_emode_configs`). For example, the risk\",\n \"engine creates such an intersection from all the emode config of all banks the user is borrowing\",\n \"from.\"\n ],\n \"repr\": {\n \"kind\": \"c\"\n },\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": [\n {\n \"name\": \"entries\",\n \"type\": {\n \"array\": [\n {\n \"defined\": {\n \"name\": \"EmodeEntry\"\n }\n },\n 10\n ]\n }\n }\n ]\n }\n },\n {\n \"name\": \"EmodeEntry\",\n \"repr\": {\n \"kind\": \"c\"\n },\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": [\n {\n \"name\": \"collateral_bank_emode_tag\",\n \"docs\": [\n \"emode_tag of the bank(s) whose collateral you wish to treat preferentially.\"\n ],\n \"type\": \"u16\"\n },\n {\n \"name\": \"flags\",\n \"docs\": [\n \"* APPLIES_TO_ISOLATED (1) - (NOT YET IMPLEMENTED) if set, isolated banks with this tag\",\n \"also benefit. If not set, isolated banks continue to offer zero collateral, even if they\",\n \"use this tag.\",\n \"* 2, 4, 8, 16, 32, etc - reserved for future use\"\n ],\n \"type\": \"u8\"\n },\n {\n \"name\": \"pad0\",\n \"type\": {\n \"array\": [\n \"u8\",\n 5\n ]\n }\n },\n {\n \"name\": \"asset_weight_init\",\n \"docs\": [\n \"Note: If set below the collateral bank's weight, does nothing.\"\n ],\n \"type\": {\n \"defined\": {\n \"name\": \"WrappedI80F48\"\n }\n }\n },\n {\n \"name\": \"asset_weight_maint\",\n \"docs\": [\n \"Note: If set below the collateral bank's weight, does nothing.\"\n ],\n \"type\": {\n \"defined\": {\n \"name\": \"WrappedI80F48\"\n }\n }\n }\n ]\n }\n },\n {\n \"name\": \"EmodeSettings\",\n \"docs\": [\n \"Controls the bank's e-mode configuration, allowing certain collateral sources to be treated more\",\n \"favorably as collateral when used to borrow from this bank.\"\n ],\n \"repr\": {\n \"kind\": \"c\"\n },\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": [\n {\n \"name\": \"emode_tag\",\n \"docs\": [\n \"This bank's NON-unique id that other banks will use to determine what emode rate to use when\",\n \"this bank is offered as collateral.\",\n \"\",\n \"For example, all stablecoin banks might share the same emode_tag, and in their entries, each\",\n \"such stablecoin bank will recognize that collateral sources with this \\\"stable\\\" tag get\",\n \"preferential weights. When a new stablecoin is added that is considered riskier, it may get\",\n \"a new, less favorable emode tag, and eventually get upgraded to the same one as the other\",\n \"stables\",\n \"\",\n \"* 0 is in an invalid tag and will do nothing.\"\n ],\n \"type\": \"u16\"\n },\n {\n \"name\": \"pad0\",\n \"type\": {\n \"array\": [\n \"u8\",\n 6\n ]\n }\n },\n {\n \"name\": \"timestamp\",\n \"docs\": [\n \"Unix timestamp from the system clock when emode state was last updated\"\n ],\n \"type\": \"i64\"\n },\n {\n \"name\": \"flags\",\n \"docs\": [\n \"EMODE_ON (1) - If set, at least one entry is configured\",\n \"2, 4, 8, etc, Reserved for future use\"\n ],\n \"type\": \"u64\"\n },\n {\n \"name\": \"emode_config\",\n \"type\": {\n \"defined\": {\n \"name\": \"EmodeConfig\"\n }\n }\n }\n ]\n }\n },\n {\n \"name\": \"FeeState\",\n \"docs\": [\n \"Unique per-program. The Program Owner uses this account to administrate fees collected by the protocol\"\n ],\n \"serialization\": \"bytemuck\",\n \"repr\": {\n \"kind\": \"c\"\n },\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": [\n {\n \"name\": \"key\",\n \"docs\": [\n \"The fee state's own key. A PDA derived from just `b\\\"feestate\\\"`\"\n ],\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"global_fee_admin\",\n \"docs\": [\n \"Can modify fees\"\n ],\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"global_fee_wallet\",\n \"docs\": [\n \"The base wallet for all protocol fees. All SOL fees go to this wallet. All non-SOL fees go\",\n \"to the canonical ATA of this wallet for that asset.\"\n ],\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"placeholder0\",\n \"type\": \"u64\"\n },\n {\n \"name\": \"bank_init_flat_sol_fee\",\n \"docs\": [\n \"Flat fee assessed when a new bank is initialized, in lamports.\",\n \"* In SOL, in native decimals.\"\n ],\n \"type\": \"u32\"\n },\n {\n \"name\": \"bump_seed\",\n \"type\": \"u8\"\n },\n {\n \"name\": \"_padding0\",\n \"type\": {\n \"array\": [\n \"u8\",\n 4\n ]\n }\n },\n {\n \"name\": \"_padding1\",\n \"type\": {\n \"array\": [\n \"u8\",\n 15\n ]\n }\n },\n {\n \"name\": \"program_fee_fixed\",\n \"docs\": [\n \"Fee collected by the program owner from all groups\"\n ],\n \"type\": {\n \"defined\": {\n \"name\": \"WrappedI80F48\"\n }\n }\n },\n {\n \"name\": \"program_fee_rate\",\n \"docs\": [\n \"Fee collected by the program owner from all groups\"\n ],\n \"type\": {\n \"defined\": {\n \"name\": \"WrappedI80F48\"\n }\n }\n },\n {\n \"name\": \"_reserved0\",\n \"type\": {\n \"array\": [\n \"u8\",\n 32\n ]\n }\n },\n {\n \"name\": \"_reserved1\",\n \"type\": {\n \"array\": [\n \"u8\",\n 64\n ]\n }\n }\n ]\n }\n },\n {\n \"name\": \"FeeStateCache\",\n \"repr\": {\n \"kind\": \"c\"\n },\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": [\n {\n \"name\": \"global_fee_wallet\",\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"program_fee_fixed\",\n \"type\": {\n \"defined\": {\n \"name\": \"WrappedI80F48\"\n }\n }\n },\n {\n \"name\": \"program_fee_rate\",\n \"type\": {\n \"defined\": {\n \"name\": \"WrappedI80F48\"\n }\n }\n },\n {\n \"name\": \"last_update\",\n \"type\": \"i64\"\n }\n ]\n }\n },\n {\n \"name\": \"GroupEventHeader\",\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": [\n {\n \"name\": \"signer\",\n \"type\": {\n \"option\": \"pubkey\"\n }\n },\n {\n \"name\": \"lendr_group\",\n \"type\": \"pubkey\"\n }\n ]\n }\n },\n {\n \"name\": \"HealthCache\",\n \"docs\": [\n \"A read-only cache of the internal risk engine's information. Only valid in borrow/withdraw if\",\n \"the tx does not fail. To see the state in any context, e.g. to figure out if the risk engine is\",\n \"failing due to some bad price information, use `pulse_health`.\",\n \"\",\n \"Note:\"\n ],\n \"repr\": {\n \"kind\": \"c\"\n },\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": [\n {\n \"name\": \"asset_value\",\n \"docs\": [\n \"Internal risk engine asset value, using initial weight (e.g. what is used for borrowing\",\n \"purposes), with all confidence adjustments, and other discounts on price.\",\n \"* Uses EMA price\",\n \"* In dollars\"\n ],\n \"type\": {\n \"defined\": {\n \"name\": \"WrappedI80F48\"\n }\n }\n },\n {\n \"name\": \"liability_value\",\n \"docs\": [\n \"Internal risk engine liability value, using initial weight (e.g. what is used for borrowing\",\n \"purposes), with all confidence adjustments, and other discounts on price.\",\n \"* Uses EMA price\",\n \"* In dollars\"\n ],\n \"type\": {\n \"defined\": {\n \"name\": \"WrappedI80F48\"\n }\n }\n },\n {\n \"name\": \"asset_value_maint\",\n \"docs\": [\n \"Internal risk engine asset value, using maintenance weight (e.g. what is used for\",\n \"liquidation purposes), with all confidence adjustments.\",\n \"* Zero if the risk engine failed to load\",\n \"* Uses SPOT price\",\n \"* In dollars\"\n ],\n \"type\": {\n \"defined\": {\n \"name\": \"WrappedI80F48\"\n }\n }\n },\n {\n \"name\": \"liability_value_maint\",\n \"docs\": [\n \"Internal risk engine liability value, using maintenance weight (e.g. what is used for\",\n \"liquidation purposes), with all confidence adjustments.\",\n \"* Zero if the risk engine failed to load\",\n \"* Uses SPOT price\",\n \"* In dollars\"\n ],\n \"type\": {\n \"defined\": {\n \"name\": \"WrappedI80F48\"\n }\n }\n },\n {\n \"name\": \"asset_value_equity\",\n \"docs\": [\n \"The \\\"true\\\" value of assets without any confidence or weight adjustments. Internally, used\",\n \"only for bankruptcies.\",\n \"* Zero if the risk engine failed to load\",\n \"* Uses EMA price\",\n \"* In dollars\"\n ],\n \"type\": {\n \"defined\": {\n \"name\": \"WrappedI80F48\"\n }\n }\n },\n {\n \"name\": \"liability_value_equity\",\n \"docs\": [\n \"The \\\"true\\\" value of liabilities without any confidence or weight adjustments.\",\n \"Internally, used only for bankruptcies.\",\n \"* Zero if the risk engine failed to load\",\n \"* Uses EMA price\",\n \"* In dollars\"\n ],\n \"type\": {\n \"defined\": {\n \"name\": \"WrappedI80F48\"\n }\n }\n },\n {\n \"name\": \"timestamp\",\n \"docs\": [\n \"Unix timestamp from the system clock when this cache was last updated\"\n ],\n \"type\": \"i64\"\n },\n {\n \"name\": \"flags\",\n \"docs\": [\n \"The flags that indicate the state of the health cache. This is a u64 bitfield, where each\",\n \"bit represents a flag.\",\n \"\",\n \"* HEALTHY = 1 - If set, the account cannot be liquidated. If 0, the account is unhealthy and\",\n \"can be liquidated.\",\n \"* ENGINE STATUS = 2 - If set, the engine did not error during the last health pulse. If 0,\",\n \"the engine would have errored and this cache is likely invalid. `RiskEngineInitRejected`\",\n \"is ignored and will allow the flag to be set anyways.\",\n \"* ORACLE OK = 4 - If set, the engine did not error due to an oracle issue. If 0, engine was\",\n \"passed a bad bank or oracle account, or an oracle was stale. Check the order in which\",\n \"accounts were passed and ensure each balance has the correct banks/oracles, and that\",\n \"oracle cranks ran recently enough. Check `internal_err` and `err_index` for more details\",\n \"in some circumstances. Invalid if generated after borrow/withdraw (these instructions will\",\n \"ignore oracle issues if health is still satisfactory with some balance zeroed out).\",\n \"* 8, 16, 32, 64, 128, etc - reserved for future use\"\n ],\n \"type\": \"u32\"\n },\n {\n \"name\": \"lendr_err\",\n \"docs\": [\n \"If the engine errored, look here for the error code. If the engine returns ok, you may also\",\n \"check here to see if the risk engine rejected this tx (3009).\"\n ],\n \"type\": \"u32\"\n },\n {\n \"name\": \"prices\",\n \"docs\": [\n \"Each price corresponds to that index of Balances in the LendingAccount. Useful for debugging\",\n \"or liquidator consumption, to determine how a user's position is priced internally.\",\n \"* An f64 stored as bytes\"\n ],\n \"type\": {\n \"array\": [\n {\n \"array\": [\n \"u8\",\n 8\n ]\n },\n 16\n ]\n }\n },\n {\n \"name\": \"internal_err\",\n \"docs\": [\n \"Errors in asset oracles are ignored (with prices treated as zero). If you see a zero price\",\n \"and the `ORACLE_OK` flag is not set, check here to see what error was ignored internally.\"\n ],\n \"type\": \"u32\"\n },\n {\n \"name\": \"err_index\",\n \"docs\": [\n \"Index in `balances` where `internal_err` appeared\"\n ],\n \"type\": \"u8\"\n },\n {\n \"name\": \"program_version\",\n \"docs\": [\n \"Since 0.1.3, the version will be encoded here. See PROGRAM_VERSION.\"\n ],\n \"type\": \"u8\"\n },\n {\n \"name\": \"pad0\",\n \"type\": {\n \"array\": [\n \"u8\",\n 2\n ]\n }\n },\n {\n \"name\": \"internal_liq_err\",\n \"type\": \"u32\"\n },\n {\n \"name\": \"internal_bankruptcy_err\",\n \"type\": \"u32\"\n },\n {\n \"name\": \"reserved0\",\n \"type\": {\n \"array\": [\n \"u8\",\n 32\n ]\n }\n },\n {\n \"name\": \"reserved1\",\n \"type\": {\n \"array\": [\n \"u8\",\n 16\n ]\n }\n }\n ]\n }\n },\n {\n \"name\": \"HealthPulseEvent\",\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": [\n {\n \"name\": \"account\",\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"health_cache\",\n \"type\": {\n \"defined\": {\n \"name\": \"HealthCache\"\n }\n }\n }\n ]\n }\n },\n {\n \"name\": \"InterestRateConfig\",\n \"repr\": {\n \"kind\": \"c\"\n },\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": [\n {\n \"name\": \"optimal_utilization_rate\",\n \"type\": {\n \"defined\": {\n \"name\": \"WrappedI80F48\"\n }\n }\n },\n {\n \"name\": \"plateau_interest_rate\",\n \"type\": {\n \"defined\": {\n \"name\": \"WrappedI80F48\"\n }\n }\n },\n {\n \"name\": \"max_interest_rate\",\n \"type\": {\n \"defined\": {\n \"name\": \"WrappedI80F48\"\n }\n }\n },\n {\n \"name\": \"insurance_fee_fixed_apr\",\n \"docs\": [\n \"Goes to insurance, funds `collected_insurance_fees_outstanding`\"\n ],\n \"type\": {\n \"defined\": {\n \"name\": \"WrappedI80F48\"\n }\n }\n },\n {\n \"name\": \"insurance_ir_fee\",\n \"docs\": [\n \"Goes to insurance, funds `collected_insurance_fees_outstanding`\"\n ],\n \"type\": {\n \"defined\": {\n \"name\": \"WrappedI80F48\"\n }\n }\n },\n {\n \"name\": \"protocol_fixed_fee_apr\",\n \"docs\": [\n \"Earned by the group, goes to `collected_group_fees_outstanding`\"\n ],\n \"type\": {\n \"defined\": {\n \"name\": \"WrappedI80F48\"\n }\n }\n },\n {\n \"name\": \"protocol_ir_fee\",\n \"docs\": [\n \"Earned by the group, goes to `collected_group_fees_outstanding`\"\n ],\n \"type\": {\n \"defined\": {\n \"name\": \"WrappedI80F48\"\n }\n }\n },\n {\n \"name\": \"protocol_origination_fee\",\n \"type\": {\n \"defined\": {\n \"name\": \"WrappedI80F48\"\n }\n }\n },\n {\n \"name\": \"_padding0\",\n \"type\": {\n \"array\": [\n \"u8\",\n 16\n ]\n }\n },\n {\n \"name\": \"_padding1\",\n \"type\": {\n \"array\": [\n {\n \"array\": [\n \"u8\",\n 32\n ]\n },\n 3\n ]\n }\n }\n ]\n }\n },\n {\n \"name\": \"InterestRateConfigCompact\",\n \"repr\": {\n \"kind\": \"c\"\n },\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": [\n {\n \"name\": \"optimal_utilization_rate\",\n \"type\": {\n \"defined\": {\n \"name\": \"WrappedI80F48\"\n }\n }\n },\n {\n \"name\": \"plateau_interest_rate\",\n \"type\": {\n \"defined\": {\n \"name\": \"WrappedI80F48\"\n }\n }\n },\n {\n \"name\": \"max_interest_rate\",\n \"type\": {\n \"defined\": {\n \"name\": \"WrappedI80F48\"\n }\n }\n },\n {\n \"name\": \"insurance_fee_fixed_apr\",\n \"type\": {\n \"defined\": {\n \"name\": \"WrappedI80F48\"\n }\n }\n },\n {\n \"name\": \"insurance_ir_fee\",\n \"type\": {\n \"defined\": {\n \"name\": \"WrappedI80F48\"\n }\n }\n },\n {\n \"name\": \"protocol_fixed_fee_apr\",\n \"type\": {\n \"defined\": {\n \"name\": \"WrappedI80F48\"\n }\n }\n },\n {\n \"name\": \"protocol_ir_fee\",\n \"type\": {\n \"defined\": {\n \"name\": \"WrappedI80F48\"\n }\n }\n },\n {\n \"name\": \"protocol_origination_fee\",\n \"type\": {\n \"defined\": {\n \"name\": \"WrappedI80F48\"\n }\n }\n }\n ]\n }\n },\n {\n \"name\": \"InterestRateConfigOpt\",\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": [\n {\n \"name\": \"optimal_utilization_rate\",\n \"type\": {\n \"option\": {\n \"defined\": {\n \"name\": \"WrappedI80F48\"\n }\n }\n }\n },\n {\n \"name\": \"plateau_interest_rate\",\n \"type\": {\n \"option\": {\n \"defined\": {\n \"name\": \"WrappedI80F48\"\n }\n }\n }\n },\n {\n \"name\": \"max_interest_rate\",\n \"type\": {\n \"option\": {\n \"defined\": {\n \"name\": \"WrappedI80F48\"\n }\n }\n }\n },\n {\n \"name\": \"insurance_fee_fixed_apr\",\n \"type\": {\n \"option\": {\n \"defined\": {\n \"name\": \"WrappedI80F48\"\n }\n }\n }\n },\n {\n \"name\": \"insurance_ir_fee\",\n \"type\": {\n \"option\": {\n \"defined\": {\n \"name\": \"WrappedI80F48\"\n }\n }\n }\n },\n {\n \"name\": \"protocol_fixed_fee_apr\",\n \"type\": {\n \"option\": {\n \"defined\": {\n \"name\": \"WrappedI80F48\"\n }\n }\n }\n },\n {\n \"name\": \"protocol_ir_fee\",\n \"type\": {\n \"option\": {\n \"defined\": {\n \"name\": \"WrappedI80F48\"\n }\n }\n }\n },\n {\n \"name\": \"protocol_origination_fee\",\n \"type\": {\n \"option\": {\n \"defined\": {\n \"name\": \"WrappedI80F48\"\n }\n }\n }\n }\n ]\n }\n },\n {\n \"name\": \"LendingAccount\",\n \"repr\": {\n \"kind\": \"c\"\n },\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": [\n {\n \"name\": \"balances\",\n \"type\": {\n \"array\": [\n {\n \"defined\": {\n \"name\": \"Balance\"\n }\n },\n 16\n ]\n }\n },\n {\n \"name\": \"_padding\",\n \"type\": {\n \"array\": [\n \"u64\",\n 8\n ]\n }\n }\n ]\n }\n },\n {\n \"name\": \"LendingAccountBorrowEvent\",\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": [\n {\n \"name\": \"header\",\n \"type\": {\n \"defined\": {\n \"name\": \"AccountEventHeader\"\n }\n }\n },\n {\n \"name\": \"bank\",\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"mint\",\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"amount\",\n \"type\": \"u64\"\n }\n ]\n }\n },\n {\n \"name\": \"LendingAccountDepositEvent\",\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": [\n {\n \"name\": \"header\",\n \"type\": {\n \"defined\": {\n \"name\": \"AccountEventHeader\"\n }\n }\n },\n {\n \"name\": \"bank\",\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"mint\",\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"amount\",\n \"type\": \"u64\"\n }\n ]\n }\n },\n {\n \"name\": \"LendingAccountLiquidateEvent\",\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": [\n {\n \"name\": \"header\",\n \"type\": {\n \"defined\": {\n \"name\": \"AccountEventHeader\"\n }\n }\n },\n {\n \"name\": \"liquidatee_lendr_account\",\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"liquidatee_lendr_account_authority\",\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"asset_bank\",\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"asset_mint\",\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"liability_bank\",\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"liability_mint\",\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"liquidatee_pre_health\",\n \"type\": \"f64\"\n },\n {\n \"name\": \"liquidatee_post_health\",\n \"type\": \"f64\"\n },\n {\n \"name\": \"pre_balances\",\n \"type\": {\n \"defined\": {\n \"name\": \"LiquidationBalances\"\n }\n }\n },\n {\n \"name\": \"post_balances\",\n \"type\": {\n \"defined\": {\n \"name\": \"LiquidationBalances\"\n }\n }\n }\n ]\n }\n },\n {\n \"name\": \"LendingAccountRepayEvent\",\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": [\n {\n \"name\": \"header\",\n \"type\": {\n \"defined\": {\n \"name\": \"AccountEventHeader\"\n }\n }\n },\n {\n \"name\": \"bank\",\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"mint\",\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"amount\",\n \"type\": \"u64\"\n },\n {\n \"name\": \"close_balance\",\n \"type\": \"bool\"\n }\n ]\n }\n },\n {\n \"name\": \"LendingAccountWithdrawEvent\",\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": [\n {\n \"name\": \"header\",\n \"type\": {\n \"defined\": {\n \"name\": \"AccountEventHeader\"\n }\n }\n },\n {\n \"name\": \"bank\",\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"mint\",\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"amount\",\n \"type\": \"u64\"\n },\n {\n \"name\": \"close_balance\",\n \"type\": \"bool\"\n }\n ]\n }\n },\n {\n \"name\": \"LendingPoolBankAccrueInterestEvent\",\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": [\n {\n \"name\": \"header\",\n \"type\": {\n \"defined\": {\n \"name\": \"GroupEventHeader\"\n }\n }\n },\n {\n \"name\": \"bank\",\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"mint\",\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"delta\",\n \"type\": \"u64\"\n },\n {\n \"name\": \"fees_collected\",\n \"type\": \"f64\"\n },\n {\n \"name\": \"insurance_collected\",\n \"type\": \"f64\"\n }\n ]\n }\n },\n {\n \"name\": \"LendingPoolBankCollectFeesEvent\",\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": [\n {\n \"name\": \"header\",\n \"type\": {\n \"defined\": {\n \"name\": \"GroupEventHeader\"\n }\n }\n },\n {\n \"name\": \"bank\",\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"mint\",\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"group_fees_collected\",\n \"type\": \"f64\"\n },\n {\n \"name\": \"group_fees_outstanding\",\n \"type\": \"f64\"\n },\n {\n \"name\": \"insurance_fees_collected\",\n \"type\": \"f64\"\n },\n {\n \"name\": \"insurance_fees_outstanding\",\n \"type\": \"f64\"\n }\n ]\n }\n },\n {\n \"name\": \"LendingPoolBankConfigureEvent\",\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": [\n {\n \"name\": \"header\",\n \"type\": {\n \"defined\": {\n \"name\": \"GroupEventHeader\"\n }\n }\n },\n {\n \"name\": \"bank\",\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"mint\",\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"config\",\n \"type\": {\n \"defined\": {\n \"name\": \"BankConfigOpt\"\n }\n }\n }\n ]\n }\n },\n {\n \"name\": \"LendingPoolBankConfigureFrozenEvent\",\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": [\n {\n \"name\": \"header\",\n \"type\": {\n \"defined\": {\n \"name\": \"GroupEventHeader\"\n }\n }\n },\n {\n \"name\": \"bank\",\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"mint\",\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"deposit_limit\",\n \"type\": \"u64\"\n },\n {\n \"name\": \"borrow_limit\",\n \"type\": \"u64\"\n }\n ]\n }\n },\n {\n \"name\": \"LendingPoolBankConfigureOracleEvent\",\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": [\n {\n \"name\": \"header\",\n \"type\": {\n \"defined\": {\n \"name\": \"GroupEventHeader\"\n }\n }\n },\n {\n \"name\": \"bank\",\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"oracle_setup\",\n \"type\": \"u8\"\n },\n {\n \"name\": \"oracle\",\n \"type\": \"pubkey\"\n }\n ]\n }\n },\n {\n \"name\": \"LendingPoolBankCreateEvent\",\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": [\n {\n \"name\": \"header\",\n \"type\": {\n \"defined\": {\n \"name\": \"GroupEventHeader\"\n }\n }\n },\n {\n \"name\": \"bank\",\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"mint\",\n \"type\": \"pubkey\"\n }\n ]\n }\n },\n {\n \"name\": \"LendingPoolBankHandleBankruptcyEvent\",\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": [\n {\n \"name\": \"header\",\n \"type\": {\n \"defined\": {\n \"name\": \"AccountEventHeader\"\n }\n }\n },\n {\n \"name\": \"bank\",\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"mint\",\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"bad_debt\",\n \"type\": \"f64\"\n },\n {\n \"name\": \"covered_amount\",\n \"type\": \"f64\"\n },\n {\n \"name\": \"socialized_amount\",\n \"type\": \"f64\"\n }\n ]\n }\n },\n {\n \"name\": \"LendrAccount\",\n \"serialization\": \"bytemuck\",\n \"repr\": {\n \"kind\": \"c\"\n },\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": [\n {\n \"name\": \"group\",\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"authority\",\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"lending_account\",\n \"type\": {\n \"defined\": {\n \"name\": \"LendingAccount\"\n }\n }\n },\n {\n \"name\": \"account_flags\",\n \"docs\": [\n \"The flags that indicate the state of the account. This is u64 bitfield, where each bit\",\n \"represents a flag.\",\n \"\",\n \"Flags:LendrAccount\",\n \"- 1: `ACCOUNT_DISABLED` - Indicates that the account is disabled and no further actions can\",\n \"be taken on it.\",\n \"- 2: `ACCOUNT_IN_FLASHLOAN` - Only set when an account is within a flash loan, e.g. when\",\n \"start_flashloan is called, then unset when the flashloan ends.\",\n \"- 4: `ACCOUNT_FLAG_DEPRECATED` - Deprecated, available for future use\",\n \"- 8: `ACCOUNT_TRANSFER_AUTHORITY_ALLOWED` - the admin has flagged with account to be moved,\",\n \"original owner can now call `set_account_transfer_authority`\"\n ],\n \"type\": \"u64\"\n },\n {\n \"name\": \"emissions_destination_account\",\n \"docs\": [\n \"Set with `update_emissions_destination_account`. Emissions rewards can be withdrawn to the\",\n \"canonical ATA of this wallet without the user's input (withdraw_emissions_permissionless).\",\n \"If pubkey default, the user has not opted into this feature, and must claim emissions\",\n \"manually (withdraw_emissions).\"\n ],\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"health_cache\",\n \"type\": {\n \"defined\": {\n \"name\": \"HealthCache\"\n }\n }\n },\n {\n \"name\": \"_padding0\",\n \"type\": {\n \"array\": [\n \"u64\",\n 21\n ]\n }\n }\n ]\n }\n },\n {\n \"name\": \"LendrAccountCreateEvent\",\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": [\n {\n \"name\": \"header\",\n \"type\": {\n \"defined\": {\n \"name\": \"AccountEventHeader\"\n }\n }\n }\n ]\n }\n },\n {\n \"name\": \"LendrAccountTransferAccountAuthorityEvent\",\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": [\n {\n \"name\": \"header\",\n \"type\": {\n \"defined\": {\n \"name\": \"AccountEventHeader\"\n }\n }\n },\n {\n \"name\": \"old_account_authority\",\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"new_account_authority\",\n \"type\": \"pubkey\"\n }\n ]\n }\n },\n {\n \"name\": \"LendrGroup\",\n \"serialization\": \"bytemuck\",\n \"repr\": {\n \"kind\": \"c\"\n },\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": [\n {\n \"name\": \"admin\",\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"group_flags\",\n \"docs\": [\n \"Bitmask for group settings flags.\",\n \"* 0: `PROGRAM_FEES_ENABLED` If set, program-level fees are enabled.\",\n \"* 1: `ARENA_GROUP` If set, this is an arena group, which can only have two banks\",\n \"* Bits 1-63: Reserved for future use.\"\n ],\n \"type\": \"u64\"\n },\n {\n \"name\": \"fee_state_cache\",\n \"docs\": [\n \"Caches information from the global `FeeState` so the FeeState can be omitted on certain ixes\"\n ],\n \"type\": {\n \"defined\": {\n \"name\": \"FeeStateCache\"\n }\n }\n },\n {\n \"name\": \"banks\",\n \"type\": \"u16\"\n },\n {\n \"name\": \"pad0\",\n \"type\": {\n \"array\": [\n \"u8\",\n 6\n ]\n }\n },\n {\n \"name\": \"emode_admin\",\n \"docs\": [\n \"This admin can configure collateral ratios above (but not below) the collateral ratio of\",\n \"certain banks , e.g. allow SOL to count as 90% collateral when borrowing an LST instead of\",\n \"the default rate.\"\n ],\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"_padding_0\",\n \"type\": {\n \"array\": [\n {\n \"array\": [\n \"u64\",\n 2\n ]\n },\n 24\n ]\n }\n },\n {\n \"name\": \"_padding_1\",\n \"type\": {\n \"array\": [\n {\n \"array\": [\n \"u64\",\n 2\n ]\n },\n 32\n ]\n }\n },\n {\n \"name\": \"_padding_4\",\n \"type\": \"u64\"\n }\n ]\n }\n },\n {\n \"name\": \"LendrGroupConfigureEvent\",\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": [\n {\n \"name\": \"header\",\n \"type\": {\n \"defined\": {\n \"name\": \"GroupEventHeader\"\n }\n }\n },\n {\n \"name\": \"admin\",\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"flags\",\n \"type\": \"u64\"\n }\n ]\n }\n },\n {\n \"name\": \"LendrGroupCreateEvent\",\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": [\n {\n \"name\": \"header\",\n \"type\": {\n \"defined\": {\n \"name\": \"GroupEventHeader\"\n }\n }\n }\n ]\n }\n },\n {\n \"name\": \"LiquidationBalances\",\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": [\n {\n \"name\": \"liquidatee_asset_balance\",\n \"type\": \"f64\"\n },\n {\n \"name\": \"liquidatee_liability_balance\",\n \"type\": \"f64\"\n },\n {\n \"name\": \"liquidator_asset_balance\",\n \"type\": \"f64\"\n },\n {\n \"name\": \"liquidator_liability_balance\",\n \"type\": \"f64\"\n }\n ]\n }\n },\n {\n \"name\": \"OracleSetup\",\n \"repr\": {\n \"kind\": \"rust\"\n },\n \"type\": {\n \"kind\": \"enum\",\n \"variants\": [\n {\n \"name\": \"None\"\n },\n {\n \"name\": \"PythLegacy\"\n },\n {\n \"name\": \"SwitchboardV2\"\n },\n {\n \"name\": \"PythPushOracle\"\n },\n {\n \"name\": \"SwitchboardPull\"\n },\n {\n \"name\": \"StakedWithPythPush\"\n }\n ]\n }\n },\n {\n \"name\": \"RiskTier\",\n \"repr\": {\n \"kind\": \"rust\"\n },\n \"type\": {\n \"kind\": \"enum\",\n \"variants\": [\n {\n \"name\": \"Collateral\"\n },\n {\n \"name\": \"Isolated\"\n }\n ]\n }\n },\n {\n \"name\": \"StakedSettings\",\n \"docs\": [\n \"Unique per-group. Staked Collateral banks created under a group automatically use these\",\n \"settings. Groups that have not created this struct cannot create staked collateral banks. When\",\n \"this struct updates, changes must be permissionlessly propogated to staked collateral banks.\",\n \"Administrators can also edit the bank manually, i.e. with configure_bank, to temporarily make\",\n \"changes such as raising the deposit limit for a single bank.\"\n ],\n \"serialization\": \"bytemuck\",\n \"repr\": {\n \"kind\": \"c\"\n },\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": [\n {\n \"name\": \"key\",\n \"docs\": [\n \"This account's own key. A PDA derived from `lendr_group` and `STAKED_SETTINGS_SEED`\"\n ],\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"lendr_group\",\n \"docs\": [\n \"Group for which these settings apply\"\n ],\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"oracle\",\n \"docs\": [\n \"Generally, the Pyth push oracle for SOL\"\n ],\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"asset_weight_init\",\n \"type\": {\n \"defined\": {\n \"name\": \"WrappedI80F48\"\n }\n }\n },\n {\n \"name\": \"asset_weight_maint\",\n \"type\": {\n \"defined\": {\n \"name\": \"WrappedI80F48\"\n }\n }\n },\n {\n \"name\": \"deposit_limit\",\n \"type\": \"u64\"\n },\n {\n \"name\": \"total_asset_value_init_limit\",\n \"type\": \"u64\"\n },\n {\n \"name\": \"oracle_max_age\",\n \"type\": \"u16\"\n },\n {\n \"name\": \"risk_tier\",\n \"type\": {\n \"defined\": {\n \"name\": \"RiskTier\"\n }\n }\n },\n {\n \"name\": \"_pad0\",\n \"type\": {\n \"array\": [\n \"u8\",\n 5\n ]\n }\n },\n {\n \"name\": \"_reserved0\",\n \"docs\": [\n \"The following values are irrelevant because staked collateral positions do not support\",\n \"borrowing.\"\n ],\n \"type\": {\n \"array\": [\n \"u8\",\n 8\n ]\n }\n },\n {\n \"name\": \"_reserved1\",\n \"type\": {\n \"array\": [\n \"u8\",\n 32\n ]\n }\n },\n {\n \"name\": \"_reserved2\",\n \"type\": {\n \"array\": [\n \"u8\",\n 64\n ]\n }\n }\n ]\n }\n },\n {\n \"name\": \"StakedSettingsConfig\",\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": [\n {\n \"name\": \"oracle\",\n \"type\": \"pubkey\"\n },\n {\n \"name\": \"asset_weight_init\",\n \"type\": {\n \"defined\": {\n \"name\": \"WrappedI80F48\"\n }\n }\n },\n {\n \"name\": \"asset_weight_maint\",\n \"type\": {\n \"defined\": {\n \"name\": \"WrappedI80F48\"\n }\n }\n },\n {\n \"name\": \"deposit_limit\",\n \"type\": \"u64\"\n },\n {\n \"name\": \"total_asset_value_init_limit\",\n \"type\": \"u64\"\n },\n {\n \"name\": \"oracle_max_age\",\n \"type\": \"u16\"\n },\n {\n \"name\": \"risk_tier\",\n \"docs\": [\n \"WARN: You almost certainly want \\\"Collateral\\\", using Isolated risk tier makes the asset\",\n \"worthless as collateral, and is generally useful only when creating a staked collateral pool\",\n \"for rewards purposes only.\"\n ],\n \"type\": {\n \"defined\": {\n \"name\": \"RiskTier\"\n }\n }\n }\n ]\n }\n },\n {\n \"name\": \"StakedSettingsEditConfig\",\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": [\n {\n \"name\": \"oracle\",\n \"type\": {\n \"option\": \"pubkey\"\n }\n },\n {\n \"name\": \"asset_weight_init\",\n \"type\": {\n \"option\": {\n \"defined\": {\n \"name\": \"WrappedI80F48\"\n }\n }\n }\n },\n {\n \"name\": \"asset_weight_maint\",\n \"type\": {\n \"option\": {\n \"defined\": {\n \"name\": \"WrappedI80F48\"\n }\n }\n }\n },\n {\n \"name\": \"deposit_limit\",\n \"type\": {\n \"option\": \"u64\"\n }\n },\n {\n \"name\": \"total_asset_value_init_limit\",\n \"type\": {\n \"option\": \"u64\"\n }\n },\n {\n \"name\": \"oracle_max_age\",\n \"type\": {\n \"option\": \"u16\"\n }\n },\n {\n \"name\": \"risk_tier\",\n \"docs\": [\n \"WARN: You almost certainly want \\\"Collateral\\\", using Isolated risk tier makes the asset\",\n \"worthless as collateral, making all outstanding accounts eligible to be liquidated, and is\",\n \"generally useful only when creating a staked collateral pool for rewards purposes only.\"\n ],\n \"type\": {\n \"option\": {\n \"defined\": {\n \"name\": \"RiskTier\"\n }\n }\n }\n }\n ]\n }\n },\n {\n \"name\": \"WrappedI80F48\",\n \"serialization\": \"bytemuck\",\n \"repr\": {\n \"kind\": \"c\",\n \"align\": 8\n },\n \"type\": {\n \"kind\": \"struct\",\n \"fields\": [\n {\n \"name\": \"value\",\n \"type\": {\n \"array\": [\n \"u8\",\n 16\n ]\n }\n }\n ]\n }\n }\n ]\n}","import LENDR_IDL_V0_1_3_JSON from \"./lendr_0.1.3.json\";\nimport type { Lendr as LendrIdlTypeV0_1_3 } from \"./lendr-types_0.1.3\";\n\nexport const LENDR_IDL = LENDR_IDL_V0_1_3_JSON as LendrIdlType;\nexport type LendrIdlType = LendrIdlTypeV0_1_3;\n","import {LangErrorMessage} from \"@coral-xyz/anchor\";\nimport type {PublicKey} from \"@solana/web3.js\";\nimport type {SolanaTransaction} from \"./common\";\nimport {LENDR_IDL} from \"./idl\";\nimport {TOKEN_PROGRAM_ID} from \"@solana/spl-token\";\nimport {JUPITER_V6_PROGRAM} from \"@/constants\";\n\nexport enum ProcessTransactionErrorType {\n TransactionBuildingError,\n TransactionSendingError,\n SimulationError,\n TransactionTupleError,\n\n FallthroughError,\n TimeoutError,\n}\n\nexport class ProcessTransactionError extends Error {\n logs?: string[];\n type: ProcessTransactionErrorType;\n programId?: string;\n failedTxs?: SolanaTransaction[];\n\t_error?: Error;\n\n constructor({\n message,\n type,\n logs,\n programId,\n code,\n failedTxs,\n\t _error,\n }: {\n message: string;\n type: ProcessTransactionErrorType;\n logs?: string[];\n programId?: string;\n code?: number;\n failedTxs?: SolanaTransaction[];\n\t\t_error?: Error;\n }) {\n super(message);\n this.programId = programId;\n this.type = type;\n this.logs = logs;\n this.failedTxs = failedTxs;\n\t\tthis._error = _error;\n }\n\n static withFailedTransactions(\n error: ProcessTransactionError,\n failedTxs: SolanaTransaction[],\n ): ProcessTransactionError {\n return new ProcessTransactionError({\n message: error.message,\n type: error.type,\n logs: error.logs,\n programId: error.programId,\n failedTxs: failedTxs,\n\t _error: error\n });\n }\n}\n\nexport interface ProgramError {\n programId: string;\n code: number;\n}\n\nexport interface ProgramErrorWithDescription extends ProgramError {\n description: string;\n}\n\nconst LDR_ERROR_CODE_MAP: Map<number, string> = new Map(LENDR_IDL.errors.map((error) => [error.code, error.msg]));\n\nexport function parseTransactionError(error: any, ldrProgramId: PublicKey) {\n const logs = error?.logs;\n const name = error?.name;\n let message = error?.transactionMessage ?? error?.message ?? error?.err;\n let programId = error?.programId;\n let code = error?.code;\n\n if (message) {\n message = message.replace(/\\\\\"/g, '\"').replace(/^\"|\"$/g, \"\");\n } else if (error?.error) {\n message = error.error.replace(/\\\\\"/g, '\"').replace(/^\"|\"$/g, \"\");\n }\n\n if (logs) {\n const parsedError = parseErrorFromLogs(logs, ldrProgramId);\n if (parsedError) {\n message = parsedError.description;\n programId = parsedError.programId;\n code = parsedError.code;\n }\n }\n\n return {\n programId: programId,\n type: name,\n description: message,\n code: code,\n };\n}\n\nexport function parseErrorFromLogs(logs: string[], ldrProgramId: PublicKey): ProgramErrorWithDescription | null {\n const customError = parseCustomProgramError(logs, ldrProgramId);\n if (customError) return customError;\n\n return null;\n}\n\nfunction parseCustomProgramError(logs: string[], ldrProgramId: PublicKey): ProgramErrorWithDescription | null {\n const error = parseCustomProgramErrorFromLogs(logs);\n if (error === null) {\n return null;\n }\n\n let errorMsg: string | undefined;\n\n if (error.programId === ldrProgramId.toBase58()) {\n const ldrError = LDR_ERROR_CODE_MAP.get(error.code);\n if (ldrError !== undefined) {\n return { code: error.code, programId: error.programId, description: ldrError };\n }\n }\n\n const programErrors = ERROR_CODE_MAPS.get(error.programId);\n if (programErrors !== undefined) {\n errorMsg = programErrors.get(error.code);\n if (errorMsg !== undefined) {\n return { code: error.code, programId: error.programId, description: errorMsg };\n }\n }\n\n errorMsg = LangErrorMessage.get(error.code);\n if (errorMsg !== undefined) {\n return { code: error.code, programId: error.programId, description: errorMsg };\n }\n\n return null;\n}\n\nfunction parseCustomProgramErrorFromLogs(logs: string[]): ProgramError | null {\n const log = logs.find((log) => log.includes(\"failed: custom program error\"));\n if (!log) return null;\n const regex = /^Program (?<program>\\S+) failed: custom program error: (?<code>0x[0-9a-fA-F]+)/g;\n const match = regex.exec(log);\n if (!match?.groups) return null;\n const code = parseInt(match.groups.code);\n return { programId: match.groups.program, code };\n}\n\nenum TokenErrorCode {\n NotRentExempt = 0,\n InsufficientFunds = 1,\n InvalidMint = 2,\n MintMismatch = 3,\n OwnerMismatch = 4,\n FixedSupply = 5,\n AlreadyInUse = 6,\n InvalidNumberOfProvidedSigners = 7,\n InvalidNumberOfRequiredSigners = 8,\n UninitializedState = 9,\n NativeNotSupported = 10,\n NonNativeHasBalance = 11,\n InvalidInstruction = 12,\n InvalidState = 13,\n Overflow = 14,\n AuthorityTypeNotSupported = 15,\n MintCannotFreeze = 16,\n AccountFrozen = 17,\n MintDecimalsMismatch = 18,\n NonNativeNotSupported = 19,\n}\n\nconst TokenErrorCodeMap: Map<number, string> = new Map([\n [TokenErrorCode.NotRentExempt, \"Lamport balance below rent-exempt threshold\"],\n [TokenErrorCode.InsufficientFunds, \"Insufficient funds\"],\n [TokenErrorCode.InvalidMint, \"Invalid Mint\"],\n [TokenErrorCode.MintMismatch, \"Account not associated with this Mint\"],\n [TokenErrorCode.OwnerMismatch, \"Owner does not match\"],\n [TokenErrorCode.FixedSupply, \"This token's supply is fixed and new tokens cannot be minted\"],\n [TokenErrorCode.AlreadyInUse, \"The account cannot be initialized because it is already being used\"],\n [TokenErrorCode.InvalidNumberOfProvidedSigners, \"Invalid number of provided signers\"],\n [TokenErrorCode.InvalidNumberOfRequiredSigners, \"Invalid number of required signers\"],\n [TokenErrorCode.UninitializedState, \"State is uninitialized\"],\n [TokenErrorCode.NativeNotSupported, \"Instruction does not support native tokens\"],\n [TokenErrorCode.NonNativeHasBalance, \"Non-native account can only be closed if its balance is zero\"],\n [TokenErrorCode.InvalidInstruction, \"Invalid instruction\"],\n [TokenErrorCode.InvalidState, \"State is invalid for requested operation\"],\n [TokenErrorCode.Overflow, \"Operation overflowed\"],\n [TokenErrorCode.AuthorityTypeNotSupported, \"Account does not support specified authority type\"],\n [TokenErrorCode.MintCannotFreeze, \"This token mint cannot freeze accounts\"],\n [TokenErrorCode.AccountFrozen, \"Account is frozen; all account operations will fail\"],\n [TokenErrorCode.MintDecimalsMismatch, \"Mint decimals mismatch between the client and mint\"],\n [TokenErrorCode.NonNativeNotSupported, \"Instruction does not support non-native tokens\"],\n]);\n\nenum JupiterErrorCode {\n EmptyRoute = 6000,\n SlippageToleranceExceeded = 6001,\n InvalidCalculation = 6002,\n MissingPlatformFeeAccount = 6003,\n InvalidSlippage = 6004,\n NotEnoughPercent = 6005,\n InvalidInputIndex = 6006,\n InvalidOutputIndex = 6007,\n NotEnoughAccountKeys = 6008,\n NonZeroMinimumOutAmountNotSupported = 6009,\n InvalidRoutePlan = 6010,\n InvalidReferralAuthority = 6011,\n LedgerTokenAccountDoesNotMatch = 6012,\n InvalidTokenLedger = 6013,\n IncorrectTokenProgramID = 6014,\n TokenProgramNotProvided = 6015,\n SwapNotSupported = 6016,\n ExactOutAmountNotMatched = 6017,\n SourceAndDestinationMintCannotBeTheSame = 6018,\n}\n\nconst JupiterErrorCodeMap: Map<number, string> = new Map([\n [JupiterErrorCode.EmptyRoute, \"Empty route\"],\n [JupiterErrorCode.SlippageToleranceExceeded, \"Slippage tolerance exceeded\"],\n [JupiterErrorCode.InvalidCalculation, \"Invalid calculation\"],\n [JupiterErrorCode.MissingPlatformFeeAccount, \"Missing platform fee account\"],\n [JupiterErrorCode.InvalidSlippage, \"Invalid slippage\"],\n [JupiterErrorCode.NotEnoughPercent, \"Not enough percent to 100\"],\n [JupiterErrorCode.InvalidInputIndex, \"Token input index is invalid\"],\n [JupiterErrorCode.InvalidOutputIndex, \"Token output index is invalid\"],\n [JupiterErrorCode.NotEnoughAccountKeys, \"Not Enough Account keys\"],\n [JupiterErrorCode.NonZeroMinimumOutAmountNotSupported, \"Non zero minimum out amount not supported\"],\n [JupiterErrorCode.InvalidRoutePlan, \"Invalid route plan\"],\n [JupiterErrorCode.InvalidReferralAuthority, \"Invalid referral authority\"],\n [JupiterErrorCode.LedgerTokenAccountDoesNotMatch, \"Token account doesn't match the ledger\"],\n [JupiterErrorCode.InvalidTokenLedger, \"Invalid token ledger\"],\n [JupiterErrorCode.IncorrectTokenProgramID, \"Token program ID is invalid\"],\n [JupiterErrorCode.TokenProgramNotProvided, \"Token program not provided\"],\n [JupiterErrorCode.SwapNotSupported, \"Swap not supported\"],\n [JupiterErrorCode.ExactOutAmountNotMatched, \"Exact out amount doesn't match\"],\n [JupiterErrorCode.SourceAndDestinationMintCannotBeTheSame, \"Source mint and destination mint cannot the same\"],\n]);\n\nconst ERROR_CODE_MAPS: Map<string, Map<number, string>> = new Map([\n [TOKEN_PROGRAM_ID.toBase58(), TokenErrorCodeMap],\n [JUPITER_V6_PROGRAM.toBase58(), JupiterErrorCodeMap],\n]);\n","import {\n\ttype Commitment,\n\ttype ConfirmOptions,\n\ttype Connection,\n\ttype PublicKey,\n\ttype SimulatedTransactionResponse,\n\tSolanaJSONRPCError,\n\ttype Transaction,\n\ttype TransactionSignature,\n\ttype VersionedTransaction,\n} from \"@solana/web3.js\";\nimport {parseTransactionError, ProcessTransactionError, ProcessTransactionErrorType} from \"~/errors\";\nimport {\n\taddTransactionMetadata,\n\tgetComputeBudgetUnits,\n\tisV0Tx,\n\tlegacyTxToV0Tx,\n\tmicroLamportsToUi,\n\tsetTimeoutPromise,\n\tsleep,\n\ttype SolanaTransaction,\n\ttype TransactionBroadcastType,\n\ttype TransactionOptions,\n\ttype Wallet,\n} from \"../../common\";\n\nimport {\n\tBundleSimulationError,\n\tformatTransactions,\n\tisSimulatedTransactionResponse,\n\ttype RpcSimulateBundleTransactionResult,\n\tSendBundleError,\n\tsendTransactionAsBundle,\n\tsendTransactionAsBundleRpc,\n\tsendTransactionAsGrpcBundle,\n\tsimulateBundle,\n} from \"./helpers\";\nimport {DEFAULT_CONFIRM_OPTS, PROGRAM_ID, SKIP_SIMULATION} from \"@/constants\";\nimport bs58 from \"bs58\";\n\nexport const DEFAULT_PROCESS_TX_OPTS = {\n broadcastType: \"RPC\" as TransactionBroadcastType,\n isSequentialTxs: true,\n isReadOnly: false,\n};\nexport interface ProcessTransactionOpts extends ProcessTransactionsClientOpts {\n isReadOnly?: boolean;\n programId?: PublicKey;\n bundleSimRpcEndpoint?: string;\n addArenaTxTag?: boolean;\n}\n\nexport type PriorityFees = {\n bundleTipUi?: number;\n priorityFeeMicro?: number;\n maxCapUi?: number;\n};\n\nexport type BroadcastMethodType = Extract<TransactionBroadcastType, \"BUNDLE\" | \"RPC\">;\n\nexport type SpecificBroadcastMethodType = \"GRPC_BUNDLE\" | \"API_BUNDLE\" | \"RPC_BUNDLE\" | \"RPC_SEQUENTIAL\";\n\nexport type SpecificBroadcastMethod = {\n method: SpecificBroadcastMethodType;\n broadcastType: BroadcastMethodType;\n};\n\nexport type ProcessTransactionStrategy = {\n splitExecutionsStrategy?: {\n singleTx: BroadcastMethodType;\n multiTx: BroadcastMethodType;\n };\n fallbackSequence: SpecificBroadcastMethod[];\n};\n\nexport const DEFAULT_PROCESS_TX_STRATEGY: ProcessTransactionStrategy = {\n splitExecutionsStrategy: {\n singleTx: \"RPC\",\n multiTx: \"RPC\",\n },\n // if splitExecutionsStrategy is provided, the fallbackSequence will prioritize the first relevant broadcast method in the array\n fallbackSequence: [\n { method: \"GRPC_BUNDLE\", broadcastType: \"BUNDLE\" },\n { method: \"API_BUNDLE\", broadcastType: \"BUNDLE\" },\n { method: \"RPC_BUNDLE\", broadcastType: \"RPC\" },\n { method: \"RPC_SEQUENTIAL\", broadcastType: \"RPC\" },\n ],\n};\n\nexport interface ProcessTransactionsClientOpts extends PriorityFees {\n broadcastType?: TransactionBroadcastType;\n dynamicStrategy?: ProcessTransactionStrategy;\n isSequentialTxs?: boolean;\n addArenaTxTag?: boolean;\n callback?: (index?: number, success?: boolean, signature?: string, stepsToAdvance?: number) => void;\n}\n\ntype ProcessTransactionsProps = {\n transactions: SolanaTransaction[];\n connection: Connection;\n wallet: Wallet;\n txOpts?: TransactionOptions;\n processOpts?: ProcessTransactionOpts;\n};\n\n/**\n * Processes a batch of Solana transactions by signing, simulating, and sending them to the network.\n *\n * @param {ProcessTransactionsProps} props - The properties required to process transactions.\n * @param {SolanaTransaction[]} props.transactions - The transactions to be processed.\n * @param {Connection} props.connection - The connection to the Solana network.\n * @param {Wallet} props.wallet - The wallet used to sign the transactions.\n * @param {ProcessTransactionOpts} [props.processOpts] - Optional processing options.\n * @param {TransactionOptions} [props.txOpts] - Optional transaction options.\n *\n * @returns {Promise<TransactionSignature[]>} - A promise that resolves to an array of transaction signatures.\n *\n * @throws {ProcessTransactionError} - Throws an error if transaction processing fails.\n */\nexport async function processTransactions({\n transactions,\n connection,\n wallet,\n processOpts: processOptsArgs,\n txOpts,\n}: ProcessTransactionsProps): Promise<TransactionSignature[]> {\n const processOpts = {\n ...DEFAULT_PROCESS_TX_OPTS,\n ...processOptsArgs,\n };\n const commitment = connection.commitment ?? DEFAULT_CONFIRM_OPTS.commitment;\n\n if (processOpts?.broadcastType === \"BUNDLE\" && processOpts?.bundleTipUi === 0) {\n throw new Error(\"A bundle tip is required for a bundled transactions\");\n }\n\n let broadcastType: BroadcastMethodType;\n let finalFallbackMethod: SpecificBroadcastMethod[];\n\n const strategy = processOpts.dynamicStrategy ?? DEFAULT_PROCESS_TX_STRATEGY;\n if (processOpts?.broadcastType === \"DYNAMIC\") {\n if (strategy.splitExecutionsStrategy) {\n if (transactions.length > 1) {\n broadcastType = strategy.splitExecutionsStrategy.multiTx;\n } else {\n broadcastType = strategy.splitExecutionsStrategy.singleTx;\n }\n } else {\n broadcastType = strategy.fallbackSequence[0].broadcastType;\n }\n } else {\n broadcastType = processOpts.broadcastType;\n }\n\n if (broadcastType === \"RPC\") {\n finalFallbackMethod = strategy.fallbackSequence.filter((method) => method.broadcastType === \"RPC\");\n } else {\n finalFallbackMethod = strategy.fallbackSequence.filter((method) => method.broadcastType === \"BUNDLE\");\n }\n\n let versionedTransactions: VersionedTransaction[] = [];\n let minContextSlot: number;\n let blockhash: string;\n let lastValidBlockHeight: number;\n\n try {\n const getLatestBlockhashAndContext = await connection.getLatestBlockhashAndContext(commitment);\n\n minContextSlot = getLatestBlockhashAndContext.context.slot - 4;\n blockhash = getLatestBlockhashAndContext.value.blockhash;\n lastValidBlockHeight = getLatestBlockhashAndContext.value.lastValidBlockHeight;\n } catch (error) {\n console.error(\"Failed to get latest blockhash and context\", error);\n\n if (error instanceof SolanaJSONRPCError) {\n throw error;\n }\n\n throw new ProcessTransactionError({\n message: \"Failed to get latest blockhash and context.\",\n type: ProcessTransactionErrorType.TransactionBuildingError,\n failedTxs: transactions,\n });\n }\n\n const mergedOpts: ConfirmOptions = {\n ...DEFAULT_CONFIRM_OPTS,\n commitment,\n preflightCommitment: commitment,\n minContextSlot,\n ...txOpts,\n };\n\n let updatedTransactions: SolanaTransaction[] = transactions;\n\n try {\n const simulationResult = await simulateTransactions(processOpts, connection, transactions, mergedOpts, {\n feePayer: wallet.publicKey,\n blockhash,\n });\n\n const unitsConsumed = isSimulatedTransactionResponse(simulationResult)\n ? [simulationResult.unitsConsumed]\n : simulationResult.map((tx) => (tx.unitsConsumed ? Number(tx.unitsConsumed) : undefined));\n\n updatedTransactions = transactions.map((tx, idx) =>\n addTransactionMetadata(tx, {\n ...tx,\n unitsConsumed: unitsConsumed[idx],\n }),\n );\n } catch {\n // only to estimate compute units, final simulation is done just before sending\n }\n\n const maxCapUi = processOpts.maxCapUi;\n\n console.log(\"------ Transaction Details 👇 ------\");\n console.log(`📝 Executing ${transactions.length} transaction${transactions.length > 1 ? \"s\" : \"\"}`);\n console.log(`📡 Broadcast type: ${broadcastType}`);\n if (broadcastType === \"BUNDLE\") {\n console.log(\n `💸 Bundle tip: ${maxCapUi ? Math.min(processOpts.bundleTipUi ?? 0, maxCapUi) : processOpts.bundleTipUi} SOL`,\n );\n } else {\n updatedTransactions.forEach((tx, idx) => {\n const cu = tx.unitsConsumed ? Math.min(tx.unitsConsumed + 50_000, 1_400_000) : getComputeBudgetUnits(tx);\n const priorityFeeUi = maxCapUi\n ? Math.min(processOpts.priorityFeeMicro ? microLamportsToUi(processOpts.priorityFeeMicro, cu) : 0, maxCapUi)\n : processOpts.priorityFeeMicro\n ? microLamportsToUi(processOpts.priorityFeeMicro, cu)\n : 0;\n console.log(`💸 Priority fee for tx ${idx}: ${priorityFeeUi} SOL`);\n });\n }\n console.log(\"--------------------------------\");\n\n versionedTransactions = formatTransactions(\n updatedTransactions,\n broadcastType,\n blockhash,\n {\n priorityFeeMicro: processOpts.priorityFeeMicro ?? 0,\n bundleTipUi: processOpts.bundleTipUi ?? 0,\n feePayer: wallet.publicKey,\n\n maxCapUi,\n },\n processOpts.addArenaTxTag,\n );\n\n let signatures: TransactionSignature[] = [];\n let bundleSignature: string | undefined;\n\n try {\n if (txOpts?.dryRun || processOpts?.isReadOnly) {\n return await dryRunTransaction(processOpts, connection, versionedTransactions);\n } else {\n let base58Txs: string[] = [];\n\n if (wallet.signAllTransactions) {\n versionedTransactions = await wallet.signAllTransactions(versionedTransactions);\n base58Txs = versionedTransactions.map((signedTx) => bs58.encode(signedTx.serialize()));\n } else {\n for (let i = 0; i < versionedTransactions.length; i++) {\n const signedTx = await wallet.signTransaction(versionedTransactions[i]);\n const base58Tx = bs58.encode(signedTx.serialize());\n base58Txs.push(base58Tx);\n versionedTransactions[i] = signedTx;\n }\n }\n // Updating after 'sign in wallet' step in toast\n // If the transactions are bundled, we need to advance the toast by the number of transactions.\n if (broadcastType === \"BUNDLE\") {\n const stepsToAdvance = versionedTransactions.length;\n processOpts.callback?.(undefined, true, undefined, stepsToAdvance);\n } else {\n processOpts.callback?.(undefined, true);\n }\n\n let simulateTxs: (() => Promise<SimulatedTransactionResponse | RpcSimulateBundleTransactionResult[]>) | null =\n null;\n if (!SKIP_SIMULATION) {\n simulateTxs = async () =>\n await simulateTransactions(processOpts, connection, versionedTransactions, mergedOpts);\n }\n\n const sendTxBundleGrpc = async (throwError: boolean) =>\n await sendTransactionAsGrpcBundle(connection, base58Txs, throwError);\n const sendTxBundleApi = async (throwError: boolean, bundleId?: string) =>\n await sendTransactionAsBundle(connection, base58Txs, throwError, bundleId);\n const sendTxBundleRpc = async () =>\n await sendTransactionAsBundleRpc({\n versionedTransactions,\n txOpts,\n connection,\n onCallback: processOpts.callback,\n blockStrategy: { blockhash, lastValidBlockHeight },\n confirmCommitment: mergedOpts.commitment,\n isSequentialTxs: processOpts.isSequentialTxs,\n throwError: true,\n });\n\n for (const [idx, method] of finalFallbackMethod.entries()) {\n const isLast = idx === finalFallbackMethod.length - 1;\n if (idx === 0 && simulateTxs && !SKIP_SIMULATION) {\n await simulateTxs();\n }\n\n let temporaryBundleSignature: string | undefined;\n let sig: string | undefined;\n let sigs: string[] | undefined;\n switch (method.method) {\n case \"GRPC_BUNDLE\":\n // always throw error, this is temporary as bundle already processed isn't catched well\n sig = await sendTxBundleGrpc(true).catch((error) => {\n if (error?.bundleId) {\n temporaryBundleSignature = error.bundleId;\n }\n\n if (isLast) throw error;\n return undefined;\n });\n if (sig) bundleSignature = sig;\n break;\n case \"API_BUNDLE\":\n sig = await sendTxBundleApi(isLast, temporaryBundleSignature);\n if (sig) bundleSignature = sig;\n break;\n case \"RPC_BUNDLE\":\n sigs = await sendTxBundleRpc();\n if (sigs) signatures = sigs;\n break;\n case \"RPC_SEQUENTIAL\":\n console.log(\"implement\");\n break;\n }\n\n if (sig || sigs) {\n break;\n }\n }\n\n if (bundleSignature || signatures.length > 0) {\n console.log(\"------ Transaction Success ✅ ------\");\n if (bundleSignature) {\n console.log(\"Bundle signature:\", bundleSignature);\n }\n if (signatures.length > 0) {\n console.log(\"Transaction signatures:\", signatures.join(\", \"));\n }\n console.log(\"--------------------------------\");\n }\n\n if (signatures.length !== 0) {\n return signatures;\n } else {\n if (!bundleSignature) throw new Error(\"API bundle failed: unknown error\");\n return [bundleSignature];\n }\n }\n } catch (error: any) {\n const failedTxs = transactions.splice(signatures.length);\n\n if (error instanceof SolanaJSONRPCError) {\n throw error;\n }\n\n if (error instanceof ProcessTransactionError) {\n throw ProcessTransactionError.withFailedTransactions(error, failedTxs);\n }\n\n if (error instanceof SendBundleError) {\n // the bundle failed to land not much info we can gather from failing bundles\n throw new ProcessTransactionError({\n message: error.message,\n type: ProcessTransactionErrorType.TransactionSendingError,\n\t programId: PROGRAM_ID.toBase58(),\n failedTxs: failedTxs,\n\t _error: error\n });\n }\n\n\t const parsedError = parseTransactionError(error, processOpts?.programId ?? PROGRAM_ID);\n\n if (error?.logs?.length > 0) {\n console.log(\"------ Logs 👇 ------\");\n console.log(error.logs.join(\"\\n\"));\n if (parsedError) {\n console.log(\"Parsed:\", parsedError);\n throw new ProcessTransactionError({\n message: parsedError.description,\n type: ProcessTransactionErrorType.TransactionSendingError,\n logs: error.logs,\n programId: parsedError.programId,\n\t _error: error\n });\n }\n }\n console.log(\"fallthrough error\", error);\n throw new ProcessTransactionError({\n message: parsedError?.description ?? \"Something went wrong\",\n type: ProcessTransactionErrorType.FallthroughError,\n logs: error.logs,\n programId: parsedError.programId,\n\t _error: error\n });\n }\n}\n\nexport const simulateTransactions = async (\n processOpts: ProcessTransactionOpts,\n connection: Connection,\n solanaTransactions: VersionedTransaction[] | Transaction[] | SolanaTransaction[],\n confirmOpts?: ConfirmOptions,\n txOpts?: {\n feePayer: PublicKey;\n blockhash: string;\n },\n): Promise<SimulatedTransactionResponse | RpcSimulateBundleTransactionResult[]> => {\n const v0Txs = solanaTransactions.map((tx) => (isV0Tx(tx) ? tx : legacyTxToV0Tx(tx, txOpts)));\n\n try {\n if (v0Txs.length > 1) {\n const response = await simulateBundle(processOpts?.bundleSimRpcEndpoint ?? connection.rpcEndpoint, v0Txs);\n return response;\n } else {\n const response = await connection.simulateTransaction(v0Txs[0], {\n sigVerify: false,\n commitment: confirmOpts?.commitment,\n replaceRecentBlockhash: false,\n minContextSlot: confirmOpts?.minContextSlot,\n });\n if (response.value.err) {\n const error = response.value.err;\n\t const parsedError = parseTransactionError(error, processOpts?.programId ?? PROGRAM_ID);\n throw new ProcessTransactionError({\n message: parsedError.description ?? JSON.stringify(response.value.err),\n type: ProcessTransactionErrorType.SimulationError,\n logs: response.value.logs ?? [],\n programId: parsedError.programId,\n });\n }\n return response.value;\n }\n } catch (error) {\n if (error instanceof BundleSimulationError) {\n\t const parsedError = parseTransactionError(error, processOpts?.programId ?? PROGRAM_ID);\n throw new ProcessTransactionError({\n message: parsedError.description,\n type: ProcessTransactionErrorType.SimulationError,\n logs: error.logs,\n programId: parsedError.programId,\n\t _error: error\n });\n }\n\n throw error;\n }\n};\n\nconst dryRunTransaction = async (\n processOpts: ProcessTransactionOpts,\n connection: Connection,\n versionedTransactions: VersionedTransaction[],\n): Promise<TransactionSignature[]> => {\n try {\n const response = await simulateBundle(\n processOpts?.bundleSimRpcEndpoint ?? connection.rpcEndpoint,\n versionedTransactions,\n );\n\n console.log(\"------ Units Consumed 👇 ------\");\n for (const tx of response) {\n console.log(`✅ Success - ${tx.unitsConsumed} CU`);\n }\n\n console.log(\"------ Logs 👇 ------\");\n for (const tx of response) {\n console.log(tx.logs);\n }\n } catch (error) {\n if (error instanceof BundleSimulationError) {\n console.log(`❌ Error: ${error.message}`);\n console.log(\"------ Logs 👇 ------\");\n if (error.logs) {\n for (const log of error.logs) {\n console.log(log);\n }\n }\n }\n throw error;\n }\n\n return [];\n};\n\nexport async function confirmTransaction(\n connection: Connection,\n signature: string,\n commitment: Commitment = \"confirmed\",\n) {\n const getStatus = async () => {\n const commitmentArray: Commitment[] = [\"processed\", \"confirmed\", \"finalized\"];\n const index: number = commitmentArray.indexOf(commitment);\n if (index === -1) throw new Error(\"Invalid commitment\");\n\n let attempts = 0;\n const maxAttempts = 8;\n\n while (attempts < maxAttempts) {\n attempts += 1;\n\n const status = await connection.getSignatureStatus(signature);\n\n if (status?.value?.err) {\n console.error(\"❌ Error:\", status.value.err);\n throw status.value.err;\n }\n\n if (status?.value && status.value.confirmationStatus) {\n const confirmationStatusIndex = commitmentArray.indexOf(status.value.confirmationStatus);\n if (confirmationStatusIndex >= index) {\n return status.value;\n }\n }\n\n console.log(\"🔄 Waiting for confirmation...\");\n\n await sleep(2000);\n }\n console.log(\"❌ Transaction failed to confirm in time.\");\n throw new Error(\"Transaction failed to confirm in time.\");\n };\n\n const result = await Promise.race([getStatus(), setTimeoutPromise(20000, `Transaction failed to confirm in time.`)]);\n\n if (result instanceof Error) {\n throw result;\n }\n\n return result;\n}\n","import type { Commitment, Connection, TransactionSignature, VersionedTransaction } from \"@solana/web3.js\";\nimport { ProcessTransactionError, ProcessTransactionErrorType } from \"~/errors\";\nimport type { TransactionOptions } from \"../../../common\";\nimport { confirmTransaction } from \"../transaction.service\";\n\ntype SendTransactionAsRpcProps = {\n versionedTransactions: VersionedTransaction[];\n connection: Connection;\n blockStrategy: {\n blockhash: string;\n lastValidBlockHeight: number;\n };\n isSequentialTxs: boolean;\n confirmCommitment?: Commitment;\n txOpts?: TransactionOptions;\n throwError?: boolean;\n onCallback?: (index: number, success: boolean, sig: string) => void;\n};\n\nexport async function sendTransactionAsBundleRpc({\n versionedTransactions,\n txOpts,\n connection,\n onCallback,\n blockStrategy,\n confirmCommitment,\n isSequentialTxs,\n throwError = false,\n}: SendTransactionAsRpcProps): Promise<TransactionSignature[]> {\n let signatures: TransactionSignature[] = [];\n let hasValidationErrors = false;\n\n if (isSequentialTxs) {\n for (const [index, tx] of versionedTransactions.entries()) {\n let signature: TransactionSignature;\n\n try {\n signature = await connection.sendTransaction(tx, txOpts);\n } catch (error) {\n // Handle the specific \"fallthrough error ea\" and other sendTransaction errors\n const errorMessage = error instanceof Error ? error.message : String(error);\n if (\n errorMessage.includes(\"Expected the value to satisfy a union\") ||\n errorMessage.includes(\"satisfy a union\")\n ) {\n console.warn(\"Transaction type validation error:\", errorMessage);\n // onCallback?.(index, true, \"\");\n hasValidationErrors = true;\n continue;\n } else {\n onCallback?.(index, false, \"\");\n throw error;\n }\n }\n\n if (signature) {\n try {\n await confirmTransaction(connection, signature, confirmCommitment);\n onCallback?.(index, true, signature);\n } catch (error) {\n onCallback?.(index, false, signature);\n throw error;\n }\n signatures.push(signature);\n }\n }\n\n // Throw user-friendly error if validation errors occurred\n if (hasValidationErrors) {\n onCallback?.(\n versionedTransactions.length,\n true,\n \"The transaction may have landed on-chain but confirmation failed.\",\n );\n\n signatures.push(\"The transaction may have landed on-chain but confirmation failed.\");\n }\n } else {\n signatures = await Promise.all(\n versionedTransactions.map(async (versionedTransaction, index) => {\n try {\n const signature = await connection.sendTransaction(versionedTransaction, txOpts);\n return signature;\n } catch (error) {\n // Handle the specific \"fallthrough error ea\" and other sendTransaction errors\n const errorMessage = error instanceof Error ? error.message : String(error);\n if (\n errorMessage.includes(\"Expected the value to satisfy a union\") ||\n errorMessage.includes(\"satisfy a union\")\n ) {\n console.warn(\"Transaction type validation error:\", errorMessage);\n onCallback?.(index, false, \"\");\n hasValidationErrors = true;\n return \"\"; // Return empty signature to continue processing\n }\n // Re-throw other errors\n onCallback?.(index, false, \"\");\n throw error;\n }\n }),\n );\n\n // Filter out empty signatures from failed transactions\n signatures = signatures.filter((sig) => sig !== \"\");\n\n // Throw user-friendly error if validation errors occurred\n if (hasValidationErrors) {\n throw new ProcessTransactionError({\n message:\n \"Transaction confirmation failed. The transaction may have landed on-chain but confirmation failed. Please check your wallet and try again.\",\n type: ProcessTransactionErrorType.TransactionTupleError,\n });\n }\n\n await Promise.all(\n signatures.map(async (signature, index) => {\n try {\n const result = await confirmTransaction(connection, signature, confirmCommitment);\n onCallback?.(index, true, signature);\n return result;\n } catch (error) {\n onCallback?.(index, false, signature);\n throw error;\n }\n }),\n );\n }\n\n return signatures;\n}\n","import {\n ComputeBudgetProgram,\n PublicKey,\n type TransactionInstruction,\n TransactionMessage,\n VersionedTransaction,\n} from \"@solana/web3.js\";\nimport { LENDR_IDL, type LendrIdlType } from \"~/idl\";\nimport { makeTxPriorityIx } from \"~/models/account\";\nimport { makePriorityFeeMicroIx } from \"~/utils\";\nimport {\n addTransactionMetadata,\n decodeInstruction,\n decompileV0Transaction,\n getComputeBudgetUnits,\n getTxSize,\n isV0Tx,\n legacyTxToV0Tx,\n microLamportsToUi,\n type SolanaTransaction,\n TransactionArenaKeyMap,\n type TransactionBroadcastType,\n uiToMicroLamports,\n updateV0Tx,\n} from \"../../../common\";\n\n// Temporary imports\nexport const MAX_TX_SIZE = 1232;\nexport const BUNDLE_TX_SIZE = 81;\nexport const PRIORITY_TX_SIZE = 44;\n\nexport function isFlashloan(tx: SolanaTransaction): boolean {\n if (isV0Tx(tx)) {\n const addressLookupTableAccounts = tx.addressLookupTables ?? [];\n const message = decompileV0Transaction(tx, addressLookupTableAccounts);\n const idl = { ...LENDR_IDL, address: new PublicKey(0) } as unknown as LendrIdlType;\n const decoded = message.instructions.map((ix) => decodeInstruction(idl, ix.data));\n return decoded.some((ix) => ix?.name.toLowerCase().includes(\"flashloan\"));\n }\n //TODO: add legacy tx check\n return false;\n}\n\nfunction getFlashloanIndex(transactions: SolanaTransaction[]): number | null {\n for (const [index, transaction] of transactions.entries()) {\n if (isFlashloan(transaction)) {\n return index;\n }\n }\n return null;\n}\n\ntype FeeSettings = {\n priorityFeeMicro: number;\n bundleTipUi: number;\n feePayer: PublicKey;\n maxCapUi?: number;\n};\n\n/**\n * Formats a list of Solana transactions into versioned transactions, applying\n * necessary settings such as fees and blockhash. Optionally adds transaction tags.\n *\n * @param {SolanaTransaction[]} transactionsArg - The array of Solana transactions to format.\n * @param {TransactionBroadcastType} broadcastType - The type of transaction broadcast to use.\n * @param {string} blockhash - The recent blockhash to set for the transactions.\n * @param {FeeSettings} feeSettings - The settings for transaction fees, including priority fee and bundle tip.\n * @param {boolean} [addTransactionTags] - Optional flag to add transaction tags.\n * @returns {VersionedTransaction[]} - The array of formatted versioned transactions.\n */\nexport function formatTransactions(\n transactionsArg: SolanaTransaction[],\n broadcastType: TransactionBroadcastType,\n blockhash: string,\n feeSettings: FeeSettings,\n addTransactionTags?: boolean,\n): VersionedTransaction[] {\n const formattedTransactions: VersionedTransaction[] = [];\n const { priorityFeeMicro, bundleTipUi, feePayer, maxCapUi } = feeSettings;\n\n const flashloanIndex = getFlashloanIndex(transactionsArg);\n transactionsArg.forEach((tx) => {\n if (!isV0Tx(tx)) {\n tx.recentBlockhash = blockhash;\n tx.feePayer = feePayer;\n }\n });\n\n const transactions = addTransactionTags ? addTransactionTxTags(transactionsArg) : transactionsArg;\n\n const txSizes: number[] = transactions.map((tx) => getTxSize(tx));\n const dummyPriorityFeeIx = makePriorityFeeMicroIx(1);\n\n const priorityIxs: TransactionInstruction[] = [];\n const cuLimitIxs: (TransactionInstruction | undefined)[] = [];\n\n transactions.forEach((tx, idx) => {\n const cu = tx.unitsConsumed ? Math.min(tx.unitsConsumed + 50_000, 1_400_000) : getComputeBudgetUnits(tx);\n const priorityFeeUi = maxCapUi\n ? Math.min(microLamportsToUi(priorityFeeMicro, cu), maxCapUi)\n : microLamportsToUi(priorityFeeMicro, cu);\n\n let updatedFees = uiToMicroLamports(priorityFeeUi, cu);\n // don't want to pay more than 0.1 SOL in fees\n if (priorityFeeUi > 0.1) {\n updatedFees = uiToMicroLamports(0.1, cu);\n }\n\n priorityIxs.push(broadcastType === \"BUNDLE\" ? dummyPriorityFeeIx : makePriorityFeeMicroIx(updatedFees));\n cuLimitIxs.push(cu ? ComputeBudgetProgram.setComputeUnitLimit({ units: cu }) : undefined);\n });\n\n const { bundleTipIx } = makeTxPriorityIx(\n feePayer,\n maxCapUi ? Math.min(bundleTipUi, maxCapUi) : bundleTipUi,\n broadcastType,\n );\n\n let bundleTipIndex = broadcastType === \"BUNDLE\" ? -1 : null; // if index is -1 in the end, then add bundle tx\n const priorityFeeIndexes: number[] = [];\n\n for (let i = 0; i < txSizes.length; i++) {\n let baseTxSize = txSizes[i];\n\n if (flashloanIndex !== i) {\n if (bundleTipIndex === -1 && txSizes[i] + BUNDLE_TX_SIZE < MAX_TX_SIZE) {\n baseTxSize += BUNDLE_TX_SIZE;\n bundleTipIndex = i;\n }\n }\n\n if (flashloanIndex === i || baseTxSize + PRIORITY_TX_SIZE < MAX_TX_SIZE) {\n priorityFeeIndexes.push(i);\n }\n }\n\n // no space for bundle tip, so add seperate tx\n if (bundleTipIndex === -1 && bundleTipIx) {\n const bundleTipMessage = new TransactionMessage({\n instructions: [bundleTipIx],\n payerKey: feePayer,\n recentBlockhash: blockhash,\n });\n\n formattedTransactions.push(new VersionedTransaction(bundleTipMessage.compileToV0Message()));\n }\n\n for (const [index, transaction] of transactions.entries()) {\n const hasFlashloan = flashloanIndex !== null; // check if there is a flashloan\n const isTxFlashloan = hasFlashloan && flashloanIndex === index; // check if the tx is the flashloan tx\n\n const signers = transaction.signers ?? [];\n const addressLookupTables = transaction.addressLookupTables ?? [];\n\n const requiredIxs: TransactionInstruction[] = [\n ...(bundleTipIndex === index && bundleTipIx ? [bundleTipIx] : []),\n ...(priorityFeeIndexes.includes(index) ? [priorityIxs[index]] : []),\n ...(cuLimitIxs[index] ? [cuLimitIxs[index]] : []),\n ];\n\n let newTransaction: VersionedTransaction;\n\n if (isV0Tx(transaction)) {\n newTransaction = updateV0Tx(transaction, {\n addressLookupTables,\n additionalIxs: requiredIxs,\n blockhash,\n replaceOnly: isTxFlashloan,\n });\n } else {\n newTransaction = legacyTxToV0Tx(transaction, {\n addressLookupTables,\n additionalIxs: requiredIxs,\n blockhash,\n replaceOnly: isTxFlashloan,\n });\n }\n\n newTransaction.sign(signers);\n formattedTransactions.push(newTransaction);\n }\n\n return formattedTransactions;\n}\n\nfunction addTransactionTxTags(transactions: SolanaTransaction[]): SolanaTransaction[] {\n const txWithTags: SolanaTransaction[] = [];\n\n for (const [_, tx] of transactions.entries()) {\n let solanaTx: SolanaTransaction = tx;\n const arenaKey = TransactionArenaKeyMap[tx.type];\n\n if (arenaKey) {\n if (isV0Tx(solanaTx)) {\n console.log(\"tx\", solanaTx);\n const addressLookupTableAccounts = solanaTx.addressLookupTables ?? [];\n const message = decompileV0Transaction(solanaTx, addressLookupTableAccounts);\n\n message.instructions[0].keys.push({\n pubkey: arenaKey,\n isSigner: false,\n isWritable: false,\n });\n solanaTx = addTransactionMetadata(\n new VersionedTransaction(message.compileToV0Message(tx.addressLookupTables)),\n {\n signers: solanaTx.signers,\n addressLookupTables: solanaTx.addressLookupTables,\n type: solanaTx.type,\n unitsConsumed: solanaTx.unitsConsumed,\n },\n );\n } else {\n solanaTx.instructions[0].keys.push({\n pubkey: arenaKey,\n isSigner: false,\n isWritable: false,\n });\n }\n }\n txWithTags.push(solanaTx);\n }\n return txWithTags;\n}\n","import { PublicKey } from \"@solana/web3.js\";\nimport BigNumber from \"bignumber.js\";\nimport { LendrRequirementType } from \"~/models/account\";\nimport {\n type BankType,\n computeAssetUsdValue,\n computeInterestRates,\n computeLiabilityUsdValue,\n getAssetQuantity,\n getLiabilityQuantity,\n} from \"~/services/bank\";\nimport { type OraclePrice, PriceBias } from \"~/services/price\";\nimport { findPoolAddress, findPoolMintAddress, findPoolStakeAddress } from \"~/vendor/single-spl-pool\";\nimport {\n aprToApy,\n type BankExtendedMetadata,\n type BankMetadataMap,\n composeRemainingAccounts,\n nativeToUi,\n shortenAddress\n} from \"../../../common\";\n\nimport type { BalanceType, LendrAccountType } from \"../types\";\n\n/**\n * Lendr Account Computes\n * =========================\n */\n\nexport function computeFreeCollateral(lendrAccount: LendrAccountType, opts?: { clamped?: boolean }): BigNumber {\n const _clamped = opts?.clamped ?? true;\n\n const { assets, liabilities } = computeHealthComponents(lendrAccount, LendrRequirementType.Initial);\n\n const signedFreeCollateral = assets.minus(liabilities);\n\n return _clamped ? BigNumber.max(0, signedFreeCollateral) : signedFreeCollateral;\n}\n\nexport function computeFreeCollateralLegacy(\n activeBalances: BalanceType[],\n banks: Map<string, BankType>,\n oraclePrices: Map<string, OraclePrice>,\n opts?: { clamped?: boolean },\n): BigNumber {\n const _clamped = opts?.clamped ?? true;\n\n const { assets, liabilities } = computeHealthComponentsLegacy(\n activeBalances,\n banks,\n oraclePrices,\n LendrRequirementType.Initial,\n [],\n );\n\n const signedFreeCollateral = assets.minus(liabilities);\n\n return _clamped ? BigNumber.max(0, signedFreeCollateral) : signedFreeCollateral;\n}\n\nexport function computeHealthComponents(\n lendrAccount: LendrAccountType,\n lendrReqType: LendrRequirementType,\n): {\n assets: BigNumber;\n liabilities: BigNumber;\n} {\n // check if health cache failed\n switch (lendrReqType) {\n case LendrRequirementType.Equity:\n return {\n assets: lendrAccount.healthCache.assetValueEquity,\n liabilities: lendrAccount.healthCache.liabilityValueEquity,\n };\n case LendrRequirementType.Initial:\n return {\n assets: lendrAccount.healthCache.assetValue,\n liabilities: lendrAccount.healthCache.liabilityValue,\n };\n case LendrRequirementType.Maintenance:\n return {\n assets: lendrAccount.healthCache.assetValueMaint,\n liabilities: lendrAccount.healthCache.liabilityValueMaint,\n };\n }\n}\n\nexport function computeHealthComponentsLegacy(\n activeBalances: BalanceType[],\n banks: Map<string, BankType>,\n oraclePrices: Map<string, OraclePrice>,\n lendrReqType: LendrRequirementType,\n excludedBanks: PublicKey[] = [],\n): {\n assets: BigNumber;\n liabilities: BigNumber;\n} {\n const filteredBalances = activeBalances.filter(\n (accountBalance) => !excludedBanks.find((b) => b.equals(accountBalance.bankPk)),\n );\n\n const [assets, liabilities] = filteredBalances\n .map((accountBalance) => {\n const bank = banks.get(accountBalance.bankPk.toBase58());\n if (!bank) {\n console.warn(`Bank ${shortenAddress(accountBalance.bankPk)} not found, excluding from health computation`);\n return [new BigNumber(0), new BigNumber(0)];\n }\n\n const priceInfo = oraclePrices.get(accountBalance.bankPk.toBase58());\n if (!priceInfo) {\n console.warn(\n `Price info for bank ${shortenAddress(accountBalance.bankPk)} not found, excluding from health computation`,\n );\n return [new BigNumber(0), new BigNumber(0)];\n }\n\n const { assets, liabilities } = getBalanceUsdValueWithPriceBias(accountBalance, bank, priceInfo, lendrReqType);\n return [assets, liabilities];\n })\n .reduce(\n ([asset, liability], [d, l]) => {\n return [asset.plus(d), liability.plus(l)];\n },\n [new BigNumber(0), new BigNumber(0)],\n );\n\n return { assets, liabilities };\n}\n\nexport function computeHealthComponentsWithoutBiasLegacy(\n activeBalances: BalanceType[],\n banks: Map<string, BankType>,\n oraclePrices: Map<string, OraclePrice>,\n lendrReqType: LendrRequirementType,\n): {\n assets: BigNumber;\n liabilities: BigNumber;\n} {\n const [assets, liabilities] = activeBalances\n .map((accountBalance) => {\n const bank = banks.get(accountBalance.bankPk.toBase58());\n if (!bank) {\n console.warn(`Bank ${shortenAddress(accountBalance.bankPk)} not found, excluding from health computation`);\n return [new BigNumber(0), new BigNumber(0)];\n }\n\n const priceInfo = oraclePrices.get(accountBalance.bankPk.toBase58());\n if (!priceInfo) {\n console.warn(\n `Price info for bank ${shortenAddress(accountBalance.bankPk)} not found, excluding from health computation`,\n );\n return [new BigNumber(0), new BigNumber(0)];\n }\n\n const { assets, liabilities } = computeBalanceUsdValue(accountBalance, bank, priceInfo, lendrReqType);\n return [assets, liabilities];\n })\n .reduce(\n ([asset, liability], [d, l]) => {\n return [asset.plus(d), liability.plus(l)];\n },\n [new BigNumber(0), new BigNumber(0)],\n );\n\n return { assets, liabilities };\n}\n\nexport function computeAccountValue(lendrAccount: LendrAccountType): BigNumber {\n const { assets, liabilities } = computeHealthComponents(lendrAccount, LendrRequirementType.Equity);\n return assets.minus(liabilities);\n}\n\nexport function computeNetApy(\n lendrAccount: LendrAccountType,\n activeBalances: BalanceType[],\n banks: Map<string, BankType>,\n oraclePrices: Map<string, OraclePrice>,\n): number {\n const { assets, liabilities } = computeHealthComponents(lendrAccount, LendrRequirementType.Equity);\n const totalUsdValue = assets.minus(liabilities);\n const apr = activeBalances\n .reduce((weightedApr, balance) => {\n const bank = banks.get(balance.bankPk.toBase58());\n if (!bank) {\n console.warn(`Bank ${shortenAddress(balance.bankPk)} not found, excluding from APY computation`);\n return weightedApr;\n }\n\n const priceInfo = oraclePrices.get(balance.bankPk.toBase58());\n if (!priceInfo) {\n console.warn(`Price info for bank ${shortenAddress(balance.bankPk)} not found, excluding from APY computation`);\n return weightedApr;\n }\n\n return weightedApr\n .minus(\n computeInterestRates(bank)\n .borrowingRate.times(\n computeBalanceUsdValue(balance, bank, priceInfo, LendrRequirementType.Equity).liabilities,\n )\n .div(totalUsdValue.isEqualTo(0) ? 1 : totalUsdValue),\n )\n .plus(\n computeInterestRates(bank)\n .lendingRate.times(computeBalanceUsdValue(balance, bank, priceInfo, LendrRequirementType.Equity).assets)\n .div(totalUsdValue.isEqualTo(0) ? 1 : totalUsdValue),\n );\n }, new BigNumber(0))\n .toNumber();\n\n return aprToApy(apr);\n}\n\n/**\n * Lendr Balance Computes\n * =========================\n */\n\nexport function computeBalanceUsdValue(\n balance: BalanceType,\n bank: BankType,\n oraclePrice: OraclePrice,\n lendrRequirementType: LendrRequirementType,\n): {\n assets: BigNumber;\n liabilities: BigNumber;\n} {\n const assetsValue = computeAssetUsdValue(\n bank,\n oraclePrice,\n balance.assetShares,\n lendrRequirementType,\n PriceBias.None,\n );\n const liabilitiesValue = computeLiabilityUsdValue(\n bank,\n oraclePrice,\n balance.liabilityShares,\n lendrRequirementType,\n PriceBias.None,\n );\n return { assets: assetsValue, liabilities: liabilitiesValue };\n}\n\nexport function getBalanceUsdValueWithPriceBias(\n balance: BalanceType,\n bank: BankType,\n oraclePrice: OraclePrice,\n lendrRequirementType: LendrRequirementType,\n): {\n assets: BigNumber;\n liabilities: BigNumber;\n} {\n const assetsValue = computeAssetUsdValue(\n bank,\n oraclePrice,\n balance.assetShares,\n lendrRequirementType,\n PriceBias.Lowest,\n );\n const liabilitiesValue = computeLiabilityUsdValue(\n bank,\n oraclePrice,\n balance.liabilityShares,\n lendrRequirementType,\n PriceBias.Highest,\n );\n return { assets: assetsValue, liabilities: liabilitiesValue };\n}\n\nexport function computeQuantity(\n balance: BalanceType,\n bank: BankType,\n): {\n assets: BigNumber;\n liabilities: BigNumber;\n} {\n const assetsQuantity = getAssetQuantity(bank, balance.assetShares);\n const liabilitiesQuantity = getLiabilityQuantity(bank, balance.liabilityShares);\n return { assets: assetsQuantity, liabilities: liabilitiesQuantity };\n}\n\nexport function computeQuantityUi(\n balance: BalanceType,\n bank: BankType,\n): {\n assets: BigNumber;\n liabilities: BigNumber;\n} {\n const assetsQuantity = new BigNumber(nativeToUi(getAssetQuantity(bank, balance.assetShares), bank.mintDecimals));\n const liabilitiesQuantity = new BigNumber(\n nativeToUi(getLiabilityQuantity(bank, balance.liabilityShares), bank.mintDecimals),\n );\n return { assets: assetsQuantity, liabilities: liabilitiesQuantity };\n}\n\nexport function computeClaimedEmissions(balance: BalanceType, bank: BankType, currentTimestamp: number): BigNumber {\n const lendingActive = bank.emissionsActiveLending;\n const borrowActive = bank.emissionsActiveBorrowing;\n\n const { assets, liabilities } = computeQuantity(balance, bank);\n\n let balanceAmount: BigNumber | null = null;\n\n if (lendingActive) {\n balanceAmount = assets;\n } else if (borrowActive) {\n balanceAmount = liabilities;\n }\n\n if (balanceAmount) {\n const lastUpdate = balance.lastUpdate;\n const period = new BigNumber(currentTimestamp - lastUpdate);\n const emissionsRate = new BigNumber(bank.emissionsRate);\n const emissions = period\n .times(balanceAmount)\n .times(emissionsRate)\n .div(31_536_000 * 10 ** bank.mintDecimals);\n const emissionsReal = BigNumber.min(emissions, new BigNumber(bank.emissionsRemaining));\n\n return emissionsReal;\n }\n\n return new BigNumber(0);\n}\n\nexport function computeTotalOutstandingEmissions(balance: BalanceType, bank: BankType): BigNumber {\n const claimedEmissions = balance.emissionsOutstanding;\n const unclaimedEmissions = computeClaimedEmissions(balance, bank, Date.now() / 1000);\n return claimedEmissions.plus(unclaimedEmissions);\n}\n\nexport function computeHealthCheckAccounts(\n balances: BalanceType[],\n banks: Map<string, BankType>,\n mandatoryBanks: PublicKey[] = [],\n excludedBanks: PublicKey[] = [],\n): BankType[] {\n const activeBalances = balances.filter((b) => b.active);\n\n const mandatoryBanksSet = new Set(mandatoryBanks.map((b) => b.toBase58()));\n const excludedBanksSet = new Set(excludedBanks.map((b) => b.toBase58()));\n const activeBanks = new Set(activeBalances.map((b) => b.bankPk.toBase58()));\n const banksToAdd = new Set([...mandatoryBanksSet].filter((x) => !activeBanks.has(x)));\n\n let slotsToKeep = banksToAdd.size;\n const projectedActiveBanks = balances\n .filter((balance) => {\n if (balance.active) {\n return !excludedBanksSet.has(balance.bankPk.toBase58());\n } else if (slotsToKeep > 0) {\n slotsToKeep--;\n return true;\n } else {\n return false;\n }\n })\n .map((balance) => {\n if (balance.active) {\n const bank = banks.get(balance.bankPk.toBase58());\n if (!bank) throw Error(`Bank ${balance.bankPk.toBase58()} not found`);\n return bank;\n }\n const newBankAddress = [...banksToAdd.values()][0];\n banksToAdd.delete(newBankAddress);\n const bank = banks.get(newBankAddress);\n if (!bank) throw Error(`Bank ${newBankAddress} not found`);\n return bank;\n });\n\n return projectedActiveBanks;\n}\n\nexport function computeHealthAccountMetas(\n banksToInclude: BankType[],\n // TODO)) remove\n bankMetadataMap?: BankMetadataMap,\n enableSorting = true,\n bankExtendedMetadata?: BankExtendedMetadata,\n): PublicKey[] {\n const wrapperFn = enableSorting\n ? composeRemainingAccounts\n : (banksAndOracles: PublicKey[][]) => banksAndOracles.flat();\n\n const accounts = wrapperFn(\n banksToInclude.map((bank) => {\n const keys = [bank.address, bank.oracleKey];\n\n // for staked collateral banks (assetTag === 2), include additional accounts\n if (bank.config.assetTag === 2) {\n // TODO))\n if (!bankMetadataMap && !bankExtendedMetadata) {\n throw Error(`No bank metadata for ${bank.address.toBase58()} provided`);\n }\n\n const bankMetadata = bankExtendedMetadata ?? bankMetadataMap?.[bank.address.toBase58()];\n const validatorVoteAccount = bankMetadata?.validatorVoteAccount\n\n if (!validatorVoteAccount) {\n throw Error(`no validatorVoteAccount on Bank metadata: ${bank.address.toBase58()}`);\n }\n\n const pool = findPoolAddress(new PublicKey(validatorVoteAccount));\n const solPool = findPoolStakeAddress(pool);\n const lstMint = findPoolMintAddress(pool);\n\n keys.push(lstMint, solPool);\n }\n\n return keys;\n }),\n );\n\n return accounts;\n}\n","import type { PublicKey } from \"@solana/web3.js\";\nimport type BigNumber from \"bignumber.js\";\n\nexport interface BalanceType {\n active: boolean;\n bankPk: PublicKey;\n assetShares: BigNumber;\n liabilityShares: BigNumber;\n emissionsOutstanding: BigNumber;\n lastUpdate: number;\n}\n\nexport enum HealthCacheFlags {\n /**\n * If set (1), the account is considered healthy and cannot be liquidated.\n * If not set (0), the account is unhealthy and can be liquidated.\n */\n HEALTHY = 1 << 0, // 1\n /**\n * If set (1), the engine did not error during the last health pulse.\n * If not set (0), the engine would have errored and this cache is likely invalid.\n * `RiskEngineInitRejected` is ignored and will allow the flag to be set anyways.\n */\n ENGINE_STATUS_OK = 1 << 1, // 2\n /**\n * If set (1), the engine did not error due to an oracle issue.\n * If not set (0), engine was passed a bad bank or oracle account, or an oracle was stale.\n * Check the order in which accounts were passed and ensure each balance has the correct banks/oracles,\n * and that oracle cranks ran recently enough. Check `internal_err` and `err_index` for more details\n * in some circumstances. Invalid if generated after borrow/withdraw (these instructions will\n * ignore oracle issues if health is still satisfactory with some balance zeroed out).\n */\n ORACLE_OK = 1 << 2, // 4\n}\n\nexport interface HealthCacheType {\n assetValue: BigNumber;\n liabilityValue: BigNumber;\n assetValueMaint: BigNumber;\n liabilityValueMaint: BigNumber;\n assetValueEquity: BigNumber;\n liabilityValueEquity: BigNumber;\n timestamp: BigNumber;\n flags: HealthCacheFlags[];\n prices: number[][];\n simulationFailed?: boolean;\n}\n\nexport interface LendrAccountType {\n address: PublicKey;\n group: PublicKey;\n authority: PublicKey;\n balances: BalanceType[];\n accountFlags: AccountFlags[];\n emissionsDestinationAccount: PublicKey;\n healthCache: HealthCacheType;\n}\n\nexport enum AccountFlags {\n ACCOUNT_DISABLED = 1 << 0, // 1\n ACCOUNT_IN_FLASHLOAN = 1 << 1, // 2\n ACCOUNT_FLAG_DEPRECATED = 1 << 2, // 4\n ACCOUNT_TRANSFER_AUTHORITY_ALLOWED = 1 << 3, // 8\n}\n","import { BorshCoder } from \"@coral-xyz/anchor\";\nimport { PublicKey } from \"@solana/web3.js\";\nimport BigNumber from \"bignumber.js\";\nimport BN from \"bn.js\";\nimport type { LendrIdlType } from \"~/idl\";\n\nimport { Balance } from \"~/models/balance\";\nimport { HealthCache } from \"~/models/health-cache\";\nimport { AccountType } from \"~/types\";\nimport { wrappedI80F48toBigNumber } from \"../../../common\";\n\nimport {\n AccountFlags,\n type BalanceRaw,\n type BalanceType,\n type BalanceTypeDto,\n HealthCacheFlags,\n type HealthCacheType,\n type HealthCacheTypeDto,\n type LendrAccountRaw,\n type LendrAccountType,\n type LendrAccountTypeDto,\n} from \"../types\";\n\nexport function decodeAccountRaw(encoded: Buffer, idl: LendrIdlType): LendrAccountRaw {\n const coder = new BorshCoder(idl);\n return coder.accounts.decode(AccountType.LendrAccount, encoded);\n}\n\nexport function parseBalanceRaw(balanceRaw: BalanceRaw): BalanceType {\n const active = typeof balanceRaw.active === \"number\" ? balanceRaw.active === 1 : balanceRaw.active;\n const bankPk = balanceRaw.bankPk;\n const assetShares = wrappedI80F48toBigNumber(balanceRaw.assetShares);\n const liabilityShares = wrappedI80F48toBigNumber(balanceRaw.liabilityShares);\n const emissionsOutstanding = wrappedI80F48toBigNumber(balanceRaw.emissionsOutstanding);\n const lastUpdate = balanceRaw.lastUpdate.toNumber();\n\n return {\n active,\n bankPk,\n assetShares,\n liabilityShares,\n emissionsOutstanding,\n lastUpdate,\n };\n}\n\nexport function parseLendrAccountRaw(lendrAccountPk: PublicKey, accountData: LendrAccountRaw) {\n const address = lendrAccountPk;\n const group = accountData.group;\n const authority = accountData.authority;\n const balances = accountData.lendingAccount.balances.map(Balance.from);\n const accountFlags = getActiveAccountFlags(accountData.accountFlags);\n const emissionsDestinationAccount = accountData.emissionsDestinationAccount;\n const healthCache = HealthCache.from(accountData.healthCache);\n\n return {\n address,\n group,\n authority,\n balances,\n accountFlags,\n emissionsDestinationAccount,\n healthCache,\n };\n}\n\n/**\n * Get all active account flags as an array of flag names\n */\nexport function getActiveAccountFlags(flags: BN): AccountFlags[] {\n const activeFlags: AccountFlags[] = [];\n\n Object.keys(AccountFlags)\n .filter((key) => isNaN(Number(key))) // Only get the string keys (not the reverse mapping)\n .forEach((key) => {\n const flag = AccountFlags[key as keyof typeof AccountFlags];\n if (typeof flag === \"number\" && hasAccountFlag(flags, flag)) {\n activeFlags.push(flag);\n }\n });\n\n return activeFlags;\n}\n\n/**\n * Check if an account flag is set\n */\nexport function hasAccountFlag(flags: BN, flag: number): boolean {\n return !flags.and(new BN(flag)).isZero();\n}\n\n/**\n * Convert on-chain health cache flags (BN) to an array of HealthCacheFlags enum values\n *\n * According to the IDL, health cache flags are defined as:\n * - HEALTHY = 1 (bit 0) - If set, the account cannot be liquidated\n * - ENGINE_STATUS_OK = 2 (bit 1) - If set, the engine did not error during health calculation\n * - ORACLE_OK = 4 (bit 2) - If set, the engine did not encounter oracle issues\n */\nexport function getActiveHealthCacheFlags(flags: number): HealthCacheFlags[] {\n const activeFlags: HealthCacheFlags[] = [];\n\n // Check each flag bit\n if (hasHealthCacheFlag(flags, HealthCacheFlags.HEALTHY)) {\n activeFlags.push(HealthCacheFlags.HEALTHY);\n }\n\n if (hasHealthCacheFlag(flags, HealthCacheFlags.ENGINE_STATUS_OK)) {\n activeFlags.push(HealthCacheFlags.ENGINE_STATUS_OK);\n }\n\n if (hasHealthCacheFlag(flags, HealthCacheFlags.ORACLE_OK)) {\n activeFlags.push(HealthCacheFlags.ORACLE_OK);\n }\n\n return activeFlags;\n}\n\n/**\n * Check if a health cache flag is set\n */\nexport function hasHealthCacheFlag(flags: number, flag: HealthCacheFlags): boolean {\n return (flags & flag) !== 0;\n}\n\n/**\n * Convert numeric health cache flags to a human-readable status message\n */\nexport function getHealthCacheStatusDescription(flags: number): string {\n const activeFlags = getActiveHealthCacheFlags(flags);\n\n // Check for critical conditions first\n if (!activeFlags.includes(HealthCacheFlags.HEALTHY)) {\n return \"UNHEALTHY: Account is eligible for liquidation\";\n }\n\n if (!activeFlags.includes(HealthCacheFlags.ENGINE_STATUS_OK)) {\n return \"ERROR: Risk engine encountered an error during health calculation\";\n }\n\n if (!activeFlags.includes(HealthCacheFlags.ORACLE_OK)) {\n return \"WARNING: Oracle price data may be stale or invalid\";\n }\n\n // All good\n if (activeFlags.length === 3) {\n return \"HEALTHY: Account is in good standing\";\n }\n\n // Default case (shouldn't happen often)\n return `Status flags: ${activeFlags.join(\", \")}`;\n}\n\nexport function dtoToLendrAccount(lendrAccountDto: LendrAccountTypeDto): LendrAccountType {\n return {\n address: new PublicKey(lendrAccountDto.address),\n group: new PublicKey(lendrAccountDto.group),\n authority: new PublicKey(lendrAccountDto.authority),\n balances: lendrAccountDto.balances.map(dtoToBalance),\n accountFlags: lendrAccountDto.accountFlags,\n emissionsDestinationAccount: new PublicKey(lendrAccountDto.emissionsDestinationAccount),\n healthCache: dtoToHealthCache(lendrAccountDto.healthCache),\n };\n}\n\nexport function dtoToBalance(balanceDto: BalanceTypeDto): BalanceType {\n return {\n active: balanceDto.active,\n bankPk: new PublicKey(balanceDto.bankPk),\n assetShares: new BigNumber(balanceDto.assetShares),\n liabilityShares: new BigNumber(balanceDto.liabilityShares),\n emissionsOutstanding: new BigNumber(balanceDto.emissionsOutstanding),\n lastUpdate: balanceDto.lastUpdate,\n };\n}\n\nexport function dtoToHealthCache(healthCacheDto: HealthCacheTypeDto): HealthCacheType {\n return {\n assetValue: new BigNumber(healthCacheDto.assetValue),\n liabilityValue: new BigNumber(healthCacheDto.liabilityValue),\n assetValueMaint: new BigNumber(healthCacheDto.assetValueMaint),\n liabilityValueMaint: new BigNumber(healthCacheDto.liabilityValueMaint),\n assetValueEquity: new BigNumber(healthCacheDto.assetValueEquity),\n liabilityValueEquity: new BigNumber(healthCacheDto.liabilityValueEquity),\n timestamp: new BigNumber(healthCacheDto.timestamp),\n flags: healthCacheDto.flags,\n prices: healthCacheDto.prices,\n simulationFailed: healthCacheDto.simulationFailed,\n };\n}\n","import type { PublicKey } from \"@solana/web3.js\";\nimport type BigNumber from \"bignumber.js\";\n\nimport { type ActionEmodeImpact, type EmodeImpact, EmodeImpactStatus, type EmodePair, EmodeTag } from \"~/services/bank\";\n\nexport function computeEmodeImpacts(\n emodePairs: EmodePair[],\n activeLiabilities: PublicKey[],\n activeCollateral: PublicKey[],\n allBanks: PublicKey[],\n): Record<string, ActionEmodeImpact> {\n const toKey = (k: PublicKey) => k.toBase58();\n\n // Baseline state\n const basePairs = computeActiveEmodePairs(emodePairs, activeLiabilities, activeCollateral);\n const baseOn = basePairs.length > 0;\n\n // Liability tag map & existing tags\n const liabTagMap = new Map<string, string>();\n for (const p of emodePairs) {\n liabTagMap.set(p.liabilityBank.toBase58(), p.liabilityBankTag.toString());\n }\n const existingTags = new Set<string>(\n activeLiabilities.map((l) => liabTagMap.get(l.toBase58())).filter((t): t is string => !!t),\n );\n\n // Helper for min initial weight (used in diffState only)\n function minWeight(ps: EmodePair[]): BigNumber {\n let m = ps[0].assetWeightInit;\n for (const x of ps) if (x.assetWeightInit.lt(m)) m = x.assetWeightInit;\n return m;\n }\n\n // Determine status transitions\n function diffState(before: EmodePair[], after: EmodePair[]): EmodeImpactStatus {\n const was = before.length > 0,\n isOn = after.length > 0;\n if (!was && !isOn) return EmodeImpactStatus.InactiveEmode;\n if (!was && isOn) return EmodeImpactStatus.ActivateEmode;\n if (was && !isOn) return EmodeImpactStatus.RemoveEmode;\n\n const bMin = minWeight(before),\n aMin = minWeight(after);\n if (aMin.gt(bMin)) return EmodeImpactStatus.IncreaseEmode;\n if (aMin.lt(bMin)) return EmodeImpactStatus.ReduceEmode;\n return EmodeImpactStatus.ExtendEmode;\n }\n\n // Simulation of each action\n function simulate(bank: PublicKey, action: \"borrow\" | \"repay\" | \"supply\" | \"withdraw\"): EmodeImpact {\n let L = [...activeLiabilities],\n C = [...activeCollateral];\n switch (action) {\n case \"borrow\":\n if (!L.some((x) => x.equals(bank))) L.push(bank);\n break;\n case \"repay\":\n L = L.filter((x) => !x.equals(bank));\n break;\n case \"supply\":\n if (!C.some((x) => x.equals(bank))) C.push(bank);\n break;\n case \"withdraw\":\n C = C.filter((x) => !x.equals(bank));\n break;\n }\n\n const after = computeActiveEmodePairs(emodePairs, L, C);\n let status = diffState(basePairs, after);\n\n // Borrow override\n if (action === \"borrow\") {\n const tag = liabTagMap.get(bank.toBase58());\n\n // Borrowing an unconfigured bank => EMODE off / inactive\n if (!tag) {\n status = baseOn ? EmodeImpactStatus.RemoveEmode : EmodeImpactStatus.InactiveEmode;\n\n // EMODE was ON; keep the diffState result unless EMODE really turns OFF\n } else if (baseOn) {\n if (after.length === 0) {\n status = EmodeImpactStatus.RemoveEmode;\n } else if (existingTags.has(tag)) {\n status = EmodeImpactStatus.ExtendEmode; // same tag ⇒ extend\n // else keep diffState (Increase/Reduce) which is already correct\n }\n }\n }\n\n // Supply override\n if (action === \"supply\") {\n const isOn = after.length > 0;\n status =\n !baseOn && isOn\n ? EmodeImpactStatus.ActivateEmode\n : baseOn && isOn\n ? EmodeImpactStatus.ExtendEmode\n : EmodeImpactStatus.InactiveEmode;\n }\n\n // Withdraw override\n if (action === \"withdraw\") {\n if (!baseOn) {\n status = EmodeImpactStatus.InactiveEmode;\n } else if (after.length === 0) {\n status = EmodeImpactStatus.RemoveEmode;\n } else {\n const b = minWeight(basePairs),\n a = minWeight(after);\n if (a.gt(b)) status = EmodeImpactStatus.IncreaseEmode;\n else if (a.lt(b)) status = EmodeImpactStatus.ReduceEmode;\n else status = EmodeImpactStatus.ExtendEmode;\n }\n }\n\n // Find the pair with lowest assetWeightInit and grab its maint weight\n let bestPair: EmodePair | undefined;\n if (after.length > 0) {\n bestPair = after[0];\n for (const p of after) {\n if (p.assetWeightInit.lt(bestPair.assetWeightInit)) {\n bestPair = p;\n }\n }\n }\n\n return {\n status,\n resultingPairs: after,\n activePair: bestPair,\n };\n }\n\n // Run simulations across allBanks\n const result: Record<string, ActionEmodeImpact> = {};\n for (const bank of allBanks) {\n const key = toKey(bank);\n const impact: ActionEmodeImpact = {};\n\n // Only new borrows\n if (!activeCollateral.some((x) => x.equals(bank))) {\n impact.borrowImpact = simulate(bank, \"borrow\");\n }\n\n // Only supply for collateral-configured banks not in play\n const collSet = new Set(emodePairs.flatMap((p) => p.collateralBanks.map((c) => c.toBase58())));\n if (\n collSet.has(key) &&\n !activeCollateral.some((x) => x.equals(bank)) &&\n !activeLiabilities.some((x) => x.equals(bank))\n ) {\n impact.supplyImpact = simulate(bank, \"supply\");\n }\n\n if (activeLiabilities.some((x) => x.equals(bank))) {\n impact.repayAllImpact = simulate(bank, \"repay\");\n }\n if (activeCollateral.some((x) => x.equals(bank))) {\n impact.withdrawAllImpact = simulate(bank, \"withdraw\");\n }\n\n result[key] = impact;\n }\n\n return result;\n}\n\nexport function computeActiveEmodePairs(\n emodePairs: EmodePair[],\n activeLiabilities: PublicKey[],\n activeCollateral: PublicKey[],\n): EmodePair[] {\n // 1) Drop any pairs with an “unset” tag (0)\n const configured = emodePairs.filter(\n (p) => p.collateralBankTag !== EmodeTag.UNSET && p.liabilityBankTag !== EmodeTag.UNSET,\n );\n\n // 2) Build the set of required liability‐tags from _all_ active liabilities\n // If any liability has no configured entry at all, EMODE is off.\n const liabTagByBank = new Map<string, string>();\n for (const p of configured) {\n liabTagByBank.set(p.liabilityBank.toBase58(), p.liabilityBankTag.toString());\n }\n const requiredTags = new Set<string>();\n for (const liab of activeLiabilities) {\n const tag = liabTagByBank.get(liab.toBase58());\n if (!tag) {\n // a liability with no entries kills EMODE immediately\n return [];\n }\n requiredTags.add(tag);\n }\n\n // 3) Of those configured pairs, keep only ones touching both an active liability AND collateral\n const possible = configured.filter(\n (p) =>\n activeLiabilities.some((l) => l.equals(p.liabilityBank)) &&\n p.collateralBanks.some((c) => activeCollateral.some((a) => a.equals(c))),\n );\n if (possible.length === 0) return [];\n\n // 4) Group by collateral-tag\n const byCollTag: Record<string, EmodePair[]> = {};\n for (const p of possible) {\n const ct = p.collateralBankTag.toString();\n if (!byCollTag[ct]) {\n byCollTag[ct] = [];\n }\n byCollTag[ct].push(p);\n }\n\n // 5) Return the group whose liability-tags cover _every_ requiredTag\n for (const group of Object.values(byCollTag)) {\n const supports = new Set(group.map((p) => p.liabilityBankTag.toString()));\n let coversAll = true;\n for (const rt of requiredTags) {\n if (!supports.has(rt)) {\n coversAll = false;\n break;\n }\n }\n if (coversAll) {\n return group;\n }\n }\n\n // 6) Nothing can cover all liabilities → EMODE off\n return [];\n}\n","import type { PublicKey } from \"@solana/web3.js\";\nimport { LendrAccount } from \"~/models/account\";\nimport type { Bank } from \"~/models/bank\";\nimport type { OraclePrice } from \"~/services/price\";\nimport type { LendrProgram } from \"~/types\";\nimport type { BankMetadataMap } from \"../../../common\";\n\nimport { type HealthCacheSimulationError, simulateAccountHealthCacheWithFallback } from \"../account.service\";\nimport type { LendrAccountRaw, LendrAccountType } from \"../types\";\n\nexport const fetchLendrAccountAddresses = async (\n program: LendrProgram,\n authority: PublicKey,\n group: PublicKey,\n): Promise<PublicKey[]> => {\n const lendrAccounts = (\n await program.account.lendrAccount.all([\n {\n memcmp: {\n bytes: group.toBase58(),\n offset: 8, // lendrGroup is the first field in the account, so only offset is the discriminant\n },\n },\n {\n memcmp: {\n bytes: authority.toBase58(),\n offset: 8 + 32, // authority is the second field in the account after the authority, so offset by the discriminant and a pubkey\n },\n },\n ])\n ).map((a) => a.publicKey);\n\n return lendrAccounts;\n};\n\nexport const fetchLendrAccountData = async (\n program: LendrProgram,\n lendrAccountPk: PublicKey,\n bankMap: Map<string, Bank>,\n oraclePrices: Map<string, OraclePrice>,\n bankMetadataMap: BankMetadataMap,\n): Promise<{ lendrAccount: LendrAccountType; error?: HealthCacheSimulationError }> => {\n const lendrAccountRaw: LendrAccountRaw = await program.account.lendrAccount.fetch(lendrAccountPk, \"confirmed\");\n const lendrAccount = LendrAccount.fromAccountParsed(lendrAccountPk, lendrAccountRaw);\n\n const lendrAccountWithCache = await simulateAccountHealthCacheWithFallback({\n program,\n lendrAccount,\n bankMap,\n oraclePrices,\n bankMetadataMap,\n balances: lendrAccount.balances,\n });\n\n return lendrAccountWithCache;\n};\n","import BN from \"bn.js\";\n\nimport type {\n AccountFlags,\n BalanceType,\n BalanceTypeDto,\n HealthCacheType,\n HealthCacheTypeDto,\n LendrAccountType,\n LendrAccountTypeDto,\n} from \"../types\";\n\n/**\n * Convert numeric flag to BN for Solana compatibility\n */\nexport function accountFlagToBN(flag: AccountFlags): BN {\n return new BN(flag);\n}\n\nexport function lendrAccountToDto(lendrAccount: LendrAccountType): LendrAccountTypeDto {\n return {\n address: lendrAccount.address.toBase58(),\n group: lendrAccount.group.toBase58(),\n authority: lendrAccount.authority.toBase58(),\n balances: lendrAccount.balances.map(balanceToDto),\n accountFlags: lendrAccount.accountFlags,\n emissionsDestinationAccount: lendrAccount.emissionsDestinationAccount.toBase58(),\n healthCache: healthCacheToDto(lendrAccount.healthCache),\n };\n}\n\nexport function balanceToDto(balance: BalanceType): BalanceTypeDto {\n return {\n active: balance.active,\n bankPk: balance.bankPk.toBase58(),\n assetShares: balance.assetShares.toString(),\n liabilityShares: balance.liabilityShares.toString(),\n emissionsOutstanding: balance.emissionsOutstanding.toString(),\n lastUpdate: balance.lastUpdate,\n };\n}\n\nexport function healthCacheToDto(healthCache: HealthCacheType): HealthCacheTypeDto {\n return {\n assetValue: healthCache.assetValue.toString(),\n liabilityValue: healthCache.liabilityValue.toString(),\n assetValueMaint: healthCache.assetValueMaint.toString(),\n liabilityValueMaint: healthCache.liabilityValueMaint.toString(),\n assetValueEquity: healthCache.assetValueEquity.toString(),\n liabilityValueEquity: healthCache.liabilityValueEquity.toString(),\n timestamp: healthCache.timestamp.toString(),\n flags: healthCache.flags,\n prices: healthCache.prices,\n simulationFailed: healthCache.simulationFailed,\n };\n}\n","import type { AnchorProvider } from \"@coral-xyz/anchor\";\nimport {\n type AddressLookupTableAccount,\n ComputeBudgetProgram,\n Keypair,\n PublicKey,\n SystemProgram,\n type TransactionInstruction,\n TransactionMessage,\n VersionedTransaction,\n} from \"@solana/web3.js\";\nimport BigNumber from \"bignumber.js\";\nimport BN from \"bn.js\";\n\nimport type LendrClient from \"~/clients/client\";\nimport type { BankMap, OraclePriceMap } from \"~/clients/client\";\n\nimport type { LendrIdlType } from \"~/idl\";\nimport instructions from \"~/instructions\";\nimport { LendrAccount, LendrAccountWrapper, LendrRequirementType } from \"~/models/account\";\nimport type { Balance } from \"~/models/balance\";\nimport type { Bank } from \"~/models/bank\";\nimport { HealthCache } from \"~/models/health-cache\";\n\nimport { type BankType, OracleSetup } from \"~/services/bank\";\nimport type { OraclePrice } from \"~/services/price\";\nimport { simulateBundle } from \"~/services/transaction/helpers\";\nimport type { LendrProgram } from \"~/types\";\nimport { feedIdToString } from \"~/utils\";\nimport type { InstructionWithEphemeralSigners } from \"~/vendor/pyth_crank\";\nimport { getSwitchboardProgram } from \"~/vendor/switchboard_pull\";\nimport {\n\ttype BankMetadataMap,\n\tbigNumberToWrappedI80F48,\n\ttype Program,\n\ttype SolanaTransaction,\n\tsplitInstructionsToFitTransactions,\n\twrappedI80F48toBigNumber,\n} from \"../../common\";\nimport type { BalanceRaw, BalanceType, LendrAccountRaw } from \"./types\";\nimport {\n computeHealthAccountMetas,\n computeHealthCheckAccounts,\n computeHealthComponentsLegacy,\n computeHealthComponentsWithoutBiasLegacy,\n} from \"./utils\";\n\n/**\n * Custom error class for health cache simulation failures\n */\nexport class HealthCacheSimulationError extends Error {\n lndrErr: number | null;\n internalErr: number | null;\n\n constructor(message: string, lndrErr: number | null, internalErr: number | null) {\n super(message);\n this.name = \"HealthCacheSimulationError\";\n this.lndrErr = lndrErr;\n this.internalErr = internalErr;\n\n // Maintains proper stack trace for where our error was thrown (only available on V8)\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, HealthCacheSimulationError);\n }\n }\n}\n\nexport async function simulateAccountHealthCacheWithFallback(props: {\n program: Program<LendrIdlType>;\n bankMap: Map<string, Bank>;\n oraclePrices: Map<string, OraclePrice>;\n lendrAccount: LendrAccount;\n balances: Balance[];\n bankMetadataMap: BankMetadataMap;\n}): Promise<{ lendrAccount: LendrAccount; error?: HealthCacheSimulationError }> {\n let lendrAccount = props.lendrAccount;\n\n const activeBalances = props.balances.filter((b) => b.active);\n\n const { assets: assetValueEquity, liabilities: liabilityValueEquity } = computeHealthComponentsWithoutBiasLegacy(\n activeBalances,\n props.bankMap,\n props.oraclePrices,\n LendrRequirementType.Equity,\n );\n\n try {\n const simulatedAccount = await simulateAccountHealthCache({\n program: props.program,\n bankMap: props.bankMap,\n oraclePrices: props.oraclePrices,\n lendrAccountPk: props.lendrAccount.address,\n balances: props.balances,\n bankMetadataMap: props.bankMetadataMap,\n });\n\n simulatedAccount.healthCache.assetValueEquity = bigNumberToWrappedI80F48(assetValueEquity);\n simulatedAccount.healthCache.liabilityValueEquity = bigNumberToWrappedI80F48(liabilityValueEquity);\n\n lendrAccount = LendrAccount.fromAccountParsed(props.lendrAccount.address, simulatedAccount);\n } catch (e) {\n console.log(\"e\", e);\n const { assets: assetValueMaint, liabilities: liabilityValueMaint } = computeHealthComponentsLegacy(\n activeBalances,\n props.bankMap,\n props.oraclePrices,\n LendrRequirementType.Maintenance,\n );\n\n const { assets: assetValueInitial, liabilities: liabilityValueInitial } = computeHealthComponentsLegacy(\n activeBalances,\n props.bankMap,\n props.oraclePrices,\n LendrRequirementType.Initial,\n );\n\n lendrAccount.setHealthCache(\n new HealthCache(\n assetValueInitial,\n liabilityValueInitial,\n assetValueMaint,\n liabilityValueMaint,\n assetValueEquity,\n liabilityValueEquity,\n new BigNumber(0),\n [],\n [],\n true,\n ),\n );\n\n // Return the error if it's a HealthCacheSimulationError\n if (e instanceof HealthCacheSimulationError) {\n return { lendrAccount, error: e };\n }\n }\n\n return { lendrAccount };\n}\n\nexport async function simulateAccountHealthCache(props: {\n program: Program<LendrIdlType>;\n bankMap: Map<string, Bank>;\n oraclePrices: Map<string, OraclePrice>;\n lendrAccountPk: PublicKey;\n balances: Balance[];\n bankMetadataMap: BankMetadataMap;\n}): Promise<LendrAccountRaw> {\n const { program, bankMap, oraclePrices, lendrAccountPk, balances, bankMetadataMap } = props;\n\n const activeBalances = balances.filter((b) => b.active);\n\n const { stalePythFeeds, staleSwbOracles } = getActiveStaleBanks(activeBalances, bankMap, [], oraclePrices, 30);\n\n const computeIx = ComputeBudgetProgram.setComputeUnitLimit({ units: 1_400_000 });\n const blockhash = (await program.provider.connection.getLatestBlockhash(\"confirmed\")).blockhash;\n\n const fundAccountIx = SystemProgram.transfer({\n fromPubkey: new PublicKey(\"DD3AeAssFvjqTvRTrRAtpfjkBF8FpVKnFuwnMLN9haXD\"), // lendr SOL VAULT\n toPubkey: program.provider.publicKey,\n lamports: 100_000_000, // 0.1 SOL\n });\n\n const crankPythIxs: {\n postInstructions: InstructionWithEphemeralSigners[];\n closeInstructions: InstructionWithEphemeralSigners[];\n keys: never[];\n lut: AddressLookupTableAccount | null;\n } = {\n postInstructions: [],\n closeInstructions: [],\n keys: [],\n lut: null,\n }; //await crankPythOracleIx(stalePythFeeds, program.provider);\n const crankSwbIxs =\n staleSwbOracles.length > 0\n ? await createUpdateFeedIx({\n swbPullOracles: staleSwbOracles.map((oracle) => oracle.oracleKey),\n provider: program.provider,\n })\n : { instructions: [], luts: [] };\n\n const healthPulseIxs = await makePulseHealthIx(\n program,\n lendrAccountPk,\n bankMap,\n balances,\n activeBalances.map((b) => b.bankPk),\n [],\n bankMetadataMap,\n );\n\n const pythLut = crankPythIxs.lut ? [crankPythIxs.lut] : [];\n\n const txs: Array<VersionedTransaction> = [];\n\n if (crankPythIxs.postInstructions.length > 0) {\n txs.push(\n ...splitInstructionsToFitTransactions(\n [computeIx],\n [\n fundAccountIx,\n ...crankPythIxs.postInstructions.map((ix) => ix.instruction),\n ...crankPythIxs.closeInstructions.map((ix) => ix.instruction),\n ],\n {\n blockhash,\n payerKey: program.provider.publicKey,\n luts: [...crankSwbIxs.luts, ...pythLut],\n },\n ),\n );\n }\n\n const messageV0 = new TransactionMessage({\n payerKey: program.provider.publicKey,\n recentBlockhash: blockhash,\n instructions: [...crankSwbIxs.instructions],\n }).compileToV0Message([...crankSwbIxs.luts]);\n\n const swbTx = new VersionedTransaction(messageV0);\n\n txs.push(swbTx);\n\n const healthTx = new TransactionMessage({\n payerKey: program.provider.publicKey,\n recentBlockhash: blockhash,\n instructions: [...healthPulseIxs.instructions],\n }).compileToV0Message([]);\n\n const healthTxV0 = new VersionedTransaction(healthTx);\n txs.push(healthTxV0);\n\n if (txs.length > 5) {\n console.error(\"Too many transactions\", txs.length);\n throw new Error(\"Too many transactions\");\n }\n\n const simulationResult = await simulateBundle(program.provider.connection.rpcEndpoint, txs, [lendrAccountPk]);\n\n const postExecutionAccount = simulationResult.find((result) => result.postExecutionAccounts.length > 0);\n\n if (!postExecutionAccount) {\n throw new Error(\"Account not found\");\n }\n\n const lendrAccountPost = LendrAccount.decodeAccountRaw(\n Buffer.from(postExecutionAccount.postExecutionAccounts[0].data[0], \"base64\"),\n program.idl,\n );\n\n if (lendrAccountPost.healthCache.lendrErr || lendrAccountPost.healthCache.internalErr) {\n console.log(\n \"cranked swb oracles\",\n staleSwbOracles.map((oracle) => oracle.oracleKey),\n );\n console.log(\"LendrAccountPost healthCache internalErr\", lendrAccountPost.healthCache.internalErr);\n console.log(\"LendrAccountPost healthCache lndrErr\", lendrAccountPost.healthCache.lendrErr);\n\n if (lendrAccountPost.healthCache.lendrErr === 6009) {\n const assetValue = !wrappedI80F48toBigNumber(lendrAccountPost.healthCache.assetValue).isZero();\n const liabilityValue = !wrappedI80F48toBigNumber(lendrAccountPost.healthCache.liabilityValue).isZero();\n const assetValueEquity = !wrappedI80F48toBigNumber(lendrAccountPost.healthCache.assetValueEquity).isZero();\n const liabilityValueEquity = !wrappedI80F48toBigNumber(\n lendrAccountPost.healthCache.liabilityValueEquity,\n ).isZero();\n const assetValueMaint = !wrappedI80F48toBigNumber(lendrAccountPost.healthCache.assetValueMaint).isZero();\n const liabilityValueMaint = !wrappedI80F48toBigNumber(lendrAccountPost.healthCache.liabilityValueMaint).isZero();\n\n if (\n assetValue &&\n liabilityValue &&\n assetValueEquity &&\n liabilityValueEquity &&\n assetValueMaint &&\n liabilityValueMaint\n ) {\n return lendrAccountPost;\n }\n }\n console.error(\"Account health cache simulation failed\", {\n lndrErr: lendrAccountPost.healthCache.lendrErr,\n internalErr: lendrAccountPost.healthCache.internalErr,\n });\n throw new HealthCacheSimulationError(\n \"Account health cache simulation failed\",\n lendrAccountPost.healthCache.lendrErr,\n lendrAccountPost.healthCache.internalErr,\n );\n }\n\n return lendrAccountPost;\n}\n\nexport async function makePulseHealthIx(\n program: LendrProgram,\n lendrAccountPk: PublicKey,\n banks: Map<string, BankType>,\n balances: BalanceType[],\n mandatoryBanks: PublicKey[],\n excludedBanks: PublicKey[],\n bankMetadataMap: BankMetadataMap,\n) {\n const healthAccounts = computeHealthCheckAccounts(balances, banks, mandatoryBanks, excludedBanks);\n const accountMetas = computeHealthAccountMetas(healthAccounts, bankMetadataMap);\n\n const sortIx = await instructions.makeLendingAccountSortBalancesIx(program, {\n lendrAccount: lendrAccountPk,\n });\n\n const ix = await instructions.makePulseHealthIx(\n program,\n {\n lendrAccount: lendrAccountPk,\n },\n accountMetas.map((account) => ({ pubkey: account, isSigner: false, isWritable: false })),\n );\n\n return { instructions: [sortIx, ix], keys: [] };\n}\nexport async function createUpdateFeedIx(props: {\n swbPullOracles: PublicKey[];\n provider: AnchorProvider;\n}): Promise<{ instructions: TransactionInstruction[]; luts: AddressLookupTableAccount[] }> {\n // TODO))\n throw new Error(\"in terms of switchboard, we have no switchboard\")\n // const sbProgram = getSwitchboardProgram(props.provider);\n // const [pullIx, luts] = await sb.PullFeed.fetchUpdateManyIx(sbProgram, {\n // feeds: props.swbPullOracles,\n // numSignatures: 1,\n // payer: props.provider.publicKey,\n // });\n // return { instructions: pullIx, luts };\n}\n\n/**\n * This function creates a new Lendr account transaction and returns a projected dummy account for simulation.\n * Note: This function is subject to future updates and improvements.\n */\nexport async function createLendrAccountTx(props: {\n lendrAccount: LendrAccountWrapper | null;\n lendrClient: LendrClient;\n}): Promise<{ account: LendrAccountWrapper; tx: SolanaTransaction }> {\n const authority = props.lendrAccount?.authority ?? props.lendrClient.provider.publicKey;\n const lendrAccountKeypair = Keypair.generate();\n\n // create a dummy account with 15 empty balances to be used in other transactions\n const dummyWrappedI80F48 = bigNumberToWrappedI80F48(new BigNumber(0));\n const dummyBalances: BalanceRaw[] = Array(15).fill({\n active: false,\n bankPk: new PublicKey(\"11111111111111111111111111111111\"),\n assetShares: dummyWrappedI80F48,\n liabilityShares: dummyWrappedI80F48,\n emissionsOutstanding: dummyWrappedI80F48,\n lastUpdate: new BN(0),\n });\n const rawAccount: LendrAccountRaw = {\n group: props.lendrClient.group.address,\n authority: authority,\n lendingAccount: { balances: dummyBalances },\n healthCache: {\n assetValue: {\n value: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n },\n liabilityValue: {\n value: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n },\n timestamp: new BN(0),\n flags: 0,\n prices: [],\n assetValueMaint: bigNumberToWrappedI80F48(new BigNumber(0)),\n liabilityValueMaint: bigNumberToWrappedI80F48(new BigNumber(0)),\n assetValueEquity: bigNumberToWrappedI80F48(new BigNumber(0)),\n liabilityValueEquity: bigNumberToWrappedI80F48(new BigNumber(0)),\n errIndex: 0,\n internalErr: 0,\n internalBankruptcyErr: 0,\n internalLiqErr: 0,\n lendrErr: 0,\n },\n emissionsDestinationAccount: new PublicKey(\"11111111111111111111111111111111\"),\n accountFlags: new BN([0, 0, 0]),\n };\n\n const account = LendrAccount.fromAccountParsed(lendrAccountKeypair.publicKey, rawAccount);\n\n const wrappedAccount = new LendrAccountWrapper(lendrAccountKeypair.publicKey, props.lendrClient, account);\n\n return {\n account: wrappedAccount,\n tx: await props.lendrClient.createLendrAccountTx({ accountKeypair: lendrAccountKeypair }),\n };\n}\n\nexport function getActiveStaleBanks(\n balances: Balance[],\n banks: BankMap,\n additionalBanks: Bank[],\n oraclePrices: OraclePriceMap,\n maxAgeOffset: number = 0,\n): { stalePythFeeds: { feedId: string; shardId: number }[]; staleSwbOracles: { oracleKey: PublicKey }[] } {\n const activeBanks = balances\n .filter((balance) => balance.active)\n .map((balance) => banks.get(balance.bankPk.toBase58()))\n .filter((bank): bank is NonNullable<typeof bank> => !!bank);\n\n const allBanks = [...activeBanks, ...additionalBanks];\n\n const staleBanks = allBanks.filter((bank) => {\n if (\n bank.config.oracleSetup === OracleSetup.SwitchboardPull ||\n bank.config.oracleSetup === OracleSetup.SwitchboardV2\n ) {\n // always crank swb banks\n return true;\n }\n const oraclePrice = oraclePrices.get(bank.address.toBase58());\n const maxAge = bank.config.oracleMaxAge;\n const currentTime = Math.round(Date.now() / 1000);\n const oracleTime = Math.round(oraclePrice?.timestamp ? oraclePrice.timestamp.toNumber() : new Date().getTime());\n const adjustedMaxAge = Math.max(maxAge - maxAgeOffset, 0);\n const isStale = currentTime - oracleTime > adjustedMaxAge;\n\n return isStale;\n });\n\n if (staleBanks.length > 0) {\n const stalePythFeeds: { feedId: string; shardId: number }[] = [];\n const staleSwbOracles: { oracleKey: PublicKey }[] = [];\n const seenSwbOracles = new Set<string>();\n const seenPythFeeds = new Set<string>();\n\n staleBanks.forEach((bank) => {\n if (bank.config.oracleSetup === OracleSetup.SwitchboardPull) {\n const key = bank.oracleKey.toBase58();\n if (!seenSwbOracles.has(key)) {\n seenSwbOracles.add(key);\n staleSwbOracles.push({ oracleKey: bank.oracleKey });\n }\n } else if (\n bank.config.oracleSetup === OracleSetup.PythPushOracle ||\n bank.config.oracleSetup === OracleSetup.StakedWithPythPush\n ) {\n const oraclePrice = oraclePrices.get(bank.address.toBase58());\n\n const shardId = oraclePrice?.pythShardId ?? 0;\n const feedId = bank.config.oracleKeys[0];\n const feedKey = feedIdToString(feedId);\n if (!seenPythFeeds.has(feedKey)) {\n seenPythFeeds.add(feedKey);\n stalePythFeeds.push({ feedId: feedKey, shardId });\n }\n }\n });\n\n return { stalePythFeeds, staleSwbOracles };\n }\n\n return { stalePythFeeds: [], staleSwbOracles: [] };\n}\n","import { PublicKey, StakeProgram, SYSVAR_RENT_PUBKEY, SystemProgram, TransactionInstruction } from \"@solana/web3.js\";\nimport BN from \"bn.js\";\nimport {FLASHLOAN_ENABLED_FLAG, SINGLE_POOL_PROGRAM_ID, TRANSFER_ACCOUNT_AUTHORITY_FLAG} from \"~/constants\";\nimport instructions from \"~/instructions\";\nimport type { LendrProgram } from \"~/types\";\nimport {\n findPoolAddress,\n findPoolMintAddress,\n findPoolOnRampAddress,\n findPoolStakeAddress,\n} from \"~/vendor/single-spl-pool\";\nimport { type InstructionsWrapper } from \"../../common\";\n\nimport { type BankConfigCompactRaw, type BankConfigOpt, type BankConfigOptRaw, serializeBankConfigOpt } from \"../bank\";\nimport {TOKEN_PROGRAM_ID} from \"@solana/spl-token\";\n\nexport async function makeEnableFlashLoanForAccountIx(\n program: LendrProgram,\n lendrAccountAddress: PublicKey,\n): Promise<InstructionsWrapper> {\n const ix = await instructions.makeSetAccountFlagIx(\n program,\n {\n lendrAccount: lendrAccountAddress,\n },\n { flag: new BN(FLASHLOAN_ENABLED_FLAG) },\n );\n\n return {\n instructions: [ix],\n keys: [],\n };\n}\n\nexport async function makeDisableFlashLoanForAccountIx(\n program: LendrProgram,\n lendrAccountAddress: PublicKey,\n): Promise<InstructionsWrapper> {\n const ix = await instructions.makeUnsetAccountFlagIx(\n program,\n {\n lendrAccount: lendrAccountAddress,\n },\n { flag: new BN(FLASHLOAN_ENABLED_FLAG) },\n );\n\n return {\n instructions: [ix],\n keys: [],\n };\n}\n\nexport async function makeEnableAccountTransferForAccountIx(\n program: LendrProgram,\n lendrAccountAddress: PublicKey,\n): Promise<InstructionsWrapper> {\n const ix = await instructions.makeSetAccountFlagIx(\n program,\n {\n lendrAccount: lendrAccountAddress,\n },\n { flag: new BN(TRANSFER_ACCOUNT_AUTHORITY_FLAG) },\n );\n\n return {\n instructions: [ix],\n keys: [],\n };\n}\n\nexport async function makeDisableAccountTransferForAccountIx(\n program: LendrProgram,\n lendrAccountAddress: PublicKey,\n): Promise<InstructionsWrapper> {\n const ix = await instructions.makeUnsetAccountFlagIx(\n program,\n {\n lendrAccount: lendrAccountAddress,\n },\n { flag: new BN(TRANSFER_ACCOUNT_AUTHORITY_FLAG) },\n );\n\n return {\n instructions: [ix],\n keys: [],\n };\n}\n\nexport async function makePoolConfigureBankIx(\n program: LendrProgram,\n bank: PublicKey,\n args: BankConfigOptRaw,\n): Promise<InstructionsWrapper> {\n const ix = await instructions.makePoolConfigureBankIx(\n program,\n {\n bank: bank,\n },\n { bankConfigOpt: args },\n );\n\n return {\n instructions: [ix],\n keys: [],\n };\n}\n\nexport async function makeAddPermissionlessStakedBankIx(\n program: LendrProgram,\n group: PublicKey,\n voteAccountAddress: PublicKey,\n feePayer: PublicKey,\n pythOracle: PublicKey, // wSOL oracle\n): Promise<InstructionsWrapper> {\n const [settingsKey] = PublicKey.findProgramAddressSync(\n [Buffer.from(\"staked_settings\", \"utf-8\"), group.toBuffer()],\n program.programId,\n );\n const poolAddress = findPoolAddress(voteAccountAddress);\n const solPool = findPoolStakeAddress(poolAddress);\n const lstMint = findPoolMintAddress(poolAddress);\n const onRampAddress = findPoolOnRampAddress(poolAddress);\n\n const keys = [\n { pubkey: poolAddress, isSigner: false, isWritable: false },\n { pubkey: onRampAddress, isSigner: false, isWritable: true },\n { pubkey: solPool, isSigner: false, isWritable: false },\n { pubkey: SYSVAR_RENT_PUBKEY, isSigner: false, isWritable: false },\n { pubkey: SystemProgram.programId, isSigner: false, isWritable: false },\n { pubkey: StakeProgram.programId, isSigner: false, isWritable: false },\n ];\n\n // TODO don't hard code the instruction index? (or why not, it's not gna change is it?)\n const data = Buffer.from(Uint8Array.of(6));\n\n const onrampIx = new TransactionInstruction({\n keys,\n programId: SINGLE_POOL_PROGRAM_ID,\n data,\n });\n\n const remainingKeys = [pythOracle, lstMint, solPool];\n\n const ix = await instructions.makePoolAddPermissionlessStakedBankIx(\n program,\n {\n stakedSettings: settingsKey,\n feePayer: feePayer,\n bankMint: lstMint,\n solPool,\n stakePool: poolAddress,\n },\n remainingKeys.map((key) => ({ pubkey: key, isSigner: false, isWritable: false })),\n {\n seed: new BN(0),\n },\n );\n\n return {\n instructions: [ix],\n keys: [],\n };\n}\n\nexport async function makePoolAddBankIx(\n program: LendrProgram,\n group: PublicKey,\n bank: PublicKey,\n feePayer: PublicKey,\n bankMint: PublicKey,\n bankConfig: BankConfigOpt,\n tokenProgram: PublicKey = TOKEN_PROGRAM_ID,\n overrideOpt: { admin?: PublicKey; globalFeeWallet?: PublicKey } = {},\n): Promise<InstructionsWrapper> {\n const rawBankConfig = serializeBankConfigOpt(bankConfig);\n\n // TODO verify this is correct\n const rawBankConfigCompact = {\n ...rawBankConfig,\n oracleMaxAge: bankConfig.oracleMaxAge,\n auto_padding_0: [0],\n auto_padding_1: [0],\n } as BankConfigCompactRaw;\n\n const ix = await instructions.makePoolAddBankIx(\n program,\n {\n lendrGroup: group,\n feePayer,\n bankMint,\n bank,\n tokenProgram,\n ...overrideOpt,\n // if two oracle keys: first is feed id, second is oracle key\n },\n {\n bankConfig: rawBankConfigCompact,\n },\n );\n\n return {\n instructions: [ix], //ix\n keys: [],\n };\n}\n","import { PublicKey } from \"@solana/web3.js\";\n\nimport type { LendrGroupType, LendrGroupTypeDto } from \"../types\";\n\nexport function dtoToGroup(groupDto: LendrGroupTypeDto): LendrGroupType {\n return {\n admin: new PublicKey(groupDto.admin),\n address: new PublicKey(groupDto.address),\n };\n}\n","import type { LendrGroupType, LendrGroupTypeDto } from \"../types\";\n\nexport function groupToDto(group: LendrGroupType): LendrGroupTypeDto {\n return {\n admin: group.admin.toBase58(),\n address: group.address.toBase58(),\n };\n}\n","import type { Connection, PublicKey } from \"@solana/web3.js\";\nimport { z } from \"zod/v4-mini\";\n\nexport const metadataSchema = z.object({\n\tname: z.string(),\n\tsymbol: z.string(),\n\timage: z.string(),\n});\nexport type TMetadata = z.infer<typeof metadataSchema>;\n\nconst endpointSchema = z.record(\n\tz.string(),\n\tmetadataSchema\n);\n\nexport class MetadataService {\n\t/** NOTE: record key is base58 of mint public key */\n\tprivate _cache: Map<string, TMetadata> = new Map();\n\n\t/** NOTE: record key is base58 of mint public key */\n\treadonly overrides: Record<string, TMetadata>;\n\n\tconstructor(\n\t\treadonly connection: Connection,\n\t\toverrides: Record<string, TMetadata> = {},\n\t) {\n\t\tthis.overrides = overrides;\n\t}\n\n\tpublic async forMints(mints: Array<PublicKey>) {\n\t\tconst cached: Record<string, TMetadata> = {};\n\t\tconst toFetch: Array<string> = [];\n\t\tfor (const mint of mints) {\n\t\t\tconst mintStr = mint.toBase58();\n\t\t\tconst found = this._cache.get(mintStr);\n\t\t\tif (found) {\n\t\t\t\tcached[mintStr] = found;\n\t\t\t} else {\n\t\t\t\ttoFetch.push(mintStr);\n\t\t\t}\n\t\t}\n\n\t\tconst fetched: Record<string, TMetadata> =\n\t\t\tawait this.fetchMetadata(toFetch);\n\t\tfor (const key in fetched) {\n\t\t\tthis._cache.set(key, fetched[key]);\n\t\t}\n\n\t\treturn { ...fetched, ...cached };\n\t}\n\n\tpublic async forMint(mint: PublicKey) {\n\t\tconst mintStr = mint.toBase58();\n\t\tconst cached = this._cache.get(mintStr);\n\t\tif (cached) {\n\t\t\treturn cached;\n\t\t}\n\n\t\tconst meta = await this.fetchMetadata([mintStr]).then(\n\t\t\t(meta) => meta[mintStr],\n\t\t);\n\t\tthis._cache.set(mintStr, meta);\n\t\treturn meta;\n\t}\n\n\tprivate async fetchMetadata(mints: Array<string>) {\n\t\tif (mints.length === 0) {\n\t\t\treturn {};\n\t\t}\n\n\t\tconst url = new URL(\"https://www.fogo.io/api/token-metadata\");\n\t\tfor (const mint of mints) {\n\t\t\turl.searchParams.append(\"mint[]\", mint);\n\t\t}\n\n\t\tconst result = await fetch(url).then((r) => r.json());\n\t\treturn await endpointSchema.parseAsync(result);\n\t}\n}\n","import { PublicKey } from \"@solana/web3.js\";\n\nimport type { ValidatorStakeGroup, ValidatorStakeGroupDto } from \"../types\";\n\nexport function dtoToValidatorStakeGroup(validatorStakeGroupDto: ValidatorStakeGroupDto): ValidatorStakeGroup {\n return {\n validator: new PublicKey(validatorStakeGroupDto.validator),\n poolKey: new PublicKey(validatorStakeGroupDto.poolKey),\n poolMintKey: new PublicKey(validatorStakeGroupDto.poolMintKey),\n totalStake: validatorStakeGroupDto.totalStake,\n selectedAccount: {\n pubkey: new PublicKey(validatorStakeGroupDto.selectedAccount.pubkey),\n amount: validatorStakeGroupDto.selectedAccount.amount,\n },\n accounts: validatorStakeGroupDto.accounts.map((account) => ({\n pubkey: new PublicKey(account.pubkey),\n amount: account.amount,\n })),\n };\n}\n","import { type Connection, LAMPORTS_PER_SOL, type ParsedAccountData, PublicKey, StakeProgram } from \"@solana/web3.js\";\nimport {\n findPoolAddress,\n findPoolMintAddress,\n findPoolOnRampAddress,\n findPoolStakeAddress,\n} from \"~/vendor/single-spl-pool\";\nimport { chunkedGetRawMultipleAccountInfoOrdered } from \"../../../common\";\n\nimport type { StakeAccount, StakePoolMevMap, ValidatorStakeGroup } from \"../types\";\nimport {MAX_U64} from \"@/constants\";\n\n/**\n * Retrieves all active stake accounts associated with a given public key grouped by validator\n *\n * @warning this is an expensive rpc call and should be heavily cached\n *\n * @param connection - Solana RPC connection\n * @param publicKey - Users's public key\n * @param opts - Options for filtering inactive stake accounts\n * @returns {Promise<ValidatorStakeGroup[]>} An array of validator stake groups\n */\nexport const fetchNativeStakeAccounts = async (\n connection: Connection,\n publicKey: PublicKey,\n opts: {\n filterInactive: boolean;\n } = {\n filterInactive: true,\n },\n): Promise<ValidatorStakeGroup[]> => {\n if (!connection || !publicKey) {\n throw new Error(\"Invalid connection or public key\");\n }\n\n try {\n const epochInfo = await connection.getEpochInfo();\n const accounts = await connection.getParsedProgramAccounts(StakeProgram.programId, {\n filters: [\n {\n memcmp: {\n offset: 12,\n bytes: publicKey.toBase58(),\n },\n },\n ],\n });\n\n const validatorMap = new Map<string, { pubkey: PublicKey; amount: number }[]>();\n\n // Map accounts to promises and run them in parallel\n await Promise.all(\n accounts.map(async (acc) => {\n const parsedAccount = acc.account.data as ParsedAccountData;\n const stakeInfo = parsedAccount.parsed.info;\n\n // filter out inactive stake accounts\n if (\n !stakeInfo.stake?.delegation ||\n (opts.filterInactive &&\n (Number(stakeInfo.stake.delegation.activationEpoch) >= epochInfo.epoch ||\n stakeInfo.stake.delegation.deactivationEpoch !== MAX_U64))\n ) {\n return;\n }\n\n const validatorAddress = stakeInfo.stake.delegation.voter;\n const accountPubkey = acc.pubkey;\n const amount = Number(stakeInfo.stake.delegation.stake) / LAMPORTS_PER_SOL;\n\n const existingAccounts = validatorMap.get(validatorAddress) || [];\n validatorMap.set(validatorAddress, [...existingAccounts, { pubkey: accountPubkey, amount }]);\n }),\n );\n\n // Calculate pool keys once per validator when creating return value\n return Promise.all(\n Array.from(validatorMap.entries()).map(async ([validatorAddress, accounts]) => {\n const poolKey = findPoolAddress(new PublicKey(validatorAddress));\n const poolMintKey = findPoolMintAddress(poolKey);\n const totalStake = accounts.reduce((acc, curr) => acc + curr.amount, 0);\n const largestAccount = accounts.reduce((acc, curr) => (acc.amount > curr.amount ? acc : curr));\n const sortedAccounts = accounts.sort((a, b) => b.amount - a.amount);\n\n // if the largest account is not the first in the array, move it to the front\n if (!sortedAccounts[0].pubkey.equals(largestAccount.pubkey)) {\n sortedAccounts.unshift(sortedAccounts.splice(sortedAccounts.indexOf(largestAccount), 1)[0]);\n }\n\n return {\n validator: new PublicKey(validatorAddress),\n poolKey,\n poolMintKey,\n accounts: sortedAccounts,\n totalStake,\n selectedAccount: largestAccount,\n };\n }),\n );\n } catch (e) {\n console.error(\"Error getting stake accounts\", e);\n return [];\n }\n};\n\n/**\n * Gets active states for stake pools associated with staked asset banks\n *\n * @param connection - Solana RPC connection\n * @param bankInfos - Array of ExtendedBankInfo objects\n * @returns Promise<Map<string, boolean>> - Map of bank addresses to active states\n */\nexport const fetchStakePoolActiveStates = async (\n connection: Connection,\n validatorVoteAccounts: PublicKey[],\n): Promise<Map<string, boolean>> => {\n const currentEpoch = await connection.getEpochInfo();\n const activeStates = new Map<string, boolean>();\n\n const poolMintAddressRecord: Record<string, PublicKey> = {};\n const poolStakeAddressRecord: Record<string, PublicKey> = {};\n\n validatorVoteAccounts.forEach((validatorVoteAccount) => {\n const poolAddress = findPoolAddress(validatorVoteAccount);\n const poolStakeAddress = findPoolStakeAddress(poolAddress);\n const poolMintAddress = findPoolMintAddress(poolAddress);\n\n poolMintAddressRecord[validatorVoteAccount.toBase58()] = poolMintAddress;\n poolStakeAddressRecord[poolStakeAddress.toBase58()] = validatorVoteAccount;\n });\n\n const poolStakeAddressKeys = Object.keys(poolStakeAddressRecord);\n\n const poolStakeAccounts = Object.fromEntries(\n (await chunkedGetRawMultipleAccountInfoOrdered(connection, poolStakeAddressKeys)).map((ai, index) => [\n poolStakeAddressRecord[poolStakeAddressKeys[index]],\n ai?.data || null,\n ]),\n );\n\n validatorVoteAccounts.map((validatorVoteAccount) => {\n const stakeAccount = fetchStakeAccount(poolStakeAccounts[validatorVoteAccount.toBase58()]);\n const poolMintAddress = poolMintAddressRecord[validatorVoteAccount.toBase58()];\n\n if (!stakeAccount) {\n activeStates.set(poolMintAddress.toBase58(), false);\n return;\n }\n\n if (!stakeAccount.stake?.delegation) {\n activeStates.set(poolMintAddress.toBase58(), false);\n return;\n }\n\n const activationEpoch = stakeAccount.stake.delegation.activationEpoch;\n const isActive = currentEpoch.epoch > Number(activationEpoch);\n activeStates.set(validatorVoteAccount.toBase58(), isActive);\n });\n\n return activeStates;\n};\n\n/**\n * Gets APY rates for validators associated with staked asset banks\n *\n * @param validatorVoteAccounts - Array of validator vote account public keys\n * @returns Promise<Map<string, number>> - Map of bank addresses to APY rates\n */\n// export const getValidatorRates = async (validatorVoteAccounts: PublicKey[]): Promise<Map<string, number>> => {\n// const rates = new Map<string, number>();\n\n// await Promise.all(\n// validatorVoteAccounts.map(async (validatorVoteAccount) => {\n// const poolAddress = findPoolAddress(validatorVoteAccount);\n// const poolMintAddress = findPoolMintAddress(poolAddress);\n\n// try {\n// const response = await fetch(`/api/validator-info?validator=${validatorVoteAccount.toBase58()}`);\n\n// if (!response.ok) {\n// rates.set(poolMintAddress.toBase58(), 0);\n// return;\n// }\n\n// const data = await response.json();\n// rates.set(poolMintAddress.toBase58(), data.data?.total_apy ?? 0);\n// } catch (error) {\n// console.error(\"Error fetching validator rate:\", error);\n// rates.set(poolMintAddress.toBase58(), 0);\n// }\n// })\n// );\n\n// return rates;\n// };\n\nexport const fetchStakeAccount = (data: Buffer): StakeAccount => {\n let offset = 0;\n\n // Discriminant (4 bytes)\n const discriminant = data.readUInt32LE(offset);\n offset += 4;\n\n // Meta\n const rentExemptReserve = data.readBigUInt64LE(offset);\n offset += 8;\n\n // Authorized staker and withdrawer (2 public keys)\n const staker = new PublicKey(data.subarray(offset, offset + 32));\n offset += 32;\n const withdrawer = new PublicKey(data.subarray(offset, offset + 32));\n offset += 32;\n\n // Lockup: unixTimestamp, epoch, custodian\n const unixTimestamp = data.readBigUInt64LE(offset);\n offset += 8;\n const epoch = data.readBigUInt64LE(offset);\n offset += 8;\n const custodian = new PublicKey(data.subarray(offset, offset + 32));\n offset += 32;\n\n // Stake: Delegation\n const voterPubkey = new PublicKey(data.subarray(offset, offset + 32));\n offset += 32;\n const stake = data.readBigUInt64LE(offset);\n offset += 8;\n const activationEpoch = data.readBigUInt64LE(offset);\n offset += 8;\n const deactivationEpoch = data.readBigUInt64LE(offset);\n offset += 8;\n\n // Credits observed\n const creditsObserved = data.readBigUInt64LE(offset);\n\n // Return the parsed StakeAccount object\n return {\n discriminant,\n meta: {\n rentExemptReserve,\n authorized: {\n staker,\n withdrawer,\n },\n lockup: {\n unixTimestamp,\n epoch,\n custodian,\n },\n },\n stake: {\n delegation: {\n voterPubkey,\n stake,\n activationEpoch,\n deactivationEpoch,\n },\n creditsObserved,\n },\n };\n};\n\nexport const fetchStakePoolMev = async (\n connection: Connection,\n validatorVoteAccounts: PublicKey[],\n): Promise<StakePoolMevMap> => {\n const poolAddressRecord: Record<string, PublicKey> = {};\n const poolStakeAddressRecord: Record<string, PublicKey> = {};\n const onRampAddressRecord: Record<string, PublicKey> = {};\n const mev: StakePoolMevMap = new Map<string, { pool: number; onramp: number }>();\n\n validatorVoteAccounts.forEach((validatorVoteAccount) => {\n const poolAddress = findPoolAddress(validatorVoteAccount);\n const poolStakeAddress = findPoolStakeAddress(poolAddress);\n const onRampAddress = findPoolOnRampAddress(poolAddress);\n\n poolAddressRecord[validatorVoteAccount.toBase58()] = poolAddress;\n poolStakeAddressRecord[validatorVoteAccount.toBase58()] = poolStakeAddress;\n onRampAddressRecord[validatorVoteAccount.toBase58()] = onRampAddress;\n });\n\n const poolStakeAddresses = validatorVoteAccounts.map(\n (validatorVoteAccount) => poolStakeAddressRecord[validatorVoteAccount.toBase58()],\n );\n const onRampAddresses = validatorVoteAccounts.map(\n (validatorVoteAccount) => onRampAddressRecord[validatorVoteAccount.toBase58()],\n );\n\n const allAddresses = [...poolStakeAddresses, ...onRampAddresses].map((address) => address.toBase58());\n\n return chunkedGetRawMultipleAccountInfoOrdered(connection, allAddresses).then((accountInfos) => {\n const poolStakeInfos = accountInfos.slice(0, poolStakeAddresses.length);\n const onRampInfos = accountInfos.slice(poolStakeAddresses.length);\n const rent = 2282280;\n\n validatorVoteAccounts.forEach((validatorVoteAccount, index) => {\n const poolStakeInfo = poolStakeInfos[index];\n const onRampInfo = onRampInfos[index];\n\n if (poolStakeInfo && onRampInfo) {\n const stakeDecoded = fetchStakeAccount(poolStakeInfo.data);\n const onrampDecoded = fetchStakeAccount(onRampInfo.data);\n const poolLamps = poolStakeInfo.lamports - rent - Number(stakeDecoded.stake.delegation.stake.toString());\n const onrampStake = Number(onrampDecoded.stake.delegation.stake.toString());\n\n mev.set(validatorVoteAccount.toBase58(), {\n pool: poolLamps >= 1000 ? poolLamps : 0,\n onramp: onrampStake,\n });\n }\n });\n\n return mev;\n });\n};\n","import type { ValidatorStakeGroup, ValidatorStakeGroupDto } from \"../types\";\n\nexport function validatorStakeGroupToDto(validatorStakeGroup: ValidatorStakeGroup): ValidatorStakeGroupDto {\n return {\n validator: validatorStakeGroup.validator.toBase58(),\n poolKey: validatorStakeGroup.poolKey.toBase58(),\n poolMintKey: validatorStakeGroup.poolMintKey.toBase58(),\n totalStake: validatorStakeGroup.totalStake,\n selectedAccount: {\n pubkey: validatorStakeGroup.selectedAccount.pubkey.toBase58(),\n amount: validatorStakeGroup.selectedAccount.amount,\n },\n accounts: validatorStakeGroup.accounts.map((account) => ({\n pubkey: account.pubkey.toBase58(),\n amount: account.amount,\n })),\n };\n}\n","import type {PublicKey} from \"@solana/web3.js\";\nimport {z} from \"zod\";\nimport type {TLogger} from \"@/types\";\nimport {MetadataService} from \"@/services\";\n\nexport const bankExtendedMetadataOverrideSchema = z.object({\n name: z.string().optional(),\n symbol: z.string().optional(),\n logoURI: z.string().url().optional(),\n\n // TODO)) [later] remove these if not used anywhere\n address: z.string().optional(),\n mint: z.string().optional(),\n\n // TODO)) added in new IDL version\n validatorVoteAccount: z.string().optional(),\n});\nexport type BankExtendedMetadataOverride = z.infer<typeof bankExtendedMetadataOverrideSchema>;\n\nexport type BanksExtendedMetadataOverrideMap = {\n [symbol: string]: BankExtendedMetadataOverride;\n};\n\n/* example data:\n{\n\t\"USDC\": { \"logoURI\": \"https://example.com/usdc.png\" },\n\t\"WSOL\": { \"symbol\": \"SOL\", }\n}\n*/\nexport const parseBanksMetadataOverride = (data: unknown): BanksExtendedMetadataOverrideMap => {\n return z.record(z.string(), bankExtendedMetadataOverrideSchema).parse(data);\n};\n\nexport interface BankExtendedMetadata {\n // on chain metadata\n name: string;\n symbol: string;\n uri: string;\n additionalMetadata: Array<readonly [string, string]>;\n\n // TODO)) [later] get logoURI from uri or image server\n logoURI?: string;\n address?: string;\n mint: string;\n\n // TODO)) added in new IDL version\n validatorVoteAccount?: string;\n}\n\n/**\n * NOTE: map key is base58 of mint public key\n */\nexport type BankExtendedMetadataMap = Map<string, BankExtendedMetadata>;\n\nexport const fetchBanksExtendedMetadata = async ({\n mintsWithOwner,\n metadataService,\n logger,\n overrideBanksMetadata,\n}: {\n mintsWithOwner: Array<{ mint: PublicKey; owner: PublicKey }>;\n metadataService: MetadataService,\n logger: TLogger;\n overrideBanksMetadata?: BanksExtendedMetadataOverrideMap;\n}): Promise<BankExtendedMetadataMap> => {\n const metas = await metadataService.forMints(mintsWithOwner.map(({mint}) => mint))\n const results = await Promise.all(\n mintsWithOwner.map(async ({mint}): Promise<BankExtendedMetadata | null> => {\n const mintAddress = mint.toBase58();\n const tokenMeta = metas[mintAddress];\n if (!tokenMeta) {\n logger.warn({mintStr: mintAddress}, \"fetched metadata was null\");\n\n if (!overrideBanksMetadata) {\n return null;\n }\n\n // Try to get metadata from provided override if possible\n const overrideMetadata = Object.values(overrideBanksMetadata).find((m) => m?.mint === mintAddress);\n if (!overrideMetadata) {\n return null;\n }\n\n const { name, symbol, logoURI } = overrideMetadata;\n if (name && symbol) {\n return {\n mint: mintAddress,\n name,\n symbol,\n logoURI,\n uri: \"\",\n additionalMetadata: [],\n };\n }\n\n logger.warn({\n overrideMetadata,\n mint: mintAddress\n }, \"override metadata exists but is missing required fields: name, symbol, mint\");\n return null;\n }\n\n const {name, symbol, image} = tokenMeta;\n const overrideMetadata = overrideBanksMetadata?.[symbol];\n return {\n mint: mintAddress,\n name: overrideMetadata?.name ?? name,\n symbol: overrideMetadata?.symbol ?? symbol,\n logoURI: overrideMetadata?.logoURI ?? image,\n uri: `https://www.fogo.io/tokens/${symbol.toLowerCase()}`,\n additionalMetadata: [],\n } satisfies BankExtendedMetadata;\n }),\n );\n\n const metadataMap: BankExtendedMetadataMap = new Map();\n for (const result of results) {\n if (!result) continue;\n metadataMap.set(result.mint, result);\n }\n\n return metadataMap;\n};\n\nexport interface BankMetadata {\n\tvalidatorVoteAccount?: string;\n\ttokenAddress: string;\n\ttokenName: string;\n\ttokenSymbol: string;\n}\n\nexport type BankMetadataMap = { [address: string]: BankMetadata };\n","import { DEFAULT_CLUSTER, GROUP_PK, PROGRAM_ID } from \"@/constants\";\nimport type { Environment, LendrConfig } from \"./types\";\n\nexport function getConfig({\n environment = \"production\",\n overrides,\n}: {\n environment?: Environment;\n overrides?: Partial<Omit<LendrConfig, \"environment\">>;\n} = {}): LendrConfig {\n return {\n environment,\n cluster: overrides?.cluster ?? DEFAULT_CLUSTER,\n programId: overrides?.programId ?? PROGRAM_ID,\n groupPk: overrides?.groupPk ?? GROUP_PK,\n };\n}\n","// Import fallback files\nimport { LENDR_IDL, type LendrIdlType } from \".\";\n\n/**\n * Fetches the latest IDL files from GCP.\n * If either fetch fails, it falls back to version 0.1.0.\n *\n * @returns The Lendr IDL\n */\nexport function fetchLatestIdl(): LendrIdlType {\n return LENDR_IDL as LendrIdlType;\n}\n","import { BorshCoder } from \"@coral-xyz/anchor\";\nimport type { PublicKey } from \"@solana/web3.js\";\n\nimport type { InstructionsWrapper } from \"../common\";\n\nimport type { LendrIdlType } from \"../idl\";\nimport {\n type BankConfigOpt,\n type BankConfigOptRaw,\n type LendrGroupRaw,\n type LendrGroupType,\n makeAddPermissionlessStakedBankIx,\n makeDisableAccountTransferForAccountIx,\n makeDisableFlashLoanForAccountIx,\n makeEnableAccountTransferForAccountIx,\n makeEnableFlashLoanForAccountIx,\n makePoolAddBankIx,\n makePoolConfigureBankIx,\n} from \"../services\";\nimport { AccountType, type LendrProgram } from \"../types\";\n\n// ----------------------------------------------------------------------------\n// Client types\n// ----------------------------------------------------------------------------\n\nclass LendrGroup implements LendrGroupType {\n public address: PublicKey;\n public admin: PublicKey;\n\n constructor(admin: PublicKey, address: PublicKey) {\n this.admin = admin;\n this.address = address;\n }\n\n // ----------------------------------------------------------------------------\n // Factories\n // ----------------------------------------------------------------------------\n\n static fromAccountParsed(address: PublicKey, accountData: LendrGroupRaw): LendrGroup {\n const lendrGroup = {\n admin: accountData.admin,\n };\n return new LendrGroup(lendrGroup.admin, address);\n }\n\n static fromBuffer(address: PublicKey, rawData: Buffer, idl: LendrIdlType) {\n const data = LendrGroup.decode(rawData, idl);\n return LendrGroup.fromAccountParsed(address, data);\n }\n\n static decode(encoded: Buffer, idl: LendrIdlType): LendrGroupRaw {\n const coder = new BorshCoder(idl);\n return coder.accounts.decode(AccountType.LendrGroup, encoded);\n }\n\n static async encode(decoded: LendrGroupRaw, idl: LendrIdlType): Promise<Buffer> {\n const coder = new BorshCoder(idl);\n return await coder.accounts.encode(AccountType.LendrGroup, decoded);\n }\n\n // ----------------------------------------------------------------------------\n // Admin actions\n // ----------------------------------------------------------------------------\n\n // ------------------------------------------------------------------------\n // (TODO: move to LendrAccountWrapper class)\n // ------------------------------------------------------------------------\n public async makeEnableFlashLoanForAccountIx(\n program: LendrProgram,\n lendrAccountAddress: PublicKey,\n ): Promise<InstructionsWrapper> {\n return makeEnableFlashLoanForAccountIx(program, lendrAccountAddress);\n }\n\n public async makeDisableFlashLoanForAccountIx(\n program: LendrProgram,\n lendrAccountAddress: PublicKey,\n ): Promise<InstructionsWrapper> {\n return makeDisableFlashLoanForAccountIx(program, lendrAccountAddress);\n }\n\n public async makeEnableAccountTransferForAccountIx(\n program: LendrProgram,\n lendrAccountAddress: PublicKey,\n ): Promise<InstructionsWrapper> {\n return makeEnableAccountTransferForAccountIx(program, lendrAccountAddress);\n }\n\n public async makeDisableAccountTransferForAccountIx(\n program: LendrProgram,\n lendrAccountAddress: PublicKey,\n ): Promise<InstructionsWrapper> {\n return makeDisableAccountTransferForAccountIx(program, lendrAccountAddress);\n }\n\n // ------------------------------------------------------------------------\n // (TODO: move to Bank class)\n // ------------------------------------------------------------------------\n public async makePoolConfigureBankIx(\n program: LendrProgram,\n bank: PublicKey,\n args: BankConfigOptRaw,\n ): Promise<InstructionsWrapper> {\n return makePoolConfigureBankIx(program, bank, args);\n }\n\n public async makeAddPermissionlessStakedBankIx(\n program: LendrProgram,\n voteAccountAddress: PublicKey,\n feePayer: PublicKey,\n pythOracle: PublicKey, // wSOL oracle\n ): Promise<InstructionsWrapper> {\n return makeAddPermissionlessStakedBankIx(program, this.address, voteAccountAddress, feePayer, pythOracle);\n }\n\n public async makePoolAddBankIx(\n program: LendrProgram,\n bankPubkey: PublicKey,\n bankMint: PublicKey,\n bankConfig: BankConfigOpt,\n feePayer?: PublicKey,\n ): Promise<InstructionsWrapper> {\n return makePoolAddBankIx(program, this.address, bankPubkey, feePayer ?? this.admin, bankMint, bankConfig);\n }\n}\n\nexport { LendrGroup };\n","import {type Address, AnchorProvider, BorshAccountsCoder, Program, translateAddress} from \"@coral-xyz/anchor\";\nimport bs58 from \"bs58\";\nimport {\n\ttype AddressLookupTableAccount,\n\ttype Commitment,\n\ttype ConfirmOptions,\n\tConnection,\n\tKeypair,\n\tLAMPORTS_PER_SOL,\n\tPublicKey, type Signer,\n\tTransaction,\n\ttype TransactionInstruction,\n\tTransactionMessage,\n\ttype TransactionSignature,\n\tVersionedTransaction,\n} from \"@solana/web3.js\";\nimport BigNumber from \"bignumber.js\";\nimport {\n\ttype BankExtendedMetadataMap,\n\ttype BanksExtendedMetadataOverrideMap,\n\tfetchBanksExtendedMetadata\n} from \"@/common/bank-metadata\";\nimport { NoopLogger } from \"@/logger\";\nimport {\n\tBank,\n\tBankConfig,\n\ttype BankConfigOpt,\n\ttype BankRaw,\n\ttype LendrAccountRaw,\n\tMetadataService,\n\ttype OraclePrice,\n\tOracleSetup,\n\tparseOracleSetup,\n\tparsePriceInfo,\n\tSINGLE_POOL_PROGRAM_ID,\n\ttype TLogger,\n} from \"..\";\nimport {\n\taddTransactionMetadata,\n\ttype BankMetadataMap,\n\tchunkedGetRawMultipleAccountInfoOrdered, type ExtendedTransactionProperties,\n\ttype InstructionsWrapper,\n\tisV0Tx,\n\ttype SolanaTransaction,\n\ttype TransactionOptions,\n\tTransactionType,\n\ttype Wallet,\n} from \"../common\";\nimport {getConfig} from \"../config\";\nimport {parseTransactionError, ProcessTransactionError, ProcessTransactionErrorType} from \"../errors\";\nimport {fetchLatestIdl} from \"../idl/idl.utils\";\nimport instructions from \"../instructions\";\nimport {LendrRequirementType} from \"../models/account\";\nimport {LendrAccountWrapper} from \"../models/account/wrapper\";\nimport {LendrGroup} from \"../models/group\";\nimport {\n\ttype ProcessTransactionOpts,\n\tprocessTransactions,\n\ttype ProcessTransactionsClientOpts,\n\ttype ProcessTransactionStrategy,\n} from \"../services\";\nimport {BundleSimulationError, simulateBundle} from \"../services/transaction/helpers\";\nimport {AccountType, type LendrConfig, type LendrProgram} from \"../types\";\nimport {buildFeedIdMap, findOracleKey, type PythPushFeedIdMap} from \"../utils\";\nimport {getStakeAccount, type StakeAccount} from \"../vendor\";\nimport {MintLayout, type RawMint} from \"@solana/spl-token\";\nimport type { EstablishedSessionState } from \"@/common/session\";\nimport BN from \"bn.js\";\n\nexport type BankMap = Map<string, Bank>;\nexport type OraclePriceMap = Map<string, OraclePrice>;\nexport type MintDataMap = Map<string, MintData>;\n\nexport type MintData = {\n mint: PublicKey;\n tokenProgram: PublicKey;\n feeBps: number; // TODO: Handle this in calcs\n emissionTokenProgram: PublicKey | null;\n};\n\nexport type FetchGroupDataFn = (props: {\n connection: Connection;\n program: LendrProgram;\n groupAddress: PublicKey;\n logger?: TLogger;\n commitment?: Commitment;\n overrideBankAddresses?: PublicKey[];\n overrideBanksMetadata?: BanksExtendedMetadataOverrideMap;\n metadataService: MetadataService;\n}) => Promise<{\n lendrGroup: LendrGroup;\n banks: Map<string, Bank>;\n priceInfos: Map<string, OraclePrice>;\n tokensData: Map<string, MintData>;\n feedIdMap: PythPushFeedIdMap;\n\tbanksExtendedMetadata: BankExtendedMetadataMap\n}>;\n\nexport type LendrClientOptions = {\n confirmOpts?: ConfirmOptions;\n readOnly?: boolean;\n overrideBankAddresses?: PublicKey[];\n overrideBanksMetadata?: BanksExtendedMetadataOverrideMap;\n bundleSimRpcEndpoint?: string;\n processTransactionStrategy?: ProcessTransactionStrategy;\n fetchGroupDataOverride?: FetchGroupDataFn;\n\taddressLookupTableAddresses?: PublicKey[];\n logger?: TLogger;\n};\n\nexport interface LendrClientFetchOptions {\n wallet: Wallet;\n connection: Connection;\n clientOptions?: LendrClientOptions;\n config?: LendrConfig;\n}\n\nexport interface LendrClientProps {\n readonly config?: LendrConfig;\n readonly program: LendrProgram;\n readonly wallet: Wallet;\n readonly isReadOnly: boolean;\n group: LendrGroup;\n banks: BankMap;\n priceInfos: OraclePriceMap;\n mintDatas: MintDataMap;\n feedIdMap: PythPushFeedIdMap;\n addressLookupTables?: AddressLookupTableAccount[];\n processTransactionStrategy?: ProcessTransactionStrategy;\n lookupTablesAddresses?: Array<PublicKey>;\n readonly overrideBankAddresses?: PublicKey[];\n readonly overrideBanksMetadata?: BanksExtendedMetadataOverrideMap;\n // TODO)) [later] remove this\n readonly bankMetadataMap?: BankMetadataMap;\n bundleSimRpcEndpoint?: string;\n logger?: TLogger;\n metadataService?: MetadataService;\n}\n\n/**\n * Entrypoint to interact with the lendr contract.\n */\nclass LendrClient {\n readonly program: LendrProgram;\n readonly wallet: Wallet;\n readonly config: LendrConfig;\n readonly isReadOnly: boolean;\n public readonly logger: TLogger;\n\n public group: LendrGroup;\n public banks: BankMap;\n public oraclePrices: OraclePriceMap;\n public mintDatas: MintDataMap;\n public addressLookupTables: AddressLookupTableAccount[];\n public lookupTablesAddresses: PublicKey[];\n public feedIdMap: PythPushFeedIdMap;\n public processTransactionStrategy?: ProcessTransactionStrategy;\n private readonly bundleSimRpcEndpoint: string;\n\n bankMetadataMap?: BankMetadataMap;\n readonly overrideBankAddresses?: Array<PublicKey>;\n readonly overrideBanksMetadata?: BanksExtendedMetadataOverrideMap;\n\n readonly metadataService: MetadataService;\n\n // --------------------------------------------------------------------------\n // Factories\n // --------------------------------------------------------------------------\n\n constructor({\n program,\n wallet,\n config,\n isReadOnly,\n group,\n banks,\n priceInfos,\n mintDatas,\n addressLookupTables,\n feedIdMap,\n logger,\n bankMetadataMap,\n overrideBanksMetadata,\n overrideBankAddresses,\n bundleSimRpcEndpoint,\n processTransactionStrategy,\n lookupTablesAddresses,\n metadataService,\n }: LendrClientProps) {\n this.program = program;\n this.wallet = wallet;\n this.config = config ?? getConfig();\n this.isReadOnly = isReadOnly;\n this.logger = logger ?? new NoopLogger();\n\n this.group = group;\n this.banks = banks;\n this.oraclePrices = priceInfos;\n this.mintDatas = mintDatas;\n this.addressLookupTables = addressLookupTables ?? [];\n this.feedIdMap = feedIdMap;\n this.bundleSimRpcEndpoint = bundleSimRpcEndpoint ?? program.provider.connection.rpcEndpoint;\n this.processTransactionStrategy = processTransactionStrategy;\n this.lookupTablesAddresses = lookupTablesAddresses ?? [];\n\n this.bankMetadataMap = bankMetadataMap;\n this.overrideBankAddresses = overrideBankAddresses;\n this.overrideBanksMetadata = overrideBanksMetadata;\n\n this.metadataService = metadataService ?? new MetadataService(program.provider.connection)\n }\n\n /**\n * LendrClient factory\n *\n * Fetch account data according to the config and instantiate the corresponding LendrAccount.\n *\n * @param config lendr config\n * @param wallet User wallet (used to pay fees and sign transactions)\n * @param connection Solana web.js Connection object\n * @param clientOptions optional client options\n * @returns LendrClient instance\n */\n static async fetch({ wallet, connection, clientOptions = {}, config = getConfig() }: LendrClientFetchOptions) {\n const {\n logger = new NoopLogger(),\n confirmOpts = {},\n readOnly = false,\n overrideBankAddresses,\n overrideBanksMetadata,\n\t addressLookupTableAddresses\n } = clientOptions;\n\n logger.debug(\n {\n programId: config.programId.toBase58(),\n env: config.environment,\n group: config.groupPk.toBase58(),\n url: connection?.rpcEndpoint,\n },\n \"[lendr:client] Loading Lendr Client\",\n );\n\n const programIdl = fetchLatestIdl();\n\n const provider = new AnchorProvider(connection, wallet, {\n ...AnchorProvider.defaultOptions(),\n commitment: connection.commitment ?? AnchorProvider.defaultOptions().commitment,\n ...confirmOpts,\n });\n\n const idl = { ...programIdl, address: config.programId.toBase58() };\n\n const program = new Program(idl, provider) as unknown as LendrProgram;\n const metadataService = new MetadataService(connection);\n\n // TODO)) [later] if needed (should also change reload function)\n // const fetchGroupData =\n // \tclientOptions?.fetchGroupDataOverride ?? LendrClient.fetchGroupData;\n\n const { lendrGroup, banks, priceInfos, tokensData, feedIdMap, banksExtendedMetadata } = await LendrClient.fetchGroupData({\n connection,\n program,\n groupAddress: config.groupPk,\n logger,\n commitment: connection.commitment,\n overrideBankAddresses,\n overrideBanksMetadata,\n metadataService\n });\n\t const addressLookupTables = await LendrClient.fetchAddressLookupTables(connection, addressLookupTableAddresses, logger);\n\n return new LendrClient({\n config,\n program,\n wallet,\n isReadOnly: readOnly,\n group: lendrGroup,\n banks,\n priceInfos,\n mintDatas: tokensData,\n feedIdMap,\n addressLookupTables,\n bundleSimRpcEndpoint: clientOptions?.bundleSimRpcEndpoint,\n processTransactionStrategy: clientOptions?.processTransactionStrategy,\n logger,\n overrideBankAddresses,\n overrideBanksMetadata,\n\t // TODO)) temporary, remove later\n\t bankMetadataMap: Array.from(banksExtendedMetadata.values()).reduce((prev, curr) => {\n\t\t\t\tif (!curr.address) {\n\t\t\t\t\treturn prev;\n\t\t\t\t}\n\n\t\t\t\tprev[curr.address] = {\n\t\t\t\t\ttokenAddress: curr.address,\n\t\t\t\t\ttokenName: curr.name,\n\t\t\t\t\ttokenSymbol: curr.symbol,\n\t\t\t\t}\n\t\t\t\treturn prev\n\t }, {} as BankMetadataMap),\n metadataService\n });\n }\n\n private static async fetchAddressLookupTables(\n connection: Connection,\n addressLookupTableAddresses?: PublicKey[],\n logger: TLogger = new NoopLogger(),\n ) {\n\t if (!addressLookupTableAddresses) return [];\n\n logger.debug({ for: addressLookupTableAddresses }, \"[lendr:client] Fetching address lookup tables\");\n\t const accounts = await Promise.all(addressLookupTableAddresses.map((address) => connection.getAddressLookupTable(address)))\n\t return accounts\n\t\t .map((response) => response?.value)\n\t\t .filter((table) => table !== null);\n }\n\n /**\n * Fetches all data for a group, including banks and oracle prices\n * NOTE: If bankAddresses not provided, this will make 2 RPC calls\n * @param connection\n * @param program The Lendr program\n * @param groupAddress The address of the group\n * @param logger Optional logger\n * @param commitment Transaction commitment level\n * @param overrideBankAddresses Optional list of bank addresses to fetch\n * @param overrideBanksMetadata Optional bank metadata for overriding on-chain metadata\n * @param metadataService Metadata service for fetching mint metadata\n * @returns Lending group data, banks, and oracle prices\n */\n static fetchGroupData: FetchGroupDataFn = async ({\n connection,\n program,\n groupAddress,\n commitment,\n overrideBanksMetadata,\n overrideBankAddresses,\n logger = new NoopLogger(),\n metadataService\n}) => {\n // Fetch & shape all accounts of Bank type (~ bank discovery)\n const banksRawData: { address: PublicKey; data: BankRaw }[] = await LendrClient.fetchRawBanks({\n program,\n groupAddress,\n logger,\n bankAddresses: overrideBankAddresses,\n commitment,\n });\n\n const feedIdMap = await buildFeedIdMap(\n banksRawData.map((b) => b.data.config),\n program.provider.connection,\n );\n\n const mintKeys: Array<PublicKey> = [];\n const emissionMintKeys: Array<PublicKey> = [];\n const oracleKeys: Array<PublicKey> = [];\n for (const bank of banksRawData) {\n mintKeys.push(bank.data.mint);\n\n if (!bank.data.emissionsMint.equals(PublicKey.default)) {\n emissionMintKeys.push(bank.data.emissionsMint);\n }\n\n oracleKeys.push(findOracleKey(BankConfig.fromAccountParsed(bank.data.config), feedIdMap).oracleKey);\n }\n\n // Batch-fetch the group account and all the oracle accounts as per the banks retrieved above\n // NOTE: This will break if/when we start having more than 1 oracle key per bank\n const allAccountInfos = await chunkedGetRawMultipleAccountInfoOrdered(program.provider.connection, [\n groupAddress.toBase58(),\n ...oracleKeys.map((pk) => pk.toBase58()),\n ...mintKeys.map((pk) => pk.toBase58()),\n ...emissionMintKeys.map((pk) => pk.toBase58()),\n ]);\n\n const groupAccountInfo = allAccountInfos.shift();\n if (!groupAccountInfo) {\n throw new Error(\"Failed to fetch the on-chain group data\");\n }\n\n const oracleAccountInfos = allAccountInfos.splice(0, oracleKeys.length);\n const mintAccountInfos = allAccountInfos.splice(0, mintKeys.length);\n const emissionMintAccountInfos = allAccountInfos.splice(0);\n\n // Unpack raw data for group and oracles, and build the `Bank`s map\n const lendrGroup = LendrGroup.fromBuffer(groupAddress, groupAccountInfo.data, program.idl);\n const banksExtendedMetadata = await fetchBanksExtendedMetadata({\n mintsWithOwner: mintKeys.map((mint, idx) => ({\n mint,\n owner: mintAccountInfos[idx].owner,\n })),\n metadataService,\n logger,\n overrideBanksMetadata,\n });\n\n const banks = new Map<string, Bank>();\n const priceInfos = new Map<string, OraclePrice>();\n const pythStakedCollateralBanks: PublicKey[] = [];\n const tokensData = new Map<string, MintData>();\n\n const stakedCollatMap: Record<\n string,\n {\n bankAddress: PublicKey;\n mint: PublicKey;\n stakePoolAddress: PublicKey;\n poolAddress: PublicKey;\n }\n > = {};\n const solPools: string[] = [];\n const mints: string[] = [];\n\n banksRawData.forEach(({ address, data }, index) => {\n const bankAddressStr = address.toBase58();\n const metadata = banksExtendedMetadata.get(data.mint.toBase58());\n\n const mintDataRaw = mintAccountInfos[index];\n if (!mintDataRaw) {\n throw new Error(`Failed to fetch mint account for bank ${bankAddressStr}`);\n }\n\n const priceDataRaw = oracleAccountInfos[index];\n if (!priceDataRaw) {\n throw new Error(`Failed to fetch price oracle account for bank ${bankAddressStr}`);\n }\n\n const bank = Bank.fromAccountParsed(address, data, feedIdMap, metadata, mintDataRaw.owner);\n banks.set(bankAddressStr, bank);\n\n let emissionTokenProgram: PublicKey | null = null;\n if (!data.emissionsMint.equals(PublicKey.default)) {\n const emissionMintDataRawIndex = emissionMintKeys.findIndex((pk) => pk.equals(data.emissionsMint));\n emissionTokenProgram =\n emissionMintDataRawIndex >= 0 ? emissionMintAccountInfos[emissionMintDataRawIndex].owner : null;\n }\n\n tokensData.set(bankAddressStr, {\n mint: mintKeys[index],\n tokenProgram: mintDataRaw.owner,\n feeBps: 0,\n emissionTokenProgram,\n });\n\n const oracleSetup = parseOracleSetup(data.config.oracleSetup);\n priceInfos.set(bankAddressStr, parsePriceInfo(oracleSetup, priceDataRaw.data, logger));\n\n if (oracleSetup === OracleSetup.StakedWithPythPush && metadata?.validatorVoteAccount) {\n const [poolAddress] = PublicKey.findProgramAddressSync(\n [Buffer.from(\"pool\"), new PublicKey(metadata.validatorVoteAccount).toBuffer()],\n SINGLE_POOL_PROGRAM_ID,\n );\n const [stakePoolAddress] = PublicKey.findProgramAddressSync(\n [Buffer.from(\"stake\"), poolAddress.toBuffer()],\n SINGLE_POOL_PROGRAM_ID,\n );\n\n stakedCollatMap[address.toBase58()] = {\n bankAddress: address,\n mint: new PublicKey(metadata.mint),\n stakePoolAddress,\n poolAddress,\n };\n solPools.push(stakePoolAddress.toBase58());\n mints.push(metadata.mint);\n }\n });\n\n const dataAis = await chunkedGetRawMultipleAccountInfoOrdered(program.provider.connection, [...mints, ...solPools]);\n const stakePoolsAis: StakeAccount[] = dataAis.slice(mints.length).map((ai) => getStakeAccount(ai.data));\n const lstMintsAis: RawMint[] = dataAis.slice(0, mints.length).map((mintAi) => MintLayout.decode(mintAi.data));\n\n const lstMintRecord: Record<string, RawMint> = Object.fromEntries(mints.map((mint, i) => [mint, lstMintsAis[i]]));\n const solPoolsRecord: Record<string, StakeAccount> = Object.fromEntries(\n solPools.map((poolKey, i) => [poolKey, stakePoolsAis[i]]),\n );\n\n for (const index in stakedCollatMap) {\n const { bankAddress, mint, stakePoolAddress, poolAddress } = stakedCollatMap[index];\n const stakeAccount = solPoolsRecord[stakePoolAddress.toBase58()];\n const tokenSupply = lstMintRecord[mint.toBase58()].supply;\n\n const stakeActual = Number(stakeAccount.stake.delegation.stake);\n\n const oracle = priceInfos.get(bankAddress.toBase58());\n if (oracle) {\n const adjustPrice = (price: BigNumber, stakeActual: number, tokenSupply: bigint) => {\n return Number(tokenSupply) === 0\n ? price\n : new BigNumber((price.toNumber() * (stakeActual - LAMPORTS_PER_SOL)) / Number(tokenSupply));\n };\n\n const adjustPriceComponent = (priceComponent: any, stakeActual: number, tokenSupply: bigint) => ({\n price: adjustPrice(priceComponent.price, stakeActual, tokenSupply),\n confidence: priceComponent.confidence,\n lowestPrice: adjustPrice(priceComponent.lowestPrice, stakeActual, tokenSupply),\n highestPrice: adjustPrice(priceComponent.highestPrice, stakeActual, tokenSupply),\n });\n\n const oraclePrice = {\n timestamp: oracle.timestamp,\n priceRealtime: adjustPriceComponent(oracle.priceRealtime, stakeActual, tokenSupply),\n priceWeighted: adjustPriceComponent(oracle.priceWeighted, stakeActual, tokenSupply),\n };\n\n priceInfos.set(bankAddress.toBase58(), oraclePrice);\n }\n }\n\n logger.debug(\n {\n banksSize: banks.size,\n priceFeedsSize: priceInfos.size,\n },\n \"[lendr:client] Fetched banks and price feeds\",\n );\n\n return {\n lendrGroup,\n banks,\n priceInfos,\n tokensData,\n feedIdMap,\n banksExtendedMetadata,\n };\n };\n\n\tprivate static fetchRawBanks = async ({\n groupAddress,\n bankAddresses,\n program,\n logger = new NoopLogger(),\n commitment,\n }: {\n groupAddress: PublicKey;\n program: LendrProgram;\n bankAddresses?: Array<PublicKey>;\n logger?: TLogger;\n commitment?: Commitment;\n }) => {\n if (!bankAddresses || bankAddresses.length === 0) {\n const bankAccountsData = await program.account.bank.all([\n { memcmp: { offset: 8 + 32 + 1, bytes: groupAddress.toBase58() } },\n ]);\n return bankAccountsData.map((account) => ({\n address: account.publicKey,\n data: account.account as BankRaw,\n }));\n }\n\n logger.debug(\n { banksLength: bankAddresses.length },\n \"[lending:client] Using preloaded bank addresses, skipping gpa call\",\n );\n\n const bankAccountsData = await program.account.bank.fetchMultiple(bankAddresses, commitment);\n\n const banksRawData: Array<{ address: PublicKey; data: BankRaw }> = [];\n for (let i = 0; i < bankAccountsData.length; i++) {\n if (bankAccountsData[i] === null) {\n continue;\n }\n\n banksRawData.push({\n address: bankAddresses[i],\n data: bankAccountsData[i] as unknown as BankRaw,\n });\n }\n\n return banksRawData;\n };\n\n async reload() {\n const { lendrGroup, banks, priceInfos, tokensData, feedIdMap, banksExtendedMetadata } = await LendrClient.fetchGroupData({\n connection: this.program.provider.connection,\n program: this.program,\n groupAddress: this.config.groupPk,\n logger: this.logger,\n commitment: this.program.provider.connection.commitment,\n overrideBankAddresses: this.overrideBankAddresses,\n overrideBanksMetadata: this.overrideBanksMetadata,\n metadataService: this.metadataService,\n });\n\n this.group = lendrGroup;\n this.banks = banks;\n this.oraclePrices = priceInfos;\n this.feedIdMap = feedIdMap;\n this.mintDatas = tokensData;\n this.bankMetadataMap = Array.from(banksExtendedMetadata.values()).reduce((prev, curr) => {\n if (!curr.address) {\n return prev;\n }\n\n prev[curr.address] = {\n tokenAddress: curr.address,\n tokenName: curr.name,\n tokenSymbol: curr.symbol,\n }\n return prev\n }, {} as BankMetadataMap);\n }\n\n // --------------------------------------------------------------------------\n // Attributes\n // --------------------------------------------------------------------------\n\n get groupAddress(): PublicKey {\n return this.config.groupPk;\n }\n\n get provider(): AnchorProvider {\n return this.program.provider as AnchorProvider;\n }\n\n get programId(): PublicKey {\n return this.program.programId;\n }\n\n async getAllLendrAccountPubkeys(): Promise<PublicKey[]> {\n return (\n await this.provider.connection.getProgramAccounts(this.programId, {\n filters: [\n {\n memcmp: {\n bytes: this.config.groupPk.toBase58(),\n offset: 8, // lendrGroup is the first field in the account, so only offset is the discriminant\n },\n },\n ],\n dataSlice: { offset: 0, length: 0 },\n })\n ).map((a) => a.pubkey);\n }\n\n /**\n * Fetches multiple lendr accounts based on an array of public keys using the getMultipleAccounts RPC call.\n *\n * @param pubkeys - The public keys of the lendr accounts to fetch.\n * @returns An array of LendrAccountWrapper instances.\n */\n async getMultipleLendrAccounts(pubkeys: PublicKey[]): Promise<LendrAccountWrapper[]> {\n this.logger.debug({ pubkeys }, \"Fetching lendr accounts\");\n\n const accounts = await this.program.account.lendrAccount.fetchMultiple(pubkeys);\n\n return accounts.map((account, index) => {\n if (!accounts) {\n throw new Error(`Account not found for pubkey: ${pubkeys[index].toBase58()}`);\n }\n return LendrAccountWrapper.fromAccountParsed(pubkeys[index], this, account as unknown as LendrAccountRaw);\n });\n }\n\n /**\n * Retrieves the addresses of all lendr accounts in the underlying group.\n *\n * @returns Account addresses\n */\n async getAllLendrAccountAddresses(): Promise<PublicKey[]> {\n return (\n await this.program.provider.connection.getProgramAccounts(this.programId, {\n commitment: this.program.provider.connection.commitment,\n dataSlice: {\n offset: 0,\n length: 0,\n },\n filters: [\n {\n memcmp: {\n bytes: this.groupAddress.toBase58(),\n offset: 8, // lendrGroup is the second field in the account after the authority, so offset by the discriminant and a pubkey\n },\n },\n {\n memcmp: {\n offset: 0,\n bytes: bs58.encode(\n new BorshAccountsCoder(this.program.idl).accountDiscriminator(AccountType.LendrAccount),\n ),\n },\n },\n ],\n })\n ).map((a) => a.pubkey);\n }\n\n /**\n * Retrieves all lendr accounts under the specified authority.\n *\n * @returns LendrAccount instances\n */\n async getLendrAccountsForAuthority(authority?: Address): Promise<LendrAccountWrapper[]> {\n const _authority = authority ? translateAddress(authority) : this.provider.wallet.publicKey;\n\n const lendrAccounts = (\n await this.program.account.lendrAccount.all([\n {\n memcmp: {\n bytes: this.groupAddress.toBase58(),\n offset: 8, // lendrGroup is the first field in the account, so only offset is the discriminant\n },\n },\n {\n memcmp: {\n bytes: _authority.toBase58(),\n offset: 8 + 32, // authority is the second field in the account after the authority, so offset by the discriminant and a pubkey\n },\n },\n ])\n ).map((a) => LendrAccountWrapper.fromAccountParsed(a.publicKey, this, a.account as unknown as LendrAccountRaw));\n\n lendrAccounts.sort((accountA, accountB) => {\n const assetsValueA = accountA.computeHealthComponents(LendrRequirementType.Equity).assets;\n const assetsValueB = accountB.computeHealthComponents(LendrRequirementType.Equity).assets;\n\n if (assetsValueA.eq(assetsValueB)) return 0;\n return assetsValueA.gt(assetsValueB) ? -1 : 1;\n });\n\n return lendrAccounts;\n }\n\n /**\n * Retrieves the addresses of all accounts owned by the lendr program.\n *\n * @returns Account addresses\n */\n async getAllProgramAccountAddresses(type: AccountType): Promise<PublicKey[]> {\n return (\n await this.program.provider.connection.getProgramAccounts(this.programId, {\n commitment: this.program.provider.connection.commitment,\n dataSlice: {\n offset: 0,\n length: 0,\n },\n filters: [\n {\n memcmp: {\n offset: 0,\n bytes: bs58.encode(\n new BorshAccountsCoder(this.program.idl).accountDiscriminator(AccountType.LendrAccount),\n ),\n },\n },\n ],\n })\n ).map((a) => a.pubkey);\n }\n\n getBankByPk(bankAddress: Address): Bank | null {\n const _bankAddress = translateAddress(bankAddress);\n return this.banks.get(_bankAddress.toString()) ?? null;\n }\n\n getBankByMint(mint: Address): Bank | null {\n const _mint = translateAddress(mint);\n return [...this.banks.values()].find((bank) => bank.mint.equals(_mint)) ?? null;\n }\n\n getBankByTokenSymbol(tokenSymbol: string): Bank | null {\n if (tokenSymbol === undefined) return null;\n return [...this.banks.values()].find((bank) => bank.tokenSymbol === tokenSymbol) ?? null;\n }\n\n getOraclePriceByBank(bankAddress: Address): OraclePrice | null {\n const _bankAddress = translateAddress(bankAddress);\n return this.oraclePrices.get(_bankAddress.toString()) ?? null;\n }\n // --------------------------------------------------------------------------\n // User actions\n // --------------------------------------------------------------------------\n\n /**\n * Create transaction instruction to create a new lendr account under the authority of the user.\n *\n * @returns transaction instruction\n */\n async makeCreateLendrAccountIx(lendrAccountPk: PublicKey): Promise<InstructionsWrapper> {\n this.logger.debug({ for: lendrAccountPk.toBase58() }, \"Generating lendr account ix\");\n\n const initLendrAccountIx = await instructions.makeInitLendrAccountIx(this.program, {\n lendrGroup: this.groupAddress,\n lendrAccount: lendrAccountPk,\n authority: this.provider.wallet.publicKey,\n feePayer: this.provider.wallet.publicKey,\n });\n\n const ixs = [initLendrAccountIx];\n\n return {\n instructions: ixs,\n keys: [],\n };\n }\n\n async makeCreateLendrAccountWithSessionIx(session: EstablishedSessionState, accountSeed: BN): Promise<InstructionsWrapper> {\n this.logger.debug({ for: session.walletPublicKey.toBase58() }, \"Generating lendr account init with session ix\");\n const initLendrAccountIx = await instructions.makeInitLendrAccountWithSessionIx(this.program, {\n lendrGroup: this.groupAddress,\n session: session,\n feePayer: session.payer,\n }, accountSeed);\n\n const ixs = [initLendrAccountIx];\n\n return {\n instructions: ixs,\n keys: [],\n };\n }\n\n /**\n * Create a new lendr account under the authority of the user.\n *\n * @param createOpts - Options for creating the account\n * @param createOpts.newAccountKey - Optional public key to use for the new account. If not provided, a new keypair will be generated.\n * @param processOpts - Options for processing the transaction\n * @param txOpts - Transaction options\n * @returns Object containing the transaction signature and the created LendrAccount instance\n */\n async createLendrAccount(\n createOpts?: { newAccountKey?: PublicKey | undefined },\n processOpts?: ProcessTransactionsClientOpts,\n txOpts?: TransactionOptions,\n ): Promise<LendrAccountWrapper> {\n const accountKeypair = Keypair.generate();\n const newAccountKey = createOpts?.newAccountKey ?? accountKeypair.publicKey;\n\n const solanaTx = await this.createLendrAccountTx({ accountKeypair });\n const sig = await this.processTransaction(solanaTx, processOpts, txOpts);\n\n this.logger.debug({ sig }, \"Created Lendr account\");\n\n return txOpts?.dryRun || createOpts?.newAccountKey\n ? Promise.resolve(undefined as unknown as LendrAccountWrapper)\n : LendrAccountWrapper.fetch(newAccountKey, this, txOpts?.commitment);\n }\n\n /**\n * Create a new lendr account under the authority of the user using fogo session.\n *\n * @param session - Session object in Established state\n * @param commitment - desired commitment level\n * @param customAccountSeed - undefined/null/0 for canonical lendr account in a group; positive for multi-accounts.\n *\n * @returns Object containing the transaction signature and the created LendrAccount instance\n */\n async createLendrAccountWithSession(\n session: EstablishedSessionState,\n commitment?: Commitment,\n customAccountSeed?: number | bigint,\n ) {\n const accountSeed = new BN(customAccountSeed ?? 0);\n const tx = await this.createLendrAccountWithSessionTx(session, new BN(accountSeed ?? 0));\n const txResult = await session.sendTransaction(tx);\n this.logger.debug({ txResult }, \"Created Lendr account (using session)\");\n const [accountPublicKey] = PublicKey.findProgramAddressSync(\n [\n Buffer.from(\"pyroners\"),\n session.walletPublicKey.toBuffer(),\n this.groupAddress.toBuffer(),\n accountSeed.toArrayLike(Buffer, 'le', 8)\n ],\n this.programId\n );\n try {\n return {\n account: await LendrAccountWrapper.fetch(accountPublicKey, this, commitment),\n accountPublicKey,\n result: txResult,\n }\n } catch(ex) {\n this.logger?.error({ tx: txResult?.signature }, \"Failed fetching created account.\");\n }\n\n return {\n result: txResult,\n accountPublicKey,\n account: null\n };\n }\n\n /**\n * Create a transaction to initialize a new lendr account under the authority of the user.\n *\n * @param createOpts - Options for creating the account\n * @param createOpts.newAccountKey - Optional public key to use for the new account. If not provided, a new keypair will be generated.\n * @returns Transaction that can be used to create a new lendr account\n */\n async createLendrAccountTx(createOpts?: { accountKeypair?: Keypair }): Promise<SolanaTransaction> {\n const accountKeypair = createOpts?.accountKeypair ?? Keypair.generate();\n\n const ixs = await this.makeCreateLendrAccountIx(accountKeypair.publicKey);\n const signers = [...ixs.keys];\n // If there was no newAccountKey provided, we need to sign with the ephemeral Keypair we generated.\n signers.push(accountKeypair);\n\n const tx = new Transaction().add(...ixs.instructions);\n const solanaTx = addTransactionMetadata(tx, {\n signers,\n addressLookupTables: this.addressLookupTables,\n type: TransactionType.CREATE_ACCOUNT,\n });\n\n return solanaTx;\n }\n\n async getLatestBlockHashForSure() {\n try {\n return (await this.provider.connection.getLatestBlockhashAndContext(\"confirmed\")).value.blockhash;\n } catch (ex) {\n const connection = new Connection(this.provider.connection.rpcEndpoint, this.provider.opts);\n return (await connection.getLatestBlockhashAndContext(\"confirmed\")).value.blockhash;\n }\n }\n\n async createVersionTransaction(\n instructions: TransactionInstruction[],\n payerKey: PublicKey,\n signers?: Array<Signer>,\n extraMetaData?: ExtendedTransactionProperties,\n ) {\n const blockhash = await this.getLatestBlockHashForSure();\n\n const versionedMessage = new TransactionMessage({\n instructions,\n payerKey,\n recentBlockhash: blockhash,\n });\n\n const tx = new VersionedTransaction(\n this.addressLookupTables\n ? versionedMessage.compileToV0Message(this.addressLookupTables)\n : versionedMessage.compileToLegacyMessage()\n );\n\n if (signers?.length){\n tx.sign(signers);\n }\n\n if(extraMetaData && Object.keys(extraMetaData)?.length) {\n return addTransactionMetadata(tx, extraMetaData);\n }\n\n return tx;\n }\n\n async createLendrAccountWithSessionTx(session: EstablishedSessionState, accountSeed: BN) {\n const ixs = await this.makeCreateLendrAccountWithSessionIx(session, accountSeed);\n\n return this.createVersionTransaction(ixs.instructions, session.payer, [...ixs.keys], {\n type: TransactionType.CREATE_ACCOUNT,\n });\n }\n\n /**\n * Create transaction instruction to initialize a new group.\n *\n * @returns transaction instruction\n */\n async makeCreateLendrGroupIx(lendrGroup: PublicKey): Promise<InstructionsWrapper> {\n this.logger.debug({ lendrGroup: lendrGroup.toBase58() }, \"Generating group init ix\");\n\n const initGroupIx = await instructions.makeGroupInitIx(this.program, {\n lendrGroup: lendrGroup,\n admin: this.provider.wallet.publicKey,\n });\n\n const ixs = [initGroupIx];\n\n return {\n instructions: ixs,\n keys: [],\n };\n }\n\n /**\n * Initiates a new permissionless lendr bank under the authority of the user.\n *\n * @param {Object} params - The parameters for creating a permissionless bank.\n * @param {PublicKey} params.mint - The public key of the mint for the bank.\n * @param {BankConfigOpt} params.bankConfig - The configuration options for the bank.\n * @param {PublicKey} params.group - The public key of the group to which the bank belongs.\n * @param {PublicKey} params.admin - The public key of the admin who will have authority over the bank.\n * @param {Keypair} [params.seed] - An optional keypair used as a seed for generating the bank account.\n * @param {TransactionOptions} [params.txOpts] - Optional transaction options for processing.\n * @param {ProcessTransactionsClientOpts} [params.processOpts] - Optional processing options for transactions.\n * @returns {Promise<TransactionSignature>} A promise that resolves to the transaction signature as a string.\n */\n async createPermissionlessBank({\n mint,\n bankConfig,\n group,\n admin,\n seed,\n txOpts,\n processOpts,\n }: {\n mint: PublicKey;\n bankConfig: BankConfigOpt;\n group: PublicKey;\n admin: PublicKey;\n seed?: Keypair;\n processOpts?: ProcessTransactionsClientOpts;\n txOpts?: TransactionOptions;\n }): Promise<TransactionSignature> {\n const keypair = seed ?? Keypair.generate();\n const bankIxs = await this.group.makePoolAddBankIx(this.program, keypair.publicKey, mint, bankConfig, admin);\n\n const signers = [...bankIxs.keys, keypair];\n\n const tx = new Transaction().add(...bankIxs.instructions);\n\n const solanaTx = addTransactionMetadata(tx, {\n signers,\n addressLookupTables: this.addressLookupTables,\n type: TransactionType.CREATE_PERM_BANK,\n });\n const sig = await this.processTransaction(solanaTx, processOpts, txOpts);\n this.logger.debug({ sig }, \"Created Lendr group\");\n\n return sig;\n }\n\n /**\n * Initializes a new lendr group with the specified parameters.\n *\n * @param seed - Optional keypair used for generating the group account.\n * @param additionalIxs - Optional array of additional transaction instructions to include.\n * @param txOpts - Optional transaction options for processing.\n * @param processOpts - Optional processing options for transactions.\n * @returns The public key of the newly created lendr group.\n */\n async createLendrGroup(\n seed?: Keypair,\n additionalIxs?: TransactionInstruction[],\n processOpts?: ProcessTransactionsClientOpts,\n txOpts?: TransactionOptions,\n ): Promise<PublicKey> {\n const accountKeypair = seed ?? Keypair.generate();\n\n const ixs = await this.makeCreateLendrGroupIx(accountKeypair.publicKey);\n const signers = [...ixs.keys, accountKeypair];\n const tx = new Transaction().add(...ixs.instructions, ...(additionalIxs ?? []));\n const solanaTx = addTransactionMetadata(tx, {\n signers,\n addressLookupTables: this.addressLookupTables,\n type: TransactionType.CREATE_GROUP,\n });\n const sig = await this.processTransaction(solanaTx, processOpts, txOpts);\n this.logger.debug({ sig }, \"Created Lendr group\");\n\n return Promise.resolve(accountKeypair.publicKey);\n }\n\n /**\n * Create a new bank under the authority of the user.\n *\n * @param bankMint - The public key of the token mint for the bank.\n * @param bankConfig - Configuration options for the bank.\n * @param seed - Optional keypair for the bank.\n * @param txOpts - Optional transaction options for processing.\n * @param processOpts - Optional processing options for transactions.\n * @returns The bank's public key and the transaction signature\n */\n async createLendingPool(\n bankMint: PublicKey,\n bankConfig: BankConfigOpt,\n seed?: Keypair,\n processOpts?: ProcessTransactionsClientOpts,\n txOpts?: TransactionOptions,\n ): Promise<{ bankAddress: PublicKey; signature: TransactionSignature }> {\n const bankKeypair = seed ?? Keypair.generate();\n\n const ixs = await this.group.makePoolAddBankIx(this.program, bankKeypair.publicKey, bankMint, bankConfig);\n const signers = [...ixs.keys, bankKeypair];\n const tx = new Transaction().add(...ixs.instructions);\n\n const solanaTx = addTransactionMetadata(tx, {\n signers,\n addressLookupTables: this.addressLookupTables,\n type: TransactionType.CREATE_PERM_BANK,\n });\n const sig = await this.processTransaction(solanaTx, processOpts, txOpts);\n this.logger.debug({ sig }, \"Created new lending pool\");\n\n return Promise.resolve({\n bankAddress: bankKeypair.publicKey,\n signature: sig,\n });\n }\n\n // --------------------------------------------------------------------------\n // Helpers\n // --------------------------------------------------------------------------\n\n /**\n * Processes multiple Solana transactions by signing and sending them to the network.\n *\n * @param {SolanaTransaction[]} transactions - An array of transactions to be processed.\n * @param {ProcessTransactionsClientOpts} [processOpts] - Optional processing options for transactions.\n * @param {TransactionOptions} [txOpts] - Optional transaction options for processing.\n *\n * @returns {Promise<TransactionSignature[]>} - A promise that resolves to an array of transaction signatures.\n *\n * @throws {ProcessTransactionError} - Throws an error if transaction processing fails.\n */\n async processTransactions(\n transactions: SolanaTransaction[],\n processOpts?: ProcessTransactionsClientOpts,\n txOpts?: TransactionOptions,\n ): Promise<TransactionSignature[]> {\n const options: ProcessTransactionOpts = {\n ...processOpts,\n isReadOnly: this.isReadOnly,\n programId: this.program.programId,\n bundleSimRpcEndpoint: this.bundleSimRpcEndpoint,\n dynamicStrategy: processOpts?.dynamicStrategy ?? this.processTransactionStrategy,\n };\n\n console.log(\"processOpts\", processOpts);\n console.log(\"processTransactions\", options);\n\n return await processTransactions({\n transactions,\n connection: this.provider.connection,\n wallet: this.provider.wallet,\n processOpts: options,\n txOpts,\n });\n }\n\n /**\n * Processes a single Solana transaction by signing and sending it to the network.\n *\n * @param {SolanaTransaction} transaction - The transaction to be processed.\n * @param {TransactionOptions} [txOpts] - Optional transaction options.\n * @param {ProcessTransactionsClientOpts} [processOpts] - Optional processing options.\n *\n * @returns {Promise<TransactionSignature>} - A promise that resolves to the transaction signature.\n *\n * @throws {ProcessTransactionError} - Throws an error if transaction processing fails.\n */\n async processTransaction(\n transaction: SolanaTransaction,\n processOpts?: ProcessTransactionsClientOpts,\n txOpts?: TransactionOptions,\n ): Promise<TransactionSignature> {\n transaction.addressLookupTables = transaction.addressLookupTables || this.addressLookupTables;\n\n const options: ProcessTransactionOpts = {\n ...processOpts,\n isReadOnly: this.isReadOnly,\n programId: this.program.programId,\n bundleSimRpcEndpoint: this.bundleSimRpcEndpoint,\n dynamicStrategy: processOpts?.dynamicStrategy ?? this.processTransactionStrategy,\n };\n\n const [signature] = await processTransactions({\n transactions: [transaction],\n connection: this.provider.connection,\n wallet: this.provider.wallet,\n processOpts: options,\n txOpts,\n });\n\n return signature;\n }\n\n async simulateTransactions(\n transactions: (Transaction | VersionedTransaction)[],\n accountsToInspect: PublicKey[],\n ): Promise<(Buffer | null)[]> {\n const versionedTransactions: VersionedTransaction[] = [];\n const connection = new Connection(this.provider.connection.rpcEndpoint, this.provider.opts);\n let blockhash: string;\n\n try {\n const getLatestBlockhashAndContext = await connection.getLatestBlockhashAndContext(\"confirmed\");\n blockhash = getLatestBlockhashAndContext.value.blockhash;\n\n for (const transaction of transactions) {\n if (isV0Tx(transaction)) {\n versionedTransactions.push(transaction);\n } else {\n const versionedMessage = new TransactionMessage({\n instructions: transaction.instructions,\n payerKey: this.provider.publicKey,\n recentBlockhash: blockhash,\n });\n\n versionedTransactions.push(\n new VersionedTransaction(versionedMessage.compileToV0Message(this.addressLookupTables)),\n );\n }\n }\n } catch (error: any) {\n throw new ProcessTransactionError({\n message: error.message,\n type: ProcessTransactionErrorType.TransactionBuildingError,\n\t _error: error\n });\n }\n\n try {\n if (transactions.length === 1) {\n const response = await connection.simulateTransaction(versionedTransactions[0], {\n sigVerify: false,\n accounts: {\n encoding: \"base64\",\n addresses: accountsToInspect.map((a) => a.toBase58()),\n },\n });\n if (response.value.err) {\n const error = response.value.err;\n const parsedError = parseTransactionError(error, this.config.programId);\n throw new ProcessTransactionError({\n message: parsedError.description ?? JSON.stringify(response.value.err),\n type: ProcessTransactionErrorType.SimulationError,\n logs: response.value.logs ?? [],\n programId: parsedError.programId,\n });\n }\n return response.value.accounts?.map((a) => (a ? Buffer.from(a.data[0], \"base64\") : null)) ?? [];\n } else {\n const simulationResult = await simulateBundle(\n this.bundleSimRpcEndpoint,\n versionedTransactions,\n accountsToInspect,\n );\n const value = simulationResult[simulationResult.length - 1];\n\n const accounts = value.postExecutionAccounts;\n return accounts?.map((a: any) => (a ? Buffer.from(a.data[0], \"base64\") : null)) ?? [];\n }\n } catch (error: any) {\n if (error instanceof ProcessTransactionError) throw error;\n\n const parsedError = parseTransactionError(error, this.config.programId);\n\n if (error instanceof BundleSimulationError) {\n throw new ProcessTransactionError({\n message: parsedError.description,\n type: ProcessTransactionErrorType.SimulationError,\n logs: error.logs,\n programId: parsedError.programId,\n\t _error: error\n });\n }\n\n if (error?.logs?.length > 0) {\n console.log(\"------ Logs 👇 ------\");\n console.log(error.logs.join(\"\\n\"));\n if (parsedError) {\n console.log(\"Parsed:\", parsedError);\n throw new ProcessTransactionError({\n message: parsedError.description,\n type: ProcessTransactionErrorType.SimulationError,\n logs: error.logs,\n programId: parsedError.programId,\n\t _error: error\n });\n }\n }\n\n console.log(\"fallthrough error\", error);\n throw new ProcessTransactionError({\n message: parsedError?.description ?? \"Something went wrong\",\n type: ProcessTransactionErrorType.FallthroughError,\n logs: error.logs,\n programId: parsedError.programId,\n\t _error: error\n });\n }\n }\n}\n\nexport default LendrClient;\n"],"mappings":";;;;;;;;;;;;;;;;;AAQA,eAAe,uBACbA,WACAC,YAMA;AACA,QAAO,UAAU,QAAQ,wBAAwB,CAAC,SAASC,WAAS,CAAC,aAAa;AACnF;AAED,eAAe,kCACbF,WACA,EAAE,YAAY,SAAS,UAItB,EACDG,aACA;AACA,QAAO,UAAU,QACd,kCAAkC,QAAQ,iBAAiB,YAAY,CACvE,SAAS;EAAE;EAAY,YAAY,QAAQ;EAAkB;CAAU,EAAC,CACxE,aAAa;AACjB;AAED,eAAe,cACbH,WACAI,YAWAC,MAIAC,oBAAmC,CAAE,GACrC;CACA,MAAM,EAAE,cAAc,oBAAoB,MAAM,aAAc,GAAG,kBAAkB,GAAGJ;AAEtF,QAAO,UAAU,QACd,sBAAsB,KAAK,QAAQ,KAAK,oBAAoB,KAAK,CACjE,SAAS;EACR;EACA;EACA;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,CAAC;CACE;AACF;;;;ACMD,MAAaE,uBAAuC;CAClD,SAAS;CACT,UAAU;EACR,MAAM;EACN,SAAS;EACT,MAAM;CACP;CACD,cAAc,CACZ;EACE,MAAM;EACN,eAAe;GAAC;GAAI;GAAG;GAAI;GAAK;GAAI;GAAK;GAAK;EAAI;EAClD,UAAU;GACR;IACE,MAAM;IACN,UAAU;IACV,QAAQ;GACT;GACD,EACE,MAAM,qBACP;GACD,EACE,MAAM,aACP;GACD,EACE,MAAM,SACP;GACD;IACE,MAAM;IACN,UAAU;GACX;GACD;IACE,MAAM;IACN,UAAU;GACX;GACD,EACE,MAAM,gBACP;EACF;EACD,MAAM;GACJ;IACE,MAAM;IACN,MAAM,EACJ,SAAS,EACP,MAAM,mBACP,EACF;GACF;GACD;IACE,MAAM;IACN,MAAM;GACP;GACD;IACE,MAAM;IACN,MAAM,EACJ,OAAO,CAAC,MAAM,EAAG,EAClB;GACF;EACF;CACF,CACF;CACD,QAAQ,CACN;EACE,MAAM;EACN,MAAM;EACN,KAAK;CACN,GACD;EACE,MAAM;EACN,MAAM;EACN,KAAK;CACN,CACF;CACD,OAAO,CACL;EACE,MAAM;EACN,MAAM;GACJ,MAAM;GACN,QAAQ,CACN;IACE,MAAM;IACN,MAAM,EACJ,SAAS,EACP,MAAM,oBACP,EACF;GACF,GACD;IACE,MAAM;IACN,MAAM;GACP,CACF;EACF;CACF,GACD;EACE,MAAM;EACN,MAAM;GACJ,MAAM;GACN,QAAQ,CACN;IACE,MAAM;IACN,MAAM;GACP,GACD;IACE,MAAM;IACN,MAAM,EACJ,KAAK,EACH,OAAO,CAAC,MAAM,EAAG,EAClB,EACF;GACF,CACF;EACF;CACF,CACF;AACF;;;;ACk2CD,MAAaC,oBAA8C;CACzD,SAAS;CACT,UAAU;EACR,MAAM;EACN,SAAS;EACT,MAAM;CACP;CACD,cAAc;EACZ;GACE,MAAM;GACN,MAAM;IACJ;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAC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;KACN,MAAM,CACJ,8FACA,iCACD;KACD,UAAU;KACV,QAAQ;IACT;IACD;KACE,MAAM;KACN,MAAM;MACJ;MACA;MACA;MACA;MACA;MACA;MACA;MACA;KACD;IACF;IACD;KACE,MAAM;KACN,UAAU;IACX;IACD,EACE,MAAM,gBACP;GACF;GACD,MAAM,CAAE;EACT;EACD;GACE,MAAM;GACN,MAAM,CACJ,2FACA,6DACD;GACD,eAAe;IAAC;IAAI;IAAK;IAAK;IAAK;IAAK;IAAK;IAAK;GAAI;GACtD,UAAU;IACR;KACE,MAAM;KACN,UAAU;KACV,QAAQ;IACT;IACD;KACE,MAAM;KACN,MAAM,CAAC,aAAc;IACtB;IACD;KACE,MAAM;KACN,MAAM;MACJ;MACA;MACA;KACD;KACD,UAAU;IACX;GACF;GACD,MAAM,CAAE;EACT;CACF;CACD,UAAU;EACR;GACE,MAAM;GACN,eAAe;IAAC;IAAI;IAAI;IAAI;IAAK;IAAK;IAAI;IAAK;GAAG;EACnD;EACD;GACE,MAAM;GACN,eAAe;IAAC;IAAK;IAAK;IAAK;IAAG;IAAK;IAAK;IAAK;GAAI;EACtD;EACD;GACE,MAAM;GACN,eAAe;IAAC;IAAI;IAAK;IAAI;IAAI;IAAI;IAAK;IAAK;GAAI;EACpD;CACF;CACD,QAAQ;EACN;GACE,MAAM;GACN,MAAM;GACN,KAAK;EACN;EACD;GACE,MAAM;GACN,MAAM;GACN,KAAK;EACN;EACD;GACE,MAAM;GACN,MAAM;GACN,KAAK;EACN;EACD;GACE,MAAM;GACN,MAAM;GACN,KAAK;EACN;EACD;GACE,MAAM;GACN,MAAM;GACN,KAAK;EACN;EACD;GACE,MAAM;GACN,MAAM;GACN,KAAK;EACN;EACD;GACE,MAAM;GACN,MAAM;GACN,KAAK;EACN;EACD;GACE,MAAM;GACN,MAAM;GACN,KAAK;EACN;EACD;GACE,MAAM;GACN,MAAM;GACN,KAAK;EACN;EACD;GACE,MAAM;GACN,MAAM;GACN,KAAK;EACN;EACD;GACE,MAAM;GACN,MAAM;GACN,KAAK;EACN;EACD;GACE,MAAM;GACN,MAAM;GACN,KAAK;EACN;EACD;GACE,MAAM;GACN,MAAM;GACN,KAAK;EACN;EACD;GACE,MAAM;GACN,MAAM;GACN,KAAK;EACN;EACD;GACE,MAAM;GACN,MAAM;GACN,KAAK;EACN;EACD;GACE,MAAM;GACN,MAAM;GACN,KAAK;EACN;EACD;GACE,MAAM;GACN,MAAM;GACN,KAAK;EACN;EACD;GACE,MAAM;GACN,MAAM;GACN,KAAK;EACN;EACD;GACE,MAAM;GACN,MAAM;GACN,KAAK;EACN;EACD;GACE,MAAM;GACN,MAAM;GACN,KAAK;EACN;EACD;GACE,MAAM;GACN,MAAM;GACN,KAAK;EACN;EACD;GACE,MAAM;GACN,MAAM;GACN,KAAK;EACN;EACD;GACE,MAAM;GACN,MAAM;GACN,KAAK;EACN;EACD;GACE,MAAM;GACN,MAAM;GACN,KAAK;EACN;EACD;GACE,MAAM;GACN,MAAM;GACN,KAAK;EACN;EACD;GACE,MAAM;GACN,MAAM;GACN,KAAK;EACN;EACD;GACE,MAAM;GACN,MAAM;GACN,KAAK;EACN;EACD;GACE,MAAM;GACN,MAAM;GACN,KAAK;EACN;EACD;GACE,MAAM;GACN,MAAM;GACN,KAAK;EACN;EACD;GACE,MAAM;GACN,MAAM;GACN,KAAK;EACN;EACD;GACE,MAAM;GACN,MAAM;GACN,KAAK;EACN;EACD;GACE,MAAM;GACN,MAAM;GACN,KAAK;EACN;EACD;GACE,MAAM;GACN,MAAM;GACN,KAAK;EACN;EACD;GACE,MAAM;GACN,MAAM;GACN,KAAK;EACN;EACD;GACE,MAAM;GACN,MAAM;GACN,KAAK;EACN;EACD;GACE,MAAM;GACN,MAAM;GACN,KAAK;EACN;EACD;GACE,MAAM;GACN,MAAM;GACN,KAAK;EACN;EACD;GACE,MAAM;GACN,MAAM;GACN,KAAK;EACN;EACD;GACE,MAAM;GACN,MAAM;GACN,KAAK;EACN;EACD;GACE,MAAM;GACN,MAAM;GACN,KAAK;EACN;EACD;GACE,MAAM;GACN,MAAM;GACN,KAAK;EACN;EACD;GACE,MAAM;GACN,MAAM;GACN,KAAK;EACN;EACD;GACE,MAAM;GACN,MAAM;GACN,KAAK;EACN;EACD;GACE,MAAM;GACN,MAAM;GACN,KAAK;EACN;EACD;GACE,MAAM;GACN,MAAM;GACN,KAAK;EACN;EACD;GACE,MAAM;GACN,MAAM;GACN,KAAK;EACN;EACD;GACE,MAAM;GACN,MAAM;GACN,KAAK;EACN;EACD;GACE,MAAM;GACN,MAAM;GACN,KAAK;EACN;EACD;GACE,MAAM;GACN,MAAM;GACN,KAAK;EACN;EACD;GACE,MAAM;GACN,MAAM;GACN,KAAK;EACN;EACD;GACE,MAAM;GACN,MAAM;GACN,KAAK;EACN;EACD;GACE,MAAM;GACN,MAAM;GACN,KAAK;EACN;EACD;GACE,MAAM;GACN,MAAM;GACN,KAAK;EACN;EACD;GACE,MAAM;GACN,MAAM;GACN,KAAK;EACN;EACD;GACE,MAAM;GACN,MAAM;GACN,KAAK;EACN;EACD;GACE,MAAM;GACN,MAAM;GACN,KAAK;EACN;EACD;GACE,MAAM;GACN,MAAM;GACN,KAAK;EACN;CACF;CACD,OAAO;EACL;GACE,MAAM;GACN,MAAM,CAAC,uDAAwD;GAC/D,MAAM;IACJ,MAAM;IACN,QAAQ;KACN;MACE,MAAM;MACN,MAAM;KACP;KACD;MACE,MAAM;MACN,MAAM;KACP;KACD;MACE,MAAM;MACN,MAAM,EACJ,KAAK,EACH,OAAO,CAAC,MAAM,EAAG,EAClB,EACF;KACF;IACF;GACF;EACF;EACD;GACE,MAAM;GACN,MAAM;IACJ;IACA;IACA;GACD;GACD,MAAM;IACJ,MAAM;IACN,QAAQ;KACN;MACE,MAAM;MACN,MAAM,CAAC,6BAA8B;MACrC,MAAM;KACP;KACD;MACE,MAAM;MACN,MAAM,CAAC,kBAAmB;MAC1B,MAAM;KACP;KACD;MACE,MAAM;MACN,MAAM,CAAC,mDAAoD;MAC3D,MAAM,EACJ,SAAS,EACP,MAAM,aACP,EACF;KACF;IACF;GACF;EACF;EACD;GACE,MAAM;GACN,MAAM;IACJ;IACA;IACA;IACA;IACA;GACD;GACD,MAAM;IACJ,MAAM;IACN,QAAQ;KACN;MACE,MAAM;MACN,MAAM,CAAC,cAAe;MACtB,MAAM,EACJ,OAAO,CAAC,MAAM,CAAE,EACjB;KACF;KACD;MACE,MAAM;MACN,MAAM,CAAC,iCAAkC;MACzC,MAAM;KACP;KACD;MACE,MAAM;MACN,MAAM,CAAC,6BAA8B;MACrC,MAAM;KACP;KACD;MACE,MAAM;MACN,MAAM,CAAC,4DAA6D;MACpE,MAAM;KACP;KACD;MACE,MAAM;MACN,MAAM,CAAC,yBAA0B;MACjC,MAAM,EACJ,OAAO,CAAC,MAAM,EAAG,EAClB;KACF;KACD;MACE,MAAM;MACN,MAAM,CAAC,kCAAmC;MAC1C,MAAM;KACP;KACD;MACE,MAAM;MACN,MAAM,CAAC,gDAAiD;MACxD,MAAM;KACP;KACD;MACE,MAAM;MACN,MAAM,CAAC,kBAAmB;MAC1B,MAAM;KACP;IACF;GACF;EACF;EACD;GACE,MAAM;GACN,MAAM;IACJ;IACA;IACA;IACA;IACA;GACD;GACD,MAAM;IACJ,MAAM;IACN,QAAQ,CACN;KACE,MAAM;KACN,MAAM;MACJ;MACA;MACA;MACA;MACA;MACA;MACA;KACD;KACD,MAAM,EACJ,OAAO,CAAC,MAAM,EAAG,EAClB;IACF,CACF;GACF;EACF;EACD;GACE,MAAM;GACN,MAAM,CAAC,8DAA+D;GACtE,MAAM,EACJ,MAAM,SACP;EACF;EACD;GACE,MAAM;GACN,MAAM;IACJ;IACA;IACA;GACD;GACD,MAAM;IACJ,MAAM;IACN,QAAQ;KACN;MACE,MAAM;MACN,MAAM,CAAC,gFAAiF;MACxF,MAAM;KACP;KACD;MACE,MAAM;MACN,MAAM,CACJ,2FACA,2CACD;MACD,MAAM,EACJ,OAAO,CAAC,MAAM,CAAE,EACjB;KACF;KACD;MACE,MAAM;MACN,MAAM;OACJ;OACA;OACA;MACD;MACD,MAAM,EACJ,SAAS,EACP,MAAM,WACP,EACF;KACF;KACD;MACE,MAAM;MACN,MAAM,CAAC,4EAA6E;MACpF,MAAM;KACP;IACF;GACF;EACF;EACD;GACE,MAAM;GACN,MAAM,CAAC,wEAAyE;GAChF,MAAM;IACJ,MAAM;IACN,QAAQ,CACN;KACE,MAAM;KACN,MAAM,CAAC,6FAA8F;KACrG,MAAM;IACP,CACF;GACF;EACF;EACD;GACE,MAAM;GACN,MAAM;IACJ,MAAM;IACN,QAAQ;KACN;MACE,MAAM;MACN,MAAM,EACJ,SAAS,EACP,MAAM,wBACP,EACF;KACF;KACD;MACE,MAAM;MACN,MAAM;KACP;KACD;MACE,MAAM;MACN,MAAM,EACJ,SAAS,EACP,MAAM,cACP,EACF;KACF;IACF;GACF;EACF;EACD;GACE,MAAM;GACN,MAAM,CAAC,gEAAiE;GACxE,MAAM;IACJ,MAAM;IACN,QAAQ,CACN;KACE,MAAM;KACN,MAAM,EACJ,SAAS,EACP,MAAM,sBACP,EACF;IACF,CACF;GACF;EACF;EACD;GACE,MAAM;GACN,MAAM,CAAC,2EAA4E;GACnF,MAAM;IACJ,MAAM;IACN,QAAQ;KACN;MACE,MAAM;MACN,MAAM,CAAC,gDAAiD;MACxD,MAAM;KACP;KACD;MACE,MAAM;MACN,MAAM,CAAC,yFAAyF,SAAU;MAC1G,MAAM;KACP;KACD;MACE,MAAM;MACN,MAAM;OACJ;OACA;OACA;OACA;MACD;MACD,MAAM,EACJ,SAAS,EACP,MAAM,gBACP,EACF;KACF;KACD;MACE,MAAM;MACN,MAAM,CAAC,yBAA0B;MACjC,MAAM,EACJ,OAAO,CAAC,MAAM,CAAE,EACjB;KACF;KACD;MACE,MAAM;MACN,MAAM,CAAC,sCAAuC;MAC9C,MAAM,EACJ,SAAS,EACP,MAAM,YACP,EACF;KACF;KACD;MACE,MAAM;MACN,MAAM,CAAC,6BAA8B;MACrC,MAAM;KACP;KACD;MACE,MAAM;MACN,MAAM,CAAC,kCAAmC;MAC1C,MAAM;KACP;KACD;MACE,MAAM;MACN,MAAM;OACJ;OACA;OACA;OACA;MACD;MACD,MAAM,EACJ,SAAS,EACP,MAAM,oBACP,EACF;KACF;KACD;MACE,MAAM;MACN,MAAM,CAAC,mFAAoF;MAC3F,MAAM;KACP;IACF;GACF;EACF;EACD;GACE,MAAM;GACN,MAAM,CACJ,0FACA,+EACD;GACD,MAAM;IACJ,MAAM;IACN,QAAQ,CACN;KACE,MAAM;KACN,MAAM,CAAC,mBAAoB;KAC3B,MAAM,EACJ,SAAS,EACP,MAAM,sBACP,EACF;IACF,GACD;KACE,MAAM;KACN,MAAM,CAAC,kBAAmB;KAC1B,MAAM;IACP,CACF;GACF;EACF;EACD;GACE,MAAM;GACN,MAAM;IACJ;IACA;IACA;IACA;GACD;GACD,MAAM;IACJ,MAAM;IACN,QAAQ,CACN;KACE,MAAM;KACN,MAAM,CAAC,eAAgB;KACvB,MAAM,EACJ,SAAS,EACP,MAAM,sBACP,EACF;IACF,CACF;GACF;EACF;EACD;GACE,MAAM;GACN,MAAM,CAAC,iGAAiG,MAAO;GAC/G,MAAM;IACJ,MAAM;IACN,QAAQ;KACN;MACE,MAAM;MACN,MAAM,CAAC,gDAAiD;MACxD,MAAM;KACP;KACD;MACE,MAAM;MACN,MAAM,CAAC,iCAAkC;MACzC,MAAM,EACJ,SAAS,EACP,MAAM,YACP,EACF;KACF;KACD;MACE,MAAM;MACN,MAAM,CACJ,2FACA,yBACD;MACD,MAAM;KACP;KACD;MACE,MAAM;MACN,MAAM;OACJ;OACA;OACA;OACA;OACA;OACA;OACA;MACD;MACD,MAAM;KACP;KACD;MACE,MAAM;MACN,MAAM,CAAC,6BAA8B;MACrC,MAAM;KACP;KACD;MACE,MAAM;MACN,MAAM,CAAC,kCAAmC;MAC1C,MAAM;KACP;KACD;MACE,MAAM;MACN,MAAM,CAAC,4DAA6D;MACpE,MAAM;KACP;KACD;MACE,MAAM;MACN,MAAM,CAAC,yBAA0B;MACjC,MAAM,EACJ,OAAO,CAAC,MAAM,EAAG,EAClB;KACF;IACF;GACF;EACF;EACD;GACE,MAAM;GACN,MAAM,CAAC,uCAAwC;GAC/C,MAAM;IACJ,MAAM;IACN,QAAQ,CACN;KACE,MAAM;KACN,MAAM,CAAC,eAAgB;KACvB,MAAM,EACJ,SAAS,EACP,MAAM,kBACP,EACF;IACF,GACD;KACE,MAAM;KACN,MAAM,CAAC,kBAAmB;KAC1B,MAAM;IACP,CACF;GACF;EACF;EACD;GACE,MAAM;GACN,MAAM,CACJ,gGACA,cACD;GACD,MAAM;IACJ,MAAM;IACN,QAAQ,CACN;KACE,MAAM;KACN,MAAM,CAAC,sBAAuB;KAC9B,MAAM;IACP,GACD;KACE,MAAM;KACN,MAAM,CAAC,qEAAsE;KAC7E,MAAM;IACP,CACF;GACF;EACF;EACD;GACE,MAAM;GACN,MAAM,CACJ,4FACA,cACD;GACD,MAAM;IACJ,MAAM;IACN,QAAQ;KACN;MACE,MAAM;MACN,MAAM,CAAC,6BAA8B;MACrC,MAAM;KACP;KACD;MACE,MAAM;MACN,MAAM,CAAC,mDAAoD;MAC3D,MAAM,EACJ,SAAS,EACP,MAAM,aACP,EACF;KACF;KACD;MACE,MAAM;MACN,MAAM;OACJ;OACA;OACA;MACD;MACD,MAAM,EACJ,QAAQ,SACT;KACF;IACF;GACF;EACF;EACD;GACE,MAAM;GACN,MAAM,CACJ,8FACA,cACD;GACD,MAAM;IACJ,MAAM;IACN,QAAQ,CACN;KACE,MAAM;KACN,MAAM,CAAC,0BAA2B;KAClC,MAAM;IACP,GACD;KACE,MAAM;KACN,MAAM,CAAC,yEAA0E;KACjF,MAAM;IACP,CACF;GACF;EACF;EACD;GACE,MAAM;GACN,MAAM,CAAC,8BAA+B;GACtC,MAAM;IACJ,MAAM;IACN,QAAQ;KACN;MACE,MAAM;MACN,MAAM,CACJ,2FACA,8CACD;MACD,MAAM,EACJ,SAAS,EACP,MAAM,mBACP,EACF;KACF;KACD;MACE,MAAM;MACN,MAAM,CAAC,yDAA0D;MACjE,MAAM;KACP;KACD;MACE,MAAM;MACN,MAAM,CAAC,4EAA6E;MACpF,MAAM;KACP;IACF;GACF;EACF;EACD;GACE,MAAM;GACN,MAAM;IACJ;IACA;IACA;GACD;GACD,MAAM;IACJ,MAAM;IACN,QAAQ,CACN;KACE,MAAM;KACN,MAAM;IACP,CACF;GACF;EACF;EACD;GACE,MAAM;GACN,MAAM,CAAC,kFAAmF;GAC1F,MAAM;IACJ,MAAM;IACN,QAAQ,CACN;KACE,MAAM;KACN,MAAM;IACP,CACF;GACF;EACF;EACD;GACE,MAAM;GACN,MAAM,CAAC,yDAA0D;GACjE,MAAM;IACJ,MAAM;IACN,QAAQ,CACN;KACE,MAAM;KACN,MAAM,EACJ,OAAO,CAAC,MAAM,EAAG,EAClB;IACF,CACF;GACF;EACF;EACD;GACE,MAAM;GACN,MAAM;IACJ;IACA;IACA;GACD;GACD,MAAM;IACJ,MAAM;IACN,QAAQ,CACN;KACE,MAAM;KACN,MAAM;IACP,CACF;GACF;EACF;EACD;GACE,MAAM;GACN,MAAM;IACJ,MAAM;IACN,QAAQ;KACN;MACE,MAAM;MACN,MAAM;KACP;KACD;MACE,MAAM;MACN,MAAM,EACJ,OAAO,CAAC,MAAM,EAAG,EAClB;KACF;KACD;MACE,MAAM;MACN,MAAM;KACP;IACF;GACF;EACF;EACD;GACE,MAAM;GACN,MAAM;IACJ;IACA;IACA;IACA;IACA;GACD;GACD,MAAM;IACJ,MAAM;IACN,UAAU;KACR,EACE,MAAM,aACP;KACD,EACE,MAAM,cACP;KACD,EACE,MAAM,UACP;KACD,EACE,MAAM,gBACP;KACD,EACE,MAAM,eACP;KACD,EACE,MAAM,kBACP;KACD,EACE,MAAM,oBACP;KACD,EACE,MAAM,mBACP;KACD,EACE,MAAM,wBACP;IACF;GACF;EACF;EACD;GACE,MAAM;GACN,MAAM;IACJ,MAAM;IACN,UAAU;KACR,EACE,MAAM,QACP;KACD,EACE,MAAM,SACP;KACD,EACE,MAAM,aACP;IACF;GACF;EACF;EACD;GACE,MAAM;GACN,MAAM,CAAC,gEAAgE,wCAAyC;GAChH,MAAM;IACJ,MAAM;IACN,UAAU;KACR,EACE,MAAM,YACP;KACD,EACE,MAAM,UACP;KACD,EACE,MAAM,qBACP;IACF;GACF;EACF;EACD;GACE,MAAM;GACN,MAAM,CAAC,gEAAiE;GACxE,MAAM;IACJ,MAAM;IACN,UAAU;KACR;MACE,MAAM;MACN,QAAQ;OACN;QACE,MAAM;QACN,MAAM;OACP;OACD;QACE,MAAM;QACN,MAAM;OACP;OACD;QACE,MAAM;QACN,MAAM,EACJ,SAAS,EACP,MAAM,aACP,EACF;OACF;MACF;KACF;KACD;MACE,MAAM;MACN,QAAQ;OACN;QACE,MAAM;QACN,MAAM;OACP;OACD;QACE,MAAM;QACN,MAAM;OACP;OACD;QACE,MAAM;QACN,MAAM;OACP;OACD;QACE,MAAM;QACN,MAAM,EACJ,SAAS,EACP,MAAM,aACP,EACF;OACF;MACF;KACF;KACD,EACE,MAAM,kBACP;IACF;GACF;EACF;EACD;GACE,MAAM;GACN,MAAM,CAAC,kCAAmC;GAC1C,MAAM;IACJ,MAAM;IACN,UAAU;KACR,EACE,MAAM,QACP;KACD,EACE,MAAM,UACP;KACD,EACE,MAAM,WACP;IACF;GACF;EACF;EACD;GACE,MAAM;GACN,MAAM;IACJ;IACA;IACA;IACA;GACD;GACD,MAAM;IACJ,MAAM;IACN,UAAU,CACR,EACE,MAAM,YACP,GACD,EACE,MAAM,YACP,CACF;GACF;EACF;EACD;GACE,MAAM;GACN,MAAM;IACJ;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;GACD;GACD,MAAM;IACJ,MAAM;IACN,QAAQ;KACN;MACE,MAAM;MACN,MAAM,CAAC,0EAA2E;MAClF,MAAM;KACP;KACD;MACE,MAAM;MACN,MAAM,CAAC,6BAA8B;MACrC,MAAM,EACJ,KAAK,EACH,OAAO,CAAC,MAAM,EAAG,EAClB,EACF;KACF;KACD;MACE,MAAM;MACN,MAAM,CAAC,8DAA+D;MACtE,MAAM,EACJ,SAAS,EACP,MAAM,YACP,EACF;KACF;KACD;MACE,MAAM;MACN,MAAM,CAAC,mEAAoE;MAC3E,MAAM,EACJ,SAAS,EACP,MAAM,YACP,EACF;KACF;IACF;GACF;EACF;EACD;GACE,MAAM;GACN,MAAM;IACJ;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;GACD;GACD,MAAM;IACJ,MAAM;IACN,QAAQ;KACN;MACE,MAAM;MACN,MAAM,CAAC,0BAA2B;MAClC,MAAM,EACJ,KAAK,OACN;KACF;KACD;MACE,MAAM;MACN,MAAM,CAAC,+BAAgC;MACvC,MAAM,EACJ,SAAS,EACP,MAAM,cACP,EACF;KACF;KACD;MACE,MAAM;MACN,MAAM,CAAC,2BAA4B;MACnC,MAAM;KACP;IACF;GACF;EACF;EACD;GACE,MAAM;GACN,MAAM;IACJ;IACA;IACA;IACA;GACD;GACD,MAAM;IACJ,MAAM;IACN,QAAQ,CACN;KACE,MAAM;KACN,MAAM,CAAC,0CAA2C;KAClD,MAAM,EACJ,SAAS,EACP,MAAM,SACP,EACF;IACF,GACD;KACE,MAAM;KACN,MAAM,CAAC,aAAc;KACrB,MAAM;IACP,CACF;GACF;EACF;CACF;CACD,WAAW;EACT;GACE,MAAM;GACN,MAAM;GACN,OAAO;EACR;EACD;GACE,MAAM;GACN,MAAM;GACN,OAAO;EACR;EACD;GACE,MAAM;GACN,MAAM;GACN,OAAO;EACR;EACD;GACE,MAAM;GACN,MAAM;GACN,OAAO;EACR;EACD;GACE,MAAM;GACN,MAAM,EACJ,SAAS,EACP,MAAM,QACP,EACF;GACD,OAAO;EACR;CACF;AACF;;;;ACt3ED,MAAaC,mCAAuD;CAClE,SAAS;CACT,UAAU;EACR,MAAM;EACN,SAAS;EACT,MAAM;CACP;CACD,cAAc;EACZ;GACE,MAAM;G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;IACE,MAAM;IACN,QAAQ;GACT,GACD;IACE,MAAM;IACN,UAAU;GACX,CACF;GACD,MAAM,CACJ;IACE,MAAM;IACN,MAAM;GACP,CACF;EACF;EACD;GACE,MAAM;GACN,eAAe;IAAC;IAAG;IAAK;IAAK;IAAK;IAAI;IAAI;IAAK;GAAI;GACnD,UAAU,CACR;IACE,MAAM;IACN,QAAQ;GACT,GACD;IACE,MAAM;IACN,UAAU;GACX,CACF;GACD,MAAM,CACJ;IACE,MAAM;IACN,MAAM;GACP,CACF;EACF;EACD;GACE,MAAM;GACN,MAAM;IACJ;IACA;IACA;IACA;GACD;GACD,eAAe;IAAC;IAAI;IAAK;IAAI;IAAK;IAAK;IAAK;IAAI;GAAI;GACpD,UAAU;IACR;KACE,MAAM;KACN,UAAU;KACV,QAAQ;IACT;IACD;KACE,MAAM;KACN,MAAM,CAAC,mEAAoE;IAC5E;IACD,EACE,MAAM,SACP;IACD;KACE,MAAM;KACN,UAAU;IACX;IACD;KACE,MAAM;KACN,MAAM,CACJ,oHACA,sLACD;KACD,UAAU;KACV,QAAQ;IACT;IACD,EACE,MAAM,gBACP;IACD;KACE,MAAM;KACN,QAAQ;IACT;GACF;GACD,MAAM,CACJ;IACE,MAAM;IACN,MAAM,EACJ,SAAS,EACP,MAAM,yBACP,EACF;GACF,CACF;EACF;EACD;GACE,MAAM;GACN,MAAM;IACJ;IACA;IACA;GACD;GACD,eAAe;IAAC;IAAK;IAAI;IAAK;IAAK;IAAI;IAAI;IAAK;GAAG;GACnD,UAAU;IACR;KACE,MAAM;KACN,UAAU;KACV,QAAQ;IACT;IACD,EACE,MAAM,aACP;IACD,EACE,MAAM,SACP;IACD;KACE,MAAM;KACN,UAAU;IACX;IACD;KACE,MAAM;KACN,MAAM,CACJ,oHACA,sLACD;KACD,UAAU;KACV,QAAQ;IACT;IACD,EACE,MAAM,gBACP;IACD;KACE,MAAM;KACN,QAAQ;IACT;GACF;GACD,MAAM,CACJ;IACE,MAAM;IACN,MAAM,E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;GACN,KAAK;EACN;EACD;GACE,MAAM;GACN,MAAM;GACN,KAAK;EACN;EACD;GACE,MAAM;GACN,MAAM;GACN,KAAK;EACN;EACD;GACE,MAAM;GACN,MAAM;GACN,KAAK;EACN;EACD;GACE,MAAM;GACN,MAAM;GACN,KAAK;EACN;EACD;GACE,MAAM;GACN,MAAM;GACN,KAAK;EACN;EACD;GACE,MAAM;GACN,MAAM;GACN,KAAK;EACN;EACD;GACE,MAAM;GACN,MAAM;GACN,KAAK;EACN;EACD;GACE,MAAM;GACN,MAAM;GACN,KAAK;EACN;EACD;GACE,MAAM;GACN,MAAM;GACN,KAAK;EACN;EACD;GACE,MAAM;GACN,MAAM;GACN,KAAK;EACN;EACD;GACE,MAAM;GACN,MAAM;GACN,KAAK;EACN;EACD;GACE,MAAM;GACN,MAAM;GACN,KAAK;EACN;EACD;GACE,MAAM;GACN,MAAM;GACN,KAAK;EACN;EACD;GACE,MAAM;GACN,MAAM;GACN,KAAK;EACN;EACD;GACE,MAAM;GACN,MAAM;GACN,KAAK;EACN;EACD;GACE,MAAM;GACN,MAAM;GACN,KAAK;EACN;EACD;GACE,MAAM;GACN,MAAM;GACN,KAAK;EACN;EACD;GACE,MAAM;GACN,MAAM;GACN,KAAK;EACN;EACD;GACE,MAAM;GACN,MAAM;GACN,KAAK;EACN;EACD;GACE,MAAM;GACN,MAAM;GACN,KAAK;EACN;EACD;GACE,MAAM;GACN,MAAM;GACN,KAAK;EACN;CACF;CACD,OAAO;EACL;GACE,MAAM;GACN,MAAM;IACJ,MAAM;IACN,QAAQ;KACN;MACE,MAAM;MACN,MAAM,EACJ,OAAO,CAAC,MAAM,EAAG,EAClB;KACF;KACD;MACE,MAAM;MACN,MAAM;KACP;KACD;MACE,MAAM;MACN,MAAM;KACP;KACD;MACE,MAAM;MACN,MAAM;KACP;KACD;MACE,MAAM;MACN,MAAM;KACP;KACD;MACE,MAAM;MACN,MAAM;KACP;KACD;MACE,MAAM;MACN,MAAM;KACP;KACD;MACE,MAAM;MACN,MAAM;KACP;IACF;GACF;EACF;EACD;GACE,MAAM;GACN,MAAM,CACJ,6FACA,oFACD;GACD,MAAM;IACJ,MAAM;IACN,QAAQ;KACN;MACE,MAAM;MACN,MAAM,EACJ,OAAO,CAAC,MAAM,EAAG,EAClB;KACF;KACD;MACE,MAAM;MACN,MAAM;KACP;KACD;MACE,MAAM;MACN,MAAM;KACP;KACD;MACE,MAAM;MACN,MAAM;KACP;KACD;MACE,MAAM;MACN,MAAM;KACP;KACD;MACE,MAAM;MACN,MAAM;KACP;KACD;MACE,MAAM;MACN,MAAM,CACJ,iEACA,8DACD;MACD,MAAM;KACP;IACF;GACF;EACF;EACD;GACE,MAAM;GACN,MAAM;IACJ,MAAM;IACN,QAAQ,CACN;KACE,MAAM;KACN,MAAM;IACP,GACD;KACE,MAAM;KACN,MAAM,EACJ,KAAK,EACH,OAAO,CAAC,MAAM,EAAG,EAClB,EACF;IACF,CACF;GACF;EACF;EACD;GACE,MAAM;GACN,MAAM;IACJ,MAAM;IACN,QAAQ,CACN;KACE,MAAM;KACN,MAAM;IACP,GACD;KACE,MAAM;KACN,MAAM;IACP,CACF;GACF;EACF;EACD;GACE,MAAM;GACN,MAAM;IACJ,MAAM;IACN,QAAQ;KACN;MACE,MAAM;MACN,MAAM;KACP;KACD;MACE,MAAM;MACN,MAAM,EACJ,SAAS,EACP,MAAM,oBACP,EACF;KACF;KACD;MACE,MAAM;MACN,MAAM;KACP;IACF;GACF;EACF;EACD;GACE,MAAM;GACN,MAAM;IACJ,MAAM;IACN,QAAQ,CACN;KACE,MAAM;KACN,MAAM,EACJ,SAAS,EACP,MAAM,oBACP,EACF;IACF,GACD;KACE,MAAM;KACN,MAAM;IACP,CACF;GACF;EACF;EACD;GACE,MAAM;GACN,MAAM;IACJ,MAAM;IACN,QAAQ;KACN;MACE,MAAM;MACN,MAAM,EACJ,SAAS,EACP,MAAM,oBACP,EACF;KACF;KACD;MACE,MAAM;MACN,MAAM,EACJ,SAAS,EACP,MAAM,oBACP,EACF;KACF;KACD;MACE,MAAM;MACN,MAAM;KACP;IACF;GACF;EACF;EACD;GACE,MAAM;GACN,MAAM,CACJ,8UACD;GACD,MAAM;IACJ,MAAM;IACN,UAAU,CACR;KACE,MAAM;KACN,QAAQ,CACN;MACE,MAAM;MACN,MAAM;KACP,CACF;IACF,GACD,EACE,MAAM,OACP,CACF;GACF;EACF;EACD;GACE,MAAM;GACN,MAAM;IACJ,MAAM;IACN,QAAQ;KACN;MACE,MAAM;MACN,MAAM;KACP;KACD;MACE,MAAM;MACN,MAAM,EACJ,QAAQ,SACT;KACF;KACD;MACE,MAAM;MACN,MAAM;KACP;KACD;MACE,MAAM;MACN,MAAM,EACJ,KAAK,EACH,SAAS,EACP,MAAM,aACP,EACF,EACF;KACF;KACD;MACE,MAAM;MACN,MAAM;KACP;KACD;MACE,MAAM;MACN,MAAM;KACP;IACF;GACF;EACF;EACD;GACE,MAAM;GACN,MAAM;IACJ,MAAM;IACN,QAAQ;KACN;MACE,MAAM;MACN,MAAM;KACP;KACD;MACE,MAAM;MACN,MAAM,EACJ,SAAS,EACP,MAAM,oBACP,EACF;KACF;KACD;MACE,MAAM;MACN,MAAM,EACJ,SAAS,EACP,MAAM,mBACP,EACF;KACF;KACD;MACE,MAAM;MACN,MAAM;KACP;IACF;GACF;EACF;EACD;GACE,MAAM;GACN,MAAM;IACJ,MAAM;IACN,QAAQ,CACN;KACE,MAAM;KACN,MAAM;IACP,GACD;KACE,MAAM;KACN,MAAM,EACJ,SAAS,EACP,MAAM,YACP,EACF;IACF,CACF;GACF;EACF;CACF;AACF;;;;ACljDD,MAAa,8BAA8B,IAAI,UAAU;AACzD,MAAa,8BAA8B,IAAI,UAAU;AACzD,MAAa,iCAAiC,IAAI,UAAU;AAE5D,MAAa,oBAAoB;AACjC,MAAa,gBAAgB;AAC7B,MAAa,gBAAgB;AAC7B,MAAa,sBAAsB;AACnC,MAAa,6BAA6B;AAC1C,MAAa,uBAAuB;;;;AAKpC,M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QAAQ;CACR,eAAe;AAChB;mBACe;CACd;EACE,QAAQ;EACR,QAAQ;GACN;GACA;GACA;EACD;EACD,iBAAiB;GACf;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACD;EACD,YAAY;GACV;IACE,QAAQ;IACR,YAAY;GACb;GACD;IACE,QAAQ;IACR,QAAQ,CACN,oCACD;IACD,UAAU;IACV,aAAa,CACX,WACD;GACF;GACD;IACE,QAAQ;IACR,OAAO,EACL,SAAS,CACP;KACE,QAAQ;KACR,SAAS;MACP;MACA;MACA;MACA;MACA;MACA;MACA;MACA;KACD;IACF,CACF,EACF;GACF;EACF;EACD,QAAQ,CACN;GACE,QAAQ;GACR,QAAQ;EACT,CACF;CACF;CACD;EACE,QAAQ;EACR,QAAQ,CACN,uEACD;EACD,iBAAiB;GACf;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACD;EACD,YAAY,CACV;GACE,QAAQ;GACR,QAAQ,CACN,8BACD;GACD,YAAY;GACZ,UAAU;GACV,aAAa,CACX,WACD;EACF,GACD;GACE,QAAQ;GACR,YAAY;GACZ,OAAO,EACL,SAAS,CACP;IACE,QAAQ;IACR,SAAS;KACP;KACA;KACA;KACA;KACA;KACA;KACA;KACA;IACD;GACF,CACF,EACF;EACF,CACF;EACD,QAAQ;GACN;IACE,QAAQ;IACR,QAAQ;GACT;GACD;IACE,QAAQ;IACR,QAAQ;GACT;GACD;IACE,QAAQ;IACR,QAAQ;GACT;GACD;IACE,QAAQ;IACR,QAAQ,EACN,WAAW,EACT,QAAQ,gBACT,EACF;GACF;GACD;IACE,QAAQ;IACR,QAAQ,EACN,WAAW,EACT,QAAQ,gBACT,EACF;GACF;EACF;CACF;CACD;EACE,QAAQ;EACR,iBAAiB;GACf;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACD;EACD,YAAY;GACV;IACE,QAAQ;IACR,aAAa,CACX,iBACD;GACF;GACD;IACE,QAAQ;IACR,UAAU;IACV,aAAa,CACX,aACD;GACF;GACD;IACE,QAAQ;IACR,YAAY;GACb;EACF;EACD,QAAQ,CACN;GACE,QAAQ;GACR,QAAQ,EACN,WAAW,EACT,QAAQ,2BACT,EACF;EACF,CACF;CACF;CACD;EACE,QAAQ;EACR,QAAQ,CACN,8FACA,mCACD;EACD,iBAAiB;GACf;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACD;EACD,YAAY;GACV;IACE,QAAQ;IACR,QAAQ,CACN,mBACD;IACD,YAAY;IACZ,UAAU;GACX;GACD;IACE,QAAQ;IACR,YAAY;IACZ,OAAO,EACL,SAAS,CACP;KACE,QAAQ;KACR,SAAS;MACP;MACA;MACA;MACA;MACA;MACA;MACA;MACA;KACD;IACF,CACF,EACF;GACF;GACD;IACE,QAAQ;IACR,WAAW;GACZ;GACD;IACE,QAAQ;IACR,WAAW;GACZ;EACF;EACD,QAAQ;GACN;IACE,QAAQ;IACR,QAAQ;GACT;GACD;IACE,QAAQ;IACR,QAAQ;GACT;GACD;IACE,QAAQ;IACR,QAAQ;GACT;GACD;IACE,QAAQ;IACR,QAAQ,EACN,WAAW,EACT,QAAQ,gBACT,EACF;GACF;GACD;IACE,QAAQ;IACR,QAAQ,EACN,WAAW,EACT,QAAQ,gBACT,EACF;GACF;EACF;CACF;CACD;EACE,QAAQ;EACR,QAAQ;GACN;GACA;GACA;GACA;EACD;EACD,iBAAiB;GACf;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACD;EACD,YAAY;GACV,EACE,QAAQ,cACT;GACD;IACE,QAAQ;IACR,UAAU;IACV,aAAa,CACX,aACD;GACF;GACD;IACE,QAAQ;IACR,QAAQ,CACN,mBACD;IACD,YAAY;IACZ,UAAU;GACX;GACD;IACE,QAAQ;IACR,YAAY;IACZ,OAAO,EACL,SAAS,CACP;KACE,QAAQ;KACR,SAAS;MACP;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;KACD;IACF,GACD;KACE,QAAQ;KACR,QAAQ;IACT,CACF,EACF;GACF;GACD;IACE,QAAQ;IACR,WAAW;GACZ;GACD;IACE,QAAQ;IACR,WAAW;GACZ;EACF;EACD,QAAQ,CACN;GACE,QAAQ;GACR,QAAQ,EACN,WAAW,EACT,QAAQ,uBACT,EACF;EACF,CACF;CACF;CACD;EACE,QAAQ;EACR,iBAAiB;GACf;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACD;EACD,YAAY;GACV;IACE,QAAQ;IACR,aAAa,CACX,iBACA,MACD;GACF;GACD;IACE,QAAQ;IACR,YAAY;GACb;GACD;IACE,QAAQ;IACR,UAAU;IACV,aAAa,CACX,eACD;GACF;GACD;IACE,QAAQ;IACR,YAAY;GACb;GACD;IACE,QAAQ;IACR,YAAY;GACb;GACD;IACE,QAAQ;IACR,YAAY;IACZ,OAAO,EACL,SAAS,CACP;KACE,QAAQ;KACR,SAAS;MACP;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;KACD;IACF,GACD;KACE,QAAQ;KACR,QAAQ;IACT,CACF,EACF;GACF;GACD;IACE,QAAQ;IACR,YAAY;IACZ,aAAa,CACX,MACD;GACF;GACD,EACE,QAAQ,gBACT;EACF;EACD,QAAQ,CACN;GACE,QAAQ;GACR,QAAQ;EACT,CACF;CACF;CACD;EACE,QAAQ;EACR,iBAAiB;GACf;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACD;EACD,YAAY;GACV;IACE,QAAQ;IACR,aAAa,CACX,iBACA,MACD;GACF;GACD;IACE,QAAQ;IACR,YAAY;GACb;GACD;IACE,QAAQ;IACR,UAAU;GACX;GACD;IACE,QAAQ;IACR,YAAY;GACb;GACD;IACE,QAAQ;IACR,YAAY;GACb;GACD;IACE,QAAQ;IACR,YAAY;IACZ,OAAO,EACL,SAAS,CACP;KACE,QAAQ;KACR,SAAS;MACP;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;KACD;IACF,GACD;KACE,QAAQ;KACR,QAAQ;IACT,CACF,EACF;GACF;GACD;IACE,QAAQ;IACR,YAAY;IACZ,aAAa,CACX,MACD;GACF;GACD,EACE,QAAQ,gBACT;EACF;EACD,QAAQ,CACN;GACE,QAAQ;GACR,QAAQ;EACT,CACF;CACF;CACD;EACE,QAAQ;EACR,iBAAiB;GACf;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACD;EACD,YAAY;GACV;IACE,QAAQ;IACR,aAAa,CACX,iBACA,MACD;GACF;GACD;IACE,QAAQ;IACR,YAAY;GACb;GACD;IACE,QAAQ;IACR,UAAU;IACV,aAAa,CACX,eACD;GACF;GACD;IACE,QAAQ;IACR,YAAY;GACb;EACF;EACD,QAAQ,CAAE;CACX;CACD;EACE,QAAQ;EACR,iBAAiB;GACf;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACD;EACD,YAAY;GACV;IACE,QAAQ;IACR,aAAa,CACX,iBACA,MACD;GACF;GACD;IACE,QAAQ;IACR,YAAY;GACb;GACD;IACE,QAAQ;IACR,UAAU;IACV,aAAa,CACX,eACD;GACF;GACD;IACE,QAAQ;IACR,YAAY;GACb;GACD;IACE,QAAQ;IACR,YAAY;GACb;GACD;IACE,QAAQ;IACR,YAAY;IACZ,aAAa,CACX,MACD;GACF;GACD,EACE,QAAQ,gBACT;EACF;EACD,QAAQ,CACN;GACE,QAAQ;GACR,QAAQ;EACT,GACD;GACE,QAAQ;GACR,QAAQ,EACN,UAAU,OACX;EACF,CACF;CACF;CACD;EACE,QAAQ;EACR,iBAAiB;GACf;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACD;EACD,YAAY;GACV;IACE,QAAQ;IACR,UAAU;GACX;GACD;IACE,QAAQ;IACR,OAAO,EACL,SAAS,CACP;KACE,QAAQ;KACR,SAAS;MACP;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;KACD;IACF,CACF,EACF;GACF;GACD;IACE,QAAQ;IACR,aAAa,CACX,iBACA,MACD;GACF;GACD;IACE,QAAQ;IACR,YAAY;GACb;GACD;IACE,QAAQ;IACR,YAAY;GACb;GACD;IACE,QAAQ;IACR,YAAY;GACb;GACD;IACE,QAAQ;IACR,YAAY;IACZ,aAAa,CACX,MACD;GACF;GACD,EACE,QAAQ,gBACT;EACF;EACD,QAAQ,CACN;GACE,QAAQ;GACR,QAAQ;EACT,GACD;GACE,QAAQ;GACR,QAAQ,EACN,UAAU,OACX;EACF,CACF;CACF;CACD;EACE,QAAQ;EACR,iBAAiB;GACf;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACD;EACD,YAAY,CACV;GACE,QAAQ;GACR,YAAY;EACb,GACD;GACE,QAAQ;GACR,UAAU;GACV,aAAa,CACX,eACD;EACF,CACF;EACD,QAAQ,CAAE;CACX;CACD;EACE,QAAQ;EACR,QAAQ,CACN,mEACD;EACD,iBAAiB;GACf;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACD;EACD,YAAY;GACV;IACE,QAAQ;IACR,aAAa;KACX;KACA;KACA;KACA;IACD;GACF;GACD;IACE,QAAQ;IACR,YAAY;GACb;GACD;IACE,QAAQ;IACR,YAAY;GACb;GACD;IACE,QAAQ;IACR,YAAY;GACb;GACD;IACE,QAAQ;IACR,UAAU;IACV,aAAa,CACX,0BACD;GACF;GACD;IACE,QAAQ;IACR,YAAY;GACb;GACD;IACE,QAAQ;IACR,YAAY;IACZ,OAAO,EACL,SAAS,CACP;KACE,QAAQ;KACR,SAAS;MACP;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;KACD;IACF,GACD;KACE,QAAQ;KACR,QAAQ;IACT,CACF,EACF;GACF;GACD;IACE,QAAQ;IACR,YAAY;IACZ,OAAO,EACL,SAAS,CACP;KACE,QAAQ;KACR,SAAS;MACP;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;KACD;IACF,GACD;KACE,QAAQ;KACR,QAAQ;IACT,CACF,EACF;GACF;GACD;IACE,QAAQ;IACR,YAAY;IACZ,OAAO,EACL,SAAS,CACP;KACE,QAAQ;KACR,SAAS;MACP;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;KACD;IACF,GACD;KACE,QAAQ;KACR,QAAQ;IACT,CACF,EACF;GACF;GACD,EACE,QAAQ,gBACT;EACF;EACD,QAAQ,CACN;GACE,QAAQ;GACR,QAAQ;EACT,CACF;CACF;CACD;EACE,QAAQ;EACR,QAAQ;GACN;GACA;GACA;GACA;GACA;EACD;EACD,iBAAiB;GACf;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACD;EACD,YAAY,CACV;GACE,QAAQ;GACR,YAAY;EACb,CACF;EACD,QAAQ,CAAE;CACX;CACD;EACE,QAAQ;EACR,iBAAiB;GACf;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACD;EACD,YAAY;GACV;IACE,QAAQ;IACR,aAAa,CACX,iBACA,MACD;GACF;GACD;IACE,QAAQ;IACR,YAAY;GACb;GACD;IACE,QAAQ;IACR,UAAU;IACV,aAAa,CACX,eACD;GACF;GACD;IACE,QAAQ;IACR,YAAY;GACb;GACD;IACE,QAAQ;IACR,YAAY;GACb;GACD;IACE,QAAQ;IACR,YAAY;IACZ,aAAa,CACX,MACD;GACF;GACD,EACE,QAAQ,gBACT;EACF;EACD,QAAQ,CACN;GACE,QAAQ;GACR,QAAQ;EACT,GACD;GACE,QAAQ;GACR,QAAQ,EACN,UAAU,OACX;EACF,CACF;CACF;CACD;EACE,QAAQ;EACR,iBAAiB;GACf;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACD;EACD,YAAY;GACV;IACE,QAAQ;IACR,aAAa,CACX,iBACA,MACD;GACF;GACD;IACE,QAAQ;IACR,YAAY;GACb;GACD;IACE,QAAQ;IACR,UAAU;GACX;GACD;IACE,QAAQ;IACR,OAAO,EACL,SAAS,CACP;KACE,QAAQ;KACR,SAAS;MACP;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;KACD;IACF,CACF,EACF;GACF;GACD;IACE,QAAQ;IACR,YAAY;GACb;GACD;IACE,QAAQ;IACR,YAAY;GACb;GACD;IACE,QAAQ;IACR,YAAY;IACZ,aAAa,CACX,MACD;GACF;GACD,EACE,QAAQ,gBACT;EACF;EACD,QAAQ,CACN;GACE,QAAQ;GACR,QAAQ;EACT,GACD;GACE,QAAQ;GACR,QAAQ,EACN,UAAU,OACX;EACF,CACF;CACF;CACD;EACE,QAAQ;EACR,iBAAiB;GACf;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACD;EACD,YAAY,CACV;GACE,QAAQ;GACR,YAAY;EACb,GACD;GACE,QAAQ;GACR,YAAY;EACb,CACF;EACD,QAAQ,CAAE;CACX;CACD;EACE,QAAQ;EACR,QAAQ;GACN;GACA;GACA;GACA;EACD;EACD,iBAAiB;GACf;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACD;EACD,YAAY,CACV;GACE,QAAQ;GACR,YAAY;EACb,CACF;EACD,QAAQ,CAAE;CACX;CACD;EACE,QAAQ;EACR,iBAAiB;GACf;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACD;EACD,YAAY;GACV;IACE,QAAQ;IACR,YAAY;GACb;GACD;IACE,QAAQ;IACR,UAAU;IACV,aAAa,CACX,eACD;GACF;GACD;IACE,QAAQ;IACR,WAAW;GACZ;EACF;EACD,QAAQ,CACN;GACE,QAAQ;GACR,QAAQ;EACT,CACF;CACF;CACD;EACE,QAAQ;EACR,iBAAiB;GACf;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACD;EACD,YAAY;GACV;IACE,QAAQ;IACR,aAAa,CACX,iBACA,MACD;GACF;GACD;IACE,QAAQ;IACR,YAAY;GACb;GACD;IACE,QAAQ;IACR,UAAU;IACV,aAAa,CACX,eACD;GACF;GACD;IACE,QAAQ;IACR,YAAY;GACb;GACD;IACE,QAAQ;IACR,YAAY;GACb;GACD;IACE,QAAQ;IACR,OAAO,EACL,SAAS,CACP;KACE,QAAQ;KACR,SAAS;MACP;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;KACD;IACF,GACD;KACE,QAAQ;KACR,QAAQ;IACT,CACF,EACF;GACF;GACD;IACE,QAAQ;IACR,YAAY;IACZ,aAAa,CACX,MACD;GACF;GACD,EACE,QAAQ,gBACT;EACF;EACD,QAAQ,CACN;GACE,QAAQ;GACR,QAAQ;EACT,GACD;GACE,QAAQ;GACR,QAAQ,EACN,UAAU,OACX;EACF,CACF;CACF;CACD;EACE,QAAQ;EACR,iBAAiB;GACf;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACD;EACD,YAAY;GACV;IACE,QAAQ;IACR,aAAa,CACX,iBACA,MACD;GACF;GACD;IACE,QAAQ;IACR,YAAY;GACb;GACD;IACE,QAAQ;IACR,UAAU;IACV,aAAa,CACX,eACD;GACF;GACD;IACE,QAAQ;IACR,YAAY;GACb;GACD;IACE,QAAQ;IACR,aAAa,CACX,MACD;GACF;GACD;IACE,QAAQ;IACR,OAAO,EACL,SAAS;KACP;MACE,QAAQ;MACR,SAAS;OACP;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;MACD;KACF;KACD;MACE,QAAQ;MACR,QAAQ;KACT;KACD;MACE,QAAQ;MACR,QAAQ;KACT;IACF,EACF;GACF;GACD;IACE,QAAQ;IACR,YAAY;IACZ,OAAO,EACL,SAAS;KACP;MACE,QAAQ;MACR,SAAS;OACP;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;MACD;KACF;KACD;MACE,QAAQ;MACR,QAAQ;KACT;KACD;MACE,QAAQ;MACR,QAAQ;KACT;IACF,EACF;GACF;GACD;IACE,QAAQ;IACR,YAAY;GACb;GACD,EACE,QAAQ,gBACT;EACF;EACD,QAAQ,CAAE;CACX;CACD;EACE,QAAQ;EACR,iBAAiB;GACf;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACD;EACD,YAAY;GACV;IACE,QAAQ;IACR,aAAa,CACX,iBACA,MACD;GACF;GACD;IACE,QAAQ;IACR,YAAY;GACb;GACD;IACE,QAAQ;IACR,YAAY;GACb;GACD;IACE,QAAQ;IACR,aAAa,CACX,MACD;GACF;GACD;IACE,QAAQ;IACR,OAAO,EACL,SAAS;KACP;MACE,QAAQ;MACR,SAAS;OACP;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;MACD;KACF;KACD;MACE,QAAQ;MACR,QAAQ;KACT;KACD;MACE,QAAQ;MACR,QAAQ;KACT;IACF,EACF;GACF;GACD;IACE,QAAQ;IACR,YAAY;IACZ,OAAO,EACL,SAAS;KACP;MACE,QAAQ;MACR,SAAS;OACP;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;MACD;KACF;KACD;MACE,QAAQ;MACR,QAAQ;KACT;KACD;MACE,QAAQ;MACR,QAAQ;KACT;IACF,EACF;GACF;GACD;IACE,QAAQ;IACR,QAAQ,CACN,+BACD;IACD,YAAY;GACb;GACD,EACE,QAAQ,gBACT;EACF;EACD,QAAQ,CAAE;CACX;CACD;EACE,QAAQ;EACR,iBAAiB;GACf;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACD;EACD,YAAY;GACV;IACE,QAAQ;IACR,aAAa,CACX,iBACA,MACD;GACF;GACD;IACE,QAAQ;IACR,YAAY;GACb;GACD;IACE,QAAQ;IACR,UAAU;GACX;GACD;IACE,QAAQ;IACR,YAAY;GACb;GACD;IACE,QAAQ;IACR,YAAY;GACb;GACD;IACE,QAAQ;IACR,OAAO,EACL,SAAS,CACP;KACE,QAAQ;KACR,SAAS;MACP;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;KACD;IACF,GACD;KACE,QAAQ;KACR,QAAQ;IACT,CACF,EACF;GACF;GACD;IACE,QAAQ;IACR,YAAY;IACZ,aAAa,CACX,MACD;GACF;GACD,EACE,QAAQ,gBACT;EACF;EACD,QAAQ,CACN;GACE,QAAQ;GACR,QAAQ;EACT,GACD;GACE,QAAQ;GACR,QAAQ,EACN,UAAU,OACX;EACF,CACF;CACF;CACD;EACE,QAAQ;EACR,iBAAiB;GACf;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACD;EACD,YAAY,CACV;GACE,QAAQ;GACR,aAAa,CACX,MACD;EACF,GACD;GACE,QAAQ;GACR,YAAY;EACb,CACF;EACD,QAAQ,CAAE;CACX;CACD;EACE,QAAQ;EACR,iBAAiB;GACf;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACD;EACD,YAAY;GACV;IACE,QAAQ;IACR,YAAY;GACb;GACD;IACE,QAAQ;IACR,YAAY;IACZ,UAAU;IACV,aAAa,CACX,aACD;GACF;GACD;IACE,QAAQ;IACR,QAAQ,CACN,4FACD;IACD,YAAY;IACZ,UAAU;GACX;GACD;IACE,QAAQ;IACR,OAAO,EACL,SAAS,CACP;KACE,QAAQ;KACR,SAAS;MACP;MACA;MACA;MACA;MACA;MACA;MACA;MACA;KACD;IACF,CACF,EACF;GACF;GACD;IACE,QAAQ;IACR,YAAY;IACZ,aAAa,CACX,WACD;GACF;GACD,EACE,QAAQ,YACT;GACD;IACE,QAAQ;IACR,YAAY;IACZ,UAAU;GACX;GACD;IACE,QAAQ;IACR,OAAO,EACL,SAAS,CACP;KACE,QAAQ;KACR,SAAS;MACP;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;KACD;IACF,GACD;KACE,QAAQ;KACR,QAAQ;IACT,CACF,EACF;GACF;GACD;IACE,QAAQ;IACR,YAAY;IACZ,OAAO,EACL,SAAS,CACP;KACE,QAAQ;KACR,SAAS;MACP;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;KACD;IACF,GACD;KACE,QAAQ;KACR,QAAQ;IACT,CACF,EACF;GACF;GACD;IACE,QAAQ;IACR,OAAO,EACL,SAAS,CACP;KACE,QAAQ;KACR,SAAS;MACP;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;KACD;IACF,GACD;KACE,QAAQ;KACR,QAAQ;IACT,CACF,EACF;GACF;GACD;IACE,QAAQ;IACR,YAAY;IACZ,OAAO,EACL,SAAS,CACP;KACE,QAAQ;KACR,SAAS;MACP;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;KACD;IACF,GACD;KACE,QAAQ;KACR,QAAQ;IACT,CACF,EACF;GACF;GACD;IACE,QAAQ;IACR,OAAO,EACL,SAAS,CACP;KACE,QAAQ;KACR,SAAS;MACP;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;KACD;IACF,GACD;KACE,QAAQ;KACR,QAAQ;IACT,CACF,EACF;GACF;GACD;IACE,QAAQ;IACR,YAAY;IACZ,OAAO,EACL,SAAS,CACP;KACE,QAAQ;KACR,SAAS;MACP;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;KACD;IACF,GACD;KACE,QAAQ;KACR,QAAQ;IACT,CACF,EACF;GACF;GACD;IACE,QAAQ;IACR,WAAW;GACZ;GACD,EACE,QAAQ,gBACT;GACD;IACE,QAAQ;IACR,WAAW;GACZ;EACF;EACD,QAAQ,CACN;GACE,QAAQ;GACR,QAAQ,EACN,WAAW,EACT,QAAQ,oBACT,EACF;EACF,CACF;CACF;CACD;EACE,QAAQ;EACR,iBAAiB;GACf;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACD;EACD,YAAY;GACV;IACE,QAAQ;IACR,YAAY;IACZ,aAAa,CACX,iBACD;GACF;GACD,EACE,QAAQ,kBACT;GACD;IACE,QAAQ;IACR,YAAY;IACZ,UAAU;GACX;GACD;IACE,QAAQ;IACR,QAAQ;KACN;KACA;KACA;KACA;IACD;GACF;GACD,EACE,QAAQ,WACT;GACD;IACE,QAAQ;IACR,QAAQ;KACN;KACA;KACA;KACA;IACD;GACF;GACD;IACE,QAAQ;IACR,YAAY;IACZ,OAAO,EACL,SAAS;KACP;MACE,QAAQ;MACR,QAAQ;KACT;KACD;MACE,QAAQ;MACR,QAAQ;KACT;KACD;MACE,QAAQ;MACR,QAAQ;KACT;IACF,EACF;GACF;GACD;IACE,QAAQ;IACR,OAAO,EACL,SAAS,CACP;KACE,QAAQ;KACR,SAAS;MACP;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;KACD;IACF,GACD;KACE,QAAQ;KACR,QAAQ;IACT,CACF,EACF;GACF;GACD;IACE,QAAQ;IACR,YAAY;IACZ,OAAO,EACL,SAAS,CACP;KACE,QAAQ;KACR,SAAS;MACP;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;KACD;IACF,GACD;KACE,QAAQ;KACR,QAAQ;IACT,CACF,EACF;GACF;GACD;IACE,QAAQ;IACR,OAAO,EACL,SAAS,CACP;KACE,QAAQ;KACR,SAAS;MACP;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;KACD;IACF,GACD;KACE,QAAQ;KACR,QAAQ;IACT,CACF,EACF;GACF;GACD;IACE,QAAQ;IACR,YAAY;IACZ,OAAO,EACL,SAAS,CACP;KACE,QAAQ;KACR,SAAS;MACP;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;KACD;IACF,GACD;KACE,QAAQ;KACR,QAAQ;IACT,CACF,EACF;GACF;GACD;IACE,QAAQ;IACR,OAAO,EACL,SAAS,CACP;KACE,QAAQ;KACR,SAAS;MACP;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;KACD;IACF,GACD;KACE,QAAQ;KACR,QAAQ;IACT,CACF,EACF;GACF;GACD;IACE,QAAQ;IACR,YAAY;IACZ,OAAO,EACL,SAAS,CACP;KACE,QAAQ;KACR,SAAS;MACP;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;KACD;IACF,GACD;KACE,QAAQ;KACR,QAAQ;IACT,CACF,EACF;GACF;GACD;IACE,QAAQ;IACR,WAAW;GACZ;GACD,EACE,QAAQ,gBACT;GACD;IACE,QAAQ;IACR,WAAW;GACZ;EACF;EACD,QAAQ,CACN;GACE,QAAQ;GACR,QAAQ;EACT,CACF;CACF;CACD;EACE,QAAQ;EACR,QAAQ;GACN;GACA;GACA;EACD;EACD,iBAAiB;GACf;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACD;EACD,YAAY;GACV;IACE,QAAQ;IACR,YAAY;GACb;GACD;IACE,QAAQ;IACR,YAAY;IACZ,UAAU;IACV,aAAa,CACX,aACD;GACF;GACD;IACE,QAAQ;IACR,QAAQ,CACN,4FACD;IACD,YAAY;IACZ,UAAU;GACX;GACD;IACE,QAAQ;IACR,OAAO,EACL,SAAS,CACP;KACE,QAAQ;KACR,SAAS;MACP;MACA;MACA;MACA;MACA;MACA;MACA;MACA;KACD;IACF,CACF,EACF;GACF;GACD;IACE,QAAQ;IACR,YAAY;IACZ,aAAa,CACX,WACD;GACF;GACD,EACE,QAAQ,YACT;GACD;IACE,QAAQ;IACR,YAAY;IACZ,OAAO,EACL,SAAS;KACP;MACE,QAAQ;MACR,QAAQ;KACT;KACD;MACE,QAAQ;MACR,QAAQ;KACT;KACD;MACE,QAAQ;MACR,QAAQ;KACT;IACF,EACF;GACF;GACD;IACE,QAAQ;IACR,OAAO,EACL,SAAS,CACP;KACE,QAAQ;KACR,SAAS;MACP;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;KACD;IACF,GACD;KACE,QAAQ;KACR,QAAQ;IACT,CACF,EACF;GACF;GACD;IACE,QAAQ;IACR,YAAY;IACZ,OAAO,EACL,SAAS,CACP;KACE,QAAQ;KACR,SAAS;MACP;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;KACD;IACF,GACD;KACE,QAAQ;KACR,QAAQ;IACT,CACF,EACF;GACF;GACD;IACE,QAAQ;IACR,OAAO,EACL,SAAS,CACP;KACE,QAAQ;KACR,SAAS;MACP;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;KACD;IACF,GACD;KACE,QAAQ;KACR,QAAQ;IACT,CACF,EACF;GACF;GACD;IACE,QAAQ;IACR,YAAY;IACZ,OAAO,EACL,SAAS,CACP;KACE,QAAQ;KACR,SAAS;MACP;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;KACD;IACF,GACD;KACE,QAAQ;KACR,QAAQ;IACT,CACF,EACF;GACF;GACD;IACE,QAAQ;IACR,OAAO,EACL,SAAS,CACP;KACE,QAAQ;KACR,SAAS;MACP;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;KACD;IACF,GACD;KACE,QAAQ;KACR,QAAQ;IACT,CACF,EACF;GACF;GACD;IACE,QAAQ;IACR,YAAY;IACZ,OAAO,EACL,SAAS,CACP;KACE,QAAQ;KACR,SAAS;MACP;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;KACD;IACF,GACD;KACE,QAAQ;KACR,QAAQ;IACT,CACF,EACF;GACF;GACD;IACE,QAAQ;IACR,WAAW;GACZ;GACD,EACE,QAAQ,gBACT;GACD;IACE,QAAQ;IACR,WAAW;GACZ;EACF;EACD,QAAQ,CACN;GACE,QAAQ;GACR,QAAQ,EACN,WAAW,EACT,QAAQ,oBACT,EACF;EACF,GACD;GACE,QAAQ;GACR,QAAQ;EACT,CACF;CACF;CACD;EACE,QAAQ;EACR,iBAAiB;GACf;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACD;EACD,YAAY;GACV;IACE,QAAQ;IACR,aAAa,CACX,MACD;GACF;GACD;IACE,QAAQ;IACR,YAAY;GACb;GACD;IACE,QAAQ;IACR,OAAO,EACL,SAAS,CACP;KACE,QAAQ;KACR,SAAS;MACP;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;KACD;IACF,GACD;KACE,QAAQ;KACR,QAAQ;IACT,CACF,EACF;GACF;GACD;IACE,QAAQ;IACR,YAAY;IACZ,OAAO,EACL,SAAS,CACP;KACE,QAAQ;KACR,SAAS;MACP;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;KACD;IACF,GACD;KACE,QAAQ;KACR,QAAQ;IACT,CACF,EACF;GACF;GACD;IACE,QAAQ;IACR,YAAY;IACZ,OAAO,EACL,SAAS,CACP;KACE,QAAQ;KACR,SAAS;MACP;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;KACD;IACF,GACD;KACE,QAAQ;KACR,QAAQ;IACT,CACF,EACF;GACF;GACD;IACE,QAAQ;IACR,YAAY;IACZ,OAAO,EACL,SAAS,CACP;KACE,QAAQ;KACR,SAAS;MACP;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;KACD;IACF,GACD;KACE,QAAQ;KACR,QAAQ;IACT,CACF,EACF;GACF;GACD;IACE,QAAQ;IACR,OAAO,EACL,SAAS,CACP;KACE,QAAQ;KACR,SAAS;MACP;MACA;MACA;MACA;MACA;MACA;MACA;MACA;KACD;IACF,CACF,EACF;GACF;GACD;IACE,QAAQ;IACR,QAAQ,CACN,+FACA,iCACD;IACD,YAAY;GACb;GACD,EACE,QAAQ,gBACT;EACF;EACD,QAAQ,CAAE;CACX;CACD;EACE,QAAQ;EACR,iBAAiB;GACf;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACD;EACD,YAAY;GACV;IACE,QAAQ;IACR,YAAY;IACZ,aAAa,CACX,MACD;GACF;GACD;IACE,QAAQ;IACR,UAAU;IACV,aAAa,CACX,OACD;GACF;GACD;IACE,QAAQ;IACR,YAAY;GACb;EACF;EACD,QAAQ,CACN;GACE,QAAQ;GACR,QAAQ,EACN,WAAW,EACT,QAAQ,gBACT,EACF;EACF,CACF;CACF;CACD;EACE,QAAQ;EACR,iBAAiB;GACf;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACD;EACD,YAAY;GACV;IACE,QAAQ;IACR,aAAa,CACX,MACD;GACF;GACD;IACE,QAAQ;IACR,UAAU;IACV,aAAa,CACX,OACD;GACF;GACD;IACE,QAAQ;IACR,YAAY;GACb;EACF;EACD,QAAQ,CACN;GACE,QAAQ;GACR,QAAQ;EACT,GACD;GACE,QAAQ;GACR,QAAQ,EACN,SAAS,CACP,EACE,WAAW,EACT,QAAQ,aACT,EACF,GACD,EACD,EACF;EACF,CACF;CACF;CACD;EACE,QAAQ;EACR,iBAAiB;GACf;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACD;EACD,YAAY;GACV;IACE,QAAQ;IACR,aAAa,CACX,MACD;GACF;GACD;IACE,QAAQ;IACR,UAAU;IACV,aAAa,CACX,OACD;GACF;GACD;IACE,QAAQ;IACR,YAAY;GACb;EACF;EACD,QAAQ,CACN;GACE,QAAQ;GACR,QAAQ;EACT,GACD;GACE,QAAQ;GACR,QAAQ;EACT,CACF;CACF;CACD;EACE,QAAQ;EACR,QAAQ,CACN,+DACD;EACD,iBAAiB;GACf;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACD;EACD,YAAY;GACV;IACE,QAAQ;IACR,aAAa,CACX,QACA,eACD;GACF;GACD;IACE,QAAQ;IACR,QAAQ,CACN,oDACD;IACD,UAAU;GACX;GACD;IACE,QAAQ;IACR,YAAY;GACb;GACD;IACE,QAAQ;IACR,YAAY;GACb;GACD;IACE,QAAQ;IACR,YAAY;IACZ,OAAO,EACL,SAAS,CACP;KACE,QAAQ;KACR,SAAS;MACP;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;KACD;IACF,GACD;KACE,QAAQ;KACR,QAAQ;IACT,CACF,EACF;GACF;GACD;IACE,QAAQ;IACR,YAAY;IACZ,OAAO,EACL,SAAS,CACP;KACE,QAAQ;KACR,SAAS;MACP;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;KACD;IACF,GACD;KACE,QAAQ;KACR,QAAQ;IACT,CACF,EACF;GACF;GACD;IACE,QAAQ;IACR,OAAO,EACL,SAAS,CACP;KACE,QAAQ;KACR,SAAS;MACP;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;KACD;IACF,GACD;KACE,QAAQ;KACR,QAAQ;IACT,CACF,EACF;GACF;GACD,EACE,QAAQ,gBACT;EACF;EACD,QAAQ,CAAE;CACX;CACD;EACE,QAAQ;EACR,iBAAiB;GACf;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACD;EACD,YAAY;GACV;IACE,QAAQ;IACR,YAAY;IACZ,aAAa,CACX,MACD;GACF;GACD;IACE,QAAQ;IACR,YAAY;IACZ,UAAU;IACV,aAAa,CACX,OACD;GACF;GACD;IACE,QAAQ;IACR,YAAY;GACb;GACD,EACE,QAAQ,iBACT;GACD;IACE,QAAQ;IACR,OAAO,EACL,SAAS;KACP;MACE,QAAQ;MACR,SAAS;OACP;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;MACD;KACF;KACD;MACE,QAAQ;MACR,QAAQ;KACT;KACD;MACE,QAAQ;MACR,QAAQ;KACT;IACF,EACF;GACF;GACD;IACE,QAAQ;IACR,YAAY;IACZ,OAAO,EACL,SAAS;KACP;MACE,QAAQ;MACR,SAAS;OACP;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;MACD;KACF;KACD;MACE,QAAQ;MACR,QAAQ;KACT;KACD;MACE,QAAQ;MACR,QAAQ;KACT;IACF,EACF;GACF;GACD;IACE,QAAQ;IACR,QAAQ,CACN,gEACA,EACD;IACD,YAAY;GACb;GACD,EACE,QAAQ,gBACT;GACD;IACE,QAAQ;IACR,WAAW;GACZ;EACF;EACD,QAAQ;GACN;IACE,QAAQ;IACR,QAAQ;GACT;GACD;IACE,QAAQ;IACR,QAAQ;GACT;GACD;IACE,QAAQ;IACR,QAAQ;GACT;EACF;CACF;CACD;EACE,QAAQ;EACR,iBAAiB;GACf;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACD;EACD,YAAY;GACV;IACE,QAAQ;IACR,YAAY;IACZ,aAAa,CACX,MACD;GACF;GACD;IACE,QAAQ;IACR,YAAY;IACZ,UAAU;IACV,aAAa,CACX,OACD;GACF;GACD;IACE,QAAQ;IACR,YAAY;GACb;GACD,EACE,QAAQ,iBACT;GACD;IACE,QAAQ;IACR,YAAY;IACZ,OAAO,EACL,SAAS;KACP;MACE,QAAQ;MACR,SAAS;OACP;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;OACA;MACD;KACF;KACD;MACE,QAAQ;MACR,QAAQ;KACT;KACD;MACE,QAAQ;MACR,QAAQ;KACT;IACF,EACF;GACF;GACD;IACE,QAAQ;IACR,YAAY;GACb;GACD,EACE,QAAQ,gBACT;EACF;EACD,QAAQ;GACN;IACE,QAAQ;IACR,QAAQ,EACN,UAAU,MACX;GACF;GACD;IACE,QAAQ;IACR,QAAQ,EACN,UAAU,MACX;GACF;GACD;IACE,QAAQ;IACR,QAAQ,EACN,UAAU,MACX;GACF;EACF;CACF;CACD;EACE,QAAQ;EACR,iBAAiB;GACf;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACD;EACD,YAAY;GACV;IACE,QAAQ;IACR,aAAa,CACX,MACD;GACF;GACD;IACE,QAAQ;IACR,YAAY;GACb;GACD;IACE,QAAQ;IACR,UAAU;IACV,aAAa,CACX,OACD;GACF;GACD;IACE,QAAQ;IACR,QAAQ,CACN,iFACD;GACF;EACF;EACD,QAAQ,CAAE;CACX;CACD;EACE,QAAQ;EACR,iBAAiB;GACf;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACD;EACD,YAAY;GACV;IACE,QAAQ;IACR,aAAa,CACX,MACD;GACF;GACD,EACE,QAAQ,OACT;GACD;IACE,QAAQ;IACR,UAAU;IACV,aAAa,CACX,OACD;GACF;GACD;IACE,QAAQ;IACR,YAAY;IACZ,OAAO,EACL,SAAS,CACP;KACE,QAAQ;KACR,SAAS;MACP;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;KACD;IACF,GACD;KACE,QAAQ;KACR,QAAQ;IACT,CACF,EACF;GACF;GACD;IACE,QAAQ;IACR,OAAO,EACL,SAAS,CACP;KACE,QAAQ;KACR,SAAS;MACP;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;KACD;IACF,GACD;KACE,QAAQ;KACR,QAAQ;IACT,CACF,EACF;GACF;GACD;IACE,QAAQ;IACR,YAAY;GACb;GACD,EACE,QAAQ,gBACT;EACF;EACD,QAAQ,CACN;GACE,QAAQ;GACR,QAAQ;EACT,CACF;CACF;CACD;EACE,QAAQ;EACR,iBAAiB;GACf;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACD;EACD,YAAY;GACV;IACE,QAAQ;IACR,aAAa,CACX,MACD;GACF;GACD,EACE,QAAQ,OACT;GACD;IACE,QAAQ;IACR,YAAY;IACZ,OAAO,EACL,SAAS,CACP;KACE,QAAQ;KACR,SAAS;MACP;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;KACD;IACF,GACD;KACE,QAAQ;KACR,QAAQ;IACT,CACF,EACF;GACF;GACD;IACE,QAAQ;IACR,OAAO,EACL,SAAS,CACP;KACE,QAAQ;KACR,SAAS;MACP;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;KACD;IACF,GACD;KACE,QAAQ;KACR,QAAQ;IACT,CACF,EACF;GACF;GACD;IACE,QAAQ;IACR,YAAY;IACZ,aAAa,CACX,MACD;GACF;GACD,EACE,QAAQ,gBACT;EACF;EACD,QAAQ,CACN;GACE,QAAQ;GACR,QAAQ;EACT,CACF;CACF;CACD;EACE,QAAQ;EACR,iBAAiB;GACf;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACD;EACD,YAAY;GACV;IACE,QAAQ;IACR,aAAa,CACX,MACD;GACF;GACD,EACE,QAAQ,OACT;GACD;IACE,QAAQ;IACR,UAAU;IACV,aAAa,CACX,OACD;GACF;GACD;IACE,QAAQ;IACR,YAAY;IACZ,OAAO,EACL,SAAS,CACP;KACE,QAAQ;KACR,SAAS;MACP;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;KACD;IACF,GACD;KACE,QAAQ;KACR,QAAQ;IACT,CACF,EACF;GACF;GACD;IACE,QAAQ;IACR,OAAO,EACL,SAAS,CACP;KACE,QAAQ;KACR,SAAS;MACP;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;KACD;IACF,GACD;KACE,QAAQ;KACR,QAAQ;IACT,CACF,EACF;GACF;GACD;IACE,QAAQ;IACR,YAAY;GACb;GACD,EACE,QAAQ,gBACT;EACF;EACD,QAAQ,CACN;GACE,QAAQ;GACR,QAAQ;EACT,CACF;CACF;CACD;EACE,QAAQ;EACR,iBAAiB;GACf;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACD;EACD,YAAY;GACV;IACE,QAAQ;IACR,YAAY;GACb;GACD;IACE,QAAQ;IACR,UAAU;IACV,aAAa,CACX,eACD;GACF;GACD;IACE,QAAQ;IACR,YAAY;IACZ,UAAU;GACX;EACF;EACD,QAAQ,CAAE;CACX;CACD;EACE,QAAQ;EACR,QAAQ,CACN,8CACD;EACD,iBAAiB;GACf;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACD;EACD,YAAY;GACV,EACE,QAAQ,cACT;GACD;IACE,QAAQ;IACR,YAAY;IACZ,UAAU;GACX;GACD;IACE,QAAQ;IACR,UAAU;GACX;GACD;IACE,QAAQ;IACR,YAAY;IACZ,UAAU;GACX;GACD;IACE,QAAQ;IACR,WAAW;GACZ;EACF;EACD,QAAQ,CAAE;CACX;CACD;EACE,QAAQ;EACR,iBAAiB;GACf;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACD;EACD,YAAY;GACV;IACE,QAAQ;IACR,UAAU;GACX;GACD,EACE,QAAQ,cACT;GACD;IACE,QAAQ;IACR,YAAY;IACZ,OAAO,EACL,SAAS;KACP;MACE,QAAQ;MACR,SAAS;OACP;OACA;OACA;OACA;OACA;OACA;OACA;OACA;MACD;KACF;KACD;MACE,QAAQ;MACR,QAAQ;KACT;KACD;MACE,QAAQ;MACR,QAAQ;KACT;KACD;MACE,QAAQ;MACR,QAAQ;KACT;IACF,EACF;GACF;GACD;IACE,QAAQ;IACR,YAAY;IACZ,UAAU;GACX;GACD;IACE,QAAQ;IACR,WAAW;GACZ;EACF;EACD,QAAQ,CACN;GACE,QAAQ;GACR,QAAQ;EACT,GACD;GACE,QAAQ;GACR,QAAQ;EACT,CACF;CACF;CACD;EACE,QAAQ;EACR,iBAAiB;GACf;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACD;EACD,YAAY;GACV;IACE,QAAQ;IACR,YAAY;GACb;GACD;IACE,QAAQ;IACR,UAAU;IACV,aAAa,CACX,eACD;GACF;GACD;IACE,QAAQ;IACR,QAAQ,CACN,6EACA,EACD;GACF;EACF;EACD,QAAQ,CAAE;CACX;CACD;EACE,QAAQ;EACR,iBAAiB;GACf;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACD;EACD,YAAY,CACV;GACE,QAAQ;GACR,YAAY;EACb,GACD;GACE,QAAQ;GACR,UAAU;GACV,aAAa,CACX,aACD;EACF,CACF;EACD,QAAQ;GACN;IACE,QAAQ;IACR,QAAQ;GACT;GACD;IACE,QAAQ;IACR,QAAQ;GACT;GACD;IACE,QAAQ;IACR,QAAQ;GACT;EACF;CACF;CACD;EACE,QAAQ;EACR,iBAAiB;GACf;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACD;EACD,YAAY;GACV;IACE,QAAQ;IACR,YAAY;IACZ,UAAU;GACX;GACD;IACE,QAAQ;IACR,YAAY;IACZ,UAAU;GACX;GACD;IACE,QAAQ;IACR,OAAO,EACL,SAAS,CACP;KACE,QAAQ;KACR,SAAS;MACP;MACA;MACA;MACA;MACA;MACA;MACA;MACA;KACD;IACF,CACF,EACF;GACF;GACD;IACE,QAAQ;IACR,WAAW;GACZ;EACF;EACD,QAAQ,CACN;GACE,QAAQ;GACR,QAAQ;EACT,CACF;CACF;CACD;EACE,QAAQ;EACR,QAAQ,CACN,yEACD;EACD,iBAAiB;GACf;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACD;EACD,YAAY,CACV;GACE,QAAQ;GACR,OAAO,EACL,SAAS,CACP;IACE,QAAQ;IACR,SAAS;KACP;KACA;KACA;KACA;KACA;KACA;KACA;KACA;IACD;GACF,CACF,EACF;EACF,GACD;GACE,QAAQ;GACR,QAAQ,CACN,4EACD;GACD,YAAY;EACb,CACF;EACD,QAAQ,CAAE;CACX;CACD;EACE,QAAQ;EACR,iBAAiB;GACf;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACD;EACD,YAAY;GACV;IACE,QAAQ;IACR,aAAa,CACX,iBACD;GACF;GACD,EACE,QAAQ,kBACT;GACD;IACE,QAAQ;IACR,YAAY;GACb;EACF;EACD,QAAQ,CAAE;CACX;CACD;EACE,QAAQ;EACR,iBAAiB;GACf;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACD;EACD,YAAY;GACV;IACE,QAAQ;IACR,aAAa,CACX,eACD;GACF;GACD;IACE,QAAQ;IACR,YAAY;GACb;GACD;IACE,QAAQ;IACR,UAAU;IACV,aAAa,CACX,OACD;GACF;EACF;EACD,QAAQ,CACN;GACE,QAAQ;GACR,QAAQ;EACT,CACF;CACF;CACD;EACE,QAAQ;EACR,iBAAiB;GACf;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACD;EACD,YAAY;GACV;IACE,QAAQ;IACR,YAAY;GACb;GACD;IACE,QAAQ;IACR,aAAa,CACX,eACD;GACF;GACD;IACE,QAAQ;IACR,UAAU;IACV,aAAa,CACX,eACD;GACF;GACD,EACE,QAAQ,gBACT;GACD;IACE,QAAQ;IACR,YAAY;IACZ,UAAU;GACX;EACF;EACD,QAAQ,CAAE;CACX;CACD;EACE,QAAQ;EACR,iBAAiB;GACf;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACD;EACD,YAAY;GACV;IACE,QAAQ;IACR,aAAa,CACX,eACD;GACF;GACD;IACE,QAAQ;IACR,YAAY;GACb;GACD;IACE,QAAQ;IACR,UAAU;IACV,aAAa,CACX,OACD;GACF;EACF;EACD,QAAQ,CACN;GACE,QAAQ;GACR,QAAQ;EACT,CACF;CACF;AACF;eACW;CACV;EACE,QAAQ;EACR,iBAAiB;GACf;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACD;CACF;CACD;EACE,QAAQ;EACR,iBAAiB;GACf;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACD;CACF;CACD;EACE,QAAQ;EACR,iBAAiB;GACf;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACD;CACF;CACD;EACE,QAAQ;EACR,iBAAiB;GACf;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACD;CACF;CACD;EACE,QAAQ;EACR,iBAAiB;GACf;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACD;CACF;AACF;aACS;CACR;EACE,QAAQ;EACR,iBAAiB;GACf;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACD;CACF;CACD;EACE,QAAQ;EACR,iBAAiB;GACf;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACD;CACF;CACD;EACE,QAAQ;EACR,iBAAiB;GACf;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACD;CACF;CACD;EACE,QAAQ;EACR,iBAAiB;GACf;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACD;CACF;CACD;EACE,QAAQ;EACR,iBAAiB;GACf;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACD;CACF;CACD;EACE,QAAQ;EACR,iBAAiB;GACf;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACD;CACF;CACD;EACE,QAAQ;EACR,iBAAiB;GACf;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACD;CACF;CACD;EACE,QAAQ;EACR,iBAAiB;GACf;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACD;CACF;CACD;EACE,QAAQ;EACR,iBAAiB;GACf;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACD;CACF;CACD;EACE,QAAQ;EACR,iBAAiB;GACf;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACD;CACF;CACD;EACE,QAAQ;EACR,iBAAiB;GACf;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACD;CACF;CACD;EACE,QAAQ;EACR,iBAAiB;GACf;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACD;CACF;CACD;EACE,QAAQ;EACR,iBAAiB;GACf;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACD;CACF;CACD;EACE,QAAQ;EACR,iBAAiB;GACf;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACD;CACF;CACD;EACE,QAAQ;EACR,iBAAiB;GACf;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACD;CACF;CACD;EACE,QAAQ;EACR,iBAAiB;GACf;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACD;CACF;CACD;EACE,QAAQ;EACR,iBAAiB;GACf;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACD;CACF;CACD;EACE,QAAQ;EACR,iBAAiB;GACf;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACD;CACF;AACF;aACS;CACR;EACE,QAAQ;EACR,QAAQ;EACR,OAAO;CACR;CACD;EACE,QAAQ;EACR,QAAQ;EACR,OAAO;CACR;CACD;EACE,QAAQ;EACR,QAAQ;EACR,OAAO;CACR;CACD;EACE,QAAQ;EACR,QAAQ;EACR,OAAO;CACR;CACD;EACE,QAAQ;EACR,QAAQ;EACR,OAAO;CACR;CACD;EACE,QAAQ;EACR,QAAQ;EACR,OAAO;CACR;CACD;EACE,QAAQ;EACR,QAAQ;EACR,OAAO;CACR;CACD;EACE,QAAQ;EACR,QAAQ;EAC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QAAQ,gBACT,EACF;IACF;IACD;KACE,QAAQ;KACR,QAAQ,EACN,WAAW,EACT,QAAQ,gBACT,EACF;IACF;IACD;KACE,QAAQ;KACR,QAAQ,EACN,WAAW,EACT,QAAQ,gBACT,EACF;IACF;IACD;KACE,QAAQ;KACR,QAAQ;IACT;IACD;KACE,QAAQ;KACR,QAAQ,EACN,WAAW,EACT,QAAQ,aACT,EACF;IACF;IACD;KACE,QAAQ;KACR,QAAQ;MACN;MACA;MACA;MACA;MACA;MACA;MACA;KACD;KACD,QAAQ;IACT;IACD;KACE,QAAQ;KACR,QAAQ,CACN,6FACA,yCACD;KACD,QAAQ;IACT;IACD;KACE,QAAQ;KACR,QAAQ,EACN,WAAW,EACT,QAAQ,gBACT,EACF;IACF;IACD;KACE,QAAQ;KACR,QAAQ;IACT;IACD;KACE,QAAQ;KACR,QAAQ,CACN,qGACD;KACD,QAAQ,EACN,WAAW,EACT,QAAQ,gBACT,EACF;IACF;IACD;KACE,QAAQ;KACR,QAAQ,CACN,6FACA,wDACD;KACD,QAAQ,EACN,WAAW,EACT,QAAQ,gBACT,EACF;IACF;IACD;KACE,QAAQ;KACR,QAAQ;MACN;MACA;MACA;KACD;KACD,QAAQ;IACT;IACD;KACE,QAAQ;KACR,QAAQ,EACN,SAAS,CACP,MACA,CACD,EACF;IACF;IACD;KACE,QAAQ;KACR,QAAQ,EACN,SAAS,CACP,EACE,SAAS,CACP,OACA,CACD,EACF,GACD,EACD,EACF;IACF;GACF;EACF;CACF;CACD;EACE,QAAQ;EACR,QAAQ,CACN,sEACD;EACD,QAAQ,EACN,QAAQ,IACT;EACD,QAAQ;GACN,QAAQ;GACR,UAAU;IACR;KACE,QAAQ;KACR,QAAQ,EACN,WAAW,EACT,QAAQ,gBACT,EACF;IACF;IACD;KACE,QAAQ;KACR,QAAQ,EACN,WAAW,EACT,QAAQ,gBACT,EACF;IACF;IACD;KACE,QAAQ;KACR,QAAQ,EACN,WAAW,EACT,QAAQ,gBACT,EACF;IACF;IACD;KACE,QAAQ;KACR,QAAQ,EACN,WAAW,EACT,QAAQ,gBACT,EACF;IACF;IACD;KACE,QAAQ;KACR,QAAQ;IACT;IACD;KACE,QAAQ;KACR,QAAQ,EACN,WAAW,EACT,QAAQ,qBACT,EACF;IACF;IACD;KACE,QAAQ;KACR,QAAQ,EACN,WAAW,EACT,QAAQ,uBACT,EACF;IACF;IACD;KACE,QAAQ;KACR,QAAQ,EACN,WAAW,EACT,QAAQ,cACT,EACF;IACF;IACD;KACE,QAAQ;KACR,QAAQ,EACN,SAAS,CACP,UACA,CACD,EACF;IACF;IACD;KACE,QAAQ;KACR,QAAQ,EACN,SAAS,CACP,MACA,CACD,EACF;IACF;IACD;KACE,QAAQ;KACR,QAAQ;IACT;IACD;KACE,QAAQ;KACR,QAAQ,EACN,WAAW,EACT,QAAQ,WACT,EACF;IACF;IACD;KACE,QAAQ;KACR,QAAQ;MACN;MACA;MACA;MACA;MACA;MACA;MACA;MACA;KACD;KACD,QAAQ;IACT;IACD;KACE,QAAQ;KACR,QAAQ,EACN,SAAS,CACP,MACA,CACD,EACF;IACF;IACD;KACE,QAAQ;KACR,QAAQ;MACN;MACA;MACA;MACA;MACA;MACA;MACA;MACA;KACD;KACD,QAAQ;IACT;IACD;KACE,QAAQ;KACR,QAAQ,CACN,yEACD;KACD,QAAQ;IACT;IACD;KACE,QAAQ;KACR,QAAQ,EACN,SAAS,CACP,MACA,CACD,EACF;IACF;IACD;KACE,QAAQ;KACR,QAAQ,EACN,SAAS,CACP,MACA,EACD,EACF;IACF;GACF;EACF;CACF;CACD;EACE,QAAQ;EACR,QAAQ,CACN,sEACD;EACD,QAAQ,EACN,QAAQ,IACT;EACD,QAAQ;GACN,QAAQ;GACR,UAAU;IACR;KACE,QAAQ;KACR,QAAQ,EACN,WAAW,EACT,QAAQ,gBACT,EACF;IACF;IACD;KACE,QAAQ;KACR,QAAQ,EACN,WAAW,EACT,QAAQ,gBACT,EACF;IACF;IACD;KACE,QAAQ;KACR,QAAQ,EACN,WAAW,EACT,QAAQ,gBACT,EACF;IACF;IACD;KACE,QAAQ;KACR,QAAQ,EACN,WAAW,EACT,QAAQ,gBACT,EACF;IACF;IACD;KACE,QAAQ;KACR,QAAQ;IACT;IACD;KACE,QAAQ;KACR,QAAQ,EACN,WAAW,EACT,QAAQ,4BACT,EACF;IACF;IACD;KACE,QAAQ;KACR,QAAQ,EACN,WAAW,EACT,QAAQ,uBACT,EACF;IACF;IACD;KACE,QAAQ;KACR,QAAQ;IACT;IACD;KACE,QAAQ;KACR,QAAQ,EACN,WAAW,EACT,QAAQ,WACT,EACF;IACF;IACD;KACE,QAAQ;KACR,QAAQ;MACN;MACA;MACA;MACA;MACA;MACA;MACA;MACA;KACD;KACD,QAAQ;IACT;IACD;KACE,QAAQ;KACR,QAAQ,EACN,SAAS,CACP,MACA,CACD,EACF;IACF;IACD;KACE,QAAQ;KACR,QAAQ;MACN;MACA;MACA;MACA;MACA;MACA;MACA;MACA;KACD;KACD,QAAQ;IACT;IACD;KACE,QAAQ;KACR,QAAQ,CACN,yEACD;KACD,QAAQ;IACT;GACF;EACF;CACF;CACD;EACE,QAAQ;EACR,QAAQ;GACN,QAAQ;GACR,UAAU;IACR;KACE,QAAQ;KACR,QAAQ,EACN,UAAU,EACR,WAAW,EACT,QAAQ,gBACT,EACF,EACF;IACF;IACD;KACE,QAAQ;KACR,QAAQ,EACN,UAAU,EACR,WAAW,EACT,QAAQ,gBACT,EACF,EACF;IACF;IACD;KACE,QAAQ;KACR,QAAQ,EACN,UAAU,EACR,WAAW,EACT,QAAQ,gBACT,EACF,EACF;IACF;IACD;KACE,QAAQ;KACR,QAAQ,EACN,UAAU,EACR,WAAW,EACT,QAAQ,gBACT,EACF,EACF;IACF;IACD;KACE,QAAQ;KACR,QAAQ,EACN,UAAU,MACX;IACF;IACD;KACE,QAAQ;KACR,QAAQ,EACN,UAAU,MACX;IACF;IACD;KACE,QAAQ;KACR,QAAQ,EACN,UAAU,EACR,WAAW,EACT,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KACR,QAAQ,EACN,SAAS,CACP,MACA,CACD,EACF;IACF;IACD;KACE,QAAQ;KACR,QAAQ,CACN,gEACD;KACD,QAAQ,EACN,WAAW,EACT,QAAQ,gBACT,EACF;IACF;IACD;KACE,QAAQ;KACR,QAAQ,CACN,gEACD;KACD,QAAQ,EACN,WAAW,EACT,QAAQ,gBACT,EACF;IACF;GACF;EACF;CACF;CACD;EACE,QAAQ;EACR,QAAQ,CACN,oGACA,6DACD;EACD,QAAQ,EACN,QAAQ,IACT;EACD,QAAQ;GACN,QAAQ;GACR,UAAU;IACR;KACE,QAAQ;KACR,QAAQ;MACN;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;KACD;KACD,QAAQ;IACT;IACD;KACE,QAAQ;KACR,QAAQ,EACN,SAAS,CACP,MACA,CACD,EACF;IACF;IACD;KACE,QAAQ;KACR,QAAQ,CACN,wEACD;KACD,QAAQ;IACT;IACD;KACE,QAAQ;KACR,QAAQ,CACN,2DACA,uCACD;KACD,QAAQ;IACT;IACD;KACE,QAAQ;KACR,QAAQ,EACN,WAAW,EACT,QAAQ,cACT,EACF;IACF;GACF;EACF;CACF;CACD;EACE,QAAQ;EACR,QAAQ,CACN,wGACD;EACD,iBAAiB;EACjB,QAAQ,EACN,QAAQ,IACT;EACD,QAAQ;GACN,QAAQ;GACR,UAAU;IACR;KACE,QAAQ;KACR,QAAQ,CACN,kEACD;KACD,QAAQ;IACT;IACD;KACE,QAAQ;KACR,QAAQ,CACN,iBACD;KACD,QAAQ;IACT;IACD;KACE,QAAQ;KACR,QAAQ,CACN,8FACA,qDACD;KACD,QAAQ;IACT;IACD;KACE,QAAQ;KACR,QAAQ;IACT;IACD;KACE,QAAQ;KACR,QAAQ,CACN,kEACA,+BACD;KACD,QAAQ;IACT;IACD;KACE,QAAQ;KACR,QAAQ;IACT;IACD;KACE,QAAQ;KACR,QAAQ,EACN,SAAS,CACP,MACA,CACD,EACF;IACF;IACD;KACE,QAAQ;KACR,QAAQ,EACN,SAAS,CACP,MACA,EACD,EACF;IACF;IACD;KACE,QAAQ;KACR,QAAQ,CACN,oDACD;KACD,QAAQ,EACN,WAAW,EACT,QAAQ,gBACT,EACF;IACF;IACD;KACE,QAAQ;KACR,QAAQ,CACN,oDACD;KACD,QAAQ,EACN,WAAW,EACT,QAAQ,gBACT,EACF;IACF;IACD;KACE,QAAQ;KACR,QAAQ,EACN,SAAS,CACP,MACA,EACD,EACF;IACF;IACD;KACE,QAAQ;KACR,QAAQ,EACN,SAAS,CACP,MACA,EACD,EACF;IACF;GACF;EACF;CACF;CACD;EACE,QAAQ;EACR,QAAQ,EACN,QAAQ,IACT;EACD,QAAQ;GACN,QAAQ;GACR,UAAU;IACR;KACE,QAAQ;KACR,QAAQ;IACT;IACD;KACE,QAAQ;KACR,QAAQ,EACN,WAAW,EACT,QAAQ,gBACT,EACF;IACF;IACD;KACE,QAAQ;KACR,QAAQ,EACN,WAAW,EACT,QAAQ,gBACT,EACF;IACF;IACD;KACE,QAAQ;KACR,QAAQ;IACT;GACF;EACF;CACF;CACD;EACE,QAAQ;EACR,QAAQ;GACN,QAAQ;GACR,UAAU,CACR;IACE,QAAQ;IACR,QAAQ,EACN,UAAU,SACX;GACF,GACD;IACE,QAAQ;IACR,QAAQ;GACT,CACF;EACF;CACF;CACD;EACE,QAAQ;EACR,QAAQ;GACN;GACA;GACA;GACA;GACA;EACD;EACD,QAAQ,EACN,QAAQ,IACT;EACD,QAAQ;GACN,QAAQ;GACR,UAAU;IACR;KACE,QAAQ;KACR,QAAQ;MACN;MACA;MACA;MACA;KACD;KACD,QAAQ,EACN,WAAW,EACT,QAAQ,gBACT,EACF;IACF;IACD;KACE,QAAQ;KACR,QAAQ;MACN;MACA;MACA;MACA;KACD;KACD,QAAQ,EACN,WAAW,EACT,QAAQ,gBACT,EACF;IACF;IACD;KACE,QAAQ;KACR,QAAQ;MACN;MACA;MACA;MACA;MACA;KACD;KACD,QAAQ,EACN,WAAW,EACT,QAAQ,gBACT,EACF;IACF;IACD;KACE,QAAQ;KACR,QAAQ;MACN;MACA;MACA;MACA;MACA;KACD;KACD,QAAQ,EACN,WAAW,EACT,QAAQ,gBACT,EACF;IACF;IACD;KACE,QAAQ;KACR,QAAQ;MACN;MACA;MACA;MACA;MACA;KACD;KACD,QAAQ,EACN,WAAW,EACT,QAAQ,gBACT,EACF;IACF;IACD;KACE,QAAQ;KACR,QAAQ;MACN;MACA;MACA;MACA;MACA;KACD;KACD,QAAQ,EACN,WAAW,EACT,QAAQ,gBACT,EACF;IACF;IACD;KACE,QAAQ;KACR,QAAQ,CACN,uEACD;KACD,QAAQ;IACT;IACD;KACE,QAAQ;KACR,QAAQ;MACN;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;KACD;KACD,QAAQ;IACT;IACD;KACE,QAAQ;KACR,QAAQ,CACN,+FACA,+DACD;KACD,QAAQ;IACT;IACD;KACE,QAAQ;KACR,QAAQ;MACN;MACA;MACA;KACD;KACD,QAAQ,EACN,SAAS,CACP,EACE,SAAS,CACP,MACA,CACD,EACF,GACD,EACD,EACF;IACF;IACD;KACE,QAAQ;KACR,QAAQ,CACN,8FACA,2FACD;KACD,QAAQ;IACT;IACD;KACE,QAAQ;KACR,QAAQ,CACN,mDACD;KACD,QAAQ;IACT;IACD;KACE,QAAQ;KACR,QAAQ,CACN,qEACD;KACD,QAAQ;IACT;IACD;KACE,QAAQ;KACR,QAAQ,EACN,SAAS,CACP,MACA,CACD,EACF;IACF;IACD;KACE,QAAQ;KACR,QAAQ;IACT;IACD;KACE,QAAQ;KACR,QAAQ;IACT;IACD;KACE,QAAQ;KACR,QAAQ,EACN,SAAS,CACP,MACA,EACD,EACF;IACF;IACD;KACE,QAAQ;KACR,QAAQ,EACN,SAAS,CACP,MACA,EACD,EACF;IACF;GACF;EACF;CACF;CACD;EACE,QAAQ;EACR,QAAQ;GACN,QAAQ;GACR,UAAU,CACR;IACE,QAAQ;IACR,QAAQ;GACT,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;IACT;IACD;KACE,QAAQ;KACR,QAAQ;IACT;IACD;KACE,QAAQ;KACR,QAAQ,EACN,WAAW,EACT,QAAQ,iBACT,EACF;IACF;IACD;KACE,QAAQ;KACR,QAAQ;MACN;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;KACD;KACD,QAAQ;IACT;IACD;KACE,QAAQ;KACR,QAAQ;MACN;MACA;MACA;MACA;KACD;KACD,QAAQ;IACT;IACD;KACE,QAAQ;KACR,QAAQ,EACN,WAAW,EACT,QAAQ,cACT,EACF;IACF;IACD;KACE,QAAQ;KACR,QAAQ,EACN,SAAS,CACP,OACA,EACD,EACF;IACF;GACF;EACF;CACF;CACD;EACE,QAAQ;EACR,QAAQ;GACN,QAAQ;GACR,UAAU,CACR;IACE,QAAQ;IACR,QAAQ,EACN,WAAW,EACT,QAAQ,qBACT,EACF;GACF,CACF;EACF;CACF;CACD;EACE,QAAQ;EACR,QAAQ;GACN,QAAQ;GACR,UAAU;IACR;KACE,QAAQ;KACR,QAAQ,EACN,WAAW,EACT,QAAQ,qBACT,EACF;IACF;IACD;KACE,QAAQ;KACR,QAAQ;IACT;IACD;KACE,QAAQ;KACR,QAAQ;IACT;GACF;EACF;CACF;CACD;EACE,QAAQ;EACR,iBAAiB;EACjB,QAAQ,EACN,QAAQ,IACT;EACD,QAAQ;GACN,QAAQ;GACR,UAAU;IACR;KACE,QAAQ;KACR,QAAQ;IACT;IACD;KACE,QAAQ;KACR,QAAQ;MACN;MACA;MACA;MACA;KACD;KACD,QAAQ;IACT;IACD;KACE,QAAQ;KACR,QAAQ,CACN,8FACD;KACD,QAAQ,EACN,WAAW,EACT,QAAQ,gBACT,EACF;IACF;IACD;KACE,QAAQ;KACR,QAAQ;IACT;IACD;KACE,QAAQ;KACR,QAAQ,EACN,SAAS,CACP,MACA,CACD,EACF;IACF;IACD;KACE,QAAQ;KACR,QAAQ;MACN;MACA;MACA;KACD;KACD,QAAQ;IACT;IACD;KACE,QAAQ;KACR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