Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
Atomic Swap
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kirti
Atomic Swap
Commits
b14e6ce5
Commit
b14e6ce5
authored
Nov 26, 2022
by
kirtisingh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Linked backend with Blockchains
parent
49466459
Changes
5
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
333 additions
and
25 deletions
+333
-25
app.js
app.js
+306
-2
public/script.js
public/script.js
+15
-14
public/style.css
public/style.css
+3
-0
views/index.ejs
views/index.ejs
+5
-6
views/orderbook.ejs
views/orderbook.ejs
+4
-3
No files found.
app.js
View file @
b14e6ce5
This diff is collapsed.
Click to expand it.
public/script.js
View file @
b14e6ce5
...
...
@@ -150,14 +150,14 @@ async function printOrderListOnt(hashlock){
}
// console.log(typeof(val));
ls
.
innerHTML
=
`<table>
<tr><td>Initiator ONT Address:</td> <td>
${
orderList
[
"
initiatorOntAddress
"
]}
</td></tr>
<tr><td>Initiator ETH Address:</td> <td>
${
orderList
[
"
initiatorEthAddress
"
]}
</td></tr>
<tr><td>Buyer ONT Address:</td> <td>
${
orderList
[
"
buyerOntAddress
"
]}
</td></tr>
<tr><td>Buyer ETH Address:</td> <td>
${
orderList
[
"
buyerEthAddress
"
]}
</td></tr>
<tr><td>Amount Ont:</td> <td>
${
orderList
[
"
amountOnt
"
]}
</td></tr>
<tr><td>Refund Time:</td> <td>
${
t
}
</td></tr>
<tr><td>Secret:</td> <td>
${
orderList
[
"
secret
"
]}
</td></tr>
<tr><td>Status:</td> <td>
${
orderList
[
"
status
"
]}
</td></tr>
<tr><td
class="pd"
>Initiator ONT Address:</td> <td>
${
orderList
[
"
initiatorOntAddress
"
]}
</td></tr>
<tr><td
class="pd"
>Initiator ETH Address:</td> <td>
${
orderList
[
"
initiatorEthAddress
"
]}
</td></tr>
<tr><td
class="pd"
>Buyer ONT Address:</td> <td>
${
orderList
[
"
buyerOntAddress
"
]}
</td></tr>
<tr><td
class="pd"
>Buyer ETH Address:</td> <td>
${
orderList
[
"
buyerEthAddress
"
]}
</td></tr>
<tr><td
class="pd"
>Amount Ont:</td> <td>
${
orderList
[
"
amountOnt
"
]}
</td></tr>
<tr><td
class="pd"
>Refund Time:</td> <td>
${
t
}
</td></tr>
<tr><td
class="pd"
>Secret:</td> <td>
${
orderList
[
"
secret
"
]}
</td></tr>
<tr><td
class="pd"
>Status:</td> <td>
${
orderList
[
"
status
"
]}
</td></tr>
</table>`
;
// console.log(orderList);
var
slides
=
document
.
getElementsByName
(
"
hashlock
"
);
...
...
@@ -247,19 +247,20 @@ async function notifyforstateineth(){
// }, 10000);
// }
const
sleep
=
ms
=>
new
Promise
(
resolve
=>
setTimeout
(
resolve
,
ms
));
//
const sleep = ms => new Promise(resolve => setTimeout(resolve, ms));
async
function
getBidTimeLock
(
hashlock
,
tid
){
if
(
tid
==
"
bidtimer1
"
){
await
initiateBidding
(
hashlock
);
await
sleep
(
10000
);
document
.
getElementById
(
'
todb
'
).
submit
();
// await sleep(10000);
}
const
orderList
=
await
window
.
contract2
.
methods
.
orderList
(
hashlock
).
call
();
var
tl
=
parseInt
(
orderList
[
"
bidTimelock
"
]);
if
(
tid
==
"
bidtimer1
"
){
document
.
getElementById
(
'
bidTimelock3
'
).
value
=
timeConverter
(
tl
);
document
.
getElementById
(
'
todb
'
).
submit
();
}
//
if(tid == "bidtimer1"){
//
document.getElementById('bidTimelock3').value=timeConverter(tl);
//
}
countdown
(
tid
,
tl
);
}
...
...
public/style.css
View file @
b14e6ce5
...
...
@@ -40,6 +40,9 @@ td, th {
text-align
:
left
;
padding
:
8px
;
}
.pd
{
padding
:
8px
;
}
tr
:nth-child
(
even
)
{
background-color
:
#dddddd
;
...
...
views/index.ejs
View file @
b14e6ce5
...
...
@@ -13,7 +13,6 @@
<script
src=
"https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"
></script>
</head>
<body>
<h1
class=
"centeralign"
"
>
Atomic Swap
</h1>
<br
>
<div
class=
"centeralign"
>
...
...
@@ -22,7 +21,7 @@
<button
type=
"button"
class=
"btn btn-primary"
id=
"ETHBut"
onclick=
"hideElement('ONT'); showElement('ETH');"
>
ETH
</button>
</div>
<hr>
<div
class=
"centeralign"
id =
"ONT"
>
<div
class=
"centeralign
setmargin
"
id =
"ONT"
>
<!-- ORDER STATUS -->
<div>
...
...
@@ -109,10 +108,10 @@
</div>
<iframe
name=
"votar"
style=
"display:none;"
></iframe>
<form
id=
"todb"
action=
"/txns"
method=
"post"
target=
"votar"
>
<form
id=
"todb"
action=
"/txns"
method=
"post"
target=
"votar"
style=
"display:none;"
>
<input
type=
"hidden"
name=
"hashlock"
id=
"hash12"
><br><br>
<input
type=
"hidden"
name=
"amountOnt"
id=
"amountOnt3"
><br><br>
<input
type=
"hidden"
name=
"bidTimelock"
id=
"bidTimelock3"
><br><br>
<
!-- <
input type="hidden" name="amountOnt" id="amountOnt3"><br><br>
<input type="hidden" name="bidTimelock" id="bidTimelock3"><br><br>
-->
<input
style=
"display: none;"
type=
"submit"
value=
"Send to Database"
>
</form>
...
...
@@ -154,7 +153,7 @@
</div>
<hr>
</div>
<div>
<div
class=
"setmargin"
>
Status:
<span
id=
"status"
>
Loading...
</span>
</div>
...
...
views/orderbook.ejs
View file @
b14e6ce5
<html
lang=
"en"
>
<head>
<meta
charset=
'utf-8'
>
<
!-- <meta http-equiv='X-UA-Compatible' content='IE=edge'> --
>
<
!-- <meta http-equiv="refresh" content="15"> --
>
<
meta
http-equiv=
'X-UA-Compatible'
content=
'IE=edge'
>
<
meta
http-equiv=
"refresh"
content=
"10"
>
<title><
%=
title
%
></title>
<meta
name=
'viewport'
content=
'width=device-width, initial-scale=1'
>
<script
src=
'/web3.min.js'
></script>
<link
rel=
"stylesheet"
href=
"/style.css"
>
<link
rel=
"stylesheet"
href=
"https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css"
>
<script
src=
"https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"
></script>
...
...
@@ -22,6 +23,7 @@
<
%
txns.forEach(txn =
>
{
%
>
<tr>
<td><
%=
txn
.
hashlock
%
></td>
<
%
%
>
<td><
%=
txn
.
amountOnt
%
></td>
<td><
%=
txn
.
bidTimelock
%
></td>
</tr>
...
...
@@ -30,7 +32,6 @@
<
%
}
else
{
%
>
<p>
There are no transactions to display...
</p>
<
%
}
%
>
</div>
</body>
</html>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment