Skip to content

Commit

Permalink
Merge pull request #29 from rairprotocol/create-new-demo-rair-sdk
Browse files Browse the repository at this point in the history
Add new demo-rair-sdk folder
  • Loading branch information
sarora180673 authored Dec 5, 2024
2 parents 97a280b + aacc43a commit a1f253a
Show file tree
Hide file tree
Showing 948 changed files with 116,665 additions and 0 deletions.
1 change: 1 addition & 0 deletions demo-rair-sdk/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
31 changes: 31 additions & 0 deletions demo-rair-sdk/.env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
VITE_NODE_ADDRESS=0x3fD4268B03cce553f180E77dfC14fde00271F9B7
VITE_DIAMONDS_ENABLED=true
VITE_LOG_WEB3=false
VITE_HOME_PAGE=/
VITE_DISABLE_CREATOR_VIEWS=false
VITE_3_TAB_MARKETPLACE_DISABLED=false
VITE_TEST_CONTRACTS=true
DANGEROUSLY_DISABLE_HOST_CHECK=true
VITE_GOOGLE_ANALYTICS=t
VITE_GA_NAME=t

// Optional
// Please go to web3auth to get your free API key
// VITE_WEB3AUTH_CLIENT_ID=<API-KEY>

#upload_progress_host
VITE_UPLOAD_PROGRESS_HOST=http://localhost:5000

VITE_NODE_SOCKET_URI=:5000

//VITE_TESTNET=false

VITE_HTML_META_TITLE=RAIRprotocol | Open-source Deployment Layer
VITE_HTML_META_FAVICON_URI=./favicons/loading-favicon.svg
VITE_HTML_META_IMAGE_URL=https://github.com/rairprotocol/RAIRsite/blob/main/src/assets/images/1500x500.jpg
VITE_HTML_META_AUTHOR=RAIRprotocol | Open-source Deployment Layer
VITE_HTML_META_DESCRIPTION=RAIRTECH is pioneering the future of open-source Web3 deployment. With the creation of RAIRprotocol, enterprises can now access a truly open deployment layer, eliminating API risks and fulfilling the transparent promise of Web3. We support the RAIRprotocol ecosystem with a comprehensive suite of managed services, ensuring seamless and secure integration for your business.
VITE_IPFS_GATEWAY=http://rair.myfilebase.com/ipfs/

VITE_DEFAULT_BLOCKCHAIN=0x2105
VITE_WEB3AUTH_CLIENT_ID=BEfl04Slm6zUDrpxC-r5qgO6cjW2mlXc82z0rvTiNL-JdYTxYQHl7YzyNy4Ja4jq8fUDhysW1hwRDqLM6tYK3-4
26 changes: 26 additions & 0 deletions demo-rair-sdk/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

package-lock.json
12 changes: 12 additions & 0 deletions demo-rair-sdk/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM node:lts AS build

#install dependencies
WORKDIR /usr/src/minting
COPY package.json ./
RUN npm install --force
COPY . /usr/src/minting
WORKDIR /usr/src/minting

EXPOSE 3001

CMD npm start
25 changes: 25 additions & 0 deletions demo-rair-sdk/Dockerfile.prod
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# build environment

FROM node:22.4.0 AS build

WORKDIR /usr/src/minting


COPY package.json ./
COPY yarn.lock ./
RUN yarn install
COPY . /usr/src/minting
#RUN mkdir -p node_modules/.cache && chmod -R 777 node_modules/.cache
RUN yarn build


# production environment

FROM nginx:stable-alpine

COPY --from=build /usr/src/minting/dist /usr/share/nginx/html
COPY --from=build /usr/src/minting/nginx/nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80

# The default parameters to ENTRYPOINT (unless overruled on the command line)
CMD ["nginx", "-g", "daemon off;"]
25 changes: 25 additions & 0 deletions demo-rair-sdk/Dockerfile.prod-new
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# build environment

FROM node:21.2.0 AS build

WORKDIR /usr/src/minting


COPY package.json ./
COPY yarn.lock ./
RUN yarn install
COPY . /usr/src/minting
#RUN mkdir -p node_modules/.cache && chmod -R 777 node_modules/.cache
RUN yarn build


# production environment

FROM nginx:stable-alpine

COPY --from=build /usr/src/minting/dist /usr/share/nginx/html
COPY --from=build /usr/src/minting/nginx-prod/nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80

# The default parameters to ENTRYPOINT (unless overruled on the command line)
CMD ["nginx", "-g", "daemon off;"]
37 changes: 37 additions & 0 deletions demo-rair-sdk/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
![Banner](../assets/img/banner.webp)
[![RAIRmarket](https://img.shields.io/badge/RAIR-market-C67FD1)](https://rair.market)
[![RAIRprotocol](https://img.shields.io/badge/RAIR-protocol-C67FD1)](https://rairprotocol.org)
![License](https://img.shields.io/badge/License-Apache2.0-yellow)
[![Discord](https://img.shields.io/badge/Discord-4950AF)](https://discord.gg/vuBUfB7w)
[![Twitter](https://img.shields.io/twitter/follow/rairprotocol)](https://twitter.com/rairprotocol)

# React + TypeScript + Vite

This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.

Currently, two official plugins are available:

- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh

## Expanding the ESLint configuration

If you are developing a production application, we recommend updating the configuration to enable type aware lint rules:

- Configure the top-level `parserOptions` property like this:

```js
export default {
// other rules...
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
project: ['./tsconfig.json', './tsconfig.node.json'],
tsconfigRootDir: __dirname
}
};
```

- Replace `plugin:@typescript-eslint/recommended` to `plugin:@typescript-eslint/recommended-type-checked` or `plugin:@typescript-eslint/strict-type-checked`
- Optionally add `plugin:@typescript-eslint/stylistic-type-checked`
- Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and add `plugin:react/recommended` & `plugin:react/jsx-runtime` to the `extends` list
10 changes: 10 additions & 0 deletions demo-rair-sdk/commands/run_tsc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

echo "RUN TSC ON MINTER MARKETPLACE"

DIR=$(dirname $0)

# run typescript using the version installed
# in node_modules as a dev dependency

npx tsc -p $DIR/../
22 changes: 22 additions & 0 deletions demo-rair-sdk/docker-defaults.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env sh
set -eu

# As of version 1.19, the official Nginx Docker image supports templates with
# variable substitution. But that uses `envsubst`, which does not allow for
# defaults for missing variables. Here, first use the regular command shell
# to set the defaults:
export API_HOST=${API_HOST:-http://host.docker.internal:5000/api/}

# Due to `set -u` this would fail if not defined and no default was set above
echo "Will proxy requests for /api/* to ${API_HOST}*"

export MS_HOST=${MS_HOST:-http://host.docker.internal:5002/ms/}
echo "Will proxy requests for /api/* to ${MS_HOST}*"

export API_HOST_STREAM=${API_HOST_STREAM:-http://host.docker.internal:5000/stream/}
echo "Will proxy requests for /api/* to ${API_HOST_STREAM}*"

# Finally, let the original Nginx entry point do its work, passing whatever is
# set for CMD. Use `exec` to replace the current process, to trap any signals
# (like Ctrl+C) that Docker may send it:
exec /docker-entrypoint.sh "$@"
48 changes: 48 additions & 0 deletions demo-rair-sdk/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%VITE_HTML_META_FAVICON_URI%" />
<meta prefix="og: http://ogp.me/ns#" />
<title>Demo Rair SDK</title>
<meta name='author' content='%VITE_HTML_META_AUTHOR%' />
<meta name="description" content='%VITE_HTML_META_DESCRIPTION%' />
<meta property="og:title" content='%VITE_HTML_META_TITLE%' />
<meta property="og:description" content='%VITE_HTML_META_DESCRIPTION%' />
<meta property="og:image" content='%VITE_HTML_META_IMAGE_URL%' />
<meta name="twitter:title" content='%VITE_HTML_META_TITLE%' />
<meta name="twitter:description" content='%VITE_HTML_META_DESCRIPTION%' />
<link rel="icon" href='%VITE_HTML_META_FAVICON_URI%' />
<link
rel="apple-touch-icon"
href="%VITE_HTML_META_IMAGE_URL%"
/>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<link href="https://vjs.zencdn.net/7.14.3/video-js.css" rel="stylesheet" />
<link rel="apple-touch-icon" href="./favicons/loading-favicon.svg" />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="/manifest.json" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
</head>
<body>
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-PFTB5D7"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
44 changes: 44 additions & 0 deletions demo-rair-sdk/nginx-prod/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
server {
listen 80;
listen [::]:80;

#Docker DNS
#resolver 127.0.0.11;

server_name localhost;
access_log /var/log/nginx/appstore.access.log;
error_log /var/log/nginx/appstore.error.log;

add_header 'Access-Control-Allow-Origin' 'https://new-api.rair.tech';
add_header 'Access-Control-Allow-Origin' 'https://new-ms.rair.tech';

location / {
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri $uri/ /index.html;
add header Cache-Control "public, max-age=3600, must-revalidate";
}

location /api {
proxy_pass http://rair-node:5000;
client_max_body_size 200000M;
#proxy_set_header X-Forwarded-Proto $scheme;
#proxy_cookie_path ~^/(.+)$ "/$1; secure; SameSite=none";
}

location /stream {
proxy_pass http://rair-node:5000;
#proxy_set_header X-Forwarded-Proto $scheme;
}

location /ms {
proxy_pass http://rair-stream:5002;
client_max_body_size 200000M;
#proxy_set_header X-Forwarded-Proto $scheme;
}

location /socket.io {
proxy_pass http://rair-node:5000;
client_max_body_size 200000M;
}
}
31 changes: 31 additions & 0 deletions demo-rair-sdk/nginx/new-nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
server {
listen 443;
listen [::]:443;

#Docker DNS
#resolver 127.0.0.11;

server_name localhost;
access_log /var/log/nginx/appstore.access.log;
error_log /var/log/nginx/appstore.error.log;

location / {
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}

location /api {
proxy_pass http://rair-node-primary-service:5000;
client_max_body_size 200000M;
}

location /stream {
proxy_pass http://rair-node-primary-service:5000;
}

location /ms {
proxy_pass http://rair-stream-primary:5002;
client_max_body_size 200000M;
}
}
45 changes: 45 additions & 0 deletions demo-rair-sdk/nginx/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
server {
listen 80;
listen [::]:80;

#Docker DNS
#resolver 127.0.0.11;

server_name localhost;
access_log /var/log/nginx/appstore.access.log;
error_log /var/log/nginx/appstore.error.log;

add_header 'Access-Control-Allow-Origin' 'https://new-api.rair.tech';
add_header 'Access-Control-Allow-Origin' 'https://new-ms.rair.tech';
add_header 'Access-Control-Allow-Origin' 'https://api.hotdrops.live';

location / {
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri $uri/ /index.html;
# add header Cache-Control "public, max-age=3600, must-revalidate";
}

location /api {
proxy_pass http://rair-node:5000;
client_max_body_size 200000M;
#proxy_set_header X-Forwarded-Proto $scheme;
#proxy_cookie_path ~^/(.+)$ "/$1; secure; SameSite=none";
}

location /stream {
proxy_pass http://rair-node:5000;
#proxy_set_header X-Forwarded-Proto $scheme;
}

location /ms {
proxy_pass http://rair-stream:5002;
client_max_body_size 200000M;
#proxy_set_header X-Forwarded-Proto $scheme;
}

location /socket.io {
proxy_pass http://rair-node:5000;
client_max_body_size 200000M;
}
}
Loading

0 comments on commit a1f253a

Please sign in to comment.