https://github.com/fuellabs/sway-by-example
Examples of Sway programs
https://github.com/fuellabs/sway-by-example
Last synced: 8 months ago
JSON representation
Examples of Sway programs
- Host: GitHub
- URL: https://github.com/fuellabs/sway-by-example
- Owner: FuelLabs
- License: mit
- Created: 2022-11-23T04:28:17.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-10-04T03:03:39.000Z (over 1 year ago)
- Last Synced: 2025-05-21T18:34:21.683Z (about 1 year ago)
- Language: Solidity
- Homepage: sway-by-example.vercel.app
- Size: 2.47 MB
- Stars: 11
- Watchers: 4
- Forks: 8
- Open Issues: 15
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# sway-by-example.github.io
[Sway By Example](https://www.swaybyexample.com/)
### License
[MIT License](LICENSE)
### Development
```shell
npm i
npm start
```
### Production
```shell
npm run build
# Preview produciton
npm run preview
# Deploy
npm run deploy
```
### Memo
TODO: code split / dynamic imports
```shell
## Deploy ##
# copy files from contracts
npx ts-node scripts/copy.ts
# md to react
npx ts-node --project ./scripts/tsconfig.json scripts/md-to-react.ts src/pages/array
# md to react all pages
find src/pages -type d -not -path "*/__snapshots__" -exec npx ts-node --project ./scripts/tsconfig.json scripts/md-to-react.ts {} \;
# build routes
npx ts-node --project ./scripts/tsconfig.json scripts/build-routes.ts
# build search index
npx ts-node --project ./scripts/tsconfig.json scripts/build-search-index.ts
## Compile Solidity ##
solc-select install 0.59.0
solc-select use 0.59.0
# compile single file
solc src/pages/hello-world/HelloWorld.sol
# find and compile sol
find src/pages/hacks -name "*.sol" solc {} \;
find src/pages -type f -name "*.sol" -exec sh -c 'solc "$0"' {} \;
## Mics ##
# rename files
find . -type f -name "index.test.js" -exec sh -c 'mv "$0" "${0%.test.js}.test.tsx"' {} \;
```