-
Notifications
You must be signed in to change notification settings - Fork 19
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
base: development
Are you sure you want to change the base?
Optional NFT Types #90
Conversation
@whilefoo rfc |
@0x4007 why did we want to make them optional in the first place? |
It isn't required for ERC20 Permits #69 (comment) |
@luisantoniocrag, this task has been idle for a while. Please provide an update. |
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; |
There was a problem hiding this comment.
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
if (!_nftContractAddress) { | ||
const errorMessage = "NFT contract address is not defined"; | ||
_logger.error(errorMessage); | ||
throw new Error(errorMessage); | ||
} | ||
|
There was a problem hiding this comment.
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"); |
There was a problem hiding this comment.
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
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"); |
There was a problem hiding this comment.
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
Alright, thanks @whilefoo! done ✅ |
Resolves #88