@monolythium/core-sdk 0.3.7 → 0.3.8

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 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") {
@@ -6928,7 +6996,7 @@ function encodePlaceMarketOrderCalldata(args) {
6928
6996
  normalized.quoteTokenId,
6929
6997
  uint8Word2(normalized.side),
6930
6998
  uint256Word2(normalized.quantity, "quantity"),
6931
- uint16Word(normalized.maxSlippageBps, "maxSlippageBps")
6999
+ uint16Word2(normalized.maxSlippageBps, "maxSlippageBps")
6932
7000
  )
6933
7001
  );
6934
7002
  }
@@ -6941,7 +7009,7 @@ function encodePlaceMarketOrderExCalldata(args) {
6941
7009
  normalized.quoteTokenId,
6942
7010
  uint8Word2(normalized.side),
6943
7011
  uint256Word2(normalized.quantity, "quantity"),
6944
- uint16Word(normalized.maxSlippageBps, "maxSlippageBps"),
7012
+ uint16Word2(normalized.maxSlippageBps, "maxSlippageBps"),
6945
7013
  uint8Word2(normalized.mode)
6946
7014
  )
6947
7015
  );
@@ -7451,7 +7519,7 @@ function uint64Word3(value, name) {
7451
7519
  }
7452
7520
  return out;
7453
7521
  }
7454
- function uint16Word(value, name) {
7522
+ function uint16Word2(value, name) {
7455
7523
  if (value < 0n || value > 0xffffn) {
7456
7524
  throw new MarketActionError(`${name} must fit uint16`);
7457
7525
  }
@@ -8163,8 +8231,10 @@ exports.deriveNativeSpotMarketId = deriveNativeSpotMarketId;
8163
8231
  exports.deriveNativeSpotOrderId = deriveNativeSpotOrderId;
8164
8232
  exports.encodeBlockSelector = encodeBlockSelector;
8165
8233
  exports.encodeCancelOrderCalldata = encodeCancelOrderCalldata;
8234
+ exports.encodeClaimCalldata = encodeClaimCalldata;
8166
8235
  exports.encodeClaimPolicyByAddressCalldata = encodeClaimPolicyByAddressCalldata;
8167
8236
  exports.encodeCompleteRedemptionCalldata = encodeCompleteRedemptionCalldata;
8237
+ exports.encodeDelegateCalldata = encodeDelegateCalldata;
8168
8238
  exports.encodeDisableCalldata = encodeDisableCalldata;
8169
8239
  exports.encodeEnableCalldata = encodeEnableCalldata;
8170
8240
  exports.encodeHasPubkeyCalldata = encodeHasPubkeyCalldata;
@@ -8219,12 +8289,15 @@ exports.encodeNativeSpotSettleRoutedLimitOrderCall = encodeNativeSpotSettleRoute
8219
8289
  exports.encodePlaceLimitOrderCalldata = encodePlaceLimitOrderCalldata;
8220
8290
  exports.encodePlaceMarketOrderCalldata = encodePlaceMarketOrderCalldata;
8221
8291
  exports.encodePlaceMarketOrderExCalldata = encodePlaceMarketOrderExCalldata;
8292
+ exports.encodeRedelegateCalldata = encodeRedelegateCalldata;
8222
8293
  exports.encodeRegisterPubkeyCalldata = encodeRegisterPubkeyCalldata;
8223
8294
  exports.encodeReportServiceProbeCalldata = encodeReportServiceProbeCalldata;
8295
+ exports.encodeSetAutoCompoundCalldata = encodeSetAutoCompoundCalldata;
8224
8296
  exports.encodeSetBridgeResumeCooldownCalldata = encodeSetBridgeResumeCooldownCalldata;
8225
8297
  exports.encodeSetBridgeRouteFinalityCalldata = encodeSetBridgeRouteFinalityCalldata;
8226
8298
  exports.encodeSetPolicyCalldata = encodeSetPolicyCalldata;
8227
8299
  exports.encodeSetPolicyClaimCalldata = encodeSetPolicyClaimCalldata;
8300
+ exports.encodeUndelegateCalldata = encodeUndelegateCalldata;
8228
8301
  exports.exportBridgeRouteCatalogueJson = exportBridgeRouteCatalogueJson;
8229
8302
  exports.fetchChainInfoLatest = fetchChainInfoLatest;
8230
8303
  exports.fetchChainRegistryLatest = fetchChainRegistryLatest;