-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
57 lines (48 loc) · 1.46 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Converter</title>
</head>
<body>
<p>
<label for="inputAbi">ABI</label>
<br/>
<textarea id="inputAbi" rows="5" style="width: 100%"></textarea>
</p>
<p>
<label for="inputData">Data</label>
<br/>
<textarea id="inputData" rows="5" style="width: 100%"></textarea>
</p>
<p>
<label>Output:</label>
<br/>
<span id="output" style="word-break: break-all"></span>
</p>
<script type="module">
import init, {mapTonCellIntoEthBytes} from './pkg/eth_ton_abi_converter.js';
async function run() {
await init();
const output = document.getElementById('output');
const inputAbi = document.getElementById('inputAbi');
const inputData = document.getElementById('inputData');
const onChange = () => {
const abi = inputAbi.value;
const data = inputData.value;
console.log(abi, data);
try {
output.innerText = mapTonCellIntoEthBytes(abi, data);
} catch (e) {
output.innerText = e.toString();
}
}
inputAbi.addEventListener('change', onChange);
inputData.addEventListener('change', onChange);
}
run();
</script>
</body>
</html>