-
Notifications
You must be signed in to change notification settings - Fork 58
Rename PriceSchema to AmountSchema #529
Conversation
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 will work fine but I dislike the duplication just for a different error message
src/schema/shared.ts
Outdated
@@ -84,6 +84,13 @@ export const RawDateSchema = z.date().transform((i) => { | |||
return BigNumber.from(Math.floor(i.getTime() / 1000)); | |||
}); | |||
|
|||
export const AirdropQuantitySchema = z |
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 think we already have an alias for Price that is "Amount" - can you use that instead?
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.
not sure what you mean here, I added this because I realized the error message for airdrop when invalid quantity was wrong
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.
lets just call this AmountSchema
and use it for the Amount
type
src/schema/shared.ts
Outdated
@@ -84,6 +84,13 @@ export const RawDateSchema = z.date().transform((i) => { | |||
return BigNumber.from(Math.floor(i.getTime() / 1000)); | |||
}); | |||
|
|||
export const AirdropQuantitySchema = z |
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.
lets just call this AmountSchema
and use it for the Amount
type
…into ni/use-custom-schema-for-airdrop
@@ -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); |
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 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>; |
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.
why did you change this one? this should not be changed
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.
talked offline
So we get a correct error message if they submit an invalid quantity