@0dotxyz/p0-ts-sdk 2.3.1 → 2.3.3
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/dist/index.cjs +322 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +211 -6
- package/dist/index.d.ts +211 -6
- package/dist/index.js +309 -8
- package/dist/index.js.map +1 -1
- package/dist/instructions.d.cts +1 -1
- package/dist/instructions.d.ts +1 -1
- package/dist/{types-BC4kJXuQ.d.ts → types-Cxl2AUvk.d.ts} +59 -2
- package/dist/{types-6ULf9Ciw.d.cts → types-DtUR-yHt.d.cts} +59 -2
- package/package.json +2 -1
package/dist/index.js
CHANGED
|
@@ -8,6 +8,7 @@ import { struct, u32, u8 } from '@solana/buffer-layout';
|
|
|
8
8
|
import { publicKey, u64, bool } from '@solana/buffer-layout-utils';
|
|
9
9
|
import { Buffer as Buffer$1 } from 'buffer';
|
|
10
10
|
import { deserialize } from 'borsh';
|
|
11
|
+
import bs58 from 'bs58';
|
|
11
12
|
import * as borsh from '@coral-xyz/borsh';
|
|
12
13
|
import { struct as struct$1, bool as bool$1, publicKey as publicKey$1, array as array$1, u64 as u64$1, u8 as u8$1, u32 as u32$1, u128 } from '@coral-xyz/borsh';
|
|
13
14
|
import WebSocket from 'ws';
|
|
@@ -202,6 +203,15 @@ var TransactionBuildingError = class _TransactionBuildingError extends Error {
|
|
|
202
203
|
return new _TransactionBuildingError(code, message, details);
|
|
203
204
|
}
|
|
204
205
|
};
|
|
206
|
+
var DECOMPOSABLE_SWAP_ERROR_CODES = /* @__PURE__ */ new Set([
|
|
207
|
+
"SWAP_SIZE_EXCEEDED_LOOP" /* SWAP_SIZE_EXCEEDED_LOOP */,
|
|
208
|
+
"SWAP_SIZE_EXCEEDED_REPAY" /* SWAP_SIZE_EXCEEDED_REPAY */,
|
|
209
|
+
"SWAP_SIZE_EXCEEDED_POSITION_SWAP" /* SWAP_SIZE_EXCEEDED_POSITION_SWAP */,
|
|
210
|
+
"SWAP_QUOTE_FAILED" /* SWAP_QUOTE_FAILED */
|
|
211
|
+
]);
|
|
212
|
+
function isDecomposableSwapError(e) {
|
|
213
|
+
return e instanceof TransactionBuildingError && DECOMPOSABLE_SWAP_ERROR_CODES.has(e.code);
|
|
214
|
+
}
|
|
205
215
|
var PDA_BANK_LIQUIDITY_VAULT_AUTH_SEED = Buffer.from("liquidity_vault_auth");
|
|
206
216
|
var PDA_BANK_INSURANCE_VAULT_AUTH_SEED = Buffer.from("insurance_vault_auth");
|
|
207
217
|
var PDA_BANK_FEE_VAULT_AUTH_SEED = Buffer.from("fee_vault_auth");
|
|
@@ -16016,8 +16026,10 @@ function toBankDto(bank) {
|
|
|
16016
16026
|
emissionsRate: bank.emissionsRate,
|
|
16017
16027
|
emissionsMint: bank.emissionsMint.toBase58(),
|
|
16018
16028
|
emissionsRemaining: bank.emissionsRemaining.toString(),
|
|
16029
|
+
collectedProgramFeesOutstanding: bank.collectedProgramFeesOutstanding.toString(),
|
|
16019
16030
|
oracleKey: bank.oracleKey.toBase58(),
|
|
16020
16031
|
emode: toEmodeSettingsDto(bank.emode),
|
|
16032
|
+
rateLimiter: bank.rateLimiter ? toBankRateLimiterDto(bank.rateLimiter) : void 0,
|
|
16021
16033
|
tokenSymbol: bank.tokenSymbol,
|
|
16022
16034
|
feesDestinationAccount: bank.feesDestinationAccount?.toBase58(),
|
|
16023
16035
|
lendingPositionCount: bank.lendingPositionCount?.toString(),
|
|
@@ -16042,6 +16054,21 @@ function toBankDto(bank) {
|
|
|
16042
16054
|
} : void 0
|
|
16043
16055
|
};
|
|
16044
16056
|
}
|
|
16057
|
+
function toRateLimitWindowDto(window) {
|
|
16058
|
+
return {
|
|
16059
|
+
maxOutflow: window.maxOutflow.toString(),
|
|
16060
|
+
windowDuration: window.windowDuration,
|
|
16061
|
+
windowStart: window.windowStart,
|
|
16062
|
+
prevWindowOutflow: window.prevWindowOutflow.toString(),
|
|
16063
|
+
curWindowOutflow: window.curWindowOutflow.toString()
|
|
16064
|
+
};
|
|
16065
|
+
}
|
|
16066
|
+
function toBankRateLimiterDto(rateLimiter) {
|
|
16067
|
+
return {
|
|
16068
|
+
hourly: toRateLimitWindowDto(rateLimiter.hourly),
|
|
16069
|
+
daily: toRateLimitWindowDto(rateLimiter.daily)
|
|
16070
|
+
};
|
|
16071
|
+
}
|
|
16045
16072
|
function toEmodeSettingsDto(emodeSettings) {
|
|
16046
16073
|
return {
|
|
16047
16074
|
emodeTag: emodeSettings.emodeTag,
|
|
@@ -16120,6 +16147,8 @@ function bankRawToDto(bankRaw) {
|
|
|
16120
16147
|
emissionsRate: bankRaw.emissionsRate.toString(),
|
|
16121
16148
|
emissionsRemaining: bankRaw.emissionsRemaining,
|
|
16122
16149
|
emissionsMint: bankRaw.emissionsMint.toBase58(),
|
|
16150
|
+
collectedProgramFeesOutstanding: bankRaw.collectedProgramFeesOutstanding,
|
|
16151
|
+
rateLimiter: bankRaw.rateLimiter ? bankRateLimiterRawToDto(bankRaw.rateLimiter) : void 0,
|
|
16123
16152
|
feesDestinationAccount: bankRaw?.feesDestinationAccount?.toBase58(),
|
|
16124
16153
|
lendingPositionCount: bankRaw?.lendingPositionCount?.toString(),
|
|
16125
16154
|
borrowingPositionCount: bankRaw?.borrowingPositionCount?.toString(),
|
|
@@ -16129,6 +16158,21 @@ function bankRawToDto(bankRaw) {
|
|
|
16129
16158
|
integrationAcc3: bankRaw.integrationAcc3.toBase58()
|
|
16130
16159
|
};
|
|
16131
16160
|
}
|
|
16161
|
+
function rateLimitWindowRawToDto(window) {
|
|
16162
|
+
return {
|
|
16163
|
+
maxOutflow: window.maxOutflow.toString(),
|
|
16164
|
+
windowDuration: window.windowDuration.toString(),
|
|
16165
|
+
windowStart: window.windowStart.toString(),
|
|
16166
|
+
prevWindowOutflow: window.prevWindowOutflow.toString(),
|
|
16167
|
+
curWindowOutflow: window.curWindowOutflow.toString()
|
|
16168
|
+
};
|
|
16169
|
+
}
|
|
16170
|
+
function bankRateLimiterRawToDto(rateLimiter) {
|
|
16171
|
+
return {
|
|
16172
|
+
hourly: rateLimitWindowRawToDto(rateLimiter.hourly),
|
|
16173
|
+
daily: rateLimitWindowRawToDto(rateLimiter.daily)
|
|
16174
|
+
};
|
|
16175
|
+
}
|
|
16132
16176
|
function emodeSettingsRawToDto(emodeSettingsRaw) {
|
|
16133
16177
|
return {
|
|
16134
16178
|
emodeTag: emodeSettingsRaw.emodeTag,
|
|
@@ -16228,6 +16272,21 @@ function parseEmodeSettingsRaw(emodeSettingsRaw) {
|
|
|
16228
16272
|
};
|
|
16229
16273
|
return emodeSettings;
|
|
16230
16274
|
}
|
|
16275
|
+
function parseRateLimitWindowRaw(window) {
|
|
16276
|
+
return {
|
|
16277
|
+
maxOutflow: new BigNumber3(window.maxOutflow.toString()),
|
|
16278
|
+
windowDuration: window.windowDuration.toNumber(),
|
|
16279
|
+
windowStart: window.windowStart.toNumber(),
|
|
16280
|
+
prevWindowOutflow: new BigNumber3(window.prevWindowOutflow.toString()),
|
|
16281
|
+
curWindowOutflow: new BigNumber3(window.curWindowOutflow.toString())
|
|
16282
|
+
};
|
|
16283
|
+
}
|
|
16284
|
+
function parseBankRateLimiterRaw(rateLimiter) {
|
|
16285
|
+
return {
|
|
16286
|
+
hourly: parseRateLimitWindowRaw(rateLimiter.hourly),
|
|
16287
|
+
daily: parseRateLimitWindowRaw(rateLimiter.daily)
|
|
16288
|
+
};
|
|
16289
|
+
}
|
|
16231
16290
|
function parseBankRaw(address, accountParsed, bankMetadata) {
|
|
16232
16291
|
const flags = accountParsed.flags.toNumber();
|
|
16233
16292
|
const mint = accountParsed.mint;
|
|
@@ -16259,8 +16318,10 @@ function parseBankRaw(address, accountParsed, bankMetadata) {
|
|
|
16259
16318
|
const emissionsRate = accountParsed.emissionsRate.toNumber();
|
|
16260
16319
|
const emissionsMint = accountParsed.emissionsMint;
|
|
16261
16320
|
const emissionsRemaining = accountParsed.emissionsRemaining ? wrappedI80F48toBigNumber(accountParsed.emissionsRemaining) : new BigNumber3(0);
|
|
16321
|
+
const collectedProgramFeesOutstanding = accountParsed.collectedProgramFeesOutstanding ? wrappedI80F48toBigNumber(accountParsed.collectedProgramFeesOutstanding) : new BigNumber3(0);
|
|
16262
16322
|
const { oracleKey } = { oracleKey: config.oracleKeys[0] };
|
|
16263
16323
|
const emode = parseEmodeSettingsRaw(accountParsed.emode);
|
|
16324
|
+
const rateLimiter = accountParsed.rateLimiter ? parseBankRateLimiterRaw(accountParsed.rateLimiter) : void 0;
|
|
16264
16325
|
const tokenSymbol = bankMetadata?.tokenSymbol;
|
|
16265
16326
|
const feesDestinationAccount = accountParsed.feesDestinationAccount;
|
|
16266
16327
|
const lendingPositionCount = accountParsed.lendingPositionCount ? new BigNumber3(accountParsed.lendingPositionCount.toString()) : new BigNumber3(0);
|
|
@@ -16321,11 +16382,13 @@ function parseBankRaw(address, accountParsed, bankMetadata) {
|
|
|
16321
16382
|
emissionsRate,
|
|
16322
16383
|
emissionsMint,
|
|
16323
16384
|
emissionsRemaining,
|
|
16385
|
+
collectedProgramFeesOutstanding,
|
|
16324
16386
|
oracleKey,
|
|
16325
16387
|
feesDestinationAccount,
|
|
16326
16388
|
lendingPositionCount,
|
|
16327
16389
|
borrowingPositionCount,
|
|
16328
16390
|
emode,
|
|
16391
|
+
rateLimiter,
|
|
16329
16392
|
tokenSymbol,
|
|
16330
16393
|
kaminoIntegrationAccounts,
|
|
16331
16394
|
driftIntegrationAccounts,
|
|
@@ -16361,8 +16424,10 @@ function dtoToBank(bankDto) {
|
|
|
16361
16424
|
emissionsRate: bankDto.emissionsRate,
|
|
16362
16425
|
emissionsMint: new PublicKey(bankDto.emissionsMint),
|
|
16363
16426
|
emissionsRemaining: new BigNumber3(bankDto.emissionsRemaining),
|
|
16427
|
+
collectedProgramFeesOutstanding: new BigNumber3(bankDto.collectedProgramFeesOutstanding ?? "0"),
|
|
16364
16428
|
oracleKey: new PublicKey(bankDto.oracleKey),
|
|
16365
16429
|
emode: dtoToEmodeSettings(bankDto.emode),
|
|
16430
|
+
rateLimiter: bankDto.rateLimiter ? dtoToBankRateLimiter(bankDto.rateLimiter) : void 0,
|
|
16366
16431
|
tokenSymbol: bankDto.tokenSymbol,
|
|
16367
16432
|
feesDestinationAccount: bankDto.feesDestinationAccount ? new PublicKey(bankDto.feesDestinationAccount) : void 0,
|
|
16368
16433
|
lendingPositionCount: bankDto.lendingPositionCount ? new BigNumber3(bankDto.lendingPositionCount) : void 0,
|
|
@@ -16387,6 +16452,21 @@ function dtoToBank(bankDto) {
|
|
|
16387
16452
|
} : void 0
|
|
16388
16453
|
};
|
|
16389
16454
|
}
|
|
16455
|
+
function dtoToRateLimitWindow(window) {
|
|
16456
|
+
return {
|
|
16457
|
+
maxOutflow: new BigNumber3(window.maxOutflow),
|
|
16458
|
+
windowDuration: window.windowDuration,
|
|
16459
|
+
windowStart: window.windowStart,
|
|
16460
|
+
prevWindowOutflow: new BigNumber3(window.prevWindowOutflow),
|
|
16461
|
+
curWindowOutflow: new BigNumber3(window.curWindowOutflow)
|
|
16462
|
+
};
|
|
16463
|
+
}
|
|
16464
|
+
function dtoToBankRateLimiter(rateLimiter) {
|
|
16465
|
+
return {
|
|
16466
|
+
hourly: dtoToRateLimitWindow(rateLimiter.hourly),
|
|
16467
|
+
daily: dtoToRateLimitWindow(rateLimiter.daily)
|
|
16468
|
+
};
|
|
16469
|
+
}
|
|
16390
16470
|
function dtoToEmodeSettings(emodeSettingsDto) {
|
|
16391
16471
|
return {
|
|
16392
16472
|
emodeTag: emodeSettingsDto.emodeTag,
|
|
@@ -16465,6 +16545,8 @@ function dtoToBankRaw(bankDto) {
|
|
|
16465
16545
|
emissionsRate: new BN11(bankDto.emissionsRate),
|
|
16466
16546
|
emissionsRemaining: bankDto.emissionsRemaining,
|
|
16467
16547
|
emissionsMint: new PublicKey(bankDto.emissionsMint),
|
|
16548
|
+
collectedProgramFeesOutstanding: bankDto.collectedProgramFeesOutstanding,
|
|
16549
|
+
rateLimiter: bankDto.rateLimiter ? dtoToBankRateLimiterRaw(bankDto.rateLimiter) : void 0,
|
|
16468
16550
|
feesDestinationAccount: bankDto.feesDestinationAccount ? new PublicKey(bankDto.feesDestinationAccount) : void 0,
|
|
16469
16551
|
lendingPositionCount: bankDto.lendingPositionCount ? Number(bankDto.lendingPositionCount) : void 0,
|
|
16470
16552
|
borrowingPositionCount: bankDto.borrowingPositionCount ? Number(bankDto.borrowingPositionCount) : void 0,
|
|
@@ -16474,6 +16556,21 @@ function dtoToBankRaw(bankDto) {
|
|
|
16474
16556
|
integrationAcc3: new PublicKey(bankDto.integrationAcc3)
|
|
16475
16557
|
};
|
|
16476
16558
|
}
|
|
16559
|
+
function dtoToRateLimitWindowRaw(window) {
|
|
16560
|
+
return {
|
|
16561
|
+
maxOutflow: new BN11(window.maxOutflow),
|
|
16562
|
+
windowDuration: new BN11(window.windowDuration),
|
|
16563
|
+
windowStart: new BN11(window.windowStart),
|
|
16564
|
+
prevWindowOutflow: new BN11(window.prevWindowOutflow),
|
|
16565
|
+
curWindowOutflow: new BN11(window.curWindowOutflow)
|
|
16566
|
+
};
|
|
16567
|
+
}
|
|
16568
|
+
function dtoToBankRateLimiterRaw(rateLimiter) {
|
|
16569
|
+
return {
|
|
16570
|
+
hourly: dtoToRateLimitWindowRaw(rateLimiter.hourly),
|
|
16571
|
+
daily: dtoToRateLimitWindowRaw(rateLimiter.daily)
|
|
16572
|
+
};
|
|
16573
|
+
}
|
|
16477
16574
|
function dtoToEmodeSettingsRaw(emodeSettingsDto) {
|
|
16478
16575
|
return {
|
|
16479
16576
|
emodeTag: emodeSettingsDto.emodeTag,
|
|
@@ -62071,6 +62168,7 @@ async function buildRepayWithCollatFlashloanTx({
|
|
|
62071
62168
|
// src/services/account/utils/flashloan-size.utils.ts
|
|
62072
62169
|
var SWAP_MERGE_OVERHEAD = 150;
|
|
62073
62170
|
var FL_IX_OVERHEAD = 52;
|
|
62171
|
+
var OVERSIZED_TX_SENTINEL = MAX_TX_SIZE * 4;
|
|
62074
62172
|
function compactU16Size(n) {
|
|
62075
62173
|
return n < 128 ? 1 : n < 16384 ? 2 : 3;
|
|
62076
62174
|
}
|
|
@@ -62227,7 +62325,13 @@ function compileFlashloanPrecheck({
|
|
|
62227
62325
|
recentBlockhash: PublicKey.default.toBase58(),
|
|
62228
62326
|
instructions: allIxs
|
|
62229
62327
|
}).compileToV0Message(luts);
|
|
62230
|
-
|
|
62328
|
+
let rawSize;
|
|
62329
|
+
try {
|
|
62330
|
+
rawSize = new VersionedTransaction(msg).serialize().length;
|
|
62331
|
+
} catch (e) {
|
|
62332
|
+
if (!(e instanceof RangeError)) throw e;
|
|
62333
|
+
rawSize = OVERSIZED_TX_SENTINEL;
|
|
62334
|
+
}
|
|
62231
62335
|
const fullTxSize = rawSize + FL_IX_OVERHEAD;
|
|
62232
62336
|
const overshoot = fullTxSize - MAX_TX_SIZE;
|
|
62233
62337
|
const { header, staticAccountKeys, addressTableLookups } = msg;
|
|
@@ -65227,7 +65331,7 @@ function composeBundle(firstLegTxs, secondLegTxs, payer, blockhash, maxBundleTxs
|
|
|
65227
65331
|
if (result.length > maxBundleTxs) return null;
|
|
65228
65332
|
return result;
|
|
65229
65333
|
}
|
|
65230
|
-
function
|
|
65334
|
+
function compoundQuoteRisk(firstLeg, secondLeg) {
|
|
65231
65335
|
const compound = (a, b) => {
|
|
65232
65336
|
if (a == null && b == null) return void 0;
|
|
65233
65337
|
const x = Number(a ?? 0);
|
|
@@ -65235,13 +65339,36 @@ function mergeBridgeQuotes(firstLeg, secondLeg) {
|
|
|
65235
65339
|
return String(1 - (1 - x) * (1 - y));
|
|
65236
65340
|
};
|
|
65237
65341
|
return {
|
|
65238
|
-
inAmount: firstLeg.inAmount,
|
|
65239
|
-
outAmount: secondLeg.outAmount,
|
|
65240
|
-
otherAmountThreshold: secondLeg.otherAmountThreshold,
|
|
65241
65342
|
slippageBps: Math.round(
|
|
65242
65343
|
(1 - (1 - firstLeg.slippageBps / 1e4) * (1 - secondLeg.slippageBps / 1e4)) * 1e4
|
|
65243
65344
|
),
|
|
65244
|
-
priceImpactPct: compound(firstLeg.priceImpactPct, secondLeg.priceImpactPct)
|
|
65345
|
+
priceImpactPct: compound(firstLeg.priceImpactPct, secondLeg.priceImpactPct)
|
|
65346
|
+
};
|
|
65347
|
+
}
|
|
65348
|
+
function mergeBridgeQuotes(firstLeg, secondLeg) {
|
|
65349
|
+
return {
|
|
65350
|
+
inAmount: firstLeg.inAmount,
|
|
65351
|
+
outAmount: secondLeg.outAmount,
|
|
65352
|
+
otherAmountThreshold: secondLeg.otherAmountThreshold,
|
|
65353
|
+
...compoundQuoteRisk(firstLeg, secondLeg),
|
|
65354
|
+
provider: firstLeg.provider
|
|
65355
|
+
};
|
|
65356
|
+
}
|
|
65357
|
+
function mergeBridgeQuotesDebt(firstLeg, secondLeg) {
|
|
65358
|
+
return {
|
|
65359
|
+
inAmount: firstLeg.outAmount,
|
|
65360
|
+
outAmount: secondLeg.inAmount,
|
|
65361
|
+
otherAmountThreshold: secondLeg.inAmount,
|
|
65362
|
+
...compoundQuoteRisk(firstLeg, secondLeg),
|
|
65363
|
+
provider: firstLeg.provider
|
|
65364
|
+
};
|
|
65365
|
+
}
|
|
65366
|
+
function mergeBridgeQuotesLoop(firstLeg, secondLeg) {
|
|
65367
|
+
return {
|
|
65368
|
+
inAmount: secondLeg.inAmount,
|
|
65369
|
+
outAmount: firstLeg.outAmount,
|
|
65370
|
+
otherAmountThreshold: firstLeg.otherAmountThreshold,
|
|
65371
|
+
...compoundQuoteRisk(firstLeg, secondLeg),
|
|
65245
65372
|
provider: firstLeg.provider
|
|
65246
65373
|
};
|
|
65247
65374
|
}
|
|
@@ -65684,6 +65811,76 @@ var fetchMarginfiAccountAddresses = async (program, authority, group) => {
|
|
|
65684
65811
|
])).map((a) => a.publicKey);
|
|
65685
65812
|
return marginfiAccounts;
|
|
65686
65813
|
};
|
|
65814
|
+
var MARGINFI_ACCOUNT_DISCRIMINATOR = Buffer.from([67, 178, 130, 109, 126, 114, 28, 42]);
|
|
65815
|
+
var GROUP_OFFSET = 8;
|
|
65816
|
+
var BALANCES_OFFSET = 72;
|
|
65817
|
+
var BALANCE_SIZE = 104;
|
|
65818
|
+
var BANK_PK_OFFSET_IN_BALANCE = 1;
|
|
65819
|
+
var MAX_BALANCES = 16;
|
|
65820
|
+
var scanBankSlots = async (program, group, bank, options) => {
|
|
65821
|
+
const connection = program.provider.connection;
|
|
65822
|
+
const programId = program.programId;
|
|
65823
|
+
const discriminatorBytes = bs58.encode(MARGINFI_ACCOUNT_DISCRIMINATOR);
|
|
65824
|
+
const groupBytes = group.toBase58();
|
|
65825
|
+
const bankBytes = bank.toBase58();
|
|
65826
|
+
const slotOffsets = Array.from(
|
|
65827
|
+
{ length: MAX_BALANCES },
|
|
65828
|
+
(_, n) => BALANCES_OFFSET + BANK_PK_OFFSET_IN_BALANCE + n * BALANCE_SIZE
|
|
65829
|
+
);
|
|
65830
|
+
const scanSlot = (offset) => {
|
|
65831
|
+
const filters = [
|
|
65832
|
+
{ memcmp: { offset: 0, bytes: discriminatorBytes } },
|
|
65833
|
+
{ memcmp: { offset: GROUP_OFFSET, bytes: groupBytes } },
|
|
65834
|
+
{ memcmp: { offset, bytes: bankBytes } }
|
|
65835
|
+
];
|
|
65836
|
+
return connection.getProgramAccounts(programId, {
|
|
65837
|
+
filters,
|
|
65838
|
+
dataSlice: options.dataSlice
|
|
65839
|
+
});
|
|
65840
|
+
};
|
|
65841
|
+
const byAddress = /* @__PURE__ */ new Map();
|
|
65842
|
+
const collect = (slotResults) => {
|
|
65843
|
+
for (const { pubkey, account } of slotResults) {
|
|
65844
|
+
byAddress.set(pubkey.toBase58(), account);
|
|
65845
|
+
}
|
|
65846
|
+
};
|
|
65847
|
+
const concurrency = options.concurrency;
|
|
65848
|
+
if (concurrency === void 0 || concurrency >= slotOffsets.length) {
|
|
65849
|
+
(await Promise.all(slotOffsets.map(scanSlot))).forEach(collect);
|
|
65850
|
+
} else {
|
|
65851
|
+
const batchSize = Math.max(1, Math.floor(concurrency));
|
|
65852
|
+
for (let i = 0; i < slotOffsets.length; i += batchSize) {
|
|
65853
|
+
const batch = slotOffsets.slice(i, i + batchSize);
|
|
65854
|
+
(await Promise.all(batch.map(scanSlot))).forEach(collect);
|
|
65855
|
+
}
|
|
65856
|
+
}
|
|
65857
|
+
return byAddress;
|
|
65858
|
+
};
|
|
65859
|
+
var fetchMarginfiAccountAddressesHoldingBank = async (program, group, bank, options) => {
|
|
65860
|
+
const byAddress = await scanBankSlots(program, group, bank, {
|
|
65861
|
+
concurrency: options?.concurrency,
|
|
65862
|
+
dataSlice: { offset: 0, length: 0 }
|
|
65863
|
+
});
|
|
65864
|
+
return Array.from(byAddress.keys(), (a) => new PublicKey(a));
|
|
65865
|
+
};
|
|
65866
|
+
var fetchMarginfiAccountActiveBalancesForBank = async (program, group, bank, options) => {
|
|
65867
|
+
const byAddress = await scanBankSlots(program, group, bank, {
|
|
65868
|
+
concurrency: options?.concurrency
|
|
65869
|
+
});
|
|
65870
|
+
const results = [];
|
|
65871
|
+
for (const [address, account] of byAddress) {
|
|
65872
|
+
const accountAddress = new PublicKey(address);
|
|
65873
|
+
const raw = program.coder.accounts.decode(
|
|
65874
|
+
"marginfiAccount" /* MarginfiAccount */,
|
|
65875
|
+
account.data
|
|
65876
|
+
);
|
|
65877
|
+
const parsed = parseMarginfiAccountRaw(accountAddress, raw);
|
|
65878
|
+
const balance = parsed.balances.find((b) => b.active && b.bankPk.equals(bank));
|
|
65879
|
+
if (!balance) continue;
|
|
65880
|
+
results.push({ accountAddress, authority: parsed.authority, balance });
|
|
65881
|
+
}
|
|
65882
|
+
return results;
|
|
65883
|
+
};
|
|
65687
65884
|
var fetchMarginfiAccountData = async (program, marginfiAccountPk, banksMap, bankIntegrationMap) => {
|
|
65688
65885
|
const marginfiAccountRaw = await program.account.marginfiAccount.fetch(
|
|
65689
65886
|
marginfiAccountPk,
|
|
@@ -65960,6 +66157,33 @@ function patchDepositAmount(ix, amountNative) {
|
|
|
65960
66157
|
amountNative.toArrayLike(Buffer, "le", 8).copy(ix.data, DEPOSIT_AMOUNT_OFFSET);
|
|
65961
66158
|
}
|
|
65962
66159
|
|
|
66160
|
+
// src/services/account/utils/bridge.utils.ts
|
|
66161
|
+
function accountConflictsWithBridge(account, bankPk, side) {
|
|
66162
|
+
const balance = account.balances.find((b) => b.active && b.bankPk.equals(bankPk));
|
|
66163
|
+
if (!balance) return false;
|
|
66164
|
+
return side === "deposit" ? balance.liabilityShares.gt(0) : balance.assetShares.gt(0);
|
|
66165
|
+
}
|
|
66166
|
+
function resolveBridgeBanks(params) {
|
|
66167
|
+
const { orderedBridgeMints, banks, marginfiAccount, side } = params;
|
|
66168
|
+
const passesSideFilter = side === "borrow" ? isStandardBorrowable : isStandardDepositable;
|
|
66169
|
+
const bridges = [];
|
|
66170
|
+
const conflicts = [];
|
|
66171
|
+
const seenMints = /* @__PURE__ */ new Set();
|
|
66172
|
+
for (const mint of orderedBridgeMints) {
|
|
66173
|
+
const mintKey = mint.toBase58();
|
|
66174
|
+
if (seenMints.has(mintKey)) continue;
|
|
66175
|
+
seenMints.add(mintKey);
|
|
66176
|
+
const bank = banks.find((b) => b.mint.equals(mint) && passesSideFilter(b));
|
|
66177
|
+
if (!bank) continue;
|
|
66178
|
+
if (accountConflictsWithBridge(marginfiAccount, bank.address, side)) {
|
|
66179
|
+
conflicts.push(bank);
|
|
66180
|
+
} else {
|
|
66181
|
+
bridges.push(bank);
|
|
66182
|
+
}
|
|
66183
|
+
}
|
|
66184
|
+
return { bridges, conflicts };
|
|
66185
|
+
}
|
|
66186
|
+
|
|
65963
66187
|
// src/services/price/utils/smart-crank.utils.ts
|
|
65964
66188
|
async function computeSmartCrank({
|
|
65965
66189
|
marginfiAccount,
|
|
@@ -67460,6 +67684,14 @@ function computeRemainingCapacity(bank) {
|
|
|
67460
67684
|
}
|
|
67461
67685
|
|
|
67462
67686
|
// src/services/bank/utils/bank-metrics.utils.ts
|
|
67687
|
+
function isStandardBorrowable(bank) {
|
|
67688
|
+
const { assetTag, operationalState, borrowLimit } = bank.config;
|
|
67689
|
+
return (assetTag === 0 /* DEFAULT */ || assetTag === 1 /* SOL */) && operationalState === "Operational" /* Operational */ && borrowLimit.gt(0);
|
|
67690
|
+
}
|
|
67691
|
+
function isStandardDepositable(bank) {
|
|
67692
|
+
const { assetTag, operationalState } = bank.config;
|
|
67693
|
+
return (assetTag === 0 /* DEFAULT */ || assetTag === 1 /* SOL */) && operationalState === "Operational" /* Operational */;
|
|
67694
|
+
}
|
|
67463
67695
|
function computeBankTotalDeposits(bank, assetShareValueMultiplier) {
|
|
67464
67696
|
const totalAssets = getTotalAssetQuantity(bank).times(
|
|
67465
67697
|
assetShareValueMultiplier ?? 1
|
|
@@ -68938,7 +69170,7 @@ async function fetchBankIntegrationMetadata(options) {
|
|
|
68938
69170
|
return bankIntegrationMap;
|
|
68939
69171
|
}
|
|
68940
69172
|
var Bank = class _Bank {
|
|
68941
|
-
constructor(address, mint, mintDecimals, group, assetShareValue, liabilityShareValue, liquidityVault, liquidityVaultBump, liquidityVaultAuthorityBump, insuranceVault, insuranceVaultBump, insuranceVaultAuthorityBump, collectedInsuranceFeesOutstanding, feeVault, feeVaultBump, feeVaultAuthorityBump, collectedGroupFeesOutstanding, lastUpdate, config, totalAssetShares, totalLiabilityShares, emissionsActiveBorrowing, emissionsActiveLending, emissionsRate, emissionsMint, emissionsRemaining, oracleKey, emode, kaminoIntegrationAccounts, driftIntegrationAccounts, solendIntegrationAccounts, jupLendIntegrationAccounts, feesDestinationAccount, lendingPositionCount, borrowingPositionCount, tokenSymbol) {
|
|
69173
|
+
constructor(address, mint, mintDecimals, group, assetShareValue, liabilityShareValue, liquidityVault, liquidityVaultBump, liquidityVaultAuthorityBump, insuranceVault, insuranceVaultBump, insuranceVaultAuthorityBump, collectedInsuranceFeesOutstanding, feeVault, feeVaultBump, feeVaultAuthorityBump, collectedGroupFeesOutstanding, lastUpdate, config, totalAssetShares, totalLiabilityShares, emissionsActiveBorrowing, emissionsActiveLending, emissionsRate, emissionsMint, emissionsRemaining, collectedProgramFeesOutstanding, oracleKey, emode, rateLimiter, kaminoIntegrationAccounts, driftIntegrationAccounts, solendIntegrationAccounts, jupLendIntegrationAccounts, feesDestinationAccount, lendingPositionCount, borrowingPositionCount, tokenSymbol) {
|
|
68942
69174
|
this.address = address;
|
|
68943
69175
|
this.mint = mint;
|
|
68944
69176
|
this.mintDecimals = mintDecimals;
|
|
@@ -68965,8 +69197,10 @@ var Bank = class _Bank {
|
|
|
68965
69197
|
this.emissionsRate = emissionsRate;
|
|
68966
69198
|
this.emissionsMint = emissionsMint;
|
|
68967
69199
|
this.emissionsRemaining = emissionsRemaining;
|
|
69200
|
+
this.collectedProgramFeesOutstanding = collectedProgramFeesOutstanding;
|
|
68968
69201
|
this.oracleKey = oracleKey;
|
|
68969
69202
|
this.emode = emode;
|
|
69203
|
+
this.rateLimiter = rateLimiter;
|
|
68970
69204
|
this.kaminoIntegrationAccounts = kaminoIntegrationAccounts;
|
|
68971
69205
|
this.driftIntegrationAccounts = driftIntegrationAccounts;
|
|
68972
69206
|
this.solendIntegrationAccounts = solendIntegrationAccounts;
|
|
@@ -69034,8 +69268,10 @@ var Bank = class _Bank {
|
|
|
69034
69268
|
bankType.emissionsRate,
|
|
69035
69269
|
bankType.emissionsMint,
|
|
69036
69270
|
bankType.emissionsRemaining,
|
|
69271
|
+
bankType.collectedProgramFeesOutstanding,
|
|
69037
69272
|
bankType.oracleKey,
|
|
69038
69273
|
bankType.emode,
|
|
69274
|
+
bankType.rateLimiter,
|
|
69039
69275
|
bankType.kaminoIntegrationAccounts,
|
|
69040
69276
|
bankType.driftIntegrationAccounts,
|
|
69041
69277
|
bankType.solendIntegrationAccounts,
|
|
@@ -69075,8 +69311,10 @@ var Bank = class _Bank {
|
|
|
69075
69311
|
props.emissionsRate,
|
|
69076
69312
|
props.emissionsMint,
|
|
69077
69313
|
props.emissionsRemaining,
|
|
69314
|
+
props.collectedProgramFeesOutstanding,
|
|
69078
69315
|
props.oracleKey,
|
|
69079
69316
|
props.emode,
|
|
69317
|
+
props.rateLimiter,
|
|
69080
69318
|
props.kaminoIntegrationAccounts,
|
|
69081
69319
|
props.driftIntegrationAccounts,
|
|
69082
69320
|
props.solendIntegrationAccounts,
|
|
@@ -70143,6 +70381,69 @@ var Project0Client = class _Project0Client {
|
|
|
70143
70381
|
async getAccountAddresses(authority) {
|
|
70144
70382
|
return fetchMarginfiAccountAddresses(this.program, authority, this.group.address);
|
|
70145
70383
|
}
|
|
70384
|
+
/**
|
|
70385
|
+
* Fetches the addresses of all marginfi accounts in the group that hold a position in a
|
|
70386
|
+
* specific bank.
|
|
70387
|
+
*
|
|
70388
|
+
* Because a marginfi account holds up to 16 balance slots (sorted descending by bank, so the
|
|
70389
|
+
* target can be at any slot), this scans all 16 slots in parallel via filtered
|
|
70390
|
+
* `getProgramAccounts` calls. It returns only addresses (no account data is transferred),
|
|
70391
|
+
* which keeps it viable across the group's ~500k accounts. Hydrate any address you care about
|
|
70392
|
+
* with `fetchAccount`.
|
|
70393
|
+
*
|
|
70394
|
+
* @param bank - The bank public key to search for in account balances
|
|
70395
|
+
* @param options - Optional settings:
|
|
70396
|
+
* - `concurrency`: max number of the 16 slot scans to run at once. Omit to fire all 16 in
|
|
70397
|
+
* parallel; pass a smaller value (e.g. 4) to batch them and avoid RPC rate limits.
|
|
70398
|
+
* @returns Deduplicated array of account addresses holding the bank
|
|
70399
|
+
*/
|
|
70400
|
+
async getAccountAddressesHoldingBank(bank, options) {
|
|
70401
|
+
return fetchMarginfiAccountAddressesHoldingBank(
|
|
70402
|
+
this.program,
|
|
70403
|
+
this.group.address,
|
|
70404
|
+
bank,
|
|
70405
|
+
options
|
|
70406
|
+
);
|
|
70407
|
+
}
|
|
70408
|
+
/**
|
|
70409
|
+
* Fetches every account's active balance for a given mint, with its authority, account
|
|
70410
|
+
* address, and the deposited/borrowed amounts in UI units.
|
|
70411
|
+
*
|
|
70412
|
+
* A mint can map to multiple banks (e.g. DEFAULT + Kamino), so this resolves all matching
|
|
70413
|
+
* banks via {@link getBanksByMint}, scans each for accounts holding it, and emits one row per
|
|
70414
|
+
* (account, bank). An account that holds the mint in several banks yields several rows.
|
|
70415
|
+
*
|
|
70416
|
+
* Amounts are computed with each bank's share multiplier (`assetShareValueMultiplierByBank`)
|
|
70417
|
+
* and the bank's mint decimals, matching `Balance.computeQuantityUi`.
|
|
70418
|
+
*
|
|
70419
|
+
* @param mint - The mint to search account balances for
|
|
70420
|
+
* @param options - Optional settings:
|
|
70421
|
+
* - `assetTag`: restrict to banks with this asset tag (e.g. only Kamino banks for the mint)
|
|
70422
|
+
* - `concurrency`: max number of the 16 slot scans to run at once per bank (see
|
|
70423
|
+
* {@link getAccountAddressesHoldingBank})
|
|
70424
|
+
* @returns One row per (account, bank) holding the mint
|
|
70425
|
+
*/
|
|
70426
|
+
async getAuthorityBalancesForMint(mint, options) {
|
|
70427
|
+
const banks = this.getBanksByMint(mint, options?.assetTag);
|
|
70428
|
+
const rows = [];
|
|
70429
|
+
for (const bank of banks) {
|
|
70430
|
+
const multiplier = this.assetShareValueMultiplierByBank.get(bank.address.toBase58());
|
|
70431
|
+
const balances = await fetchMarginfiAccountActiveBalancesForBank(
|
|
70432
|
+
this.program,
|
|
70433
|
+
this.group.address,
|
|
70434
|
+
bank.address,
|
|
70435
|
+
{ concurrency: options?.concurrency }
|
|
70436
|
+
);
|
|
70437
|
+
for (const { accountAddress, authority, balance } of balances) {
|
|
70438
|
+
const { assets, liabilities } = Balance.fromBalanceType(balance).computeQuantityUi(
|
|
70439
|
+
bank,
|
|
70440
|
+
multiplier
|
|
70441
|
+
);
|
|
70442
|
+
rows.push({ authority, accountAddress, bank: bank.address, assets, liabilities });
|
|
70443
|
+
}
|
|
70444
|
+
}
|
|
70445
|
+
return rows;
|
|
70446
|
+
}
|
|
70146
70447
|
/**
|
|
70147
70448
|
* Fetches and wraps a marginfi account in one call.
|
|
70148
70449
|
*
|
|
@@ -70336,6 +70637,6 @@ var EmodeSettings = class _EmodeSettings {
|
|
|
70336
70637
|
}
|
|
70337
70638
|
};
|
|
70338
70639
|
|
|
70339
|
-
export { ADDRESS_LOOKUP_TABLE_FOR_GROUP, ADDRESS_LOOKUP_TABLE_FOR_GROUP_NATIVE_STAKE, ADDRESS_LOOKUP_TABLE_FOR_SWAP, AccountFlags, AccountType, AssetTag, BUNDLE_TX_SIZE, Balance, Bank, BankConfig, BankConfigFlag, BankVaultType, DEFAULT_CROSSBAR_URL, DEFAULT_FALLBACK_CROSSBAR_URL, DEFAULT_ORACLE_MAX_AGE, DEFAULT_REPAY_ALL_EXTRA_BUFFER_BPS, DISABLED_FLAG, EMPTY_HEALTH_CACHE, EmodeEntryFlags, EmodeFlags, EmodeImpactStatus, EmodeSettings, EmodeTag, FLASHLOAN_ENABLED_FLAG, HOURS_PER_YEAR, HealthCache, HealthCacheFlags, HealthCacheSimulationError, HealthCacheStatus, JUPITER_V6_PROGRAM, JUP_SWAP_LUT_PROGRAM_AUTHORITY_INDEX, LST_MINT, MARGINFI_IDL, MARGINFI_PROGRAM, MARGINFI_PROGRAM_STAGING, MARGINFI_PROGRAM_STAGING_ALT, MARGINFI_SPONSORED_SHARD_ID, MAX_ACCOUNT_LOCKS, MAX_CONFIDENCE_INTERVAL_RATIO, MAX_TX_SIZE, MAX_U64, MPL_METADATA_PROGRAM_ID, MarginRequirementType, MarginfiAccount, MarginfiAccountWrapper, MarginfiGroup, OperationalState, OracleSetup, PDA_BANK_EMISSIONS_AUTH_SEED, PDA_BANK_EMISSIONS_VAULT_SEED, PDA_BANK_FEE_STATE_SEED, PDA_BANK_FEE_VAULT_AUTH_SEED, PDA_BANK_FEE_VAULT_SEED, PDA_BANK_INSURANCE_VAULT_AUTH_SEED, PDA_BANK_INSURANCE_VAULT_SEED, PDA_BANK_LIQUIDITY_VAULT_AUTH_SEED, PDA_BANK_LIQUIDITY_VAULT_SEED, PDA_MARGINFI_ACCOUNT_SEED, PRIORITY_TX_SIZE, PYTH_PRICE_CONF_INTERVALS, PYTH_PUSH_ORACLE_ID, PYTH_SPONSORED_SHARD_ID, PriceBias, Project0Client, RiskTier, SINGLE_POOL_PROGRAM_ID, STAKE_CONFIG_ID, STAKE_PROGRAM_ID, SWAP_ADAPTERS, SWB_PRICE_CONF_INTERVALS, SYSTEM_PROGRAM_ID, SYSVAR_CLOCK_ID, SYSVAR_RENT_ID, SYSVAR_STAKE_HISTORY_ID, SwapProvider, TRANSFER_ACCOUNT_AUTHORITY_FLAG, TransactionArenaKeyMap, TransactionBuildingError, TransactionBuildingErrorCode, TransactionConfigMap, TransactionType, USDC_DECIMALS, USDC_MINT, WSOL_MINT, ZERO_ORACLE_KEY, accountFlagToBN, addOracleToBanksIx, addTransactionMetadata, adjustPriceComponent, aprToApy, apyToApr, balanceToDto, bankConfigRawToDto, bankConfigToBankConfigRaw, bankMetadataMapToDto, bankMetadataToDto, bankRawToDto, bigNumberToWrappedI80F48, bpsToPercentile, calculateApyFromInterest, calculateInterestFromApy, capConfidenceInterval, categorizePythBanks, checkBatchOracleCrankability, checkJupiterFeeAccount, checkMultipleOraclesCrankability, checkTitanFeeAccount, chunkedGetRawMultipleAccountInfoOrdered, chunkedGetRawMultipleAccountInfoOrderedWithNulls, chunkedGetRawMultipleAccountInfos, compileFlashloanPrecheck, composeBridgedSwap, composeRemainingAccounts, computeAccountValue, computeActiveEmodePairs, computeAssetHealthComponent, computeAssetUsdValue, computeBalanceUsdValue, computeBankBorrowApy, computeBankBorrowCapRemaining, computeBankDepositCapRemaining, computeBankMetrics, computeBankPoolSize, computeBankSupplyApy, computeBankTotalBorrows, computeBankTotalBorrowsUsd, computeBankTotalDeposits, computeBankTotalDepositsUsd, computeBaseInterestRate, computeBorrowEstimateForRepay, computeClaimedEmissions, computeClosePositionTokenAmount, computeEmodeImpacts, computeFlashLoanNonSwapBudget, computeFlashloanSwapConstraints, computeFreeCollateralFromBalances, computeFreeCollateralFromCache, computeHealthAccountMetas, computeHealthCacheStatus, computeHealthCheckAccounts, computeHealthComponentsFromBalances, computeHealthComponentsFromCache, computeInterestRates, computeLiabilityHealthComponent, computeLiabilityUsdValue, computeLiquidationPriceForBank, computeLoopingParams, computeLowestEmodeWeights, computeMaxBorrowForBank, computeMaxLeverage, computeMaxWithdrawForBank, computeNetApy, computeProjectedActiveBalancesNoCpi, computeProjectedActiveBanksNoCpi, computeQuantity, computeQuantityUi, computeRemainingCapacity, computeSmartCrank, computeStakedBankMultipliers, computeTotalOutstandingEmissions, computeTvl, computeUsdValue, computeUtilizationRate, computeV0TxSize, convertVoteAccCoeffsToBankCoeffs, createActiveEmodePairFromPairs, createEmptyBalance, decodeAccountRaw, decodeBankRaw, decodeInstruction, decompileV0Transaction, deriveBankEmissionsAuth, deriveBankEmissionsVault, deriveBankFeeVault, deriveBankFeeVaultAuthority, deriveBankInsuranceVault, deriveBankInsuranceVaultAuthority, deriveBankLiquidityVault, deriveBankLiquidityVaultAuthority, deriveFeeState, deriveMarginfiAccount, deserializeInstruction, deserializeLut, deserializeSwapEngineRequest, deserializeSwapEngineResult, dtoToBalance, dtoToBank, dtoToBankConfig, dtoToBankConfigRaw, dtoToBankMetadata, dtoToBankMetadataMap, dtoToBankRaw, dtoToEmodeSettings, dtoToEmodeSettingsRaw, dtoToGroup, dtoToHealthCache, dtoToInterestRateConfig, dtoToMarginfiAccount, dtoToOraclePrice, dtoToValidatorStakeGroup, emodeSettingsRawToDto, extractPythOracleKeys, fetchBank, fetchBankIntegrationMetadata, fetchMarginfiAccountAddresses, fetchMarginfiAccountData, fetchMultipleBanks, fetchNativeStakeAccounts, fetchOracleData, fetchProgramForMints, fetchPythOracleData, fetchPythOraclePricesFromAPI, fetchPythOraclePricesFromChain, fetchStakeAccount, fetchStakePoolActiveStates, fetchStakePoolMev, fetchSwbOracleAccountsFromAPI, fetchSwbOracleAccountsFromChain, fetchSwbOracleData, fetchSwbOraclePricesFromAPI, fetchSwbOraclePricesFromCrossbar, findRandomAvailableAccountIndex, freezeBankConfigIx, generateDummyAccount, getAccountKeys, getActiveAccountFlags, getActiveBalances, getActiveEmodeEntryFlags, getActiveEmodeFlags, getActiveHealthCacheFlags, getAssetQuantity, getAssetShares, getAssetWeight, getBalance, getBalanceUsdValueWithPriceBias, getBankVaultAuthority, getBankVaultSeeds, getBirdeyeFallbackPricesByFeedId, getBirdeyePricesForMints, getConfig, getDriftCTokenMultiplier, getDriftMetadata, getDriftStatesDto, getEmodePairs, getExactOutEstimate, getHealthCacheStatusDescription, getHealthSimulationTransactions, getJupLendFTokenMultiplier, getJupLendMetadata, getJupLendStatesDto, getJupiterReferralFeeAccount, getJupiterSwapIxsForFlashloan, getKaminoCTokenMultiplier, getKaminoMetadata, getKaminoStatesDto, getLiabilityQuantity, getLiabilityShares, getLiabilityWeight, getOracleSourceFromBank, getOracleSourceFromOracleSetup, getOracleSourceNameFromKey, getPrice, getPriceWithConfidence, getStakedBankMetadataMap, getSwapAdapter, getSwapIxsForFlashloan, getTitanExactOutEstimate, getTitanSwapIxsForFlashloan, getTotalAccountKeys, getTotalAssetQuantity, getTotalLiabilityQuantity, getTxSize, getValidatorVoteAccountByBank, getWritableAccountKeys, groupToDto, hasAccountFlag, hasEmodeEntryFlag, hasEmodeFlag, hasHealthCacheFlag, healthCacheToDto, isDepositIx, isFlashloan, isV0Tx, isWeightedPrice, isWholePosition, makeAccountTransferToNewAccountTx, makeAddPermissionlessStakedBankIx, makeBeginFlashLoanIx3 as makeBeginFlashLoanIx, makeBorrowIx3 as makeBorrowIx, makeBorrowTx, makeBundleTipIx, makeClearEmissionsIx, makeCloseMarginfiAccountIx, makeCloseMarginfiAccountTx, makeCrankSwbFeedIx, makeCreateAccountIxWithProjection, makeCreateAccountTxWithProjection, makeCreateMarginfiAccountIx, makeCreateMarginfiAccountTx, makeDepositIx3 as makeDepositIx, makeDepositTx, makeDriftDepositIx3 as makeDriftDepositIx, makeDriftDepositTx, makeDriftWithdrawIx3 as makeDriftWithdrawIx, makeDriftWithdrawTx, makeEndFlashLoanIx3 as makeEndFlashLoanIx, makeFlashLoanTx, makeJuplendDepositIx2 as makeJuplendDepositIx, makeJuplendDepositTx, makeJuplendWithdrawIx2 as makeJuplendWithdrawIx, makeJuplendWithdrawTx, makeKaminoDepositIx3 as makeKaminoDepositIx, makeKaminoDepositTx, makeKaminoWithdrawIx3 as makeKaminoWithdrawIx, makeKaminoWithdrawTx, makeLoopTx, makeMergeStakeAccountsTx, makeMintStakedLstIx, makeMintStakedLstTx, makePoolAddBankIx3 as makePoolAddBankIx, makePoolConfigureBankIx3 as makePoolConfigureBankIx, makePriorityFeeIx, makePriorityFeeMicroIx, makePulseHealthIx2 as makePulseHealthIx, makeRedeemStakedLstIx, makeRedeemStakedLstTx, makeRefreshKaminoBanksIxs, makeRepayIx3 as makeRepayIx, makeRepayTx, makeRepayWithCollatTx, makeRollPtTx, makeSetupIx, makeSmartCrankSwbFeedIx, makeSwapCollateralTx, makeSwapDebtTx, makeTxPriorityIx, makeUnwrapSolIx, makeUpdateDriftMarketIxs, makeUpdateJupLendRateIxs, makeUpdateSwbFeedIx, makeVersionedTransaction, makeWithdrawIx3 as makeWithdrawIx, makeWithdrawTx, makeWrapSolIxs, mapBrokenFeedsToOraclePrices, mapJupiterQuoteToSwapQuoteResult, mapPythBanksToOraclePrices, mapSwbBanksToOraclePrices, marginfiAccountToDto, mergeBridgeQuotes, nativeToUi, oraclePriceToDto, parseBalanceRaw, parseBankConfigRaw, parseBankRaw, parseEmodeSettingsRaw, parseEmodeTag, parseHealthCacheRaw, parseMarginfiAccountRaw, parseOperationalState, parseOracleSetup, parseOraclePriceData as parsePriceInfo, parseRiskTier, parseRpcPythPriceData, parseSwbOraclePriceData, partitionBanksByCrankability, patchDepositAmount, resolveAmount, runSwapEngine, selectLutsForAccountAction, selectLutsForBanks, serializeBankConfigOpt, serializeInstruction, serializeInterestRateConfig, serializeLut, serializeOperationalState, serializeOracleSetup, serializeOracleSetupToIndex, serializeRiskTier, serializeSwapEngineRequest, serializeSwapEngineResult, shortenAddress, simulateAccountHealthCache, simulateAccountHealthCacheWithFallback, simulateBundle, splitInstructionsToFitTransactions, swapEngineProvidersFromOpts, swapEngineQuoteFieldsFromOpts, toBankConfigDto, toBankDto, toBigNumber, toEmodeSettingsDto, toInterestRateConfigDto, toJupiterConfig, toNumber, uiToNative, uiToNativeBigNumber, validatorStakeGroupToDto, wrappedI80F48toBigNumber };
|
|
70640
|
+
export { ADDRESS_LOOKUP_TABLE_FOR_GROUP, ADDRESS_LOOKUP_TABLE_FOR_GROUP_NATIVE_STAKE, ADDRESS_LOOKUP_TABLE_FOR_SWAP, AccountFlags, AccountType, AssetTag, BUNDLE_TX_SIZE, Balance, Bank, BankConfig, BankConfigFlag, BankVaultType, DEFAULT_CROSSBAR_URL, DEFAULT_FALLBACK_CROSSBAR_URL, DEFAULT_ORACLE_MAX_AGE, DEFAULT_REPAY_ALL_EXTRA_BUFFER_BPS, DISABLED_FLAG, EMPTY_HEALTH_CACHE, EmodeEntryFlags, EmodeFlags, EmodeImpactStatus, EmodeSettings, EmodeTag, FLASHLOAN_ENABLED_FLAG, HOURS_PER_YEAR, HealthCache, HealthCacheFlags, HealthCacheSimulationError, HealthCacheStatus, JUPITER_V6_PROGRAM, JUP_SWAP_LUT_PROGRAM_AUTHORITY_INDEX, LST_MINT, MARGINFI_IDL, MARGINFI_PROGRAM, MARGINFI_PROGRAM_STAGING, MARGINFI_PROGRAM_STAGING_ALT, MARGINFI_SPONSORED_SHARD_ID, MAX_ACCOUNT_LOCKS, MAX_CONFIDENCE_INTERVAL_RATIO, MAX_TX_SIZE, MAX_U64, MPL_METADATA_PROGRAM_ID, MarginRequirementType, MarginfiAccount, MarginfiAccountWrapper, MarginfiGroup, OperationalState, OracleSetup, PDA_BANK_EMISSIONS_AUTH_SEED, PDA_BANK_EMISSIONS_VAULT_SEED, PDA_BANK_FEE_STATE_SEED, PDA_BANK_FEE_VAULT_AUTH_SEED, PDA_BANK_FEE_VAULT_SEED, PDA_BANK_INSURANCE_VAULT_AUTH_SEED, PDA_BANK_INSURANCE_VAULT_SEED, PDA_BANK_LIQUIDITY_VAULT_AUTH_SEED, PDA_BANK_LIQUIDITY_VAULT_SEED, PDA_MARGINFI_ACCOUNT_SEED, PRIORITY_TX_SIZE, PYTH_PRICE_CONF_INTERVALS, PYTH_PUSH_ORACLE_ID, PYTH_SPONSORED_SHARD_ID, PriceBias, Project0Client, RiskTier, SINGLE_POOL_PROGRAM_ID, STAKE_CONFIG_ID, STAKE_PROGRAM_ID, SWAP_ADAPTERS, SWB_PRICE_CONF_INTERVALS, SYSTEM_PROGRAM_ID, SYSVAR_CLOCK_ID, SYSVAR_RENT_ID, SYSVAR_STAKE_HISTORY_ID, SwapProvider, TRANSFER_ACCOUNT_AUTHORITY_FLAG, TransactionArenaKeyMap, TransactionBuildingError, TransactionBuildingErrorCode, TransactionConfigMap, TransactionType, USDC_DECIMALS, USDC_MINT, WSOL_MINT, ZERO_ORACLE_KEY, accountConflictsWithBridge, accountFlagToBN, addOracleToBanksIx, addTransactionMetadata, adjustPriceComponent, aprToApy, apyToApr, balanceToDto, bankConfigRawToDto, bankConfigToBankConfigRaw, bankMetadataMapToDto, bankMetadataToDto, bankRateLimiterRawToDto, bankRawToDto, bigNumberToWrappedI80F48, bpsToPercentile, calculateApyFromInterest, calculateInterestFromApy, capConfidenceInterval, categorizePythBanks, checkBatchOracleCrankability, checkJupiterFeeAccount, checkMultipleOraclesCrankability, checkTitanFeeAccount, chunkedGetRawMultipleAccountInfoOrdered, chunkedGetRawMultipleAccountInfoOrderedWithNulls, chunkedGetRawMultipleAccountInfos, compileFlashloanPrecheck, composeBridgedSwap, composeRemainingAccounts, computeAccountValue, computeActiveEmodePairs, computeAssetHealthComponent, computeAssetUsdValue, computeBalanceUsdValue, computeBankBorrowApy, computeBankBorrowCapRemaining, computeBankDepositCapRemaining, computeBankMetrics, computeBankPoolSize, computeBankSupplyApy, computeBankTotalBorrows, computeBankTotalBorrowsUsd, computeBankTotalDeposits, computeBankTotalDepositsUsd, computeBaseInterestRate, computeBorrowEstimateForRepay, computeClaimedEmissions, computeClosePositionTokenAmount, computeEmodeImpacts, computeFlashLoanNonSwapBudget, computeFlashloanSwapConstraints, computeFreeCollateralFromBalances, computeFreeCollateralFromCache, computeHealthAccountMetas, computeHealthCacheStatus, computeHealthCheckAccounts, computeHealthComponentsFromBalances, computeHealthComponentsFromCache, computeInterestRates, computeLiabilityHealthComponent, computeLiabilityUsdValue, computeLiquidationPriceForBank, computeLoopingParams, computeLowestEmodeWeights, computeMaxBorrowForBank, computeMaxLeverage, computeMaxWithdrawForBank, computeNetApy, computeProjectedActiveBalancesNoCpi, computeProjectedActiveBanksNoCpi, computeQuantity, computeQuantityUi, computeRemainingCapacity, computeSmartCrank, computeStakedBankMultipliers, computeTotalOutstandingEmissions, computeTvl, computeUsdValue, computeUtilizationRate, computeV0TxSize, convertVoteAccCoeffsToBankCoeffs, createActiveEmodePairFromPairs, createEmptyBalance, decodeAccountRaw, decodeBankRaw, decodeInstruction, decompileV0Transaction, deriveBankEmissionsAuth, deriveBankEmissionsVault, deriveBankFeeVault, deriveBankFeeVaultAuthority, deriveBankInsuranceVault, deriveBankInsuranceVaultAuthority, deriveBankLiquidityVault, deriveBankLiquidityVaultAuthority, deriveFeeState, deriveMarginfiAccount, deserializeInstruction, deserializeLut, deserializeSwapEngineRequest, deserializeSwapEngineResult, dtoToBalance, dtoToBank, dtoToBankConfig, dtoToBankConfigRaw, dtoToBankMetadata, dtoToBankMetadataMap, dtoToBankRateLimiter, dtoToBankRateLimiterRaw, dtoToBankRaw, dtoToEmodeSettings, dtoToEmodeSettingsRaw, dtoToGroup, dtoToHealthCache, dtoToInterestRateConfig, dtoToMarginfiAccount, dtoToOraclePrice, dtoToValidatorStakeGroup, emodeSettingsRawToDto, extractPythOracleKeys, fetchBank, fetchBankIntegrationMetadata, fetchMarginfiAccountActiveBalancesForBank, fetchMarginfiAccountAddresses, fetchMarginfiAccountAddressesHoldingBank, fetchMarginfiAccountData, fetchMultipleBanks, fetchNativeStakeAccounts, fetchOracleData, fetchProgramForMints, fetchPythOracleData, fetchPythOraclePricesFromAPI, fetchPythOraclePricesFromChain, fetchStakeAccount, fetchStakePoolActiveStates, fetchStakePoolMev, fetchSwbOracleAccountsFromAPI, fetchSwbOracleAccountsFromChain, fetchSwbOracleData, fetchSwbOraclePricesFromAPI, fetchSwbOraclePricesFromCrossbar, findRandomAvailableAccountIndex, freezeBankConfigIx, generateDummyAccount, getAccountKeys, getActiveAccountFlags, getActiveBalances, getActiveEmodeEntryFlags, getActiveEmodeFlags, getActiveHealthCacheFlags, getAssetQuantity, getAssetShares, getAssetWeight, getBalance, getBalanceUsdValueWithPriceBias, getBankVaultAuthority, getBankVaultSeeds, getBirdeyeFallbackPricesByFeedId, getBirdeyePricesForMints, getConfig, getDriftCTokenMultiplier, getDriftMetadata, getDriftStatesDto, getEmodePairs, getExactOutEstimate, getHealthCacheStatusDescription, getHealthSimulationTransactions, getJupLendFTokenMultiplier, getJupLendMetadata, getJupLendStatesDto, getJupiterReferralFeeAccount, getJupiterSwapIxsForFlashloan, getKaminoCTokenMultiplier, getKaminoMetadata, getKaminoStatesDto, getLiabilityQuantity, getLiabilityShares, getLiabilityWeight, getOracleSourceFromBank, getOracleSourceFromOracleSetup, getOracleSourceNameFromKey, getPrice, getPriceWithConfidence, getStakedBankMetadataMap, getSwapAdapter, getSwapIxsForFlashloan, getTitanExactOutEstimate, getTitanSwapIxsForFlashloan, getTotalAccountKeys, getTotalAssetQuantity, getTotalLiabilityQuantity, getTxSize, getValidatorVoteAccountByBank, getWritableAccountKeys, groupToDto, hasAccountFlag, hasEmodeEntryFlag, hasEmodeFlag, hasHealthCacheFlag, healthCacheToDto, isDecomposableSwapError, isDepositIx, isFlashloan, isStandardBorrowable, isStandardDepositable, isV0Tx, isWeightedPrice, isWholePosition, makeAccountTransferToNewAccountTx, makeAddPermissionlessStakedBankIx, makeBeginFlashLoanIx3 as makeBeginFlashLoanIx, makeBorrowIx3 as makeBorrowIx, makeBorrowTx, makeBundleTipIx, makeClearEmissionsIx, makeCloseMarginfiAccountIx, makeCloseMarginfiAccountTx, makeCrankSwbFeedIx, makeCreateAccountIxWithProjection, makeCreateAccountTxWithProjection, makeCreateMarginfiAccountIx, makeCreateMarginfiAccountTx, makeDepositIx3 as makeDepositIx, makeDepositTx, makeDriftDepositIx3 as makeDriftDepositIx, makeDriftDepositTx, makeDriftWithdrawIx3 as makeDriftWithdrawIx, makeDriftWithdrawTx, makeEndFlashLoanIx3 as makeEndFlashLoanIx, makeFlashLoanTx, makeJuplendDepositIx2 as makeJuplendDepositIx, makeJuplendDepositTx, makeJuplendWithdrawIx2 as makeJuplendWithdrawIx, makeJuplendWithdrawTx, makeKaminoDepositIx3 as makeKaminoDepositIx, makeKaminoDepositTx, makeKaminoWithdrawIx3 as makeKaminoWithdrawIx, makeKaminoWithdrawTx, makeLoopTx, makeMergeStakeAccountsTx, makeMintStakedLstIx, makeMintStakedLstTx, makePoolAddBankIx3 as makePoolAddBankIx, makePoolConfigureBankIx3 as makePoolConfigureBankIx, makePriorityFeeIx, makePriorityFeeMicroIx, makePulseHealthIx2 as makePulseHealthIx, makeRedeemStakedLstIx, makeRedeemStakedLstTx, makeRefreshKaminoBanksIxs, makeRepayIx3 as makeRepayIx, makeRepayTx, makeRepayWithCollatTx, makeRollPtTx, makeSetupIx, makeSmartCrankSwbFeedIx, makeSwapCollateralTx, makeSwapDebtTx, makeTxPriorityIx, makeUnwrapSolIx, makeUpdateDriftMarketIxs, makeUpdateJupLendRateIxs, makeUpdateSwbFeedIx, makeVersionedTransaction, makeWithdrawIx3 as makeWithdrawIx, makeWithdrawTx, makeWrapSolIxs, mapBrokenFeedsToOraclePrices, mapJupiterQuoteToSwapQuoteResult, mapPythBanksToOraclePrices, mapSwbBanksToOraclePrices, marginfiAccountToDto, mergeBridgeQuotes, mergeBridgeQuotesDebt, mergeBridgeQuotesLoop, nativeToUi, oraclePriceToDto, parseBalanceRaw, parseBankConfigRaw, parseBankRateLimiterRaw, parseBankRaw, parseEmodeSettingsRaw, parseEmodeTag, parseHealthCacheRaw, parseMarginfiAccountRaw, parseOperationalState, parseOracleSetup, parseOraclePriceData as parsePriceInfo, parseRiskTier, parseRpcPythPriceData, parseSwbOraclePriceData, partitionBanksByCrankability, patchDepositAmount, resolveAmount, resolveBridgeBanks, runSwapEngine, selectLutsForAccountAction, selectLutsForBanks, serializeBankConfigOpt, serializeInstruction, serializeInterestRateConfig, serializeLut, serializeOperationalState, serializeOracleSetup, serializeOracleSetupToIndex, serializeRiskTier, serializeSwapEngineRequest, serializeSwapEngineResult, shortenAddress, simulateAccountHealthCache, simulateAccountHealthCacheWithFallback, simulateBundle, splitInstructionsToFitTransactions, swapEngineProvidersFromOpts, swapEngineQuoteFieldsFromOpts, toBankConfigDto, toBankDto, toBigNumber, toEmodeSettingsDto, toInterestRateConfigDto, toJupiterConfig, toNumber, uiToNative, uiToNativeBigNumber, validatorStakeGroupToDto, wrappedI80F48toBigNumber };
|
|
70340
70641
|
//# sourceMappingURL=index.js.map
|
|
70341
70642
|
//# sourceMappingURL=index.js.map
|