@zoralabs/nft-metadata
Advanced tools
Comparing version 1.2.4 to 1.2.5
@@ -1,4 +0,3 @@ | ||
export declare function isIPFS(uri: string): any; | ||
export declare function hasIpfsPrefix(uri: string): boolean; | ||
export declare function getIPFSUrl(uri: string, gateway: string): any; | ||
export declare function isIPFS(uri: string): boolean; | ||
export declare function getIPFSUrl(uri: string, gateway: string): string; | ||
export declare function getPrivateGateway(chainName: string, tokenAddress: string): "https://ipfsgateway.makersplace.com" | "https://ipfs.foundation.app" | "https://zora-prod.mypinata.cloud" | undefined; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getPrivateGateway = exports.getIPFSUrl = exports.hasIpfsPrefix = exports.isIPFS = void 0; | ||
exports.getPrivateGateway = exports.getIPFSUrl = exports.isIPFS = void 0; | ||
const addresses_1 = require("../utils/addresses"); | ||
const gateway_tools_1 = require("../utils/gateway-tools"); | ||
const addresses_2 = require("../constants/addresses"); | ||
const IPFSGatewayTools = require('@pinata/ipfs-gateway-tools/dist/node'); | ||
const gatewayTools = new IPFSGatewayTools(); | ||
function isIPFS(uri) { | ||
const result = gatewayTools.containsCID(uri); | ||
// TODO - this lib is not working right so hack for now | ||
return result.containsCid && (uri.includes('/ipfs/') || hasIpfsPrefix(uri)); | ||
return !!gateway_tools_1.getCID(uri); | ||
} | ||
exports.isIPFS = isIPFS; | ||
function hasIpfsPrefix(uri) { | ||
return uri.startsWith('ipfs://'); | ||
} | ||
exports.hasIpfsPrefix = hasIpfsPrefix; | ||
function getIPFSUrl(uri, gateway) { | ||
if (isIPFS(uri)) { | ||
return gatewayTools.convertToDesiredGateway(uri, gateway); | ||
if (gateway_tools_1.getCID(uri)) { | ||
return gateway_tools_1.convertToDesiredGateway(uri, gateway); | ||
} | ||
@@ -22,0 +15,0 @@ return uri; |
{ | ||
"name": "@zoralabs/nft-metadata", | ||
"version": "1.2.4", | ||
"version": "1.2.5", | ||
"description": "Generic nft metadata parsers", | ||
@@ -14,3 +14,2 @@ "author": "Zora", | ||
"dependencies": { | ||
"@pinata/ipfs-gateway-tools": "1.1.6", | ||
"@zoralabs/core": "^1.0.7", | ||
@@ -20,2 +19,3 @@ "axios": "^0.22.0", | ||
"cross-fetch": "^3.1.4", | ||
"is-ipfs": "6.0.2", | ||
"node-abort-controller": "^2.0.0" | ||
@@ -22,0 +22,0 @@ }, |
66901
52
1717
+ Addedis-ipfs@6.0.2
+ Addedis-ipfs@6.0.2(transitive)
+ Addedmafmt@10.0.0(transitive)
+ Addedmultiaddr@10.0.1(transitive)
- Removed@pinata/ipfs-gateway-tools@1.1.6
- Removed@multiformats/base-x@4.0.1(transitive)
- Removed@pinata/ipfs-gateway-tools@1.1.6(transitive)
- Removedcids@1.1.9(transitive)
- Removedis-ipfs@5.0.0(transitive)
- Removedmafmt@9.0.0(transitive)
- Removedmultiaddr@9.0.2(transitive)
- Removedmultibase@4.0.6(transitive)
- Removedmulticodec@3.2.1(transitive)
- Removedmultihashes@4.0.3(transitive)
- Removeduint8arrays@2.1.10(transitive)
- Removedvarint@5.0.2(transitive)