Clarification on Lazy Minting with signature

Hello, I’m implementing this functionality found here:

and am looking at this code snippet starting on line 40:

NFT: [
          { name: 'tokenId', type: 'uint256' },
          { name: 'account', type: 'address' },

These tokens are coming from the json file here:

I understand all of this code except what is happening in the original signature from the owner authorizing the token to be redeemed. What is this “account” found in the key value pair of the token? Is this the address the token will be minted at? How is this calculated?

In the actual smart contract we have

    require(_verify(signer, _hash(account, tokenId), signature), "Invalid signature");

where “account” is the same one assigned to each token. Can someone help clarify what this is? I don’t think its the buyer address, because how could the seller sign off on selling to a particular address before they even know who is going to buy it?

Furthermore, in the mint function in the redeem function, this is called:

_safeMint(account, tokenId);

where again account is the one specified in the tokens.json file. I don’t understand why we would mint to this address

Hey, I was looking into this workshop and had the same question. Did you ever find an answer?

Sorry we missed this question.

account is who will receive that particular token. Whether it is a buyer or someone who earned the token through other means will depend on what you want to implement with this pattern.

The pattern described in the workshop is mostly designed for distributing tokens once you have a list of accounts and the token that each will receive.

If you want to use the cryptographic tools for selling to yet unknown buyers, you'll need to adapt it in some way!

1 Like