@rabbitholegg/questdk
Advanced tools
Comparing version 2.0.0-alpha.43 to 2.0.0-alpha.44
@@ -7,10 +7,32 @@ "use strict"; | ||
async function fetchERC1155Metadata(client, contractAddress, tokenId) { | ||
const tokenURI = await client.readContract({ | ||
let tokenURI = await client.readContract({ | ||
address: contractAddress, | ||
abi: [ | ||
'function uri(uint256 tokenId) external view returns (string memory)', | ||
{ | ||
inputs: [ | ||
{ | ||
internalType: 'uint256', | ||
name: 'tokenId', | ||
type: 'uint256', | ||
}, | ||
], | ||
name: 'uri', | ||
outputs: [ | ||
{ | ||
internalType: 'string', | ||
name: '', | ||
type: 'string', | ||
}, | ||
], | ||
stateMutability: 'view', | ||
type: 'function', | ||
}, | ||
], | ||
functionName: 'uri', | ||
args: [tokenId], | ||
args: [BigInt(tokenId)], | ||
}); | ||
if (tokenURI.startsWith('ipfs://')) { | ||
const ipfsIdentifier = tokenURI.split('/').slice(2).join('/'); | ||
tokenURI = `https://ipfs.io/ipfs/${ipfsIdentifier}`; | ||
} | ||
const response = await axios_1.default.get(tokenURI); | ||
@@ -17,0 +39,0 @@ return response.data; |
@@ -7,10 +7,32 @@ "use strict"; | ||
async function fetchERC721Metadata(client, contractAddress, tokenId) { | ||
const tokenURI = await client.readContract({ | ||
let tokenURI = await client.readContract({ | ||
address: contractAddress, | ||
abi: [ | ||
'function tokenURI(uint256 tokenId) external view returns (string memory)', | ||
{ | ||
inputs: [ | ||
{ | ||
internalType: 'uint256', | ||
name: 'tokenId', | ||
type: 'uint256', | ||
}, | ||
], | ||
name: 'tokenURI', | ||
outputs: [ | ||
{ | ||
internalType: 'string', | ||
name: '', | ||
type: 'string', | ||
}, | ||
], | ||
stateMutability: 'view', | ||
type: 'function', | ||
}, | ||
], | ||
functionName: 'tokenURI', | ||
args: [tokenId], | ||
args: [BigInt(tokenId)], | ||
}); | ||
if (tokenURI.startsWith('ipfs://')) { | ||
const ipfsIdentifier = tokenURI.split('/').slice(2).join('/'); | ||
tokenURI = `https://ipfs.io/ipfs/${ipfsIdentifier}`; | ||
} | ||
const response = await axios_1.default.get(tokenURI); | ||
@@ -17,0 +39,0 @@ return response.data; |
@@ -13,10 +13,32 @@ import fetchQuestActionParams from '../quests/fetchQuestData.js'; | ||
export async function fetchERC1155Metadata(client, contractAddress, tokenId) { | ||
const tokenURI = await client.readContract({ | ||
let tokenURI = await client.readContract({ | ||
address: contractAddress, | ||
abi: [ | ||
'function uri(uint256 tokenId) external view returns (string memory)', | ||
{ | ||
inputs: [ | ||
{ | ||
internalType: 'uint256', | ||
name: 'tokenId', | ||
type: 'uint256', | ||
}, | ||
], | ||
name: 'uri', | ||
outputs: [ | ||
{ | ||
internalType: 'string', | ||
name: '', | ||
type: 'string', | ||
}, | ||
], | ||
stateMutability: 'view', | ||
type: 'function', | ||
}, | ||
], | ||
functionName: 'uri', | ||
args: [tokenId], | ||
args: [BigInt(tokenId)], | ||
}); | ||
if (tokenURI.startsWith('ipfs://')) { | ||
const ipfsIdentifier = tokenURI.split('/').slice(2).join('/'); | ||
tokenURI = `https://ipfs.io/ipfs/${ipfsIdentifier}`; | ||
} | ||
const response = await axios.get(tokenURI); | ||
@@ -23,0 +45,0 @@ return response.data; |
@@ -13,10 +13,32 @@ import fetchQuestActionParams from '../quests/fetchQuestData.js'; | ||
export async function fetchERC721Metadata(client, contractAddress, tokenId) { | ||
const tokenURI = await client.readContract({ | ||
let tokenURI = await client.readContract({ | ||
address: contractAddress, | ||
abi: [ | ||
'function tokenURI(uint256 tokenId) external view returns (string memory)', | ||
{ | ||
inputs: [ | ||
{ | ||
internalType: 'uint256', | ||
name: 'tokenId', | ||
type: 'uint256', | ||
}, | ||
], | ||
name: 'tokenURI', | ||
outputs: [ | ||
{ | ||
internalType: 'string', | ||
name: '', | ||
type: 'string', | ||
}, | ||
], | ||
stateMutability: 'view', | ||
type: 'function', | ||
}, | ||
], | ||
functionName: 'tokenURI', | ||
args: [tokenId], | ||
args: [BigInt(tokenId)], | ||
}); | ||
if (tokenURI.startsWith('ipfs://')) { | ||
const ipfsIdentifier = tokenURI.split('/').slice(2).join('/'); | ||
tokenURI = `https://ipfs.io/ipfs/${ipfsIdentifier}`; | ||
} | ||
const response = await axios.get(tokenURI); | ||
@@ -23,0 +45,0 @@ return response.data; |
{ | ||
"name": "@rabbitholegg/questdk", | ||
"description": "", | ||
"version": "2.0.0-alpha.43", | ||
"version": "2.0.0-alpha.44", | ||
"files": [ | ||
@@ -6,0 +6,0 @@ "dist", |
@@ -18,11 +18,33 @@ import fetchQuestActionParams from '../quests/fetchQuestData.js' | ||
): Promise<any> { | ||
const tokenURI: string = await (client.readContract({ | ||
let tokenURI: string = await (client.readContract({ | ||
address: contractAddress as Address, | ||
abi: [ | ||
'function uri(uint256 tokenId) external view returns (string memory)', | ||
{ | ||
inputs: [ | ||
{ | ||
internalType: 'uint256', | ||
name: 'tokenId', | ||
type: 'uint256', | ||
}, | ||
], | ||
name: 'uri', | ||
outputs: [ | ||
{ | ||
internalType: 'string', | ||
name: '', | ||
type: 'string', | ||
}, | ||
], | ||
stateMutability: 'view', | ||
type: 'function', | ||
}, | ||
], | ||
functionName: 'uri', | ||
args: [tokenId], | ||
args: [BigInt(tokenId)], | ||
}) as Promise<string>) | ||
if (tokenURI.startsWith('ipfs://')) { | ||
const ipfsIdentifier = tokenURI.split('/').slice(2).join('/') | ||
tokenURI = `https://ipfs.io/ipfs/${ipfsIdentifier}` | ||
} | ||
const response = await axios.get(tokenURI) | ||
@@ -29,0 +51,0 @@ return response.data |
@@ -18,11 +18,33 @@ import fetchQuestActionParams from '../quests/fetchQuestData.js' | ||
): Promise<any> { | ||
const tokenURI: string = await (client.readContract({ | ||
let tokenURI: string = await (client.readContract({ | ||
address: contractAddress as Address, | ||
abi: [ | ||
'function tokenURI(uint256 tokenId) external view returns (string memory)', | ||
{ | ||
inputs: [ | ||
{ | ||
internalType: 'uint256', | ||
name: 'tokenId', | ||
type: 'uint256', | ||
}, | ||
], | ||
name: 'tokenURI', | ||
outputs: [ | ||
{ | ||
internalType: 'string', | ||
name: '', | ||
type: 'string', | ||
}, | ||
], | ||
stateMutability: 'view', | ||
type: 'function', | ||
}, | ||
], | ||
functionName: 'tokenURI', | ||
args: [tokenId], | ||
args: [BigInt(tokenId)], | ||
}) as Promise<string>) | ||
if (tokenURI.startsWith('ipfs://')) { | ||
const ipfsIdentifier = tokenURI.split('/').slice(2).join('/') | ||
tokenURI = `https://ipfs.io/ipfs/${ipfsIdentifier}` | ||
} | ||
const response = await axios.get(tokenURI) | ||
@@ -29,0 +51,0 @@ return response.data |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
150970
2563