diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 000000000..709c9a747 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,26 @@ +# Use the latest 2.1 version of CircleCI pipeline process engine. +# See: https://circleci.com/docs/configuration-reference + +version: 2.1 +executors: + my-custom-executor: + docker: + - image: cimg/base:stable + auth: + # ensure you have first added these secrets + # visit app.circleci.com/settings/project/github/Dargon789/hardhat-project/environment-variables + username: $DOCKER_HUB_USER + password: $DOCKER_HUB_PASSWORD +jobs: + web3-defi-game-project-: + + executor: my-custom-executor + steps: + - checkout + - run: | + # echo Hello, World! + +workflows: + my-custom-workflow: + jobs: + - web3-defi-game-project- diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 000000000..81c7b58d8 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,38 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: 'bug' +assignees: '' + +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +Steps to reproduce the behavior: +1. Go to '...' +2. Click on '....' +3. Scroll down to '....' +4. See error + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Screenshots** +If applicable, add screenshots to help explain your problem. + +**Desktop (please complete the following information):** + - OS: [e.g. iOS] + - Browser [e.g. chrome, safari] + - Version [e.g. 22] + +**Smartphone (please complete the following information):** + - Device: [e.g. iPhone6] + - OS: [e.g. iOS8.1] + - Browser [e.g. stock browser, safari] + - Version [e.g. 22] + +**Additional context** +Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/custom.md b/.github/ISSUE_TEMPLATE/custom.md new file mode 100644 index 000000000..48d5f81fa --- /dev/null +++ b/.github/ISSUE_TEMPLATE/custom.md @@ -0,0 +1,10 @@ +--- +name: Custom issue template +about: Describe this issue template's purpose here. +title: '' +labels: '' +assignees: '' + +--- + + diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 000000000..36014cde5 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,20 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: 'enhancement' +assignees: '' + +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. diff --git a/.github/workflows/fortify.yml b/.github/workflows/fortify.yml new file mode 100644 index 000000000..ff1a25baf --- /dev/null +++ b/.github/workflows/fortify.yml @@ -0,0 +1,85 @@ +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. + +################################################################################################################################################ +# Fortify Application Security provides your team with solutions to empower DevSecOps practices, enable cloud transformation, and secure your # +# software supply chain. To learn more about Fortify, start a free trial or contact our sales team, visit fortify.com. # +# # +# Use this starter workflow as a basis for integrating Fortify Application Security Testing into your GitHub workflows. This template # +# demonstrates the steps to package the code+dependencies, initiate a scan, and optionally import SAST vulnerabilities into GitHub Security # +# Code Scanning Alerts. Additional information is available in the workflow comments and the Fortify AST Action / fcli / Fortify product # +# documentation. If you need additional assistance, please contact Fortify support. # +################################################################################################################################################ + +name: Fortify AST Scan + +# Customize trigger events based on your DevSecOps process and/or policy +on: + push: + branches: [ "master" ] + pull_request: + # The branches below must be a subset of the branches above + branches: [ "master" ] + schedule: + - cron: '31 12 * * 4' + workflow_dispatch: + +jobs: + Fortify-AST-Scan: + # Use the appropriate runner for building your source code. Ensure dev tools required to build your code are present and configured appropriately (MSBuild, Python, etc). + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + + steps: + # Check out source code + - name: Check Out Source Code + uses: actions/checkout@v4 + + # Java is required to run the various Fortify utilities. Ensuring proper version is installed on the runner. + - name: Setup Java + uses: actions/setup-java@v4 + with: + java-version: 17 + distribution: 'temurin' + + # Perform SAST and optionally SCA scan via Fortify on Demand/Fortify Hosted/Software Security Center, then + # optionally export SAST results to the GitHub code scanning dashboard. In case further customization is + # required, you can use sub-actions like fortify/github-action/setup@v1 to set up the various Fortify tools + # and run them directly from within your pipeline; see https://github.com/fortify/github-action#readme for + # details. + + - name: Run FoD SAST Scan + uses: fortify/github-action@a92347297e02391b857e7015792cd1926a4cd418 + with: + sast-scan: true + env: + ### Required configuration when integrating with Fortify on Demand + FOD_URL: https://ams.fortify.com + FOD_TENANT: ${{secrets.FOD_TENANT}} + FOD_USER: ${{secrets.FOD_USER}} + FOD_PASSWORD: ${{secrets.FOD_PAT}} + ### Optional configuration when integrating with Fortify on Demand + # EXTRA_PACKAGE_OPTS: -oss # Extra 'scancentral package' options, like '-oss'' if + # Debricked SCA scan is enabled on Fortify on Demand + # EXTRA_FOD_LOGIN_OPTS: --socket-timeout=60s # Extra 'fcli fod session login' options + # FOD_RELEASE: MyApp:MyRelease # FoD release name, default: /:; may + # replace app+release name with numeric release ID + # DO_WAIT: true # Wait for scan completion, implied if 'DO_EXPORT: true' + # DO_EXPORT: true # Export SAST results to GitHub code scanning dashboard + ### Required configuration when integrating with Fortify Hosted / Software Security Center & ScanCentral + # SSC_URL: ${{secrets.SSC_URL}} # SSC URL + # SSC_TOKEN: ${{secrets.SSC_TOKEN}} # SSC CIToken or AutomationToken + # SC_SAST_TOKEN: ${{secrets.SC_SAST_TOKEN}} # ScanCentral SAST client auth token + # SC_SAST_SENSOR_VERSION: ${{vars.SC_SAST_SENSOR_VERSION}} # Sensor version on which to run the scan; + # usually defined as organization or repo variable + ### Optional configuration when integrating with Fortify Hosted / Software Security Center & ScanCentral + # EXTRA_SC_SAST_LOGIN_OPTS: --socket-timeout=60s # Extra 'fcli sc-sast session login' options + # SSC_APPVERSION: MyApp:MyVersion # SSC application version, default: /: + # EXTRA_PACKAGE_OPTS: -bv myCustomPom.xml # Extra 'scancentral package' options + # DO_WAIT: true # Wait for scan completion, implied if 'DO_EXPORT: true' + # DO_EXPORT: true # Export SAST results to GitHub code scanning dashboard diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index d49eea949..7d5edbd5f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -9,6 +9,7 @@ jobs: steps: - uses: actions/checkout@v3 - uses: ./.github/actions/install-dependencies + - run: pnpm install --no-frozen-lockfile build: name: Run build diff --git a/CNAME b/CNAME index c9903e895..aa0085b19 100644 --- a/CNAME +++ b/CNAME @@ -1 +1 @@ -wagmi-project-two.vercel.app \ No newline at end of file +sequence.app \ No newline at end of file diff --git a/packages/0xsequence/CHANGELOG.md b/packages/0xsequence/CHANGELOG.md index 030a2c5d9..ef700228d 100644 --- a/packages/0xsequence/CHANGELOG.md +++ b/packages/0xsequence/CHANGELOG.md @@ -1,5 +1,29 @@ # 0xsequence +## 1.10.15 + +### Patch Changes + +- utils: extractProjectIdFromAccessKey +- Updated dependencies + - @0xsequence/abi@1.10.15 + - @0xsequence/account@1.10.15 + - @0xsequence/api@1.10.15 + - @0xsequence/auth@1.10.15 + - @0xsequence/core@1.10.15 + - @0xsequence/guard@1.10.15 + - @0xsequence/indexer@1.10.15 + - @0xsequence/metadata@1.10.15 + - @0xsequence/migration@1.10.15 + - @0xsequence/multicall@1.10.15 + - @0xsequence/network@1.10.15 + - @0xsequence/provider@1.10.15 + - @0xsequence/relayer@1.10.15 + - @0xsequence/sessions@1.10.15 + - @0xsequence/signhub@1.10.15 + - @0xsequence/utils@1.10.15 + - @0xsequence/wallet@1.10.15 + ## 1.10.14 ### Patch Changes diff --git a/packages/0xsequence/package.json b/packages/0xsequence/package.json index 5fc1524ce..d3e638eea 100644 --- a/packages/0xsequence/package.json +++ b/packages/0xsequence/package.json @@ -1,6 +1,6 @@ { "name": "0xsequence", - "version": "1.10.14", + "version": "1.10.15", "description": "Sequence: a modular web3 stack and smart wallet for Ethereum chains", "repository": "https://github.com/0xsequence/sequence.js", "source": "src/index.ts", diff --git a/packages/abi/CHANGELOG.md b/packages/abi/CHANGELOG.md index 15092de06..fd5614991 100644 --- a/packages/abi/CHANGELOG.md +++ b/packages/abi/CHANGELOG.md @@ -1,5 +1,11 @@ # @0xsequence/abi +## 1.10.15 + +### Patch Changes + +- utils: extractProjectIdFromAccessKey + ## 1.10.14 ### Patch Changes diff --git a/packages/abi/package.json b/packages/abi/package.json index bf133663b..924b6cc7b 100644 --- a/packages/abi/package.json +++ b/packages/abi/package.json @@ -1,6 +1,6 @@ { "name": "@0xsequence/abi", - "version": "1.10.14", + "version": "1.10.15", "description": "abi sub-package for Sequence", "repository": "https://github.com/0xsequence/sequence.js/tree/master/packages/abi", "source": "src/index.ts", diff --git a/packages/account/CHANGELOG.md b/packages/account/CHANGELOG.md index a6cd32c68..c9e98e803 100644 --- a/packages/account/CHANGELOG.md +++ b/packages/account/CHANGELOG.md @@ -1,5 +1,20 @@ # @0xsequence/account +## 1.10.15 + +### Patch Changes + +- utils: extractProjectIdFromAccessKey +- Updated dependencies + - @0xsequence/abi@1.10.15 + - @0xsequence/core@1.10.15 + - @0xsequence/migration@1.10.15 + - @0xsequence/network@1.10.15 + - @0xsequence/relayer@1.10.15 + - @0xsequence/sessions@1.10.15 + - @0xsequence/utils@1.10.15 + - @0xsequence/wallet@1.10.15 + ## 1.10.14 ### Patch Changes diff --git a/packages/account/package.json b/packages/account/package.json index ade5693c5..212a7e88e 100644 --- a/packages/account/package.json +++ b/packages/account/package.json @@ -1,6 +1,6 @@ { "name": "@0xsequence/account", - "version": "1.10.14", + "version": "1.10.15", "description": "tools for migrating sequence wallets to new versions", "repository": "https://github.com/0xsequence/sequence.js/tree/master/packages/account", "source": "src/index.ts", diff --git a/packages/api/CHANGELOG.md b/packages/api/CHANGELOG.md index e40204e34..d0bb881cc 100644 --- a/packages/api/CHANGELOG.md +++ b/packages/api/CHANGELOG.md @@ -1,5 +1,11 @@ # @0xsequence/api +## 1.10.15 + +### Patch Changes + +- utils: extractProjectIdFromAccessKey + ## 1.10.14 ### Patch Changes diff --git a/packages/api/package.json b/packages/api/package.json index 64fc8c394..761520ccb 100644 --- a/packages/api/package.json +++ b/packages/api/package.json @@ -1,6 +1,6 @@ { "name": "@0xsequence/api", - "version": "1.10.14", + "version": "1.10.15", "description": "api sub-package for Sequence", "repository": "https://github.com/0xsequence/sequence.js/tree/master/packages/api", "source": "src/index.ts", diff --git a/packages/auth/CHANGELOG.md b/packages/auth/CHANGELOG.md index 367469fcb..12e9ad53e 100644 --- a/packages/auth/CHANGELOG.md +++ b/packages/auth/CHANGELOG.md @@ -1,5 +1,24 @@ # @0xsequence/auth +## 1.10.15 + +### Patch Changes + +- utils: extractProjectIdFromAccessKey +- Updated dependencies + - @0xsequence/abi@1.10.15 + - @0xsequence/account@1.10.15 + - @0xsequence/api@1.10.15 + - @0xsequence/core@1.10.15 + - @0xsequence/indexer@1.10.15 + - @0xsequence/metadata@1.10.15 + - @0xsequence/migration@1.10.15 + - @0xsequence/network@1.10.15 + - @0xsequence/sessions@1.10.15 + - @0xsequence/signhub@1.10.15 + - @0xsequence/utils@1.10.15 + - @0xsequence/wallet@1.10.15 + ## 1.10.14 ### Patch Changes diff --git a/packages/auth/package.json b/packages/auth/package.json index 7f328ca22..5d28e7da3 100644 --- a/packages/auth/package.json +++ b/packages/auth/package.json @@ -1,6 +1,6 @@ { "name": "@0xsequence/auth", - "version": "1.10.14", + "version": "1.10.15", "description": "auth sub-package for Sequence", "repository": "https://github.com/0xsequence/sequence.js/tree/master/packages/auth", "source": "src/index.ts", diff --git a/packages/core/CHANGELOG.md b/packages/core/CHANGELOG.md index 754f2884d..5f69761cd 100644 --- a/packages/core/CHANGELOG.md +++ b/packages/core/CHANGELOG.md @@ -1,5 +1,13 @@ # @0xsequence/core +## 1.10.15 + +### Patch Changes + +- utils: extractProjectIdFromAccessKey +- Updated dependencies + - @0xsequence/abi@1.10.15 + ## 1.10.14 ### Patch Changes diff --git a/packages/core/package.json b/packages/core/package.json index f16bfda0b..a7ff4519b 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@0xsequence/core", - "version": "1.10.14", + "version": "1.10.15", "description": "core primitives for interacting with the sequence wallet contracts", "repository": "https://github.com/0xsequence/sequence.js/tree/master/packages/core", "source": "src/index.ts", diff --git a/packages/core/src/version.ts b/packages/core/src/version.ts index e8e78cfa0..43af5af41 100644 --- a/packages/core/src/version.ts +++ b/packages/core/src/version.ts @@ -1 +1 @@ -export const VERSION = '1.10.14' +export const VERSION = '1.10.15' diff --git a/packages/deployer/CHANGELOG.md b/packages/deployer/CHANGELOG.md index 3102b27b3..3bd7eafcd 100644 --- a/packages/deployer/CHANGELOG.md +++ b/packages/deployer/CHANGELOG.md @@ -1,5 +1,13 @@ # @0xsequence/deployer +## 1.10.15 + +### Patch Changes + +- utils: extractProjectIdFromAccessKey +- Updated dependencies + - @0xsequence/utils@1.10.15 + ## 1.10.14 ### Patch Changes diff --git a/packages/deployer/package.json b/packages/deployer/package.json index 8e3cf8c1b..866885e39 100644 --- a/packages/deployer/package.json +++ b/packages/deployer/package.json @@ -1,6 +1,6 @@ { "name": "@0xsequence/deployer", - "version": "1.10.14", + "version": "1.10.15", "description": "deployer sub-package for Sequence", "repository": "https://github.com/0xsequence/sequence.js/tree/master/packages/deployer", "source": "src/index.ts", diff --git a/packages/estimator/CHANGELOG.md b/packages/estimator/CHANGELOG.md index ef7b839b7..7919d7950 100644 --- a/packages/estimator/CHANGELOG.md +++ b/packages/estimator/CHANGELOG.md @@ -1,5 +1,15 @@ # @0xsequence/estimator +## 1.10.15 + +### Patch Changes + +- utils: extractProjectIdFromAccessKey +- Updated dependencies + - @0xsequence/abi@1.10.15 + - @0xsequence/core@1.10.15 + - @0xsequence/utils@1.10.15 + ## 1.10.14 ### Patch Changes diff --git a/packages/estimator/package.json b/packages/estimator/package.json index eda4672cf..4af1861e0 100644 --- a/packages/estimator/package.json +++ b/packages/estimator/package.json @@ -1,6 +1,6 @@ { "name": "@0xsequence/estimator", - "version": "1.10.14", + "version": "1.10.15", "description": "estimator sub-package for Sequence", "repository": "https://github.com/0xsequence/sequence.js/tree/master/packages/estimator", "source": "src/index.ts", diff --git a/packages/guard/CHANGELOG.md b/packages/guard/CHANGELOG.md index 4bd732e75..20380ac4e 100644 --- a/packages/guard/CHANGELOG.md +++ b/packages/guard/CHANGELOG.md @@ -1,5 +1,16 @@ # @0xsequence/guard +## 1.10.15 + +### Patch Changes + +- utils: extractProjectIdFromAccessKey +- Updated dependencies + - @0xsequence/account@1.10.15 + - @0xsequence/core@1.10.15 + - @0xsequence/signhub@1.10.15 + - @0xsequence/utils@1.10.15 + ## 1.10.14 ### Patch Changes diff --git a/packages/guard/package.json b/packages/guard/package.json index 0876998e5..a526178aa 100644 --- a/packages/guard/package.json +++ b/packages/guard/package.json @@ -1,6 +1,6 @@ { "name": "@0xsequence/guard", - "version": "1.10.14", + "version": "1.10.15", "description": "guard sub-package for Sequence", "repository": "https://github.com/0xsequence/sequence.js/tree/master/packages/guard", "source": "src/index.ts", diff --git a/packages/indexer/CHANGELOG.md b/packages/indexer/CHANGELOG.md index 923e56eb8..cde7136d4 100644 --- a/packages/indexer/CHANGELOG.md +++ b/packages/indexer/CHANGELOG.md @@ -1,5 +1,11 @@ # @0xsequence/indexer +## 1.10.15 + +### Patch Changes + +- utils: extractProjectIdFromAccessKey + ## 1.10.14 ### Patch Changes diff --git a/packages/indexer/package.json b/packages/indexer/package.json index 1cc1a66ad..d51c7827c 100644 --- a/packages/indexer/package.json +++ b/packages/indexer/package.json @@ -1,6 +1,6 @@ { "name": "@0xsequence/indexer", - "version": "1.10.14", + "version": "1.10.15", "description": "indexer sub-package for Sequence", "repository": "https://github.com/0xsequence/sequence.js/tree/master/packages/indexer", "source": "src/index.ts", diff --git a/packages/metadata/CHANGELOG.md b/packages/metadata/CHANGELOG.md index 59de86171..a51f30f95 100644 --- a/packages/metadata/CHANGELOG.md +++ b/packages/metadata/CHANGELOG.md @@ -1,5 +1,11 @@ # @0xsequence/metadata +## 1.10.15 + +### Patch Changes + +- utils: extractProjectIdFromAccessKey + ## 1.10.14 ### Patch Changes diff --git a/packages/metadata/package.json b/packages/metadata/package.json index 01bafc193..1440eaf25 100644 --- a/packages/metadata/package.json +++ b/packages/metadata/package.json @@ -1,6 +1,6 @@ { "name": "@0xsequence/metadata", - "version": "1.10.14", + "version": "1.10.15", "description": "metadata sub-package for Sequence", "repository": "https://github.com/0xsequence/sequence.js/tree/master/packages/metadata", "source": "src/index.ts", diff --git a/packages/migration/CHANGELOG.md b/packages/migration/CHANGELOG.md index 43e8540e8..fd1a2c61e 100644 --- a/packages/migration/CHANGELOG.md +++ b/packages/migration/CHANGELOG.md @@ -1,5 +1,15 @@ # @0xsequence/migration +## 1.10.15 + +### Patch Changes + +- utils: extractProjectIdFromAccessKey +- Updated dependencies + - @0xsequence/abi@1.10.15 + - @0xsequence/core@1.10.15 + - @0xsequence/wallet@1.10.15 + ## 1.10.14 ### Patch Changes diff --git a/packages/migration/package.json b/packages/migration/package.json index 8c2cbcb20..6d8f03621 100644 --- a/packages/migration/package.json +++ b/packages/migration/package.json @@ -1,6 +1,6 @@ { "name": "@0xsequence/migration", - "version": "1.10.14", + "version": "1.10.15", "description": "tools for migrating sequence wallets to new versions", "repository": "https://github.com/0xsequence/sequence.js/tree/master/packages/migration", "source": "src/index.ts", diff --git a/packages/multicall/CHANGELOG.md b/packages/multicall/CHANGELOG.md index de5ac4098..d223ccb21 100644 --- a/packages/multicall/CHANGELOG.md +++ b/packages/multicall/CHANGELOG.md @@ -1,5 +1,15 @@ # @0xsequence/multicall +## 1.10.15 + +### Patch Changes + +- utils: extractProjectIdFromAccessKey +- Updated dependencies + - @0xsequence/abi@1.10.15 + - @0xsequence/network@1.10.15 + - @0xsequence/utils@1.10.15 + ## 1.10.14 ### Patch Changes diff --git a/packages/multicall/package.json b/packages/multicall/package.json index c2910d253..820bbf0b6 100644 --- a/packages/multicall/package.json +++ b/packages/multicall/package.json @@ -1,6 +1,6 @@ { "name": "@0xsequence/multicall", - "version": "1.10.14", + "version": "1.10.15", "description": "multicall sub-package for Sequence", "repository": "https://github.com/0xsequence/sequence.js/tree/master/packages/multicall", "source": "src/index.ts", diff --git a/packages/network/CHANGELOG.md b/packages/network/CHANGELOG.md index 27b470634..e72711e47 100644 --- a/packages/network/CHANGELOG.md +++ b/packages/network/CHANGELOG.md @@ -1,5 +1,16 @@ # @0xsequence/network +## 1.10.15 + +### Patch Changes + +- utils: extractProjectIdFromAccessKey +- Updated dependencies + - @0xsequence/core@1.10.15 + - @0xsequence/indexer@1.10.15 + - @0xsequence/relayer@1.10.15 + - @0xsequence/utils@1.10.15 + ## 1.10.14 ### Patch Changes diff --git a/packages/network/package.json b/packages/network/package.json index f499bcb63..cb2f688af 100644 --- a/packages/network/package.json +++ b/packages/network/package.json @@ -1,6 +1,6 @@ { "name": "@0xsequence/network", - "version": "1.10.14", + "version": "1.10.15", "description": "network sub-package for Sequence", "repository": "https://github.com/0xsequence/sequence.js/tree/master/packages/network", "source": "src/index.ts", diff --git a/packages/provider/CHANGELOG.md b/packages/provider/CHANGELOG.md index 96bf50684..47a4d493d 100644 --- a/packages/provider/CHANGELOG.md +++ b/packages/provider/CHANGELOG.md @@ -1,5 +1,21 @@ # @0xsequence/provider +## 1.10.15 + +### Patch Changes + +- utils: extractProjectIdFromAccessKey +- Updated dependencies + - @0xsequence/abi@1.10.15 + - @0xsequence/account@1.10.15 + - @0xsequence/auth@1.10.15 + - @0xsequence/core@1.10.15 + - @0xsequence/migration@1.10.15 + - @0xsequence/network@1.10.15 + - @0xsequence/relayer@1.10.15 + - @0xsequence/utils@1.10.15 + - @0xsequence/wallet@1.10.15 + ## 1.10.14 ### Patch Changes diff --git a/packages/provider/package.json b/packages/provider/package.json index fe35f4aea..36e5c9e41 100644 --- a/packages/provider/package.json +++ b/packages/provider/package.json @@ -1,6 +1,6 @@ { "name": "@0xsequence/provider", - "version": "1.10.14", + "version": "1.10.15", "description": "provider sub-package for Sequence", "repository": "https://github.com/0xsequence/sequence.js/tree/master/packages/provider", "source": "src/index.ts", diff --git a/packages/react-native/CHANGELOG.md b/packages/react-native/CHANGELOG.md index 65ef2cac8..364b8868e 100644 --- a/packages/react-native/CHANGELOG.md +++ b/packages/react-native/CHANGELOG.md @@ -1,5 +1,13 @@ # @0xsequence/react-native +## 1.10.15 + +### Patch Changes + +- utils: extractProjectIdFromAccessKey +- Updated dependencies + - @0xsequence/waas@1.10.15 + ## 1.10.14 ### Patch Changes diff --git a/packages/react-native/package.json b/packages/react-native/package.json index 39ac93027..a1e81117b 100644 --- a/packages/react-native/package.json +++ b/packages/react-native/package.json @@ -1,6 +1,6 @@ { "name": "@0xsequence/react-native", - "version": "1.10.14", + "version": "1.10.15", "description": "react-native compat-lib sub-package for Sequence", "repository": "https://github.com/0xsequence/sequence.js/tree/master/packages/react-native", "source": "src/index.ts", diff --git a/packages/relayer/CHANGELOG.md b/packages/relayer/CHANGELOG.md index a67807e93..6f41138f3 100644 --- a/packages/relayer/CHANGELOG.md +++ b/packages/relayer/CHANGELOG.md @@ -1,5 +1,15 @@ # @0xsequence/relayer +## 1.10.15 + +### Patch Changes + +- utils: extractProjectIdFromAccessKey +- Updated dependencies + - @0xsequence/abi@1.10.15 + - @0xsequence/core@1.10.15 + - @0xsequence/utils@1.10.15 + ## 1.10.14 ### Patch Changes diff --git a/packages/relayer/package.json b/packages/relayer/package.json index 76c80cdf2..e02ded268 100644 --- a/packages/relayer/package.json +++ b/packages/relayer/package.json @@ -1,6 +1,6 @@ { "name": "@0xsequence/relayer", - "version": "1.10.14", + "version": "1.10.15", "description": "relayer sub-package for Sequence", "repository": "https://github.com/0xsequence/sequence.js/tree/master/packages/relayer", "source": "src/index.ts", diff --git a/packages/replacer/CHANGELOG.md b/packages/replacer/CHANGELOG.md index e8d9ec560..19a59fad5 100644 --- a/packages/replacer/CHANGELOG.md +++ b/packages/replacer/CHANGELOG.md @@ -1,5 +1,14 @@ # @0xsequence/replacer +## 1.10.15 + +### Patch Changes + +- utils: extractProjectIdFromAccessKey +- Updated dependencies + - @0xsequence/abi@1.10.15 + - @0xsequence/core@1.10.15 + ## 1.10.14 ### Patch Changes diff --git a/packages/replacer/package.json b/packages/replacer/package.json index a4bed98de..07486b733 100644 --- a/packages/replacer/package.json +++ b/packages/replacer/package.json @@ -1,6 +1,6 @@ { "name": "@0xsequence/replacer", - "version": "1.10.14", + "version": "1.10.15", "description": "EIP-5719 client implementation", "repository": "https://github.com/0xsequence/sequence.js/tree/master/packages/replacer", "source": "src/index.ts", diff --git a/packages/sessions/CHANGELOG.md b/packages/sessions/CHANGELOG.md index a736522ad..db561c5c7 100644 --- a/packages/sessions/CHANGELOG.md +++ b/packages/sessions/CHANGELOG.md @@ -1,5 +1,15 @@ # @0xsequence/sessions +## 1.10.15 + +### Patch Changes + +- utils: extractProjectIdFromAccessKey +- Updated dependencies + - @0xsequence/core@1.10.15 + - @0xsequence/migration@1.10.15 + - @0xsequence/replacer@1.10.15 + ## 1.10.14 ### Patch Changes diff --git a/packages/sessions/package.json b/packages/sessions/package.json index 8a14796f9..69ea0e629 100644 --- a/packages/sessions/package.json +++ b/packages/sessions/package.json @@ -1,6 +1,6 @@ { "name": "@0xsequence/sessions", - "version": "1.10.14", + "version": "1.10.15", "description": "tools for migrating sequence wallets to new versions", "repository": "https://github.com/0xsequence/sequence.js/tree/master/packages/sessions", "source": "src/index.ts", diff --git a/packages/signhub/CHANGELOG.md b/packages/signhub/CHANGELOG.md index f569b5d85..c93e1018f 100644 --- a/packages/signhub/CHANGELOG.md +++ b/packages/signhub/CHANGELOG.md @@ -1,5 +1,13 @@ # @0xsequence/signhub +## 1.10.15 + +### Patch Changes + +- utils: extractProjectIdFromAccessKey +- Updated dependencies + - @0xsequence/core@1.10.15 + ## 1.10.14 ### Patch Changes diff --git a/packages/signhub/package.json b/packages/signhub/package.json index 1a8341e3e..bbaa31060 100644 --- a/packages/signhub/package.json +++ b/packages/signhub/package.json @@ -1,6 +1,6 @@ { "name": "@0xsequence/signhub", - "version": "1.10.14", + "version": "1.10.15", "description": "orchestrates a series of signers, provides visibility into the signing process, and to the signers themselves", "repository": "https://github.com/0xsequence/sequence.js/tree/master/packages/signhub", "source": "src/index.ts", diff --git a/packages/simulator/CHANGELOG.md b/packages/simulator/CHANGELOG.md index f47d5498d..b19dc5fcb 100644 --- a/packages/simulator/CHANGELOG.md +++ b/packages/simulator/CHANGELOG.md @@ -1,5 +1,13 @@ # @0xsequence/simulator +## 1.10.15 + +### Patch Changes + +- utils: extractProjectIdFromAccessKey +- Updated dependencies + - @0xsequence/core@1.10.15 + ## 1.10.14 ### Patch Changes diff --git a/packages/simulator/package.json b/packages/simulator/package.json index 3bd4360c6..ee43f4e1b 100644 --- a/packages/simulator/package.json +++ b/packages/simulator/package.json @@ -1,6 +1,6 @@ { "name": "@0xsequence/simulator", - "version": "1.10.14", + "version": "1.10.15", "description": "simulator sub-package for Sequence", "repository": "https://github.com/0xsequence/sequence.js/tree/master/packages/simulator", "source": "src/index.ts", diff --git a/packages/tests/CHANGELOG.md b/packages/tests/CHANGELOG.md index c916d3382..7525aecad 100644 --- a/packages/tests/CHANGELOG.md +++ b/packages/tests/CHANGELOG.md @@ -1,5 +1,13 @@ # @0xsequence/tests +## 1.10.15 + +### Patch Changes + +- utils: extractProjectIdFromAccessKey +- Updated dependencies + - @0xsequence/core@1.10.15 + ## 1.10.14 ### Patch Changes diff --git a/packages/tests/package.json b/packages/tests/package.json index c1f464435..cde2e1dd9 100644 --- a/packages/tests/package.json +++ b/packages/tests/package.json @@ -1,6 +1,6 @@ { "name": "@0xsequence/tests", - "version": "1.10.14", + "version": "1.10.15", "description": "test tools for sequence.js", "repository": "https://github.com/0xsequence/sequence.js/tree/master/packages/tests", "source": "src/index.ts", diff --git a/packages/utils/CHANGELOG.md b/packages/utils/CHANGELOG.md index 953ae4755..f8f2aa2e7 100644 --- a/packages/utils/CHANGELOG.md +++ b/packages/utils/CHANGELOG.md @@ -1,5 +1,11 @@ # @0xsequence/utils +## 1.10.15 + +### Patch Changes + +- utils: extractProjectIdFromAccessKey + ## 1.10.14 ### Patch Changes diff --git a/packages/utils/package.json b/packages/utils/package.json index 2c3f14ec2..2d9e4b4a6 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -1,6 +1,6 @@ { "name": "@0xsequence/utils", - "version": "1.10.14", + "version": "1.10.15", "description": "utils sub-package for Sequence", "repository": "https://github.com/0xsequence/sequence.js/tree/master/packages/utils", "source": "src/index.ts", diff --git a/packages/waas-ethers/CHANGELOG.md b/packages/waas-ethers/CHANGELOG.md index 7154395e1..35b7591e6 100644 --- a/packages/waas-ethers/CHANGELOG.md +++ b/packages/waas-ethers/CHANGELOG.md @@ -1,5 +1,13 @@ # @0xsequence/waas-ethers +## 1.10.15 + +### Patch Changes + +- utils: extractProjectIdFromAccessKey +- Updated dependencies + - @0xsequence/waas@1.10.15 + ## 1.10.14 ### Patch Changes diff --git a/packages/waas-ethers/package.json b/packages/waas-ethers/package.json index b952ef4d7..41ff597d3 100644 --- a/packages/waas-ethers/package.json +++ b/packages/waas-ethers/package.json @@ -1,6 +1,6 @@ { "name": "@0xsequence/waas-ethers", - "version": "1.10.14", + "version": "1.10.15", "description": "waas ethers wrapper", "repository": "https://github.com/0xsequence/sequence.js/tree/master/packages/waas", "source": "src/index.ts", diff --git a/packages/waas/CHANGELOG.md b/packages/waas/CHANGELOG.md index 198c456ad..e9ecf34c5 100644 --- a/packages/waas/CHANGELOG.md +++ b/packages/waas/CHANGELOG.md @@ -1,5 +1,14 @@ # @0xsequence/waas +## 1.10.15 + +### Patch Changes + +- utils: extractProjectIdFromAccessKey +- Updated dependencies + - @0xsequence/core@1.10.15 + - @0xsequence/network@1.10.15 + ## 1.10.14 ### Patch Changes diff --git a/packages/waas/package.json b/packages/waas/package.json index 4cf3ea798..f7dcc9101 100644 --- a/packages/waas/package.json +++ b/packages/waas/package.json @@ -1,6 +1,6 @@ { "name": "@0xsequence/waas", - "version": "1.10.14", + "version": "1.10.15", "description": "waas session client", "repository": "https://github.com/0xsequence/sequence.js/tree/master/packages/waas", "source": "src/index.ts", diff --git a/packages/wallet/CHANGELOG.md b/packages/wallet/CHANGELOG.md index b2486b92d..41342d98d 100644 --- a/packages/wallet/CHANGELOG.md +++ b/packages/wallet/CHANGELOG.md @@ -1,5 +1,18 @@ # @0xsequence/wallet +## 1.10.15 + +### Patch Changes + +- utils: extractProjectIdFromAccessKey +- Updated dependencies + - @0xsequence/abi@1.10.15 + - @0xsequence/core@1.10.15 + - @0xsequence/network@1.10.15 + - @0xsequence/relayer@1.10.15 + - @0xsequence/signhub@1.10.15 + - @0xsequence/utils@1.10.15 + ## 1.10.14 ### Patch Changes diff --git a/packages/wallet/package.json b/packages/wallet/package.json index 998d8307b..8a63a37d8 100644 --- a/packages/wallet/package.json +++ b/packages/wallet/package.json @@ -1,6 +1,6 @@ { "name": "@0xsequence/wallet", - "version": "1.10.14", + "version": "1.10.15", "description": "wallet sub-package for Sequence", "repository": "https://github.com/0xsequence/sequence.js/tree/master/packages/wallet", "source": "src/index.ts", diff --git a/wagmi-project/package.json b/wagmi-project/package.json index 298a76bbc..206445bb3 100644 --- a/wagmi-project/package.json +++ b/wagmi-project/package.json @@ -10,7 +10,7 @@ "preview": "vite preview" }, "dependencies": { - "@tanstack/react-query": "5.45.1", + "@tanstack/react-query": "5.64.2", "react": "^18.3.1", "react-dom": "^18.3.1", "viem": "latest", diff --git a/wagmi-project/src/App.tsx b/wagmi-project/src/App.tsx index faa8ce1c7..9f245fc45 100644 --- a/wagmi-project/src/App.tsx +++ b/wagmi-project/src/App.tsx @@ -1,46 +1,1362 @@ -import { useAccount, useConnect, useDisconnect } from 'wagmi' +import { AnimatePresence } from 'framer-motion' +import React, { useState, useEffect, useMemo, SetStateAction } from 'react' +import { ethers } from 'ethers' +import { sequence } from '0xsequence' +import { walletContracts } from '@0xsequence/abi' +import { + Box, + Image, + Text, + Button, + ExternalLinkIcon, + Divider, + Card, + TransactionIcon, + Select, + TokenImage, + TextInput, + Modal +} from '@0xsequence/design-system' +import { ETHAuth } from '@0xsequence/ethauth' +import { configureLogger } from '@0xsequence/utils' +import { ConnectOptions, OpenWalletIntent, Settings } from '@0xsequence/provider' +import { ChainId, NetworkType } from '@0xsequence/network' -function App() { - const account = useAccount() - const { connectors, connect, status, error } = useConnect() - const { disconnect } = useDisconnect() +import { ERC_20_ABI } from './constants/abi' +import { Console } from './components/Console' +import { Group } from './components/Group' +import { getDefaultChainId, toHexString } from './helpers' +import logoUrl from './images/logo.svg' +import skyweaverBannerUrl from './images/skyweaver-banner.png' +import skyweaverBannerLargeUrl from './images/skyweaver-banner-large.png' + +configureLogger({ logLevel: 'DEBUG' }) + +interface Environment { + name: string + walletUrl: string + projectAccessKey: string +} + +const environments: Environment[] = [ + { + name: 'production', + walletUrl: 'https://sequence.app', + projectAccessKey: 'AQAAAAAAAAbvrgpWEC2Aefg5qYStQmwjBpA' + }, + { + name: 'development', + walletUrl: 'https://dev.sequence.app', + //projectAccessKey: 'AQAAAAAAAAVBNfoB30kz7Ph4I_Qs5mkYuDc', + projectAccessKey: 'AQAAAAAAAAVCXiQ9f_57R44MjorZ4SmGdhA' + }, + { + name: 'local', + walletUrl: 'http://localhost:3333', + projectAccessKey: 'AQAAAAAAAAVCXiQ9f_57R44MjorZ4SmGdhA' + }, + { + name: 'custom', + walletUrl: '', + projectAccessKey: '' + } +] + +const DEFAULT_API_URL = 'https://api.sequence.app' + +// Specify your desired default chain id. NOTE: you can communicate to multiple +// chains at the same time without even having to switch the network, but a default +// chain is required. +const defaultChainId = getDefaultChainId() || ChainId.MAINNET +// const defaultChainId = ChainId.POLYGON +// const defaultChainId = ChainId.GOERLI +// const defaultChainId = ChainId.ARBITRUM +// const defaultChainId = ChainId.AVALANCHE +// etc.. see the full list here: https://docs.sequence.xyz/multi-chain-support + +// For Sequence core dev team -- app developers can ignore +// a custom wallet app url can specified in the query string +const urlParams = new URLSearchParams(window.location.search) + +const env = urlParams.get('env') ?? 'production' +const envConfig = environments.find(x => x.name === env) ?? environments.find(x => x.name === 'production') +if (!envConfig) { + throw new Error('Invalid environment configuration.') +} +const walletAppURL = urlParams.get('walletAppURL') ?? envConfig.walletUrl +const projectAccessKey = urlParams.get('projectAccessKey') ?? envConfig.projectAccessKey +const showProhibitedActions = urlParams.has('showProhibitedActions') + +const isCustom = walletAppURL !== envConfig.walletUrl || projectAccessKey !== envConfig.projectAccessKey + +if (walletAppURL && walletAppURL.length > 0) { + // Wallet can point to a custom wallet app url + // NOTICE: this is not needed, unless testing an alpha version of the wallet + sequence.initWallet(projectAccessKey, { defaultNetwork: defaultChainId, transports: { walletAppURL } }) +} else { + // Init the sequence wallet library at the top-level of your project with + // your designed default chain id + sequence.initWallet(projectAccessKey, { defaultNetwork: defaultChainId, transports: { walletAppURL } }) +} + +// App component +const App = () => { + const [consoleMsg, setConsoleMsg] = useState(null) + const [email, setEmail] = useState(null) + const [consoleLoading, setConsoleLoading] = useState(false) + const [isWalletConnected, setIsWalletConnected] = useState(false) + + const wallet = sequence.getWallet().getProvider() + + const [showChainId, setShowChainId] = useState(wallet.getChainId()) + const [isOpen, toggleModal] = useState(false) + const [warning, setWarning] = useState(false) + + useEffect(() => { + const handleChainChanged = (chainId: string) => { + setShowChainId(Number(BigInt(chainId))) + } + wallet.on('chainChanged', handleChainChanged) + return () => { + wallet.off('chainChanged', handleChainChanged) + } + }, [wallet]) + + useEffect(() => { + setIsWalletConnected(wallet.isConnected()) + }, [wallet]) + + useEffect(() => { + consoleWelcomeMessage() + // eslint-disable-next-line + }, [isWalletConnected]) + + useEffect(() => { + // Wallet events + const onOpen = () => { + console.log('wallet window opened') + } + wallet.client.on('open', onOpen) + + const onClose = () => { + console.log('wallet window closed') + } + wallet.client.on('close', onClose) + + return () => { + wallet.client.off('open', onOpen) + wallet.client.off('close', onClose) + } + }, [wallet]) + + const defaultConnectOptions: ConnectOptions = { + app: 'Demo Dapp', + askForEmail: true + // keepWalletOpened: true, + } + + // Methods + const connect = async (connectOptions: ConnectOptions = { app: 'Demo dapp' }) => { + if (isWalletConnected) { + resetConsole() + appendConsoleLine('Wallet already connected!') + setConsoleLoading(false) + return + } + + connectOptions = { + ...defaultConnectOptions, + ...connectOptions, + settings: { + ...defaultConnectOptions.settings, + ...connectOptions.settings + } + } + + try { + resetConsole() + appendConsoleLine('Connecting') + const wallet = sequence.getWallet() + + const connectDetails = await wallet.connect(connectOptions) + + // Example of how to verify using ETHAuth via Sequence API + if (connectOptions.authorize && connectDetails.connected && connectDetails.proof) { + let apiUrl = urlParams.get('apiUrl') + + if (!apiUrl || apiUrl.length === 0) { + apiUrl = DEFAULT_API_URL + } + + const api = new sequence.api.SequenceAPIClient(apiUrl) + // or just + // const api = new sequence.api.SequenceAPIClient('https://api.sequence.app') + + const { isValid } = await api.isValidETHAuthProof({ + chainId: connectDetails.chainId, + walletAddress: connectDetails.session.accountAddress, + ethAuthProofString: connectDetails.proof.proofString + }) + + appendConsoleLine(`isValid (API)?: ${isValid}`) + } + + // Example of how to verify using ETHAuth directl on the client + if (connectOptions.authorize) { + const ethAuth = new ETHAuth() + + if (connectDetails.proof) { + const decodedProof = await ethAuth.decodeProof(connectDetails.proof.proofString, true) + + const isValid = await wallet.utils.isValidTypedDataSignature( + wallet.getAddress(), + connectDetails.proof.typedData, + decodedProof.signature, + Number(BigInt(connectDetails.chainId)) + ) + + appendConsoleLine(`connected using chainId: ${BigInt(connectDetails.chainId).toString()}`) + appendConsoleLine(`isValid (client)?: ${isValid}`) + } + } + + setConsoleLoading(false) + if (connectDetails.connected) { + appendConsoleLine('Wallet connected!') + appendConsoleLine(`shared email: ${connectDetails.email}`) + setIsWalletConnected(true) + } else { + appendConsoleLine('Failed to connect wallet - ' + connectDetails.error) + } + } catch (e) { + console.error(e) + consoleErrorMessage() + } + } + + const disconnect = () => { + const wallet = sequence.getWallet() + wallet.disconnect() + consoleWelcomeMessage() + setIsWalletConnected(false) + } + + const openWallet = () => { + const wallet = sequence.getWallet() + wallet.openWallet() + } + + const openWalletWithSettings = () => { + const wallet = sequence.getWallet() + + const settings: Settings = { + theme: 'light', + includedPaymentProviders: ['moonpay', 'ramp'], + defaultFundingCurrency: 'eth', + defaultPurchaseAmount: 400, + lockFundingCurrencyToDefault: false + } + + const intent: OpenWalletIntent = { + type: 'openWithOptions', + options: { + app: 'Demo Dapp', + settings + } + } + + const path = 'wallet/add-funds' + wallet.openWallet(path, intent) + } + + const closeWallet = () => { + const wallet = sequence.getWallet() + wallet.closeWallet() + } + + const isConnected = async () => { + resetConsole() + const wallet = sequence.getWallet() + appendConsoleLine(`isConnected?: ${wallet.isConnected()}`) + setConsoleLoading(false) + } + + const isOpened = async () => { + resetConsole() + const wallet = sequence.getWallet() + appendConsoleLine(`isOpened?: ${wallet.isOpened()}`) + setConsoleLoading(false) + } + + const getChainID = async () => { + try { + resetConsole() + + const topChainId = wallet.getChainId() + appendConsoleLine(`top chainId: ${topChainId}`) + + const provider = wallet.getProvider() + const providerChainId = provider!.getChainId() + appendConsoleLine(`provider.getChainId(): ${providerChainId}`) + + const signer = wallet.getSigner() + const signerChainId = await signer.getChainId() + appendConsoleLine(`signer.getChainId(): ${signerChainId}`) + + setConsoleLoading(false) + } catch (e) { + console.error(e) + consoleErrorMessage() + } + } + + const getAccounts = async () => { + try { + resetConsole() + + const wallet = sequence.getWallet() + const address = wallet.getAddress() + appendConsoleLine(`getAddress(): ${address}`) + + const provider = wallet.getProvider() + const accountList = provider.listAccounts() + appendConsoleLine(`accounts: ${JSON.stringify(accountList)}`) + + setConsoleLoading(false) + } catch (e) { + console.error(e) + consoleErrorMessage() + } + } + + const getBalance = async () => { + try { + resetConsole() + + const wallet = sequence.getWallet() + + const provider = wallet.getProvider() + const account = wallet.getAddress() + const balanceChk1 = await provider!.getBalance(account) + appendConsoleLine(`balance check 1: ${balanceChk1.toString()}`) + + const signer = wallet.getSigner() + const balanceChk2 = await signer.getBalance() + appendConsoleLine(`balance check 2: ${balanceChk2.toString()}`) + + setConsoleLoading(false) + } catch (e) { + console.error(e) + consoleErrorMessage() + } + } + + const getNetworks = async () => { + try { + resetConsole() + + const wallet = sequence.getWallet() + const networks = await wallet.getNetworks() + + appendConsoleLine(`networks: ${JSON.stringify(networks, null, 2)}`) + setConsoleLoading(false) + } catch (e) { + console.error(e) + consoleErrorMessage() + } + } + + const signMessageString = async () => { + try { + resetConsole() + + const wallet = sequence.getWallet() + + appendConsoleLine('signing message...') + const signer = wallet.getSigner() + + const message = `1915 Robert Frost +The Road Not Taken + +Two roads diverged in a yellow wood, +And sorry I could not travel both +And be one traveler, long I stood +And looked down one as far as I could +To where it bent in the undergrowth + +Then took the other, as just as fair, +And having perhaps the better claim, +Because it was grassy and wanted wear +Though as for that the passing there +Had worn them really about the same, + +And both that morning equally lay +In leaves no step had trodden black. +Oh, I kept the first for another day! +Yet knowing how way leads on to way, +I doubted if I should ever come back. + +I shall be telling this with a sigh +Somewhere ages and ages hence: +Two roads diverged in a wood, and I— +I took the one less traveled by, +And that has made all the difference. + +\u2601 \u2600 \u2602` + + // sign + const sig = await signer.signMessage(message) + appendConsoleLine(`signature: ${sig}`) + + const isValid = await wallet.utils.isValidMessageSignature(wallet.getAddress(), message, sig, await signer.getChainId()) + appendConsoleLine(`isValid?: ${isValid}`) + if (!isValid) throw new Error('sig invalid') + + setConsoleLoading(false) + } catch (e) { + console.error(e) + consoleErrorMessage() + } + } + + const signMessageHex = async () => { + try { + resetConsole() + + const wallet = sequence.getWallet() + + appendConsoleLine('signing message...') + const signer = wallet.getSigner() + + // Message in hex + const message = ethers.hexlify(ethers.toUtf8Bytes('Hello, world!')) + + // sign + const sig = await signer.signMessage(message) + appendConsoleLine(`signature: ${sig}`) + + const isValid = await wallet.utils.isValidMessageSignature(wallet.getAddress(), message, sig, await signer.getChainId()) + appendConsoleLine(`isValid?: ${isValid}`) + if (!isValid) throw new Error('sig invalid') + + setConsoleLoading(false) + } catch (e) { + console.error(e) + consoleErrorMessage() + } + } + + const signMessageBytes = async () => { + try { + resetConsole() + + const wallet = sequence.getWallet() + + appendConsoleLine('signing message...') + const signer = wallet.getSigner() + + // Message in hex + const message = ethers.toUtf8Bytes('Hello, world!') + + // sign + const sig = await signer.signMessage(message) + appendConsoleLine(`signature: ${sig}`) + + const isValid = await wallet.utils.isValidMessageSignature(wallet.getAddress(), message, sig, await signer.getChainId()) + appendConsoleLine(`isValid?: ${isValid}`) + if (!isValid) throw new Error('sig invalid') + + setConsoleLoading(false) + } catch (e) { + console.error(e) + consoleErrorMessage() + } + } + + const signTypedData = async () => { + try { + resetConsole() + const wallet = sequence.getWallet() + + appendConsoleLine('signing typedData...') + + const typedData: sequence.utils.TypedData = { + types: { + Person: [ + { name: 'name', type: 'string' }, + { name: 'wallet', type: 'address' } + ], + Mail: [ + { name: 'from', type: 'Person' }, + { name: 'to', type: 'Person' }, + { name: 'cc', type: 'Person[]' }, + { name: 'contents', type: 'string' }, + { name: 'attachements', type: 'string[]' } + ] + }, + primaryType: 'Mail', + domain: { + name: 'Ether Mail', + version: '1', + chainId: 1, + verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC' + }, + message: { + from: { + name: 'Cow', + wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826' + }, + to: { + name: 'Bob', + wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB' + }, + cc: [ + { name: 'Dev Team', wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB' }, + { name: 'Accounting', wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB' } + ], + contents: 'Hello, Bob!', + attachements: ['cat.png', 'dog.png'] + } + } + + const signer = wallet.getSigner() + + const sig = await signer.signTypedData(typedData.domain, typedData.types, typedData.message) + appendConsoleLine(`signature: ${sig}`) + + // validate + const isValid = await wallet.utils.isValidTypedDataSignature(wallet.getAddress(), typedData, sig, await signer.getChainId()) + appendConsoleLine(`isValid?: ${isValid}`) + + setConsoleLoading(false) + } catch (e) { + console.error(e) + consoleErrorMessage() + } + } + + const estimateUnwrapGas = async () => { + try { + resetConsole() + + const wallet = sequence.getWallet() + + const wmaticContractAddress = '0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270' + const wmaticInterface = new ethers.Interface(['function withdraw(uint256 amount)']) + + const tx: sequence.transactions.Transaction = { + to: wmaticContractAddress, + data: wmaticInterface.encodeFunctionData('withdraw', ['1000000000000000000']) + } + + const provider = wallet.getProvider() + const estimate = await provider.estimateGas(tx) + + appendConsoleLine(`estimated gas needed for wmatic withdrawal : ${estimate.toString()}`) + + setConsoleLoading(false) + } catch (e) { + console.error(e) + consoleErrorMessage() + } + } + + const sendETH = async (signer?: sequence.provider.SequenceSigner) => { + try { + resetConsole() + const wallet = sequence.getWallet() + + signer = signer || wallet.getSigner() + + appendConsoleLine(`Transfer txn on ${signer.getChainId()} chainId`) + + // NOTE: on mainnet, the balance will be of ETH value + // and on matic, the balance will be of MATIC value + + // Sending the funds to the wallet itself + // so we don't lose any funds ;-) + // (of course, you can send anywhere) + const toAddress = await signer.getAddress() + + const tx1: sequence.transactions.Transaction = { + delegateCall: false, + revertOnError: false, + gasLimit: '0x55555', + to: toAddress, + value: ethers.parseEther('1.234'), + data: '0x' + } + + const tx2: sequence.transactions.Transaction = { + delegateCall: false, + revertOnError: false, + gasLimit: '0x55555', + to: toAddress, + value: ethers.parseEther('0.4242'), + data: '0x' + } + + const provider = signer.provider + + const balance1 = await provider.getBalance(toAddress) + appendConsoleLine(`balance of ${toAddress}, before: ${balance1}`) + + const txnResp = await signer.sendTransaction([tx1, tx2]) + appendConsoleLine(`txnResponse: ${JSON.stringify(txnResp)}`) + + const balance2 = await provider.getBalance(toAddress) + appendConsoleLine(`balance of ${toAddress}, after: ${balance2}`) + + setConsoleLoading(false) + } catch (e) { + console.error(e) + consoleErrorMessage() + } + } + + const sendSepoliaUSDC = async (signer?: sequence.provider.SequenceSigner) => { + try { + resetConsole() + + const wallet = sequence.getWallet() + + signer = signer || wallet.getSigner() // select DefaultChain signer by default + + // Sending the funds to the wallet itself + // so we don't lose any funds ;-) + // (of course, you can send anywhere) + const toAddress = await signer.getAddress() + + const amount = ethers.parseUnits('1', 1) + + // (USDC address on Sepolia) + const usdcAddress = '0x07865c6e87b9f70255377e024ace6630c1eaa37f' + + const tx: sequence.transactions.Transaction = { + delegateCall: false, + revertOnError: false, + gasLimit: '0x55555', + to: usdcAddress, + value: 0, + data: new ethers.Interface(ERC_20_ABI).encodeFunctionData('transfer', [toAddress, toHexString(amount)]) + } + + const txnResp = await signer.sendTransaction([tx], { chainId: ChainId.SEPOLIA }) + appendConsoleLine(`txnResponse: ${JSON.stringify(txnResp)}`) + + setConsoleLoading(false) + } catch (e) { + console.error(e) + consoleErrorMessage() + } + } + + const sendDAI = async (signer?: sequence.provider.SequenceSigner) => { + try { + resetConsole() + + const wallet = sequence.getWallet() + + signer = signer || wallet.getSigner() // select DefaultChain signer by default + + // Sending the funds to the wallet itself + // so we don't lose any funds ;-) + // (of course, you can send anywhere) + const toAddress = await signer.getAddress() + + const amount = ethers.parseUnits('0.05', 18) + const daiContractAddress = '0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063' // (DAI address on Polygon) + + const tx: sequence.transactions.Transaction = { + delegateCall: false, + revertOnError: false, + gasLimit: '0x55555', + to: daiContractAddress, + value: 0, + data: new ethers.Interface(ERC_20_ABI).encodeFunctionData('transfer', [toAddress, toHexString(amount)]) + } + + const txnResp = await signer.sendTransaction([tx]) + appendConsoleLine(`txnResponse: ${JSON.stringify(txnResp)}`) + + setConsoleLoading(false) + } catch (e) { + console.error(e) + consoleErrorMessage() + } + } + + const sendETHSidechain = async () => { + try { + const wallet = sequence.getWallet() + + // Send either to Arbitrum or Optimism + // just pick one that is not the current chainId + const pick = wallet.getChainId() === ChainId.ARBITRUM ? ChainId.OPTIMISM : ChainId.ARBITRUM + sendETH(wallet.getSigner(pick)) + } catch (e) { + console.error(e) + consoleErrorMessage() + } + } + + const send1155Tokens = async () => { + try { + resetConsole() + appendConsoleLine('TODO') + setConsoleLoading(false) + } catch (e) { + console.error(e) + consoleErrorMessage() + } + } + + const contractExample = async (signer?: sequence.provider.SequenceSigner) => { + try { + resetConsole() + + const wallet = sequence.getWallet() + + signer = signer || wallet.getSigner() + + const abi = [ + 'function balanceOf(address owner) view returns (uint256)', + 'function decimals() view returns (uint8)', + 'function symbol() view returns (string)', + 'function transfer(address to, uint amount) returns (bool)', + 'event Transfer(address indexed from, address indexed to, uint amount)' + ] + + // USD Coin (PoS) on Polygon + const address = '0x2791bca1f2de4661ed88a30c99a7a9449aa84174' + + const usdc = new ethers.Contract(address, abi) + + const usdSymbol = await usdc.symbol() + appendConsoleLine(`Token symbol: ${usdSymbol}`) + + const balance = await usdc.balanceOf(await signer.getAddress()) + appendConsoleLine(`Token Balance: ${balance.toString()}`) + + setConsoleLoading(false) + } catch (e) { + console.error(e) + consoleErrorMessage() + } + } + + const fetchTokenBalances = async () => { + try { + resetConsole() + + const wallet = sequence.getWallet() + + const signer = wallet.getSigner() + const accountAddress = await signer.getAddress() + const networks = await wallet.getNetworks() + const network = networks.find(network => network.chainId === ChainId.POLYGON) + + if (!network) { + throw new Error(`Could not find Polygon network in networks list`) + } + + const indexer = new sequence.indexer.SequenceIndexer(network.indexerUrl) + + const tokenBalances = await indexer.getTokenBalances({ + accountAddress: accountAddress, + includeMetadata: true + }) + + appendConsoleLine(`tokens in your account: ${JSON.stringify(tokenBalances)}`) + + // NOTE: you can put any NFT/collectible address in the `contractAddress` field and it will return all of the balances + metadata. + // We use the Skyweaver production contract address here for demo purposes, but try another one :) + const skyweaverCollectibles = await indexer.getTokenBalances({ + accountAddress: accountAddress, + includeMetadata: true, + contractAddress: '0x631998e91476DA5B870D741192fc5Cbc55F5a52E' + }) + appendConsoleLine(`skyweaver collectibles in your account: ${JSON.stringify(skyweaverCollectibles)}`) + + setConsoleLoading(false) + } catch (e) { + console.error(e) + consoleErrorMessage() + } + } + + const updateImplementation = async (signer?: sequence.provider.SequenceSigner) => { + try { + resetConsole() + + const wallet = sequence.getWallet() + + signer = signer || wallet.getSigner() // select DefaultChain signer by default + + const transaction: sequence.transactions.Transaction = { + to: wallet.getAddress(), + data: new ethers.Interface(walletContracts.mainModule.abi).encodeFunctionData('updateImplementation', [ + ethers.ZeroAddress + ]) + } + + const response = await signer.sendTransaction(transaction) + appendConsoleLine(`response: ${JSON.stringify(response)}`) + setConsoleLoading(false) + } catch (e) { + console.error(e) + consoleErrorMessage() + } + } + + const updateImageHash = async (signer?: sequence.provider.SequenceSigner) => { + try { + resetConsole() + + const wallet = sequence.getWallet() + + signer = signer || wallet.getSigner() // select DefaultChain signer by default + + const transaction: sequence.transactions.Transaction = { + to: wallet.getAddress(), + data: new ethers.Interface(walletContracts.mainModuleUpgradable.abi).encodeFunctionData('updateImageHash', [ + ethers.ZeroHash + ]) + } + + const response = await signer.sendTransaction(transaction) + appendConsoleLine(`response: ${JSON.stringify(response)}`) + setConsoleLoading(false) + } catch (e) { + console.error(e) + consoleErrorMessage() + } + } + + const delegateCall = async (signer?: sequence.provider.SequenceSigner) => { + try { + resetConsole() + + const wallet = sequence.getWallet() + + signer = signer || wallet.getSigner() // select DefaultChain signer by default + + const transaction: sequence.transactions.Transaction = { + to: wallet.getAddress(), + delegateCall: true + } + + const response = await signer.sendTransaction(transaction) + appendConsoleLine(`response: ${JSON.stringify(response)}`) + setConsoleLoading(false) + } catch (e) { + console.error(e) + consoleErrorMessage() + } + } + + const addHook = async (signer?: sequence.provider.SequenceSigner) => { + try { + resetConsole() + + const wallet = sequence.getWallet() + + signer = signer || wallet.getSigner() // select DefaultChain signer by default + + const transaction: sequence.transactions.Transaction = { + to: wallet.getAddress(), + data: new ethers.Interface(['function addHook(bytes4 _signature, address _implementation)']).encodeFunctionData( + 'addHook', + ['0x01234567', ethers.ZeroAddress] + ) + } + + const response = await signer.sendTransaction(transaction) + appendConsoleLine(`response: ${JSON.stringify(response)}`) + setConsoleLoading(false) + } catch (e) { + console.error(e) + consoleErrorMessage() + } + } + + const setExtraImageHash = async (signer?: sequence.provider.SequenceSigner) => { + try { + resetConsole() + + const wallet = sequence.getWallet() + + signer = signer || wallet.getSigner() // select DefaultChain signer by default + + const transaction: sequence.transactions.Transaction = { + to: wallet.getAddress(), + data: new ethers.Interface(['function setExtraImageHash(bytes32 _imageHash, uint256 _expiration)']).encodeFunctionData( + 'setExtraImageHash', + [ethers.ZeroHash, ethers.MaxUint256] + ) + } + + const response = await signer.sendTransaction(transaction) + appendConsoleLine(`response: ${JSON.stringify(response)}`) + setConsoleLoading(false) + } catch (e) { + console.error(e) + consoleErrorMessage() + } + } + + const appendConsoleLine = (message: string, clear = false) => { + console.log(message) + + if (clear) { + return setConsoleMsg(message) + } + + return setConsoleMsg(prevState => { + return `${prevState}\n\n${message}` + }) + } + + const resetConsole = () => { + setConsoleLoading(true) + } + + const consoleWelcomeMessage = () => { + setConsoleLoading(false) + + if (isWalletConnected) { + setConsoleMsg('Status: Wallet is connected :)') + } else { + setConsoleMsg('Status: Wallet not connected. Please connect wallet first.') + } + } + + const consoleErrorMessage = () => { + setConsoleLoading(false) + setConsoleMsg('An error occurred') + } + + // networks list, filtered and sorted + const omitNetworks = [ + ChainId.RINKEBY, + ChainId.HARDHAT, + ChainId.HARDHAT_2, + ChainId.KOVAN, + ChainId.ROPSTEN, + ChainId.HOMEVERSE_TESTNET, + ChainId.BASE_GOERLI + ] + + const mainnets = Object.values(sequence.network.networks) + .filter(network => network.type === NetworkType.MAINNET) + .sort((a, b) => a.chainId - b.chainId) + const testnets = Object.values(sequence.network.networks) + .filter(network => network.type === NetworkType.TESTNET) + .sort((a, b) => a.chainId - b.chainId) + const networks = [...mainnets, ...testnets].filter(network => !network.deprecated && !omitNetworks.includes(network.chainId)) + + useEffect(() => { + if (email && !isOpen) { + console.log(email) + connect({ + app: 'Demo Dapp', + authorize: true, + settings: { + // Specify signInWithEmail with an email address to allow user automatically sign in with the email option. + signInWithEmail: email, + theme: 'dark', + bannerUrl: `${window.location.origin}${skyweaverBannerUrl}` + } + }) + setEmail(null) + } + }, [email, isOpen]) + + const sanitizeEmail = (email: string) => { + // Trim unnecessary spaces + email = email.trim() + + // Check if the email matches the pattern of a typical email + const emailRegex = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6}$/ + if (emailRegex.test(email)) { + return true + } + + return false + } return ( - <> -
-

Account

- -
- status: {account.status} -
- addresses: {JSON.stringify(account.addresses)} -
- chainId: {account.chainId} -
- - {account.status === 'connected' && ( - + + + + logo + + + + + + Demo Dapp + + + + + + A dapp example on how to use the Sequence Wallet. This covers how to connect, sign messages and send transctions. + + + + + + + Please open your browser dev inspector to view output of functions below. + + + + + + {!isCustom && ( + + wallet.setDefaultChainId(Number(value))} + value={String(showChainId)} + options={[ + ...Object.values(networks).map(network => ({ + label: ( + + + {network.title!} + + ), + value: String(network.chainId) + })) + ]} + /> + + + +
- -
-

Connect

- {connectors.map((connector) => ( - - ))} -
{status}
-
{error?.message}
-
- + + + ) } -export default App +export default React.memo(App)