diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 00000000..6da21fcf --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1 @@ +* @rabbitholegg/protocol-sdk diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 00000000..5d79c27a --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,65 @@ +name: Bug Report +description: File a bug/issue +title: 'bug: ' +body: + - type: markdown + attributes: + value: | + Thanks for taking the time to fill out this bug report! The more info you provide, the more we can help you. If you are a [Sponsor](https://github.com/sponsors/wagmi-dev?metadata_campaign=gh_issue), your issues are prioritized. + + - type: checkboxes + attributes: + label: Is there an existing issue for this? + description: Please search to see if an issue already exists for the bug you encountered. + options: + - label: I have searched the existing issues + required: true + + - type: input + attributes: + label: Package Version + description: What version of questdk are you using? + placeholder: 0.1.0 + validations: + required: true + + - type: textarea + attributes: + label: Current Behavior + description: A concise description of what you're experiencing. + validations: + required: false + + - type: textarea + attributes: + label: Expected Behavior + description: A concise description of what you expected to happen. + validations: + required: false + + - type: textarea + attributes: + label: Steps To Reproduce + description: Steps or code snippets to reproduce the behavior. + validations: + required: false + + - type: input + attributes: + label: Link to Minimal Reproducible Example (StackBlitz, CodeSandbox, GitHub repo etc.) + description: | + Please provide a link via [rabbithole.gg](https://rabbithole.gg/) or a link to a minimal repository that can reproduce the problem you ran into. + This makes investigating issues and helping you out significantly easier! For most issues, you will likely get asked to provide one so why not add one now :) + placeholder: https://rabbithole.gg/ + validations: + required: false + + - type: textarea + attributes: + label: Anything else? + description: | + Browser info? Screenshots? Anything that will give us more context about the issue you are encountering! + + Tip: You can attach images or log files by clicking this area to highlight it and then dragging files in. + validations: + required: false diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 00000000..53f4b326 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,8 @@ +blank_issues_enabled: false +contact_links: + - name: Ask Question + url: https://github.com/rabbitholegg/questdk/discussions/new?category=q-a + about: Ask questions and discuss with other community members + - name: Request Feature + url: https://github.com/rabbitholegg/questdk/discussions/new?category=ideas + about: Requests features or brainstorm ideas for new functionality diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..9d67e73b --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,11 @@ +version: 2 +updates: + - package-ecosystem: "npm" + directory: "/" + schedule: + interval: "monthly" + + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "monthly" diff --git a/.github/stale.yml b/.github/stale.yml new file mode 100644 index 00000000..e9301ec4 --- /dev/null +++ b/.github/stale.yml @@ -0,0 +1,17 @@ +# Number of days of inactivity before an issue becomes stale +daysUntilStale: 180 +# Number of days of inactivity before a stale issue is closed +daysUntilClose: 7 +# Issues with these labels will never be considered stale +exemptLabels: + - bug + - not stale +# Label to use when marking an issue as stale +staleLabel: stale +# Comment to post when marking an issue as stale. Set to `false` to disable +markComment: > + This issue has been automatically marked as stale because it has not had + recent activity. It will be closed if no further activity occurs. Thank you + for your contributions. +# Comment to post when closing a stale issue. Set to `false` to disable +closeComment: false diff --git a/.github/workflows/forge.yml b/.github/workflows/forge.yml new file mode 100644 index 00000000..615175cf --- /dev/null +++ b/.github/workflows/forge.yml @@ -0,0 +1,41 @@ +name: Run Forge Tests +on: + workflow_call: + workflow_dispatch: + +env: + FOUNDRY_PROFILE: ci + +jobs: + check: + name: Build and Test + runs-on: ubuntu-latest + strategy: + matrix: + shard: [1, 2, 3] + total-shards: [3] + fail-fast: true + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Install Foundry + uses: foundry-rs/foundry-toolchain@v1 + with: + version: nightly + + - name: Run Forge build + working-directory: ./packages/evm + run: | + forge --version + forge build --sizes + id: build + + - name: Run Forge tests + working-directory: ./packages/evm + env: + TEST_SIGNER_PRIVATE_KEY: ${{ secrets.TEST_SIGNER_PRIVATE_KEY }} + run: | + forge test -vvv + id: test diff --git a/.github/workflows/on-pull-request.yml b/.github/workflows/on-pull-request.yml new file mode 100644 index 00000000..87e256a2 --- /dev/null +++ b/.github/workflows/on-pull-request.yml @@ -0,0 +1,18 @@ +name: Pull request +on: + pull_request: + types: [opened, reopened, synchronize, ready_for_review] + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + verify: + name: Verify + uses: ./.github/workflows/verify.yml + secrets: inherit + forge: + name: Forge + uses: ./.github/workflows/forge.yml + secrets: inherit diff --git a/.github/workflows/on-push-to-main.yml b/.github/workflows/on-push-to-main.yml new file mode 100644 index 00000000..8cf5c0a9 --- /dev/null +++ b/.github/workflows/on-push-to-main.yml @@ -0,0 +1,107 @@ +name: Main +on: + push: + branches: [main] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + verify: + name: Verify + uses: ./.github/workflows/verify.yml + secrets: inherit + + changesets: + name: Changesets + runs-on: ubuntu-latest + timeout-minutes: 15 + + steps: + - name: Clone repository + uses: actions/checkout@v4 + with: + # This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits + fetch-depth: 0 + - uses: actions/setup-node@v4 + with: + node-version: 18 + registry-url: https://registry.npmjs.org/ + scope: "@boostxyz" + + - name: Install dependencies + uses: ./.github/actions/install-dependencies + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Create Version Pull Request + uses: changesets/action@v1 + with: + version: pnpm changeset:version + commit: "chore: version package" + title: "chore: version package" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + release: + name: Release + needs: verify + runs-on: ubuntu-latest + timeout-minutes: 20 + + steps: + - name: Clone repository + uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 18 + registry-url: https://registry.npmjs.org/ + scope: "@boostxyz" + + - name: Install dependencies + uses: ./.github/actions/install-dependencies + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Create .npmrc + run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc + + - name: Publish to NPM + uses: changesets/action@v1 + with: + publish: pnpm publish-packages + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN }} + + docs: + needs: check + name: Deploy Docs + runs-on: ubuntu-latest + + permissions: + contents: write + pages: write + id-token: write + + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Install Foundry + uses: foundry-rs/foundry-toolchain@v1 + with: + version: nightly + + - name: Build Documentation (mdBook) + working-directory: ./packages/evm + run: forge doc --build + + - name: Publish Documentation + uses: JamesIves/github-pages-deploy-action@v4 + with: + folder: ./packages/evm/docs/book + token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/verify.yml b/.github/workflows/verify.yml new file mode 100644 index 00000000..d2d0b061 --- /dev/null +++ b/.github/workflows/verify.yml @@ -0,0 +1,57 @@ +name: Verify +on: + workflow_call: + workflow_dispatch: + +jobs: + build: + name: Build + needs: lint + runs-on: ubuntu-latest + timeout-minutes: 15 + + steps: + - name: Clone repository + uses: actions/checkout@v4 + + - name: Install dependencies + uses: ./.github/actions/install-dependencies + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Build + run: pnpm build + + # test: + # name: Test + # runs-on: ubuntu-latest + # strategy: + # matrix: + # shard: [1, 2, 3] + # total-shards: [3] + # transport-mode: ["http", "webSocket"] + # include: + # - batch-multicall: "false" + # - batch-multicall: "true" + # transport-mode: "http" + + # steps: + # - name: Clone repository + # uses: actions/checkout@v4 + + # - name: Install dependencies + # uses: ./.github/actions/install-dependencies + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + # - name: Run tests + # uses: nick-fields/retry@v3 + # with: + # timeout_minutes: 20 + # max_attempts: 3 + # command: pnpm test:ci -- --shard=${{ matrix.shard }}/${{ matrix.total-shards }} + + # - name: Upload coverage reports to Codecov + # uses: codecov/codecov-action@v4.3.0 + # with: + # token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.gitignore b/.gitignore index f752cb81..467b9af9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ node_modules/ .turbo +dist diff --git a/package.json b/package.json index 0c6f66e1..490b5202 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "lint": "turbo lint", "prepare": "lefthook install", "postinstall": "git submodule update --init", - "format": "prettier --write \"**/*.{ts,tsx,md}\" && forge fmt packages/evm" + "format": "forge fmt packages/evm" }, "devDependencies": { "@biomejs/biome": "1.8.1", @@ -22,6 +22,7 @@ "lefthook": "^1.6.15", "prettier": "^3.2.5", "turbo": "^2.0.0", + "typescript": "^5.3.3", "vite": "^5.2.13" }, "packageManager": "pnpm@8.15.8", diff --git a/packages/evm/.github/workflows/test.yml b/packages/evm/.github/workflows/test.yml deleted file mode 100644 index 7836f608..00000000 --- a/packages/evm/.github/workflows/test.yml +++ /dev/null @@ -1,67 +0,0 @@ -name: Run Tests and Update Docs - -on: - push: - branches: - - main - -env: - FOUNDRY_PROFILE: ci - -jobs: - check: - name: Build and Test - runs-on: ubuntu-latest - strategy: - fail-fast: true - steps: - - uses: actions/checkout@v4 - with: - submodules: recursive - - - name: Install Foundry - uses: foundry-rs/foundry-toolchain@v1 - with: - version: nightly - - - name: Run Forge build - run: | - forge --version - forge build --sizes - id: build - - - name: Run Forge tests - env: - TEST_SIGNER_PRIVATE_KEY: ${{ secrets.TEST_SIGNER_PRIVATE_KEY }} - run: | - forge test -vvv - id: test - - docs: - needs: check - name: Deploy Docs - runs-on: ubuntu-latest - - permissions: - contents: write - pages: write - id-token: write - - steps: - - uses: actions/checkout@v4 - with: - submodules: recursive - - - name: Install Foundry - uses: foundry-rs/foundry-toolchain@v1 - with: - version: nightly - - - name: Build Documentation (mdBook) - run: forge doc --build - - - name: Publish Documentation - uses: JamesIves/github-pages-deploy-action@v4 - with: - folder: ./docs/book - token: ${{ secrets.GITHUB_TOKEN }} diff --git a/packages/evm/package.json b/packages/evm/package.json index 65b004bb..1059fbe7 100644 --- a/packages/evm/package.json +++ b/packages/evm/package.json @@ -1,8 +1,9 @@ { - "name": "@boost/evm", - "version": "1.0.0", + "name": "@boostxyz/evm", + "version": "0.0.0-alpha.0", "description": "", "main": "README.md", + "private": true, "scripts": { "test": "forge test -vvv && hardhat test" }, diff --git a/packages/sdk/package.json b/packages/sdk/package.json new file mode 100644 index 00000000..946c3c20 --- /dev/null +++ b/packages/sdk/package.json @@ -0,0 +1,25 @@ +{ + "name": "@boostxyz/sdk", + "version": "0.0.0-alpha.0", + "private": true, + "files": ["dist"], + "exports": { + ".": { + "require": "./dist/index.cjs", + "import": "./dist/index.js", + "types": "./dist/index.d.ts" + } + }, + "main": "./dist/index.cjs", + "module": "./dist/index.js", + "types": "./dist/index.d.ts", + "typings": "./dist/index.d.ts", + "scripts": { + "build": "vite build && tsc --emitDeclarationOnly --declaration --declarationMap", + "bench": "vitest bench", + "bench:ci": "CI=true vitest bench", + "clean": "rimraf dist", + "test": "vitest dev", + "test:ci": "CI=true vitest --coverage" + } +} diff --git a/packages/sdk/src/index.ts b/packages/sdk/src/index.ts new file mode 100644 index 00000000..e4ea7770 --- /dev/null +++ b/packages/sdk/src/index.ts @@ -0,0 +1 @@ +export type {}; diff --git a/packages/sdk/tsconfig.json b/packages/sdk/tsconfig.json new file mode 100644 index 00000000..74968b47 --- /dev/null +++ b/packages/sdk/tsconfig.json @@ -0,0 +1,9 @@ +{ + "extends": "../../tsconfig.json", + "include": ["src"], + "compilerOptions": { + "rootDir": "./src", + "outDir": "dist" + }, + "exclude": ["dist", "build", "node_modules"] +} diff --git a/packages/sdk/vite.config.js b/packages/sdk/vite.config.js new file mode 100644 index 00000000..0d5e7c92 --- /dev/null +++ b/packages/sdk/vite.config.js @@ -0,0 +1,16 @@ +/** @type {import('vite').UserConfig} */ +export default { + build: { + rollupOptions: { + external: [], + }, + lib: { + entry: ['src/index.ts'], + emptyOutDir: false, + name: 'BoostSDK', + fileName: (module, name) => { + return `${name}.${module === 'es' ? 'js' : 'cjs'}`; + }, + }, + }, +}; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 7151b29c..77b8767d 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -32,6 +32,9 @@ importers: turbo: specifier: ^2.0.0 version: 2.0.3 + typescript: + specifier: ^5.3.3 + version: 5.3.3 vite: specifier: ^5.2.13 version: 5.2.13(@types/node@20.12.11) @@ -90,6 +93,8 @@ importers: specifier: ^2.9.9 version: 2.9.9(typescript@5.3.3)(zod@3.22.4) + packages/sdk: {} + packages: /@adraffy/ens-normalize@1.10.0: