-
Notifications
You must be signed in to change notification settings - Fork 34
feat: fix example and add local UI counter UI #39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| MIT License | ||
|
|
||
| Copyright (c) 2023 Magicblock Pte. Ltd. | ||
|
|
||
| Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| of this software and associated documentation files (the "Software"), to deal | ||
| in the Software without restriction, including without limitation the rights | ||
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| copies of the Software, and to permit persons to whom the Software is | ||
| furnished to do so, subject to the following conditions: | ||
|
|
||
| The above copyright notice and this permission notice shall be included in all | ||
| copies or substantial portions of the Software. | ||
|
|
||
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| SOFTWARE. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| # Ephemeral Counter UI | ||
|
|
||
| This is a React-based UI for the Ephemeral Counter program, which is part of the documentation for integrating with the Ephemeral Rollups. | ||
|
|
||
| ## Overview | ||
|
|
||
| The UI demonstrates the use of Solana's ephemeral rollups with a simple counter program. It showcases an `increment` instruction that can run both on the main network and ephemeral rollup. | ||
|
|
||
| ## Documentation | ||
|
|
||
| For more information, visit: [Ephemeral Rollups Documentation](https://docs.magicblock.gg/Accelerate/ephemeral_rollups). | ||
|
|
||
| ## Getting Started | ||
|
|
||
| ### Prerequisites | ||
|
|
||
| - Node.js | ||
| - npm | ||
|
|
||
| ### Installation | ||
|
|
||
| 1. Navigate to the `app` directory | ||
| 2. Install the dependencies: | ||
|
|
||
|
|
||
| npm install | ||
|
|
||
|
|
||
| ### Running the Application | ||
|
|
||
| To start the application, run: | ||
|
|
||
|
|
||
| npm run dev | ||
|
|
||
|
|
||
| ### Configure RPC endpoints | ||
|
|
||
| This UI talks to two RPC endpoints: | ||
| - REACT_APP_PROVIDER_ENDPOINT: the Solana RPC used by the wallet and on-chain counter (e.g., your local validator or a public RPC). | ||
| - REACT_APP_EPHEMERAL_PROVIDER_ENDPOINT: the Ephemeral Rollup RPC used for the ephemeral counter. | ||
|
|
||
| You can set them via environment variables when starting the app. | ||
|
|
||
| Examples | ||
| - Using localhost (same machine): | ||
| REACT_APP_PROVIDER_ENDPOINT=http://localhost:8899 \ | ||
| REACT_APP_EPHEMERAL_PROVIDER_ENDPOINT=http://localhost:7799 \ | ||
| npm run start | ||
|
|
||
| If these variables are not provided, the app will default to MagicBlock’s public endpoints: | ||
| - REACT_APP_PROVIDER_ENDPOINT → https://rpc.magicblock.app/devnet | ||
| - REACT_APP_EPHEMERAL_PROVIDER_ENDPOINT → https://devnet.magicblock.app | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| MIT License | ||
|
|
||
| Copyright (c) 2023 Magicblock Pte. Ltd. | ||
|
|
||
| Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| of this software and associated documentation files (the "Software"), to deal | ||
| in the Software without restriction, including without limitation the rights | ||
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| copies of the Software, and to permit persons to whom the Software is | ||
| furnished to do so, subject to the following conditions: | ||
|
|
||
| The above copyright notice and this permission notice shall be included in all | ||
| copies or substantial portions of the Software. | ||
|
|
||
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| SOFTWARE. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| ## 🚀 Getting Started | ||
|
|
||
| ### Npm | ||
|
|
||
| ```bash | ||
| npm run install | ||
| ``` | ||
|
|
||
| ```bash | ||
| npm run start | ||
| ``` | ||
|
|
||
| ### Yarn | ||
|
|
||
| ```bash | ||
| yarn install | ||
| ``` | ||
|
|
||
| ```bash | ||
| yarn start | ||
| ``` | ||
|
|
||
| ## 💚 Open Source | ||
|
|
||
| Open Source is at the heart of what we do at MagicBlock. We believe building software in the open, with thriving communities, helps leave the world a little better than we found it. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| // craco.config.js | ||
| const webpack = require('webpack'); | ||
|
|
||
| module.exports = { | ||
| webpack: { | ||
| configure: (webpackConfig) => { | ||
| // Specify fallbacks for Node.js modules that are not available in the browser | ||
| webpackConfig.resolve.fallback = { | ||
| http: require.resolve('stream-http'), | ||
| https: require.resolve('https-browserify'), | ||
| crypto: require.resolve('crypto-browserify'), | ||
| stream: require.resolve('stream-browserify'), | ||
| buffer: require.resolve('buffer-browserify'), | ||
| zlib: false, | ||
| url: false, | ||
| vm: false, | ||
| }; | ||
|
Comment on lines
+8
to
+17
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Preserve existing fallbacks instead of overwriting them.
🤖 Prompt for AI Agents |
||
|
|
||
| webpackConfig.output = { | ||
| ...webpackConfig.output, | ||
| publicPath: '/', | ||
| }; | ||
|
|
||
| // Add Buffer global if it's missing | ||
| webpackConfig.plugins = (webpackConfig.plugins || []).concat( | ||
| new webpack.ProvidePlugin({ | ||
| Buffer: ['buffer', 'Buffer'], | ||
| }) | ||
| ); | ||
|
|
||
| // Ignore specific warnings (adjust the regex as needed) | ||
| const ignoredWarnings = [/Failed to parse source map/]; | ||
|
|
||
| // Webpack 5 approach to use the 'ignoreWarnings' option | ||
| webpackConfig.ignoreWarnings = webpackConfig.ignoreWarnings || []; | ||
| webpackConfig.ignoreWarnings = [ | ||
| ...webpackConfig.ignoreWarnings, | ||
| ...ignoredWarnings.map((pattern) => ({ | ||
| message: pattern, | ||
| })), | ||
| ]; | ||
|
|
||
| return webpackConfig; | ||
| }, | ||
| }, | ||
| }; | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix the npm install command.
The command
npm run installis incorrect. The standard npm command isnpm installwithout therunprefix.Apply this diff to fix the command:
In anchor-counter/app/app/README.md around lines 5 to 7, the README shows the
incorrect command "npm run install"; replace it with the standard "npm install"
command so users run the proper installer command (update the fenced code block
to contain "npm install" instead of "npm run install").