@medialane/sdk 0.85.7 → 0.85.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.
@@ -11595,6 +11595,84 @@ function buildDeployAccountParams(ownerPubkey, salt = 0) {
11595
11595
  contractAddress: computeAccountAddress(ownerPubkey, salt)
11596
11596
  };
11597
11597
  }
11598
+ var norm = (address) => normalizeAddress("STARKNET", address);
11599
+ var SIGNER_TYPE_NAMES = ["Starknet", "Secp256k1", "Secp256r1"];
11600
+ function encodeFeltArray(items) {
11601
+ return [starknet.num.toHex(items.length), ...items];
11602
+ }
11603
+ function encodeStarknetSigner(pubkey) {
11604
+ return ["0x0", starknet.num.toHex(pubkey)];
11605
+ }
11606
+ function encodeStarknetSignerArray(pubkeys) {
11607
+ return [starknet.num.toHex(pubkeys.length), ...pubkeys.flatMap(encodeStarknetSigner)];
11608
+ }
11609
+ function buildSetFirstGuardianCall(address, guardianPubkey) {
11610
+ return {
11611
+ contractAddress: norm(address),
11612
+ entrypoint: "change_guardians",
11613
+ calldata: [...encodeFeltArray([]), ...encodeStarknetSignerArray([guardianPubkey])]
11614
+ };
11615
+ }
11616
+ function buildTriggerEscapeOwnerCall(targetAddress, newOwnerPubkey) {
11617
+ return {
11618
+ contractAddress: norm(targetAddress),
11619
+ entrypoint: "trigger_escape_owner",
11620
+ calldata: encodeStarknetSigner(newOwnerPubkey)
11621
+ };
11622
+ }
11623
+ function buildCompleteEscapeOwnerCall(targetAddress) {
11624
+ return { contractAddress: norm(targetAddress), entrypoint: "escape_owner", calldata: [] };
11625
+ }
11626
+ function buildCancelEscapeCall(address) {
11627
+ return { contractAddress: norm(address), entrypoint: "cancel_escape", calldata: [] };
11628
+ }
11629
+ function decodeGuardiansInfo(res) {
11630
+ const len = Number(res[0]);
11631
+ const out = [];
11632
+ for (let i = 0; i < len; i++) {
11633
+ const base = 1 + i * 3;
11634
+ out.push({
11635
+ type: SIGNER_TYPE_NAMES[Number(res[base])] ?? "Starknet",
11636
+ guid: res[base + 1],
11637
+ storedValue: res[base + 2]
11638
+ });
11639
+ }
11640
+ return out;
11641
+ }
11642
+ var ESCAPE_TYPE_NAMES = ["None", "Guardian", "Owner"];
11643
+ var ESCAPE_STATUS_NAMES = ["None", "NotReady", "Ready", "Expired"];
11644
+ function decodeEscapeAndStatus(res) {
11645
+ const readyAt = Number(res[0]);
11646
+ const escapeType = ESCAPE_TYPE_NAMES[Number(res[1])] ?? "None";
11647
+ const optionTag = Number(res[2]);
11648
+ const statusIndex = optionTag === 0 ? 5 : 3;
11649
+ const status = ESCAPE_STATUS_NAMES[Number(res[statusIndex])] ?? "None";
11650
+ return { readyAt, escapeType, status };
11651
+ }
11652
+ async function getGuardians(provider, address) {
11653
+ const res = await provider.callContract({
11654
+ contractAddress: norm(address),
11655
+ entrypoint: "get_guardians_info",
11656
+ calldata: []
11657
+ });
11658
+ return decodeGuardiansInfo(res);
11659
+ }
11660
+ async function getEscape(provider, address) {
11661
+ const res = await provider.callContract({
11662
+ contractAddress: norm(address),
11663
+ entrypoint: "get_escape_and_status",
11664
+ calldata: []
11665
+ });
11666
+ return decodeEscapeAndStatus(res);
11667
+ }
11668
+ async function getEscapeSecurityPeriod(provider, address) {
11669
+ const res = await provider.callContract({
11670
+ contractAddress: norm(address),
11671
+ entrypoint: "get_escape_security_period",
11672
+ calldata: []
11673
+ });
11674
+ return Number(res[0]);
11675
+ }
11598
11676
 
11599
11677
  exports.ADMIN_HEADERS = ADMIN_HEADERS;
11600
11678
  exports.ADMIN_SCOPE = ADMIN_SCOPE;
@@ -11633,18 +11711,24 @@ exports.adminRequestDigest = adminRequestDigest;
11633
11711
  exports.build1155CancellationTypedData = build1155CancellationTypedData;
11634
11712
  exports.build1155OrderTypedData = build1155OrderTypedData;
11635
11713
  exports.buildAdminSessionTypedData = buildAdminSessionTypedData;
11714
+ exports.buildCancelEscapeCall = buildCancelEscapeCall;
11636
11715
  exports.buildCancellationTypedData = buildCancellationTypedData;
11637
11716
  exports.buildChangeOwnersCall = buildChangeOwnersCall;
11717
+ exports.buildCompleteEscapeOwnerCall = buildCompleteEscapeOwnerCall;
11638
11718
  exports.buildCreateCreatorCoinCall = buildCreateCreatorCoinCall;
11639
11719
  exports.buildDeployAccountParams = buildDeployAccountParams;
11640
11720
  exports.buildFeeCall = buildFeeCall;
11641
11721
  exports.buildLaunchOnEkuboCalls = buildLaunchOnEkuboCalls;
11642
11722
  exports.buildOrderTypedData = buildOrderTypedData;
11723
+ exports.buildSetFirstGuardianCall = buildSetFirstGuardianCall;
11724
+ exports.buildTriggerEscapeOwnerCall = buildTriggerEscapeOwnerCall;
11643
11725
  exports.buybackQuoteRaw = buybackQuoteRaw;
11644
11726
  exports.coinToRaw = toRaw;
11645
11727
  exports.computeAccountAddress = computeAccountAddress;
11646
11728
  exports.computeOwnerGuid = computeOwnerGuid;
11647
11729
  exports.createAdminSessionGrant = createAdminSessionGrant;
11730
+ exports.decodeEscapeAndStatus = decodeEscapeAndStatus;
11731
+ exports.decodeGuardiansInfo = decodeGuardiansInfo;
11648
11732
  exports.deriveOwnerKeyPair = deriveOwnerKeyPair;
11649
11733
  exports.encodeAdminHeaders = encodeAdminHeaders;
11650
11734
  exports.encodeByteArray = encodeByteArray;
@@ -11652,6 +11736,9 @@ exports.fdvHuman = fdvHuman;
11652
11736
  exports.getCounter = getCounter;
11653
11737
  exports.getCounter1155 = getCounter1155;
11654
11738
  exports.getCreatorCoinPrice = getCreatorCoinPrice;
11739
+ exports.getEscape = getEscape;
11740
+ exports.getEscapeSecurityPeriod = getEscapeSecurityPeriod;
11741
+ exports.getGuardians = getGuardians;
11655
11742
  exports.getOrderDetails = getOrderDetails;
11656
11743
  exports.getOrderDetails1155 = getOrderDetails1155;
11657
11744
  exports.getSiwsStorageKey = getSiwsStorageKey;