-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
143 lines (118 loc) · 5.6 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
<!doctype html>
<head>
<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
<meta content="utf-8" http-equiv="encoding">
</head>
<script src="./dist/lib-neopt-core.js"></script>
<script>
console.log("lib-neopt-core (Neo3CppLib object): " + Neo3CppLib);
console.log("Neo3CppLib.myOnInit:" + Neo3CppLib.myOnInit);
//
Neo3CppLib.myOnInit(
function () {
console.log("INITIALIZED lib-neopt-core!");
// can use functions now!
document.getElementById('lib_hash').innerHTML = Neo3CppLib.mymodule['core-hash'];
document.getElementById('lib_date').innerHTML = Neo3CppLib.mymodule['core-date'];
document.getElementById('all_methods').value =
(Object.getOwnPropertyNames(Neo3CppLib).filter(function (p) {
return typeof Neo3CppLib[p] === 'function';
}));
document.getElementById('all_methods').value =
document.getElementById('all_methods').value.replace(/,/g, '\n')
}
);
//
</script>
<script>
function testConversionToVerification() {
let csbiginteger = Neo3CppLib.csbiginteger;
console.log(csbiginteger);
var vx = csbiginteger.csBigInteger("92417421609284060097852441734141491128266387380656748836951019715045385777354", 10)
var vy = csbiginteger.csBigInteger("81306213973968698003399946097148256829885864908442466985789085263601870844340", 10)
var ecpoint = {
"X": vx.toHexString(),
"Y": vy.toHexString(),
"curve": "secp256r1"
};
var strJson = JSON.stringify(ecpoint);
console.log(strJson);
var strInp = " ";
//var vout = neoptFib.cpp_SmartContract_Contract_CreateSignatureRedeemScript(strJson); //Module.cpp_SmartContract_Contract_CreateSignatureRedeemScript(strJson);
var vout = Neo3CppLib.Neo3_SmartContract_Contract_CreateSignatureRedeemScript(strJson); //Module.cpp_SmartContract_Contract_CreateSignatureRedeemScript(strJson);
//var vout = neoptFib.Neo3.Contract_CreateSignatureRedeemScript(strJson);
output = "out='" + vout + "'";
console.log(output);
return output;
}
</script>
<body>
<h2>neopt-sdk-js</h2>
<a href="https://github.com/NeoResearch/neo-cpp-core/tree/master/packages/lib-neopt-core-js"
target="_blank"><b>Neo3CppLib:</b></a>
<div id="lib_hash">loading...</div>
<b>Core Date:</b>
<div id="lib_date">loading...</div>
<br />
This is a <a href="https://neoresearch.io/neopt-sdk-js/demo/" target="_blank">demo</a> for <a href="https://github.com/neoresearch/neopt-sdk-js" target="_blank">neopt-sdk-js</a>,
a JavaScript SDK for <a href="https://github.com/neo-project/neo" target="_blank">Neo3 Blockchain</a>.
<br /> <br />
<i>
This project is based on C++ projects <a href="https://github.com/neoresearch/neopt" target="_blank">neopt</a>,
<a href="https://github.com/neoresearch/csbiginteger-cpp" target="_blank">csbiginteger-cpp</a>,
<a href="https://github.com/neoresearch/libcrypton" target="_blank">libcrypton</a> and
<a href="https://github.com/neoresearch/neo-cpp-core" target="_blank">neo-cpp-core</a>.
<br />
It also depends on JS project <a href="https://github.com/neoresearch/csbiginteger-js"
target="_blank">csbiginteger-js</a>.
</i>
<br /><br />
<b>Feel free to try interactive boxes below and experiment the SDK online 😉</b>
<h3>Wallets</h3>
<!--
Neo3CppLib.Neo3_Wallets_wHelper_ToScriptHash
Neo3CppLib.Neo3_Wallets_wHelper_ToAddress
Neo3CppLib.Neo3_SmartContract_scHelper_ToScriptHash
Neo3CppLib.Neo3_SmartContract_Contract_CreateSignatureRedeemScript
-->
Address: <input type="text" id="whelper_toscripthash" value="NSh6STZ6K4jUVDNZHwYSLc4ViuEm9Q1JtU" />
ScriptHash: <input type="text" id="whelper_toscripthash_output" readonly></input>
<button id="whelper_toscripthash_btn" onclick="test_Neo3_Wallets_wHelper_ToScriptHash()">
Neo3_Wallets_wHelper_ToScriptHash
</button>
<br /><br />
ScriptHash: <input type="text" id="whelper_toaddress" value="0x0eec9e10f6491c39f3e8dbc8af7186282487594a" />
Address: <input type="text" id="whelper_toaddress_output" readonly></input>
<button id="whelper_toscripthash_btn" onclick="test_Neo3_Wallets_wHelper_ToAddress()">
Neo3_Wallets_wHelper_ToAddress
</button>
<br /><br />
<h3>SmartContract</h3>
...
<h3>API Methods</h3>
<i>Neo3CppLib.(api_method_name)</i><br />
<textarea id="all_methods" cols=70 rows=6 readonly></textarea>
<h3>More...</h3>
This is under construction. See console for some messages.
<br /><br />
<i>Special thanks to <a href="https://github.com/emscripten-core/emscripten" target="_blank">Emscripten</a> project,
it saves us many hours of coding!</i>
<br /><br />
Made with ♥ by <a href="https://neoresearch.io" target="_blank">NeoResearch Community</a> (2020).
<br /> <br />
</body>
<script>
function test_Neo3_Wallets_wHelper_ToScriptHash() {
document.getElementById('whelper_toscripthash_output').value =
Neo3CppLib.Neo3_Wallets_wHelper_ToScriptHash(
document.getElementById('whelper_toscripthash').value
);
}
function test_Neo3_Wallets_wHelper_ToAddress() {
document.getElementById('whelper_toaddress_output').value =
Neo3CppLib.Neo3_Wallets_wHelper_ToAddress(
document.getElementById('whelper_toaddress').value
);
}
</script>
</html>