@medialane/sdk 0.135.0 → 0.137.0

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.
@@ -731,12 +731,13 @@ var ApiClient = class {
731
731
  headers: this.bearer(siwsToken)
732
732
  });
733
733
  }
734
- getCollectionBySlug(slug) {
735
- return this.request(
734
+ async getCollectionBySlug(slug) {
735
+ const res = await this.request(
736
736
  `/v1/collections/by-slug/${encodeURIComponent(slug.toLowerCase().trim())}`,
737
737
  { method: "GET" },
738
738
  { allow404: true }
739
739
  );
740
+ return res?.data ?? null;
740
741
  }
741
742
  async registerUser(params) {
742
743
  return this.post("/v1/users/register", params);
@@ -823,6 +824,7 @@ var ApiClient = class {
823
824
  }
824
825
  getRemixOffers(query, siwsToken) {
825
826
  const params = new URLSearchParams({ role: query.role });
827
+ if (query.status) params.set("status", query.status);
826
828
  if (query.page !== void 0) params.set("page", String(query.page));
827
829
  if (query.limit !== void 0) params.set("limit", String(query.limit));
828
830
  return this.request(`/v1/remix-offers?${params}`, {
@@ -879,6 +881,7 @@ var ApiClient = class {
879
881
  if (opts.limit) params.set("limit", String(opts.limit));
880
882
  if (opts.service) params.set("service", opts.service);
881
883
  if (opts.sort) params.set("sort", opts.sort);
884
+ if (opts.creator) params.set("creator", this.addr(opts.creator));
882
885
  if (opts.chain) params.set("chain", opts.chain);
883
886
  const qs = params.toString();
884
887
  return this.get(`/v1/coins${qs ? `?${qs}` : ""}`);
@@ -989,12 +992,41 @@ var ApiClient = class {
989
992
  return res.claim;
990
993
  }
991
994
  async submitReport(report, siwsToken) {
995
+ const targetContract = report.targetContract ? this.addr(report.targetContract) : void 0;
996
+ const targetAddress = report.targetAddress ? this.addr(report.targetAddress) : void 0;
997
+ let targetKey = null;
998
+ if (report.targetType === "TOKEN" && targetContract && report.targetTokenId) {
999
+ targetKey = `TOKEN:${targetContract}:${report.targetTokenId}`;
1000
+ } else if (report.targetType === "COLLECTION" && targetContract) {
1001
+ targetKey = `COLLECTION:${targetContract}`;
1002
+ } else if (report.targetType === "CREATOR" && targetAddress) {
1003
+ targetKey = `CREATOR:${targetAddress}`;
1004
+ } else if (report.targetType === "COMMENT" && report.targetId) {
1005
+ targetKey = `COMMENT::${report.targetId}`;
1006
+ }
1007
+ if (!targetKey) throw new Error(`A ${report.targetType} report needs its target`);
992
1008
  await this.request("/v1/reports", {
993
1009
  method: "POST",
994
1010
  headers: this.bearer(siwsToken),
995
- body: JSON.stringify(report)
1011
+ body: JSON.stringify({ ...report, targetKey, targetContract, targetAddress })
996
1012
  });
997
1013
  }
1014
+ getPricing() {
1015
+ return this.get("/v1/pricing");
1016
+ }
1017
+ listCollections(query = {}) {
1018
+ const params = new URLSearchParams();
1019
+ if (query.page !== void 0) params.set("page", String(query.page));
1020
+ if (query.limit !== void 0) params.set("limit", String(query.limit));
1021
+ if (query.owner) params.set("owner", this.addr(query.owner));
1022
+ if (query.service) params.set("service", query.service);
1023
+ if (query.sort) params.set("sort", query.sort);
1024
+ if (query.isFeatured !== void 0) params.set("isFeatured", String(query.isFeatured));
1025
+ if (query.hideEmpty !== void 0) params.set("hideEmpty", String(query.hideEmpty));
1026
+ if (query.chain) params.set("chain", query.chain);
1027
+ const qs = params.toString();
1028
+ return this.get(`/v1/collections${qs ? `?${qs}` : ""}`);
1029
+ }
998
1030
  generateWallet(newWalletSiwsToken, siwsToken) {
999
1031
  return this.request("/v1/users/me/generate-wallet", {
1000
1032
  method: "POST",
@@ -1016,6 +1048,22 @@ var ApiClient = class {
1016
1048
  if (query.open !== void 0) params.set("open", String(query.open));
1017
1049
  return this.get(`/v1/sponsorship/offers?${params}`);
1018
1050
  }
1051
+ async getSponsorshipOffer(offerId) {
1052
+ const res = await this.request(
1053
+ `/v1/sponsorship/offers/${encodeURIComponent(offerId)}`,
1054
+ { method: "GET" },
1055
+ { allow404: true }
1056
+ );
1057
+ return res?.data ?? null;
1058
+ }
1059
+ async getSponsorshipProposal(proposalId) {
1060
+ const res = await this.request(
1061
+ `/v1/sponsorship/proposals/${encodeURIComponent(proposalId)}`,
1062
+ { method: "GET" },
1063
+ { allow404: true }
1064
+ );
1065
+ return res?.data ?? null;
1066
+ }
1019
1067
  async getSponsorshipBids(offerId) {
1020
1068
  const res = await this.get(`/v1/sponsorship/offers/${encodeURIComponent(offerId)}/bids`);
1021
1069
  return res.data;