@monolythium/core-sdk 0.3.7 → 0.3.9
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 +105 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +39 -1
- package/dist/index.d.ts +39 -1
- package/dist/index.js +98 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -6389,6 +6389,11 @@ function assertWholeNumber(field2, value) {
|
|
|
6389
6389
|
|
|
6390
6390
|
// src/delegation.ts
|
|
6391
6391
|
var DELEGATION_SELECTORS = {
|
|
6392
|
+
delegate: "0x662337de",
|
|
6393
|
+
undelegate: "0x914f3ca8",
|
|
6394
|
+
redelegate: "0xa06ac18f",
|
|
6395
|
+
claim: "0x4e71d92d",
|
|
6396
|
+
setAutoCompound: "0x86593454",
|
|
6392
6397
|
completeRedemption: "0x26169d0a"
|
|
6393
6398
|
};
|
|
6394
6399
|
var DELEGATION_REVERT_TAGS = {
|
|
@@ -6414,6 +6419,43 @@ function encodeCompleteRedemptionCalldata(index) {
|
|
|
6414
6419
|
)
|
|
6415
6420
|
);
|
|
6416
6421
|
}
|
|
6422
|
+
function encodeDelegateCalldata(cluster, weightBps) {
|
|
6423
|
+
return bytesToHex6(
|
|
6424
|
+
concatBytes5(
|
|
6425
|
+
hexToBytes5(DELEGATION_SELECTORS.delegate),
|
|
6426
|
+
uint32Word2(cluster, "cluster"),
|
|
6427
|
+
uint16Word(weightBps, "weightBps")
|
|
6428
|
+
)
|
|
6429
|
+
);
|
|
6430
|
+
}
|
|
6431
|
+
function encodeUndelegateCalldata(cluster) {
|
|
6432
|
+
return bytesToHex6(
|
|
6433
|
+
concatBytes5(
|
|
6434
|
+
hexToBytes5(DELEGATION_SELECTORS.undelegate),
|
|
6435
|
+
uint32Word2(cluster, "cluster")
|
|
6436
|
+
)
|
|
6437
|
+
);
|
|
6438
|
+
}
|
|
6439
|
+
function encodeRedelegateCalldata(fromCluster, toCluster, weightBps) {
|
|
6440
|
+
return bytesToHex6(
|
|
6441
|
+
concatBytes5(
|
|
6442
|
+
hexToBytes5(DELEGATION_SELECTORS.redelegate),
|
|
6443
|
+
uint32Word2(fromCluster, "fromCluster"),
|
|
6444
|
+
uint32Word2(toCluster, "toCluster"),
|
|
6445
|
+
uint16Word(weightBps, "weightBps")
|
|
6446
|
+
)
|
|
6447
|
+
);
|
|
6448
|
+
}
|
|
6449
|
+
function encodeClaimCalldata() {
|
|
6450
|
+
return DELEGATION_SELECTORS.claim;
|
|
6451
|
+
}
|
|
6452
|
+
function encodeSetAutoCompoundCalldata(enabled) {
|
|
6453
|
+
const flag = new Uint8Array(32);
|
|
6454
|
+
flag[31] = enabled ? 1 : 0;
|
|
6455
|
+
return bytesToHex6(
|
|
6456
|
+
concatBytes5(hexToBytes5(DELEGATION_SELECTORS.setAutoCompound), flag)
|
|
6457
|
+
);
|
|
6458
|
+
}
|
|
6417
6459
|
function isRedemptionPrincipalUnavailableRevert(data) {
|
|
6418
6460
|
return bytesToHex6(toBytes3(data)).toLowerCase() === DELEGATION_REVERT_TAGS.redemptionPrincipalUnavailable;
|
|
6419
6461
|
}
|
|
@@ -6430,6 +6472,32 @@ function uint64Word2(value, name) {
|
|
|
6430
6472
|
}
|
|
6431
6473
|
return out;
|
|
6432
6474
|
}
|
|
6475
|
+
function uint32Word2(value, name) {
|
|
6476
|
+
const n = toBigint2(value, name);
|
|
6477
|
+
if (n < 0n || n > 0xffffffffn) {
|
|
6478
|
+
throw new DelegationPrecompileError(`${name} must fit uint32`);
|
|
6479
|
+
}
|
|
6480
|
+
const out = new Uint8Array(32);
|
|
6481
|
+
let rest = n;
|
|
6482
|
+
for (let i = 31; i >= 28; i--) {
|
|
6483
|
+
out[i] = Number(rest & 0xffn);
|
|
6484
|
+
rest >>= 8n;
|
|
6485
|
+
}
|
|
6486
|
+
return out;
|
|
6487
|
+
}
|
|
6488
|
+
function uint16Word(value, name) {
|
|
6489
|
+
const n = toBigint2(value, name);
|
|
6490
|
+
if (n < 0n || n > 0xffffn) {
|
|
6491
|
+
throw new DelegationPrecompileError(`${name} must fit uint16`);
|
|
6492
|
+
}
|
|
6493
|
+
const out = new Uint8Array(32);
|
|
6494
|
+
let rest = n;
|
|
6495
|
+
for (let i = 31; i >= 30; i--) {
|
|
6496
|
+
out[i] = Number(rest & 0xffn);
|
|
6497
|
+
rest >>= 8n;
|
|
6498
|
+
}
|
|
6499
|
+
return out;
|
|
6500
|
+
}
|
|
6433
6501
|
function toBigint2(value, name) {
|
|
6434
6502
|
if (typeof value === "bigint") return value;
|
|
6435
6503
|
if (typeof value === "number") {
|
|
@@ -6856,7 +6924,13 @@ var CLOB_SELECTORS = {
|
|
|
6856
6924
|
*/
|
|
6857
6925
|
placeMarketOrderEx: "0xa6f092f0",
|
|
6858
6926
|
/** `cancelOrder(bytes32)` */
|
|
6859
|
-
cancelOrder: "0x7489ec23"
|
|
6927
|
+
cancelOrder: "0x7489ec23",
|
|
6928
|
+
/** `setMinNotional(bytes32,bytes32,uint256)` — foundation-authorized. */
|
|
6929
|
+
setMinNotional: "0x395dc48f",
|
|
6930
|
+
/** `setTickSize(bytes32,bytes32,uint256)` — foundation-authorized per-market grid tune. */
|
|
6931
|
+
setTickSize: "0x10666f0b",
|
|
6932
|
+
/** `setLotSize(bytes32,bytes32,uint256)` — foundation-authorized per-market grid tune. */
|
|
6933
|
+
setLotSize: "0x9909be80"
|
|
6860
6934
|
};
|
|
6861
6935
|
var MarketActionError = class extends Error {
|
|
6862
6936
|
constructor(message) {
|
|
@@ -6928,7 +7002,7 @@ function encodePlaceMarketOrderCalldata(args) {
|
|
|
6928
7002
|
normalized.quoteTokenId,
|
|
6929
7003
|
uint8Word2(normalized.side),
|
|
6930
7004
|
uint256Word2(normalized.quantity, "quantity"),
|
|
6931
|
-
|
|
7005
|
+
uint16Word2(normalized.maxSlippageBps, "maxSlippageBps")
|
|
6932
7006
|
)
|
|
6933
7007
|
);
|
|
6934
7008
|
}
|
|
@@ -6941,7 +7015,7 @@ function encodePlaceMarketOrderExCalldata(args) {
|
|
|
6941
7015
|
normalized.quoteTokenId,
|
|
6942
7016
|
uint8Word2(normalized.side),
|
|
6943
7017
|
uint256Word2(normalized.quantity, "quantity"),
|
|
6944
|
-
|
|
7018
|
+
uint16Word2(normalized.maxSlippageBps, "maxSlippageBps"),
|
|
6945
7019
|
uint8Word2(normalized.mode)
|
|
6946
7020
|
)
|
|
6947
7021
|
);
|
|
@@ -6954,6 +7028,25 @@ function encodeCancelOrderCalldata(args) {
|
|
|
6954
7028
|
)
|
|
6955
7029
|
);
|
|
6956
7030
|
}
|
|
7031
|
+
function encodeMarketGridTuneCalldata(selector, label, args) {
|
|
7032
|
+
return bytesToHex2(
|
|
7033
|
+
concatBytes2(
|
|
7034
|
+
hexToBytes2(selector, `${label} selector`),
|
|
7035
|
+
bytes32FromHex(args.baseTokenId, "baseTokenId"),
|
|
7036
|
+
bytes32FromHex(args.quoteTokenId, "quoteTokenId"),
|
|
7037
|
+
uint256Word2(BigInt(args.newValue), "newValue")
|
|
7038
|
+
)
|
|
7039
|
+
);
|
|
7040
|
+
}
|
|
7041
|
+
function encodeSetMinNotionalCalldata(args) {
|
|
7042
|
+
return encodeMarketGridTuneCalldata(CLOB_SELECTORS.setMinNotional, "setMinNotional", args);
|
|
7043
|
+
}
|
|
7044
|
+
function encodeSetTickSizeCalldata(args) {
|
|
7045
|
+
return encodeMarketGridTuneCalldata(CLOB_SELECTORS.setTickSize, "setTickSize", args);
|
|
7046
|
+
}
|
|
7047
|
+
function encodeSetLotSizeCalldata(args) {
|
|
7048
|
+
return encodeMarketGridTuneCalldata(CLOB_SELECTORS.setLotSize, "setLotSize", args);
|
|
7049
|
+
}
|
|
6957
7050
|
function encodeNativeSpotLimitOrderCall(args) {
|
|
6958
7051
|
const w = new BincodeWriter();
|
|
6959
7052
|
w.enumVariant(0);
|
|
@@ -7451,7 +7544,7 @@ function uint64Word3(value, name) {
|
|
|
7451
7544
|
}
|
|
7452
7545
|
return out;
|
|
7453
7546
|
}
|
|
7454
|
-
function
|
|
7547
|
+
function uint16Word2(value, name) {
|
|
7455
7548
|
if (value < 0n || value > 0xffffn) {
|
|
7456
7549
|
throw new MarketActionError(`${name} must fit uint16`);
|
|
7457
7550
|
}
|
|
@@ -8163,8 +8256,10 @@ exports.deriveNativeSpotMarketId = deriveNativeSpotMarketId;
|
|
|
8163
8256
|
exports.deriveNativeSpotOrderId = deriveNativeSpotOrderId;
|
|
8164
8257
|
exports.encodeBlockSelector = encodeBlockSelector;
|
|
8165
8258
|
exports.encodeCancelOrderCalldata = encodeCancelOrderCalldata;
|
|
8259
|
+
exports.encodeClaimCalldata = encodeClaimCalldata;
|
|
8166
8260
|
exports.encodeClaimPolicyByAddressCalldata = encodeClaimPolicyByAddressCalldata;
|
|
8167
8261
|
exports.encodeCompleteRedemptionCalldata = encodeCompleteRedemptionCalldata;
|
|
8262
|
+
exports.encodeDelegateCalldata = encodeDelegateCalldata;
|
|
8168
8263
|
exports.encodeDisableCalldata = encodeDisableCalldata;
|
|
8169
8264
|
exports.encodeEnableCalldata = encodeEnableCalldata;
|
|
8170
8265
|
exports.encodeHasPubkeyCalldata = encodeHasPubkeyCalldata;
|
|
@@ -8219,12 +8314,18 @@ exports.encodeNativeSpotSettleRoutedLimitOrderCall = encodeNativeSpotSettleRoute
|
|
|
8219
8314
|
exports.encodePlaceLimitOrderCalldata = encodePlaceLimitOrderCalldata;
|
|
8220
8315
|
exports.encodePlaceMarketOrderCalldata = encodePlaceMarketOrderCalldata;
|
|
8221
8316
|
exports.encodePlaceMarketOrderExCalldata = encodePlaceMarketOrderExCalldata;
|
|
8317
|
+
exports.encodeRedelegateCalldata = encodeRedelegateCalldata;
|
|
8222
8318
|
exports.encodeRegisterPubkeyCalldata = encodeRegisterPubkeyCalldata;
|
|
8223
8319
|
exports.encodeReportServiceProbeCalldata = encodeReportServiceProbeCalldata;
|
|
8320
|
+
exports.encodeSetAutoCompoundCalldata = encodeSetAutoCompoundCalldata;
|
|
8224
8321
|
exports.encodeSetBridgeResumeCooldownCalldata = encodeSetBridgeResumeCooldownCalldata;
|
|
8225
8322
|
exports.encodeSetBridgeRouteFinalityCalldata = encodeSetBridgeRouteFinalityCalldata;
|
|
8323
|
+
exports.encodeSetLotSizeCalldata = encodeSetLotSizeCalldata;
|
|
8324
|
+
exports.encodeSetMinNotionalCalldata = encodeSetMinNotionalCalldata;
|
|
8226
8325
|
exports.encodeSetPolicyCalldata = encodeSetPolicyCalldata;
|
|
8227
8326
|
exports.encodeSetPolicyClaimCalldata = encodeSetPolicyClaimCalldata;
|
|
8327
|
+
exports.encodeSetTickSizeCalldata = encodeSetTickSizeCalldata;
|
|
8328
|
+
exports.encodeUndelegateCalldata = encodeUndelegateCalldata;
|
|
8228
8329
|
exports.exportBridgeRouteCatalogueJson = exportBridgeRouteCatalogueJson;
|
|
8229
8330
|
exports.fetchChainInfoLatest = fetchChainInfoLatest;
|
|
8230
8331
|
exports.fetchChainRegistryLatest = fetchChainRegistryLatest;
|