@manifoldxyz/marketplace-sdk 3.0.10 → 3.0.12
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/lib/MarketplaceListing.js +17 -17
- package/package.json +1 -1
- package/src/lib/MarketplaceListing.ts +20 -16
|
@@ -56,6 +56,7 @@ var APIEndpoints;
|
|
|
56
56
|
APIEndpoints["MAINNET"] = "https://marketplace.api.manifoldxyz.dev";
|
|
57
57
|
APIEndpoints["OPTIMISM"] = "https://optimism.marketplace.api.manifoldxyz.dev";
|
|
58
58
|
APIEndpoints["BASE"] = "https://base.marketplace.api.manifoldxyz.dev";
|
|
59
|
+
APIEndpoints["SEPOLIA"] = "https://sepolia.marketplace.api.manifoldxyz.dev";
|
|
59
60
|
APIEndpoints["CAMPAIGN"] = "https://redeem.api.manifoldxyz.dev";
|
|
60
61
|
})(APIEndpoints || (APIEndpoints = {}));
|
|
61
62
|
const NULL_ADDRESS = '0x0000000000000000000000000000000000000000';
|
|
@@ -1279,24 +1280,23 @@ class MarketplaceListing {
|
|
|
1279
1280
|
let response;
|
|
1280
1281
|
const isArweave = tokenURI.match(/^https:\/\/arweave.net/);
|
|
1281
1282
|
const isIPFS = tokenURI.match(/^https:\/\/ipfs.io/);
|
|
1282
|
-
|
|
1283
|
-
//
|
|
1284
|
-
//
|
|
1285
|
-
if (
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
return response.json();
|
|
1283
|
+
const isOpenSea = tokenURI.match(/^https:\/\/api.opensea.io/);
|
|
1284
|
+
// Attempt a direct fetch of metadata from source server if not OpenSea
|
|
1285
|
+
// OpenSea API now requires an API key, so we need to defer to our server.
|
|
1286
|
+
if (!isOpenSea) {
|
|
1287
|
+
try {
|
|
1288
|
+
response = yield MarketplaceListing._fetchWithTimeout(tokenURI, {}, isArweave || isIPFS ? 2000 : 60000);
|
|
1289
|
+
}
|
|
1290
|
+
catch (error) {
|
|
1291
|
+
console.log(`Error fetching metadata: from ${tokenURI}`, error);
|
|
1292
|
+
// Do nothing
|
|
1293
|
+
}
|
|
1294
|
+
if (response && response.status === 200) {
|
|
1295
|
+
return response.json();
|
|
1296
|
+
}
|
|
1297
1297
|
}
|
|
1298
|
-
// No response, so fallback to server only if Arweave endpoints
|
|
1299
|
-
if (isArweave || isIPFS) {
|
|
1298
|
+
// No response, so fallback to server only if Arweave, IPFS or OpenSea endpoints
|
|
1299
|
+
if (isArweave || isIPFS || isOpenSea) {
|
|
1300
1300
|
response = yield fetch(`${this._getEndpoint()}/token/${tokenAddress}/${tokenId}/metadata`);
|
|
1301
1301
|
if (response.status === 200) {
|
|
1302
1302
|
return response.json();
|
package/package.json
CHANGED
|
@@ -50,6 +50,7 @@ enum APIEndpoints {
|
|
|
50
50
|
MAINNET = 'https://marketplace.api.manifoldxyz.dev',
|
|
51
51
|
OPTIMISM = 'https://optimism.marketplace.api.manifoldxyz.dev',
|
|
52
52
|
BASE = 'https://base.marketplace.api.manifoldxyz.dev',
|
|
53
|
+
SEPOLIA = 'https://sepolia.marketplace.api.manifoldxyz.dev',
|
|
53
54
|
CAMPAIGN = 'https://redeem.api.manifoldxyz.dev',
|
|
54
55
|
}
|
|
55
56
|
|
|
@@ -1592,24 +1593,27 @@ class MarketplaceListing {
|
|
|
1592
1593
|
let response;
|
|
1593
1594
|
const isArweave = tokenURI.match(/^https:\/\/arweave.net/);
|
|
1594
1595
|
const isIPFS = tokenURI.match(/^https:\/\/ipfs.io/);
|
|
1596
|
+
const isOpenSea = tokenURI.match(/^https:\/\/api.opensea.io/);
|
|
1595
1597
|
|
|
1596
|
-
//
|
|
1597
|
-
//
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1598
|
+
// Attempt a direct fetch of metadata from source server if not OpenSea
|
|
1599
|
+
// OpenSea API now requires an API key, so we need to defer to our server.
|
|
1600
|
+
if (!isOpenSea) {
|
|
1601
|
+
try {
|
|
1602
|
+
response = await MarketplaceListing._fetchWithTimeout(
|
|
1603
|
+
tokenURI,
|
|
1604
|
+
{},
|
|
1605
|
+
isArweave || isIPFS ? 2000 : 60000
|
|
1606
|
+
);
|
|
1607
|
+
} catch (error) {
|
|
1608
|
+
console.log(`Error fetching metadata: from ${tokenURI}`, error);
|
|
1609
|
+
// Do nothing
|
|
1610
|
+
}
|
|
1611
|
+
if (response && response.status === 200) {
|
|
1612
|
+
return response.json();
|
|
1613
|
+
}
|
|
1610
1614
|
}
|
|
1611
|
-
// No response, so fallback to server only if Arweave endpoints
|
|
1612
|
-
if (isArweave || isIPFS) {
|
|
1615
|
+
// No response, so fallback to server only if Arweave, IPFS or OpenSea endpoints
|
|
1616
|
+
if (isArweave || isIPFS || isOpenSea) {
|
|
1613
1617
|
response = await fetch(`${this._getEndpoint()}/token/${tokenAddress}/${tokenId}/metadata`);
|
|
1614
1618
|
if (response.status === 200) {
|
|
1615
1619
|
return response.json();
|