@medialane/sdk 0.108.0 → 0.109.0

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.
@@ -11700,17 +11700,36 @@ function computeAccountAddress(ownerPubkey, salt = 0) {
11700
11700
  );
11701
11701
  }
11702
11702
  var STARKNET_SIGNER_TYPE = "0x537461726b6e6574205369676e6572";
11703
+ var OPTION_NONE = "0x1";
11704
+ var SIGNER_STARKNET = "0x0";
11703
11705
  function computeOwnerGuid(ownerPubkey) {
11704
11706
  return starknet.hash.computePoseidonHash(STARKNET_SIGNER_TYPE, starknet.num.toHex(ownerPubkey));
11705
11707
  }
11706
- function buildChangeOwnersCall(accountAddress, removeOwnerPubkey, addOwnerPubkey) {
11707
- const guidToRemove = computeOwnerGuid(removeOwnerPubkey);
11708
+ function changeOwners(accountAddress, guidsToRemove, pubkeysToAdd) {
11708
11709
  return {
11709
11710
  contractAddress: accountAddress,
11710
11711
  entrypoint: "change_owners",
11711
- calldata: ["0x1", guidToRemove, "0x1", "0x0", starknet.num.toHex(addOwnerPubkey)]
11712
+ calldata: [
11713
+ starknet.num.toHex(guidsToRemove.length),
11714
+ ...guidsToRemove,
11715
+ starknet.num.toHex(pubkeysToAdd.length),
11716
+ ...pubkeysToAdd.flatMap((p) => [SIGNER_STARKNET, starknet.num.toHex(p)]),
11717
+ OPTION_NONE
11718
+ ]
11712
11719
  };
11713
11720
  }
11721
+ function buildChangeOwnersCall(accountAddress, removeOwnerPubkey, addOwnerPubkey) {
11722
+ return changeOwners(accountAddress, [computeOwnerGuid(removeOwnerPubkey)], [addOwnerPubkey]);
11723
+ }
11724
+ function buildAddOwnerCall(accountAddress, addOwnerPubkey) {
11725
+ return changeOwners(accountAddress, [], [addOwnerPubkey]);
11726
+ }
11727
+ function buildRemoveOwnerCall(accountAddress, removeOwnerPubkey) {
11728
+ return changeOwners(accountAddress, [computeOwnerGuid(removeOwnerPubkey)], []);
11729
+ }
11730
+ function buildRemoveOwnerByGuidCall(accountAddress, ownerGuid) {
11731
+ return changeOwners(accountAddress, [starknet.num.toHex(ownerGuid)], []);
11732
+ }
11714
11733
  function buildDeployAccountParams(ownerPubkey, salt = 0) {
11715
11734
  return {
11716
11735
  classHash: STARKNET_MEDIAWALLET_CLASS_HASH,
@@ -11781,6 +11800,14 @@ async function getGuardians(provider, address) {
11781
11800
  });
11782
11801
  return decodeGuardiansInfo(res);
11783
11802
  }
11803
+ async function getOwners(provider, address) {
11804
+ const res = await provider.callContract({
11805
+ contractAddress: norm(address),
11806
+ entrypoint: "get_owners_info",
11807
+ calldata: []
11808
+ });
11809
+ return decodeGuardiansInfo(res);
11810
+ }
11784
11811
  async function getEscape(provider, address) {
11785
11812
  const res = await provider.callContract({
11786
11813
  contractAddress: norm(address),
@@ -11886,6 +11913,7 @@ exports.adminRequestDigest = adminRequestDigest;
11886
11913
  exports.assertTransactionSucceeded = assertTransactionSucceeded;
11887
11914
  exports.build1155CancellationTypedData = build1155CancellationTypedData;
11888
11915
  exports.build1155OrderTypedData = build1155OrderTypedData;
11916
+ exports.buildAddOwnerCall = buildAddOwnerCall;
11889
11917
  exports.buildAdminSessionTypedData = buildAdminSessionTypedData;
11890
11918
  exports.buildCancelEscapeCall = buildCancelEscapeCall;
11891
11919
  exports.buildCancellationTypedData = buildCancellationTypedData;
@@ -11896,6 +11924,8 @@ exports.buildDeployAccountParams = buildDeployAccountParams;
11896
11924
  exports.buildFeeCall = buildFeeCall;
11897
11925
  exports.buildLaunchOnEkuboCalls = buildLaunchOnEkuboCalls;
11898
11926
  exports.buildOrderTypedData = buildOrderTypedData;
11927
+ exports.buildRemoveOwnerByGuidCall = buildRemoveOwnerByGuidCall;
11928
+ exports.buildRemoveOwnerCall = buildRemoveOwnerCall;
11899
11929
  exports.buildSetFirstGuardianCall = buildSetFirstGuardianCall;
11900
11930
  exports.buildTriggerEscapeOwnerCall = buildTriggerEscapeOwnerCall;
11901
11931
  exports.buybackQuoteRaw = buybackQuoteRaw;
@@ -11923,6 +11953,7 @@ exports.getEscapeSecurityPeriod = getEscapeSecurityPeriod;
11923
11953
  exports.getGuardians = getGuardians;
11924
11954
  exports.getOrderDetails = getOrderDetails;
11925
11955
  exports.getOrderDetails1155 = getOrderDetails1155;
11956
+ exports.getOwners = getOwners;
11926
11957
  exports.getSiwsStorageKey = getSiwsStorageKey;
11927
11958
  exports.getStoredSiwsToken = getStoredSiwsToken;
11928
11959
  exports.isSiwsTokenValid = isSiwsTokenValid;