Comparing version 1.1.28 to 1.1.29
{ | ||
"name": "libcip54", | ||
"version": "1.1.28", | ||
"version": "1.1.29", | ||
"description": "Cardano Smart NFT Library", | ||
@@ -5,0 +5,0 @@ "main": "lib/src/index.js", |
@@ -287,3 +287,3 @@ "use strict"; | ||
defaultGroup = "GROUP BY encode(multi_asset.policy, 'hex')"; | ||
defaultSelect = "encode(multi_asset.policy, 'hex') AS UNIT"; | ||
defaultSelect = "encode(multi_asset.policy, 'hex') AS UNIT, "; | ||
defaultCache = 'getUniquePoliciesFromStake'; | ||
@@ -791,2 +791,4 @@ } | ||
}; | ||
if (!src) | ||
return null; | ||
if (src.substring(0, 5) === 'cnft:') { | ||
@@ -807,2 +809,14 @@ // Here we actually recurse | ||
} | ||
else if (src.substring(0, 14) === 'ipfs://ipfs://') { | ||
const res = await axios_1.default.get(IPFS_GATEWAY + src.substring(14), { responseType: 'arraybuffer' }); | ||
if (!result.mediaType) | ||
result.mediaType = res.headers['content-type']; | ||
result.buffer = res.data; | ||
} | ||
else if (src.substring(0, 12) === 'ipfs://ipfs:' || src.substring(0, 12) === 'ipfs:ipfs://') { | ||
const res = await axios_1.default.get(IPFS_GATEWAY + src.substring(12), { responseType: 'arraybuffer' }); | ||
if (!result.mediaType) | ||
result.mediaType = res.headers['content-type']; | ||
result.buffer = res.data; | ||
} | ||
else if (src.substring(0, 5) === 'ar://') { | ||
@@ -844,2 +858,15 @@ const res = await axios_1.default.get(ARWEAVE_GATEWAY + src.substring(5), { responseType: 'arraybuffer' }); | ||
} | ||
else if (src.substring(0, 5) === 'ipfs/') { | ||
const res = await axios_1.default.get(IPFS_GATEWAY + src.substring(5), { responseType: 'arraybuffer' }); | ||
if (!result.mediaType) | ||
result.mediaType = res.headers['content-type']; | ||
result.buffer = res.data; | ||
} | ||
else if (src.length === 46) { | ||
// ipfs hash is 46 bytes long, sometimes people get confused | ||
const res = await axios_1.default.get(IPFS_GATEWAY + src, { responseType: 'arraybuffer' }); | ||
if (!result.mediaType) | ||
result.mediaType = res.headers['content-type']; | ||
result.buffer = res.data; | ||
} | ||
return result; | ||
@@ -846,0 +873,0 @@ }; |
{ | ||
"name": "libcip54", | ||
"version": "1.1.28", | ||
"version": "1.1.29", | ||
"description": "Cardano Smart NFT Library", | ||
@@ -5,0 +5,0 @@ "main": "lib/src/index.js", |
64795
1400