-
-
Notifications
You must be signed in to change notification settings - Fork 195
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Added approveTokenPermission to Cypress API (#1209)
* fix: Properly exported Cypress for metamask * feat: Add approveTokenPermission to Cypress API * fix: GasSettings type --------- Co-authored-by: drptbl <[email protected]>
- Loading branch information
Showing
11 changed files
with
198 additions
and
46 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
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,26 @@ | ||
import { z } from 'zod' | ||
|
||
export const GasSettingValidation = z.union([ | ||
z.literal('low'), | ||
z.literal('market'), | ||
z.literal('aggressive'), | ||
z.literal('site'), | ||
z | ||
.object({ | ||
maxBaseFee: z.number(), | ||
priorityFee: z.number(), | ||
// TODO: Add gasLimit range validation. | ||
gasLimit: z.number().optional() | ||
}) | ||
.superRefine(({ maxBaseFee, priorityFee }, ctx) => { | ||
if (priorityFee > maxBaseFee) { | ||
ctx.addIssue({ | ||
code: z.ZodIssueCode.custom, | ||
message: 'Max base fee cannot be lower than priority fee', | ||
path: ['MetaMask', 'confirmTransaction', 'gasSetting', 'maxBaseFee'] | ||
}) | ||
} | ||
}) | ||
]) | ||
|
||
export type GasSettings = z.input<typeof GasSettingValidation> |
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
Oops, something went wrong.