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

Rename PriceSchema to AmountSchema #529

Merged
merged 6 commits into from
Aug 24, 2022

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

@@ -84,6 +84,13 @@ export const RawDateSchema = z.date().transform((i) => {
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

@@ -84,6 +84,13 @@ export const RawDateSchema = z.date().transform((i) => {
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
@@ -32,7 +32,7 @@ export async function normalizePriceValue(
currencyAddress: string,
) {
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?

@@ -39,10 +39,10 @@ export type TokenHolderBalance = { holder: string; balance: CurrencyValue };
* Represents a currency price already formatted. ie. "1" for 1 ether.
* @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