From 2fdb69dd445a8a8858b1f8869d31acd425ed245f Mon Sep 17 00:00:00 2001 From: joaquim-verges Date: Thu, 24 Oct 2024 08:41:20 +0000 Subject: [PATCH] optimize: improve mintAdditionalSupplyTo efficiency (#5148) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Problem solved Short description of the bug fixed or feature added --- ## PR-Codex overview This PR focuses on optimizing the `mintAdditionalSupplyTo` function in the `erc1155` extension by modifying how the token URI is handled during the minting process. ### Detailed summary - Removed the retrieval of the existing token URI from the contract. - Set the `uri` field to an empty string, indicating the contract will maintain the existing token URI. - Kept the `to`, `tokenId`, and `amount` fields unchanged. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` --- .changeset/olive-wombats-prove.md | 5 +++++ .../extensions/erc1155/write/mintAdditionalSupplyTo.ts | 8 +------- 2 files changed, 6 insertions(+), 7 deletions(-) create mode 100644 .changeset/olive-wombats-prove.md diff --git a/.changeset/olive-wombats-prove.md b/.changeset/olive-wombats-prove.md new file mode 100644 index 00000000000..9cb3bf7ace3 --- /dev/null +++ b/.changeset/olive-wombats-prove.md @@ -0,0 +1,5 @@ +--- +"thirdweb": patch +--- + +Optimize mintAdditionalSupplyTo diff --git a/packages/thirdweb/src/extensions/erc1155/write/mintAdditionalSupplyTo.ts b/packages/thirdweb/src/extensions/erc1155/write/mintAdditionalSupplyTo.ts index 84f99ed6ea9..26d93e4309b 100644 --- a/packages/thirdweb/src/extensions/erc1155/write/mintAdditionalSupplyTo.ts +++ b/packages/thirdweb/src/extensions/erc1155/write/mintAdditionalSupplyTo.ts @@ -38,16 +38,10 @@ export function mintAdditionalSupplyTo( return MintTo.mintTo({ contract: options.contract, asyncParams: async () => { - // we'll be re-using the exising token URI - const tokenUri = await URI.uri({ - contract: options.contract, - tokenId: options.tokenId, - }); - return { to: options.to, tokenId: options.tokenId, - uri: tokenUri, + uri: "", // contract will maintain the existing token URI amount: options.supply, }; },