-
Notifications
You must be signed in to change notification settings - Fork 310
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(Trader): refetch data every 20 seconds (#11852)
* fix(Trader): refetch data every 20 seconds * fix: add bridge bunge refuel * fix: validate custom gas settings * fixup! fix: add bridge bunge refuel * fix: run codegen --------- Co-authored-by: swkatmask <[email protected]>
- Loading branch information
Showing
22 changed files
with
426 additions
and
163 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
packages/plugins/Trader/src/SiteAdaptor/trader/views/NetworkFee/schema.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { t } from '@lingui/macro' | ||
import { isGreaterThan, isLessThan } from '@masknet/web3-shared-base' | ||
import { useMemo } from 'react' | ||
import { z as zod } from 'zod' | ||
|
||
const gtZero = (v: string) => isGreaterThan(v, 0) | ||
export function useSchema(supported1559: boolean, minGasLimit = 21000) { | ||
const gasLimit = zod | ||
.string() | ||
.min(1, t`Enter gas limit`) | ||
.refine( | ||
(gasLimit) => isGreaterThan(gasLimit, minGasLimit) && isLessThan(gasLimit, 150_000), | ||
t`Gas limit should be between ${minGasLimit} and 15.00M`, | ||
) | ||
return useMemo(() => { | ||
if (supported1559) { | ||
return zod.object({ | ||
gasLimit, | ||
priorityFee: zod.string().refine(gtZero, t`Max base fee should be greater than 0`), | ||
baseFee: zod.string().refine(gtZero, t`Max base fee should be greater than 0`), | ||
}) | ||
} | ||
return zod.object({ | ||
gasLimit, | ||
gasPrice: zod.string().refine(gtZero, t`Gas price should be greater than 0`), | ||
}) | ||
}, [supported1559, minGasLimit]) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.