@medialane/sdk 0.85.6 → 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.
@@ -1125,6 +1125,10 @@ declare class ApiClient {
1125
1125
  }): Promise<ApiUserWallet>;
1126
1126
  checkEmailExists(email: string): Promise<boolean>;
1127
1127
  getMyWallet(siwsToken: string): Promise<ApiUserWallet | null>;
1128
+ changeMyEmail(email: string, siwsToken: string): Promise<{
1129
+ email: string;
1130
+ emailVerified: boolean;
1131
+ }>;
1128
1132
  getTokenRemixes(contract: string, tokenId: string, opts?: {
1129
1133
  page?: number;
1130
1134
  limit?: number;
@@ -1125,6 +1125,10 @@ declare class ApiClient {
1125
1125
  }): Promise<ApiUserWallet>;
1126
1126
  checkEmailExists(email: string): Promise<boolean>;
1127
1127
  getMyWallet(siwsToken: string): Promise<ApiUserWallet | null>;
1128
+ changeMyEmail(email: string, siwsToken: string): Promise<{
1129
+ email: string;
1130
+ emailVerified: boolean;
1131
+ }>;
1128
1132
  getTokenRemixes(contract: string, tokenId: string, opts?: {
1129
1133
  page?: number;
1130
1134
  limit?: number;
@@ -658,6 +658,13 @@ var ApiClient = class {
658
658
  { allow404: true }
659
659
  );
660
660
  }
661
+ changeMyEmail(email, siwsToken) {
662
+ return this.request("/v1/users/me/email", {
663
+ method: "POST",
664
+ headers: this.bearer(siwsToken),
665
+ body: JSON.stringify({ email })
666
+ });
667
+ }
661
668
  getTokenRemixes(contract, tokenId, opts = {}) {
662
669
  const params = new URLSearchParams();
663
670
  if (opts.page !== void 0) params.set("page", String(opts.page));
@@ -11588,6 +11595,84 @@ function buildDeployAccountParams(ownerPubkey, salt = 0) {
11588
11595
  contractAddress: computeAccountAddress(ownerPubkey, salt)
11589
11596
  };
11590
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
+ }
11591
11676
 
11592
11677
  exports.ADMIN_HEADERS = ADMIN_HEADERS;
11593
11678
  exports.ADMIN_SCOPE = ADMIN_SCOPE;
@@ -11626,18 +11711,24 @@ exports.adminRequestDigest = adminRequestDigest;
11626
11711
  exports.build1155CancellationTypedData = build1155CancellationTypedData;
11627
11712
  exports.build1155OrderTypedData = build1155OrderTypedData;
11628
11713
  exports.buildAdminSessionTypedData = buildAdminSessionTypedData;
11714
+ exports.buildCancelEscapeCall = buildCancelEscapeCall;
11629
11715
  exports.buildCancellationTypedData = buildCancellationTypedData;
11630
11716
  exports.buildChangeOwnersCall = buildChangeOwnersCall;
11717
+ exports.buildCompleteEscapeOwnerCall = buildCompleteEscapeOwnerCall;
11631
11718
  exports.buildCreateCreatorCoinCall = buildCreateCreatorCoinCall;
11632
11719
  exports.buildDeployAccountParams = buildDeployAccountParams;
11633
11720
  exports.buildFeeCall = buildFeeCall;
11634
11721
  exports.buildLaunchOnEkuboCalls = buildLaunchOnEkuboCalls;
11635
11722
  exports.buildOrderTypedData = buildOrderTypedData;
11723
+ exports.buildSetFirstGuardianCall = buildSetFirstGuardianCall;
11724
+ exports.buildTriggerEscapeOwnerCall = buildTriggerEscapeOwnerCall;
11636
11725
  exports.buybackQuoteRaw = buybackQuoteRaw;
11637
11726
  exports.coinToRaw = toRaw;
11638
11727
  exports.computeAccountAddress = computeAccountAddress;
11639
11728
  exports.computeOwnerGuid = computeOwnerGuid;
11640
11729
  exports.createAdminSessionGrant = createAdminSessionGrant;
11730
+ exports.decodeEscapeAndStatus = decodeEscapeAndStatus;
11731
+ exports.decodeGuardiansInfo = decodeGuardiansInfo;
11641
11732
  exports.deriveOwnerKeyPair = deriveOwnerKeyPair;
11642
11733
  exports.encodeAdminHeaders = encodeAdminHeaders;
11643
11734
  exports.encodeByteArray = encodeByteArray;
@@ -11645,6 +11736,9 @@ exports.fdvHuman = fdvHuman;
11645
11736
  exports.getCounter = getCounter;
11646
11737
  exports.getCounter1155 = getCounter1155;
11647
11738
  exports.getCreatorCoinPrice = getCreatorCoinPrice;
11739
+ exports.getEscape = getEscape;
11740
+ exports.getEscapeSecurityPeriod = getEscapeSecurityPeriod;
11741
+ exports.getGuardians = getGuardians;
11648
11742
  exports.getOrderDetails = getOrderDetails;
11649
11743
  exports.getOrderDetails1155 = getOrderDetails1155;
11650
11744
  exports.getSiwsStorageKey = getSiwsStorageKey;