@medialane/sdk 0.134.0 → 0.136.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.
@@ -350,6 +350,11 @@ var ApiClient = class {
350
350
  getActiveOrdersForToken(contract, tokenId) {
351
351
  return this.get(`/v1/orders/token/${this.addr(contract)}/${tokenId}`);
352
352
  }
353
+ /** Offers others made on the address's assets. */
354
+ getReceivedOffers(address, opts = {}) {
355
+ const params = new URLSearchParams({ page: String(opts.page ?? 1), limit: String(opts.limit ?? 50) });
356
+ return this.get(`/v1/orders/received/${this.addr(address)}?${params}`);
357
+ }
353
358
  getOrdersByUser(address, page = 1, limit = 20) {
354
359
  return this.get(
355
360
  `/v1/orders/user/${this.addr(address)}?page=${page}&limit=${limit}`
@@ -517,6 +522,11 @@ var ApiClient = class {
517
522
  uploadMetadata(metadata) {
518
523
  return this.post("/v1/metadata/upload", metadata);
519
524
  }
525
+ /** Pins several JSON files as one IPFS directory, e.g. a drop's token metadata. */
526
+ async uploadMetadataDirectory(files) {
527
+ const res = await this.post("/v1/metadata/upload-directory", { files });
528
+ return res.data;
529
+ }
520
530
  resolveMetadata(uri) {
521
531
  const params = new URLSearchParams({ uri });
522
532
  return this.get(`/v1/metadata/resolve?${params.toString()}`);
@@ -813,6 +823,7 @@ var ApiClient = class {
813
823
  }
814
824
  getRemixOffers(query, siwsToken) {
815
825
  const params = new URLSearchParams({ role: query.role });
826
+ if (query.status) params.set("status", query.status);
816
827
  if (query.page !== void 0) params.set("page", String(query.page));
817
828
  if (query.limit !== void 0) params.set("limit", String(query.limit));
818
829
  return this.request(`/v1/remix-offers?${params}`, {
@@ -848,7 +859,7 @@ var ApiClient = class {
848
859
  });
849
860
  }
850
861
  getPopCollections(opts = {}) {
851
- return this.getCollections(opts.page ?? 1, opts.limit ?? 20, void 0, opts.sort, "POP_PROTOCOL");
862
+ return this.getCollections(opts.page ?? 1, opts.limit ?? 20, void 0, opts.sort, "pop-protocol");
852
863
  }
853
864
  async getPopEligibility(collection, wallet) {
854
865
  const res = await this.get(
@@ -868,6 +879,8 @@ var ApiClient = class {
868
879
  if (opts.page) params.set("page", String(opts.page));
869
880
  if (opts.limit) params.set("limit", String(opts.limit));
870
881
  if (opts.service) params.set("service", opts.service);
882
+ if (opts.sort) params.set("sort", opts.sort);
883
+ if (opts.creator) params.set("creator", this.addr(opts.creator));
871
884
  if (opts.chain) params.set("chain", opts.chain);
872
885
  const qs = params.toString();
873
886
  return this.get(`/v1/coins${qs ? `?${qs}` : ""}`);
@@ -898,7 +911,7 @@ var ApiClient = class {
898
911
  });
899
912
  }
900
913
  getDropCollections(opts = {}) {
901
- return this.getCollections(opts.page ?? 1, opts.limit ?? 20, void 0, opts.sort, "COLLECTION_DROP");
914
+ return this.getCollections(opts.page ?? 1, opts.limit ?? 20, void 0, opts.sort, "drop-collection");
902
915
  }
903
916
  async getDropMintStatus(collection, wallet) {
904
917
  const res = await this.get(
@@ -906,6 +919,152 @@ var ApiClient = class {
906
919
  );
907
920
  return res.data;
908
921
  }
922
+ async getDropInfo(contract) {
923
+ const res = await this.request(
924
+ `/v1/drop/${this.addr(contract)}/info`,
925
+ { method: "GET" },
926
+ { allow404: true }
927
+ );
928
+ return res?.data ?? null;
929
+ }
930
+ async getDropState(contract) {
931
+ const res = await this.get(`/v1/drop/${this.addr(contract)}/state`);
932
+ return res.data;
933
+ }
934
+ async getTicket(contract, tokenId) {
935
+ const res = await this.get(`/v1/tickets/${this.addr(contract)}/${tokenId}`);
936
+ return res.data;
937
+ }
938
+ async getTicketCount(contract) {
939
+ const res = await this.get(`/v1/tickets/${this.addr(contract)}/count`);
940
+ return res.data.count;
941
+ }
942
+ async getClubMembership(contract, tokenId) {
943
+ const res = await this.get(`/v1/club/${this.addr(contract)}/${tokenId}`);
944
+ return res.data;
945
+ }
946
+ async isClubMember(contract, tokenId, wallet) {
947
+ const res = await this.get(
948
+ `/v1/club/${this.addr(contract)}/${tokenId}/member/${this.addr(wallet)}`
949
+ );
950
+ return res.data.isMember;
951
+ }
952
+ async getIpNftTokenData(contract, tokenId) {
953
+ const res = await this.get(`/v1/ipnft/${this.addr(contract)}/${tokenId}`);
954
+ return res.data;
955
+ }
956
+ async getPlatformStats() {
957
+ const res = await this.get("/v1/stats");
958
+ return res.data;
959
+ }
960
+ getTokens(query = {}) {
961
+ const params = new URLSearchParams();
962
+ if (query.page !== void 0) params.set("page", String(query.page));
963
+ if (query.limit !== void 0) params.set("limit", String(query.limit));
964
+ if (query.sort) params.set("sort", query.sort);
965
+ if (query.ipType) params.set("ipType", query.ipType);
966
+ if (query.derivatives) params.set("derivatives", query.derivatives);
967
+ const qs = params.toString();
968
+ return this.get(`/v1/tokens${qs ? `?${qs}` : ""}`);
969
+ }
970
+ async isCreatorHidden(wallet) {
971
+ const res = await this.get(`/v1/creators/${this.addr(wallet)}/hidden`);
972
+ return res.isHidden;
973
+ }
974
+ getMyUsernameClaim(siwsToken) {
975
+ return this.request("/v1/username-claims/me", {
976
+ method: "GET",
977
+ headers: this.bearer(siwsToken)
978
+ });
979
+ }
980
+ checkUsernameAvailability(username) {
981
+ return this.get(
982
+ `/v1/username-claims/check/${encodeURIComponent(username)}`
983
+ );
984
+ }
985
+ async submitUsernameClaim(username, siwsToken, notifyEmail) {
986
+ const res = await this.request("/v1/username-claims", {
987
+ method: "POST",
988
+ headers: this.bearer(siwsToken),
989
+ body: JSON.stringify({ username, ...notifyEmail ? { notifyEmail } : {} })
990
+ });
991
+ return res.claim;
992
+ }
993
+ async submitReport(report, siwsToken) {
994
+ const targetContract = report.targetContract ? this.addr(report.targetContract) : void 0;
995
+ const targetAddress = report.targetAddress ? this.addr(report.targetAddress) : void 0;
996
+ let targetKey = null;
997
+ if (report.targetType === "TOKEN" && targetContract && report.targetTokenId) {
998
+ targetKey = `TOKEN:${targetContract}:${report.targetTokenId}`;
999
+ } else if (report.targetType === "COLLECTION" && targetContract) {
1000
+ targetKey = `COLLECTION:${targetContract}`;
1001
+ } else if (report.targetType === "CREATOR" && targetAddress) {
1002
+ targetKey = `CREATOR:${targetAddress}`;
1003
+ } else if (report.targetType === "COMMENT" && report.targetId) {
1004
+ targetKey = `COMMENT::${report.targetId}`;
1005
+ }
1006
+ if (!targetKey) throw new Error(`A ${report.targetType} report needs its target`);
1007
+ await this.request("/v1/reports", {
1008
+ method: "POST",
1009
+ headers: this.bearer(siwsToken),
1010
+ body: JSON.stringify({ ...report, targetKey, targetContract, targetAddress })
1011
+ });
1012
+ }
1013
+ getPricing() {
1014
+ return this.get("/v1/pricing");
1015
+ }
1016
+ listCollections(query = {}) {
1017
+ const params = new URLSearchParams();
1018
+ if (query.page !== void 0) params.set("page", String(query.page));
1019
+ if (query.limit !== void 0) params.set("limit", String(query.limit));
1020
+ if (query.owner) params.set("owner", this.addr(query.owner));
1021
+ if (query.service) params.set("service", query.service);
1022
+ if (query.sort) params.set("sort", query.sort);
1023
+ if (query.isFeatured !== void 0) params.set("isFeatured", String(query.isFeatured));
1024
+ if (query.hideEmpty !== void 0) params.set("hideEmpty", String(query.hideEmpty));
1025
+ if (query.chain) params.set("chain", query.chain);
1026
+ const qs = params.toString();
1027
+ return this.get(`/v1/collections${qs ? `?${qs}` : ""}`);
1028
+ }
1029
+ generateWallet(newWalletSiwsToken, siwsToken) {
1030
+ return this.request("/v1/users/me/generate-wallet", {
1031
+ method: "POST",
1032
+ headers: this.bearer(siwsToken),
1033
+ body: JSON.stringify({ newWalletSiwsToken })
1034
+ });
1035
+ }
1036
+ syncCoin(coinAddress, owner) {
1037
+ return this.post("/v1/coins/sync", { coinAddress, ...owner ? { owner } : {} });
1038
+ }
1039
+ registerCollection(contractAddress) {
1040
+ return this.post("/v1/collections/register", { contractAddress });
1041
+ }
1042
+ getSponsorshipOffers(query = {}) {
1043
+ const params = new URLSearchParams({ limit: String(query.limit ?? 50) });
1044
+ if (query.nftContract) params.set("nftContract", query.nftContract);
1045
+ if (query.author) params.set("author", query.author);
1046
+ if (query.owner) params.set("owner", query.owner);
1047
+ if (query.open !== void 0) params.set("open", String(query.open));
1048
+ return this.get(`/v1/sponsorship/offers?${params}`);
1049
+ }
1050
+ async getSponsorshipBids(offerId) {
1051
+ const res = await this.get(`/v1/sponsorship/offers/${encodeURIComponent(offerId)}/bids`);
1052
+ return res.data;
1053
+ }
1054
+ getSponsorshipProposals(query = {}) {
1055
+ const params = new URLSearchParams({ limit: String(query.limit ?? 50) });
1056
+ if (query.nftContract) params.set("nftContract", query.nftContract);
1057
+ if (query.proposer) params.set("proposer", query.proposer);
1058
+ if (query.owner) params.set("owner", query.owner);
1059
+ if (query.open !== void 0) params.set("open", String(query.open));
1060
+ return this.get(`/v1/sponsorship/proposals?${params}`);
1061
+ }
1062
+ getSponsorshipLicenses(query = {}) {
1063
+ const params = new URLSearchParams({ limit: String(query.limit ?? 50) });
1064
+ if (query.holder) params.set("holder", query.holder);
1065
+ if (query.author) params.set("author", query.author);
1066
+ return this.get(`/v1/sponsorship/licenses?${params}`);
1067
+ }
909
1068
  async getRewards(address) {
910
1069
  const res = await this.get(`/v1/rewards/${this.addr(address)}`);
911
1070
  return res.data;