Skip to content

Commit

Permalink
fix: keystone approvals, bridge amount too low, spend approval dollar…
Browse files Browse the repository at this point in the history
… value (#85)
  • Loading branch information
meeh0w authored Nov 6, 2024
1 parent 8e61a2a commit b2c65b2
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
6 changes: 4 additions & 2 deletions src/background/vmModules/ApprovalController.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,8 @@ describe('src/background/vmModules/ApprovalController', () => {
inputs: btcTx.inputs,
outputs: btcTx.outputs,
}),
btcNetwork
btcNetwork,
action.tabId
);

expect(await promise).toEqual({
Expand Down Expand Up @@ -270,7 +271,8 @@ describe('src/background/vmModules/ApprovalController', () => {
inputs: btcTx.inputs,
outputs: btcTx.outputs,
}),
btcNetwork
btcNetwork,
action.tabId
);

expect(await promise).toEqual({ signedData: signedTx });
Expand Down
6 changes: 5 additions & 1 deletion src/background/vmModules/ApprovalController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,11 @@ export class ApprovalController implements IApprovalController {
case RpcMethod.BITCOIN_SEND_TRANSACTION:
case RpcMethod.BITCOIN_SIGN_TRANSACTION:
case RpcMethod.ETH_SEND_TRANSACTION:
return await this.#walletService.sign(signingData.data, network);
return await this.#walletService.sign(
signingData.data,
network,
action.tabId
);

default:
throw new Error('Unrecognized method: ' + params.request.method);
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Bridge/components/BridgeForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ export const BridgeForm = ({
const [neededGas, setNeededGas] = useState(0n);

useEffect(() => {
if (minimum && amount.lt(minimum)) {
if (minimum && amount.gt(0) && amount.lt(minimum)) {
setIsAmountTooLow(true);
} else {
setIsAmountTooLow(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,13 +133,7 @@ export function TokenSpendLimit({
displayValue: isInfinite
? t('Unlimited')
: (diffItemValue as TokenUnit).toDisplay(),
usdPrice:
isInfinite || !approval.usdPrice
? undefined
: String(
(diffItemValue as TokenUnit).toDisplay({ asNumber: true }) *
Number(approval.usdPrice)
),
usdPrice: approval.usdPrice,
}}
/>
</Stack>
Expand Down

0 comments on commit b2c65b2

Please sign in to comment.