-
Notifications
You must be signed in to change notification settings - Fork 236
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
feat: cli "unbox" command #2029
Merged
Merged
Changes from all commits
Commits
Show all changes
141 commits
Select commit
Hold shift + click to select a range
97b9f9c
Initial vite project.
LeilaWang c75d38b
Webpack build.
LeilaWang 6cf94f6
Aztec box ui.
LeilaWang 7f7ad09
Merge remote-tracking branch 'origin/master' into lw/aztec_box
LeilaWang 6af5308
Cleanup.
LeilaWang 844981d
Make default the last config.
LeilaWang 3b1dbb2
Change default port.
LeilaWang 35a37d3
add serve dep and compile
dan-aztec f92120a
Merge branch 'master' into dan/lw/aztec_box
dan-aztec e3c4386
add wallets from rpcClient
dan-aztec 17e51ed
select completeaddress instead of aztecaddress as wallet
dan-aztec d6c912d
parse address field correctly before deploy
dan-aztec c511c1c
fix wallet selection interaction
dan-aztec 721d248
show selected wallets full public key
dan-aztec ef65a2c
Merge branch 'master' into dan/lw/aztec_box
dan-aztec 95faf3d
sketch of calling contract methods
dan-aztec 9a3ddf9
Merge branch 'master' into dan/lw/aztec_box
dan-aztec 959ac33
Merge branch 'master' into dan/lw/aztec_box
dan-aztec 7d9674c
upate build_manifest.json, add dockerfile and arg converter util
dan-aztec a2d9a5e
revert aztec.js package.json switch
dan-aztec d713f6b
add to worskapces
dan-aztec e83d64e
Revert "revert aztec.js package.json switch"
dan-aztec b0cc2d8
revert aztecjs package.json change, add wallet param
dan-aztec 25b68da
update private token contract abi
dan-aztec e9a3ce5
convert string form values to array for yup
dan-aztec da75a2a
remove logs and allow hardcoded address value param names
dan-aztec f2b3fa3
allow box config to toggle banner animation
dan-aztec bc7b7c1
copy into cli command from other branch
dan-aztec ee3afa9
update yarnlock
dan-aztec 772cce3
update cli to point to boxes instead of starter-kit
dan-aztec e1b4ef5
rename starterkit to box
dan-aztec 4e0958a
copy more stuff into package.json
dan-aztec 1a41a9f
Merge remote-tracking branch 'origin/master' into dan/lw/aztec_box
dan-aztec 1730312
revert some circuits formatting
dan-aztec c4685ac
revert?
dan-aztec 2f6b5e4
remove env file creation
dan-aztec a15f2c5
start fixing copy commands
dan-aztec 8985652
bug on nargo.toml filtering
dan-aztec 77ebc5a
fix aztec-li
dan-aztec c910cbf
add sandbox image updating and initializating to package.json scripts
dan-aztec 02d9c4f
hide compute_nullifer method from front end
dan-aztec 8f3ac38
add @types/node and jest
dan-aztec c5a53a0
initial jest test
dan-aztec b7438ec
readme updates
dan-aztec 75e72a9
readme
dan-aztec 1fd2f8f
wait instead of is_mined()
dan-aztec c04b875
rename mint vs transfer amounts in test
dan-aztec 05adaf8
broken now?
dan-aztec 194b083
Merge branch 'master' into dan/lw/aztec_box
dan-aztec 70650b8
console.log
dan-aztec efe0347
update contract.json
dan-aztec 1a408ee
jest works in monorepo now
dan-aztec bc3771d
update default account address public key
dan-aztec ca67592
Merge branch 'master' into dan/lw/aztec_box
dan-aztec 0f92983
temp logs for failed contract deploy, modify tsconfig to remove refer…
dan-aztec 515d3da
set version 0.1.0 but not sure that matches w/npm versions of publish…
dan-aztec 98dc05e
clean up comments
dan-aztec c1bce90
Merge branch 'master' into dan/lw/aztec_box
dan-aztec a31d3f4
fix package version injection
dan-aztec 3ef8e68
update cli and private_token_contract.json
dan-aztec 228350b
fix the sandbox tests in subpackage
dan-aztec 4f5b330
only copy noir source if not present in box
dan-aztec 889dc16
remove logs and move into components/
dan-aztec ed8de57
move contract.tsx back to top level
dan-aztec 2482d76
Merge branch 'master' into dan/lw/aztec_box
dan-aztec e3939e5
bump yarn.lock
dan-aztec 09757d6
remove toplevel yarn.lock
dan-aztec 5580c10
start fixes
dan-aztec 4bb1540
start update to new txn api
dan-aztec 8f55468
select the AccountWallet for the account
dan-aztec c83f0c8
move wallet selector in utils file
dan-aztec 56ffd53
Merge branch 'master' into dan/lw/aztec_box
dan-aztec 4d4f53e
updated contract json
dan-aztec 8faae12
update generated class
dan-aztec bcf1d19
Merge branch 'master' into dan/lw/aztec_box
dan-aztec d4ae480
add copy package.json to yarn-base dockerfile
dan-aztec 6a4ffc1
Merge branch 'master' into dan/lw/aztec_box
dan-aztec 18209d9
update README to add dockerfile change for new subpackage
dan-aztec 53adf85
try to add to CI
dan-aztec cd62a23
use github for deps in Nargo.toml instead of copying files
dan-aztec b35a627
stop downloading noir-libs since they can be configured as deps in th…
dan-aztec 8cffe1f
make test an integration test
dan-aztec 43eacc4
add end-to-end dep for local sandbox setup function
dan-aztec da2ce0c
add to circlci/config.yml jobs
dan-aztec 34a1b90
try to add setup from @aztec/end-to-end
dan-aztec 4447cbd
add circuits dep
dan-aztec 100b26b
README updates, try to manually build circuits to save dockerfile
dan-aztec 7e43035
remove early yarn test in dockerfile
dan-aztec edfe623
prettier
dan-aztec 35793e0
try copying setup from end-to-end
dan-aztec 3ddb28b
revert e2d dep in test, update test to use FE helpers
dan-aztec 2a425ba
add a test to e2e for the unbox methods
dan-aztec 65d66d8
fix local tests
dan-aztec 34db68d
update e2e version of test
dan-aztec 50dc3a5
bump e-2-e tsconfig
dan-aztec 25f3bc1
format dependencies
dan-aztec 24fcea8
try just boxes
dan-aztec b51427c
remove circular dep
dan-aztec 4661cf3
remove some deps on boxes
dan-aztec 63dc3b3
annotate config.ts
dan-aztec 728a8e8
fix import but still broken
dan-aztec 84e6cb9
inherit top level package.common.json
dan-aztec 9030820
Revert "inherit top level package.common.json"
dan-aztec 49d6d93
somehow wont find @aztec/boxes/private-token
dan-aztec b9b4e97
run yarn prepare, end-to-end removed boxes dep?
dan-aztec 8d6b729
Merge branch 'master' into dan/lw/aztec_box
dan-aztec 2406e81
some pr feedback
dan-aztec 8a5934b
move arg conversion outside scripts functions
dan-aztec dca96d4
Merge branch 'master' into dan/lw/aztec_box
dan-aztec 7a5e444
Merge branch 'master' into dan/lw/aztec_box
dan-aztec 96eea37
remove test from e2e
dan-aztec fa02549
fix the test
dan-aztec d955bcd
Merge branch 'master' into dan/lw/aztec_box
dan-aztec fdc6d1f
yarn.lock
dan-aztec 21edd87
small fixes
dan-aztec 17c04aa
download the cli tag version of monorepo instead of master
dan-aztec 773ac23
revert end-to-end changes
dan-aztec 7c10033
try yarn install
dan-aztec 678e195
re-add circuits dep
dan-aztec c9fc1bb
modify package.json script to grab pinned version of sandbox image
dan-aztec 295d73a
Merge branch 'master' into dan/lw/aztec_box
dan-aztec 0cac2ce
push packageVersion to first param consistently, update a string
dan-aztec 95022e3
unneeded function
dan-aztec a05f3b1
fix compile command
dan-aztec e5e91be
Merge branch 'master' into dan/lw/aztec_box
dan-aztec aa269b5
update README and strip out some doc comments from the noir source files
dan-aztec d6f0dca
animate banner on deploy
dan-aztec 48162be
also pin the sandbox version on the start command
dan-aztec f02725b
modify the nargo toml dep to use the same tag/version as the npm pack…
dan-aztec e6956a7
Merge branch 'master' into dan/lw/aztec_box
dan-aztec 15a95a9
Merge branch 'master' into dan/lw/aztec_box
dan-aztec 2d4a73d
remove CI integration for now
dan-aztec 4609309
Revert "remove CI integration for now"
dan-aztec 7ce5248
try not setting 3 other params, let build system figure it out
dan-aztec 79606d1
Revert "try not setting 3 other params, let build system figure it out"
dan-aztec ba4ffef
Merge branch 'master' into dan/lw/aztec_box
dan-aztec 6248865
Revert "Revert "remove CI integration for now""
dan-aztec 1fbd137
remove change to base Dockerfile
dan-aztec 461f026
Merge branch 'master' into dan/lw/aztec_box
dan-aztec fa312e5
Revert "remove change to base Dockerfile"
dan-aztec 584bada
Merge branch 'master' into dan/lw/aztec_box
dan-aztec File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
module.exports = { | ||
root: true, | ||
env: { browser: true, es2020: true }, | ||
extends: [ | ||
'eslint:recommended', | ||
'plugin:@typescript-eslint/recommended', | ||
'plugin:react-hooks/recommended', | ||
'plugin:import/recommended', | ||
'plugin:import/typescript', | ||
'prettier', | ||
], | ||
settings: { | ||
'import/resolver': { | ||
typescript: true, | ||
node: true, | ||
}, | ||
}, | ||
ignorePatterns: ['dist', '.eslintrc.cjs'], | ||
parser: '@typescript-eslint/parser', | ||
plugins: ['react-refresh'], | ||
overrides: [ | ||
{ | ||
files: ['*.ts', '*.tsx'], | ||
parserOptions: { | ||
// hacky workaround for CI not having the same tsconfig setup | ||
project: true, | ||
}, | ||
}, | ||
], | ||
rules: { | ||
'react-refresh/only-export-components': ['warn', { allowConstantExport: true }], | ||
'@typescript-eslint/explicit-module-boundary-types': 'off', | ||
'@typescript-eslint/no-non-null-assertion': 'off', | ||
'@typescript-eslint/no-explicit-any': 'off', | ||
'@typescript-eslint/no-empty-function': 'off', | ||
'@typescript-eslint/await-thenable': 'error', | ||
'@typescript-eslint/no-floating-promises': 2, | ||
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_', varsIgnorePattern: '^_' }], | ||
'require-await': 2, | ||
'no-console': 'warn', | ||
'no-constant-condition': 'off', | ||
camelcase: 2, | ||
'no-restricted-imports': [ | ||
'error', | ||
{ | ||
patterns: [ | ||
{ | ||
group: ['client-dest'], | ||
message: "Fix this absolute garbage import. It's your duty to solve it before it spreads.", | ||
}, | ||
{ | ||
group: ['dest'], | ||
message: 'You should not be importing from a build directory. Did you accidentally do a relative import?', | ||
}, | ||
], | ||
}, | ||
], | ||
'import/no-unresolved': 'error', | ||
'import/no-extraneous-dependencies': 'error', | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# 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? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"singleQuote": true, | ||
"trailingComma": "all", | ||
"printWidth": 120, | ||
"arrowParens": "avoid" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
FROM 278380418400.dkr.ecr.eu-west-2.amazonaws.com/yarn-project-base AS builder | ||
|
||
COPY . . | ||
|
||
WORKDIR /usr/src/yarn-project/boxes/private-token | ||
RUN yarn build && yarn formatting | ||
|
||
# this feels wrong | ||
RUN yarn cache clean | ||
RUN yarn workspaces focus --production > /dev/null | ||
|
||
FROM node:18-alpine | ||
COPY --from=builder /usr/src/yarn-project/boxes/private-token /usr/src/yarn-project/boxes/private-token | ||
WORKDIR /usr/src/yarn-project/boxes/private-token | ||
ENTRYPOINT ["yarn"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
This is a minimal [Aztec](https://aztec.network/) Noir smart contract and frontend bootstrapped with [`aztec-cli unbox`](https://github.com/AztecProtocol/aztec-packages/tree/master/yarn-project/cli). It is recommended you use the `aztec-cli unbox PrivateToken` command so that the repository is copied with needed modifications from the monorepo subpackage. | ||
|
||
Some contract specific settings for `PrivateToken` are in a [config](src/config.ts) will require manual updates depending on your changes to the source code. `aztec-cli` can be installed with `npm i -g @aztec/cli`, if you don't have it already. | ||
|
||
## Setup | ||
|
||
Dependencies can be installed from the root of the package: | ||
|
||
```bash | ||
yarn | ||
yarn install:noir | ||
yarn install:sandbox | ||
yarn build | ||
``` | ||
|
||
In addition to the usual javascript dependencies, this project requires `nargo` (package manager) and `noir` (Aztec ZK smart contract language) in addition to `@aztec/aztec-cli`. | ||
|
||
The former are installed within `yarn install:noir` which executes | ||
|
||
```bash | ||
curl -L https://raw.githubusercontent.com/noir-lang/noirup/main/install | bash | ||
|
||
noirup -v aztec | ||
``` | ||
|
||
This sandbox requires [Docker](https://www.docker.com/) to be installed _and running_ locally. In the event the image needs updating, you can run `yarn install:sandbox` which executes | ||
|
||
```bash | ||
docker pull aztecprotocol/aztec-sandbox:latest | ||
``` | ||
|
||
## Getting started | ||
|
||
After `yarn build` has run,`yarn start:sandbox` in one terminal will launch a local instance of the Aztec sandbox via Docker Compose and `yarn start:dev` will launch a frontend app for deploying and interacting with the PrivateToken contract. | ||
|
||
At this point, [http://localhost:5173](http://localhost:5173) should provide a minimal smart contract frontend. | ||
|
||
This folder should have the following directory structure: | ||
|
||
``` | ||
|— README.md | ||
|— package.json | ||
|— src | ||
|-config.ts - PrivateToken specific configuration for the frontend. | ||
| You may need to update this if you modify the contract functions. | ||
|— app | ||
|— [frontend React .tsx code files] | ||
|- scripts | ||
|- [helpers for frontend to interact with contract on the sandbox] | ||
|— contracts | ||
|— src | ||
| The Noir smart contract source files are here. | ||
|— main.nr - the cloned noir contract, your starting point | ||
|- interface.nr - autogenerated from main.nr when you compile | ||
|— Nargo.toml [Noir build file, includes Aztec smart contract dependencies] | ||
|— artifacts | ||
| These are both generated from `contracts/` by the compile command | ||
|— private_token_contract.json | ||
|— private_token.ts | ||
|— tests | ||
| A simple end2end test deploying and testing the PrivateToken on a local sandbox | ||
| using the front end helper methods in app/scripts/ | ||
| The test requires the sandbox and anvil to be running (yarn start:sandbox). | ||
|- privatetoken.test.ts | ||
``` | ||
|
||
Most relevant to you is likely `src/contracts/main.nr` (and the build config `src/contracts/Nargo.toml`). This contains the example PrivateToken logic that the frontend interacts with and is a good place to start writing Noir. | ||
|
||
The `src/artifacts` folder can be re-generated from the command line with `yarn compile` which is an alias for | ||
|
||
```bash | ||
aztec-cli compile src/contracts --outdir ../artifacts --typescript ../artifacts | ||
``` | ||
|
||
This will generate a [Contract ABI](https://www.alchemy.com/overviews/what-is-an-abi-of-a-smart-contract-examples-and-usage) and TypeScript class for the Aztec smart contract in `src/contracts/main.nr`, which the frontend uses to generate the UI. | ||
|
||
Note: the `compile` command seems to generate a Typescript file which needs a single change - | ||
|
||
``` | ||
import PrivateTokenContractAbiJson from 'PrivateToken.json' assert { type: 'json' }; | ||
// need to update the relative import to | ||
import PrivateTokenContractAbiJson from './PrivateToken.json' assert { type: 'json' }; | ||
``` | ||
|
||
After compiling, you can re-deploy the upated noir smart contract from the web UI. The function interaction forms are generated from parsing the ContractABI, so they should update automatically after you recompile. | ||
|
||
## Learn More | ||
|
||
To learn more about Noir Smart Contract development, take a look at the following resources: | ||
|
||
- [Awesome Noir](https://github.com/noir-lang/awesome-noir) - learn about the Noir programming language. | ||
|
||
## Deploy on Aztec3 | ||
|
||
Coming Soon :) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
{ | ||
"name": "private-token", | ||
"private": true, | ||
"version": "0.1.0", | ||
"type": "module", | ||
"main": "./dest/index.js", | ||
"scripts": { | ||
"build": "yarn clean && webpack", | ||
"install:noir": "curl -L https://raw.githubusercontent.com/noir-lang/noirup/main/install | bash noirup -v aztec", | ||
"install:sandbox": "docker pull aztecprotocol/aztec-sandbox:latest", | ||
"clean": "rm -rf ./dest .tsbuildinfo", | ||
"start": "serve -p 3000 ./dest", | ||
"start:dev": "webpack serve --mode=development", | ||
"start:sandbox": "SANDBOX_VERSION=latest /bin/bash -c \"$(curl -fsSL 'https://sandbox.aztec.network')\" ", | ||
"formatting": "prettier --check ./src && eslint ./src", | ||
"formatting:fix": "prettier -w ./src", | ||
"compile": "aztec-cli compile src/contracts --outdir ../artifacts --typescript ../artifacts", | ||
"test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules $(yarn bin jest) --runInBand", | ||
"test:integration": "concurrently -k -s first -c reset,dim -n test,anvil \"yarn test\" \"anvil\"" | ||
}, | ||
"jest": { | ||
"preset": "ts-jest/presets/default-esm", | ||
"globals": { | ||
"ts-jest": { | ||
"useESM": true | ||
} | ||
}, | ||
"transform": { | ||
"^.+\\.(ts|tsx)$": "ts-jest" | ||
}, | ||
"moduleNameMapper": { | ||
"^(\\.{1,2}/.*)\\.js$": "$1" | ||
}, | ||
"testRegex": "./src/.*\\.test\\.ts$", | ||
"rootDir": "./src" | ||
}, | ||
"dependencies": { | ||
"@aztec/aztec.js": "workspace:^", | ||
"@aztec/circuits.js": "workspace:^", | ||
"@aztec/cli": "workspace:^", | ||
"@aztec/foundation": "workspace:^", | ||
"formik": "^2.4.3", | ||
"react": "^18.2.0", | ||
"react-dom": "^18.2.0", | ||
"serve": "^14.2.1", | ||
"tailwindcss": "^3.3.3", | ||
"yup": "^1.2.0" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^20.5.9", | ||
"@types/react": "^18.2.15", | ||
"@types/react-dom": "^18.2.7", | ||
"@typescript-eslint/eslint-plugin": "^6.0.0", | ||
"@typescript-eslint/parser": "^6.0.0", | ||
"autoprefixer": "^10.4.15", | ||
"copy-webpack-plugin": "^11.0.0", | ||
"css-loader": "^6.8.1", | ||
"eslint": "^8.45.0", | ||
"eslint-import-resolver-typescript": "^3.5.5", | ||
"eslint-plugin-import": "^2.27.5", | ||
"eslint-plugin-react-hooks": "^4.6.0", | ||
"eslint-plugin-react-refresh": "^0.4.3", | ||
"jest": "^29.6.4", | ||
"postcss": "^8.4.29", | ||
"postcss-loader": "^7.3.3", | ||
"prettier": "^3.0.3", | ||
"resolve-typescript-plugin": "^2.0.1", | ||
"style-loader": "^3.3.3", | ||
"ts-jest": "^29.1.0", | ||
"ts-loader": "^9.4.4", | ||
"ts-node": "^10.9.1", | ||
"typescript": "^5.0.4", | ||
"util": "^0.12.5", | ||
"webpack": "^5.88.2", | ||
"webpack-cli": "^5.1.4", | ||
"webpack-dev-server": "^4.15.1" | ||
}, | ||
"browserslist": { | ||
"production": [ | ||
">0.5%", | ||
"not dead", | ||
"not op_mini all" | ||
], | ||
"development": [ | ||
"last 1 chrome version", | ||
"last 1 firefox version", | ||
"last 1 safari version" | ||
] | ||
}, | ||
"files": [ | ||
"dest", | ||
"src", | ||
"!*.test.*" | ||
], | ||
"types": "./dest/index.d.ts" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
const tailwindcss = require('tailwindcss'); | ||
const autoprefixer = require('autoprefixer'); | ||
|
||
module.exports = { | ||
plugins: [tailwindcss('./tailwind.config.cjs'), autoprefixer], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
declare module '*.svg' { | ||
const content: any; | ||
export default content; | ||
} | ||
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. i feel like this may not be right? i dont know how about exporting types |
43 changes: 43 additions & 0 deletions
43
yarn-project/boxes/private-token/src/app/components/banner.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
interface Props { | ||
background: string; | ||
direction: string; | ||
animated?: boolean; | ||
} | ||
|
||
/** | ||
* | ||
* @param background - background color, either "black" or "purple" | ||
* @returns a moving banner repeating the word PRIVACY | ||
*/ | ||
export function Banner({ background, direction, animated }: Props) { | ||
// Determine direction | ||
const start = !animated ? '' : direction === 'reverse' ? 'animate-marquee' : 'animate-marquee3'; | ||
const end = !animated ? '' : direction === 'reverse' ? 'animate-marquee2' : 'animate-marquee4'; | ||
|
||
// Apply relevant color styles | ||
const containerStyles = | ||
background === 'black' | ||
? `relative flex overflow-x-hidden bg-indigo-950 text-orange-100` | ||
: `relative flex overflow-x-hidden bg-orange-100 text-indigo-950`; | ||
|
||
return ( | ||
<div className={containerStyles}> | ||
<div className={`py-2 whitespace-nowrap ${start}`}> | ||
{/* Generate text elements */} | ||
{Array.from({ length: 50 }, (_, index) => ( | ||
<span className="mx-4 text-2xl NBInter" key={index}> | ||
PRIVACY | ||
</span> | ||
))} | ||
</div> | ||
<div className={`absolute top-0 py-2 whitespace-nowrap ${end}`}> | ||
{/* Generate text elements */} | ||
{Array.from({ length: 50 }, (_, index) => ( | ||
<span className="mx-4 text-2xl NBInter" key={index}> | ||
PRIVACY | ||
</span> | ||
))} | ||
</div> | ||
</div> | ||
); | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
circuits.js
andcli
shouldn't be in the dependencies. Or we keepcli
and removenoir-compiler
and use cli to compile the contracts.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.
removing circuits.js and noir-compiler!