@percolatorct/sdk 1.0.0-beta.32 → 1.0.0-beta.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/abi/accounts.d.ts +20 -0
- package/dist/abi/instructions.d.ts +5 -5
- package/dist/abi/nft.d.ts +3 -1
- package/dist/index.js +249 -92
- package/dist/index.js.map +1 -1
- package/dist/solana/stake.d.ts +23 -7
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -238,6 +238,12 @@ var IX_TAG = {
|
|
|
238
238
|
// 78: removed (keeper fund)
|
|
239
239
|
};
|
|
240
240
|
Object.freeze(IX_TAG);
|
|
241
|
+
function removedInstruction(name, tag, replacement) {
|
|
242
|
+
const suffix = replacement ? ` Use ${replacement} instead.` : "";
|
|
243
|
+
throw new Error(
|
|
244
|
+
`${name} (tag ${tag}) is not accepted by the deployed wrapper program.${suffix}`
|
|
245
|
+
);
|
|
246
|
+
}
|
|
241
247
|
var HEX_RE = /^[0-9a-fA-F]{64}$/;
|
|
242
248
|
function encodeFeedId(feedId) {
|
|
243
249
|
const hex = feedId.startsWith("0x") ? feedId.slice(2) : feedId;
|
|
@@ -411,23 +417,14 @@ function encodeTradeCpi(args) {
|
|
|
411
417
|
encU64(args.limitPriceE6)
|
|
412
418
|
);
|
|
413
419
|
}
|
|
414
|
-
function encodeTradeCpiV2(
|
|
415
|
-
return
|
|
416
|
-
encU8(IX_TAG.TradeCpiV2),
|
|
417
|
-
encU16(args.lpIdx),
|
|
418
|
-
encU16(args.userIdx),
|
|
419
|
-
encI128(args.size),
|
|
420
|
-
encU8(args.bump)
|
|
421
|
-
);
|
|
420
|
+
function encodeTradeCpiV2(_args) {
|
|
421
|
+
return removedInstruction("TradeCpiV2", IX_TAG.TradeCpiV2, "encodeTradeCpi()");
|
|
422
422
|
}
|
|
423
|
-
function encodeUnresolveMarket(
|
|
424
|
-
return
|
|
423
|
+
function encodeUnresolveMarket(_args) {
|
|
424
|
+
return removedInstruction("UnresolveMarket", IX_TAG.UnresolveMarket, "encodeResolveMarket()");
|
|
425
425
|
}
|
|
426
|
-
function encodeSetRiskThreshold(
|
|
427
|
-
return
|
|
428
|
-
encU8(IX_TAG.SetRiskThreshold),
|
|
429
|
-
encU128(args.newThreshold)
|
|
430
|
-
);
|
|
426
|
+
function encodeSetRiskThreshold(_args) {
|
|
427
|
+
return removedInstruction("SetRiskThreshold", IX_TAG.SetRiskThreshold, "encodeInitMarket()");
|
|
431
428
|
}
|
|
432
429
|
function encodeUpdateAdmin(args) {
|
|
433
430
|
return concatBytes(encU8(IX_TAG.UpdateAdmin), encPubkey(args.newAdmin));
|
|
@@ -446,11 +443,8 @@ function encodeUpdateConfig(args) {
|
|
|
446
443
|
// Rust: i64 (can be negative)
|
|
447
444
|
);
|
|
448
445
|
}
|
|
449
|
-
function encodeSetMaintenanceFee(
|
|
450
|
-
return
|
|
451
|
-
encU8(IX_TAG.SetMaintenanceFee),
|
|
452
|
-
encU128(args.newFee)
|
|
453
|
-
);
|
|
446
|
+
function encodeSetMaintenanceFee(_args) {
|
|
447
|
+
return removedInstruction("SetMaintenanceFee", IX_TAG.SetMaintenanceFee, "encodeInitMarket()");
|
|
454
448
|
}
|
|
455
449
|
function encodeSetOraclePriceCap(args) {
|
|
456
450
|
return concatBytes(
|
|
@@ -470,23 +464,20 @@ function encodeAdminForceClose(args) {
|
|
|
470
464
|
encU16(args.targetIdx)
|
|
471
465
|
);
|
|
472
466
|
}
|
|
473
|
-
function encodeUpdateRiskParams(
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
if (args.tradingFeeBps !== void 0) {
|
|
480
|
-
parts.push(encU64(args.tradingFeeBps));
|
|
481
|
-
}
|
|
482
|
-
return concatBytes(...parts);
|
|
467
|
+
function encodeUpdateRiskParams(_args) {
|
|
468
|
+
return removedInstruction(
|
|
469
|
+
"UpdateRiskParams",
|
|
470
|
+
IX_TAG.UpdateRiskParams,
|
|
471
|
+
"encodeSetInsuranceWithdrawPolicy()"
|
|
472
|
+
);
|
|
483
473
|
}
|
|
484
474
|
var RENOUNCE_ADMIN_CONFIRMATION = 0x52454E4F554E4345n;
|
|
485
475
|
var UNRESOLVE_CONFIRMATION = 0xDEADBEEFCAFE1234n;
|
|
486
476
|
function encodeRenounceAdmin() {
|
|
487
|
-
return
|
|
488
|
-
|
|
489
|
-
|
|
477
|
+
return removedInstruction(
|
|
478
|
+
"RenounceAdmin",
|
|
479
|
+
IX_TAG.RenounceAdmin,
|
|
480
|
+
"encodeWithdrawInsuranceLimited()"
|
|
490
481
|
);
|
|
491
482
|
}
|
|
492
483
|
function encodeLpVaultWithdraw(args) {
|
|
@@ -499,15 +490,8 @@ function encodeUnpauseMarket() {
|
|
|
499
490
|
return encU8(IX_TAG.UnpauseMarket);
|
|
500
491
|
}
|
|
501
492
|
function encodeSetPythOracle(args) {
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
const buf = new Uint8Array(43);
|
|
505
|
-
const dv3 = new DataView(buf.buffer);
|
|
506
|
-
buf[0] = 32;
|
|
507
|
-
buf.set(args.feedId, 1);
|
|
508
|
-
dv3.setBigUint64(33, args.maxStalenessSecs, true);
|
|
509
|
-
dv3.setUint16(41, args.confFilterBps, true);
|
|
510
|
-
return buf;
|
|
493
|
+
void args;
|
|
494
|
+
return removedInstruction("SetPythOracle", IX_TAG.SetPythOracle, "encodeInitMarket()");
|
|
511
495
|
}
|
|
512
496
|
var PYTH_RECEIVER_PROGRAM_ID = "rec5EKMGg6MxZYaMdyBfgwp4d5rB9T1VQH5pJv5LtFJ";
|
|
513
497
|
async function derivePythPriceUpdateAccount(feedId, shardId = 0) {
|
|
@@ -521,7 +505,7 @@ async function derivePythPriceUpdateAccount(feedId, shardId = 0) {
|
|
|
521
505
|
return pda.toBase58();
|
|
522
506
|
}
|
|
523
507
|
function encodeUpdateMarkPrice() {
|
|
524
|
-
return
|
|
508
|
+
return removedInstruction("UpdateMarkPrice", IX_TAG.UpdateMarkPrice, "encodeUpdateHyperpMark()");
|
|
525
509
|
}
|
|
526
510
|
var MARK_PRICE_EMA_WINDOW_SLOTS = 72000n;
|
|
527
511
|
var MARK_PRICE_EMA_ALPHA_E6 = 2000000n / (MARK_PRICE_EMA_WINDOW_SLOTS + 1n);
|
|
@@ -547,7 +531,12 @@ function encodeFundMarketInsurance(args) {
|
|
|
547
531
|
return concatBytes(encU8(IX_TAG.FundMarketInsurance), encU64(args.amount));
|
|
548
532
|
}
|
|
549
533
|
function encodeSetInsuranceIsolation(args) {
|
|
550
|
-
|
|
534
|
+
void args;
|
|
535
|
+
return removedInstruction(
|
|
536
|
+
"SetInsuranceIsolation",
|
|
537
|
+
IX_TAG.SetInsuranceIsolation,
|
|
538
|
+
"encodeFundMarketInsurance()"
|
|
539
|
+
);
|
|
551
540
|
}
|
|
552
541
|
function encodeQueueWithdrawal(args) {
|
|
553
542
|
return concatBytes(encU8(IX_TAG.QueueWithdrawal), encU64(args.lpAmount));
|
|
@@ -628,26 +617,25 @@ function checkPhaseTransition(currentSlot, marketCreatedSlot, oraclePhase, cumul
|
|
|
628
617
|
}
|
|
629
618
|
}
|
|
630
619
|
function encodeSlashCreationDeposit() {
|
|
631
|
-
return
|
|
620
|
+
return removedInstruction("SlashCreationDeposit", IX_TAG.SlashCreationDeposit);
|
|
632
621
|
}
|
|
633
622
|
function encodeInitSharedVault(args) {
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
encU64(args.epochDurationSlots),
|
|
637
|
-
encU16(args.maxMarketExposureBps)
|
|
638
|
-
);
|
|
623
|
+
void args;
|
|
624
|
+
return removedInstruction("InitSharedVault", IX_TAG.InitSharedVault);
|
|
639
625
|
}
|
|
640
626
|
function encodeAllocateMarket(args) {
|
|
641
|
-
|
|
627
|
+
void args;
|
|
628
|
+
return removedInstruction("AllocateMarket", IX_TAG.AllocateMarket);
|
|
642
629
|
}
|
|
643
630
|
function encodeQueueWithdrawalSV(args) {
|
|
644
|
-
|
|
631
|
+
void args;
|
|
632
|
+
return removedInstruction("QueueWithdrawalSV", IX_TAG.QueueWithdrawalSV);
|
|
645
633
|
}
|
|
646
634
|
function encodeClaimEpochWithdrawal() {
|
|
647
|
-
return
|
|
635
|
+
return removedInstruction("ClaimEpochWithdrawal", IX_TAG.ClaimEpochWithdrawal);
|
|
648
636
|
}
|
|
649
637
|
function encodeAdvanceEpoch() {
|
|
650
|
-
return
|
|
638
|
+
return removedInstruction("AdvanceEpoch", IX_TAG.AdvanceEpoch);
|
|
651
639
|
}
|
|
652
640
|
function encodeSetOiImbalanceHardBlock(args) {
|
|
653
641
|
if (args.thresholdBps < 0 || args.thresholdBps > 1e4) {
|
|
@@ -1069,6 +1057,30 @@ var ACCOUNTS_EXECUTE_ADL = [
|
|
|
1069
1057
|
{ name: "clock", signer: false, writable: false },
|
|
1070
1058
|
{ name: "oracle", signer: false, writable: false }
|
|
1071
1059
|
];
|
|
1060
|
+
var ACCOUNTS_RESOLVE_PERMISSIONLESS = [
|
|
1061
|
+
{ name: "slab", signer: false, writable: true },
|
|
1062
|
+
{ name: "clock", signer: false, writable: false },
|
|
1063
|
+
{ name: "oracle", signer: false, writable: false }
|
|
1064
|
+
];
|
|
1065
|
+
var ACCOUNTS_FORCE_CLOSE_RESOLVED = [
|
|
1066
|
+
{ name: "slab", signer: false, writable: true },
|
|
1067
|
+
{ name: "vault", signer: false, writable: true },
|
|
1068
|
+
{ name: "ownerAta", signer: false, writable: true },
|
|
1069
|
+
{ name: "vaultAuthority", signer: false, writable: false },
|
|
1070
|
+
{ name: "tokenProgram", signer: false, writable: false },
|
|
1071
|
+
{ name: "clock", signer: false, writable: false },
|
|
1072
|
+
{ name: "oracle", signer: false, writable: false }
|
|
1073
|
+
];
|
|
1074
|
+
var ACCOUNTS_ADMIN_FORCE_CLOSE = [
|
|
1075
|
+
{ name: "admin", signer: true, writable: true },
|
|
1076
|
+
{ name: "slab", signer: false, writable: true },
|
|
1077
|
+
{ name: "vault", signer: false, writable: true },
|
|
1078
|
+
{ name: "ownerAta", signer: false, writable: true },
|
|
1079
|
+
{ name: "vaultAuthority", signer: false, writable: false },
|
|
1080
|
+
{ name: "tokenProgram", signer: false, writable: false },
|
|
1081
|
+
{ name: "clock", signer: false, writable: false },
|
|
1082
|
+
{ name: "oracle", signer: false, writable: false }
|
|
1083
|
+
];
|
|
1072
1084
|
var ACCOUNTS_CLOSE_STALE_SLABS = [
|
|
1073
1085
|
{ name: "dest", signer: true, writable: true },
|
|
1074
1086
|
{ name: "slab", signer: false, writable: true }
|
|
@@ -1083,10 +1095,108 @@ var ACCOUNTS_AUDIT_CRANK = [
|
|
|
1083
1095
|
var ACCOUNTS_ADVANCE_ORACLE_PHASE = [
|
|
1084
1096
|
{ name: "slab", signer: false, writable: true }
|
|
1085
1097
|
];
|
|
1098
|
+
var ACCOUNTS_UPDATE_HYPERP_MARK = [
|
|
1099
|
+
{ name: "slab", signer: false, writable: true },
|
|
1100
|
+
{ name: "dexPool", signer: false, writable: false },
|
|
1101
|
+
{ name: "clock", signer: false, writable: false }
|
|
1102
|
+
];
|
|
1103
|
+
var ACCOUNTS_CREATE_LP_VAULT = [
|
|
1104
|
+
{ name: "admin", signer: true, writable: true },
|
|
1105
|
+
{ name: "slab", signer: false, writable: true },
|
|
1106
|
+
{ name: "lpVaultState", signer: false, writable: true },
|
|
1107
|
+
{ name: "lpVaultMint", signer: false, writable: true },
|
|
1108
|
+
{ name: "vaultAuthority", signer: false, writable: false },
|
|
1109
|
+
{ name: "systemProgram", signer: false, writable: false },
|
|
1110
|
+
{ name: "tokenProgram", signer: false, writable: false },
|
|
1111
|
+
{ name: "rent", signer: false, writable: false }
|
|
1112
|
+
];
|
|
1113
|
+
var ACCOUNTS_LP_VAULT_DEPOSIT = [
|
|
1114
|
+
{ name: "depositor", signer: true, writable: true },
|
|
1115
|
+
{ name: "slab", signer: false, writable: true },
|
|
1116
|
+
{ name: "depositorAta", signer: false, writable: true },
|
|
1117
|
+
{ name: "vault", signer: false, writable: true },
|
|
1118
|
+
{ name: "tokenProgram", signer: false, writable: false },
|
|
1119
|
+
{ name: "lpVaultMint", signer: false, writable: true },
|
|
1120
|
+
{ name: "depositorLpAta", signer: false, writable: true },
|
|
1121
|
+
{ name: "vaultAuthority", signer: false, writable: false },
|
|
1122
|
+
{ name: "lpVaultState", signer: false, writable: true }
|
|
1123
|
+
];
|
|
1124
|
+
var ACCOUNTS_LP_VAULT_CRANK_FEES = [
|
|
1125
|
+
{ name: "slab", signer: false, writable: true },
|
|
1126
|
+
{ name: "lpVaultState", signer: false, writable: true }
|
|
1127
|
+
];
|
|
1128
|
+
var ACCOUNTS_CHALLENGE_SETTLEMENT = [
|
|
1129
|
+
{ name: "challenger", signer: true, writable: true },
|
|
1130
|
+
{ name: "slab", signer: false, writable: true },
|
|
1131
|
+
{ name: "dispute", signer: false, writable: true },
|
|
1132
|
+
{ name: "challengerAta", signer: false, writable: true },
|
|
1133
|
+
{ name: "vault", signer: false, writable: true },
|
|
1134
|
+
{ name: "tokenProgram", signer: false, writable: false },
|
|
1135
|
+
{ name: "systemProgram", signer: false, writable: false }
|
|
1136
|
+
];
|
|
1137
|
+
var ACCOUNTS_RESOLVE_DISPUTE = [
|
|
1138
|
+
{ name: "admin", signer: true, writable: true },
|
|
1139
|
+
{ name: "slab", signer: false, writable: true },
|
|
1140
|
+
{ name: "dispute", signer: false, writable: true },
|
|
1141
|
+
{ name: "challengerAta", signer: false, writable: true },
|
|
1142
|
+
{ name: "vault", signer: false, writable: true },
|
|
1143
|
+
{ name: "vaultAuthority", signer: false, writable: false },
|
|
1144
|
+
{ name: "tokenProgram", signer: false, writable: false }
|
|
1145
|
+
];
|
|
1146
|
+
var ACCOUNTS_DEPOSIT_LP_COLLATERAL = [
|
|
1147
|
+
{ name: "user", signer: true, writable: true },
|
|
1148
|
+
{ name: "slab", signer: false, writable: true },
|
|
1149
|
+
{ name: "userLpAta", signer: false, writable: true },
|
|
1150
|
+
{ name: "lpVaultMint", signer: false, writable: false },
|
|
1151
|
+
{ name: "lpVaultState", signer: false, writable: true },
|
|
1152
|
+
{ name: "tokenProgram", signer: false, writable: false },
|
|
1153
|
+
{ name: "lpEscrow", signer: false, writable: true }
|
|
1154
|
+
];
|
|
1155
|
+
var ACCOUNTS_WITHDRAW_LP_COLLATERAL = [
|
|
1156
|
+
{ name: "user", signer: true, writable: true },
|
|
1157
|
+
{ name: "slab", signer: false, writable: true },
|
|
1158
|
+
{ name: "userLpAta", signer: false, writable: true },
|
|
1159
|
+
{ name: "lpVaultMint", signer: false, writable: false },
|
|
1160
|
+
{ name: "lpVaultState", signer: false, writable: true },
|
|
1161
|
+
{ name: "tokenProgram", signer: false, writable: false },
|
|
1162
|
+
{ name: "lpEscrow", signer: false, writable: true },
|
|
1163
|
+
{ name: "vaultAuthority", signer: false, writable: false }
|
|
1164
|
+
];
|
|
1165
|
+
var ACCOUNTS_SET_OFFSET_PAIR = [
|
|
1166
|
+
{ name: "admin", signer: true, writable: true },
|
|
1167
|
+
{ name: "slabA", signer: false, writable: true },
|
|
1168
|
+
{ name: "slabB", signer: false, writable: true },
|
|
1169
|
+
{ name: "pairPda", signer: false, writable: true },
|
|
1170
|
+
{ name: "systemProgram", signer: false, writable: false }
|
|
1171
|
+
];
|
|
1172
|
+
var ACCOUNTS_ATTEST_CROSS_MARGIN = [
|
|
1173
|
+
{ name: "payer", signer: true, writable: true },
|
|
1174
|
+
{ name: "slabA", signer: false, writable: true },
|
|
1175
|
+
{ name: "slabB", signer: false, writable: true },
|
|
1176
|
+
{ name: "attestation", signer: false, writable: true },
|
|
1177
|
+
{ name: "pairPda", signer: false, writable: false },
|
|
1178
|
+
{ name: "systemProgram", signer: false, writable: false }
|
|
1179
|
+
];
|
|
1086
1180
|
var ACCOUNTS_SET_OI_IMBALANCE_HARD_BLOCK = [
|
|
1087
1181
|
{ name: "admin", signer: true, writable: false },
|
|
1088
1182
|
{ name: "slab", signer: false, writable: true }
|
|
1089
1183
|
];
|
|
1184
|
+
var ACCOUNTS_SET_MAX_PNL_CAP = [
|
|
1185
|
+
{ name: "admin", signer: true, writable: false },
|
|
1186
|
+
{ name: "slab", signer: false, writable: true }
|
|
1187
|
+
];
|
|
1188
|
+
var ACCOUNTS_SET_OI_CAP_MULTIPLIER = [
|
|
1189
|
+
{ name: "admin", signer: true, writable: false },
|
|
1190
|
+
{ name: "slab", signer: false, writable: true }
|
|
1191
|
+
];
|
|
1192
|
+
var ACCOUNTS_SET_DISPUTE_PARAMS = [
|
|
1193
|
+
{ name: "admin", signer: true, writable: false },
|
|
1194
|
+
{ name: "slab", signer: false, writable: true }
|
|
1195
|
+
];
|
|
1196
|
+
var ACCOUNTS_SET_LP_COLLATERAL_PARAMS = [
|
|
1197
|
+
{ name: "admin", signer: true, writable: false },
|
|
1198
|
+
{ name: "slab", signer: false, writable: true }
|
|
1199
|
+
];
|
|
1090
1200
|
var ACCOUNTS_MINT_POSITION_NFT = [
|
|
1091
1201
|
{ name: "payer", signer: true, writable: true },
|
|
1092
1202
|
{ name: "slab", signer: false, writable: true },
|
|
@@ -1128,10 +1238,28 @@ var ACCOUNTS_CLEAR_PENDING_SETTLEMENT = [
|
|
|
1128
1238
|
{ name: "slab", signer: false, writable: false },
|
|
1129
1239
|
{ name: "positionNftPda", signer: false, writable: true }
|
|
1130
1240
|
];
|
|
1241
|
+
var ACCOUNTS_TRANSFER_OWNERSHIP_CPI = [
|
|
1242
|
+
{ name: "caller", signer: true, writable: false },
|
|
1243
|
+
{ name: "slab", signer: false, writable: true },
|
|
1244
|
+
{ name: "nftProgram", signer: false, writable: false }
|
|
1245
|
+
];
|
|
1131
1246
|
var ACCOUNTS_SET_WALLET_CAP = [
|
|
1132
1247
|
{ name: "admin", signer: true, writable: false },
|
|
1133
1248
|
{ name: "slab", signer: false, writable: true }
|
|
1134
1249
|
];
|
|
1250
|
+
var ACCOUNTS_RESCUE_ORPHAN_VAULT = [
|
|
1251
|
+
{ name: "admin", signer: true, writable: true },
|
|
1252
|
+
{ name: "slab", signer: false, writable: true },
|
|
1253
|
+
{ name: "adminAta", signer: false, writable: true },
|
|
1254
|
+
{ name: "vault", signer: false, writable: true },
|
|
1255
|
+
{ name: "tokenProgram", signer: false, writable: false },
|
|
1256
|
+
{ name: "vaultPda", signer: false, writable: false }
|
|
1257
|
+
];
|
|
1258
|
+
var ACCOUNTS_CLOSE_ORPHAN_SLAB = [
|
|
1259
|
+
{ name: "admin", signer: true, writable: true },
|
|
1260
|
+
{ name: "slab", signer: false, writable: true },
|
|
1261
|
+
{ name: "vault", signer: false, writable: true }
|
|
1262
|
+
];
|
|
1135
1263
|
var ACCOUNTS_SET_DEX_POOL = [
|
|
1136
1264
|
{ name: "admin", signer: true, writable: false },
|
|
1137
1265
|
{ name: "slab", signer: false, writable: true },
|
|
@@ -1627,6 +1755,7 @@ function parsePositionNftAccount(data) {
|
|
|
1627
1755
|
slab: new PublicKey4(data.subarray(16, 48)),
|
|
1628
1756
|
userIdx: view.getUint16(48, true),
|
|
1629
1757
|
nftMint: new PublicKey4(data.subarray(56, 88)),
|
|
1758
|
+
positionOwner: new PublicKey4(data.subarray(160, 192)),
|
|
1630
1759
|
entryPriceE6: view.getBigUint64(88, true),
|
|
1631
1760
|
positionSize: view.getBigUint64(96, true),
|
|
1632
1761
|
isLong: data[104] === 1,
|
|
@@ -4799,12 +4928,21 @@ var STAKE_IX = {
|
|
|
4799
4928
|
Withdraw: 2,
|
|
4800
4929
|
FlushToInsurance: 3,
|
|
4801
4930
|
UpdateConfig: 4,
|
|
4931
|
+
/** @deprecated Removed on-chain in stake v3. This tag now rejects. */
|
|
4802
4932
|
TransferAdmin: 5,
|
|
4933
|
+
/** @deprecated Removed on-chain in stake v3. This tag now rejects. */
|
|
4803
4934
|
AdminSetOracleAuthority: 6,
|
|
4935
|
+
/** @deprecated Removed on-chain in stake v3. This tag now rejects. */
|
|
4804
4936
|
AdminSetRiskThreshold: 7,
|
|
4937
|
+
/** @deprecated Removed on-chain in stake v3. This tag now rejects. */
|
|
4805
4938
|
AdminSetMaintenanceFee: 8,
|
|
4939
|
+
/** @deprecated Removed on-chain in stake v3. This tag now rejects. */
|
|
4806
4940
|
AdminResolveMarket: 9,
|
|
4941
|
+
/** Current on-chain tag 10: transfer withdrawn insurance back into the pool vault. */
|
|
4942
|
+
ReturnInsurance: 10,
|
|
4943
|
+
/** @deprecated Legacy alias for ReturnInsurance. */
|
|
4807
4944
|
AdminWithdrawInsurance: 10,
|
|
4945
|
+
/** @deprecated Removed on-chain in stake v3. This tag now rejects. */
|
|
4808
4946
|
AdminSetInsurancePolicy: 11,
|
|
4809
4947
|
/** PERC-272: Accrue trading fees to LP vault */
|
|
4810
4948
|
AccrueFees: 12,
|
|
@@ -4815,7 +4953,9 @@ var STAKE_IX = {
|
|
|
4815
4953
|
/** PERC-303: Enable/configure senior-junior LP tranches */
|
|
4816
4954
|
AdminSetTrancheConfig: 15,
|
|
4817
4955
|
/** PERC-303: Deposit into junior (first-loss) tranche */
|
|
4818
|
-
DepositJunior: 16
|
|
4956
|
+
DepositJunior: 16,
|
|
4957
|
+
/** Mark the pool as resolved after the wrapper market has been resolved directly. */
|
|
4958
|
+
SetMarketResolved: 18
|
|
4819
4959
|
};
|
|
4820
4960
|
var TEXT2 = new TextEncoder();
|
|
4821
4961
|
function deriveStakePool(slab, programId) {
|
|
@@ -4860,16 +5000,6 @@ function u64Le(v) {
|
|
|
4860
5000
|
new DataView(arr.buffer).setBigUint64(0, big, true);
|
|
4861
5001
|
return arr;
|
|
4862
5002
|
}
|
|
4863
|
-
function u128Le(v) {
|
|
4864
|
-
const big = BigInt(v);
|
|
4865
|
-
if (big < 0n) throw new Error(`u128Le: value must be non-negative, got ${big}`);
|
|
4866
|
-
if (big > (1n << 128n) - 1n) throw new Error(`u128Le: value exceeds u128 max`);
|
|
4867
|
-
const arr = new Uint8Array(16);
|
|
4868
|
-
const view = new DataView(arr.buffer);
|
|
4869
|
-
view.setBigUint64(0, big & 0xFFFFFFFFFFFFFFFFn, true);
|
|
4870
|
-
view.setBigUint64(8, big >> 64n, true);
|
|
4871
|
-
return arr;
|
|
4872
|
-
}
|
|
4873
5003
|
function u16Le(v) {
|
|
4874
5004
|
if (v < 0 || v > 65535) throw new Error(`u16Le: value out of u16 range (0..65535), got ${v}`);
|
|
4875
5005
|
const arr = new Uint8Array(2);
|
|
@@ -4901,36 +5031,38 @@ function encodeStakeUpdateConfig(newCooldownSlots, newDepositCap) {
|
|
|
4901
5031
|
u64Le(newDepositCap ?? 0n)
|
|
4902
5032
|
);
|
|
4903
5033
|
}
|
|
5034
|
+
function removedStakeInstruction(name, tag) {
|
|
5035
|
+
throw new Error(
|
|
5036
|
+
`${name} (stake tag ${tag}) was removed on-chain in percolator-stake v3 and must not be sent.`
|
|
5037
|
+
);
|
|
5038
|
+
}
|
|
4904
5039
|
function encodeStakeTransferAdmin() {
|
|
4905
|
-
return
|
|
5040
|
+
return removedStakeInstruction("encodeStakeTransferAdmin", STAKE_IX.TransferAdmin);
|
|
4906
5041
|
}
|
|
4907
5042
|
function encodeStakeAdminSetOracleAuthority(newAuthority) {
|
|
4908
|
-
|
|
4909
|
-
|
|
4910
|
-
newAuthority.toBytes()
|
|
4911
|
-
);
|
|
5043
|
+
void newAuthority;
|
|
5044
|
+
return removedStakeInstruction("encodeStakeAdminSetOracleAuthority", STAKE_IX.AdminSetOracleAuthority);
|
|
4912
5045
|
}
|
|
4913
5046
|
function encodeStakeAdminSetRiskThreshold(newThreshold) {
|
|
4914
|
-
|
|
4915
|
-
|
|
4916
|
-
u128Le(newThreshold)
|
|
4917
|
-
);
|
|
5047
|
+
void newThreshold;
|
|
5048
|
+
return removedStakeInstruction("encodeStakeAdminSetRiskThreshold", STAKE_IX.AdminSetRiskThreshold);
|
|
4918
5049
|
}
|
|
4919
5050
|
function encodeStakeAdminSetMaintenanceFee(newFee) {
|
|
4920
|
-
|
|
4921
|
-
|
|
4922
|
-
u128Le(newFee)
|
|
4923
|
-
);
|
|
5051
|
+
void newFee;
|
|
5052
|
+
return removedStakeInstruction("encodeStakeAdminSetMaintenanceFee", STAKE_IX.AdminSetMaintenanceFee);
|
|
4924
5053
|
}
|
|
4925
5054
|
function encodeStakeAdminResolveMarket() {
|
|
4926
|
-
return
|
|
5055
|
+
return removedStakeInstruction("encodeStakeAdminResolveMarket", STAKE_IX.AdminResolveMarket);
|
|
4927
5056
|
}
|
|
4928
|
-
function
|
|
5057
|
+
function encodeStakeReturnInsurance(amount) {
|
|
4929
5058
|
return concatBytes(
|
|
4930
|
-
new Uint8Array([STAKE_IX.
|
|
5059
|
+
new Uint8Array([STAKE_IX.ReturnInsurance]),
|
|
4931
5060
|
u64Le(amount)
|
|
4932
5061
|
);
|
|
4933
5062
|
}
|
|
5063
|
+
function encodeStakeAdminWithdrawInsurance(amount) {
|
|
5064
|
+
return encodeStakeReturnInsurance(amount);
|
|
5065
|
+
}
|
|
4934
5066
|
function encodeStakeAccrueFees() {
|
|
4935
5067
|
return new Uint8Array([STAKE_IX.AccrueFees]);
|
|
4936
5068
|
}
|
|
@@ -4957,14 +5089,15 @@ function encodeStakeAdminSetTrancheConfig(juniorFeeMultBps) {
|
|
|
4957
5089
|
function encodeStakeDepositJunior(amount) {
|
|
4958
5090
|
return concatBytes(new Uint8Array([STAKE_IX.DepositJunior]), u64Le(amount));
|
|
4959
5091
|
}
|
|
5092
|
+
function encodeStakeSetMarketResolved() {
|
|
5093
|
+
return new Uint8Array([STAKE_IX.SetMarketResolved]);
|
|
5094
|
+
}
|
|
4960
5095
|
function encodeStakeAdminSetInsurancePolicy(authority, minWithdrawBase, maxWithdrawBps, cooldownSlots) {
|
|
4961
|
-
|
|
4962
|
-
|
|
4963
|
-
|
|
4964
|
-
|
|
4965
|
-
|
|
4966
|
-
u64Le(cooldownSlots)
|
|
4967
|
-
);
|
|
5096
|
+
void authority;
|
|
5097
|
+
void minWithdrawBase;
|
|
5098
|
+
void maxWithdrawBps;
|
|
5099
|
+
void cooldownSlots;
|
|
5100
|
+
return removedStakeInstruction("encodeStakeAdminSetInsurancePolicy", STAKE_IX.AdminSetInsurancePolicy);
|
|
4968
5101
|
}
|
|
4969
5102
|
var STAKE_POOL_SIZE = 352;
|
|
4970
5103
|
function decodeStakePool(data) {
|
|
@@ -5018,11 +5151,12 @@ function decodeStakePool(data) {
|
|
|
5018
5151
|
off += 1;
|
|
5019
5152
|
off += 7;
|
|
5020
5153
|
const reservedStart = off;
|
|
5021
|
-
const
|
|
5022
|
-
const
|
|
5023
|
-
const
|
|
5154
|
+
const marketResolved = bytes[reservedStart + 9] === 1;
|
|
5155
|
+
const hwmEnabled = bytes[reservedStart + 10] === 1;
|
|
5156
|
+
const hwmTvlLow = readU64LE4(bytes, reservedStart + 11);
|
|
5157
|
+
const hwmTvlHigh = readU64LE4(bytes, reservedStart + 19);
|
|
5024
5158
|
const epochHighWaterTvl = hwmTvlLow | hwmTvlHigh << 64n;
|
|
5025
|
-
const hwmFloorBps = readU16LE3(bytes, reservedStart +
|
|
5159
|
+
const hwmFloorBps = readU16LE3(bytes, reservedStart + 27);
|
|
5026
5160
|
const trancheEnabled = bytes[reservedStart + 32] === 1;
|
|
5027
5161
|
const juniorBalance = readU64LE4(bytes, reservedStart + 33);
|
|
5028
5162
|
const juniorTotalLp = readU64LE4(bytes, reservedStart + 41);
|
|
@@ -5032,6 +5166,7 @@ function decodeStakePool(data) {
|
|
|
5032
5166
|
bump,
|
|
5033
5167
|
vaultAuthorityBump,
|
|
5034
5168
|
adminTransferred,
|
|
5169
|
+
marketResolved,
|
|
5035
5170
|
slab,
|
|
5036
5171
|
admin,
|
|
5037
5172
|
collateralMint,
|
|
@@ -6451,19 +6586,26 @@ async function resolvePrice(mint, signal, options) {
|
|
|
6451
6586
|
}
|
|
6452
6587
|
export {
|
|
6453
6588
|
ACCOUNTS_ACCEPT_ADMIN,
|
|
6589
|
+
ACCOUNTS_ADMIN_FORCE_CLOSE,
|
|
6454
6590
|
ACCOUNTS_ADVANCE_ORACLE_PHASE,
|
|
6591
|
+
ACCOUNTS_ATTEST_CROSS_MARGIN,
|
|
6455
6592
|
ACCOUNTS_AUDIT_CRANK,
|
|
6456
6593
|
ACCOUNTS_BURN_POSITION_NFT,
|
|
6457
6594
|
ACCOUNTS_CANCEL_QUEUED_WITHDRAWAL,
|
|
6595
|
+
ACCOUNTS_CHALLENGE_SETTLEMENT,
|
|
6458
6596
|
ACCOUNTS_CLAIM_QUEUED_WITHDRAWAL,
|
|
6459
6597
|
ACCOUNTS_CLEAR_PENDING_SETTLEMENT,
|
|
6460
6598
|
ACCOUNTS_CLOSE_ACCOUNT,
|
|
6599
|
+
ACCOUNTS_CLOSE_ORPHAN_SLAB,
|
|
6461
6600
|
ACCOUNTS_CLOSE_SLAB,
|
|
6462
6601
|
ACCOUNTS_CLOSE_STALE_SLABS,
|
|
6463
6602
|
ACCOUNTS_CREATE_INSURANCE_MINT,
|
|
6603
|
+
ACCOUNTS_CREATE_LP_VAULT,
|
|
6464
6604
|
ACCOUNTS_DEPOSIT_COLLATERAL,
|
|
6465
6605
|
ACCOUNTS_DEPOSIT_INSURANCE_LP,
|
|
6606
|
+
ACCOUNTS_DEPOSIT_LP_COLLATERAL,
|
|
6466
6607
|
ACCOUNTS_EXECUTE_ADL,
|
|
6608
|
+
ACCOUNTS_FORCE_CLOSE_RESOLVED,
|
|
6467
6609
|
ACCOUNTS_FUND_MARKET_INSURANCE,
|
|
6468
6610
|
ACCOUNTS_INIT_LP,
|
|
6469
6611
|
ACCOUNTS_INIT_MARKET,
|
|
@@ -6471,6 +6613,8 @@ export {
|
|
|
6471
6613
|
ACCOUNTS_INIT_USER,
|
|
6472
6614
|
ACCOUNTS_KEEPER_CRANK,
|
|
6473
6615
|
ACCOUNTS_LIQUIDATE_AT_ORACLE,
|
|
6616
|
+
ACCOUNTS_LP_VAULT_CRANK_FEES,
|
|
6617
|
+
ACCOUNTS_LP_VAULT_DEPOSIT,
|
|
6474
6618
|
ACCOUNTS_LP_VAULT_WITHDRAW,
|
|
6475
6619
|
ACCOUNTS_MINT_POSITION_NFT,
|
|
6476
6620
|
ACCOUNTS_NFT_BURN,
|
|
@@ -6479,10 +6623,18 @@ export {
|
|
|
6479
6623
|
ACCOUNTS_PAUSE_MARKET,
|
|
6480
6624
|
ACCOUNTS_QUEUE_WITHDRAWAL,
|
|
6481
6625
|
ACCOUNTS_RECLAIM_SLAB_RENT,
|
|
6626
|
+
ACCOUNTS_RESCUE_ORPHAN_VAULT,
|
|
6627
|
+
ACCOUNTS_RESOLVE_DISPUTE,
|
|
6482
6628
|
ACCOUNTS_RESOLVE_MARKET,
|
|
6629
|
+
ACCOUNTS_RESOLVE_PERMISSIONLESS,
|
|
6483
6630
|
ACCOUNTS_SET_DEX_POOL,
|
|
6631
|
+
ACCOUNTS_SET_DISPUTE_PARAMS,
|
|
6484
6632
|
ACCOUNTS_SET_INSURANCE_ISOLATION,
|
|
6633
|
+
ACCOUNTS_SET_LP_COLLATERAL_PARAMS,
|
|
6485
6634
|
ACCOUNTS_SET_MAINTENANCE_FEE,
|
|
6635
|
+
ACCOUNTS_SET_MAX_PNL_CAP,
|
|
6636
|
+
ACCOUNTS_SET_OFFSET_PAIR,
|
|
6637
|
+
ACCOUNTS_SET_OI_CAP_MULTIPLIER,
|
|
6486
6638
|
ACCOUNTS_SET_OI_IMBALANCE_HARD_BLOCK,
|
|
6487
6639
|
ACCOUNTS_SET_ORACLE_PRICE_CAP,
|
|
6488
6640
|
ACCOUNTS_SET_PENDING_SETTLEMENT,
|
|
@@ -6491,15 +6643,18 @@ export {
|
|
|
6491
6643
|
ACCOUNTS_TOPUP_INSURANCE,
|
|
6492
6644
|
ACCOUNTS_TRADE_CPI,
|
|
6493
6645
|
ACCOUNTS_TRADE_NOCPI,
|
|
6646
|
+
ACCOUNTS_TRANSFER_OWNERSHIP_CPI,
|
|
6494
6647
|
ACCOUNTS_TRANSFER_POSITION_OWNERSHIP,
|
|
6495
6648
|
ACCOUNTS_UNPAUSE_MARKET,
|
|
6496
6649
|
ACCOUNTS_UPDATE_ADMIN,
|
|
6497
6650
|
ACCOUNTS_UPDATE_CONFIG,
|
|
6651
|
+
ACCOUNTS_UPDATE_HYPERP_MARK,
|
|
6498
6652
|
ACCOUNTS_WITHDRAW_COLLATERAL,
|
|
6499
6653
|
ACCOUNTS_WITHDRAW_INSURANCE,
|
|
6500
6654
|
ACCOUNTS_WITHDRAW_INSURANCE_LIMITED_LIVE,
|
|
6501
6655
|
ACCOUNTS_WITHDRAW_INSURANCE_LIMITED_RESOLVED,
|
|
6502
6656
|
ACCOUNTS_WITHDRAW_INSURANCE_LP,
|
|
6657
|
+
ACCOUNTS_WITHDRAW_LP_COLLATERAL,
|
|
6503
6658
|
AccountKind,
|
|
6504
6659
|
CHAINLINK_ANSWER_OFFSET,
|
|
6505
6660
|
CHAINLINK_DECIMALS_OFFSET,
|
|
@@ -6706,6 +6861,8 @@ export {
|
|
|
6706
6861
|
encodeStakeFlushToInsurance,
|
|
6707
6862
|
encodeStakeInitPool,
|
|
6708
6863
|
encodeStakeInitTradingPool,
|
|
6864
|
+
encodeStakeReturnInsurance,
|
|
6865
|
+
encodeStakeSetMarketResolved,
|
|
6709
6866
|
encodeStakeTransferAdmin,
|
|
6710
6867
|
encodeStakeUpdateConfig,
|
|
6711
6868
|
encodeStakeWithdraw,
|