@0dotxyz/p0-ts-sdk 2.8.0-alpha.2 → 2.8.0-alpha.4
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 +157 -31
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -3
- package/dist/index.d.ts +12 -3
- package/dist/index.js +157 -32
- package/dist/index.js.map +1 -1
- package/dist/instructions.cjs +5 -0
- package/dist/instructions.cjs.map +1 -1
- package/dist/instructions.d.cts +16 -1
- package/dist/instructions.d.ts +16 -1
- package/dist/instructions.js +5 -0
- package/dist/instructions.js.map +1 -1
- package/dist/{types-CX88CgJK.d.ts → types-3H0oa4o0.d.ts} +99 -28
- package/dist/{types-Dqhd5rGy.d.cts → types-BCAMIXgz.d.cts} +99 -28
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -706,12 +706,12 @@ function makeBundleTipIx(feePayer, bundleTip = 1e5) {
|
|
|
706
706
|
return bundleTipInstruction;
|
|
707
707
|
}
|
|
708
708
|
|
|
709
|
-
// src/idl/marginfi_0.1.
|
|
710
|
-
var
|
|
709
|
+
// src/idl/marginfi_0.1.11.json
|
|
710
|
+
var marginfi_0_1_11_default = {
|
|
711
711
|
address: "MFv2hWf31Z9kbCa1snEPYctwafyhdvnV7FZnsebVacA",
|
|
712
712
|
metadata: {
|
|
713
713
|
name: "marginfi",
|
|
714
|
-
version: "0.1.
|
|
714
|
+
version: "0.1.11",
|
|
715
715
|
spec: "0.1.0",
|
|
716
716
|
description: "Borrow Lending Prime Broker"
|
|
717
717
|
},
|
|
@@ -8122,6 +8122,53 @@ var marginfi_0_1_10_default = {
|
|
|
8122
8122
|
}
|
|
8123
8123
|
]
|
|
8124
8124
|
},
|
|
8125
|
+
{
|
|
8126
|
+
name: "lending_pool_configure_bank_oracle_scope",
|
|
8127
|
+
docs: [
|
|
8128
|
+
"(admin only) Point a bank at a Scope feed entry.",
|
|
8129
|
+
"* oracle - the feed's `OraclePrices` account",
|
|
8130
|
+
"* entry_index - which of the 512 entries in that account prices this bank"
|
|
8131
|
+
],
|
|
8132
|
+
discriminator: [
|
|
8133
|
+
134,
|
|
8134
|
+
228,
|
|
8135
|
+
127,
|
|
8136
|
+
3,
|
|
8137
|
+
117,
|
|
8138
|
+
132,
|
|
8139
|
+
85,
|
|
8140
|
+
146
|
|
8141
|
+
],
|
|
8142
|
+
accounts: [
|
|
8143
|
+
{
|
|
8144
|
+
name: "group",
|
|
8145
|
+
relations: [
|
|
8146
|
+
"bank"
|
|
8147
|
+
]
|
|
8148
|
+
},
|
|
8149
|
+
{
|
|
8150
|
+
name: "admin",
|
|
8151
|
+
signer: true,
|
|
8152
|
+
relations: [
|
|
8153
|
+
"group"
|
|
8154
|
+
]
|
|
8155
|
+
},
|
|
8156
|
+
{
|
|
8157
|
+
name: "bank",
|
|
8158
|
+
writable: true
|
|
8159
|
+
}
|
|
8160
|
+
],
|
|
8161
|
+
args: [
|
|
8162
|
+
{
|
|
8163
|
+
name: "oracle",
|
|
8164
|
+
type: "pubkey"
|
|
8165
|
+
},
|
|
8166
|
+
{
|
|
8167
|
+
name: "entry_index",
|
|
8168
|
+
type: "u16"
|
|
8169
|
+
}
|
|
8170
|
+
]
|
|
8171
|
+
},
|
|
8125
8172
|
{
|
|
8126
8173
|
name: "lending_pool_emissions_deposit",
|
|
8127
8174
|
docs: [
|
|
@@ -8594,19 +8641,19 @@ var marginfi_0_1_10_default = {
|
|
|
8594
8641
|
]
|
|
8595
8642
|
},
|
|
8596
8643
|
{
|
|
8597
|
-
name: "
|
|
8644
|
+
name: "lending_pool_set_oracle_price",
|
|
8598
8645
|
docs: [
|
|
8599
8646
|
"(admin only)"
|
|
8600
8647
|
],
|
|
8601
8648
|
discriminator: [
|
|
8602
|
-
|
|
8603
|
-
|
|
8604
|
-
127,
|
|
8605
|
-
127,
|
|
8606
|
-
60,
|
|
8649
|
+
234,
|
|
8650
|
+
244,
|
|
8607
8651
|
37,
|
|
8608
|
-
|
|
8609
|
-
|
|
8652
|
+
65,
|
|
8653
|
+
101,
|
|
8654
|
+
255,
|
|
8655
|
+
217,
|
|
8656
|
+
160
|
|
8610
8657
|
],
|
|
8611
8658
|
accounts: [
|
|
8612
8659
|
{
|
|
@@ -8635,6 +8682,10 @@ var marginfi_0_1_10_default = {
|
|
|
8635
8682
|
name: "WrappedI80F48"
|
|
8636
8683
|
}
|
|
8637
8684
|
}
|
|
8685
|
+
},
|
|
8686
|
+
{
|
|
8687
|
+
name: "setup",
|
|
8688
|
+
type: "u8"
|
|
8638
8689
|
}
|
|
8639
8690
|
]
|
|
8640
8691
|
},
|
|
@@ -12013,16 +12064,16 @@ var marginfi_0_1_10_default = {
|
|
|
12013
12064
|
]
|
|
12014
12065
|
},
|
|
12015
12066
|
{
|
|
12016
|
-
name: "
|
|
12067
|
+
name: "LendingPoolBankSetOraclePriceEvent",
|
|
12017
12068
|
discriminator: [
|
|
12018
|
-
|
|
12019
|
-
|
|
12020
|
-
|
|
12021
|
-
|
|
12022
|
-
|
|
12023
|
-
|
|
12024
|
-
|
|
12025
|
-
|
|
12069
|
+
92,
|
|
12070
|
+
180,
|
|
12071
|
+
117,
|
|
12072
|
+
175,
|
|
12073
|
+
131,
|
|
12074
|
+
24,
|
|
12075
|
+
159,
|
|
12076
|
+
141
|
|
12026
12077
|
]
|
|
12027
12078
|
},
|
|
12028
12079
|
{
|
|
@@ -12858,8 +12909,8 @@ var marginfi_0_1_10_default = {
|
|
|
12858
12909
|
},
|
|
12859
12910
|
{
|
|
12860
12911
|
code: 6132,
|
|
12861
|
-
name: "
|
|
12862
|
-
msg: "Use
|
|
12912
|
+
name: "UseSetOraclePrice",
|
|
12913
|
+
msg: "Use set_oracle_price instead"
|
|
12863
12914
|
},
|
|
12864
12915
|
{
|
|
12865
12916
|
code: 6133,
|
|
@@ -12876,6 +12927,26 @@ var marginfi_0_1_10_default = {
|
|
|
12876
12927
|
name: "SlippageTooHigh",
|
|
12877
12928
|
msg: "Max slippage exceeds the allowed cap"
|
|
12878
12929
|
},
|
|
12930
|
+
{
|
|
12931
|
+
code: 6136,
|
|
12932
|
+
name: "MarinadeStateValidationFailed",
|
|
12933
|
+
msg: "Marinade state validation failed"
|
|
12934
|
+
},
|
|
12935
|
+
{
|
|
12936
|
+
code: 6137,
|
|
12937
|
+
name: "ExponentVaultValidationFailed",
|
|
12938
|
+
msg: "Exponent vault validation failed"
|
|
12939
|
+
},
|
|
12940
|
+
{
|
|
12941
|
+
code: 6138,
|
|
12942
|
+
name: "InvalidPtStartPrice",
|
|
12943
|
+
msg: "PT start price must be in (0, 1]"
|
|
12944
|
+
},
|
|
12945
|
+
{
|
|
12946
|
+
code: 6139,
|
|
12947
|
+
name: "StakePoolStale",
|
|
12948
|
+
msg: "Stake pool balance has not been updated recently enough"
|
|
12949
|
+
},
|
|
12879
12950
|
{
|
|
12880
12951
|
code: 6200,
|
|
12881
12952
|
name: "WrongAssetTagForStandardInstructions",
|
|
@@ -13267,22 +13338,22 @@ var marginfi_0_1_10_default = {
|
|
|
13267
13338
|
msg: "Oracle price deviates too far from the circuit breaker reference; action rejected"
|
|
13268
13339
|
},
|
|
13269
13340
|
{
|
|
13270
|
-
code:
|
|
13341
|
+
code: 6800,
|
|
13271
13342
|
name: "ScopeInvalidAccount",
|
|
13272
13343
|
msg: "Scope oracle account is not owned by the Scope program or is malformed"
|
|
13273
13344
|
},
|
|
13274
13345
|
{
|
|
13275
|
-
code:
|
|
13346
|
+
code: 6801,
|
|
13276
13347
|
name: "ScopeInvalidEntry",
|
|
13277
13348
|
msg: "Scope entry index is out of range or the entry has never been refreshed"
|
|
13278
13349
|
},
|
|
13279
13350
|
{
|
|
13280
|
-
code:
|
|
13351
|
+
code: 6802,
|
|
13281
13352
|
name: "ScopeStalePrice",
|
|
13282
13353
|
msg: "Scope price is stale"
|
|
13283
13354
|
},
|
|
13284
13355
|
{
|
|
13285
|
-
code:
|
|
13356
|
+
code: 6803,
|
|
13286
13357
|
name: "UseConfigureBankOracleScope",
|
|
13287
13358
|
msg: "Use lending_pool_configure_bank_oracle_scope; Scope requires an entry index"
|
|
13288
13359
|
}
|
|
@@ -14376,9 +14447,9 @@ var marginfi_0_1_10_default = {
|
|
|
14376
14447
|
{
|
|
14377
14448
|
name: "scope_entry_index",
|
|
14378
14449
|
docs: [
|
|
14379
|
-
"Entry index into the Scope OraclePrices price list. Only read when",
|
|
14380
|
-
"oracle_setup == OracleSetup::Scope
|
|
14381
|
-
"Occupies what was previously _padding0
|
|
14450
|
+
"Entry index into the Scope `OraclePrices` price list. Only read when",
|
|
14451
|
+
"`oracle_setup == OracleSetup::Scope`; ignored (and zero) for every other setup.",
|
|
14452
|
+
"Occupies what was previously `_padding0`, so the layout is unchanged."
|
|
14382
14453
|
],
|
|
14383
14454
|
type: "u16"
|
|
14384
14455
|
},
|
|
@@ -17357,7 +17428,7 @@ var marginfi_0_1_10_default = {
|
|
|
17357
17428
|
}
|
|
17358
17429
|
},
|
|
17359
17430
|
{
|
|
17360
|
-
name: "
|
|
17431
|
+
name: "LendingPoolBankSetOraclePriceEvent",
|
|
17361
17432
|
type: {
|
|
17362
17433
|
kind: "struct",
|
|
17363
17434
|
fields: [
|
|
@@ -20852,7 +20923,7 @@ var marginfi_0_1_10_default = {
|
|
|
20852
20923
|
};
|
|
20853
20924
|
|
|
20854
20925
|
// src/idl/index.ts
|
|
20855
|
-
var MARGINFI_IDL =
|
|
20926
|
+
var MARGINFI_IDL = marginfi_0_1_11_default;
|
|
20856
20927
|
|
|
20857
20928
|
// src/services/bank/types/bank.types.ts
|
|
20858
20929
|
var RiskTier = /* @__PURE__ */ ((RiskTier3) => {
|
|
@@ -21764,6 +21835,10 @@ async function makeLendingPoolConfigureBankOracleIx(mfProgram, accounts, args, r
|
|
|
21764
21835
|
bank
|
|
21765
21836
|
}).accountsPartial(optionalAccounts).remainingAccounts(remainingAccounts).instruction();
|
|
21766
21837
|
}
|
|
21838
|
+
async function makeLendingPoolConfigureBankOracleScopeIx(mfProgram, accounts, args) {
|
|
21839
|
+
const { bank, ...optionalAccounts } = accounts;
|
|
21840
|
+
return mfProgram.methods.lendingPoolConfigureBankOracleScope(args.oracle, args.entryIndex).accounts({ bank }).accountsPartial(optionalAccounts).instruction();
|
|
21841
|
+
}
|
|
21767
21842
|
async function makePoolAddPermissionlessStakedBankIx(mfProgram, accounts, remainingAccounts = [], args) {
|
|
21768
21843
|
const {
|
|
21769
21844
|
stakedSettings,
|
|
@@ -21836,6 +21911,7 @@ var instructions = {
|
|
|
21836
21911
|
makeCloseAccountIx,
|
|
21837
21912
|
makePoolAddPermissionlessStakedBankIx,
|
|
21838
21913
|
makeLendingPoolConfigureBankOracleIx,
|
|
21914
|
+
makeLendingPoolConfigureBankOracleScopeIx,
|
|
21839
21915
|
makePulseHealthIx
|
|
21840
21916
|
};
|
|
21841
21917
|
var instructions_default = instructions;
|
|
@@ -52052,6 +52128,11 @@ function encodeU8(value) {
|
|
|
52052
52128
|
buf.writeUInt8(value, 0);
|
|
52053
52129
|
return buf;
|
|
52054
52130
|
}
|
|
52131
|
+
function encodeU16(value) {
|
|
52132
|
+
const buf = Buffer.alloc(2);
|
|
52133
|
+
buf.writeUInt16LE(value, 0);
|
|
52134
|
+
return buf;
|
|
52135
|
+
}
|
|
52055
52136
|
function encodeBool(value) {
|
|
52056
52137
|
const buf = Buffer.alloc(1);
|
|
52057
52138
|
buf.writeUInt8(value ? 1 : 0, 0);
|
|
@@ -52090,6 +52171,7 @@ var DISCRIMINATORS = {
|
|
|
52090
52171
|
MARGINFI_ACCOUNT_CLOSE: Buffer.from([186, 221, 93, 34, 50, 97, 194, 241]),
|
|
52091
52172
|
LENDING_POOL_ADD_BANK_PERMISSIONLESS: Buffer.from([127, 187, 121, 34, 187, 167, 238, 102]),
|
|
52092
52173
|
LENDING_POOL_CONFIGURE_BANK_ORACLE: Buffer.from([209, 82, 255, 171, 124, 21, 71, 81]),
|
|
52174
|
+
LENDING_POOL_CONFIGURE_BANK_ORACLE_SCOPE: Buffer.from([134, 228, 127, 3, 117, 132, 85, 146]),
|
|
52093
52175
|
LENDING_ACCOUNT_PULSE_HEALTH: Buffer.from([186, 52, 117, 97, 34, 74, 39, 253]),
|
|
52094
52176
|
LENDING_ACCOUNT_SORT_BALANCES: Buffer.from([187, 194, 110, 84, 82, 170, 204, 9]),
|
|
52095
52177
|
DRIFT_DEPOSIT: Buffer.from([252, 63, 250, 201, 98, 55, 130, 12]),
|
|
@@ -52525,6 +52607,23 @@ function makeLendingPoolConfigureBankOracleIx2(programId, accounts, args, remain
|
|
|
52525
52607
|
data
|
|
52526
52608
|
});
|
|
52527
52609
|
}
|
|
52610
|
+
function makeLendingPoolConfigureBankOracleScopeIx2(programId, accounts, args) {
|
|
52611
|
+
const keys = [
|
|
52612
|
+
{ pubkey: accounts.group, isSigner: false, isWritable: false },
|
|
52613
|
+
{ pubkey: accounts.admin, isSigner: true, isWritable: false },
|
|
52614
|
+
{ pubkey: accounts.bank, isSigner: false, isWritable: true }
|
|
52615
|
+
];
|
|
52616
|
+
const data = Buffer.concat([
|
|
52617
|
+
DISCRIMINATORS.LENDING_POOL_CONFIGURE_BANK_ORACLE_SCOPE,
|
|
52618
|
+
encodePublicKey(args.oracle),
|
|
52619
|
+
encodeU16(args.entryIndex)
|
|
52620
|
+
]);
|
|
52621
|
+
return new web3_js.TransactionInstruction({
|
|
52622
|
+
keys,
|
|
52623
|
+
programId,
|
|
52624
|
+
data
|
|
52625
|
+
});
|
|
52626
|
+
}
|
|
52528
52627
|
function makePoolAddBankIx2(programId, accounts, args) {
|
|
52529
52628
|
const keys = [
|
|
52530
52629
|
{ pubkey: accounts.marginfiGroup, isSigner: false, isWritable: true },
|
|
@@ -52744,6 +52843,7 @@ var syncInstructions = {
|
|
|
52744
52843
|
makeCloseAccountIx: makeCloseAccountIx2,
|
|
52745
52844
|
makePoolAddPermissionlessStakedBankIx: makePoolAddPermissionlessStakedBankIx2,
|
|
52746
52845
|
makeLendingPoolConfigureBankOracleIx: makeLendingPoolConfigureBankOracleIx2,
|
|
52846
|
+
makeLendingPoolConfigureBankOracleScopeIx: makeLendingPoolConfigureBankOracleScopeIx2,
|
|
52747
52847
|
makePulseHealthIx: makePulseHealthIx3
|
|
52748
52848
|
};
|
|
52749
52849
|
var sync_instructions_default = syncInstructions;
|
|
@@ -82336,6 +82436,31 @@ async function addOracleToBanksIx({
|
|
|
82336
82436
|
keys: []
|
|
82337
82437
|
};
|
|
82338
82438
|
}
|
|
82439
|
+
async function configureScopeOracleIx({
|
|
82440
|
+
program,
|
|
82441
|
+
bankAddress,
|
|
82442
|
+
oracle,
|
|
82443
|
+
entryIndex,
|
|
82444
|
+
groupAddress,
|
|
82445
|
+
adminAddress
|
|
82446
|
+
}) {
|
|
82447
|
+
const ix = await instructions_default.makeLendingPoolConfigureBankOracleScopeIx(
|
|
82448
|
+
program,
|
|
82449
|
+
{
|
|
82450
|
+
bank: bankAddress,
|
|
82451
|
+
group: groupAddress,
|
|
82452
|
+
admin: adminAddress
|
|
82453
|
+
},
|
|
82454
|
+
{
|
|
82455
|
+
oracle,
|
|
82456
|
+
entryIndex
|
|
82457
|
+
}
|
|
82458
|
+
);
|
|
82459
|
+
return {
|
|
82460
|
+
instructions: [ix],
|
|
82461
|
+
keys: []
|
|
82462
|
+
};
|
|
82463
|
+
}
|
|
82339
82464
|
|
|
82340
82465
|
// src/services/group/types/group.types.ts
|
|
82341
82466
|
function isGroupRateLimiterEnabled(rateLimiter) {
|
|
@@ -85753,6 +85878,7 @@ exports.computeUsdValue = computeUsdValue;
|
|
|
85753
85878
|
exports.computeUtilizationRate = computeUtilizationRate;
|
|
85754
85879
|
exports.computeV0TxSize = computeV0TxSize;
|
|
85755
85880
|
exports.computeVenueAvailableLiquidity = computeVenueAvailableLiquidity;
|
|
85881
|
+
exports.configureScopeOracleIx = configureScopeOracleIx;
|
|
85756
85882
|
exports.convertVoteAccCoeffsToBankCoeffs = convertVoteAccCoeffsToBankCoeffs;
|
|
85757
85883
|
exports.createActiveEmodePairFromPairs = createActiveEmodePairFromPairs;
|
|
85758
85884
|
exports.createEmptyBalance = createEmptyBalance;
|