Skip to content

Commit

Permalink
Merge pull request #1486 from AmbireTech/fix/enable-sign-enter
Browse files Browse the repository at this point in the history
Fix / Submit Signing Form On Enter
  • Loading branch information
Ivshti authored Nov 24, 2023
2 parents 1f57d7d + 737e9b8 commit 98d4c94
Showing 1 changed file with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ const Actions = ({
}

const lastTxn = bundle.txns[bundle.txns.length - 1]
const abiCoder = new AbiCoder();
const abiCoder = new AbiCoder()
const gasTankValue = ethers.utils
.parseUnits(value.toFixed(feeToken.decimals), feeToken.decimals)
.toString()
Expand All @@ -253,9 +253,11 @@ const Actions = ({
// add the gas tank transaction
// since it calls the relayer, it consumes only an extra 295 gas
// the data is the encoded gas tank parameters
bundle.txns.push(
[accountPresets.feeCollector, '0', abiCoder.encode(['string', 'uint256', 'string'], ['gasTank', gasTankValue, feeToken.id])]
)
bundle.txns.push([
accountPresets.feeCollector,
'0',
abiCoder.encode(['string', 'uint256', 'string'], ['gasTank', gasTankValue, feeToken.id])
])
}

return new Bundle({
Expand Down Expand Up @@ -390,6 +392,9 @@ const Actions = ({
className={styles.quickAccSigningForm}
onSubmit={(e) => {
e.preventDefault()

if (!form.current.checkValidity()) return
approveTxn({ quickAccCredentials })
}}
>
{signingStatus.confCodeRequired === 'notRequired' && (
Expand Down Expand Up @@ -441,18 +446,16 @@ const Actions = ({
disabled={signingStatus?.inProgress}
className={cn(styles.button, styles.danger)}
onClick={cancelSigning}
type="button"
>
Cancel
</Button>
<Button
variant="primaryGradient"
className={cn(styles.button, styles.confirm)}
loading={signingStatus?.inProgress}
onClick={() => {
if (!form.current.checkValidity()) return
approveTxn({ quickAccCredentials })
}}
testId="confirmSigning"
type="submit"
>
Confirm
</Button>
Expand Down

0 comments on commit 98d4c94

Please sign in to comment.