Skip to content
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

Check for Blocks before Contract Start and Adding Format Script #108

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- name: Use Node.js 18
uses: actions/setup-node@v4
with:
node-version: "18.18"
node-version: '18.18'
- run: corepack enable
- run: yarn install
- name: yarn start:docker
Expand Down Expand Up @@ -60,12 +60,12 @@ jobs:
with:
start: npx serve ui/dist -p 5173
command: yarn test:e2e
wait-on: "http://localhost:5173"
wait-on: 'http://localhost:5173'
wait-on-timeout: 120
browser: chrome
env:
DISPLAY: :0.0
SECRET_WORDS: "orbit bench unit task food shock brand bracket domain regular warfare company announce wheel grape trust sphere boy doctor half guard ritual three ecology"
SECRET_WORDS: 'orbit bench unit task food shock brand bracket domain regular warfare company announce wheel grape trust sphere boy doctor half guard ritual three ecology'

- name: Archive e2e artifacts
uses: actions/upload-artifact@v4
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,4 @@ videos

# contract tx
contract/,tx.json
contract/start-offer-up-plan.json
2 changes: 1 addition & 1 deletion contract/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"docker:bash": "docker compose exec agd bash",
"docker:make": "docker compose exec agd make -C /workspace/contract",
"make:help": "make list",
"start": "yarn docker:make clean start-contract",
"start": "./scripts/wait-for-chain.sh && yarn docker:make clean start-contract",
"build": "agoric run scripts/build-contract-deployer.js",
"test": "ava --verbose",
"lint": "tsc && eslint '**/*.js'",
Expand Down
31 changes: 31 additions & 0 deletions contract/scripts/wait-for-chain.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash

# Function to check if we see a pattern of block commits
check_block_pattern() {
local count=0
local required_patterns=3 # Number of block patterns we want to see

while IFS= read -r line; do
echo "$line" # Show the log output

if [[ $line =~ "block-manager: block "[0-9]+" commit" ]]; then
((count++))
if [ $count -ge $required_patterns ]; then
return 0 # Success
fi
fi
done

return 1 # Pattern not found
}

echo -e "\033[34mWaiting for blockchain to start...\033[0m"
yarn docker:logs | check_block_pattern

if [ $? -eq 0 ]; then
echo -e "\033[34mBlockchain is running and producing blocks...\033[0m"
exit 0
else
echo -e "\033[34mFailed to detect blockchain activity\n Run yarn start:docker to start the blockchain first!\033[0m"
exit 1
fi
44 changes: 18 additions & 26 deletions contract/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,27 +1,19 @@
{
"compilerOptions": {
"target": "ESNext",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"lib": [
"ESNext",
"DOM"
],
"checkJs": true,
"strict": true,
"noImplicitAny": false,
"useUnknownInCatchVariables": false,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"outDir": "./dist"
},
"include": [
"src",
"test"
],
"exclude": [
"node_modules"
]
}
"compilerOptions": {
"target": "ESNext",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"lib": ["ESNext", "DOM"],
"checkJs": true,
"strict": true,
"noImplicitAny": false,
"useUnknownInCatchVariables": false,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"outDir": "./dist"
},
"include": ["src", "test"],
"exclude": ["node_modules"]
}
15 changes: 14 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@
"make:help": "make -C contract list",
"start:contract": "cd contract && yarn start",
"start:ui": "cd ui && yarn dev",
"lint": "yarn workspaces foreach --all run lint",
"format": "yarn prettier --write .github contract ui",
"lint:format": "yarn prettier --check .github contract ui",
"lint": "yarn lint:format && yarn workspaces foreach --all run lint",
"lint:fix": "yarn format && yarn workspaces foreach --all run lint:fix",
"test": "yarn workspaces foreach --all run test",
"test:e2e": "yarn workspace offer-up-ui test:e2e",
"build": "yarn workspaces foreach --all run build",
Expand All @@ -62,6 +65,16 @@
"eslint-plugin-cypress": "^2.15.1",
"eslint-plugin-testing-library": "^6.2.0",
"eslint-plugin-ui-testing": "^2.0.1",
"prettier": "^3.3.3",
"prettier-plugin-tailwindcss": "^0.5.11",
"serve": "^14.2.1"
},
"prettier": {
"trailingComma": "all",
"arrowParens": "avoid",
"singleQuote": true,
"plugins": [
"prettier-plugin-tailwindcss"
]
}
}
6 changes: 3 additions & 3 deletions ui/src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,11 @@ input {
}

.error {
background-color: #E11D48;
background-color: #e11d48;
color: #fff;
}

/* increment/decrement arrows always visible */
input[type=number]::-webkit-inner-spin-button {
opacity: 1
input[type='number']::-webkit-inner-spin-button {
opacity: 1;
}
2 changes: 1 addition & 1 deletion ui/test/e2e/synpress.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ module.exports = defineConfig({
specPattern: 'test/e2e/specs/**/*spec.{js,jsx,ts,tsx}',
supportFile: 'test/support.js',
screenshotsFolder: 'test/e2e/screenshots',
videosFolder: 'test/e2e/videos'
videosFolder: 'test/e2e/videos',
},
});
4 changes: 2 additions & 2 deletions ui/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true,

"types": ["vitest/globals"],
"types": ["vitest/globals"]
},
"include": ["src", "test"],
"references": [{ "path": "./tsconfig.node.json" }],
"references": [{ "path": "./tsconfig.node.json" }]
}
66 changes: 66 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -12760,6 +12760,8 @@ __metadata:
eslint-plugin-cypress: "npm:^2.15.1"
eslint-plugin-testing-library: "npm:^6.2.0"
eslint-plugin-ui-testing: "npm:^2.0.1"
prettier: "npm:^3.3.3"
prettier-plugin-tailwindcss: "npm:^0.5.11"
serve: "npm:^14.2.1"
languageName: unknown
linkType: soft
Expand Down Expand Up @@ -13496,6 +13498,61 @@ __metadata:
languageName: node
linkType: hard

"prettier-plugin-tailwindcss@npm:^0.5.11":
version: 0.5.14
resolution: "prettier-plugin-tailwindcss@npm:0.5.14"
peerDependencies:
"@ianvs/prettier-plugin-sort-imports": "*"
"@prettier/plugin-pug": "*"
"@shopify/prettier-plugin-liquid": "*"
"@trivago/prettier-plugin-sort-imports": "*"
"@zackad/prettier-plugin-twig-melody": "*"
prettier: ^3.0
prettier-plugin-astro: "*"
prettier-plugin-css-order: "*"
prettier-plugin-import-sort: "*"
prettier-plugin-jsdoc: "*"
prettier-plugin-marko: "*"
prettier-plugin-organize-attributes: "*"
prettier-plugin-organize-imports: "*"
prettier-plugin-sort-imports: "*"
prettier-plugin-style-order: "*"
prettier-plugin-svelte: "*"
peerDependenciesMeta:
"@ianvs/prettier-plugin-sort-imports":
optional: true
"@prettier/plugin-pug":
optional: true
"@shopify/prettier-plugin-liquid":
optional: true
"@trivago/prettier-plugin-sort-imports":
optional: true
"@zackad/prettier-plugin-twig-melody":
optional: true
prettier-plugin-astro:
optional: true
prettier-plugin-css-order:
optional: true
prettier-plugin-import-sort:
optional: true
prettier-plugin-jsdoc:
optional: true
prettier-plugin-marko:
optional: true
prettier-plugin-organize-attributes:
optional: true
prettier-plugin-organize-imports:
optional: true
prettier-plugin-sort-imports:
optional: true
prettier-plugin-style-order:
optional: true
prettier-plugin-svelte:
optional: true
checksum: 10c0/9857873cb8cb0d9b7b895806e7f6265617a08805691125d282767dffb1cb3d2c4c662f2b9168ef391edc40dff1b81beb99eee488f96544e01b8924db694f2299
languageName: node
linkType: hard

"prettier@npm:^3.0.0, prettier@npm:^3.0.3, prettier@npm:^3.2.4":
version: 3.2.4
resolution: "prettier@npm:3.2.4"
Expand All @@ -13505,6 +13562,15 @@ __metadata:
languageName: node
linkType: hard

"prettier@npm:^3.3.3":
version: 3.4.2
resolution: "prettier@npm:3.4.2"
bin:
prettier: bin/prettier.cjs
checksum: 10c0/99e076a26ed0aba4ebc043880d0f08bbb8c59a4c6641cdee6cdadf2205bdd87aa1d7823f50c3aea41e015e99878d37c58d7b5f0e663bba0ef047f94e36b96446
languageName: node
linkType: hard

"pretty-bytes@npm:^5.6.0":
version: 5.6.0
resolution: "pretty-bytes@npm:5.6.0"
Expand Down
Loading