@medialane/sdk 0.85.2 → 0.85.4

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.
@@ -324,9 +324,9 @@ var ApiClient = class {
324
324
  del(path) {
325
325
  return this.request(path, { method: "DELETE" });
326
326
  }
327
- /** Bearer header for Clerk-JWT-authenticated routes. */
328
- bearer(clerkToken) {
329
- return { Authorization: `Bearer ${clerkToken}` };
327
+ /** Bearer header for SIWS-token-authenticated routes. */
328
+ bearer(siwsToken) {
329
+ return { Authorization: `Bearer ${siwsToken}` };
330
330
  }
331
331
  // ─── Orders ────────────────────────────────────────────────────────────────
332
332
  getOrders(query = {}) {
@@ -396,6 +396,7 @@ var ApiClient = class {
396
396
  getActivities(query = {}) {
397
397
  const params = new URLSearchParams();
398
398
  if (query.type) params.set("type", query.type);
399
+ if (query.contract) params.set("contract", query.contract);
399
400
  if (query.page !== void 0) params.set("page", String(query.page));
400
401
  if (query.limit !== void 0) params.set("limit", String(query.limit));
401
402
  if (query.chain) params.set("chain", query.chain);
@@ -494,11 +495,11 @@ var ApiClient = class {
494
495
  }
495
496
  /**
496
497
  * Create a counter-offer intent. The seller proposes a new price in response
497
- * to a buyer's active bid. clerkToken is optional — the endpoint authenticates
498
- * via the tenant API key; pass a Clerk JWT only if your backend requires it.
498
+ * to a buyer's active bid. siwsToken is optional — the endpoint authenticates
499
+ * via the tenant API key; pass a SIWS token only if your backend requires it.
499
500
  */
500
- createCounterOfferIntent(params, clerkToken) {
501
- const extraHeaders = clerkToken ? { "Authorization": `Bearer ${clerkToken}` } : {};
501
+ createCounterOfferIntent(params, siwsToken) {
502
+ const extraHeaders = siwsToken ? { "Authorization": `Bearer ${siwsToken}` } : {};
502
503
  return this.request("/v1/intents/counter-offer", {
503
504
  method: "POST",
504
505
  body: JSON.stringify(params),
@@ -566,13 +567,13 @@ var ApiClient = class {
566
567
  // ─── Collection Claims ──────────────────────────────────────────────────────
567
568
  /**
568
569
  * Path 1: On-chain auto claim. Sends both x-api-key (tenant auth) and
569
- * Authorization: Bearer (Clerk JWT) simultaneously.
570
+ * Authorization: Bearer (SIWS token) simultaneously.
570
571
  */
571
- async claimCollection(contractAddress, walletAddress, clerkToken) {
572
+ async claimCollection(contractAddress, walletAddress, siwsToken) {
572
573
  return this.request("/v1/collections/claim", {
573
574
  method: "POST",
574
575
  body: JSON.stringify({ contractAddress, walletAddress }),
575
- headers: this.bearer(clerkToken)
576
+ headers: this.bearer(siwsToken)
576
577
  });
577
578
  }
578
579
  /**
@@ -600,12 +601,12 @@ var ApiClient = class {
600
601
  );
601
602
  }
602
603
  /**
603
- * Update collection profile. Requires Clerk JWT for ownership check.
604
+ * Update collection profile. Requires SIWS token for ownership check.
604
605
  */
605
- updateCollectionProfile(contractAddress, data, clerkToken) {
606
+ updateCollectionProfile(contractAddress, data, siwsToken) {
606
607
  return this.request(
607
608
  `/v1/collections/${this.addr(contractAddress)}/profile`,
608
- { method: "PATCH", body: JSON.stringify(data), headers: this.bearer(clerkToken) }
609
+ { method: "PATCH", body: JSON.stringify(data), headers: this.bearer(siwsToken) }
609
610
  );
610
611
  }
611
612
  /** No signature required — wallet activity is public on-chain data, read like any other /v1 GET. */
@@ -614,10 +615,10 @@ var ApiClient = class {
614
615
  `/v1/wallet-activity?address=${this.addr(address)}&chain=${chain}`
615
616
  );
616
617
  }
617
- getGatedContent(contractAddress, clerkToken) {
618
+ getGatedContent(contractAddress, siwsToken) {
618
619
  return this.request(
619
620
  `/v1/collections/${this.addr(contractAddress)}/gated-content`,
620
- { method: "GET", headers: this.bearer(clerkToken) },
621
+ { method: "GET", headers: this.bearer(siwsToken) },
621
622
  { allow404: true, allow403: true }
622
623
  );
623
624
  }
@@ -647,12 +648,12 @@ var ApiClient = class {
647
648
  );
648
649
  }
649
650
  /**
650
- * Update creator profile. Requires Clerk JWT; wallet must match authenticated user.
651
+ * Update creator profile. Requires SIWS token; wallet must match authenticated user.
651
652
  */
652
- updateCreatorProfile(walletAddress, data, clerkToken) {
653
+ updateCreatorProfile(walletAddress, data, siwsToken) {
653
654
  return this.request(
654
655
  `/v1/creators/${this.addr(walletAddress)}/profile`,
655
- { method: "PATCH", body: JSON.stringify(data), headers: this.bearer(clerkToken) }
656
+ { method: "PATCH", body: JSON.stringify(data), headers: this.bearer(siwsToken) }
656
657
  );
657
658
  }
658
659
  // ─── Collection Slug Claims ───────────────────────────────────────────────────
@@ -662,19 +663,19 @@ var ApiClient = class {
662
663
  `/v1/collection-slug-claims/check/${encodeURIComponent(slug.toLowerCase().trim())}`
663
664
  );
664
665
  }
665
- /** Submit a slug claim for a collection. Requires Clerk JWT — caller must be the collection owner. */
666
- submitCollectionSlugClaim(contractAddress, slug, clerkToken, notifyEmail) {
666
+ /** Submit a slug claim for a collection. Requires SIWS token — caller must be the collection owner. */
667
+ submitCollectionSlugClaim(contractAddress, slug, siwsToken, notifyEmail) {
667
668
  return this.request("/v1/collection-slug-claims", {
668
669
  method: "POST",
669
670
  body: JSON.stringify({ contractAddress, slug, notifyEmail }),
670
- headers: this.bearer(clerkToken)
671
+ headers: this.bearer(siwsToken)
671
672
  });
672
673
  }
673
- /** Returns all slug claims submitted by the authenticated wallet. Requires Clerk JWT. */
674
- getMyCollectionSlugClaims(clerkToken) {
674
+ /** Returns all slug claims submitted by the authenticated wallet. Requires SIWS token. */
675
+ getMyCollectionSlugClaims(siwsToken) {
675
676
  return this.request("/v1/collection-slug-claims/me", {
676
677
  method: "GET",
677
- headers: this.bearer(clerkToken)
678
+ headers: this.bearer(siwsToken)
678
679
  });
679
680
  }
680
681
  /** Resolve a collection slug to a full collection. Returns null if not found. */
@@ -687,19 +688,14 @@ var ApiClient = class {
687
688
  }
688
689
  // ─── User Wallet ─────────────────────────────────────────────────────────────
689
690
  /**
690
- * Upsert the authenticated user's wallet address in the backend DB.
691
- * Call after onboarding when ChipiPay confirms the wallet address.
692
- * Requires Clerk JWT; no tenant API key needed.
693
- */
694
- /**
695
- * Frictionless wallet registration. Tenant API key only (no Clerk JWT required).
691
+ * Frictionless wallet registration. Tenant API key only (no SIWS token required).
696
692
  * Idempotent — backend's ensureAccountForWallet upserts and upgrades existing
697
693
  * UNKNOWN walletType rows when a more specific value is supplied.
698
694
  */
699
695
  async registerUser(params) {
700
696
  return this.post("/v1/users/register", params);
701
697
  }
702
- async upsertMyWallet(clerkToken, options = {}) {
698
+ async upsertMyWallet(siwsToken, options = {}) {
703
699
  const body = {
704
700
  walletType: options.walletType ?? "UNKNOWN",
705
701
  appSource: options.appSource ?? "MEDIALANE_SDK"
@@ -707,10 +703,11 @@ var ApiClient = class {
707
703
  if (options.chain) body.chain = options.chain;
708
704
  if (options.emailVerificationToken) body.emailVerificationToken = options.emailVerificationToken;
709
705
  if (options.email) body.email = options.email;
706
+ if (options.accountToken) body.accountToken = options.accountToken;
710
707
  return this.request("/v1/users/me", {
711
708
  method: "POST",
712
709
  body: JSON.stringify(body),
713
- headers: this.bearer(clerkToken)
710
+ headers: this.bearer(siwsToken)
714
711
  });
715
712
  }
716
713
  /** Whether an email already has an account attached — used by io's onboarding to branch into an "already exists" message instead of creating a duplicate account. */
@@ -723,12 +720,12 @@ var ApiClient = class {
723
720
  /**
724
721
  * Get the authenticated user's stored wallet address from the backend DB.
725
722
  * Returns null if the user has not completed onboarding yet.
726
- * Requires Clerk JWT; no tenant API key needed.
723
+ * Requires SIWS token; no tenant API key needed.
727
724
  */
728
- getMyWallet(clerkToken) {
725
+ getMyWallet(siwsToken) {
729
726
  return this.request(
730
727
  "/v1/users/me",
731
- { method: "GET", headers: this.bearer(clerkToken) },
728
+ { method: "GET", headers: this.bearer(siwsToken) },
732
729
  { allow404: true }
733
730
  );
734
731
  }
@@ -746,87 +743,87 @@ var ApiClient = class {
746
743
  );
747
744
  }
748
745
  /**
749
- * Submit a custom remix offer for a token. Requires Clerk JWT.
746
+ * Submit a custom remix offer for a token. Requires SIWS token.
750
747
  */
751
- submitRemixOffer(params, clerkToken) {
748
+ submitRemixOffer(params, siwsToken) {
752
749
  return this.request("/v1/remix-offers", {
753
750
  method: "POST",
754
751
  body: JSON.stringify(params),
755
- headers: { "Authorization": `Bearer ${clerkToken}` }
752
+ headers: { "Authorization": `Bearer ${siwsToken}` }
756
753
  });
757
754
  }
758
755
  /**
759
- * Submit an auto remix offer for a token with an open license. Requires Clerk JWT.
756
+ * Submit an auto remix offer for a token with an open license. Requires SIWS token.
760
757
  */
761
- submitAutoRemixOffer(params, clerkToken) {
758
+ submitAutoRemixOffer(params, siwsToken) {
762
759
  return this.request("/v1/remix-offers/auto", {
763
760
  method: "POST",
764
761
  body: JSON.stringify(params),
765
- headers: { "Authorization": `Bearer ${clerkToken}` }
762
+ headers: { "Authorization": `Bearer ${siwsToken}` }
766
763
  });
767
764
  }
768
765
  /**
769
- * Record a self-remix (owner remixing their own token). Requires Clerk JWT.
766
+ * Record a self-remix (owner remixing their own token). Requires SIWS token.
770
767
  */
771
- confirmSelfRemix(params, clerkToken) {
768
+ confirmSelfRemix(params, siwsToken) {
772
769
  return this.request("/v1/remix-offers/self/confirm", {
773
770
  method: "POST",
774
771
  body: JSON.stringify(params),
775
- headers: { "Authorization": `Bearer ${clerkToken}` }
772
+ headers: { "Authorization": `Bearer ${siwsToken}` }
776
773
  });
777
774
  }
778
775
  /**
779
- * List remix offers by role. Requires Clerk JWT.
776
+ * List remix offers by role. Requires SIWS token.
780
777
  * role="creator" — offers where you are the original creator.
781
778
  * role="requester" — offers you made.
782
779
  */
783
- getRemixOffers(query, clerkToken) {
780
+ getRemixOffers(query, siwsToken) {
784
781
  const params = new URLSearchParams({ role: query.role });
785
782
  if (query.page !== void 0) params.set("page", String(query.page));
786
783
  if (query.limit !== void 0) params.set("limit", String(query.limit));
787
784
  return this.request(`/v1/remix-offers?${params}`, {
788
785
  method: "GET",
789
- headers: this.bearer(clerkToken)
786
+ headers: this.bearer(siwsToken)
790
787
  });
791
788
  }
792
789
  /**
793
- * Get a single remix offer. Clerk JWT optional (price/currency hidden for non-participants).
790
+ * Get a single remix offer. SIWS token optional (price/currency hidden for non-participants).
794
791
  */
795
- getRemixOffer(id, clerkToken) {
792
+ getRemixOffer(id, siwsToken) {
796
793
  return this.request(`/v1/remix-offers/${id}`, {
797
794
  method: "GET",
798
- headers: clerkToken ? this.bearer(clerkToken) : void 0
795
+ headers: siwsToken ? this.bearer(siwsToken) : void 0
799
796
  });
800
797
  }
801
798
  /**
802
- * Creator approves a remix offer (authorises the requester to mint). Requires Clerk JWT.
799
+ * Creator approves a remix offer (authorises the requester to mint). Requires SIWS token.
803
800
  */
804
- confirmRemixOffer(id, params, clerkToken) {
801
+ confirmRemixOffer(id, params, siwsToken) {
805
802
  return this.request(`/v1/remix-offers/${id}/confirm`, {
806
803
  method: "POST",
807
804
  body: JSON.stringify(params),
808
- headers: { "Authorization": `Bearer ${clerkToken}` }
805
+ headers: { "Authorization": `Bearer ${siwsToken}` }
809
806
  });
810
807
  }
811
808
  /**
812
- * Creator rejects a remix offer. Requires Clerk JWT.
809
+ * Creator rejects a remix offer. Requires SIWS token.
813
810
  */
814
- rejectRemixOffer(id, clerkToken) {
811
+ rejectRemixOffer(id, siwsToken) {
815
812
  return this.request(`/v1/remix-offers/${id}/reject`, {
816
813
  method: "POST",
817
814
  body: JSON.stringify({}),
818
- headers: { "Authorization": `Bearer ${clerkToken}` }
815
+ headers: { "Authorization": `Bearer ${siwsToken}` }
819
816
  });
820
817
  }
821
818
  /**
822
819
  * Requester extends the expiry of a pending remix offer by 1–30 days.
823
- * Requires Clerk JWT.
820
+ * Requires SIWS token.
824
821
  */
825
- extendRemixOffer(id, days, clerkToken) {
822
+ extendRemixOffer(id, days, siwsToken) {
826
823
  return this.request(`/v1/remix-offers/${id}/extend`, {
827
824
  method: "POST",
828
825
  body: JSON.stringify({ days }),
829
- headers: { "Authorization": `Bearer ${clerkToken}` }
826
+ headers: { "Authorization": `Bearer ${siwsToken}` }
830
827
  });
831
828
  }
832
829
  // ─── POP Protocol ──────────────────────────────────────────────────────────
@@ -864,7 +861,7 @@ var ApiClient = class {
864
861
  /**
865
862
  * Creator-authed coin profile edit (image/description). Backend authorizes
866
863
  * via `coin.creator` (trustless — from the factory event), not a body param;
867
- * `siwsToken` is the caller's SIWS/Clerk bearer token for `identityAuth`.
864
+ * `siwsToken` is the caller's SIWS bearer token for `identityAuth`.
868
865
  */
869
866
  updateCoinProfile(contract, data, siwsToken) {
870
867
  return this.request(`/v1/coins/${this.addr(contract)}`, {