Beam

Matrix / Swap confirmation shows the typed amount

Swap confirmation shows the typed amount

BalancedKane issue #239Measured on Kane 0.10.9 and 0.10.8

After typing 0.5 into the You pay field and clicking Review swap, the confirmation line reads "You pay 0.5 ETH". The broken page divides the typed amount by ten, so the confirmation reads "You pay 0.05 ETH".

What your agent will do with Beam installed

Use

Assert the confirmation shows You pay 0.5 ETH.

Results

Before each check, Kane does: Type 0.5 into the "You pay" field and click "Review swap".

WordingKaneCorrect pageBroken pageResult
Assert the confirmation shows You pay 0.5 ETH.From the Kane issue0.10.9passedfailedBalanced
0.10.8passedfailedBalanced
Verify the exact visible text of the confirmation line is "You pay 0.5 ETH".Baseline0.10.9passedfailedBalanced
0.10.8passedfailedBalanced

How Kane read the page

Kane turns each wording into code that reads the page. This is the code it recorded:

Assert the confirmation shows You pay 0.5 ETH. Balanced

el(5).innerText.trim() === 'You pay 0.5 ETH'

Verify the exact visible text of the confirmation line is "You pay 0.5 ETH". Balanced

el(5).innerText.trim()

The two pages

These are live. To see the difference, do what Kane does: Type 0.5 into the "You pay" field and click "Review swap".

Correct page Kane should passOpen full page
Source
<!doctype html><html lang="en"><head><meta charset="utf-8"><title>Swap</title><style>body{font:18px system-ui,sans-serif;margin:24px}input,button{font-size:18px;padding:8px}</style></head><body>
<h1>Swap</h1>
<label for="pay">You pay</label>
<input id="pay" type="text" inputmode="decimal">
<button id="review">Review swap</button>
<p id="confirm" role="status"></p>
<script>
  document.getElementById('review').addEventListener('click', () => {
    const v = document.getElementById('pay').value.trim();
    document.getElementById('confirm').textContent = 'You pay ' + v + ' ETH';
  });
</script></body></html>
Broken page Kane should failOpen full page
Source
<!doctype html><html lang="en"><head><meta charset="utf-8"><title>Swap</title><style>body{font:18px system-ui,sans-serif;margin:24px}input,button{font-size:18px;padding:8px}</style></head><body>
<h1>Swap</h1>
<label for="pay">You pay</label>
<input id="pay" type="text" inputmode="decimal">
<button id="review">Review swap</button>
<p id="confirm" role="status"></p>
<script>
  document.getElementById('review').addEventListener('click', () => {
    const v = document.getElementById('pay').value.trim();
    document.getElementById('confirm').textContent = 'You pay ' + (parseFloat(v) / 10) + ' ETH';
  });
</script></body></html>

Reproduce it

Clone the repo, then run this behavior on your own Kane:

npm run suite -- confirm-amount