-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
50 lines (44 loc) · 1.34 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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>TON PHP PROOF CHECK</title>
</head>
<body>
<div class="ton_connect_wrap">
<div class="ton_connect" id="ton-connect"></div>
</div>
<script src="https://unpkg.com/@tonconnect/ui@latest/dist/tonconnect-ui.min.js"></script>
<script type="text/javascript">
const tonConnectUI = new TON_CONNECT_UI.TonConnectUI({
manifestUrl: 'tonconnect-manifest.json',
buttonRootId: 'ton-connect',
items: [
{"name": "ton_addr"},
{"name": "ton_proof", "payload": "rand"}
]
});
tonConnectUI.setConnectRequestParameters({
state: "ready",
value: {
tonProof: 'rand'
}
});
tonConnectUI.onStatusChange(wallet => {
if (wallet && wallet.connectItems?.tonProof && 'proof' in wallet.connectItems.tonProof)
{
console.log(wallet.account);
checkProofInYourBackend(wallet.connectItems.tonProof.proof, wallet.account);
}
});
async function connectToWallet() {
const connectedWallet = await tonConnectUI.connectWallet();
}
function checkProofInYourBackend(proof, wallet) {
// SEND PROOF AND WALLET
}
connectToWallet();
</script>
</body>
</html>