@medialane/sdk 0.85.3 → 0.85.5

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 = {}) {
@@ -381,12 +381,13 @@ var ApiClient = class {
381
381
  );
382
382
  }
383
383
  // ─── Collections ───────────────────────────────────────────────────────────
384
- getCollections(page = 1, limit = 20, isKnown, sort, service, chain) {
384
+ getCollections(page = 1, limit = 20, isKnown, sort, service, chain, standard) {
385
385
  const params = new URLSearchParams({ page: String(page), limit: String(limit) });
386
386
  if (isKnown !== void 0) params.set("isKnown", String(isKnown));
387
387
  if (sort) params.set("sort", sort);
388
388
  if (service) params.set("service", service);
389
389
  if (chain) params.set("chain", chain);
390
+ if (standard) params.set("standard", standard);
390
391
  return this.get(`/v1/collections?${params}`);
391
392
  }
392
393
  getCollectionsByOwner(owner, page = 1, limit = 50) {
@@ -405,6 +406,7 @@ var ApiClient = class {
405
406
  getActivities(query = {}) {
406
407
  const params = new URLSearchParams();
407
408
  if (query.type) params.set("type", query.type);
409
+ if (query.contract) params.set("contract", query.contract);
408
410
  if (query.page !== void 0) params.set("page", String(query.page));
409
411
  if (query.limit !== void 0) params.set("limit", String(query.limit));
410
412
  if (query.chain) params.set("chain", query.chain);
@@ -503,11 +505,11 @@ var ApiClient = class {
503
505
  }
504
506
  /**
505
507
  * 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.
508
+ * to a buyer's active bid. siwsToken is optional — the endpoint authenticates
509
+ * via the tenant API key; pass a SIWS token only if your backend requires it.
508
510
  */
509
- createCounterOfferIntent(params, clerkToken) {
510
- const extraHeaders = clerkToken ? { "Authorization": `Bearer ${clerkToken}` } : {};
511
+ createCounterOfferIntent(params, siwsToken) {
512
+ const extraHeaders = siwsToken ? { "Authorization": `Bearer ${siwsToken}` } : {};
511
513
  return this.request("/v1/intents/counter-offer", {
512
514
  method: "POST",
513
515
  body: JSON.stringify(params),
@@ -575,13 +577,13 @@ var ApiClient = class {
575
577
  // ─── Collection Claims ──────────────────────────────────────────────────────
576
578
  /**
577
579
  * Path 1: On-chain auto claim. Sends both x-api-key (tenant auth) and
578
- * Authorization: Bearer (Clerk JWT) simultaneously.
580
+ * Authorization: Bearer (SIWS token) simultaneously.
579
581
  */
580
- async claimCollection(contractAddress, walletAddress, clerkToken) {
582
+ async claimCollection(contractAddress, walletAddress, siwsToken) {
581
583
  return this.request("/v1/collections/claim", {
582
584
  method: "POST",
583
585
  body: JSON.stringify({ contractAddress, walletAddress }),
584
- headers: this.bearer(clerkToken)
586
+ headers: this.bearer(siwsToken)
585
587
  });
586
588
  }
587
589
  /**
@@ -609,12 +611,12 @@ var ApiClient = class {
609
611
  );
610
612
  }
611
613
  /**
612
- * Update collection profile. Requires Clerk JWT for ownership check.
614
+ * Update collection profile. Requires SIWS token for ownership check.
613
615
  */
614
- updateCollectionProfile(contractAddress, data, clerkToken) {
616
+ updateCollectionProfile(contractAddress, data, siwsToken) {
615
617
  return this.request(
616
618
  `/v1/collections/${this.addr(contractAddress)}/profile`,
617
- { method: "PATCH", body: JSON.stringify(data), headers: this.bearer(clerkToken) }
619
+ { method: "PATCH", body: JSON.stringify(data), headers: this.bearer(siwsToken) }
618
620
  );
619
621
  }
620
622
  /** No signature required — wallet activity is public on-chain data, read like any other /v1 GET. */
@@ -623,10 +625,10 @@ var ApiClient = class {
623
625
  `/v1/wallet-activity?address=${this.addr(address)}&chain=${chain}`
624
626
  );
625
627
  }
626
- getGatedContent(contractAddress, clerkToken) {
628
+ getGatedContent(contractAddress, siwsToken) {
627
629
  return this.request(
628
630
  `/v1/collections/${this.addr(contractAddress)}/gated-content`,
629
- { method: "GET", headers: this.bearer(clerkToken) },
631
+ { method: "GET", headers: this.bearer(siwsToken) },
630
632
  { allow404: true, allow403: true }
631
633
  );
632
634
  }
@@ -656,12 +658,12 @@ var ApiClient = class {
656
658
  );
657
659
  }
658
660
  /**
659
- * Update creator profile. Requires Clerk JWT; wallet must match authenticated user.
661
+ * Update creator profile. Requires SIWS token; wallet must match authenticated user.
660
662
  */
661
- updateCreatorProfile(walletAddress, data, clerkToken) {
663
+ updateCreatorProfile(walletAddress, data, siwsToken) {
662
664
  return this.request(
663
665
  `/v1/creators/${this.addr(walletAddress)}/profile`,
664
- { method: "PATCH", body: JSON.stringify(data), headers: this.bearer(clerkToken) }
666
+ { method: "PATCH", body: JSON.stringify(data), headers: this.bearer(siwsToken) }
665
667
  );
666
668
  }
667
669
  // ─── Collection Slug Claims ───────────────────────────────────────────────────
@@ -671,19 +673,19 @@ var ApiClient = class {
671
673
  `/v1/collection-slug-claims/check/${encodeURIComponent(slug.toLowerCase().trim())}`
672
674
  );
673
675
  }
674
- /** Submit a slug claim for a collection. Requires Clerk JWT — caller must be the collection owner. */
675
- submitCollectionSlugClaim(contractAddress, slug, clerkToken, notifyEmail) {
676
+ /** Submit a slug claim for a collection. Requires SIWS token — caller must be the collection owner. */
677
+ submitCollectionSlugClaim(contractAddress, slug, siwsToken, notifyEmail) {
676
678
  return this.request("/v1/collection-slug-claims", {
677
679
  method: "POST",
678
680
  body: JSON.stringify({ contractAddress, slug, notifyEmail }),
679
- headers: this.bearer(clerkToken)
681
+ headers: this.bearer(siwsToken)
680
682
  });
681
683
  }
682
- /** Returns all slug claims submitted by the authenticated wallet. Requires Clerk JWT. */
683
- getMyCollectionSlugClaims(clerkToken) {
684
+ /** Returns all slug claims submitted by the authenticated wallet. Requires SIWS token. */
685
+ getMyCollectionSlugClaims(siwsToken) {
684
686
  return this.request("/v1/collection-slug-claims/me", {
685
687
  method: "GET",
686
- headers: this.bearer(clerkToken)
688
+ headers: this.bearer(siwsToken)
687
689
  });
688
690
  }
689
691
  /** Resolve a collection slug to a full collection. Returns null if not found. */
@@ -696,19 +698,14 @@ var ApiClient = class {
696
698
  }
697
699
  // ─── User Wallet ─────────────────────────────────────────────────────────────
698
700
  /**
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).
701
+ * Frictionless wallet registration. Tenant API key only (no SIWS token required).
705
702
  * Idempotent — backend's ensureAccountForWallet upserts and upgrades existing
706
703
  * UNKNOWN walletType rows when a more specific value is supplied.
707
704
  */
708
705
  async registerUser(params) {
709
706
  return this.post("/v1/users/register", params);
710
707
  }
711
- async upsertMyWallet(clerkToken, options = {}) {
708
+ async upsertMyWallet(siwsToken, options = {}) {
712
709
  const body = {
713
710
  walletType: options.walletType ?? "UNKNOWN",
714
711
  appSource: options.appSource ?? "MEDIALANE_SDK"
@@ -720,7 +717,7 @@ var ApiClient = class {
720
717
  return this.request("/v1/users/me", {
721
718
  method: "POST",
722
719
  body: JSON.stringify(body),
723
- headers: this.bearer(clerkToken)
720
+ headers: this.bearer(siwsToken)
724
721
  });
725
722
  }
726
723
  /** 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 +730,12 @@ var ApiClient = class {
733
730
  /**
734
731
  * Get the authenticated user's stored wallet address from the backend DB.
735
732
  * Returns null if the user has not completed onboarding yet.
736
- * Requires Clerk JWT; no tenant API key needed.
733
+ * Requires SIWS token; no tenant API key needed.
737
734
  */
738
- getMyWallet(clerkToken) {
735
+ getMyWallet(siwsToken) {
739
736
  return this.request(
740
737
  "/v1/users/me",
741
- { method: "GET", headers: this.bearer(clerkToken) },
738
+ { method: "GET", headers: this.bearer(siwsToken) },
742
739
  { allow404: true }
743
740
  );
744
741
  }
@@ -756,87 +753,87 @@ var ApiClient = class {
756
753
  );
757
754
  }
758
755
  /**
759
- * Submit a custom remix offer for a token. Requires Clerk JWT.
756
+ * Submit a custom remix offer for a token. Requires SIWS token.
760
757
  */
761
- submitRemixOffer(params, clerkToken) {
758
+ submitRemixOffer(params, siwsToken) {
762
759
  return this.request("/v1/remix-offers", {
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
- * Submit an auto remix offer for a token with an open license. Requires Clerk JWT.
766
+ * Submit an auto remix offer for a token with an open license. Requires SIWS token.
770
767
  */
771
- submitAutoRemixOffer(params, clerkToken) {
768
+ submitAutoRemixOffer(params, siwsToken) {
772
769
  return this.request("/v1/remix-offers/auto", {
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
- * Record a self-remix (owner remixing their own token). Requires Clerk JWT.
776
+ * Record a self-remix (owner remixing their own token). Requires SIWS token.
780
777
  */
781
- confirmSelfRemix(params, clerkToken) {
778
+ confirmSelfRemix(params, siwsToken) {
782
779
  return this.request("/v1/remix-offers/self/confirm", {
783
780
  method: "POST",
784
781
  body: JSON.stringify(params),
785
- headers: { "Authorization": `Bearer ${clerkToken}` }
782
+ headers: { "Authorization": `Bearer ${siwsToken}` }
786
783
  });
787
784
  }
788
785
  /**
789
- * List remix offers by role. Requires Clerk JWT.
786
+ * List remix offers by role. Requires SIWS token.
790
787
  * role="creator" — offers where you are the original creator.
791
788
  * role="requester" — offers you made.
792
789
  */
793
- getRemixOffers(query, clerkToken) {
790
+ getRemixOffers(query, siwsToken) {
794
791
  const params = new URLSearchParams({ role: query.role });
795
792
  if (query.page !== void 0) params.set("page", String(query.page));
796
793
  if (query.limit !== void 0) params.set("limit", String(query.limit));
797
794
  return this.request(`/v1/remix-offers?${params}`, {
798
795
  method: "GET",
799
- headers: this.bearer(clerkToken)
796
+ headers: this.bearer(siwsToken)
800
797
  });
801
798
  }
802
799
  /**
803
- * Get a single remix offer. Clerk JWT optional (price/currency hidden for non-participants).
800
+ * Get a single remix offer. SIWS token optional (price/currency hidden for non-participants).
804
801
  */
805
- getRemixOffer(id, clerkToken) {
802
+ getRemixOffer(id, siwsToken) {
806
803
  return this.request(`/v1/remix-offers/${id}`, {
807
804
  method: "GET",
808
- headers: clerkToken ? this.bearer(clerkToken) : void 0
805
+ headers: siwsToken ? this.bearer(siwsToken) : void 0
809
806
  });
810
807
  }
811
808
  /**
812
- * Creator approves a remix offer (authorises the requester to mint). Requires Clerk JWT.
809
+ * Creator approves a remix offer (authorises the requester to mint). Requires SIWS token.
813
810
  */
814
- confirmRemixOffer(id, params, clerkToken) {
811
+ confirmRemixOffer(id, params, siwsToken) {
815
812
  return this.request(`/v1/remix-offers/${id}/confirm`, {
816
813
  method: "POST",
817
814
  body: JSON.stringify(params),
818
- headers: { "Authorization": `Bearer ${clerkToken}` }
815
+ headers: { "Authorization": `Bearer ${siwsToken}` }
819
816
  });
820
817
  }
821
818
  /**
822
- * Creator rejects a remix offer. Requires Clerk JWT.
819
+ * Creator rejects a remix offer. Requires SIWS token.
823
820
  */
824
- rejectRemixOffer(id, clerkToken) {
821
+ rejectRemixOffer(id, siwsToken) {
825
822
  return this.request(`/v1/remix-offers/${id}/reject`, {
826
823
  method: "POST",
827
824
  body: JSON.stringify({}),
828
- headers: { "Authorization": `Bearer ${clerkToken}` }
825
+ headers: { "Authorization": `Bearer ${siwsToken}` }
829
826
  });
830
827
  }
831
828
  /**
832
829
  * Requester extends the expiry of a pending remix offer by 1–30 days.
833
- * Requires Clerk JWT.
830
+ * Requires SIWS token.
834
831
  */
835
- extendRemixOffer(id, days, clerkToken) {
832
+ extendRemixOffer(id, days, siwsToken) {
836
833
  return this.request(`/v1/remix-offers/${id}/extend`, {
837
834
  method: "POST",
838
835
  body: JSON.stringify({ days }),
839
- headers: { "Authorization": `Bearer ${clerkToken}` }
836
+ headers: { "Authorization": `Bearer ${siwsToken}` }
840
837
  });
841
838
  }
842
839
  // ─── POP Protocol ──────────────────────────────────────────────────────────
@@ -874,7 +871,7 @@ var ApiClient = class {
874
871
  /**
875
872
  * Creator-authed coin profile edit (image/description). Backend authorizes
876
873
  * via `coin.creator` (trustless — from the factory event), not a body param;
877
- * `siwsToken` is the caller's SIWS/Clerk bearer token for `identityAuth`.
874
+ * `siwsToken` is the caller's SIWS bearer token for `identityAuth`.
878
875
  */
879
876
  updateCoinProfile(contract, data, siwsToken) {
880
877
  return this.request(`/v1/coins/${this.addr(contract)}`, {