@0dotxyz/p0-ts-sdk 2.7.4 → 2.8.0-alpha.1
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 +640 -40
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +101 -8
- package/dist/index.d.ts +101 -8
- package/dist/index.js +633 -41
- package/dist/index.js.map +1 -1
- package/dist/instructions.d.cts +1 -1
- package/dist/instructions.d.ts +1 -1
- package/dist/{types-DJqANTTA.d.cts → types-6tM8iZUV.d.cts} +87 -9
- package/dist/{types-sisv3J7l.d.ts → types-SY3xiGG8.d.ts} +87 -9
- package/dist/types-cfCsUNXw.d.cts +230 -0
- package/dist/types-cfCsUNXw.d.ts +230 -0
- package/dist/vendor.cjs +100 -9
- package/dist/vendor.cjs.map +1 -1
- package/dist/vendor.d.cts +6880 -6981
- package/dist/vendor.d.ts +6880 -6981
- package/dist/vendor.js +81 -3
- package/dist/vendor.js.map +1 -1
- package/package.json +1 -1
- package/dist/types-DLZaKA17.d.cts +0 -88
- package/dist/types-DLZaKA17.d.ts +0 -88
package/dist/index.js
CHANGED
|
@@ -13237,6 +13237,26 @@ var marginfi_0_1_10_default = {
|
|
|
13237
13237
|
code: 6604,
|
|
13238
13238
|
name: "CircuitBreakerPriceJump",
|
|
13239
13239
|
msg: "Oracle price deviates too far from the circuit breaker reference; action rejected"
|
|
13240
|
+
},
|
|
13241
|
+
{
|
|
13242
|
+
code: 6700,
|
|
13243
|
+
name: "ScopeInvalidAccount",
|
|
13244
|
+
msg: "Scope oracle account is not owned by the Scope program or is malformed"
|
|
13245
|
+
},
|
|
13246
|
+
{
|
|
13247
|
+
code: 6701,
|
|
13248
|
+
name: "ScopeInvalidEntry",
|
|
13249
|
+
msg: "Scope entry index is out of range or the entry has never been refreshed"
|
|
13250
|
+
},
|
|
13251
|
+
{
|
|
13252
|
+
code: 6702,
|
|
13253
|
+
name: "ScopeStalePrice",
|
|
13254
|
+
msg: "Scope price is stale"
|
|
13255
|
+
},
|
|
13256
|
+
{
|
|
13257
|
+
code: 6703,
|
|
13258
|
+
name: "UseConfigureBankOracleScope",
|
|
13259
|
+
msg: "Use lending_pool_configure_bank_oracle_scope; Scope requires an entry index"
|
|
13240
13260
|
}
|
|
13241
13261
|
],
|
|
13242
13262
|
types: [
|
|
@@ -14326,13 +14346,13 @@ var marginfi_0_1_10_default = {
|
|
|
14326
14346
|
type: "u16"
|
|
14327
14347
|
},
|
|
14328
14348
|
{
|
|
14329
|
-
name: "
|
|
14330
|
-
|
|
14331
|
-
|
|
14332
|
-
|
|
14333
|
-
|
|
14334
|
-
|
|
14335
|
-
|
|
14349
|
+
name: "scope_entry_index",
|
|
14350
|
+
docs: [
|
|
14351
|
+
"Entry index into the Scope OraclePrices price list. Only read when",
|
|
14352
|
+
"oracle_setup == OracleSetup::Scope; ignored (and zero) for every other setup.",
|
|
14353
|
+
"Occupies what was previously _padding0, so the layout is unchanged."
|
|
14354
|
+
],
|
|
14355
|
+
type: "u16"
|
|
14336
14356
|
},
|
|
14337
14357
|
{
|
|
14338
14358
|
name: "oracle_max_confidence",
|
|
@@ -19283,6 +19303,144 @@ var marginfi_0_1_10_default = {
|
|
|
19283
19303
|
},
|
|
19284
19304
|
{
|
|
19285
19305
|
name: "FixedJuplend"
|
|
19306
|
+
},
|
|
19307
|
+
{
|
|
19308
|
+
name: "Scope"
|
|
19309
|
+
},
|
|
19310
|
+
{
|
|
19311
|
+
name: "PythMSOL"
|
|
19312
|
+
},
|
|
19313
|
+
{
|
|
19314
|
+
name: "KaminoMSOL"
|
|
19315
|
+
},
|
|
19316
|
+
{
|
|
19317
|
+
name: "JuplendMSOL"
|
|
19318
|
+
},
|
|
19319
|
+
{
|
|
19320
|
+
name: "PythLST"
|
|
19321
|
+
},
|
|
19322
|
+
{
|
|
19323
|
+
name: "KaminoLST"
|
|
19324
|
+
},
|
|
19325
|
+
{
|
|
19326
|
+
name: "JuplendLST"
|
|
19327
|
+
},
|
|
19328
|
+
{
|
|
19329
|
+
name: "PTPyth"
|
|
19330
|
+
},
|
|
19331
|
+
{
|
|
19332
|
+
name: "PTFixed"
|
|
19333
|
+
},
|
|
19334
|
+
{
|
|
19335
|
+
name: "Reserved27"
|
|
19336
|
+
},
|
|
19337
|
+
{
|
|
19338
|
+
name: "Reserved28"
|
|
19339
|
+
},
|
|
19340
|
+
{
|
|
19341
|
+
name: "Reserved29"
|
|
19342
|
+
},
|
|
19343
|
+
{
|
|
19344
|
+
name: "Reserved30"
|
|
19345
|
+
},
|
|
19346
|
+
{
|
|
19347
|
+
name: "Reserved31"
|
|
19348
|
+
},
|
|
19349
|
+
{
|
|
19350
|
+
name: "Reserved32"
|
|
19351
|
+
},
|
|
19352
|
+
{
|
|
19353
|
+
name: "Reserved33"
|
|
19354
|
+
},
|
|
19355
|
+
{
|
|
19356
|
+
name: "Reserved34"
|
|
19357
|
+
},
|
|
19358
|
+
{
|
|
19359
|
+
name: "Reserved35"
|
|
19360
|
+
},
|
|
19361
|
+
{
|
|
19362
|
+
name: "Reserved36"
|
|
19363
|
+
},
|
|
19364
|
+
{
|
|
19365
|
+
name: "Reserved37"
|
|
19366
|
+
},
|
|
19367
|
+
{
|
|
19368
|
+
name: "Reserved38"
|
|
19369
|
+
},
|
|
19370
|
+
{
|
|
19371
|
+
name: "Reserved39"
|
|
19372
|
+
},
|
|
19373
|
+
{
|
|
19374
|
+
name: "Reserved40"
|
|
19375
|
+
},
|
|
19376
|
+
{
|
|
19377
|
+
name: "Reserved41"
|
|
19378
|
+
},
|
|
19379
|
+
{
|
|
19380
|
+
name: "Reserved42"
|
|
19381
|
+
},
|
|
19382
|
+
{
|
|
19383
|
+
name: "Reserved43"
|
|
19384
|
+
},
|
|
19385
|
+
{
|
|
19386
|
+
name: "Reserved44"
|
|
19387
|
+
},
|
|
19388
|
+
{
|
|
19389
|
+
name: "Reserved45"
|
|
19390
|
+
},
|
|
19391
|
+
{
|
|
19392
|
+
name: "Reserved46"
|
|
19393
|
+
},
|
|
19394
|
+
{
|
|
19395
|
+
name: "Reserved47"
|
|
19396
|
+
},
|
|
19397
|
+
{
|
|
19398
|
+
name: "Reserved48"
|
|
19399
|
+
},
|
|
19400
|
+
{
|
|
19401
|
+
name: "Reserved49"
|
|
19402
|
+
},
|
|
19403
|
+
{
|
|
19404
|
+
name: "Reserved50"
|
|
19405
|
+
},
|
|
19406
|
+
{
|
|
19407
|
+
name: "Reserved51"
|
|
19408
|
+
},
|
|
19409
|
+
{
|
|
19410
|
+
name: "Reserved52"
|
|
19411
|
+
},
|
|
19412
|
+
{
|
|
19413
|
+
name: "Reserved53"
|
|
19414
|
+
},
|
|
19415
|
+
{
|
|
19416
|
+
name: "Reserved54"
|
|
19417
|
+
},
|
|
19418
|
+
{
|
|
19419
|
+
name: "Reserved55"
|
|
19420
|
+
},
|
|
19421
|
+
{
|
|
19422
|
+
name: "Reserved56"
|
|
19423
|
+
},
|
|
19424
|
+
{
|
|
19425
|
+
name: "Reserved57"
|
|
19426
|
+
},
|
|
19427
|
+
{
|
|
19428
|
+
name: "Reserved58"
|
|
19429
|
+
},
|
|
19430
|
+
{
|
|
19431
|
+
name: "Reserved59"
|
|
19432
|
+
},
|
|
19433
|
+
{
|
|
19434
|
+
name: "Reserved60"
|
|
19435
|
+
},
|
|
19436
|
+
{
|
|
19437
|
+
name: "Reserved61"
|
|
19438
|
+
},
|
|
19439
|
+
{
|
|
19440
|
+
name: "Reserved62"
|
|
19441
|
+
},
|
|
19442
|
+
{
|
|
19443
|
+
name: "Reserved63"
|
|
19286
19444
|
}
|
|
19287
19445
|
]
|
|
19288
19446
|
}
|
|
@@ -20703,6 +20861,16 @@ var OracleSetup = /* @__PURE__ */ ((OracleSetup3) => {
|
|
|
20703
20861
|
OracleSetup3["JuplendPythPull"] = "JuplendPythPull";
|
|
20704
20862
|
OracleSetup3["JuplendSwitchboardPull"] = "JuplendSwitchboardPull";
|
|
20705
20863
|
OracleSetup3["FixedJuplend"] = "FixedJuplend";
|
|
20864
|
+
OracleSetup3["Scope"] = "Scope";
|
|
20865
|
+
OracleSetup3["PythMSOL"] = "PythMSOL";
|
|
20866
|
+
OracleSetup3["KaminoMSOL"] = "KaminoMSOL";
|
|
20867
|
+
OracleSetup3["JuplendMSOL"] = "JuplendMSOL";
|
|
20868
|
+
OracleSetup3["PythLST"] = "PythLST";
|
|
20869
|
+
OracleSetup3["KaminoLST"] = "KaminoLST";
|
|
20870
|
+
OracleSetup3["JuplendLST"] = "JuplendLST";
|
|
20871
|
+
OracleSetup3["PTPyth"] = "PTPyth";
|
|
20872
|
+
OracleSetup3["PTFixed"] = "PTFixed";
|
|
20873
|
+
OracleSetup3["Unknown"] = "Unknown";
|
|
20706
20874
|
return OracleSetup3;
|
|
20707
20875
|
})(OracleSetup || {});
|
|
20708
20876
|
var AssetTag = /* @__PURE__ */ ((AssetTag3) => {
|
|
@@ -21764,8 +21932,26 @@ function serializeOracleSetupToIndex(oracleSetup) {
|
|
|
21764
21932
|
return 16;
|
|
21765
21933
|
case "FixedJuplend" /* FixedJuplend */:
|
|
21766
21934
|
return 17;
|
|
21935
|
+
case "Scope" /* Scope */:
|
|
21936
|
+
return 18;
|
|
21937
|
+
case "PythMSOL" /* PythMSOL */:
|
|
21938
|
+
return 19;
|
|
21939
|
+
case "KaminoMSOL" /* KaminoMSOL */:
|
|
21940
|
+
return 20;
|
|
21941
|
+
case "JuplendMSOL" /* JuplendMSOL */:
|
|
21942
|
+
return 21;
|
|
21943
|
+
case "PythLST" /* PythLST */:
|
|
21944
|
+
return 22;
|
|
21945
|
+
case "KaminoLST" /* KaminoLST */:
|
|
21946
|
+
return 23;
|
|
21947
|
+
case "JuplendLST" /* JuplendLST */:
|
|
21948
|
+
return 24;
|
|
21949
|
+
case "PTPyth" /* PTPyth */:
|
|
21950
|
+
return 25;
|
|
21951
|
+
case "PTFixed" /* PTFixed */:
|
|
21952
|
+
return 26;
|
|
21767
21953
|
default:
|
|
21768
|
-
|
|
21954
|
+
throw new Error(`Cannot serialize oracle setup "${oracleSetup}"`);
|
|
21769
21955
|
}
|
|
21770
21956
|
}
|
|
21771
21957
|
function serializeOracleSetup(oracleSetup) {
|
|
@@ -21806,6 +21992,24 @@ function serializeOracleSetup(oracleSetup) {
|
|
|
21806
21992
|
return { juplendSwitchboardPull: {} };
|
|
21807
21993
|
case "FixedJuplend" /* FixedJuplend */:
|
|
21808
21994
|
return { fixedJuplend: {} };
|
|
21995
|
+
case "Scope" /* Scope */:
|
|
21996
|
+
return { scope: {} };
|
|
21997
|
+
case "PythMSOL" /* PythMSOL */:
|
|
21998
|
+
return { pythMsol: {} };
|
|
21999
|
+
case "KaminoMSOL" /* KaminoMSOL */:
|
|
22000
|
+
return { kaminoMsol: {} };
|
|
22001
|
+
case "JuplendMSOL" /* JuplendMSOL */:
|
|
22002
|
+
return { juplendMsol: {} };
|
|
22003
|
+
case "PythLST" /* PythLST */:
|
|
22004
|
+
return { pythLst: {} };
|
|
22005
|
+
case "KaminoLST" /* KaminoLST */:
|
|
22006
|
+
return { kaminoLst: {} };
|
|
22007
|
+
case "JuplendLST" /* JuplendLST */:
|
|
22008
|
+
return { juplendLst: {} };
|
|
22009
|
+
case "PTPyth" /* PTPyth */:
|
|
22010
|
+
return { ptPyth: {} };
|
|
22011
|
+
case "PTFixed" /* PTFixed */:
|
|
22012
|
+
return { ptFixed: {} };
|
|
21809
22013
|
default:
|
|
21810
22014
|
throw new Error(`Invalid oracle setup "${oracleSetup}"`);
|
|
21811
22015
|
}
|
|
@@ -21919,7 +22123,8 @@ function toBankConfigDto(bankConfig) {
|
|
|
21919
22123
|
interestRateConfig: toInterestRateConfigDto(bankConfig.interestRateConfig),
|
|
21920
22124
|
configFlags: bankConfig.configFlags,
|
|
21921
22125
|
oracleMaxConfidence: bankConfig.oracleMaxConfidence,
|
|
21922
|
-
fixedPrice: bankConfig.fixedPrice.toString()
|
|
22126
|
+
fixedPrice: bankConfig.fixedPrice.toString(),
|
|
22127
|
+
scopeEntryIndex: bankConfig.scopeEntryIndex
|
|
21923
22128
|
};
|
|
21924
22129
|
}
|
|
21925
22130
|
function toInterestRateConfigDto(interestRateConfig) {
|
|
@@ -22025,7 +22230,8 @@ function bankConfigToBankConfigRaw(config) {
|
|
|
22025
22230
|
totalAssetValueInitLimit: new BN9(config.totalAssetValueInitLimit.toString()),
|
|
22026
22231
|
oracleMaxAge: config.oracleMaxAge,
|
|
22027
22232
|
oracleMaxConfidence: config.oracleMaxConfidence,
|
|
22028
|
-
fixedPrice: bigNumberToWrappedI80F48(config.fixedPrice)
|
|
22233
|
+
fixedPrice: bigNumberToWrappedI80F48(config.fixedPrice),
|
|
22234
|
+
scopeEntryIndex: config.scopeEntryIndex
|
|
22029
22235
|
};
|
|
22030
22236
|
}
|
|
22031
22237
|
function bankConfigRawToDto(bankConfigRaw) {
|
|
@@ -22046,7 +22252,8 @@ function bankConfigRawToDto(bankConfigRaw) {
|
|
|
22046
22252
|
interestRateConfig: bankConfigRaw.interestRateConfig,
|
|
22047
22253
|
configFlags: bankConfigRaw.configFlags,
|
|
22048
22254
|
oracleMaxConfidence: bankConfigRaw.oracleMaxConfidence,
|
|
22049
|
-
fixedPrice: bankConfigRaw.fixedPrice
|
|
22255
|
+
fixedPrice: bankConfigRaw.fixedPrice,
|
|
22256
|
+
scopeEntryIndex: bankConfigRaw.scopeEntryIndex
|
|
22050
22257
|
};
|
|
22051
22258
|
}
|
|
22052
22259
|
|
|
@@ -22334,7 +22541,8 @@ function dtoToBankConfig(bankConfigDto) {
|
|
|
22334
22541
|
oracleMaxAge: bankConfigDto.oracleMaxAge,
|
|
22335
22542
|
interestRateConfig: dtoToInterestRateConfig(bankConfigDto.interestRateConfig),
|
|
22336
22543
|
oracleMaxConfidence: bankConfigDto.oracleMaxConfidence,
|
|
22337
|
-
fixedPrice: new BigNumber3(bankConfigDto.fixedPrice)
|
|
22544
|
+
fixedPrice: new BigNumber3(bankConfigDto.fixedPrice),
|
|
22545
|
+
scopeEntryIndex: bankConfigDto.scopeEntryIndex ?? 0
|
|
22338
22546
|
};
|
|
22339
22547
|
}
|
|
22340
22548
|
function dtoToInterestRateConfig(interestRateConfigDto) {
|
|
@@ -22447,7 +22655,8 @@ function dtoToBankConfigRaw(bankConfigDto) {
|
|
|
22447
22655
|
oracleMaxAge: bankConfigDto.oracleMaxAge,
|
|
22448
22656
|
interestRateConfig: bankConfigDto.interestRateConfig,
|
|
22449
22657
|
oracleMaxConfidence: bankConfigDto.oracleMaxConfidence,
|
|
22450
|
-
fixedPrice: bankConfigDto.fixedPrice
|
|
22658
|
+
fixedPrice: bankConfigDto.fixedPrice,
|
|
22659
|
+
scopeEntryIndex: bankConfigDto.scopeEntryIndex ?? 0
|
|
22451
22660
|
};
|
|
22452
22661
|
}
|
|
22453
22662
|
function parseBankConfigRaw(bankConfigRaw) {
|
|
@@ -22464,7 +22673,7 @@ function parseBankConfigRaw(bankConfigRaw) {
|
|
|
22464
22673
|
const configFlags = bankConfigRaw.configFlags;
|
|
22465
22674
|
const oracleSetup = parseOracleSetup(bankConfigRaw.oracleSetup);
|
|
22466
22675
|
const oracleKeys = bankConfigRaw.oracleKeys;
|
|
22467
|
-
const oracleMaxAge = bankConfigRaw.oracleMaxAge === 0 ? DEFAULT_ORACLE_MAX_AGE : bankConfigRaw.oracleMaxAge;
|
|
22676
|
+
const oracleMaxAge = bankConfigRaw.oracleMaxAge === 0 && oracleSetup !== "Scope" /* Scope */ ? DEFAULT_ORACLE_MAX_AGE : bankConfigRaw.oracleMaxAge;
|
|
22468
22677
|
const interestRateConfig = {
|
|
22469
22678
|
insuranceFeeFixedApr: wrappedI80F48toBigNumber(
|
|
22470
22679
|
bankConfigRaw.interestRateConfig.insuranceFeeFixedApr
|
|
@@ -22487,6 +22696,7 @@ function parseBankConfigRaw(bankConfigRaw) {
|
|
|
22487
22696
|
};
|
|
22488
22697
|
const oracleMaxConfidence = bankConfigRaw.oracleMaxConfidence;
|
|
22489
22698
|
const fixedPrice = wrappedI80F48toBigNumber(bankConfigRaw.fixedPrice);
|
|
22699
|
+
const scopeEntryIndex = bankConfigRaw.scopeEntryIndex ?? 0;
|
|
22490
22700
|
return {
|
|
22491
22701
|
assetWeightInit,
|
|
22492
22702
|
assetWeightMaint,
|
|
@@ -22504,7 +22714,8 @@ function parseBankConfigRaw(bankConfigRaw) {
|
|
|
22504
22714
|
oracleMaxAge,
|
|
22505
22715
|
interestRateConfig,
|
|
22506
22716
|
oracleMaxConfidence,
|
|
22507
|
-
fixedPrice
|
|
22717
|
+
fixedPrice,
|
|
22718
|
+
scopeEntryIndex
|
|
22508
22719
|
};
|
|
22509
22720
|
}
|
|
22510
22721
|
function parseRiskTier(riskTierRaw) {
|
|
@@ -22566,18 +22777,36 @@ function parseOracleSetup(oracleSetupRaw) {
|
|
|
22566
22777
|
return "SolendPythPull" /* SolendPythPull */;
|
|
22567
22778
|
case "solendswitchboardpull":
|
|
22568
22779
|
return "SolendSwitchboardPull" /* SolendSwitchboardPull */;
|
|
22569
|
-
case "
|
|
22780
|
+
case "fixedkamino":
|
|
22570
22781
|
return "FixedKamino" /* FixedKamino */;
|
|
22571
|
-
case "
|
|
22782
|
+
case "fixeddrift":
|
|
22572
22783
|
return "FixedDrift" /* FixedDrift */;
|
|
22573
22784
|
case "juplendpythpull":
|
|
22574
22785
|
return "JuplendPythPull" /* JuplendPythPull */;
|
|
22575
22786
|
case "juplendswitchboardpull":
|
|
22576
22787
|
return "JuplendSwitchboardPull" /* JuplendSwitchboardPull */;
|
|
22577
|
-
case "
|
|
22788
|
+
case "fixedjuplend":
|
|
22578
22789
|
return "FixedJuplend" /* FixedJuplend */;
|
|
22790
|
+
case "scope":
|
|
22791
|
+
return "Scope" /* Scope */;
|
|
22792
|
+
case "pythmsol":
|
|
22793
|
+
return "PythMSOL" /* PythMSOL */;
|
|
22794
|
+
case "kaminomsol":
|
|
22795
|
+
return "KaminoMSOL" /* KaminoMSOL */;
|
|
22796
|
+
case "juplendmsol":
|
|
22797
|
+
return "JuplendMSOL" /* JuplendMSOL */;
|
|
22798
|
+
case "pythlst":
|
|
22799
|
+
return "PythLST" /* PythLST */;
|
|
22800
|
+
case "kaminolst":
|
|
22801
|
+
return "KaminoLST" /* KaminoLST */;
|
|
22802
|
+
case "juplendlst":
|
|
22803
|
+
return "JuplendLST" /* JuplendLST */;
|
|
22804
|
+
case "ptpyth":
|
|
22805
|
+
return "PTPyth" /* PTPyth */;
|
|
22806
|
+
case "ptfixed":
|
|
22807
|
+
return "PTFixed" /* PTFixed */;
|
|
22579
22808
|
default:
|
|
22580
|
-
return "
|
|
22809
|
+
return "Unknown" /* Unknown */;
|
|
22581
22810
|
}
|
|
22582
22811
|
}
|
|
22583
22812
|
function getActiveEmodeFlags(flags) {
|
|
@@ -25708,6 +25937,17 @@ var categorizePythBanks = (banks) => {
|
|
|
25708
25937
|
const juplendPythPullBanks = banks.filter(
|
|
25709
25938
|
(bank) => bank.config.oracleSetup === "JuplendPythPull" /* JuplendPythPull */
|
|
25710
25939
|
);
|
|
25940
|
+
const pythMultipliedBanks = banks.filter(
|
|
25941
|
+
(bank) => [
|
|
25942
|
+
"PythMSOL" /* PythMSOL */,
|
|
25943
|
+
"KaminoMSOL" /* KaminoMSOL */,
|
|
25944
|
+
"JuplendMSOL" /* JuplendMSOL */,
|
|
25945
|
+
"PythLST" /* PythLST */,
|
|
25946
|
+
"KaminoLST" /* KaminoLST */,
|
|
25947
|
+
"JuplendLST" /* JuplendLST */,
|
|
25948
|
+
"PTPyth" /* PTPyth */
|
|
25949
|
+
].includes(bank.config.oracleSetup)
|
|
25950
|
+
);
|
|
25711
25951
|
return {
|
|
25712
25952
|
pythLegacyBanks,
|
|
25713
25953
|
pythPushBanks,
|
|
@@ -25715,7 +25955,8 @@ var categorizePythBanks = (banks) => {
|
|
|
25715
25955
|
pythPushKaminosBanks,
|
|
25716
25956
|
driftPythPullBanks,
|
|
25717
25957
|
solendPythPullBanks,
|
|
25718
|
-
juplendPythPullBanks
|
|
25958
|
+
juplendPythPullBanks,
|
|
25959
|
+
pythMultipliedBanks
|
|
25719
25960
|
};
|
|
25720
25961
|
};
|
|
25721
25962
|
var convertVoteAccCoeffsToBankCoeffs = (pythStakedCollateralBanks, validatorVoteAccountByBank, voteAccCoeffs) => {
|
|
@@ -25732,7 +25973,7 @@ var extractPythOracleKeys = (pythBanks) => {
|
|
|
25732
25973
|
const keys = pythBanks.map((bank) => bank.config.oracleKeys[0].toBase58());
|
|
25733
25974
|
return [...keys];
|
|
25734
25975
|
};
|
|
25735
|
-
var mapPythBanksToOraclePrices = (pythPushBanks,
|
|
25976
|
+
var mapPythBanksToOraclePrices = (pythPushBanks, multipliedBanks, oraclePrices, priceCoeffByBank) => {
|
|
25736
25977
|
const bankOraclePriceMap = /* @__PURE__ */ new Map();
|
|
25737
25978
|
pythPushBanks.forEach((bank) => {
|
|
25738
25979
|
const oracleKey = bank.config.oracleKeys[0].toBase58();
|
|
@@ -25741,7 +25982,7 @@ var mapPythBanksToOraclePrices = (pythPushBanks, pythStakedCollateralBanks, orac
|
|
|
25741
25982
|
bankOraclePriceMap.set(bank.address.toBase58(), oraclePrice);
|
|
25742
25983
|
}
|
|
25743
25984
|
});
|
|
25744
|
-
|
|
25985
|
+
multipliedBanks.forEach((bank) => {
|
|
25745
25986
|
const priceCoeff = priceCoeffByBank[bank.address.toBase58()];
|
|
25746
25987
|
const oracleKey = bank.config.oracleKeys[0]?.toBase58();
|
|
25747
25988
|
if (oracleKey && priceCoeff !== void 0) {
|
|
@@ -25759,7 +26000,7 @@ var mapPythBanksToOraclePrices = (pythPushBanks, pythStakedCollateralBanks, orac
|
|
|
25759
26000
|
};
|
|
25760
26001
|
var adjustPriceComponent = (priceComponent, priceCoeff) => ({
|
|
25761
26002
|
price: priceComponent.price.multipliedBy(priceCoeff),
|
|
25762
|
-
confidence: priceComponent.confidence,
|
|
26003
|
+
confidence: priceComponent.confidence.multipliedBy(priceCoeff),
|
|
25763
26004
|
lowestPrice: priceComponent.lowestPrice.multipliedBy(priceCoeff),
|
|
25764
26005
|
highestPrice: priceComponent.highestPrice.multipliedBy(priceCoeff)
|
|
25765
26006
|
});
|
|
@@ -25811,6 +26052,7 @@ var ORACLE_SOURCES = {
|
|
|
25811
26052
|
switchboard: "Switchboard",
|
|
25812
26053
|
pyth: "Pyth",
|
|
25813
26054
|
fixed: "Fixed",
|
|
26055
|
+
scope: "Scope",
|
|
25814
26056
|
unknown: "Unknown"
|
|
25815
26057
|
};
|
|
25816
26058
|
function getOracleSourceNameFromKey(oracleSourceKey) {
|
|
@@ -25837,14 +26079,25 @@ function getOracleSourceFromOracleSetup(oracleSetup) {
|
|
|
25837
26079
|
case "DriftPythPull" /* DriftPythPull */:
|
|
25838
26080
|
case "SolendPythPull" /* SolendPythPull */:
|
|
25839
26081
|
case "JuplendPythPull" /* JuplendPythPull */:
|
|
26082
|
+
case "PythMSOL" /* PythMSOL */:
|
|
26083
|
+
case "KaminoMSOL" /* KaminoMSOL */:
|
|
26084
|
+
case "JuplendMSOL" /* JuplendMSOL */:
|
|
26085
|
+
case "PythLST" /* PythLST */:
|
|
26086
|
+
case "KaminoLST" /* KaminoLST */:
|
|
26087
|
+
case "JuplendLST" /* JuplendLST */:
|
|
26088
|
+
case "PTPyth" /* PTPyth */:
|
|
25840
26089
|
oracleSourceKey = "pyth";
|
|
25841
26090
|
break;
|
|
25842
26091
|
case "Fixed" /* Fixed */:
|
|
25843
26092
|
case "FixedKamino" /* FixedKamino */:
|
|
25844
26093
|
case "FixedDrift" /* FixedDrift */:
|
|
25845
26094
|
case "FixedJuplend" /* FixedJuplend */:
|
|
26095
|
+
case "PTFixed" /* PTFixed */:
|
|
25846
26096
|
oracleSourceKey = "fixed";
|
|
25847
26097
|
break;
|
|
26098
|
+
case "Scope" /* Scope */:
|
|
26099
|
+
oracleSourceKey = "scope";
|
|
26100
|
+
break;
|
|
25848
26101
|
default:
|
|
25849
26102
|
oracleSourceKey = "unknown";
|
|
25850
26103
|
break;
|
|
@@ -27319,6 +27572,19 @@ function computeBankRiskAccountKeys(bank) {
|
|
|
27319
27572
|
if (bank.config.assetTag === 3 /* KAMINO */ || bank.config.assetTag === 4 /* DRIFT */ || bank.config.assetTag === 5 /* SOLEND */ || bank.config.assetTag === 6 /* JUPLEND */) {
|
|
27320
27573
|
keys.push(bank.config.oracleKeys[1]);
|
|
27321
27574
|
}
|
|
27575
|
+
switch (bank.config.oracleSetup) {
|
|
27576
|
+
case "PythMSOL" /* PythMSOL */:
|
|
27577
|
+
case "PythLST" /* PythLST */:
|
|
27578
|
+
case "PTPyth" /* PTPyth */:
|
|
27579
|
+
keys.push(bank.config.oracleKeys[1]);
|
|
27580
|
+
break;
|
|
27581
|
+
case "KaminoMSOL" /* KaminoMSOL */:
|
|
27582
|
+
case "JuplendMSOL" /* JuplendMSOL */:
|
|
27583
|
+
case "KaminoLST" /* KaminoLST */:
|
|
27584
|
+
case "JuplendLST" /* JuplendLST */:
|
|
27585
|
+
keys.push(bank.config.oracleKeys[2]);
|
|
27586
|
+
break;
|
|
27587
|
+
}
|
|
27322
27588
|
if (bank.config.assetTag === 2 /* STAKED */) {
|
|
27323
27589
|
keys.push(bank.config.oracleKeys[1], bank.config.oracleKeys[2]);
|
|
27324
27590
|
const onrampKey = bank.config.oracleKeys[3];
|
|
@@ -72073,7 +72339,9 @@ function decodeExponentVault(data) {
|
|
|
72073
72339
|
finalSyExchangeRate: exponentNumberToBigNumber(
|
|
72074
72340
|
get("final_sy_exchange_rate", "finalSyExchangeRate")
|
|
72075
72341
|
),
|
|
72076
|
-
status: Number(get("status", "status") ?? 0)
|
|
72342
|
+
status: Number(get("status", "status") ?? 0),
|
|
72343
|
+
startTs: Number(get("start_ts", "startTs") ?? 0),
|
|
72344
|
+
duration: Number(get("duration", "duration") ?? 0)
|
|
72077
72345
|
};
|
|
72078
72346
|
}
|
|
72079
72347
|
function decodeExponentMarketVault(data) {
|
|
@@ -74942,6 +75210,82 @@ function makeRefreshIntegrationBanksIxs(marginfiAccount, bankMap, banksToExclude
|
|
|
74942
75210
|
keys: [...kaminoRefreshIxs.keys, ...updateDriftMarketIxs.keys, ...updateJupLendRateIxs.keys]
|
|
74943
75211
|
};
|
|
74944
75212
|
}
|
|
75213
|
+
new PublicKey("HFn8GnPADiny6XqUoWE8uRPPxb29ikn4yTuPa9MF2fWJ");
|
|
75214
|
+
var SCOPE_ORACLE_PRICES_DISCRIMINATOR = Buffer.from([89, 128, 118, 221, 6, 72, 180, 146]);
|
|
75215
|
+
var SCOPE_MAX_ENTRIES = 512;
|
|
75216
|
+
var ENTRIES_OFFSET = 40;
|
|
75217
|
+
var DATED_PRICE_SIZE = 56;
|
|
75218
|
+
var SCOPE_ORACLE_PRICES_SIZE = ENTRIES_OFFSET + SCOPE_MAX_ENTRIES * DATED_PRICE_SIZE;
|
|
75219
|
+
function decodeScopePriceAtIndex(data, entryIndex) {
|
|
75220
|
+
if (data.length !== SCOPE_ORACLE_PRICES_SIZE) {
|
|
75221
|
+
throw new Error(`Invalid Scope OraclePrices account size: ${data.length}`);
|
|
75222
|
+
}
|
|
75223
|
+
if (!data.subarray(0, 8).equals(SCOPE_ORACLE_PRICES_DISCRIMINATOR)) {
|
|
75224
|
+
throw new Error("Invalid Scope OraclePrices discriminator");
|
|
75225
|
+
}
|
|
75226
|
+
if (entryIndex < 0 || entryIndex >= SCOPE_MAX_ENTRIES) {
|
|
75227
|
+
throw new Error(`Scope entry index out of range: ${entryIndex}`);
|
|
75228
|
+
}
|
|
75229
|
+
const offset = ENTRIES_OFFSET + entryIndex * DATED_PRICE_SIZE;
|
|
75230
|
+
const value = data.readBigUInt64LE(offset);
|
|
75231
|
+
const exp = data.readBigUInt64LE(offset + 8);
|
|
75232
|
+
const lastUpdatedSlot = data.readBigUInt64LE(offset + 16);
|
|
75233
|
+
const unixTimestamp = data.readBigUInt64LE(offset + 24);
|
|
75234
|
+
const price = new BigNumber3(value.toString()).shiftedBy(-Number(exp));
|
|
75235
|
+
return {
|
|
75236
|
+
price,
|
|
75237
|
+
lastUpdatedSlot: Number(lastUpdatedSlot),
|
|
75238
|
+
unixTimestamp: Number(unixTimestamp)
|
|
75239
|
+
};
|
|
75240
|
+
}
|
|
75241
|
+
new PublicKey("MarBmsSgKXdrN1egZf5sqe1TMai9K1rChYNDJgjq7aD");
|
|
75242
|
+
var MARINADE_STATE_SIZE = 520;
|
|
75243
|
+
var MSOL_PRICE_OFFSET = 512;
|
|
75244
|
+
var MSOL_PRICE_PRECISION = new BigNumber3(2).pow(32);
|
|
75245
|
+
function decodeMarinadeState(data) {
|
|
75246
|
+
if (data.length !== MARINADE_STATE_SIZE) {
|
|
75247
|
+
throw new Error(`Invalid Marinade State account size: ${data.length}`);
|
|
75248
|
+
}
|
|
75249
|
+
const msolPriceRaw = data.readBigUInt64LE(MSOL_PRICE_OFFSET);
|
|
75250
|
+
return {
|
|
75251
|
+
msolPrice: new BigNumber3(msolPriceRaw.toString()).div(MSOL_PRICE_PRECISION)
|
|
75252
|
+
};
|
|
75253
|
+
}
|
|
75254
|
+
new PublicKey(
|
|
75255
|
+
"SPoo1Ku8WFXoNDMHPsrGSTSG1Y47rzgn41SLUNakuHy"
|
|
75256
|
+
);
|
|
75257
|
+
new PublicKey(
|
|
75258
|
+
"SP12tWFxD9oJsVWNavTTBZvMbA6gkAmxtVgxdqvyvhY"
|
|
75259
|
+
);
|
|
75260
|
+
new PublicKey(
|
|
75261
|
+
"SPMBzsVUuoHA4Jm6KunbsotaahvVikZs1JyTW6iJvbn"
|
|
75262
|
+
);
|
|
75263
|
+
var ACCOUNT_TYPE_STAKE_POOL = 1;
|
|
75264
|
+
var TOTAL_LAMPORTS_OFFSET = 258;
|
|
75265
|
+
var POOL_TOKEN_SUPPLY_OFFSET = 266;
|
|
75266
|
+
var LAST_UPDATE_EPOCH_OFFSET = 274;
|
|
75267
|
+
function decodeStakePool(data) {
|
|
75268
|
+
if (data.length < LAST_UPDATE_EPOCH_OFFSET + 8) {
|
|
75269
|
+
throw new Error(`Invalid StakePool account size: ${data.length}`);
|
|
75270
|
+
}
|
|
75271
|
+
if (data[0] !== ACCOUNT_TYPE_STAKE_POOL) {
|
|
75272
|
+
throw new Error(`Invalid StakePool account type: ${data[0]}`);
|
|
75273
|
+
}
|
|
75274
|
+
const totalLamports = data.readBigUInt64LE(TOTAL_LAMPORTS_OFFSET);
|
|
75275
|
+
const poolTokenSupply = data.readBigUInt64LE(POOL_TOKEN_SUPPLY_OFFSET);
|
|
75276
|
+
const lastUpdateEpoch = Number(data.readBigUInt64LE(LAST_UPDATE_EPOCH_OFFSET));
|
|
75277
|
+
if (poolTokenSupply === 0n) {
|
|
75278
|
+
throw new Error("StakePool has zero token supply");
|
|
75279
|
+
}
|
|
75280
|
+
return {
|
|
75281
|
+
totalLamports,
|
|
75282
|
+
poolTokenSupply,
|
|
75283
|
+
lastUpdateEpoch,
|
|
75284
|
+
exchangeRate: new BigNumber3(totalLamports.toString()).div(
|
|
75285
|
+
new BigNumber3(poolTokenSupply.toString())
|
|
75286
|
+
)
|
|
75287
|
+
};
|
|
75288
|
+
}
|
|
74945
75289
|
var GAMMA_VAULT_PROGRAM_ID = new PublicKey(
|
|
74946
75290
|
"GaMmanX9i4jGmqDZZD2tbD6B2v9p21btenPneMXnTczV"
|
|
74947
75291
|
);
|
|
@@ -80549,16 +80893,17 @@ function chunkArray(array4, chunkSize) {
|
|
|
80549
80893
|
}
|
|
80550
80894
|
|
|
80551
80895
|
// src/services/price/services/pyth-oracle.service.ts
|
|
80552
|
-
var fetchPythOracleData = async (banks, opts) => {
|
|
80896
|
+
var fetchPythOracleData = async (banks, opts, priceCoeffByBank = {}) => {
|
|
80553
80897
|
const {
|
|
80554
80898
|
pythPushBanks,
|
|
80555
80899
|
pythStakedCollateralBanks,
|
|
80556
80900
|
pythPushKaminosBanks,
|
|
80557
80901
|
driftPythPullBanks,
|
|
80558
80902
|
solendPythPullBanks,
|
|
80559
|
-
juplendPythPullBanks
|
|
80903
|
+
juplendPythPullBanks,
|
|
80904
|
+
pythMultipliedBanks
|
|
80560
80905
|
} = categorizePythBanks(banks);
|
|
80561
|
-
if (!pythPushBanks.length && !pythStakedCollateralBanks.length && !pythPushKaminosBanks.length && !driftPythPullBanks.length && !solendPythPullBanks.length && !juplendPythPullBanks.length) {
|
|
80906
|
+
if (!pythPushBanks.length && !pythStakedCollateralBanks.length && !pythPushKaminosBanks.length && !driftPythPullBanks.length && !solendPythPullBanks.length && !juplendPythPullBanks.length && !pythMultipliedBanks.length) {
|
|
80562
80907
|
return {
|
|
80563
80908
|
bankOraclePriceMap: /* @__PURE__ */ new Map()
|
|
80564
80909
|
};
|
|
@@ -80569,9 +80914,9 @@ var fetchPythOracleData = async (banks, opts) => {
|
|
|
80569
80914
|
...pythPushKaminosBanks,
|
|
80570
80915
|
...driftPythPullBanks,
|
|
80571
80916
|
...solendPythPullBanks,
|
|
80572
|
-
...juplendPythPullBanks
|
|
80917
|
+
...juplendPythPullBanks,
|
|
80918
|
+
...pythMultipliedBanks
|
|
80573
80919
|
];
|
|
80574
|
-
const priceCoeffByBank = {};
|
|
80575
80920
|
const pythOracleKeys = extractPythOracleKeys(combinedPythBanks);
|
|
80576
80921
|
const uniquePythOracleKeys = Array.from(new Set(pythOracleKeys));
|
|
80577
80922
|
let oraclePrices;
|
|
@@ -80586,10 +80931,15 @@ var fetchPythOracleData = async (banks, opts) => {
|
|
|
80586
80931
|
}
|
|
80587
80932
|
const bankOraclePriceMap = mapPythBanksToOraclePrices(
|
|
80588
80933
|
combinedPythBanks,
|
|
80589
|
-
pythStakedCollateralBanks,
|
|
80934
|
+
[...pythStakedCollateralBanks, ...pythMultipliedBanks],
|
|
80590
80935
|
oraclePrices,
|
|
80591
80936
|
priceCoeffByBank
|
|
80592
80937
|
);
|
|
80938
|
+
pythMultipliedBanks.forEach((bank) => {
|
|
80939
|
+
if (priceCoeffByBank[bank.address.toBase58()] === void 0) {
|
|
80940
|
+
bankOraclePriceMap.delete(bank.address.toBase58());
|
|
80941
|
+
}
|
|
80942
|
+
});
|
|
80593
80943
|
return {
|
|
80594
80944
|
bankOraclePriceMap
|
|
80595
80945
|
};
|
|
@@ -80861,16 +81211,242 @@ async function fetchSingleCrossbarChunk(endpoint, swbFeedIdsChunk, isPrimary) {
|
|
|
80861
81211
|
throw error;
|
|
80862
81212
|
}
|
|
80863
81213
|
}
|
|
81214
|
+
var scopeRequestKey = (bank) => `${bank.config.oracleKeys[0].toBase58()}:${bank.config.scopeEntryIndex}`;
|
|
81215
|
+
var fetchScopeOracleData = async (banks, opts) => {
|
|
81216
|
+
const scopeBanks = banks.filter((bank) => getOracleSourceFromBank(bank).key === "scope");
|
|
81217
|
+
if (!scopeBanks.length) {
|
|
81218
|
+
return {
|
|
81219
|
+
bankOraclePriceMap: /* @__PURE__ */ new Map()
|
|
81220
|
+
};
|
|
81221
|
+
}
|
|
81222
|
+
const uniqueRequestKeys = Array.from(new Set(scopeBanks.map(scopeRequestKey)));
|
|
81223
|
+
let oraclePrices;
|
|
81224
|
+
if (opts.mode === "api") {
|
|
81225
|
+
oraclePrices = await fetchScopeOraclePricesFromAPI(
|
|
81226
|
+
uniqueRequestKeys,
|
|
81227
|
+
opts.scopeOnchainData.endpoint,
|
|
81228
|
+
{ queryKey: opts.scopeOnchainData.queryKey }
|
|
81229
|
+
);
|
|
81230
|
+
} else {
|
|
81231
|
+
oraclePrices = await fetchScopeOraclePricesFromChain(uniqueRequestKeys, opts.connection);
|
|
81232
|
+
}
|
|
81233
|
+
const bankOraclePriceMap = /* @__PURE__ */ new Map();
|
|
81234
|
+
const nowSeconds = Math.floor(Date.now() / 1e3);
|
|
81235
|
+
scopeBanks.forEach((bank) => {
|
|
81236
|
+
let oraclePrice = oraclePrices[scopeRequestKey(bank)];
|
|
81237
|
+
const isStale = !oraclePrice || nowSeconds - oraclePrice.timestamp.toNumber() > bank.config.oracleMaxAge;
|
|
81238
|
+
if (isStale) {
|
|
81239
|
+
oraclePrice = {
|
|
81240
|
+
priceRealtime: {
|
|
81241
|
+
price: new BigNumber3(0),
|
|
81242
|
+
confidence: new BigNumber3(0),
|
|
81243
|
+
lowestPrice: new BigNumber3(0),
|
|
81244
|
+
highestPrice: new BigNumber3(0)
|
|
81245
|
+
},
|
|
81246
|
+
priceWeighted: {
|
|
81247
|
+
price: new BigNumber3(0),
|
|
81248
|
+
confidence: new BigNumber3(0),
|
|
81249
|
+
lowestPrice: new BigNumber3(0),
|
|
81250
|
+
highestPrice: new BigNumber3(0)
|
|
81251
|
+
},
|
|
81252
|
+
timestamp: oraclePrice?.timestamp ?? new BigNumber3(0)
|
|
81253
|
+
};
|
|
81254
|
+
}
|
|
81255
|
+
bankOraclePriceMap.set(bank.address.toBase58(), oraclePrice);
|
|
81256
|
+
});
|
|
81257
|
+
return {
|
|
81258
|
+
bankOraclePriceMap
|
|
81259
|
+
};
|
|
81260
|
+
};
|
|
81261
|
+
var fetchScopeOraclePricesFromAPI = async (requestKeys, apiEndpoint, opts) => {
|
|
81262
|
+
const queryKey = opts?.queryKey ?? "scopeKeys";
|
|
81263
|
+
const response = await fetch(`${apiEndpoint}?${queryKey}=${requestKeys.join(",")}`);
|
|
81264
|
+
if (!response.ok) {
|
|
81265
|
+
throw new Error("Failed to fetch scope oracle data");
|
|
81266
|
+
}
|
|
81267
|
+
const { data } = await response.json();
|
|
81268
|
+
return Object.fromEntries(
|
|
81269
|
+
Object.entries(data).map(([key, oraclePrice]) => [
|
|
81270
|
+
key,
|
|
81271
|
+
{
|
|
81272
|
+
priceRealtime: {
|
|
81273
|
+
price: BigNumber3(oraclePrice.priceRealtime.price),
|
|
81274
|
+
confidence: BigNumber3(oraclePrice.priceRealtime.confidence),
|
|
81275
|
+
lowestPrice: BigNumber3(oraclePrice.priceRealtime.lowestPrice),
|
|
81276
|
+
highestPrice: BigNumber3(oraclePrice.priceRealtime.highestPrice)
|
|
81277
|
+
},
|
|
81278
|
+
priceWeighted: {
|
|
81279
|
+
price: BigNumber3(oraclePrice.priceWeighted.price),
|
|
81280
|
+
confidence: BigNumber3(oraclePrice.priceWeighted.confidence),
|
|
81281
|
+
lowestPrice: BigNumber3(oraclePrice.priceWeighted.lowestPrice),
|
|
81282
|
+
highestPrice: BigNumber3(oraclePrice.priceWeighted.highestPrice)
|
|
81283
|
+
},
|
|
81284
|
+
timestamp: BigNumber3(oraclePrice.timestamp)
|
|
81285
|
+
}
|
|
81286
|
+
])
|
|
81287
|
+
);
|
|
81288
|
+
};
|
|
81289
|
+
var fetchScopeOraclePricesFromChain = async (requestKeys, connection) => {
|
|
81290
|
+
const uniqueOracleKeys = Array.from(new Set(requestKeys.map((key) => key.split(":")[0])));
|
|
81291
|
+
const oracleAis = await chunkedGetRawMultipleAccountInfoOrdered(connection, uniqueOracleKeys);
|
|
81292
|
+
const accountDataByKey = {};
|
|
81293
|
+
uniqueOracleKeys.forEach((oracleKey, index) => {
|
|
81294
|
+
accountDataByKey[oracleKey] = oracleAis[index]?.data;
|
|
81295
|
+
});
|
|
81296
|
+
const oraclePriceByRequestKey = {};
|
|
81297
|
+
for (const requestKey of requestKeys) {
|
|
81298
|
+
const [oracleKey, entryIndexRaw] = requestKey.split(":");
|
|
81299
|
+
const data = accountDataByKey[oracleKey];
|
|
81300
|
+
let price = new BigNumber3(0);
|
|
81301
|
+
let timestamp = new BigNumber3(0);
|
|
81302
|
+
if (data) {
|
|
81303
|
+
try {
|
|
81304
|
+
const entry = decodeScopePriceAtIndex(data, Number(entryIndexRaw));
|
|
81305
|
+
price = entry.price;
|
|
81306
|
+
timestamp = new BigNumber3(entry.unixTimestamp);
|
|
81307
|
+
} catch (e) {
|
|
81308
|
+
console.error(`Failed to decode scope entry ${requestKey}`, e);
|
|
81309
|
+
}
|
|
81310
|
+
}
|
|
81311
|
+
oraclePriceByRequestKey[requestKey] = {
|
|
81312
|
+
priceRealtime: {
|
|
81313
|
+
price,
|
|
81314
|
+
confidence: new BigNumber3(0),
|
|
81315
|
+
lowestPrice: price,
|
|
81316
|
+
highestPrice: price
|
|
81317
|
+
},
|
|
81318
|
+
priceWeighted: {
|
|
81319
|
+
price,
|
|
81320
|
+
confidence: new BigNumber3(0),
|
|
81321
|
+
lowestPrice: price,
|
|
81322
|
+
highestPrice: price
|
|
81323
|
+
},
|
|
81324
|
+
timestamp
|
|
81325
|
+
};
|
|
81326
|
+
}
|
|
81327
|
+
return oraclePriceByRequestKey;
|
|
81328
|
+
};
|
|
81329
|
+
function multiplierAccountKey(bank) {
|
|
81330
|
+
switch (bank.config.oracleSetup) {
|
|
81331
|
+
case "PythMSOL" /* PythMSOL */:
|
|
81332
|
+
case "PythLST" /* PythLST */:
|
|
81333
|
+
case "PTPyth" /* PTPyth */:
|
|
81334
|
+
return bank.config.oracleKeys[1];
|
|
81335
|
+
case "KaminoMSOL" /* KaminoMSOL */:
|
|
81336
|
+
case "JuplendMSOL" /* JuplendMSOL */:
|
|
81337
|
+
case "KaminoLST" /* KaminoLST */:
|
|
81338
|
+
case "JuplendLST" /* JuplendLST */:
|
|
81339
|
+
return bank.config.oracleKeys[2];
|
|
81340
|
+
case "PTFixed" /* PTFixed */:
|
|
81341
|
+
return bank.config.oracleKeys[0];
|
|
81342
|
+
default:
|
|
81343
|
+
return void 0;
|
|
81344
|
+
}
|
|
81345
|
+
}
|
|
81346
|
+
function computePtMultiplier(vault, startPrice, nowSeconds) {
|
|
81347
|
+
const maturity = vault.startTs + vault.duration;
|
|
81348
|
+
let expectedRate;
|
|
81349
|
+
if (vault.duration <= 0 || nowSeconds <= vault.startTs) {
|
|
81350
|
+
expectedRate = startPrice;
|
|
81351
|
+
} else if (nowSeconds >= maturity) {
|
|
81352
|
+
expectedRate = new BigNumber3(1);
|
|
81353
|
+
} else {
|
|
81354
|
+
const progress = new BigNumber3(nowSeconds - vault.startTs).div(vault.duration);
|
|
81355
|
+
expectedRate = startPrice.plus(new BigNumber3(1).minus(startPrice).times(progress));
|
|
81356
|
+
}
|
|
81357
|
+
if (vault.ptSupply === 0n) {
|
|
81358
|
+
throw new Error("Exponent vault has zero PT supply");
|
|
81359
|
+
}
|
|
81360
|
+
const syPerPt = new BigNumber3(vault.syForPt.toString()).div(
|
|
81361
|
+
new BigNumber3(vault.ptSupply.toString())
|
|
81362
|
+
);
|
|
81363
|
+
const redemptionCap = syPerPt.times(vault.lastSeenSyExchangeRate);
|
|
81364
|
+
return BigNumber3.min(expectedRate, redemptionCap);
|
|
81365
|
+
}
|
|
81366
|
+
var fetchOracleMultipliers = async (banks, opts) => {
|
|
81367
|
+
const multipliedBanks = banks.filter((bank) => multiplierAccountKey(bank) !== void 0);
|
|
81368
|
+
if (!multipliedBanks.length) {
|
|
81369
|
+
return {};
|
|
81370
|
+
}
|
|
81371
|
+
if (opts.mode === "api") {
|
|
81372
|
+
return fetchOracleMultipliersFromAPI(
|
|
81373
|
+
multipliedBanks.map((bank) => bank.address.toBase58()),
|
|
81374
|
+
opts.multiplierData.endpoint,
|
|
81375
|
+
{ queryKey: opts.multiplierData.queryKey }
|
|
81376
|
+
);
|
|
81377
|
+
}
|
|
81378
|
+
return fetchOracleMultipliersFromChain(multipliedBanks, opts.connection);
|
|
81379
|
+
};
|
|
81380
|
+
var fetchOracleMultipliersFromAPI = async (bankAddresses, apiEndpoint, opts) => {
|
|
81381
|
+
const queryKey = opts?.queryKey ?? "bankAddresses";
|
|
81382
|
+
const response = await fetch(`${apiEndpoint}?${queryKey}=${bankAddresses.join(",")}`);
|
|
81383
|
+
if (!response.ok) {
|
|
81384
|
+
throw new Error("Failed to fetch price multiplier data");
|
|
81385
|
+
}
|
|
81386
|
+
const { data } = await response.json();
|
|
81387
|
+
return Object.fromEntries(
|
|
81388
|
+
Object.entries(data).map(([bankAddress, multiplier]) => [bankAddress, Number(multiplier)])
|
|
81389
|
+
);
|
|
81390
|
+
};
|
|
81391
|
+
var fetchOracleMultipliersFromChain = async (multipliedBanks, connection) => {
|
|
81392
|
+
const accountKeyByBank = new Map(
|
|
81393
|
+
multipliedBanks.map((bank) => [bank.address.toBase58(), multiplierAccountKey(bank).toBase58()])
|
|
81394
|
+
);
|
|
81395
|
+
const uniqueAccountKeys = Array.from(new Set(accountKeyByBank.values()));
|
|
81396
|
+
const accountAis = await chunkedGetRawMultipleAccountInfoOrdered(connection, uniqueAccountKeys);
|
|
81397
|
+
const accountDataByKey = {};
|
|
81398
|
+
uniqueAccountKeys.forEach((accountKey, index) => {
|
|
81399
|
+
accountDataByKey[accountKey] = accountAis[index]?.data;
|
|
81400
|
+
});
|
|
81401
|
+
const multiplierByBank = {};
|
|
81402
|
+
const nowSeconds = Math.floor(Date.now() / 1e3);
|
|
81403
|
+
for (const bank of multipliedBanks) {
|
|
81404
|
+
const bankAddress = bank.address.toBase58();
|
|
81405
|
+
const data = accountDataByKey[accountKeyByBank.get(bankAddress)];
|
|
81406
|
+
if (!data) {
|
|
81407
|
+
console.error(`Missing multiplier account for bank ${bankAddress}`);
|
|
81408
|
+
continue;
|
|
81409
|
+
}
|
|
81410
|
+
try {
|
|
81411
|
+
switch (bank.config.oracleSetup) {
|
|
81412
|
+
case "PythMSOL" /* PythMSOL */:
|
|
81413
|
+
case "KaminoMSOL" /* KaminoMSOL */:
|
|
81414
|
+
case "JuplendMSOL" /* JuplendMSOL */:
|
|
81415
|
+
multiplierByBank[bankAddress] = decodeMarinadeState(data).msolPrice.toNumber();
|
|
81416
|
+
break;
|
|
81417
|
+
case "PythLST" /* PythLST */:
|
|
81418
|
+
case "KaminoLST" /* KaminoLST */:
|
|
81419
|
+
case "JuplendLST" /* JuplendLST */:
|
|
81420
|
+
multiplierByBank[bankAddress] = decodeStakePool(data).exchangeRate.toNumber();
|
|
81421
|
+
break;
|
|
81422
|
+
case "PTPyth" /* PTPyth */:
|
|
81423
|
+
case "PTFixed" /* PTFixed */:
|
|
81424
|
+
multiplierByBank[bankAddress] = computePtMultiplier(
|
|
81425
|
+
decodeExponentVault(data),
|
|
81426
|
+
bank.config.fixedPrice,
|
|
81427
|
+
nowSeconds
|
|
81428
|
+
).toNumber();
|
|
81429
|
+
break;
|
|
81430
|
+
}
|
|
81431
|
+
} catch (e) {
|
|
81432
|
+
console.error(`Failed to compute multiplier for bank ${bankAddress}`, e);
|
|
81433
|
+
}
|
|
81434
|
+
}
|
|
81435
|
+
return multiplierByBank;
|
|
81436
|
+
};
|
|
80864
81437
|
var fetchOracleData = async (banks, opts) => {
|
|
80865
81438
|
const { zeroOracleBanks, isolatedAssetBanks, collateralAssetBanks, fixedAssetBanks } = classifyBanksForOracleStrategy(banks);
|
|
80866
81439
|
const zeroResults = handleZeroOracleBanks(zeroOracleBanks);
|
|
80867
81440
|
const fetchIsolatedPrice = opts?.isolatedBanksOpts?.fetchPrices ?? false;
|
|
80868
81441
|
const isolatedResults = fetchIsolatedPrice ? handleIsolatedAssetBanks(isolatedAssetBanks, opts?.isolatedBanksOpts?.staticPricesByBank) : /* @__PURE__ */ new Map();
|
|
80869
|
-
const
|
|
81442
|
+
const multiplierByBank = await fetchOracleMultipliers(banks, opts.oracleMultiplierOpts);
|
|
81443
|
+
const fixedResults = handleFixedOracleBanks(fixedAssetBanks, multiplierByBank);
|
|
80870
81444
|
const assetBanks = [...collateralAssetBanks, ...fetchIsolatedPrice ? isolatedAssetBanks : []];
|
|
80871
81445
|
const assetResults = await handleAssetBanks(assetBanks, {
|
|
80872
81446
|
pythOpts: opts.pythOpts,
|
|
80873
|
-
swbOpts: opts.swbOpts
|
|
81447
|
+
swbOpts: opts.swbOpts,
|
|
81448
|
+
scopeOpts: opts.scopeOpts,
|
|
81449
|
+
priceCoeffByBank: multiplierByBank
|
|
80874
81450
|
});
|
|
80875
81451
|
return mergeOracleResults([zeroResults, isolatedResults, assetResults, fixedResults], banks);
|
|
80876
81452
|
};
|
|
@@ -80904,10 +81480,11 @@ function classifyBanksForOracleStrategy(banks) {
|
|
|
80904
81480
|
fixedAssetBanks
|
|
80905
81481
|
};
|
|
80906
81482
|
}
|
|
80907
|
-
function handleFixedOracleBanks(banks) {
|
|
81483
|
+
function handleFixedOracleBanks(banks, multiplierByBank) {
|
|
80908
81484
|
const oracleMap = /* @__PURE__ */ new Map();
|
|
80909
81485
|
banks.forEach((bank) => {
|
|
80910
|
-
const
|
|
81486
|
+
const multiplier = multiplierByBank[bank.address.toBase58()];
|
|
81487
|
+
const fixedPrice = bank.config.oracleSetup === "PTFixed" /* PTFixed */ && multiplier !== void 0 ? BigNumber3(multiplier) : bank.config.fixedPrice;
|
|
80911
81488
|
const fixedOraclePrice = {
|
|
80912
81489
|
priceRealtime: {
|
|
80913
81490
|
price: fixedPrice,
|
|
@@ -80976,9 +81553,10 @@ async function handleAssetBanks(banks, opts) {
|
|
|
80976
81553
|
if (banks.length === 0) {
|
|
80977
81554
|
return /* @__PURE__ */ new Map();
|
|
80978
81555
|
}
|
|
80979
|
-
const [pythData, swbData] = await Promise.all([
|
|
80980
|
-
fetchPythOracleData(banks, opts.pythOpts),
|
|
80981
|
-
fetchSwbOracleData(banks, opts.swbOpts)
|
|
81556
|
+
const [pythData, swbData, scopeData] = await Promise.all([
|
|
81557
|
+
fetchPythOracleData(banks, opts.pythOpts, opts.priceCoeffByBank),
|
|
81558
|
+
fetchSwbOracleData(banks, opts.swbOpts),
|
|
81559
|
+
fetchScopeOracleData(banks, opts.scopeOpts)
|
|
80982
81560
|
]);
|
|
80983
81561
|
const bankOraclePriceMap = /* @__PURE__ */ new Map();
|
|
80984
81562
|
pythData.bankOraclePriceMap.forEach((oraclePrice, bankAddress) => {
|
|
@@ -80987,6 +81565,9 @@ async function handleAssetBanks(banks, opts) {
|
|
|
80987
81565
|
swbData.bankOraclePriceMap.forEach((oraclePrice, bankAddress) => {
|
|
80988
81566
|
bankOraclePriceMap.set(bankAddress, oraclePrice);
|
|
80989
81567
|
});
|
|
81568
|
+
scopeData.bankOraclePriceMap.forEach((oraclePrice, bankAddress) => {
|
|
81569
|
+
bankOraclePriceMap.set(bankAddress, oraclePrice);
|
|
81570
|
+
});
|
|
80990
81571
|
banks.forEach((bank) => {
|
|
80991
81572
|
const bankAddress = bank.address.toBase58();
|
|
80992
81573
|
const oraclePrice = bankOraclePriceMap.get(bankAddress);
|
|
@@ -83369,7 +83950,8 @@ var Bank = class _Bank {
|
|
|
83369
83950
|
bankType.config.operationalState,
|
|
83370
83951
|
bankType.config.oracleMaxConfidence,
|
|
83371
83952
|
bankType.config.fixedPrice,
|
|
83372
|
-
bankType.config.configFlags
|
|
83953
|
+
bankType.config.configFlags,
|
|
83954
|
+
bankType.config.scopeEntryIndex
|
|
83373
83955
|
);
|
|
83374
83956
|
return new _Bank(
|
|
83375
83957
|
bankType.address,
|
|
@@ -83538,7 +84120,7 @@ var Bank = class _Bank {
|
|
|
83538
84120
|
}
|
|
83539
84121
|
};
|
|
83540
84122
|
var BankConfig = class _BankConfig {
|
|
83541
|
-
constructor(assetWeightInit, assetWeightMaint, liabilityWeightInit, liabilityWeightMaint, depositLimit, borrowLimit, riskTier, totalAssetValueInitLimit, assetTag, oracleSetup, oracleKeys, oracleMaxAge, interestRateConfig, operationalState, oracleMaxConfidence, fixedPrice, configFlags) {
|
|
84123
|
+
constructor(assetWeightInit, assetWeightMaint, liabilityWeightInit, liabilityWeightMaint, depositLimit, borrowLimit, riskTier, totalAssetValueInitLimit, assetTag, oracleSetup, oracleKeys, oracleMaxAge, interestRateConfig, operationalState, oracleMaxConfidence, fixedPrice, configFlags, scopeEntryIndex = 0) {
|
|
83542
84124
|
this.assetWeightInit = assetWeightInit;
|
|
83543
84125
|
this.assetWeightMaint = assetWeightMaint;
|
|
83544
84126
|
this.liabilityWeightInit = liabilityWeightInit;
|
|
@@ -83556,6 +84138,7 @@ var BankConfig = class _BankConfig {
|
|
|
83556
84138
|
this.oracleMaxConfidence = oracleMaxConfidence;
|
|
83557
84139
|
this.fixedPrice = fixedPrice;
|
|
83558
84140
|
this.configFlags = configFlags;
|
|
84141
|
+
this.scopeEntryIndex = scopeEntryIndex;
|
|
83559
84142
|
}
|
|
83560
84143
|
static fromAccountParsed(bankConfigRaw) {
|
|
83561
84144
|
const bankConfig = parseBankConfigRaw(bankConfigRaw);
|
|
@@ -83576,7 +84159,8 @@ var BankConfig = class _BankConfig {
|
|
|
83576
84159
|
bankConfig.operationalState,
|
|
83577
84160
|
bankConfig.oracleMaxConfidence,
|
|
83578
84161
|
bankConfig.fixedPrice,
|
|
83579
|
-
bankConfig.configFlags
|
|
84162
|
+
bankConfig.configFlags,
|
|
84163
|
+
bankConfig.scopeEntryIndex
|
|
83580
84164
|
);
|
|
83581
84165
|
}
|
|
83582
84166
|
};
|
|
@@ -84755,6 +85339,14 @@ var Project0Client = class _Project0Client {
|
|
|
84755
85339
|
mode: "on-chain",
|
|
84756
85340
|
connection
|
|
84757
85341
|
},
|
|
85342
|
+
scopeOpts: {
|
|
85343
|
+
mode: "on-chain",
|
|
85344
|
+
connection
|
|
85345
|
+
},
|
|
85346
|
+
oracleMultiplierOpts: {
|
|
85347
|
+
mode: "on-chain",
|
|
85348
|
+
connection
|
|
85349
|
+
},
|
|
84758
85350
|
isolatedBanksOpts: {
|
|
84759
85351
|
fetchPrices: true
|
|
84760
85352
|
}
|
|
@@ -84887,6 +85479,6 @@ var EmodeSettings = class _EmodeSettings {
|
|
|
84887
85479
|
}
|
|
84888
85480
|
};
|
|
84889
85481
|
|
|
84890
|
-
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_BRIDGE_MINTS, DEFAULT_CROSSBAR_URL, DEFAULT_FALLBACK_CROSSBAR_URL, DEFAULT_ORACLE_MAX_AGE, DEFAULT_REPAY_ALL_EXTRA_BUFFER_BPS, DISABLED_FLAG, EMPTY_HEALTH_CACHE, EXECUTION_HEADROOM_SECONDS, 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, SECONDS_PER_YEAR, SINGLE_POOL_PROGRAM_ID, STAKED_ORACLE_DISABLED_FLAG, STAKED_ORACLE_USES_ONRAMP_FLAG, 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, U64_MAX, USDC_DECIMALS, USDC_MINT, USDT_MINT, VENUE_AVAILABLE_LIQUIDITY_BUFFER, WSOL_MINT, ZERO_ORACLE_KEY, accountConflictsWithBridgeBank, accountFlagToBN, addOracleToBanksIx, addTransactionMetadata, adjustPriceComponent, aprToApy, apyToApr, balanceToDto, bankConfigRawToDto, bankConfigToBankConfigRaw, bankMetadataMapToDto, bankMetadataToDto, bankRateLimiterRawToDto, bankRawToDto, bigNumberToWrappedI80F48, bpsToPercentile, buildCollateralLegIxs, calculateApyFromInterest, calculateInterestFromApy, capConfidenceInterval, categorizePythBanks, checkBatchOracleCrankability, checkJupiterFeeAccount, checkMultipleOraclesCrankability, checkTitanFeeAccount, chunkedGetRawMultipleAccountInfoOrdered, chunkedGetRawMultipleAccountInfoOrderedWithNulls, chunkedGetRawMultipleAccountInfos, classifyAndValidate, compileFlashloanPrecheck, composeBridgedSwap, composeRemainingAccounts, computeAccountValue, computeAccrualProjectionSeconds, computeActiveEmodePairs, computeAssetHealthComponent, computeAssetUsdValue, computeBalanceUsdValue, computeBankAvailableLiquidity, computeBankBorrowApy, computeBankBorrowCapRemaining, computeBankDepositCapRemaining, computeBankMetrics, computeBankPoolSize, computeBankProjectedAvailableLiquidity, computeBankRateLimitRemaining, computeBankSupplyApy, computeBankTotalBorrows, computeBankTotalBorrowsUsd, computeBankTotalDeposits, computeBankTotalDepositsUsd, computeBaseInterestRate, computeBorrowEstimateForRepay, computeClaimedEmissions, computeClosePositionTokenAmount, computeEmodeImpacts, computeFlashLoanNonSwapBudget, computeFlashloanSwapConstraints, computeFreeCollateralFromBalances, computeFreeCollateralFromCache, computeGroupRateLimitRemainingUsd, computeHealthAccountMetas, computeHealthCacheStatus, computeHealthCheckAccounts, computeHealthComponentsFromBalances, computeHealthComponentsFromCache, computeInterestRates, computeLiabilityHealthComponent, computeLiabilityUsdValue, computeLiquidationPriceForBank, computeLoopingParams, computeLowestEmodeWeights, computeMaxBorrowForBank, computeMaxDepositForBank, computeMaxLeverage, computeMaxWithdrawForBank, computeNetApy, computeProjectedActiveBalancesNoCpi, computeProjectedActiveBanksNoCpi, computeQuantity, computeQuantityUi, computeRateLimitWindowRemainingCapacity, computeRateLimiterRemainingCapacity, computeRemainingCapacity, computeSmartCrank, computeStakedBankMultipliers, computeTotalOutstandingEmissions, computeTvl, computeUsdValue, computeUtilizationRate, computeV0TxSize, computeVenueAvailableLiquidity, 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, fetchGammaLpVault, fetchGammaWithdrawReceipt, 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, getEffectiveDepositLimit, getEmodePairs, getExactOutEstimate, getFallbackPricesByFeedId, getFallbackPricesForMints, 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, isBorrowLimitActive, isBridgeConflictError, isDecomposableSwapError, isDepositIx, isDepositLimitActive, isFlashloan, isGroupRateLimiterEnabled, isStandardBorrowable, isStandardDepositable, isV0Tx, isWeightedPrice, isWholePosition, makeAccountTransferToNewAccountTx, makeAddPermissionlessStakedBankIx, makeBeginFlashLoanIx3 as makeBeginFlashLoanIx, makeBorrowIx3 as makeBorrowIx, makeBorrowTx, makeBridgedLoopTx, makeBridgedSwapCollateralTx, makeBridgedSwapDebtTx, makeBulkRepayTx, makeBulkWithdrawTx, makeBundleTipIx, 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, makeRefreshIntegrationBanksIxs, makeRefreshKaminoBanksIxs, makeRepayIx3 as makeRepayIx, makeRepayTx, makeRepayWithCollatTx, makeRollPtTx, makeSetupIx, makeSmartCrankSwbFeedIx, makeSmartCrankSwbFeedIxForAccounts, makeSwapCollateralTx, makeSwapDebtTx, makeTransferPositionsTx, makeTxPriorityIx, makeUnwrapSolIx, makeUpdateDriftMarketIxs, makeUpdateJupLendRateIxs, makeUpdateSwbFeedIx, makeVaultCompleteWithdrawalIx, makeVaultCompleteWithdrawalTx, makeVaultDepositIx, makeVaultDepositTx, makeVaultDepositWithSwapTx, makeVaultWithdrawIx, makeVaultWithdrawTx, 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, requireBank, requireTokenProgram, resolveAmount, resolveBridgeCandidateBanks, resolvePinnedSwapRoute, resolveTokenProgramForMint, resolveVaultTokenProgram, runSwapEngine, selectLutsForAccountAction, selectLutsForBanks, selectSwapBridges, serializeBankConfigOpt, serializeInstruction, serializeInterestRateConfig, serializeLut, serializeOperationalState, serializeOracleSetup, serializeOracleSetupToIndex, serializeRiskTier, serializeSwapEngineRequest, serializeSwapEngineResult, sharedBridgeLegContext, shortenAddress, simulateAccountHealthCache, simulateAccountHealthCacheWithFallback, simulateBundle, splitInstructionsToFitTransactions, swapEngineProvidersFromOpts, swapEngineQuoteFieldsFromOpts, toBankConfigDto, toBankDto, toBankRateLimiterDto, toBigNumber, toEmodeSettingsDto, toInterestRateConfigDto, toJupiterConfig, toNumber, tryBridgeCandidates, uiToNative, uiToNativeBigNumber, validatorStakeGroupToDto, wrappedI80F48toBigNumber };
|
|
85482
|
+
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_BRIDGE_MINTS, DEFAULT_CROSSBAR_URL, DEFAULT_FALLBACK_CROSSBAR_URL, DEFAULT_ORACLE_MAX_AGE, DEFAULT_REPAY_ALL_EXTRA_BUFFER_BPS, DISABLED_FLAG, EMPTY_HEALTH_CACHE, EXECUTION_HEADROOM_SECONDS, 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, SECONDS_PER_YEAR, SINGLE_POOL_PROGRAM_ID, STAKED_ORACLE_DISABLED_FLAG, STAKED_ORACLE_USES_ONRAMP_FLAG, 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, U64_MAX, USDC_DECIMALS, USDC_MINT, USDT_MINT, VENUE_AVAILABLE_LIQUIDITY_BUFFER, WSOL_MINT, ZERO_ORACLE_KEY, accountConflictsWithBridgeBank, accountFlagToBN, addOracleToBanksIx, addTransactionMetadata, adjustPriceComponent, aprToApy, apyToApr, balanceToDto, bankConfigRawToDto, bankConfigToBankConfigRaw, bankMetadataMapToDto, bankMetadataToDto, bankRateLimiterRawToDto, bankRawToDto, bigNumberToWrappedI80F48, bpsToPercentile, buildCollateralLegIxs, calculateApyFromInterest, calculateInterestFromApy, capConfidenceInterval, categorizePythBanks, checkBatchOracleCrankability, checkJupiterFeeAccount, checkMultipleOraclesCrankability, checkTitanFeeAccount, chunkedGetRawMultipleAccountInfoOrdered, chunkedGetRawMultipleAccountInfoOrderedWithNulls, chunkedGetRawMultipleAccountInfos, classifyAndValidate, compileFlashloanPrecheck, composeBridgedSwap, composeRemainingAccounts, computeAccountValue, computeAccrualProjectionSeconds, computeActiveEmodePairs, computeAssetHealthComponent, computeAssetUsdValue, computeBalanceUsdValue, computeBankAvailableLiquidity, computeBankBorrowApy, computeBankBorrowCapRemaining, computeBankDepositCapRemaining, computeBankMetrics, computeBankPoolSize, computeBankProjectedAvailableLiquidity, computeBankRateLimitRemaining, computeBankRiskAccountKeys, computeBankSupplyApy, computeBankTotalBorrows, computeBankTotalBorrowsUsd, computeBankTotalDeposits, computeBankTotalDepositsUsd, computeBaseInterestRate, computeBorrowEstimateForRepay, computeClaimedEmissions, computeClosePositionTokenAmount, computeEmodeImpacts, computeFlashLoanNonSwapBudget, computeFlashloanSwapConstraints, computeFreeCollateralFromBalances, computeFreeCollateralFromCache, computeGroupRateLimitRemainingUsd, computeHealthAccountMetas, computeHealthCacheStatus, computeHealthCheckAccounts, computeHealthComponentsFromBalances, computeHealthComponentsFromCache, computeInterestRates, computeLiabilityHealthComponent, computeLiabilityUsdValue, computeLiquidationPriceForBank, computeLoopingParams, computeLowestEmodeWeights, computeMaxBorrowForBank, computeMaxDepositForBank, computeMaxLeverage, computeMaxWithdrawForBank, computeNetApy, computeProjectedActiveBalancesNoCpi, computeProjectedActiveBanksNoCpi, computePtMultiplier, computeQuantity, computeQuantityUi, computeRateLimitWindowRemainingCapacity, computeRateLimiterRemainingCapacity, computeRemainingCapacity, computeSmartCrank, computeStakedBankMultipliers, computeTotalOutstandingEmissions, computeTvl, computeUsdValue, computeUtilizationRate, computeV0TxSize, computeVenueAvailableLiquidity, 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, fetchGammaLpVault, fetchGammaWithdrawReceipt, fetchMarginfiAccountActiveBalancesForBank, fetchMarginfiAccountAddresses, fetchMarginfiAccountAddressesHoldingBank, fetchMarginfiAccountData, fetchMultipleBanks, fetchNativeStakeAccounts, fetchOracleData, fetchOracleMultipliers, fetchOracleMultipliersFromAPI, fetchOracleMultipliersFromChain, fetchProgramForMints, fetchPythOracleData, fetchPythOraclePricesFromAPI, fetchPythOraclePricesFromChain, fetchScopeOracleData, fetchScopeOraclePricesFromAPI, fetchScopeOraclePricesFromChain, 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, getEffectiveDepositLimit, getEmodePairs, getExactOutEstimate, getFallbackPricesByFeedId, getFallbackPricesForMints, 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, isBorrowLimitActive, isBridgeConflictError, isDecomposableSwapError, isDepositIx, isDepositLimitActive, isFlashloan, isGroupRateLimiterEnabled, isStandardBorrowable, isStandardDepositable, isV0Tx, isWeightedPrice, isWholePosition, makeAccountTransferToNewAccountTx, makeAddPermissionlessStakedBankIx, makeBeginFlashLoanIx3 as makeBeginFlashLoanIx, makeBorrowIx3 as makeBorrowIx, makeBorrowTx, makeBridgedLoopTx, makeBridgedSwapCollateralTx, makeBridgedSwapDebtTx, makeBulkRepayTx, makeBulkWithdrawTx, makeBundleTipIx, 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, makeRefreshIntegrationBanksIxs, makeRefreshKaminoBanksIxs, makeRepayIx3 as makeRepayIx, makeRepayTx, makeRepayWithCollatTx, makeRollPtTx, makeSetupIx, makeSmartCrankSwbFeedIx, makeSmartCrankSwbFeedIxForAccounts, makeSwapCollateralTx, makeSwapDebtTx, makeTransferPositionsTx, makeTxPriorityIx, makeUnwrapSolIx, makeUpdateDriftMarketIxs, makeUpdateJupLendRateIxs, makeUpdateSwbFeedIx, makeVaultCompleteWithdrawalIx, makeVaultCompleteWithdrawalTx, makeVaultDepositIx, makeVaultDepositTx, makeVaultDepositWithSwapTx, makeVaultWithdrawIx, makeVaultWithdrawTx, 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, requireBank, requireTokenProgram, resolveAmount, resolveBridgeCandidateBanks, resolvePinnedSwapRoute, resolveTokenProgramForMint, resolveVaultTokenProgram, runSwapEngine, selectLutsForAccountAction, selectLutsForBanks, selectSwapBridges, serializeBankConfigOpt, serializeInstruction, serializeInterestRateConfig, serializeLut, serializeOperationalState, serializeOracleSetup, serializeOracleSetupToIndex, serializeRiskTier, serializeSwapEngineRequest, serializeSwapEngineResult, sharedBridgeLegContext, shortenAddress, simulateAccountHealthCache, simulateAccountHealthCacheWithFallback, simulateBundle, splitInstructionsToFitTransactions, swapEngineProvidersFromOpts, swapEngineQuoteFieldsFromOpts, toBankConfigDto, toBankDto, toBankRateLimiterDto, toBigNumber, toEmodeSettingsDto, toInterestRateConfigDto, toJupiterConfig, toNumber, tryBridgeCandidates, uiToNative, uiToNativeBigNumber, validatorStakeGroupToDto, wrappedI80F48toBigNumber };
|
|
84891
85483
|
//# sourceMappingURL=index.js.map
|
|
84892
85484
|
//# sourceMappingURL=index.js.map
|