Skip to content

Commit

Permalink
add catapp721
Browse files Browse the repository at this point in the history
  • Loading branch information
opcatbugcloser committed Nov 11, 2024
1 parent ac0af11 commit e0200bd
Show file tree
Hide file tree
Showing 36 changed files with 10,329 additions and 219 deletions.
3 changes: 3 additions & 0 deletions packages/catapp721/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
REACT_APP_TOKEN_ID=2a69e70a240f37694bfb90c97e62ca5745b67a12a8a72bd7dd6f0ea3da0fa06a_0
REACT_APP_TRACKER_URL=https://tracker-fractal-testnet.catprotocol.org/
REACT_APP_NETWORK=fractal-testnet
23 changes: 23 additions & 0 deletions packages/catapp721/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
6 changes: 6 additions & 0 deletions packages/catapp721/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# A cat721 web app sample


This example shows how to integrate with a wallet, sign and send tokens.


38 changes: 38 additions & 0 deletions packages/catapp721/config-overrides.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@

const NodePolyfillPlugin = require('node-polyfill-webpack-plugin');
const { buffer } = require('stream/consumers');
const webpack = require('webpack');
module.exports = function override(config, env) {

config.resolve.fallback = {
fs: false,
path: false,
net: false,
tls: false,
crypto: require.resolve('crypto-browserify'),
stream: require.resolve('stream-browserify'),
assert: require.resolve('assert'),
http: require.resolve('stream-http'),
https: require.resolve('https-browserify'),
os: require.resolve('os-browserify'),
url: require.resolve('url')
}

const scopePluginIndex = config.resolve.plugins.findIndex(
({ constructor }) => constructor && constructor.name === 'ModuleScopePlugin'
);

config.resolve.plugins.splice(scopePluginIndex, 1);

config.plugins.push(new NodePolyfillPlugin({
excludeAliases: ['console']
}))

config.plugins.push(new webpack.ProvidePlugin({
process: 'process/browser',
Buffer: ['buffer', 'Buffer']
}))

console.log('config', config)
return config;
}
60 changes: 60 additions & 0 deletions packages/catapp721/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{
"name": "catapp721",
"version": "0.1.0",
"private": true,
"type": "commonjs",
"dependencies": {
"@bitcoinerlab/secp256k1": "^1.1.1",
"@cat-protocol/cat-smartcontracts": "0.2.8",
"@emotion/react": "^11.13.3",
"@emotion/styled": "^11.13.0",
"@mui/material": "^6.1.1",
"@scure/btc-signer": "^1.4.0",
"@testing-library/jest-dom": "^5.17.0",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
"@types/jest": "^27.5.2",
"@types/node": "^16.18.108",
"@types/react": "^18.3.7",
"@types/react-dom": "^18.3.0",
"bitcoinjs-lib": "^7.0.0-rc.0",
"buffer": "^6.0.3",
"cross-fetch": "^4.0.0",
"decimal.js": "^10.4.3",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-hook-form": "^7.53.0",
"react-scripts": "5.0.1",
"swr": "^2.2.5",
"typescript": "^4.9.5",
"web-vitals": "^2.1.4"
},
"scripts": {
"start": "react-app-rewired start",
"build": "react-app-rewired build",
"test": "react-app-rewired test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"node-polyfill-webpack-plugin": "^2.0.1",
"react-app-rewired": "^2.2.1"
}
}
Binary file added packages/catapp721/public/favicon.ico
Binary file not shown.
43 changes: 43 additions & 0 deletions packages/catapp721/public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="Web site created using create-react-app"
/>
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<!--
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="%PUBLIC_URL%/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`.
-->
<title>CAT721 App</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>
</html>
Binary file added packages/catapp721/public/logo192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added packages/catapp721/public/logo512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions packages/catapp721/public/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"short_name": "CAT721 App",
"name": "CAT721 App Sample",
"icons": [
{
"src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
},
{
"src": "logo192.png",
"type": "image/png",
"sizes": "192x192"
},
{
"src": "logo512.png",
"type": "image/png",
"sizes": "512x512"
}
],
"start_url": ".",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}
3 changes: 3 additions & 0 deletions packages/catapp721/public/robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# https://www.robotstxt.org/robotstxt.html
User-agent: *
Disallow:
48 changes: 48 additions & 0 deletions packages/catapp721/src/App.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
.App {
text-align: center;
}

.App-logo {
height: 40vmin;
pointer-events: none;
}

@media (prefers-reduced-motion: no-preference) {
.App-logo {
animation: App-logo-spin infinite 20s linear;
}
}

.App-header {

display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-size: calc(10px + 2vmin);
}


.App-Body {
background-color: #282c34;

display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-size: calc(10px + 2vmin);
color: white;
}

.App-link {
color: #61dafb;
}

@keyframes App-logo-spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
9 changes: 9 additions & 0 deletions packages/catapp721/src/App.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import React from 'react';
import { render, screen } from '@testing-library/react';
import App from './App';

test('renders learn react link', () => {
render(<App />);
const linkElement = screen.getByText(/learn react/i);
expect(linkElement).toBeInTheDocument();
});
Loading

0 comments on commit e0200bd

Please sign in to comment.