Skip to content
This repository was archived by the owner on Aug 30, 2022. It is now read-only.

Conversation

nachoiacovino
Copy link
Contributor

So we get a correct error message if they submit an invalid quantity

@nachoiacovino nachoiacovino requested a review from jnsdls July 28, 2022 19:14
Copy link
Member

@jnsdls jnsdls left a comment

Choose a reason for hiding this comment

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

this will work fine but I dislike the duplication just for a different error message

return BigNumber.from(Math.floor(i.getTime() / 1000));
});

export const AirdropQuantitySchema = z
Copy link
Member

Choose a reason for hiding this comment

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

I think we already have an alias for Price that is "Amount" - can you use that instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

not sure what you mean here, I added this because I realized the error message for airdrop when invalid quantity was wrong

Copy link
Member

Choose a reason for hiding this comment

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

lets just call this AmountSchema and use it for the Amount type

return BigNumber.from(Math.floor(i.getTime() / 1000));
});

export const AirdropQuantitySchema = z
Copy link
Member

Choose a reason for hiding this comment

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

lets just call this AmountSchema and use it for the Amount type

@nachoiacovino nachoiacovino changed the title Use custom schema for airdrop Rename PriceSchema to AmountSchema Aug 23, 2022
) {
const metadata = await fetchCurrencyMetadata(provider, currencyAddress);
return utils.parseUnits(PriceSchema.parse(inputPrice), metadata.decimals);
return utils.parseUnits(AmountSchema.parse(inputPrice), metadata.decimals);
Copy link
Member

Choose a reason for hiding this comment

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

this was PriceSchema - why is it changed?

* @public
*/
export type Price = z.input<typeof PriceSchema>;
export type Price = z.input<typeof AmountSchema>;
Copy link
Member

Choose a reason for hiding this comment

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

why did you change this one? this should not be changed

Copy link
Member

@joaquim-verges joaquim-verges left a comment

Choose a reason for hiding this comment

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

talked offline

@joaquim-verges joaquim-verges merged commit 0a8183f into main Aug 24, 2022
@joaquim-verges joaquim-verges deleted the ni/use-custom-schema-for-airdrop branch August 24, 2022 18:46
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants