Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optional NFT Types #90

Open
wants to merge 4 commits into
base: development
Choose a base branch
from

Conversation

luisantoniocrag
Copy link

Resolves #88

@0x4007
Copy link
Member

0x4007 commented Oct 20, 2024

@whilefoo rfc

@whilefoo
Copy link
Contributor

@0x4007 why did we want to make them optional in the first place?

@0x4007
Copy link
Member

0x4007 commented Oct 21, 2024

It isn't required for ERC20 Permits #69 (comment)

Copy link

@luisantoniocrag, this task has been idle for a while. Please provide an update.

@luisantoniocrag
Copy link
Author

luisantoniocrag commented Nov 4, 2024

Hey! All good? Anything I'm missing? @0x4007

@@ -67,7 +67,8 @@ export async function generateErc721PermitSignature(
_repositoryName = contextOrPermitPayload.repositoryName;
_userId = contextOrPermitPayload.userId;
} else {
const { NFT_MINTER_PRIVATE_KEY, NFT_CONTRACT_ADDRESS } = contextOrPermitPayload.env;
const { NFT_MINTER_PRIVATE_KEY = "", NFT_CONTRACT_ADDRESS = "" } = contextOrPermitPayload.env;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should throw if these are not defined rather than assigning them an empty string. Otherwise I think things are okay

Comment on lines -105 to -110
if (!_nftContractAddress) {
const errorMessage = "NFT contract address is not defined";
_logger.error(errorMessage);
throw new Error(errorMessage);
}

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This block of code was removed since above a validation is already performed when NFT_CONTRACT_ADDRESS is not defined or its string value is empty

@@ -117,7 +117,7 @@ describe("generateErc721PermitSignature", () => {

it("should throw an error if NFT minter private key is not defined", async () => {
delete process.env.NFT_MINTER_PRIVATE_KEY;
await expect(generateErc721PermitSignature(context, "123", "contribution")).rejects.toThrow("Failed to" + " instantiate wallet");
await expect(generateErc721PermitSignature(context, "123", "contribution")).rejects.toThrow("NFT minter" + " private key" + " is not defined");
Copy link
Author

@luisantoniocrag luisantoniocrag Nov 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I Updated the error message in the unit test when NFT_MINTER_PRIVATE_KEY is not defined with a more concise message in this case

@luisantoniocrag
Copy link
Author

luisantoniocrag commented Nov 4, 2024

Done @Keyrxng 👍


if (!NFT_MINTER_PRIVATE_KEY) {
_logger.error("NFT minter private key is not defined");
throw new Error("NFT minter private key is not defined");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can put message in variable to avoid duplicating

@luisantoniocrag
Copy link
Author

Alright, thanks @whilefoo! done ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Optional NFT Types
4 participants