@percolatorct/sdk 2.0.4 → 2.0.6
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/index.js +28 -13
- package/dist/index.js.map +1 -1
- package/dist/solana/slab.d.ts +17 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
TypeScript SDK for building clients, bots, and UIs on top of the [Percolator](https://github.com/dcccrypto/percolator) perpetual futures protocol on Solana.
|
|
4
4
|
|
|
5
|
-
> **EXPERIMENTAL. NOT AUDITED.** `2.0.
|
|
5
|
+
> **EXPERIMENTAL. NOT AUDITED.** `2.0.5`. v12.19 single-target. 792 tests passing. Do NOT use with real funds.
|
|
6
6
|
|
|
7
7
|
## Target wrapper
|
|
8
8
|
|
package/dist/index.js
CHANGED
|
@@ -272,10 +272,17 @@ function encodeFeedId(feedId) {
|
|
|
272
272
|
}
|
|
273
273
|
var INIT_MARKET_BASE_LEN = 304;
|
|
274
274
|
var INIT_MARKET_EXTENDED_TAIL_LEN = 66;
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
275
|
+
var DEFAULT_EXTENDED_TAIL = {
|
|
276
|
+
insuranceWithdrawMaxBps: 0,
|
|
277
|
+
insuranceWithdrawCooldownSlots: 0n,
|
|
278
|
+
permissionlessResolveStaleSlots: 0n,
|
|
279
|
+
fundingHorizonSlots: 500n,
|
|
280
|
+
fundingKBps: 100n,
|
|
281
|
+
fundingMaxPremiumBps: 500n,
|
|
282
|
+
fundingMaxBpsPerSlot: 1000n,
|
|
283
|
+
markMinFee: 0n,
|
|
284
|
+
forceCloseDelaySlots: 1n
|
|
285
|
+
};
|
|
279
286
|
function encodeExtendedTail(t) {
|
|
280
287
|
return concatBytes(
|
|
281
288
|
encU16(t.insuranceWithdrawMaxBps),
|
|
@@ -329,16 +336,13 @@ function encodeInitMarket(args) {
|
|
|
329
336
|
`encodeInitMarket: base payload expected ${INIT_MARKET_BASE_LEN} bytes, got ${base.length}`
|
|
330
337
|
);
|
|
331
338
|
}
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
);
|
|
338
|
-
}
|
|
339
|
-
return concatBytes(base, tail);
|
|
339
|
+
const tail = encodeExtendedTail(args.extendedTail ?? DEFAULT_EXTENDED_TAIL);
|
|
340
|
+
if (tail.length !== INIT_MARKET_EXTENDED_TAIL_LEN) {
|
|
341
|
+
throw new Error(
|
|
342
|
+
`encodeInitMarket: extended tail expected ${INIT_MARKET_EXTENDED_TAIL_LEN} bytes, got ${tail.length}`
|
|
343
|
+
);
|
|
340
344
|
}
|
|
341
|
-
return base;
|
|
345
|
+
return concatBytes(base, tail);
|
|
342
346
|
}
|
|
343
347
|
function encodeInitUser(args) {
|
|
344
348
|
return concatBytes(encU8(IX_TAG.InitUser), encU64(args.feePayment));
|
|
@@ -2871,6 +2875,12 @@ for (const [label, n] of [["Small", 256], ["Medium", 1024], ["Large", 4096]]) {
|
|
|
2871
2875
|
const size = V12_17_ENGINE_OFF_SBF + accountsOff + n * V12_17_ACCOUNT_SIZE_SBF + V12_17_RISK_BUF_LEN + n * V12_17_GEN_TABLE_ENTRY;
|
|
2872
2876
|
SLAB_TIERS_V12_17[label.toLowerCase()] = { maxAccounts: n, dataSize: size, label, description: `${n} slots (v12.17)` };
|
|
2873
2877
|
}
|
|
2878
|
+
var SLAB_TIERS_V12_19 = {
|
|
2879
|
+
micro: { maxAccounts: 64, dataSize: 26848, label: "Micro", description: "64 slots (v12.19, --features micro)" },
|
|
2880
|
+
small: { maxAccounts: 256, dataSize: 96760, label: "Small", description: "256 slots (v12.19, --features small) \u2014 deployed mainnet ESa89R5..." },
|
|
2881
|
+
medium: { maxAccounts: 1024, dataSize: 376408, label: "Medium", description: "1024 slots (v12.19, --features medium)" },
|
|
2882
|
+
large: { maxAccounts: 4096, dataSize: 1495e3, label: "Large", description: "4096 slots (v12.19, default features)" }
|
|
2883
|
+
};
|
|
2874
2884
|
function buildLayoutVSetDexPool(maxAccounts) {
|
|
2875
2885
|
const engineOff = V_SETDEXPOOL_ENGINE_OFF;
|
|
2876
2886
|
const bitmapOff = V_ADL_ENGINE_BITMAP_OFF;
|
|
@@ -4651,6 +4661,10 @@ async function discoverMarkets(connection, programId, options = {}) {
|
|
|
4651
4661
|
const ALL_TIERS = [
|
|
4652
4662
|
...Object.values(SLAB_TIERS),
|
|
4653
4663
|
// v12.17 (default)
|
|
4664
|
+
...Object.values(SLAB_TIERS_V12_19),
|
|
4665
|
+
// v12.19 (deployed mainnet)
|
|
4666
|
+
...Object.values(SLAB_TIERS_V12_17),
|
|
4667
|
+
// v12.17 (explicit)
|
|
4654
4668
|
...Object.values(SLAB_TIERS_V12_15),
|
|
4655
4669
|
// v12.15
|
|
4656
4670
|
...Object.values(SLAB_TIERS_V12_1),
|
|
@@ -7043,6 +7057,7 @@ export {
|
|
|
7043
7057
|
SLAB_TIERS_V12_1,
|
|
7044
7058
|
SLAB_TIERS_V12_15,
|
|
7045
7059
|
SLAB_TIERS_V12_17,
|
|
7060
|
+
SLAB_TIERS_V12_19,
|
|
7046
7061
|
SLAB_TIERS_V1D,
|
|
7047
7062
|
SLAB_TIERS_V1D_LEGACY,
|
|
7048
7063
|
SLAB_TIERS_V1M,
|