@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.
@@ -1,5 +1,5 @@
1
- import { bm as ResolvedConfig, bu as TxResult, aH as CreatePopCollectionParams, as as ClaimConditions, aD as CreateDropParams, aM as CreateTicketParams, b6 as MintTicketsParams, aF as CreateMembershipParams, b5 as MintMembershipsParams, aK as CreateSponsorshipOfferParams, bj as ProposeSponsorshipParams, k as ApiClient, b3 as MedialaneConfig, b4 as MedialaneErrorCode, bb as OrderDetails, R as ResolvedFeeConfig, E as ApiFundingIntent, D as ApiFundingInstructions, H as ApiFundingSubmit, J as ApiIntentCreated, bC as SealedOwner, bD as ReceiptProviderLike, bE as WalletExecutor, bF as ExecutedTransaction, bG as PasskeyOwner } from '../errors-BpiH1lap.cjs';
2
- export { bH as CreatedOwner, bI as OwnerSigner, be as PasskeyCancelledError, bJ as PasskeyConfig, bw as UserFacingError, bK as createPasskeyOwner } from '../errors-BpiH1lap.cjs';
1
+ import { bG as ResolvedConfig, bO as TxResult, a$ as CreatePopCollectionParams, aM as ClaimConditions, aX as CreateDropParams, b4 as CreateTicketParams, bq as MintTicketsParams, aZ as CreateMembershipParams, bp as MintMembershipsParams, b2 as CreateSponsorshipOfferParams, bD as ProposeSponsorshipParams, k as ApiClient, bn as MedialaneConfig, bo as MedialaneErrorCode, bv as OrderDetails, R as ResolvedFeeConfig, I as ApiFundingIntent, H as ApiFundingInstructions, L as ApiFundingSubmit, N as ApiIntentCreated, bW as SealedOwner, bX as ReceiptProviderLike, bY as WalletExecutor, bZ as ExecutedTransaction, b_ as PasskeyOwner } from '../errors-CadmV001.cjs';
2
+ export { b$ as CreatedOwner, c0 as OwnerSigner, by as PasskeyCancelledError, c1 as PasskeyConfig, bQ as UserFacingError, c2 as createPasskeyOwner } from '../errors-CadmV001.cjs';
3
3
  import { AccountInterface, Call, ProviderInterface, TypedData, constants, BigNumberish, DeployAccountContractPayload, Account } from 'starknet';
4
4
  import { V as VenueAdapter, O as OrderRef, A as AdapterTxResult, R as RegisterOrderParams, j as VenueSigner } from '../types-CuSlc_YE.cjs';
5
5
  import 'zod';
@@ -1,5 +1,5 @@
1
- import { bm as ResolvedConfig, bu as TxResult, aH as CreatePopCollectionParams, as as ClaimConditions, aD as CreateDropParams, aM as CreateTicketParams, b6 as MintTicketsParams, aF as CreateMembershipParams, b5 as MintMembershipsParams, aK as CreateSponsorshipOfferParams, bj as ProposeSponsorshipParams, k as ApiClient, b3 as MedialaneConfig, b4 as MedialaneErrorCode, bb as OrderDetails, R as ResolvedFeeConfig, E as ApiFundingIntent, D as ApiFundingInstructions, H as ApiFundingSubmit, J as ApiIntentCreated, bC as SealedOwner, bD as ReceiptProviderLike, bE as WalletExecutor, bF as ExecutedTransaction, bG as PasskeyOwner } from '../errors-BsiYot6M.js';
2
- export { bH as CreatedOwner, bI as OwnerSigner, be as PasskeyCancelledError, bJ as PasskeyConfig, bw as UserFacingError, bK as createPasskeyOwner } from '../errors-BsiYot6M.js';
1
+ import { bG as ResolvedConfig, bO as TxResult, a$ as CreatePopCollectionParams, aM as ClaimConditions, aX as CreateDropParams, b4 as CreateTicketParams, bq as MintTicketsParams, aZ as CreateMembershipParams, bp as MintMembershipsParams, b2 as CreateSponsorshipOfferParams, bD as ProposeSponsorshipParams, k as ApiClient, bn as MedialaneConfig, bo as MedialaneErrorCode, bv as OrderDetails, R as ResolvedFeeConfig, I as ApiFundingIntent, H as ApiFundingInstructions, L as ApiFundingSubmit, N as ApiIntentCreated, bW as SealedOwner, bX as ReceiptProviderLike, bY as WalletExecutor, bZ as ExecutedTransaction, b_ as PasskeyOwner } from '../errors-DlrNXuXZ.js';
2
+ export { b$ as CreatedOwner, c0 as OwnerSigner, by as PasskeyCancelledError, c1 as PasskeyConfig, bQ as UserFacingError, c2 as createPasskeyOwner } from '../errors-DlrNXuXZ.js';
3
3
  import { AccountInterface, Call, ProviderInterface, TypedData, constants, BigNumberish, DeployAccountContractPayload, Account } from 'starknet';
4
4
  import { V as VenueAdapter, O as OrderRef, A as AdapterTxResult, R as RegisterOrderParams, j as VenueSigner } from '../types-CuSlc_YE.js';
5
5
  import 'zod';
@@ -348,6 +348,11 @@ var ApiClient = class {
348
348
  getActiveOrdersForToken(contract, tokenId) {
349
349
  return this.get(`/v1/orders/token/${this.addr(contract)}/${tokenId}`);
350
350
  }
351
+ /** Offers others made on the address's assets. */
352
+ getReceivedOffers(address, opts = {}) {
353
+ const params = new URLSearchParams({ page: String(opts.page ?? 1), limit: String(opts.limit ?? 50) });
354
+ return this.get(`/v1/orders/received/${this.addr(address)}?${params}`);
355
+ }
351
356
  getOrdersByUser(address, page = 1, limit = 20) {
352
357
  return this.get(
353
358
  `/v1/orders/user/${this.addr(address)}?page=${page}&limit=${limit}`
@@ -515,6 +520,11 @@ var ApiClient = class {
515
520
  uploadMetadata(metadata) {
516
521
  return this.post("/v1/metadata/upload", metadata);
517
522
  }
523
+ /** Pins several JSON files as one IPFS directory, e.g. a drop's token metadata. */
524
+ async uploadMetadataDirectory(files) {
525
+ const res = await this.post("/v1/metadata/upload-directory", { files });
526
+ return res.data;
527
+ }
518
528
  resolveMetadata(uri) {
519
529
  const params = new URLSearchParams({ uri });
520
530
  return this.get(`/v1/metadata/resolve?${params.toString()}`);
@@ -811,6 +821,7 @@ var ApiClient = class {
811
821
  }
812
822
  getRemixOffers(query, siwsToken) {
813
823
  const params = new URLSearchParams({ role: query.role });
824
+ if (query.status) params.set("status", query.status);
814
825
  if (query.page !== void 0) params.set("page", String(query.page));
815
826
  if (query.limit !== void 0) params.set("limit", String(query.limit));
816
827
  return this.request(`/v1/remix-offers?${params}`, {
@@ -846,7 +857,7 @@ var ApiClient = class {
846
857
  });
847
858
  }
848
859
  getPopCollections(opts = {}) {
849
- return this.getCollections(opts.page ?? 1, opts.limit ?? 20, void 0, opts.sort, "POP_PROTOCOL");
860
+ return this.getCollections(opts.page ?? 1, opts.limit ?? 20, void 0, opts.sort, "pop-protocol");
850
861
  }
851
862
  async getPopEligibility(collection, wallet) {
852
863
  const res = await this.get(
@@ -866,6 +877,8 @@ var ApiClient = class {
866
877
  if (opts.page) params.set("page", String(opts.page));
867
878
  if (opts.limit) params.set("limit", String(opts.limit));
868
879
  if (opts.service) params.set("service", opts.service);
880
+ if (opts.sort) params.set("sort", opts.sort);
881
+ if (opts.creator) params.set("creator", this.addr(opts.creator));
869
882
  if (opts.chain) params.set("chain", opts.chain);
870
883
  const qs = params.toString();
871
884
  return this.get(`/v1/coins${qs ? `?${qs}` : ""}`);
@@ -896,7 +909,7 @@ var ApiClient = class {
896
909
  });
897
910
  }
898
911
  getDropCollections(opts = {}) {
899
- return this.getCollections(opts.page ?? 1, opts.limit ?? 20, void 0, opts.sort, "COLLECTION_DROP");
912
+ return this.getCollections(opts.page ?? 1, opts.limit ?? 20, void 0, opts.sort, "drop-collection");
900
913
  }
901
914
  async getDropMintStatus(collection, wallet) {
902
915
  const res = await this.get(
@@ -904,6 +917,152 @@ var ApiClient = class {
904
917
  );
905
918
  return res.data;
906
919
  }
920
+ async getDropInfo(contract) {
921
+ const res = await this.request(
922
+ `/v1/drop/${this.addr(contract)}/info`,
923
+ { method: "GET" },
924
+ { allow404: true }
925
+ );
926
+ return res?.data ?? null;
927
+ }
928
+ async getDropState(contract) {
929
+ const res = await this.get(`/v1/drop/${this.addr(contract)}/state`);
930
+ return res.data;
931
+ }
932
+ async getTicket(contract, tokenId) {
933
+ const res = await this.get(`/v1/tickets/${this.addr(contract)}/${tokenId}`);
934
+ return res.data;
935
+ }
936
+ async getTicketCount(contract) {
937
+ const res = await this.get(`/v1/tickets/${this.addr(contract)}/count`);
938
+ return res.data.count;
939
+ }
940
+ async getClubMembership(contract, tokenId) {
941
+ const res = await this.get(`/v1/club/${this.addr(contract)}/${tokenId}`);
942
+ return res.data;
943
+ }
944
+ async isClubMember(contract, tokenId, wallet) {
945
+ const res = await this.get(
946
+ `/v1/club/${this.addr(contract)}/${tokenId}/member/${this.addr(wallet)}`
947
+ );
948
+ return res.data.isMember;
949
+ }
950
+ async getIpNftTokenData(contract, tokenId) {
951
+ const res = await this.get(`/v1/ipnft/${this.addr(contract)}/${tokenId}`);
952
+ return res.data;
953
+ }
954
+ async getPlatformStats() {
955
+ const res = await this.get("/v1/stats");
956
+ return res.data;
957
+ }
958
+ getTokens(query = {}) {
959
+ const params = new URLSearchParams();
960
+ if (query.page !== void 0) params.set("page", String(query.page));
961
+ if (query.limit !== void 0) params.set("limit", String(query.limit));
962
+ if (query.sort) params.set("sort", query.sort);
963
+ if (query.ipType) params.set("ipType", query.ipType);
964
+ if (query.derivatives) params.set("derivatives", query.derivatives);
965
+ const qs = params.toString();
966
+ return this.get(`/v1/tokens${qs ? `?${qs}` : ""}`);
967
+ }
968
+ async isCreatorHidden(wallet) {
969
+ const res = await this.get(`/v1/creators/${this.addr(wallet)}/hidden`);
970
+ return res.isHidden;
971
+ }
972
+ getMyUsernameClaim(siwsToken) {
973
+ return this.request("/v1/username-claims/me", {
974
+ method: "GET",
975
+ headers: this.bearer(siwsToken)
976
+ });
977
+ }
978
+ checkUsernameAvailability(username) {
979
+ return this.get(
980
+ `/v1/username-claims/check/${encodeURIComponent(username)}`
981
+ );
982
+ }
983
+ async submitUsernameClaim(username, siwsToken, notifyEmail) {
984
+ const res = await this.request("/v1/username-claims", {
985
+ method: "POST",
986
+ headers: this.bearer(siwsToken),
987
+ body: JSON.stringify({ username, ...notifyEmail ? { notifyEmail } : {} })
988
+ });
989
+ return res.claim;
990
+ }
991
+ async submitReport(report, siwsToken) {
992
+ const targetContract = report.targetContract ? this.addr(report.targetContract) : void 0;
993
+ const targetAddress = report.targetAddress ? this.addr(report.targetAddress) : void 0;
994
+ let targetKey = null;
995
+ if (report.targetType === "TOKEN" && targetContract && report.targetTokenId) {
996
+ targetKey = `TOKEN:${targetContract}:${report.targetTokenId}`;
997
+ } else if (report.targetType === "COLLECTION" && targetContract) {
998
+ targetKey = `COLLECTION:${targetContract}`;
999
+ } else if (report.targetType === "CREATOR" && targetAddress) {
1000
+ targetKey = `CREATOR:${targetAddress}`;
1001
+ } else if (report.targetType === "COMMENT" && report.targetId) {
1002
+ targetKey = `COMMENT::${report.targetId}`;
1003
+ }
1004
+ if (!targetKey) throw new Error(`A ${report.targetType} report needs its target`);
1005
+ await this.request("/v1/reports", {
1006
+ method: "POST",
1007
+ headers: this.bearer(siwsToken),
1008
+ body: JSON.stringify({ ...report, targetKey, targetContract, targetAddress })
1009
+ });
1010
+ }
1011
+ getPricing() {
1012
+ return this.get("/v1/pricing");
1013
+ }
1014
+ listCollections(query = {}) {
1015
+ const params = new URLSearchParams();
1016
+ if (query.page !== void 0) params.set("page", String(query.page));
1017
+ if (query.limit !== void 0) params.set("limit", String(query.limit));
1018
+ if (query.owner) params.set("owner", this.addr(query.owner));
1019
+ if (query.service) params.set("service", query.service);
1020
+ if (query.sort) params.set("sort", query.sort);
1021
+ if (query.isFeatured !== void 0) params.set("isFeatured", String(query.isFeatured));
1022
+ if (query.hideEmpty !== void 0) params.set("hideEmpty", String(query.hideEmpty));
1023
+ if (query.chain) params.set("chain", query.chain);
1024
+ const qs = params.toString();
1025
+ return this.get(`/v1/collections${qs ? `?${qs}` : ""}`);
1026
+ }
1027
+ generateWallet(newWalletSiwsToken, siwsToken) {
1028
+ return this.request("/v1/users/me/generate-wallet", {
1029
+ method: "POST",
1030
+ headers: this.bearer(siwsToken),
1031
+ body: JSON.stringify({ newWalletSiwsToken })
1032
+ });
1033
+ }
1034
+ syncCoin(coinAddress, owner) {
1035
+ return this.post("/v1/coins/sync", { coinAddress, ...owner ? { owner } : {} });
1036
+ }
1037
+ registerCollection(contractAddress) {
1038
+ return this.post("/v1/collections/register", { contractAddress });
1039
+ }
1040
+ getSponsorshipOffers(query = {}) {
1041
+ const params = new URLSearchParams({ limit: String(query.limit ?? 50) });
1042
+ if (query.nftContract) params.set("nftContract", query.nftContract);
1043
+ if (query.author) params.set("author", query.author);
1044
+ if (query.owner) params.set("owner", query.owner);
1045
+ if (query.open !== void 0) params.set("open", String(query.open));
1046
+ return this.get(`/v1/sponsorship/offers?${params}`);
1047
+ }
1048
+ async getSponsorshipBids(offerId) {
1049
+ const res = await this.get(`/v1/sponsorship/offers/${encodeURIComponent(offerId)}/bids`);
1050
+ return res.data;
1051
+ }
1052
+ getSponsorshipProposals(query = {}) {
1053
+ const params = new URLSearchParams({ limit: String(query.limit ?? 50) });
1054
+ if (query.nftContract) params.set("nftContract", query.nftContract);
1055
+ if (query.proposer) params.set("proposer", query.proposer);
1056
+ if (query.owner) params.set("owner", query.owner);
1057
+ if (query.open !== void 0) params.set("open", String(query.open));
1058
+ return this.get(`/v1/sponsorship/proposals?${params}`);
1059
+ }
1060
+ getSponsorshipLicenses(query = {}) {
1061
+ const params = new URLSearchParams({ limit: String(query.limit ?? 50) });
1062
+ if (query.holder) params.set("holder", query.holder);
1063
+ if (query.author) params.set("author", query.author);
1064
+ return this.get(`/v1/sponsorship/licenses?${params}`);
1065
+ }
907
1066
  async getRewards(address) {
908
1067
  const res = await this.get(`/v1/rewards/${this.addr(address)}`);
909
1068
  return res.data;