@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.
- package/dist/{errors-BpiH1lap.d.cts → errors-CadmV001.d.cts} +241 -3
- package/dist/{errors-BsiYot6M.d.ts → errors-DlrNXuXZ.d.ts} +241 -3
- package/dist/index.cjs +244 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +147 -3
- package/dist/index.d.ts +147 -3
- package/dist/index.js +241 -3
- package/dist/index.js.map +1 -1
- package/dist/starknet/index.cjs +161 -2
- package/dist/starknet/index.cjs.map +1 -1
- package/dist/starknet/index.d.cts +2 -2
- package/dist/starknet/index.d.ts +2 -2
- package/dist/starknet/index.js +161 -2
- package/dist/starknet/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -377,6 +377,11 @@ var ApiClient = class {
|
|
|
377
377
|
getActiveOrdersForToken(contract, tokenId) {
|
|
378
378
|
return this.get(`/v1/orders/token/${this.addr(contract)}/${tokenId}`);
|
|
379
379
|
}
|
|
380
|
+
/** Offers others made on the address's assets. */
|
|
381
|
+
getReceivedOffers(address, opts = {}) {
|
|
382
|
+
const params = new URLSearchParams({ page: String(opts.page ?? 1), limit: String(opts.limit ?? 50) });
|
|
383
|
+
return this.get(`/v1/orders/received/${this.addr(address)}?${params}`);
|
|
384
|
+
}
|
|
380
385
|
getOrdersByUser(address, page = 1, limit = 20) {
|
|
381
386
|
return this.get(
|
|
382
387
|
`/v1/orders/user/${this.addr(address)}?page=${page}&limit=${limit}`
|
|
@@ -544,6 +549,11 @@ var ApiClient = class {
|
|
|
544
549
|
uploadMetadata(metadata) {
|
|
545
550
|
return this.post("/v1/metadata/upload", metadata);
|
|
546
551
|
}
|
|
552
|
+
/** Pins several JSON files as one IPFS directory, e.g. a drop's token metadata. */
|
|
553
|
+
async uploadMetadataDirectory(files) {
|
|
554
|
+
const res = await this.post("/v1/metadata/upload-directory", { files });
|
|
555
|
+
return res.data;
|
|
556
|
+
}
|
|
547
557
|
resolveMetadata(uri) {
|
|
548
558
|
const params = new URLSearchParams({ uri });
|
|
549
559
|
return this.get(`/v1/metadata/resolve?${params.toString()}`);
|
|
@@ -840,6 +850,7 @@ var ApiClient = class {
|
|
|
840
850
|
}
|
|
841
851
|
getRemixOffers(query, siwsToken) {
|
|
842
852
|
const params = new URLSearchParams({ role: query.role });
|
|
853
|
+
if (query.status) params.set("status", query.status);
|
|
843
854
|
if (query.page !== void 0) params.set("page", String(query.page));
|
|
844
855
|
if (query.limit !== void 0) params.set("limit", String(query.limit));
|
|
845
856
|
return this.request(`/v1/remix-offers?${params}`, {
|
|
@@ -875,7 +886,7 @@ var ApiClient = class {
|
|
|
875
886
|
});
|
|
876
887
|
}
|
|
877
888
|
getPopCollections(opts = {}) {
|
|
878
|
-
return this.getCollections(opts.page ?? 1, opts.limit ?? 20, void 0, opts.sort, "
|
|
889
|
+
return this.getCollections(opts.page ?? 1, opts.limit ?? 20, void 0, opts.sort, "pop-protocol");
|
|
879
890
|
}
|
|
880
891
|
async getPopEligibility(collection, wallet) {
|
|
881
892
|
const res = await this.get(
|
|
@@ -895,6 +906,8 @@ var ApiClient = class {
|
|
|
895
906
|
if (opts.page) params.set("page", String(opts.page));
|
|
896
907
|
if (opts.limit) params.set("limit", String(opts.limit));
|
|
897
908
|
if (opts.service) params.set("service", opts.service);
|
|
909
|
+
if (opts.sort) params.set("sort", opts.sort);
|
|
910
|
+
if (opts.creator) params.set("creator", this.addr(opts.creator));
|
|
898
911
|
if (opts.chain) params.set("chain", opts.chain);
|
|
899
912
|
const qs = params.toString();
|
|
900
913
|
return this.get(`/v1/coins${qs ? `?${qs}` : ""}`);
|
|
@@ -925,7 +938,7 @@ var ApiClient = class {
|
|
|
925
938
|
});
|
|
926
939
|
}
|
|
927
940
|
getDropCollections(opts = {}) {
|
|
928
|
-
return this.getCollections(opts.page ?? 1, opts.limit ?? 20, void 0, opts.sort, "
|
|
941
|
+
return this.getCollections(opts.page ?? 1, opts.limit ?? 20, void 0, opts.sort, "drop-collection");
|
|
929
942
|
}
|
|
930
943
|
async getDropMintStatus(collection, wallet) {
|
|
931
944
|
const res = await this.get(
|
|
@@ -933,6 +946,152 @@ var ApiClient = class {
|
|
|
933
946
|
);
|
|
934
947
|
return res.data;
|
|
935
948
|
}
|
|
949
|
+
async getDropInfo(contract) {
|
|
950
|
+
const res = await this.request(
|
|
951
|
+
`/v1/drop/${this.addr(contract)}/info`,
|
|
952
|
+
{ method: "GET" },
|
|
953
|
+
{ allow404: true }
|
|
954
|
+
);
|
|
955
|
+
return res?.data ?? null;
|
|
956
|
+
}
|
|
957
|
+
async getDropState(contract) {
|
|
958
|
+
const res = await this.get(`/v1/drop/${this.addr(contract)}/state`);
|
|
959
|
+
return res.data;
|
|
960
|
+
}
|
|
961
|
+
async getTicket(contract, tokenId) {
|
|
962
|
+
const res = await this.get(`/v1/tickets/${this.addr(contract)}/${tokenId}`);
|
|
963
|
+
return res.data;
|
|
964
|
+
}
|
|
965
|
+
async getTicketCount(contract) {
|
|
966
|
+
const res = await this.get(`/v1/tickets/${this.addr(contract)}/count`);
|
|
967
|
+
return res.data.count;
|
|
968
|
+
}
|
|
969
|
+
async getClubMembership(contract, tokenId) {
|
|
970
|
+
const res = await this.get(`/v1/club/${this.addr(contract)}/${tokenId}`);
|
|
971
|
+
return res.data;
|
|
972
|
+
}
|
|
973
|
+
async isClubMember(contract, tokenId, wallet) {
|
|
974
|
+
const res = await this.get(
|
|
975
|
+
`/v1/club/${this.addr(contract)}/${tokenId}/member/${this.addr(wallet)}`
|
|
976
|
+
);
|
|
977
|
+
return res.data.isMember;
|
|
978
|
+
}
|
|
979
|
+
async getIpNftTokenData(contract, tokenId) {
|
|
980
|
+
const res = await this.get(`/v1/ipnft/${this.addr(contract)}/${tokenId}`);
|
|
981
|
+
return res.data;
|
|
982
|
+
}
|
|
983
|
+
async getPlatformStats() {
|
|
984
|
+
const res = await this.get("/v1/stats");
|
|
985
|
+
return res.data;
|
|
986
|
+
}
|
|
987
|
+
getTokens(query = {}) {
|
|
988
|
+
const params = new URLSearchParams();
|
|
989
|
+
if (query.page !== void 0) params.set("page", String(query.page));
|
|
990
|
+
if (query.limit !== void 0) params.set("limit", String(query.limit));
|
|
991
|
+
if (query.sort) params.set("sort", query.sort);
|
|
992
|
+
if (query.ipType) params.set("ipType", query.ipType);
|
|
993
|
+
if (query.derivatives) params.set("derivatives", query.derivatives);
|
|
994
|
+
const qs = params.toString();
|
|
995
|
+
return this.get(`/v1/tokens${qs ? `?${qs}` : ""}`);
|
|
996
|
+
}
|
|
997
|
+
async isCreatorHidden(wallet) {
|
|
998
|
+
const res = await this.get(`/v1/creators/${this.addr(wallet)}/hidden`);
|
|
999
|
+
return res.isHidden;
|
|
1000
|
+
}
|
|
1001
|
+
getMyUsernameClaim(siwsToken) {
|
|
1002
|
+
return this.request("/v1/username-claims/me", {
|
|
1003
|
+
method: "GET",
|
|
1004
|
+
headers: this.bearer(siwsToken)
|
|
1005
|
+
});
|
|
1006
|
+
}
|
|
1007
|
+
checkUsernameAvailability(username) {
|
|
1008
|
+
return this.get(
|
|
1009
|
+
`/v1/username-claims/check/${encodeURIComponent(username)}`
|
|
1010
|
+
);
|
|
1011
|
+
}
|
|
1012
|
+
async submitUsernameClaim(username, siwsToken, notifyEmail) {
|
|
1013
|
+
const res = await this.request("/v1/username-claims", {
|
|
1014
|
+
method: "POST",
|
|
1015
|
+
headers: this.bearer(siwsToken),
|
|
1016
|
+
body: JSON.stringify({ username, ...notifyEmail ? { notifyEmail } : {} })
|
|
1017
|
+
});
|
|
1018
|
+
return res.claim;
|
|
1019
|
+
}
|
|
1020
|
+
async submitReport(report, siwsToken) {
|
|
1021
|
+
const targetContract = report.targetContract ? this.addr(report.targetContract) : void 0;
|
|
1022
|
+
const targetAddress = report.targetAddress ? this.addr(report.targetAddress) : void 0;
|
|
1023
|
+
let targetKey = null;
|
|
1024
|
+
if (report.targetType === "TOKEN" && targetContract && report.targetTokenId) {
|
|
1025
|
+
targetKey = `TOKEN:${targetContract}:${report.targetTokenId}`;
|
|
1026
|
+
} else if (report.targetType === "COLLECTION" && targetContract) {
|
|
1027
|
+
targetKey = `COLLECTION:${targetContract}`;
|
|
1028
|
+
} else if (report.targetType === "CREATOR" && targetAddress) {
|
|
1029
|
+
targetKey = `CREATOR:${targetAddress}`;
|
|
1030
|
+
} else if (report.targetType === "COMMENT" && report.targetId) {
|
|
1031
|
+
targetKey = `COMMENT::${report.targetId}`;
|
|
1032
|
+
}
|
|
1033
|
+
if (!targetKey) throw new Error(`A ${report.targetType} report needs its target`);
|
|
1034
|
+
await this.request("/v1/reports", {
|
|
1035
|
+
method: "POST",
|
|
1036
|
+
headers: this.bearer(siwsToken),
|
|
1037
|
+
body: JSON.stringify({ ...report, targetKey, targetContract, targetAddress })
|
|
1038
|
+
});
|
|
1039
|
+
}
|
|
1040
|
+
getPricing() {
|
|
1041
|
+
return this.get("/v1/pricing");
|
|
1042
|
+
}
|
|
1043
|
+
listCollections(query = {}) {
|
|
1044
|
+
const params = new URLSearchParams();
|
|
1045
|
+
if (query.page !== void 0) params.set("page", String(query.page));
|
|
1046
|
+
if (query.limit !== void 0) params.set("limit", String(query.limit));
|
|
1047
|
+
if (query.owner) params.set("owner", this.addr(query.owner));
|
|
1048
|
+
if (query.service) params.set("service", query.service);
|
|
1049
|
+
if (query.sort) params.set("sort", query.sort);
|
|
1050
|
+
if (query.isFeatured !== void 0) params.set("isFeatured", String(query.isFeatured));
|
|
1051
|
+
if (query.hideEmpty !== void 0) params.set("hideEmpty", String(query.hideEmpty));
|
|
1052
|
+
if (query.chain) params.set("chain", query.chain);
|
|
1053
|
+
const qs = params.toString();
|
|
1054
|
+
return this.get(`/v1/collections${qs ? `?${qs}` : ""}`);
|
|
1055
|
+
}
|
|
1056
|
+
generateWallet(newWalletSiwsToken, siwsToken) {
|
|
1057
|
+
return this.request("/v1/users/me/generate-wallet", {
|
|
1058
|
+
method: "POST",
|
|
1059
|
+
headers: this.bearer(siwsToken),
|
|
1060
|
+
body: JSON.stringify({ newWalletSiwsToken })
|
|
1061
|
+
});
|
|
1062
|
+
}
|
|
1063
|
+
syncCoin(coinAddress, owner) {
|
|
1064
|
+
return this.post("/v1/coins/sync", { coinAddress, ...owner ? { owner } : {} });
|
|
1065
|
+
}
|
|
1066
|
+
registerCollection(contractAddress) {
|
|
1067
|
+
return this.post("/v1/collections/register", { contractAddress });
|
|
1068
|
+
}
|
|
1069
|
+
getSponsorshipOffers(query = {}) {
|
|
1070
|
+
const params = new URLSearchParams({ limit: String(query.limit ?? 50) });
|
|
1071
|
+
if (query.nftContract) params.set("nftContract", query.nftContract);
|
|
1072
|
+
if (query.author) params.set("author", query.author);
|
|
1073
|
+
if (query.owner) params.set("owner", query.owner);
|
|
1074
|
+
if (query.open !== void 0) params.set("open", String(query.open));
|
|
1075
|
+
return this.get(`/v1/sponsorship/offers?${params}`);
|
|
1076
|
+
}
|
|
1077
|
+
async getSponsorshipBids(offerId) {
|
|
1078
|
+
const res = await this.get(`/v1/sponsorship/offers/${encodeURIComponent(offerId)}/bids`);
|
|
1079
|
+
return res.data;
|
|
1080
|
+
}
|
|
1081
|
+
getSponsorshipProposals(query = {}) {
|
|
1082
|
+
const params = new URLSearchParams({ limit: String(query.limit ?? 50) });
|
|
1083
|
+
if (query.nftContract) params.set("nftContract", query.nftContract);
|
|
1084
|
+
if (query.proposer) params.set("proposer", query.proposer);
|
|
1085
|
+
if (query.owner) params.set("owner", query.owner);
|
|
1086
|
+
if (query.open !== void 0) params.set("open", String(query.open));
|
|
1087
|
+
return this.get(`/v1/sponsorship/proposals?${params}`);
|
|
1088
|
+
}
|
|
1089
|
+
getSponsorshipLicenses(query = {}) {
|
|
1090
|
+
const params = new URLSearchParams({ limit: String(query.limit ?? 50) });
|
|
1091
|
+
if (query.holder) params.set("holder", query.holder);
|
|
1092
|
+
if (query.author) params.set("author", query.author);
|
|
1093
|
+
return this.get(`/v1/sponsorship/licenses?${params}`);
|
|
1094
|
+
}
|
|
936
1095
|
async getRewards(address) {
|
|
937
1096
|
const res = await this.get(`/v1/rewards/${this.addr(address)}`);
|
|
938
1097
|
return res.data;
|
|
@@ -957,6 +1116,85 @@ var ApiClient = class {
|
|
|
957
1116
|
}
|
|
958
1117
|
};
|
|
959
1118
|
|
|
1119
|
+
// src/api/launchpad-runs.ts
|
|
1120
|
+
var isDataTokenizationRun = (run) => run.service === "data-tokenization-erc721";
|
|
1121
|
+
var isTicketingRun = (run) => run.service === "ip-ticketing";
|
|
1122
|
+
var RunRequestError = class extends Error {
|
|
1123
|
+
constructor(message, status, body) {
|
|
1124
|
+
super(message);
|
|
1125
|
+
this.status = status;
|
|
1126
|
+
this.body = body;
|
|
1127
|
+
}
|
|
1128
|
+
};
|
|
1129
|
+
function createLaunchpadRunsClient({ baseUrl, getToken, fetchImpl = fetch }) {
|
|
1130
|
+
const runsUrl = `${baseUrl.replace(/\/$/, "")}/v1/portal/runs`;
|
|
1131
|
+
const runBase = (id) => `${runsUrl}/${id}`;
|
|
1132
|
+
const runBatchBase = (id, index) => `${runBase(id)}/batches/${index}`;
|
|
1133
|
+
const runCollectionBase = (id) => `${runBase(id)}/collection`;
|
|
1134
|
+
const runTierBase = (id) => `${runBase(id)}/tier`;
|
|
1135
|
+
const authorizedFetch = async (input, init) => {
|
|
1136
|
+
const token = await getToken();
|
|
1137
|
+
const headers2 = new Headers(init?.headers);
|
|
1138
|
+
if (token) headers2.set("authorization", `Bearer ${token}`);
|
|
1139
|
+
return fetchImpl(input, { ...init, headers: headers2, cache: "no-store" });
|
|
1140
|
+
};
|
|
1141
|
+
async function call(url, init) {
|
|
1142
|
+
const res = await authorizedFetch(url, {
|
|
1143
|
+
...init,
|
|
1144
|
+
headers: { "content-type": "application/json", ...init?.headers }
|
|
1145
|
+
});
|
|
1146
|
+
const body = await res.json().catch(() => ({}));
|
|
1147
|
+
if (!res.ok) {
|
|
1148
|
+
throw new RunRequestError(String(body.error ?? "Something went wrong with this run"), res.status, body);
|
|
1149
|
+
}
|
|
1150
|
+
return { status: res.status, data: body.data };
|
|
1151
|
+
}
|
|
1152
|
+
const post = (url, body) => call(url, { method: "POST", body: body === void 0 ? void 0 : JSON.stringify(body) });
|
|
1153
|
+
const confirm = async (url) => {
|
|
1154
|
+
const { status, data } = await post(url);
|
|
1155
|
+
return { pending: status === 202, status: data.status, completed: data.completed };
|
|
1156
|
+
};
|
|
1157
|
+
const ticketing = {
|
|
1158
|
+
uploadUrl: async (id, name) => (await post(`${runBase(id)}/files/upload-url`, { name })).data.url,
|
|
1159
|
+
uploaded: async (id, name, cid) => (await post(`${runBase(id)}/files/uploaded`, { name, cid })).data,
|
|
1160
|
+
metadata: async (id, userAddress) => (await post(`${runBase(id)}/metadata`, { userAddress })).data,
|
|
1161
|
+
/** Guests who still need a wallet deployed; the ones who already have one are recorded on the run. */
|
|
1162
|
+
resolveWallets: async (id) => (await post(`${runBase(id)}/wallets/resolve`)).data.pending,
|
|
1163
|
+
registerWallet: async (id, request) => (await post(`${runBase(id)}/wallets`, request)).data,
|
|
1164
|
+
confirmCollection: (id) => confirm(`${runCollectionBase(id)}/confirm`),
|
|
1165
|
+
confirmTier: (id) => confirm(`${runTierBase(id)}/confirm`),
|
|
1166
|
+
confirmBatch: (id, index) => confirm(`${runBatchBase(id, index)}/confirm`)
|
|
1167
|
+
};
|
|
1168
|
+
return {
|
|
1169
|
+
authorizedFetch,
|
|
1170
|
+
runBase,
|
|
1171
|
+
runBatchBase,
|
|
1172
|
+
runCollectionBase,
|
|
1173
|
+
runTierBase,
|
|
1174
|
+
ticketing,
|
|
1175
|
+
list: async () => (await call(runsUrl)).data,
|
|
1176
|
+
get: async (id) => (await call(`${runBase(id)}`)).data,
|
|
1177
|
+
create: async (service, spec) => (await post(runsUrl, { service, spec })).data,
|
|
1178
|
+
update: async (id, spec) => (await call(`${runBase(id)}`, { method: "PATCH", body: JSON.stringify({ spec }) })).data,
|
|
1179
|
+
cancel: async (id) => (await post(`${runBase(id)}/cancel`)).data,
|
|
1180
|
+
checkoutWithCredits: async (id) => (await post(`${runBase(id)}/checkout`, { method: "credits" })).data,
|
|
1181
|
+
checkoutFromWallet: async (id, intentId) => (await post(`${runBase(id)}/checkout`, { method: "wallet", intentId })).data,
|
|
1182
|
+
uploadUrl: async (id, name) => (await post(`${runBase(id)}/files/upload-url`, { name })).data.url,
|
|
1183
|
+
uploaded: async (id, name, cid) => (await post(`${runBase(id)}/files/uploaded`, { name, cid })).data,
|
|
1184
|
+
itemMetadata: async (id, index, userAddress) => (await post(`${runBase(id)}/items/${index}/metadata`, { userAddress })).data,
|
|
1185
|
+
confirmBatch: async (id, index) => {
|
|
1186
|
+
const { status, data } = await post(
|
|
1187
|
+
`${runBase(id)}/batches/${index}/confirm`
|
|
1188
|
+
);
|
|
1189
|
+
return { pending: status === 202, status: data.status, completed: data.completed };
|
|
1190
|
+
},
|
|
1191
|
+
confirmCollection: async (id) => {
|
|
1192
|
+
const { status, data } = await post(`${runBase(id)}/collection/confirm`);
|
|
1193
|
+
return { pending: status === 202, status: data.status };
|
|
1194
|
+
}
|
|
1195
|
+
};
|
|
1196
|
+
}
|
|
1197
|
+
|
|
960
1198
|
// src/constants.ts
|
|
961
1199
|
var SN = getCoordinates("STARKNET");
|
|
962
1200
|
var STARKNET_MARKETPLACE_721_CONTRACT = SN.marketplace721;
|
|
@@ -2068,6 +2306,7 @@ exports.OPEN_LICENSES = OPEN_LICENSES;
|
|
|
2068
2306
|
exports.POLICY_REFUSAL_CODES = POLICY_REFUSAL_CODES;
|
|
2069
2307
|
exports.PasskeyCancelledError = PasskeyCancelledError;
|
|
2070
2308
|
exports.RESERVED_TRAITS = RESERVED_TRAITS;
|
|
2309
|
+
exports.RunRequestError = RunRequestError;
|
|
2071
2310
|
exports.STARKNET_COLLECTION_1155_CLASS_HASH = STARKNET_COLLECTION_1155_CLASS_HASH;
|
|
2072
2311
|
exports.STARKNET_COLLECTION_1155_CONTRACT = STARKNET_COLLECTION_1155_CONTRACT;
|
|
2073
2312
|
exports.STARKNET_COLLECTION_1155_FACTORY_CLASS_HASH = STARKNET_COLLECTION_1155_FACTORY_CLASS_HASH;
|
|
@@ -2115,6 +2354,7 @@ exports.collectionHref = collectionHref;
|
|
|
2115
2354
|
exports.createBackendProxyHandler = createBackendProxyHandler;
|
|
2116
2355
|
exports.createFailoverFetch = createFailoverFetch;
|
|
2117
2356
|
exports.createImageProxyHandler = createImageProxyHandler;
|
|
2357
|
+
exports.createLaunchpadRunsClient = createLaunchpadRunsClient;
|
|
2118
2358
|
exports.createRpcProxyHandler = createRpcProxyHandler;
|
|
2119
2359
|
exports.encodeU256 = encodeU256;
|
|
2120
2360
|
exports.formatAmount = formatAmount;
|
|
@@ -2128,11 +2368,13 @@ exports.getStarknetCoordinates = getStarknetCoordinates;
|
|
|
2128
2368
|
exports.getTokenByAddress = getTokenByAddress;
|
|
2129
2369
|
exports.getTokenBySymbol = getTokenBySymbol;
|
|
2130
2370
|
exports.hasCapability = hasCapability;
|
|
2371
|
+
exports.isDataTokenizationRun = isDataTokenizationRun;
|
|
2131
2372
|
exports.isPolicyRefusal = isPolicyRefusal;
|
|
2132
2373
|
exports.isPrivateHost = isPrivateHost;
|
|
2133
2374
|
exports.isPrivateOrInsecureUrl = isPrivateOrInsecureUrl;
|
|
2134
2375
|
exports.isSameOrigin = isSameOrigin;
|
|
2135
2376
|
exports.isServiceId = isServiceId;
|
|
2377
|
+
exports.isTicketingRun = isTicketingRun;
|
|
2136
2378
|
exports.isTransientRpcError = isTransientRpcError;
|
|
2137
2379
|
exports.isValidIpfsCidPath = isValidIpfsCidPath;
|
|
2138
2380
|
exports.issueAccountSessionToken = issueAccountSessionToken;
|