2023-03-14 17:15:57 +00:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html lang="en">
|
|
|
|
<head>
|
|
|
|
<meta charset="UTF-8"/>
|
|
|
|
<script src="./sm2.js"></script>
|
|
|
|
<script src="./cryptico.iife.js"></script>
|
|
|
|
<script src="../lib/index.js"></script>
|
|
|
|
<script>
|
|
|
|
function print(string) {
|
|
|
|
document.write(`${string}\n\n`)
|
|
|
|
}
|
|
|
|
|
2023-03-15 02:06:49 +00:00
|
|
|
const url = 'ws://127.0.0.1:18000/SCIDE/SCExecutor'
|
2023-03-14 17:15:57 +00:00
|
|
|
|
|
|
|
const client = new bdcontract.WsClient(
|
|
|
|
url,
|
|
|
|
(ev) => {
|
2023-03-15 02:06:49 +00:00
|
|
|
console.log("onOpen:"+JSON.stringify(ev))
|
|
|
|
invokeContract()
|
2023-03-14 17:15:57 +00:00
|
|
|
},
|
|
|
|
(ev, ws) => {
|
|
|
|
console.log(ev.data)
|
|
|
|
},
|
|
|
|
)
|
2023-03-15 02:06:49 +00:00
|
|
|
function invokeContract(){
|
|
|
|
setTimeout(async () => {
|
2023-03-14 17:15:57 +00:00
|
|
|
const status = client.status()
|
|
|
|
console.log(status)
|
|
|
|
try {
|
|
|
|
let data = await client.executeContract(
|
|
|
|
'AnnotationExample0608',
|
|
|
|
'main',
|
|
|
|
'abacd',
|
|
|
|
)
|
|
|
|
print(JSON.stringify(data))
|
|
|
|
|
|
|
|
data = await client.executeContract(
|
|
|
|
'NonExistentContract',
|
|
|
|
'random',
|
|
|
|
'abacd',
|
|
|
|
)
|
|
|
|
print(JSON.stringify(data))
|
|
|
|
} catch (data) {
|
|
|
|
print(JSON.stringify(data))
|
|
|
|
}
|
|
|
|
}, 1000)
|
2023-03-15 02:06:49 +00:00
|
|
|
}
|
|
|
|
|
2023-03-14 17:15:57 +00:00
|
|
|
</script>
|
|
|
|
<link rel="icon" type="image/svg+xml" href="favicon.svg"/>
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
|
|
|
<title>Vite App</title>
|
|
|
|
</head>
|
|
|
|
<body></body>
|
|
|
|
</html>
|