Skip to content

Commit

Permalink
more code reorg
Browse files Browse the repository at this point in the history
  • Loading branch information
ardan-bkennedy committed Mar 17, 2024
1 parent 8c67be0 commit a2f55e7
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 191 deletions.
3 changes: 2 additions & 1 deletion app/services/ui/website/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
<script src="https://c0f4f41c-2f55-4863-921b-sdk-docs.github.io/cdn/metamask-sdk.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
<script src="scripts/system.js"></script>
<script src="scripts/connect.js"></script>
<script src="scripts/engine.js"></script>
<script src="scripts/wallet.js"></script>
<script src="scripts/app.js"></script>
<script src="scripts/events.js"></script>
</head>
<body>
Expand Down
189 changes: 0 additions & 189 deletions app/services/ui/website/scripts/connect.js

This file was deleted.

35 changes: 34 additions & 1 deletion app/services/ui/website/scripts/engine.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,36 @@
async function config(url) {
try {
const result = await $.ajax({
type: "get",
url: `${url}/v1/game/config`
});

return [result, null];
}

catch (e) {
return [null, e.responseJSON];
}
}

async function connectGameEngine(url, address, chainId, dateTime, sigature) {
const data = `{"address":"${address}","chainId":${chainId},"dateTime":"${dateTime}","sig":"${sigature}"}`;

try {
const token = await $.ajax({
type: "post",
url: `${url}/v1/game/connect`,
data: data
});

return [token, null];
}

catch (e) {
return [null, e.responseJSON];
}
}

async function getGameTables(url, token) {
try {
const tables = await $.ajax({
Expand All @@ -14,4 +47,4 @@ async function getGameTables(url, token) {
catch (e) {
return [null, e.responseJSON];
}
}
}

0 comments on commit a2f55e7

Please sign in to comment.