@zoralabs/protocol-sdk 0.13.5 → 0.13.7
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/.turbo/turbo-build.log +15 -15
- package/CHANGELOG.md +19 -0
- package/dist/allow-list/allow-list-client.d.ts.map +1 -1
- package/dist/anvil.d.ts.map +1 -1
- package/dist/apis/chain-constants.d.ts.map +1 -1
- package/dist/apis/http-api-base.d.ts.map +1 -1
- package/dist/apis/network-config.d.ts.map +1 -1
- package/dist/create/create-client.d.ts.map +1 -1
- package/dist/create/minter-defaults.d.ts.map +1 -1
- package/dist/create/token-setup.d.ts.map +1 -1
- package/dist/fixtures/mint-query-results.d.ts.map +1 -1
- package/dist/fixtures/rewards-query-results.d.ts.map +1 -1
- package/dist/index.cjs +46 -68
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +43 -65
- package/dist/index.js.map +1 -1
- package/dist/ipfs/mimeTypes.d.ts.map +1 -1
- package/dist/ipfs/token-metadata.d.ts.map +1 -1
- package/dist/mint/mint-queries.d.ts.map +1 -1
- package/dist/mint/types.d.ts.map +1 -1
- package/dist/mint/utils.d.ts.map +1 -1
- package/dist/premint/conversions.d.ts.map +1 -1
- package/dist/premint/premint-api-client.d.ts.map +1 -1
- package/dist/premint/premint-client.d.ts.map +1 -1
- package/dist/premint/preminter.d.ts.map +1 -1
- package/dist/preminter.d.ts.map +1 -1
- package/dist/retries.d.ts.map +1 -1
- package/dist/rewards/rewards-queries.d.ts.map +1 -1
- package/dist/sparks/mints-queries.d.ts.map +1 -1
- package/dist/sparks/sparks-contracts.d.ts.map +1 -1
- package/dist/test-utils.d.ts.map +1 -1
- package/dist/utils.d.ts.map +1 -1
- package/dist/waitForSuccess.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -24,10 +24,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
24
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
25
|
mod
|
|
26
26
|
));
|
|
27
|
-
var __publicField = (obj, key, value) =>
|
|
28
|
-
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
29
|
-
return value;
|
|
30
|
-
};
|
|
27
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
31
28
|
|
|
32
29
|
// ../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/internal/constants.js
|
|
33
30
|
var require_constants = __commonJS({
|
|
@@ -363,6 +360,8 @@ var require_semver = __commonJS({
|
|
|
363
360
|
this.inc("patch", identifier, identifierBase);
|
|
364
361
|
this.inc("pre", identifier, identifierBase);
|
|
365
362
|
break;
|
|
363
|
+
// If the input is a non-prerelease version, this acts the same as
|
|
364
|
+
// prepatch.
|
|
366
365
|
case "prerelease":
|
|
367
366
|
if (this.prerelease.length === 0) {
|
|
368
367
|
this.inc("patch", identifier, identifierBase);
|
|
@@ -390,6 +389,8 @@ var require_semver = __commonJS({
|
|
|
390
389
|
}
|
|
391
390
|
this.prerelease = [];
|
|
392
391
|
break;
|
|
392
|
+
// This probably shouldn't be used publicly.
|
|
393
|
+
// 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.
|
|
393
394
|
case "pre": {
|
|
394
395
|
const base4 = Number(identifierBase) ? 1 : 0;
|
|
395
396
|
if (!identifier && identifierBase === false) {
|
|
@@ -1464,6 +1465,7 @@ var require_min_version = __commonJS({
|
|
|
1464
1465
|
compver.prerelease.push(0);
|
|
1465
1466
|
}
|
|
1466
1467
|
compver.raw = compver.format();
|
|
1468
|
+
/* fallthrough */
|
|
1467
1469
|
case "":
|
|
1468
1470
|
case ">=":
|
|
1469
1471
|
if (!setMin || gt(compver, setMin)) {
|
|
@@ -1473,6 +1475,7 @@ var require_min_version = __commonJS({
|
|
|
1473
1475
|
case "<":
|
|
1474
1476
|
case "<=":
|
|
1475
1477
|
break;
|
|
1478
|
+
/* istanbul ignore next */
|
|
1476
1479
|
default:
|
|
1477
1480
|
throw new Error(`Unexpected operation: ${comparator.operator}`);
|
|
1478
1481
|
}
|
|
@@ -1675,19 +1678,18 @@ var require_subset = __commonJS({
|
|
|
1675
1678
|
sub = new Range(sub, options);
|
|
1676
1679
|
dom = new Range(dom, options);
|
|
1677
1680
|
let sawNonNull = false;
|
|
1678
|
-
OUTER:
|
|
1679
|
-
for (const
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
continue OUTER;
|
|
1685
|
-
}
|
|
1686
|
-
}
|
|
1687
|
-
if (sawNonNull) {
|
|
1688
|
-
return false;
|
|
1681
|
+
OUTER: for (const simpleSub of sub.set) {
|
|
1682
|
+
for (const simpleDom of dom.set) {
|
|
1683
|
+
const isSub = simpleSubset(simpleSub, simpleDom, options);
|
|
1684
|
+
sawNonNull = sawNonNull || isSub !== null;
|
|
1685
|
+
if (isSub) {
|
|
1686
|
+
continue OUTER;
|
|
1689
1687
|
}
|
|
1690
1688
|
}
|
|
1689
|
+
if (sawNonNull) {
|
|
1690
|
+
return false;
|
|
1691
|
+
}
|
|
1692
|
+
}
|
|
1691
1693
|
return true;
|
|
1692
1694
|
};
|
|
1693
1695
|
var minimumVersionWithPreRelease = [new Comparator(">=0.0.0-0")];
|
|
@@ -2067,8 +2069,7 @@ import {
|
|
|
2067
2069
|
PremintConfigVersion
|
|
2068
2070
|
} from "@zoralabs/protocol-deployments";
|
|
2069
2071
|
var convertCollectionFromApi = (collection) => {
|
|
2070
|
-
if (!collection)
|
|
2071
|
-
return void 0;
|
|
2072
|
+
if (!collection) return void 0;
|
|
2072
2073
|
return {
|
|
2073
2074
|
additionalAdmins: collection.additionalAdmins || [],
|
|
2074
2075
|
contractAdmin: collection.contractAdmin,
|
|
@@ -3161,10 +3162,8 @@ function parseSalesConfig(targetStrategy, contractMintFee) {
|
|
|
3161
3162
|
}
|
|
3162
3163
|
}
|
|
3163
3164
|
function isPrimaryMintActive(sale, blockTime) {
|
|
3164
|
-
if (sale.saleStart > blockTime)
|
|
3165
|
-
|
|
3166
|
-
if (!sale.saleEnd)
|
|
3167
|
-
return true;
|
|
3165
|
+
if (sale.saleStart > blockTime) return false;
|
|
3166
|
+
if (!sale.saleEnd) return true;
|
|
3168
3167
|
return sale.saleEnd > blockTime;
|
|
3169
3168
|
}
|
|
3170
3169
|
function isSecondaryMinter(result) {
|
|
@@ -3206,8 +3205,7 @@ function getTargetStrategy({
|
|
|
3206
3205
|
targetStrategy = saleStrategies.find(
|
|
3207
3206
|
({ strategy: { salesStrategy } }) => salesStrategy.saleType === "timed" || salesStrategy.saleType === "fixedPrice" || salesStrategy.saleType === "erc20"
|
|
3208
3207
|
);
|
|
3209
|
-
if (!targetStrategy)
|
|
3210
|
-
throw new Error("Cannot find valid sale strategy");
|
|
3208
|
+
if (!targetStrategy) throw new Error("Cannot find valid sale strategy");
|
|
3211
3209
|
return targetStrategy;
|
|
3212
3210
|
}
|
|
3213
3211
|
}
|
|
@@ -3307,8 +3305,7 @@ var SubgraphMintGetter = class extends SubgraphGetter {
|
|
|
3307
3305
|
tokenAddress
|
|
3308
3306
|
})
|
|
3309
3307
|
);
|
|
3310
|
-
if (!tokens || tokens.length === 0)
|
|
3311
|
-
return [];
|
|
3308
|
+
if (!tokens || tokens.length === 0) return [];
|
|
3312
3309
|
return tokens.filter((x) => x.tokenId !== "0").map(
|
|
3313
3310
|
(token) => parseAndFilterTokenQueryResult({
|
|
3314
3311
|
token,
|
|
@@ -3364,8 +3361,7 @@ var contractSupportsNewMintFunction = (contractVersion) => {
|
|
|
3364
3361
|
return false;
|
|
3365
3362
|
}
|
|
3366
3363
|
const semVerContractVersion = semver.coerce(contractVersion)?.raw;
|
|
3367
|
-
if (!semVerContractVersion)
|
|
3368
|
-
return false;
|
|
3364
|
+
if (!semVerContractVersion) return false;
|
|
3369
3365
|
return semver.gte(semVerContractVersion, "2.9.0");
|
|
3370
3366
|
};
|
|
3371
3367
|
|
|
@@ -3570,8 +3566,7 @@ function makeEthMintCall({
|
|
|
3570
3566
|
if (saleType === "fixedPrice") {
|
|
3571
3567
|
minterArguments = makeFixedPriceMinterArguments({ mintTo, mintComment });
|
|
3572
3568
|
} else if (saleType === "allowlist") {
|
|
3573
|
-
if (!allowListEntry)
|
|
3574
|
-
throw new Error("Missing allowListEntry");
|
|
3569
|
+
if (!allowListEntry) throw new Error("Missing allowListEntry");
|
|
3575
3570
|
minterArguments = makeAllowListMinterArguments({ mintTo, allowListEntry });
|
|
3576
3571
|
} else {
|
|
3577
3572
|
throw new Error("Unsupported sale type");
|
|
@@ -3612,8 +3607,7 @@ function paidMintCost(salesConfig, allowListEntry) {
|
|
|
3612
3607
|
if (salesConfig.saleType === "erc20" || salesConfig.saleType === "fixedPrice") {
|
|
3613
3608
|
return salesConfig.pricePerToken;
|
|
3614
3609
|
}
|
|
3615
|
-
if (allowListEntry)
|
|
3616
|
-
return allowListEntry.price;
|
|
3610
|
+
if (allowListEntry) return allowListEntry.price;
|
|
3617
3611
|
return 0n;
|
|
3618
3612
|
}
|
|
3619
3613
|
function parseMintCosts({
|
|
@@ -3765,8 +3759,7 @@ async function getPremintsOfContractMintable({
|
|
|
3765
3759
|
typeof premint.tokenId === "undefined"
|
|
3766
3760
|
)
|
|
3767
3761
|
);
|
|
3768
|
-
if (offChainPremints.length === 0)
|
|
3769
|
-
return [];
|
|
3762
|
+
if (offChainPremints.length === 0) return [];
|
|
3770
3763
|
const mintFee = await getPremintMintFee({
|
|
3771
3764
|
publicClient,
|
|
3772
3765
|
tokenContract: params.tokenContract
|
|
@@ -3895,8 +3888,7 @@ function toPremintMintReturn({
|
|
|
3895
3888
|
};
|
|
3896
3889
|
}
|
|
3897
3890
|
function getRequiredErc20Approvals(params, salesConfig) {
|
|
3898
|
-
if (salesConfig?.saleType !== "erc20")
|
|
3899
|
-
return void 0;
|
|
3891
|
+
if (salesConfig?.saleType !== "erc20") return void 0;
|
|
3900
3892
|
return {
|
|
3901
3893
|
quantity: salesConfig.pricePerToken * BigInt(params.quantityToMint),
|
|
3902
3894
|
approveTo: salesConfig.address,
|
|
@@ -4136,8 +4128,7 @@ var isFixedPrice = (salesConfig) => {
|
|
|
4136
4128
|
return salesConfig.type === "fixedPrice" || salesConfig.pricePerToken > 0n;
|
|
4137
4129
|
};
|
|
4138
4130
|
var getSalesConfigWithDefaults = (salesConfig, contractName) => {
|
|
4139
|
-
if (!salesConfig)
|
|
4140
|
-
return timedSaleSettingsWithDefaults({}, contractName);
|
|
4131
|
+
if (!salesConfig) return timedSaleSettingsWithDefaults({}, contractName);
|
|
4141
4132
|
if (isAllowList(salesConfig)) {
|
|
4142
4133
|
return allowListWithDefaults(salesConfig);
|
|
4143
4134
|
}
|
|
@@ -4484,8 +4475,7 @@ var contractSupportsMintRewards = (contractVersion, contractStandard) => {
|
|
|
4484
4475
|
return false;
|
|
4485
4476
|
}
|
|
4486
4477
|
const semVerContractVersion = semver2.coerce(contractVersion)?.raw;
|
|
4487
|
-
if (!semVerContractVersion)
|
|
4488
|
-
return false;
|
|
4478
|
+
if (!semVerContractVersion) return false;
|
|
4489
4479
|
if (contractStandard === "ERC1155") {
|
|
4490
4480
|
return semver2.gte(semVerContractVersion, "1.3.5");
|
|
4491
4481
|
} else {
|
|
@@ -5021,8 +5011,7 @@ var mintWithEthParams = ({
|
|
|
5021
5011
|
account
|
|
5022
5012
|
});
|
|
5023
5013
|
var getPaidMintValue = (quantities, pricePerMint) => {
|
|
5024
|
-
if (!pricePerMint || pricePerMint === 0n)
|
|
5025
|
-
return;
|
|
5014
|
+
if (!pricePerMint || pricePerMint === 0n) return;
|
|
5026
5015
|
return quantities.reduce((a, b) => a + b, 0n) * pricePerMint;
|
|
5027
5016
|
};
|
|
5028
5017
|
var mintsBalanceOfAccountParams = ({
|
|
@@ -7010,6 +6999,7 @@ var CID = class _CID {
|
|
|
7010
6999
|
};
|
|
7011
7000
|
function parseCIDtoBytes(source, base4) {
|
|
7012
7001
|
switch (source[0]) {
|
|
7002
|
+
// CIDv0 is parsed differently
|
|
7013
7003
|
case "Q": {
|
|
7014
7004
|
const decoder = base4 ?? base58btc;
|
|
7015
7005
|
return [
|
|
@@ -7077,27 +7067,21 @@ var cidSymbol = Symbol.for("@ipld/js-cid/CID");
|
|
|
7077
7067
|
|
|
7078
7068
|
// src/ipfs/ipfs.ts
|
|
7079
7069
|
function isCID(str) {
|
|
7080
|
-
if (!str)
|
|
7081
|
-
return false;
|
|
7070
|
+
if (!str) return false;
|
|
7082
7071
|
try {
|
|
7083
7072
|
CID.parse(str);
|
|
7084
7073
|
return true;
|
|
7085
7074
|
} catch (e) {
|
|
7086
|
-
if (/^(bafy|Qm)/.test(str))
|
|
7087
|
-
return true;
|
|
7075
|
+
if (/^(bafy|Qm)/.test(str)) return true;
|
|
7088
7076
|
return false;
|
|
7089
7077
|
}
|
|
7090
7078
|
}
|
|
7091
7079
|
function normalizeIPFSUrl(url) {
|
|
7092
|
-
if (!url || typeof url !== "string")
|
|
7093
|
-
return null;
|
|
7080
|
+
if (!url || typeof url !== "string") return null;
|
|
7094
7081
|
url = url.replace(/"/g, "");
|
|
7095
|
-
if (isNormalizedIPFSURL(url))
|
|
7096
|
-
|
|
7097
|
-
if (
|
|
7098
|
-
return `ipfs://${url}`;
|
|
7099
|
-
if (!isIPFSUrl(url))
|
|
7100
|
-
return null;
|
|
7082
|
+
if (isNormalizedIPFSURL(url)) return url;
|
|
7083
|
+
if (isCID(url)) return `ipfs://${url}`;
|
|
7084
|
+
if (!isIPFSUrl(url)) return null;
|
|
7101
7085
|
if (isGatewayIPFSUrl(url)) {
|
|
7102
7086
|
const parsed = new URL(url.replace(/^\/\//, "http://"));
|
|
7103
7087
|
parsed.pathname = parsed.pathname.replace(/^\/ipfs\//, "");
|
|
@@ -7136,8 +7120,7 @@ function arweaveGatewayUrl(normalizedArweaveUrl) {
|
|
|
7136
7120
|
return normalizedArweaveUrl.replace("ar://", `${ARWEAVE_GATEWAY}/`);
|
|
7137
7121
|
}
|
|
7138
7122
|
function ipfsGatewayUrl(url) {
|
|
7139
|
-
if (!url || typeof url !== "string")
|
|
7140
|
-
return null;
|
|
7123
|
+
if (!url || typeof url !== "string") return null;
|
|
7141
7124
|
const normalizedIPFSUrl = normalizeIPFSUrl(url);
|
|
7142
7125
|
if (normalizedIPFSUrl) {
|
|
7143
7126
|
return normalizedIPFSUrl.replace("ipfs://", `${IPFS_GATEWAY}/ipfs/`);
|
|
@@ -7145,10 +7128,8 @@ function ipfsGatewayUrl(url) {
|
|
|
7145
7128
|
return null;
|
|
7146
7129
|
}
|
|
7147
7130
|
function getFetchableUrl(uri) {
|
|
7148
|
-
if (!uri || typeof uri !== "string")
|
|
7149
|
-
|
|
7150
|
-
if (uri.startsWith("http://"))
|
|
7151
|
-
return null;
|
|
7131
|
+
if (!uri || typeof uri !== "string") return null;
|
|
7132
|
+
if (uri.startsWith("http://")) return null;
|
|
7152
7133
|
if (isNormalizeableIPFSUrl(uri)) {
|
|
7153
7134
|
return ipfsGatewayUrl(uri);
|
|
7154
7135
|
}
|
|
@@ -7179,8 +7160,7 @@ var SVG = "image/svg+xml";
|
|
|
7179
7160
|
var TIFF = "image/tiff";
|
|
7180
7161
|
var GIF = "image/gif";
|
|
7181
7162
|
var isImage = (mimeType) => {
|
|
7182
|
-
if (!mimeType)
|
|
7183
|
-
return false;
|
|
7163
|
+
if (!mimeType) return false;
|
|
7184
7164
|
return [JPG, JPEG, PNG, WEBP, SVG, TIFF, GIF].includes(mimeType);
|
|
7185
7165
|
};
|
|
7186
7166
|
var DEFAULT_THUMBNAIL_CID_HASHES = {
|
|
@@ -7252,13 +7232,11 @@ var mimeToMediaType = {
|
|
|
7252
7232
|
[GLB_EXT]: "MODEL" /* MODEL */
|
|
7253
7233
|
};
|
|
7254
7234
|
function mimeTypeToMedia(mimeType) {
|
|
7255
|
-
if (!mimeType)
|
|
7256
|
-
return "UNKNOWN" /* UNKNOWN */;
|
|
7235
|
+
if (!mimeType) return "UNKNOWN" /* UNKNOWN */;
|
|
7257
7236
|
return mimeToMediaType[mimeType] || "UNKNOWN" /* UNKNOWN */;
|
|
7258
7237
|
}
|
|
7259
7238
|
async function getMimeType(uri) {
|
|
7260
|
-
if (!uri)
|
|
7261
|
-
return uri;
|
|
7239
|
+
if (!uri) return uri;
|
|
7262
7240
|
const res = await fetch(uri, { method: "HEAD" });
|
|
7263
7241
|
let mimeType = res.headers.get("content-type");
|
|
7264
7242
|
return mimeType;
|