@medialane/sdk 0.85.3 → 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.
package/README.md CHANGED
@@ -210,7 +210,7 @@ const result = await client.marketplace1155.cancelOrder(account, {
210
210
  });
211
211
  ```
212
212
 
213
- ### SNIP-12 Typed Data Builders (ChipiPay / custom flows)
213
+ ### SNIP-12 Typed Data Builders (custodial-wallet / custom flows)
214
214
 
215
215
  Listing/offer and cancellation are signed; fulfilment is an **unsigned** call (the buyer is
216
216
  the fulfiller, since v0.26.0) — there is no fulfillment typed-data builder.
@@ -486,7 +486,7 @@ try {
486
486
 
487
487
  ## Advanced: SNIP-12 Typed Data Builders
488
488
 
489
- For integrations that handle signing externally (e.g. ChipiPay, Cartridge Controller):
489
+ For integrations that handle signing externally (e.g. a custodial wallet service, Cartridge Controller):
490
490
 
491
491
  ```typescript
492
492
  import {
@@ -562,7 +562,7 @@ Built with:
562
562
  - **`ApiCollectionProfile.gatedContentTitle: string | null`** — public title of gated content (shown to all users; URL is accessible to holders only via the backend gated-content endpoint)
563
563
 
564
564
  ### v0.5.5
565
- - **`extendRemixOffer(id, days, clerkToken)`** — requester extends expiry of a PENDING/AUTO_PENDING remix offer by 1–30 days (`POST /v1/remix-offers/:id/extend`)
565
+ - **`extendRemixOffer(id, days, siwsToken)`** — requester extends expiry of a PENDING/AUTO_PENDING remix offer by 1–30 days (`POST /v1/remix-offers/:id/extend`)
566
566
  - **`ApiRemixOfferPrice`** type — `{ raw, formatted, currency, decimals }` replaces flat `proposedPrice`/`proposedCurrency` fields on `ApiRemixOffer.price` (visible to participants only)
567
567
 
568
568
  ### v0.5.4
@@ -573,17 +573,17 @@ Built with:
573
573
  - **`ApiComment`** type — `{ id, author, content, txHash, blockNumber, blockTimestamp, isHidden, createdAt }`
574
574
 
575
575
  ### v0.5.0
576
- - **Counter-offer support** — `createCounterOfferIntent(params, clerkToken)`, `getCounterOffers(query)`, `ApiCounterOffersQuery`, `CreateCounterOfferIntentParams`
576
+ - **Counter-offer support** — `createCounterOfferIntent(params, siwsToken)`, `getCounterOffers(query)`, `ApiCounterOffersQuery`, `CreateCounterOfferIntentParams`
577
577
  - **`OrderStatus`** extended with `"COUNTER_OFFERED"`; **`IntentType`** with `"COUNTER_OFFER"`
578
578
  - **`ApiOrder`** extended: `parentOrderHash?: string | null`, `counterOfferMessage?: string | null`
579
579
  - **Remix licensing** — full set of remix offer methods and types:
580
- - `submitRemixOffer(params, clerkToken)` — custom offer
581
- - `submitAutoRemixOffer(params, clerkToken)` — auto offer for open-license tokens
582
- - `confirmSelfRemix(params, clerkToken)` — record owner self-remix
583
- - `getRemixOffers(query, clerkToken)` — list by role
584
- - `getRemixOffer(id, clerkToken?)` — single offer
585
- - `confirmRemixOffer(id, params, clerkToken)` — creator approves
586
- - `rejectRemixOffer(id, clerkToken)` — creator rejects
580
+ - `submitRemixOffer(params, siwsToken)` — custom offer
581
+ - `submitAutoRemixOffer(params, siwsToken)` — auto offer for open-license tokens
582
+ - `confirmSelfRemix(params, siwsToken)` — record owner self-remix
583
+ - `getRemixOffers(query, siwsToken)` — list by role
584
+ - `getRemixOffer(id, siwsToken?)` — single offer
585
+ - `confirmRemixOffer(id, params, siwsToken)` — creator approves
586
+ - `rejectRemixOffer(id, siwsToken)` — creator rejects
587
587
  - `getTokenRemixes(contract, tokenId, opts?)` — public remix list
588
588
  - **New types** — `RemixOfferStatus`, `ApiRemixOffer`, `ApiPublicRemix`, `OPEN_LICENSES`, `OpenLicense`, `CreateRemixOfferParams`, `AutoRemixOfferParams`, `ConfirmSelfRemixParams`, `ConfirmRemixOfferParams`, `ApiRemixOffersQuery`
589
589
 
@@ -594,7 +594,7 @@ Built with:
594
594
  - **`IPType`** union type exported — `"Audio" | "Art" | "Documents" | "NFT" | "Video" | "Photography" | "Patents" | "Posts" | "Publications" | "RWA" | "Software" | "Custom"`
595
595
 
596
596
  ### v0.4.6
597
- - **`ApiUserWallet`** type + `upsertMyWallet(clerkToken)` / `getMyWallet(clerkToken)` for ChipiPay wallet registration fallback (`POST/GET /v1/users/me`)
597
+ - **`ApiUserWallet`** type + `upsertMyWallet(siwsToken)` / `getMyWallet(siwsToken)` for wallet registration fallback (`POST/GET /v1/users/me`)
598
598
 
599
599
  ### v0.4.5
600
600
  - **`ApiSearchCreatorResult`** type + `ApiSearchResult.creators` — creator profiles now included in search results
@@ -613,9 +613,9 @@ Built with:
613
613
  - **USDC.e removed** — bridged USDC (`0x053c91...`) removed entirely; only Circle-native USDC remains, to avoid user confusion
614
614
 
615
615
  ### v0.4.1
616
- - **Collection claims** — `claimCollection(contractAddress, walletAddress, clerkToken)` for on-chain ownership verification; `requestCollectionClaim({ contractAddress, walletAddress?, email, notes? })` for manual review
617
- - **Collection profiles** — `getCollectionProfile(contractAddress)` and `updateCollectionProfile(contractAddress, data, clerkToken)` for enriched display metadata (displayName, description, image, bannerImage, social links)
618
- - **Creator profiles** — `getCreatorProfile(walletAddress)` and `updateCreatorProfile(walletAddress, data, clerkToken)` for creator display metadata
616
+ - **Collection claims** — `claimCollection(contractAddress, walletAddress, siwsToken)` for on-chain ownership verification; `requestCollectionClaim({ contractAddress, walletAddress?, email, notes? })` for manual review
617
+ - **Collection profiles** — `getCollectionProfile(contractAddress)` and `updateCollectionProfile(contractAddress, data, siwsToken)` for enriched display metadata (displayName, description, image, bannerImage, social links)
618
+ - **Creator profiles** — `getCreatorProfile(walletAddress)` and `updateCreatorProfile(walletAddress, data, siwsToken)` for creator display metadata
619
619
  - **New types** — `ApiCollectionClaim`, `ApiAdminCollectionClaim`, `ApiCollectionProfile`, `ApiCreatorProfile`
620
620
  - **`ApiCollection`** extended with `source` (`"MEDIALANE_REGISTRY" | "EXTERNAL" | "PARTNERSHIP" | "IP_TICKET" | "IP_CLUB" | "GAME"`) and `claimedBy: string | null`
621
621
  - `profile?: ApiCollectionProfile | null` optionally embedded on `ApiCollection` when `?include=profile`
package/dist/index.cjs CHANGED
@@ -333,9 +333,9 @@ var ApiClient = class {
333
333
  del(path) {
334
334
  return this.request(path, { method: "DELETE" });
335
335
  }
336
- /** Bearer header for Clerk-JWT-authenticated routes. */
337
- bearer(clerkToken) {
338
- return { Authorization: `Bearer ${clerkToken}` };
336
+ /** Bearer header for SIWS-token-authenticated routes. */
337
+ bearer(siwsToken) {
338
+ return { Authorization: `Bearer ${siwsToken}` };
339
339
  }
340
340
  // ─── Orders ────────────────────────────────────────────────────────────────
341
341
  getOrders(query = {}) {
@@ -405,6 +405,7 @@ var ApiClient = class {
405
405
  getActivities(query = {}) {
406
406
  const params = new URLSearchParams();
407
407
  if (query.type) params.set("type", query.type);
408
+ if (query.contract) params.set("contract", query.contract);
408
409
  if (query.page !== void 0) params.set("page", String(query.page));
409
410
  if (query.limit !== void 0) params.set("limit", String(query.limit));
410
411
  if (query.chain) params.set("chain", query.chain);
@@ -503,11 +504,11 @@ var ApiClient = class {
503
504
  }
504
505
  /**
505
506
  * Create a counter-offer intent. The seller proposes a new price in response
506
- * to a buyer's active bid. clerkToken is optional — the endpoint authenticates
507
- * via the tenant API key; pass a Clerk JWT only if your backend requires it.
507
+ * to a buyer's active bid. siwsToken is optional — the endpoint authenticates
508
+ * via the tenant API key; pass a SIWS token only if your backend requires it.
508
509
  */
509
- createCounterOfferIntent(params, clerkToken) {
510
- const extraHeaders = clerkToken ? { "Authorization": `Bearer ${clerkToken}` } : {};
510
+ createCounterOfferIntent(params, siwsToken) {
511
+ const extraHeaders = siwsToken ? { "Authorization": `Bearer ${siwsToken}` } : {};
511
512
  return this.request("/v1/intents/counter-offer", {
512
513
  method: "POST",
513
514
  body: JSON.stringify(params),
@@ -575,13 +576,13 @@ var ApiClient = class {
575
576
  // ─── Collection Claims ──────────────────────────────────────────────────────
576
577
  /**
577
578
  * Path 1: On-chain auto claim. Sends both x-api-key (tenant auth) and
578
- * Authorization: Bearer (Clerk JWT) simultaneously.
579
+ * Authorization: Bearer (SIWS token) simultaneously.
579
580
  */
580
- async claimCollection(contractAddress, walletAddress, clerkToken) {
581
+ async claimCollection(contractAddress, walletAddress, siwsToken) {
581
582
  return this.request("/v1/collections/claim", {
582
583
  method: "POST",
583
584
  body: JSON.stringify({ contractAddress, walletAddress }),
584
- headers: this.bearer(clerkToken)
585
+ headers: this.bearer(siwsToken)
585
586
  });
586
587
  }
587
588
  /**
@@ -609,12 +610,12 @@ var ApiClient = class {
609
610
  );
610
611
  }
611
612
  /**
612
- * Update collection profile. Requires Clerk JWT for ownership check.
613
+ * Update collection profile. Requires SIWS token for ownership check.
613
614
  */
614
- updateCollectionProfile(contractAddress, data, clerkToken) {
615
+ updateCollectionProfile(contractAddress, data, siwsToken) {
615
616
  return this.request(
616
617
  `/v1/collections/${this.addr(contractAddress)}/profile`,
617
- { method: "PATCH", body: JSON.stringify(data), headers: this.bearer(clerkToken) }
618
+ { method: "PATCH", body: JSON.stringify(data), headers: this.bearer(siwsToken) }
618
619
  );
619
620
  }
620
621
  /** No signature required — wallet activity is public on-chain data, read like any other /v1 GET. */
@@ -623,10 +624,10 @@ var ApiClient = class {
623
624
  `/v1/wallet-activity?address=${this.addr(address)}&chain=${chain}`
624
625
  );
625
626
  }
626
- getGatedContent(contractAddress, clerkToken) {
627
+ getGatedContent(contractAddress, siwsToken) {
627
628
  return this.request(
628
629
  `/v1/collections/${this.addr(contractAddress)}/gated-content`,
629
- { method: "GET", headers: this.bearer(clerkToken) },
630
+ { method: "GET", headers: this.bearer(siwsToken) },
630
631
  { allow404: true, allow403: true }
631
632
  );
632
633
  }
@@ -656,12 +657,12 @@ var ApiClient = class {
656
657
  );
657
658
  }
658
659
  /**
659
- * Update creator profile. Requires Clerk JWT; wallet must match authenticated user.
660
+ * Update creator profile. Requires SIWS token; wallet must match authenticated user.
660
661
  */
661
- updateCreatorProfile(walletAddress, data, clerkToken) {
662
+ updateCreatorProfile(walletAddress, data, siwsToken) {
662
663
  return this.request(
663
664
  `/v1/creators/${this.addr(walletAddress)}/profile`,
664
- { method: "PATCH", body: JSON.stringify(data), headers: this.bearer(clerkToken) }
665
+ { method: "PATCH", body: JSON.stringify(data), headers: this.bearer(siwsToken) }
665
666
  );
666
667
  }
667
668
  // ─── Collection Slug Claims ───────────────────────────────────────────────────
@@ -671,19 +672,19 @@ var ApiClient = class {
671
672
  `/v1/collection-slug-claims/check/${encodeURIComponent(slug.toLowerCase().trim())}`
672
673
  );
673
674
  }
674
- /** Submit a slug claim for a collection. Requires Clerk JWT — caller must be the collection owner. */
675
- submitCollectionSlugClaim(contractAddress, slug, clerkToken, notifyEmail) {
675
+ /** Submit a slug claim for a collection. Requires SIWS token — caller must be the collection owner. */
676
+ submitCollectionSlugClaim(contractAddress, slug, siwsToken, notifyEmail) {
676
677
  return this.request("/v1/collection-slug-claims", {
677
678
  method: "POST",
678
679
  body: JSON.stringify({ contractAddress, slug, notifyEmail }),
679
- headers: this.bearer(clerkToken)
680
+ headers: this.bearer(siwsToken)
680
681
  });
681
682
  }
682
- /** Returns all slug claims submitted by the authenticated wallet. Requires Clerk JWT. */
683
- getMyCollectionSlugClaims(clerkToken) {
683
+ /** Returns all slug claims submitted by the authenticated wallet. Requires SIWS token. */
684
+ getMyCollectionSlugClaims(siwsToken) {
684
685
  return this.request("/v1/collection-slug-claims/me", {
685
686
  method: "GET",
686
- headers: this.bearer(clerkToken)
687
+ headers: this.bearer(siwsToken)
687
688
  });
688
689
  }
689
690
  /** Resolve a collection slug to a full collection. Returns null if not found. */
@@ -696,19 +697,14 @@ var ApiClient = class {
696
697
  }
697
698
  // ─── User Wallet ─────────────────────────────────────────────────────────────
698
699
  /**
699
- * Upsert the authenticated user's wallet address in the backend DB.
700
- * Call after onboarding when ChipiPay confirms the wallet address.
701
- * Requires Clerk JWT; no tenant API key needed.
702
- */
703
- /**
704
- * Frictionless wallet registration. Tenant API key only (no Clerk JWT required).
700
+ * Frictionless wallet registration. Tenant API key only (no SIWS token required).
705
701
  * Idempotent — backend's ensureAccountForWallet upserts and upgrades existing
706
702
  * UNKNOWN walletType rows when a more specific value is supplied.
707
703
  */
708
704
  async registerUser(params) {
709
705
  return this.post("/v1/users/register", params);
710
706
  }
711
- async upsertMyWallet(clerkToken, options = {}) {
707
+ async upsertMyWallet(siwsToken, options = {}) {
712
708
  const body = {
713
709
  walletType: options.walletType ?? "UNKNOWN",
714
710
  appSource: options.appSource ?? "MEDIALANE_SDK"
@@ -720,7 +716,7 @@ var ApiClient = class {
720
716
  return this.request("/v1/users/me", {
721
717
  method: "POST",
722
718
  body: JSON.stringify(body),
723
- headers: this.bearer(clerkToken)
719
+ headers: this.bearer(siwsToken)
724
720
  });
725
721
  }
726
722
  /** 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. */
@@ -733,12 +729,12 @@ var ApiClient = class {
733
729
  /**
734
730
  * Get the authenticated user's stored wallet address from the backend DB.
735
731
  * Returns null if the user has not completed onboarding yet.
736
- * Requires Clerk JWT; no tenant API key needed.
732
+ * Requires SIWS token; no tenant API key needed.
737
733
  */
738
- getMyWallet(clerkToken) {
734
+ getMyWallet(siwsToken) {
739
735
  return this.request(
740
736
  "/v1/users/me",
741
- { method: "GET", headers: this.bearer(clerkToken) },
737
+ { method: "GET", headers: this.bearer(siwsToken) },
742
738
  { allow404: true }
743
739
  );
744
740
  }
@@ -756,87 +752,87 @@ var ApiClient = class {
756
752
  );
757
753
  }
758
754
  /**
759
- * Submit a custom remix offer for a token. Requires Clerk JWT.
755
+ * Submit a custom remix offer for a token. Requires SIWS token.
760
756
  */
761
- submitRemixOffer(params, clerkToken) {
757
+ submitRemixOffer(params, siwsToken) {
762
758
  return this.request("/v1/remix-offers", {
763
759
  method: "POST",
764
760
  body: JSON.stringify(params),
765
- headers: { "Authorization": `Bearer ${clerkToken}` }
761
+ headers: { "Authorization": `Bearer ${siwsToken}` }
766
762
  });
767
763
  }
768
764
  /**
769
- * Submit an auto remix offer for a token with an open license. Requires Clerk JWT.
765
+ * Submit an auto remix offer for a token with an open license. Requires SIWS token.
770
766
  */
771
- submitAutoRemixOffer(params, clerkToken) {
767
+ submitAutoRemixOffer(params, siwsToken) {
772
768
  return this.request("/v1/remix-offers/auto", {
773
769
  method: "POST",
774
770
  body: JSON.stringify(params),
775
- headers: { "Authorization": `Bearer ${clerkToken}` }
771
+ headers: { "Authorization": `Bearer ${siwsToken}` }
776
772
  });
777
773
  }
778
774
  /**
779
- * Record a self-remix (owner remixing their own token). Requires Clerk JWT.
775
+ * Record a self-remix (owner remixing their own token). Requires SIWS token.
780
776
  */
781
- confirmSelfRemix(params, clerkToken) {
777
+ confirmSelfRemix(params, siwsToken) {
782
778
  return this.request("/v1/remix-offers/self/confirm", {
783
779
  method: "POST",
784
780
  body: JSON.stringify(params),
785
- headers: { "Authorization": `Bearer ${clerkToken}` }
781
+ headers: { "Authorization": `Bearer ${siwsToken}` }
786
782
  });
787
783
  }
788
784
  /**
789
- * List remix offers by role. Requires Clerk JWT.
785
+ * List remix offers by role. Requires SIWS token.
790
786
  * role="creator" — offers where you are the original creator.
791
787
  * role="requester" — offers you made.
792
788
  */
793
- getRemixOffers(query, clerkToken) {
789
+ getRemixOffers(query, siwsToken) {
794
790
  const params = new URLSearchParams({ role: query.role });
795
791
  if (query.page !== void 0) params.set("page", String(query.page));
796
792
  if (query.limit !== void 0) params.set("limit", String(query.limit));
797
793
  return this.request(`/v1/remix-offers?${params}`, {
798
794
  method: "GET",
799
- headers: this.bearer(clerkToken)
795
+ headers: this.bearer(siwsToken)
800
796
  });
801
797
  }
802
798
  /**
803
- * Get a single remix offer. Clerk JWT optional (price/currency hidden for non-participants).
799
+ * Get a single remix offer. SIWS token optional (price/currency hidden for non-participants).
804
800
  */
805
- getRemixOffer(id, clerkToken) {
801
+ getRemixOffer(id, siwsToken) {
806
802
  return this.request(`/v1/remix-offers/${id}`, {
807
803
  method: "GET",
808
- headers: clerkToken ? this.bearer(clerkToken) : void 0
804
+ headers: siwsToken ? this.bearer(siwsToken) : void 0
809
805
  });
810
806
  }
811
807
  /**
812
- * Creator approves a remix offer (authorises the requester to mint). Requires Clerk JWT.
808
+ * Creator approves a remix offer (authorises the requester to mint). Requires SIWS token.
813
809
  */
814
- confirmRemixOffer(id, params, clerkToken) {
810
+ confirmRemixOffer(id, params, siwsToken) {
815
811
  return this.request(`/v1/remix-offers/${id}/confirm`, {
816
812
  method: "POST",
817
813
  body: JSON.stringify(params),
818
- headers: { "Authorization": `Bearer ${clerkToken}` }
814
+ headers: { "Authorization": `Bearer ${siwsToken}` }
819
815
  });
820
816
  }
821
817
  /**
822
- * Creator rejects a remix offer. Requires Clerk JWT.
818
+ * Creator rejects a remix offer. Requires SIWS token.
823
819
  */
824
- rejectRemixOffer(id, clerkToken) {
820
+ rejectRemixOffer(id, siwsToken) {
825
821
  return this.request(`/v1/remix-offers/${id}/reject`, {
826
822
  method: "POST",
827
823
  body: JSON.stringify({}),
828
- headers: { "Authorization": `Bearer ${clerkToken}` }
824
+ headers: { "Authorization": `Bearer ${siwsToken}` }
829
825
  });
830
826
  }
831
827
  /**
832
828
  * Requester extends the expiry of a pending remix offer by 1–30 days.
833
- * Requires Clerk JWT.
829
+ * Requires SIWS token.
834
830
  */
835
- extendRemixOffer(id, days, clerkToken) {
831
+ extendRemixOffer(id, days, siwsToken) {
836
832
  return this.request(`/v1/remix-offers/${id}/extend`, {
837
833
  method: "POST",
838
834
  body: JSON.stringify({ days }),
839
- headers: { "Authorization": `Bearer ${clerkToken}` }
835
+ headers: { "Authorization": `Bearer ${siwsToken}` }
840
836
  });
841
837
  }
842
838
  // ─── POP Protocol ──────────────────────────────────────────────────────────
@@ -874,7 +870,7 @@ var ApiClient = class {
874
870
  /**
875
871
  * Creator-authed coin profile edit (image/description). Backend authorizes
876
872
  * via `coin.creator` (trustless — from the factory event), not a body param;
877
- * `siwsToken` is the caller's SIWS/Clerk bearer token for `identityAuth`.
873
+ * `siwsToken` is the caller's SIWS bearer token for `identityAuth`.
878
874
  */
879
875
  updateCoinProfile(contract, data, siwsToken) {
880
876
  return this.request(`/v1/coins/${this.addr(contract)}`, {