From 20ee5bc185b5814d0c2a49b701954707d3836c80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Muhammed=20Tanr=C4=B1kulu?= Date: Fri, 1 Dec 2023 19:26:39 +0100 Subject: [PATCH] improve url origin verification (#43) --- package.json | 2 +- src/specs/erc1155.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 1217408..e5ed1bd 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "version": "0.3.4", + "version": "0.3.5", "license": "MIT", "main": "dist/index.js", "module": "dist/index.esm.js", diff --git a/src/specs/erc1155.ts b/src/specs/erc1155.ts index b101c0b..3277d92 100644 --- a/src/specs/erc1155.ts +++ b/src/specs/erc1155.ts @@ -11,7 +11,7 @@ const abi = [ function getMarketplaceAPIKey(uri: string, options?: AvatarResolverOpts) { if ( - uri.startsWith('https://api.opensea.io') && + uri.startsWith('https://api.opensea.io/') && options?.apiKey?.['opensea'] ) { return { 'X-API-KEY': options.apiKey.opensea }; @@ -28,7 +28,7 @@ export default class ERC1155 { options?: AvatarResolverOpts ) { // exclude opensea api which does not follow erc1155 spec - const tokenIDHex = !tokenID.startsWith('https://api.opensea.io') + const tokenIDHex = !tokenID.startsWith('https://api.opensea.io/') ? tokenID.replace('0x', '').padStart(64, '0') : tokenID; const contract = new Contract(contractAddress, abi, provider);