32 | );
33 | }
34 | };
35 |
36 | ReactDOM.render(
37 |
38 | ,
39 | ,
40 | document.getElementById("root"),
41 | );
42 |
43 | // If you want your app to work offline and load faster, you can change
44 | // unregister() to register() below. Note this comes with some pitfalls.
45 | // Learn more about service workers: https://cra.link/PWA
46 | serviceWorkerRegistration.register();
47 |
--------------------------------------------------------------------------------
/src/service-worker.js:
--------------------------------------------------------------------------------
1 | /* eslint-disable no-restricted-globals */
2 |
3 | // This service worker can be customized!
4 | // See https://developers.google.com/web/tools/workbox/modules
5 | // for the list of available Workbox modules, or add any other
6 | // code you'd like.
7 | // You can also remove this file if you'd prefer not to use a
8 | // service worker, and the Workbox build step will be skipped.
9 |
10 | import { clientsClaim } from "workbox-core";
11 | import { ExpirationPlugin } from "workbox-expiration";
12 | import { precacheAndRoute, createHandlerBoundToURL } from "workbox-precaching";
13 | import { registerRoute } from "workbox-routing";
14 | import { StaleWhileRevalidate } from "workbox-strategies";
15 |
16 | clientsClaim();
17 |
18 | // Precache all of the assets generated by your build process.
19 | // Their URLs are injected into the manifest variable below.
20 | // This variable must be present somewhere in your service worker file,
21 | // even if you decide not to use precaching. See https://cra.link/PWA
22 | precacheAndRoute(self.__WB_MANIFEST);
23 |
24 | // Set up App Shell-style routing, so that all navigation requests
25 | // are fulfilled with your index.html shell. Learn more at
26 | // https://developers.google.com/web/fundamentals/architecture/app-shell
27 | const fileExtensionRegexp = new RegExp("/[^/?]+\\.[^/]+$");
28 | registerRoute(
29 | // Return false to exempt requests from being fulfilled by index.html.
30 | ({ request, url }) => {
31 | // If this isn't a navigation, skip.
32 | if (request.mode !== "navigate") {
33 | return false;
34 | } // If this is a URL that starts with /_, skip.
35 |
36 | if (url.pathname.startsWith("/_")) {
37 | return false;
38 | } // If this looks like a URL for a resource, because it contains // a file extension, skip.
39 |
40 | if (url.pathname.match(fileExtensionRegexp)) {
41 | return false;
42 | } // Return true to signal that we want to use the handler.
43 |
44 | return true;
45 | },
46 | createHandlerBoundToURL(process.env.PUBLIC_URL + "/index.html"),
47 | );
48 |
49 | // An example runtime caching route for requests that aren't handled by the
50 | // precache, in this case same-origin .png requests like those from in public/
51 | registerRoute(
52 | // Add in any other file extensions or routing criteria as needed.
53 | ({ url }) =>
54 | url.origin === self.location.origin && url.pathname.endsWith(".png"), // Customize this strategy as needed, e.g., by changing to CacheFirst.
55 | new StaleWhileRevalidate({
56 | cacheName: "images",
57 | plugins: [
58 | // Ensure that once this runtime cache reaches a maximum size the
59 | // least-recently used images are removed.
60 | new ExpirationPlugin({ maxEntries: 50 }),
61 | ],
62 | }),
63 | );
64 |
65 | // This allows the web app to trigger skipWaiting via
66 | // registration.waiting.postMessage({type: 'SKIP_WAITING'})
67 | self.addEventListener("message", (event) => {
68 | if (event.data && event.data.type === "SKIP_WAITING") {
69 | self.skipWaiting();
70 | }
71 | });
72 |
--------------------------------------------------------------------------------
/src/serviceWorkerRegistration.js:
--------------------------------------------------------------------------------
1 | // This optional code is used to register a service worker.
2 | // register() is not called by default.
3 |
4 | // This lets the app load faster on subsequent visits in production, and gives
5 | // it offline capabilities. However, it also means that developers (and users)
6 | // will only see deployed updates on subsequent visits to a page, after all the
7 | // existing tabs open on the page have been closed, since previously cached
8 | // resources are updated in the background.
9 |
10 | // To learn more about the benefits of this model and instructions on how to
11 | // opt-in, read https://cra.link/PWA
12 |
13 | const isLocalhost = Boolean(
14 | window.location.hostname === "localhost" ||
15 | // [::1] is the IPv6 localhost address.
16 | window.location.hostname === "[::1]" ||
17 | // 127.0.0.0/8 are considered localhost for IPv4.
18 | window.location.hostname.match(
19 | /^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/,
20 | ),
21 | );
22 |
23 | export function register(config) {
24 | if (process.env.NODE_ENV === "production" && "serviceWorker" in navigator) {
25 | // The URL constructor is available in all browsers that support SW.
26 | const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href);
27 | if (publicUrl.origin !== window.location.origin) {
28 | // Our service worker won't work if PUBLIC_URL is on a different origin
29 | // from what our page is served on. This might happen if a CDN is used to
30 | // serve assets; see https://github.com/facebook/create-react-app/issues/2374
31 | return;
32 | }
33 |
34 | window.addEventListener("load", () => {
35 | const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`;
36 |
37 | if (isLocalhost) {
38 | // This is running on localhost. Let's check if a service worker still exists or not.
39 | checkValidServiceWorker(swUrl, config);
40 |
41 | // Add some additional logging to localhost, pointing developers to the
42 | // service worker/PWA documentation.
43 | navigator.serviceWorker.ready.then(() => {
44 | console.log(
45 | "This web app is being served cache-first by a service " +
46 | "worker. To learn more, visit https://cra.link/PWA",
47 | );
48 | });
49 | } else {
50 | // Is not localhost. Just register service worker
51 | registerValidSW(swUrl, config);
52 | }
53 | });
54 | }
55 | }
56 |
57 | function registerValidSW(swUrl, config) {
58 | navigator.serviceWorker
59 | .register(swUrl)
60 | .then((registration) => {
61 | registration.onupdatefound = () => {
62 | const installingWorker = registration.installing;
63 | if (installingWorker == null) {
64 | return;
65 | }
66 | installingWorker.onstatechange = () => {
67 | if (installingWorker.state === "installed") {
68 | if (navigator.serviceWorker.controller) {
69 | // At this point, the updated precached content has been fetched,
70 | // but the previous service worker will still serve the older
71 | // content until all client tabs are closed.
72 | console.log(
73 | "New content is available and will be used when all " +
74 | "tabs for this page are closed. See https://cra.link/PWA.",
75 | );
76 |
77 | // Execute callback
78 | if (config && config.onUpdate) {
79 | config.onUpdate(registration);
80 | }
81 | } else {
82 | // At this point, everything has been precached.
83 | // It's the perfect time to display a
84 | // "Content is cached for offline use." message.
85 | console.log("Content is cached for offline use.");
86 |
87 | // Execute callback
88 | if (config && config.onSuccess) {
89 | config.onSuccess(registration);
90 | }
91 | }
92 | }
93 | };
94 | };
95 | })
96 | .catch((error) => {
97 | console.error("Error during service worker registration:", error);
98 | });
99 | }
100 |
101 | function checkValidServiceWorker(swUrl, config) {
102 | // Check if the service worker can be found. If it can't reload the page.
103 | fetch(swUrl, {
104 | headers: { "Service-Worker": "script" },
105 | })
106 | .then((response) => {
107 | // Ensure service worker exists, and that we really are getting a JS file.
108 | const contentType = response.headers.get("content-type");
109 | if (
110 | response.status === 404 ||
111 | (contentType != null && contentType.indexOf("javascript") === -1)
112 | ) {
113 | // No service worker found. Probably a different app. Reload the page.
114 | navigator.serviceWorker.ready.then((registration) => {
115 | registration.unregister().then(() => {
116 | window.location.reload();
117 | });
118 | });
119 | } else {
120 | // Service worker found. Proceed as normal.
121 | registerValidSW(swUrl, config);
122 | }
123 | })
124 | .catch(() => {
125 | console.log(
126 | "No internet connection found. App is running in offline mode.",
127 | );
128 | });
129 | }
130 |
131 | export function unregister() {
132 | if ("serviceWorker" in navigator) {
133 | navigator.serviceWorker.ready
134 | .then((registration) => {
135 | registration.unregister();
136 | })
137 | .catch((error) => {
138 | console.error(error.message);
139 | });
140 | }
141 | }
142 |
--------------------------------------------------------------------------------
/src/style.css:
--------------------------------------------------------------------------------
1 | .ant-menu-horizontal:not(.ant-menu-dark) > .ant-menu-item:hover::after,
2 | .ant-menu-horizontal:not(.ant-menu-dark) > .ant-menu-submenu:hover::after,
3 | .ant-menu-horizontal:not(.ant-menu-dark) > .ant-menu-item-active::after,
4 | .ant-menu-horizontal:not(.ant-menu-dark) > .ant-menu-submenu-active::after,
5 | .ant-menu-horizontal:not(.ant-menu-dark) > .ant-menu-item-open::after,
6 | .ant-menu-horizontal:not(.ant-menu-dark) > .ant-menu-submenu-open::after,
7 | .ant-menu-horizontal:not(.ant-menu-dark) > .ant-menu-item-selected::after,
8 | .ant-menu-horizontal:not(.ant-menu-dark) > .ant-menu-submenu-selected::after {
9 | border-bottom: 2px solid #21bf96 !important;
10 | }
11 |
12 | .ant-menu-horizontal > .ant-menu-item-selected a,
13 | .ant-menu-horizontal > .ant-menu-item a:hover {
14 | color: #21bf96 !important;
15 | }
16 |
17 | .ant-modal-content {
18 | overflow: auto;
19 | border-radius: 1rem;
20 | }
21 |
22 | .rejected {
23 | opacity: 0.25;
24 | }
25 |
26 | ul {
27 | margin-left: 25px !important;
28 | }
29 |
--------------------------------------------------------------------------------
/src/uikit/Flex/Flex.jsx:
--------------------------------------------------------------------------------
1 | export const Flex = (props) => (
2 |
21 | {props.children}
22 |
23 | );
24 |
--------------------------------------------------------------------------------
/test/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ashbeech/moralis-nft-game/d77e3ecf4c8440394c7e4914bd38f3359410d85d/test/.gitkeep
--------------------------------------------------------------------------------
/truffle-config.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Use this file to configure your truffle project. It's seeded with some
3 | * common settings for different networks and features like migrations,
4 | * compilation and testing. Uncomment the ones you need or modify
5 | * them to suit your project as necessary.
6 | *
7 | * More information about configuration can be found at:
8 | *
9 | * trufflesuite.com/docs/advanced/configuration
10 | *
11 | * To deploy via Infura you'll need a wallet provider (like @truffle/hdwallet-provider)
12 | * to sign your transactions before they're sent to a remote public node. Infura accounts
13 | * are available for free at: infura.io/register.
14 | *
15 | * You'll also need a mnemonic - the twelve word phrase the wallet uses to generate
16 | * public/private key pairs. If you're publishing your code to GitHub make sure you load this
17 | * phrase from a file you've .gitignored so it doesn't accidentally become public.
18 | *
19 | */
20 |
21 | // const HDWalletProvider = require('@truffle/hdwallet-provider');
22 | //
23 | // const fs = require('fs');
24 | // const mnemonic = fs.readFileSync(".secret").toString().trim();
25 |
26 | module.exports = {
27 | contracts_directory: "./contracts",
28 |
29 | /**
30 | * Networks define how you connect to your ethereum client and let you set the
31 | * defaults web3 uses to send transactions. If you don't specify one truffle
32 | * will spin up a development blockchain for you on port 9545 when you
33 | * run `develop` or `test`. You can ask a truffle command to use a specific
34 | * network from the command line, e.g
35 | *
36 | * $ truffle test --network
37 | */
38 |
39 | networks: {
40 | // Useful for testing. The `development` name is special - truffle uses it by default
41 | // if it's defined here and no other network is specified at the command line.
42 | // You should run a client (like ganache-cli, geth or parity) in a separate terminal
43 | // tab if you use this network and you must also set the `host`, `port` and `network_id`
44 | // options below to some value.
45 | //
46 | development: {
47 | host: "127.0.0.1", // Localhost (default: none)
48 | port: 7545, // Standard Ethereum port (default: none)
49 | network_id: "*", // Any network (default: none)
50 | },
51 | // Another network with more advanced options...
52 | // advanced: {
53 | // port: 8777, // Custom port
54 | // network_id: 1342, // Custom network
55 | // gas: 8500000, // Gas sent with each transaction (default: ~6700000)
56 | // gasPrice: 20000000000, // 20 gwei (in wei) (default: 100 gwei)
57 | // from: , // Account to send txs from (default: accounts[0])
58 | // websocket: true // Enable EventEmitter interface for web3 (default: false)
59 | // },
60 | // Useful for deploying to a public network.
61 | // NB: It's important to wrap the provider as a function.
62 | // ropsten: {
63 | // provider: () => new HDWalletProvider(mnemonic, `https://ropsten.infura.io/v3/YOUR-PROJECT-ID`),
64 | // network_id: 3, // Ropsten's id
65 | // gas: 5500000, // Ropsten has a lower block limit than mainnet
66 | // confirmations: 2, // # of confs to wait between deployments. (default: 0)
67 | // timeoutBlocks: 200, // # of blocks before a deployment times out (minimum/default: 50)
68 | // skipDryRun: true // Skip dry run before migrations? (default: false for public nets )
69 | // },
70 | // Useful for private networks
71 | // private: {
72 | // provider: () => new HDWalletProvider(mnemonic, `https://network.io`),
73 | // network_id: 2111, // This network is yours, in the cloud.
74 | // production: true // Treats this network as if it was a public net. (default: false)
75 | // }
76 | },
77 |
78 | // Set default mocha options here, use special reporters etc.
79 | mocha: {
80 | // timeout: 100000
81 | },
82 |
83 | // Configure your compilers
84 | compilers: {
85 | solc: {
86 | version: "0.8.10", // Fetch exact version from solc-bin (default: truffle's version)
87 | // docker: true, // Use "0.5.1" you've installed locally with docker (default: false)
88 | // settings: { // See the solidity docs for advice about optimization and evmVersion
89 | // optimizer: {
90 | // enabled: false,
91 | // runs: 200
92 | // },
93 | // evmVersion: "byzantium"
94 | // }
95 | },
96 | },
97 |
98 | // Truffle DB is currently disabled by default; to enable it, change enabled:
99 | // false to enabled: true. The default storage location can also be
100 | // overridden by specifying the adapter settings, as shown in the commented code below.
101 | //
102 | // NOTE: It is not possible to migrate your contracts to truffle DB and you should
103 | // make a backup of your artifacts to a safe location before enabling this feature.
104 | //
105 | // After you backed up your artifacts you can utilize db by running migrate as follows:
106 | // $ truffle migrate --reset --compile-all
107 | //
108 | // db: {
109 | // enabled: false,
110 | // host: "127.0.0.1",
111 | // adapter: {
112 | // name: "sqlite",
113 | // settings: {
114 | // directory: ".db"
115 | // }
116 | // }
117 | // }
118 | };
119 |
--------------------------------------------------------------------------------