-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* some working code * reworked backend js for modules * add backend files back * fixing menu.js * minor fix from service * fixing test file --------- Co-authored-by: Ale Kennedy <[email protected]>
- Loading branch information
1 parent
f9da55c
commit 7d7fcf2
Showing
25 changed files
with
163 additions
and
190 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Binary file renamed
BIN
+19.2 KB
...ripts/frontend/assets/greenbackground.png → ...ces/ui/website/assets/greenbackground.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import App from './app.js'; | ||
|
||
const app = new App('http://0.0.0.0:3000'); | ||
|
||
const sdk = new MetaMaskSDK.MetaMaskSDK({ | ||
dappMetadata: { | ||
name: 'Pure JS example', | ||
url: window.location.host, | ||
}, | ||
logging: { | ||
sdk: false, | ||
}, | ||
}); | ||
|
||
$.ajaxSetup({ | ||
contentType: 'application/json; charset=utf-8', | ||
}); | ||
|
||
window.onload = function () { | ||
app.Init(); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,71 +1,80 @@ | ||
class Engine { | ||
url; | ||
token; | ||
#url; | ||
#token; | ||
|
||
// ------------------------------------------------------------------------- | ||
|
||
constructor(url) { | ||
this.url = url; | ||
this.#url = url; | ||
} | ||
|
||
// ------------------------------------------------------------------------- | ||
|
||
async isConnected() { | ||
return (token != null) ? true : false; | ||
async #isConnected() { | ||
return this.#token != null ? true : false; | ||
} | ||
|
||
async config() { | ||
async Config() { | ||
try { | ||
const result = await $.ajax({ | ||
type: "get", | ||
url: `${this.url}/v1/game/config` | ||
type: 'get', | ||
url: `${this.#url}/v1/game/config`, | ||
}); | ||
|
||
return [result, null]; | ||
} | ||
|
||
catch (e) { | ||
} catch (e) { | ||
return [null, parseError(e)]; | ||
} | ||
} | ||
|
||
async connect(address, chainId, dateTime, sigature) { | ||
async Connect(address, chainId, dateTime, sigature) { | ||
try { | ||
this.token = null; | ||
this.#token = null; | ||
|
||
const result = await $.ajax({ | ||
type: "post", | ||
url: `${this.url}/v1/game/connect`, | ||
data: `{"address":"${address}","chainId":${chainId},"dateTime":"${dateTime}","sig":"${sigature}"}` | ||
type: 'post', | ||
url: `${this.#url}/v1/game/connect`, | ||
data: `{"address":"${address}","chainId":${chainId},"dateTime":"${dateTime}","sig":"${sigature}"}`, | ||
}); | ||
|
||
this.token = result.token; | ||
this.#token = result.token; | ||
|
||
return null; | ||
} | ||
|
||
catch (e) { | ||
} catch (e) { | ||
return [null, parseError(e)]; | ||
} | ||
} | ||
|
||
async tables() { | ||
async Tables() { | ||
try { | ||
if (!this.isConnected) { | ||
return [null, "not connected to game engine"]; | ||
return [null, 'not connected to game engine']; | ||
} | ||
|
||
const tables = await $.ajax({ | ||
type: "get", | ||
url: `${this.url}/v1/game/tables`, | ||
headers: { "Authorization": "Bearer " + this.token } | ||
type: 'get', | ||
url: `${this.#url}/v1/game/tables`, | ||
headers: {Authorization: 'Bearer ' + this.#token}, | ||
}); | ||
|
||
return [tables, null]; | ||
} | ||
|
||
catch (e) { | ||
} catch (e) { | ||
return [null, parseError(e)]; | ||
} | ||
} | ||
} | ||
|
||
export default Engine; | ||
|
||
// ============================================================================= | ||
|
||
function parseError(e) { | ||
switch (true) { | ||
case 'responseJSON' in e: | ||
return e.responseJSON.error; | ||
case 'responseText' in e: | ||
return e.responseText; | ||
} | ||
|
||
return 'no error field identified'; | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.