@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.
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"
@@ -716,10 +712,11 @@ var ApiClient = class {
716
712
  if (options.chain) body.chain = options.chain;
717
713
  if (options.emailVerificationToken) body.emailVerificationToken = options.emailVerificationToken;
718
714
  if (options.email) body.email = options.email;
715
+ if (options.accountToken) body.accountToken = options.accountToken;
719
716
  return this.request("/v1/users/me", {
720
717
  method: "POST",
721
718
  body: JSON.stringify(body),
722
- headers: this.bearer(clerkToken)
719
+ headers: this.bearer(siwsToken)
723
720
  });
724
721
  }
725
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. */
@@ -732,12 +729,12 @@ var ApiClient = class {
732
729
  /**
733
730
  * Get the authenticated user's stored wallet address from the backend DB.
734
731
  * Returns null if the user has not completed onboarding yet.
735
- * Requires Clerk JWT; no tenant API key needed.
732
+ * Requires SIWS token; no tenant API key needed.
736
733
  */
737
- getMyWallet(clerkToken) {
734
+ getMyWallet(siwsToken) {
738
735
  return this.request(
739
736
  "/v1/users/me",
740
- { method: "GET", headers: this.bearer(clerkToken) },
737
+ { method: "GET", headers: this.bearer(siwsToken) },
741
738
  { allow404: true }
742
739
  );
743
740
  }
@@ -755,87 +752,87 @@ var ApiClient = class {
755
752
  );
756
753
  }
757
754
  /**
758
- * Submit a custom remix offer for a token. Requires Clerk JWT.
755
+ * Submit a custom remix offer for a token. Requires SIWS token.
759
756
  */
760
- submitRemixOffer(params, clerkToken) {
757
+ submitRemixOffer(params, siwsToken) {
761
758
  return this.request("/v1/remix-offers", {
762
759
  method: "POST",
763
760
  body: JSON.stringify(params),
764
- headers: { "Authorization": `Bearer ${clerkToken}` }
761
+ headers: { "Authorization": `Bearer ${siwsToken}` }
765
762
  });
766
763
  }
767
764
  /**
768
- * 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.
769
766
  */
770
- submitAutoRemixOffer(params, clerkToken) {
767
+ submitAutoRemixOffer(params, siwsToken) {
771
768
  return this.request("/v1/remix-offers/auto", {
772
769
  method: "POST",
773
770
  body: JSON.stringify(params),
774
- headers: { "Authorization": `Bearer ${clerkToken}` }
771
+ headers: { "Authorization": `Bearer ${siwsToken}` }
775
772
  });
776
773
  }
777
774
  /**
778
- * 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.
779
776
  */
780
- confirmSelfRemix(params, clerkToken) {
777
+ confirmSelfRemix(params, siwsToken) {
781
778
  return this.request("/v1/remix-offers/self/confirm", {
782
779
  method: "POST",
783
780
  body: JSON.stringify(params),
784
- headers: { "Authorization": `Bearer ${clerkToken}` }
781
+ headers: { "Authorization": `Bearer ${siwsToken}` }
785
782
  });
786
783
  }
787
784
  /**
788
- * List remix offers by role. Requires Clerk JWT.
785
+ * List remix offers by role. Requires SIWS token.
789
786
  * role="creator" — offers where you are the original creator.
790
787
  * role="requester" — offers you made.
791
788
  */
792
- getRemixOffers(query, clerkToken) {
789
+ getRemixOffers(query, siwsToken) {
793
790
  const params = new URLSearchParams({ role: query.role });
794
791
  if (query.page !== void 0) params.set("page", String(query.page));
795
792
  if (query.limit !== void 0) params.set("limit", String(query.limit));
796
793
  return this.request(`/v1/remix-offers?${params}`, {
797
794
  method: "GET",
798
- headers: this.bearer(clerkToken)
795
+ headers: this.bearer(siwsToken)
799
796
  });
800
797
  }
801
798
  /**
802
- * 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).
803
800
  */
804
- getRemixOffer(id, clerkToken) {
801
+ getRemixOffer(id, siwsToken) {
805
802
  return this.request(`/v1/remix-offers/${id}`, {
806
803
  method: "GET",
807
- headers: clerkToken ? this.bearer(clerkToken) : void 0
804
+ headers: siwsToken ? this.bearer(siwsToken) : void 0
808
805
  });
809
806
  }
810
807
  /**
811
- * 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.
812
809
  */
813
- confirmRemixOffer(id, params, clerkToken) {
810
+ confirmRemixOffer(id, params, siwsToken) {
814
811
  return this.request(`/v1/remix-offers/${id}/confirm`, {
815
812
  method: "POST",
816
813
  body: JSON.stringify(params),
817
- headers: { "Authorization": `Bearer ${clerkToken}` }
814
+ headers: { "Authorization": `Bearer ${siwsToken}` }
818
815
  });
819
816
  }
820
817
  /**
821
- * Creator rejects a remix offer. Requires Clerk JWT.
818
+ * Creator rejects a remix offer. Requires SIWS token.
822
819
  */
823
- rejectRemixOffer(id, clerkToken) {
820
+ rejectRemixOffer(id, siwsToken) {
824
821
  return this.request(`/v1/remix-offers/${id}/reject`, {
825
822
  method: "POST",
826
823
  body: JSON.stringify({}),
827
- headers: { "Authorization": `Bearer ${clerkToken}` }
824
+ headers: { "Authorization": `Bearer ${siwsToken}` }
828
825
  });
829
826
  }
830
827
  /**
831
828
  * Requester extends the expiry of a pending remix offer by 1–30 days.
832
- * Requires Clerk JWT.
829
+ * Requires SIWS token.
833
830
  */
834
- extendRemixOffer(id, days, clerkToken) {
831
+ extendRemixOffer(id, days, siwsToken) {
835
832
  return this.request(`/v1/remix-offers/${id}/extend`, {
836
833
  method: "POST",
837
834
  body: JSON.stringify({ days }),
838
- headers: { "Authorization": `Bearer ${clerkToken}` }
835
+ headers: { "Authorization": `Bearer ${siwsToken}` }
839
836
  });
840
837
  }
841
838
  // ─── POP Protocol ──────────────────────────────────────────────────────────
@@ -873,7 +870,7 @@ var ApiClient = class {
873
870
  /**
874
871
  * Creator-authed coin profile edit (image/description). Backend authorizes
875
872
  * via `coin.creator` (trustless — from the factory event), not a body param;
876
- * `siwsToken` is the caller's SIWS/Clerk bearer token for `identityAuth`.
873
+ * `siwsToken` is the caller's SIWS bearer token for `identityAuth`.
877
874
  */
878
875
  updateCoinProfile(contract, data, siwsToken) {
879
876
  return this.request(`/v1/coins/${this.addr(contract)}`, {