Skip to content

Commit

Permalink
Update demo-ton-ui.html
Browse files Browse the repository at this point in the history
  • Loading branch information
stels-cs authored Oct 25, 2023
1 parent baa967e commit d8d2599
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion ton-connect-ui/demo-ton-ui.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
<body>
<div class="center">
<button onclick="connectWallet()">Connect wallet</button>
<pre id="log"></pre>
</div>
</body>
<script src="https://unpkg.com/@tonconnect/ui@latest/dist/tonconnect-ui.min.js"></script>
Expand All @@ -32,9 +33,19 @@
restoreConnection: false,
});

tonConnectUI.onStatusChange(wallet => {
log("onStatusChange: "+wallet?.account.address)
})

function log(msg) {
console.log(msg)
const t = document.createTextNode(msg + "\n")
document.getElementById('log').appendChild(t);
}

async function connectWallet() {
const connectedWallet = await tonConnectUI.connectWallet();
console.log('connectedWallet', connectedWallet);
log("connected after connectWallet");
}
</script>
</html>

0 comments on commit d8d2599

Please sign in to comment.