From 75d2c26e34fd1b53b4c55fc8eb5c6adb53862944 Mon Sep 17 00:00:00 2001 From: moldy530 <4642570+moldy530@users.noreply.github.com> Date: Wed, 8 Jan 2025 21:14:14 +0000 Subject: [PATCH 1/3] chore: add PR step for validating iOS builds (#1266) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # Pull Request Checklist - [ ] Did you add new tests and confirm existing tests pass? (`yarn test`) - [ ] Did you update relevant docs? (docs are found in the `site` folder, and guidelines for updating/adding docs can be found in the [contribution guide](https://github.com/alchemyplatform/aa-sdk/blob/main/CONTRIBUTING.md)) - [ ] Do your commits follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) standard? - [ ] Does your PR title also follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) standard? - [ ] If you have a breaking change, is it [correctly reflected in your commit message](https://www.conventionalcommits.org/en/v1.0.0/#examples)? (e.g. `feat!: breaking change`) - [ ] Did you run lint (`yarn lint:check`) and fix any issues? (`yarn lint:write`) - [ ] Did you follow the [contribution guidelines](https://github.com/alchemyplatform/aa-sdk/blob/main/CONTRIBUTING.md)? --- ## PR-Codex overview This PR focuses on cleaning up the CI workflow by removing unnecessary steps and adding a new job for building an iOS application. ### Detailed summary - Deleted the file `.github/workflows/ci.yml`. - Removed the `free disk space` job from `.github/workflows/on-pull-request.yml`. - Added a new job `build_ios` to build the iOS application. - Included steps for checking out files, setting up, installing `cocoapods`, and building the iOS example. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` --- .github/actions/setup/action.yml | 15 ++ .github/workflows/on-pull-request.yml | 42 +++-- .../.github/actions/setup/action.yml | 27 --- .../rn-signer/.github/workflows/ci.yml | 157 ------------------ 4 files changed, 44 insertions(+), 197 deletions(-) delete mode 100644 account-kit/rn-signer/.github/actions/setup/action.yml delete mode 100644 account-kit/rn-signer/.github/workflows/ci.yml diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml index c556042db4..46b24359cc 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup/action.yml @@ -67,6 +67,21 @@ runs: run: | /bin/bash -c "yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --licenses > /dev/null" + - name: Clear Linux specific files + if: runner.os == 'Linux' + shell: bash + run: | + sudo swapoff -a + sudo rm -f /swapfile + sudo apt clean + images=$(docker image ls -aq) + if [ -n "$images" ]; then + docker rmi $images + else + echo "No images to remove." + fi + df -h + # similarly, I'm not seeing this cache ever get used # - name: Cache Gradle # if: env.turbo_cache_hit != 1 diff --git a/.github/workflows/on-pull-request.yml b/.github/workflows/on-pull-request.yml index e12d8a4d52..d8e8c49db6 100644 --- a/.github/workflows/on-pull-request.yml +++ b/.github/workflows/on-pull-request.yml @@ -75,19 +75,6 @@ jobs: fetch-depth: "0" submodules: "recursive" - - name: free disk space - run: | - sudo swapoff -a - sudo rm -f /swapfile - sudo apt clean - images=$(docker image ls -aq) - if [ -n "$images" ]; then - docker rmi $images - else - echo "No images to remove." - fi - df -h - - name: Setup uses: ./.github/actions/setup @@ -114,4 +101,33 @@ jobs: - name: Unit Test run: yarn test:ci + + build_ios: + name: Build iOS + runs-on: macos-14 + env: + OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} + API_KEY: ${{ secrets.API_KEY }} + TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} + TURBO_TEAM: ${{ vars.TURBO_TEAM }} + steps: + - name: "Checkout files" + uses: actions/checkout@v3 + with: + token: ${{ secrets.ALCHEMY_BOT_PAT }} + fetch-depth: "0" + submodules: "recursive" + + - name: Setup + uses: ./.github/actions/setup + - name: Install cocoapods + working-directory: account-kit/rn-signer/example/ios + run: | + pod install + env: + NO_FLIPPER: 1 + + - name: Build example for iOS + run: | + yarn turbo run build:ios diff --git a/account-kit/rn-signer/.github/actions/setup/action.yml b/account-kit/rn-signer/.github/actions/setup/action.yml deleted file mode 100644 index fb98c79ad8..0000000000 --- a/account-kit/rn-signer/.github/actions/setup/action.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: Setup -description: Setup Node.js and install dependencies - -runs: - using: composite - steps: - - name: Setup Node.js - uses: actions/setup-node@v3 - with: - node-version-file: .nvmrc - - - name: Cache dependencies - id: yarn-cache - uses: actions/cache@v3 - with: - path: | - **/node_modules - .yarn/install-state.gz - key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}-${{ hashFiles('**/package.json', '!node_modules/**') }} - restore-keys: | - ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }} - ${{ runner.os }}-yarn- - - - name: Install dependencies - if: steps.yarn-cache.outputs.cache-hit != 'true' - run: yarn install --immutable - shell: bash diff --git a/account-kit/rn-signer/.github/workflows/ci.yml b/account-kit/rn-signer/.github/workflows/ci.yml deleted file mode 100644 index bbd4f05d77..0000000000 --- a/account-kit/rn-signer/.github/workflows/ci.yml +++ /dev/null @@ -1,157 +0,0 @@ -name: CI -on: - push: - branches: - - main - pull_request: - branches: - - main - merge_group: - types: - - checks_requested - -jobs: - lint: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Setup - uses: ./.github/actions/setup - - - name: Lint files - run: yarn lint - - - name: Typecheck files - run: yarn typecheck - - test: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Setup - uses: ./.github/actions/setup - - - name: Run unit tests - run: yarn test --maxWorkers=2 --coverage - - build-library: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Setup - uses: ./.github/actions/setup - - - name: Build package - run: yarn prepare - - build-android: - runs-on: ubuntu-latest - env: - TURBO_CACHE_DIR: .turbo/android - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Setup - uses: ./.github/actions/setup - - - name: Cache turborepo for Android - uses: actions/cache@v3 - with: - path: ${{ env.TURBO_CACHE_DIR }} - key: ${{ runner.os }}-turborepo-android-${{ hashFiles('yarn.lock') }} - restore-keys: | - ${{ runner.os }}-turborepo-android- - - - name: Check turborepo cache for Android - run: | - TURBO_CACHE_STATUS=$(node -p "($(yarn turbo run build:android --cache-dir="${{ env.TURBO_CACHE_DIR }}" --dry=json)).tasks.find(t => t.task === 'build:android').cache.status") - - if [[ $TURBO_CACHE_STATUS == "HIT" ]]; then - echo "turbo_cache_hit=1" >> $GITHUB_ENV - fi - - - name: Install JDK - if: env.turbo_cache_hit != 1 - uses: actions/setup-java@v3 - with: - distribution: "zulu" - java-version: "17" - - - name: Finalize Android SDK - if: env.turbo_cache_hit != 1 - run: | - /bin/bash -c "yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --licenses > /dev/null" - - - name: Cache Gradle - if: env.turbo_cache_hit != 1 - uses: actions/cache@v3 - with: - path: | - ~/.gradle/wrapper - ~/.gradle/caches - key: ${{ runner.os }}-gradle-${{ hashFiles('example/android/gradle/wrapper/gradle-wrapper.properties') }} - restore-keys: | - ${{ runner.os }}-gradle- - - - name: Build example for Android - env: - JAVA_OPTS: "-XX:MaxHeapSize=6g" - run: | - yarn turbo run build:android --cache-dir="${{ env.TURBO_CACHE_DIR }}" - - build-ios: - runs-on: macos-14 - env: - TURBO_CACHE_DIR: .turbo/ios - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Setup - uses: ./.github/actions/setup - - - name: Cache turborepo for iOS - uses: actions/cache@v3 - with: - path: ${{ env.TURBO_CACHE_DIR }} - key: ${{ runner.os }}-turborepo-ios-${{ hashFiles('yarn.lock') }} - restore-keys: | - ${{ runner.os }}-turborepo-ios- - - - name: Check turborepo cache for iOS - run: | - TURBO_CACHE_STATUS=$(node -p "($(yarn turbo run build:ios --cache-dir="${{ env.TURBO_CACHE_DIR }}" --dry=json)).tasks.find(t => t.task === 'build:ios').cache.status") - - if [[ $TURBO_CACHE_STATUS == "HIT" ]]; then - echo "turbo_cache_hit=1" >> $GITHUB_ENV - fi - - - name: Cache cocoapods - if: env.turbo_cache_hit != 1 - id: cocoapods-cache - uses: actions/cache@v3 - with: - path: | - **/ios/Pods - key: ${{ runner.os }}-cocoapods-${{ hashFiles('example/ios/Podfile.lock') }} - restore-keys: | - ${{ runner.os }}-cocoapods- - - - name: Install cocoapods - if: env.turbo_cache_hit != 1 && steps.cocoapods-cache.outputs.cache-hit != 'true' - run: | - cd example/ios - pod install - env: - NO_FLIPPER: 1 - - - name: Build example for iOS - run: | - yarn turbo run build:ios --cache-dir="${{ env.TURBO_CACHE_DIR }}" From 06d9deda91e24f7c654bbf2e5713644fd39f6a85 Mon Sep 17 00:00:00 2001 From: Alchemy Bot Date: Thu, 9 Jan 2025 00:00:04 +0000 Subject: [PATCH 2/3] chore(release): publish v4.8.0 [skip-ci] --- CHANGELOG.md | 24 ++++++++++++++++++++++++ aa-sdk/core/CHANGELOG.md | 11 +++++++++++ aa-sdk/core/package.json | 2 +- aa-sdk/core/src/version.ts | 2 +- aa-sdk/ethers/CHANGELOG.md | 4 ++++ aa-sdk/ethers/package.json | 6 +++--- account-kit/core/CHANGELOG.md | 4 ++++ account-kit/core/package.json | 10 +++++----- account-kit/core/src/version.ts | 2 +- account-kit/infra/CHANGELOG.md | 8 ++++++++ account-kit/infra/package.json | 6 +++--- account-kit/infra/src/version.ts | 2 +- account-kit/logging/CHANGELOG.md | 4 ++++ account-kit/logging/package.json | 2 +- account-kit/logging/src/version.ts | 2 +- account-kit/plugingen/CHANGELOG.md | 4 ++++ account-kit/plugingen/package.json | 4 ++-- account-kit/plugingen/src/version.ts | 2 +- account-kit/react/CHANGELOG.md | 4 ++++ account-kit/react/package.json | 10 +++++----- account-kit/react/src/version.ts | 2 +- account-kit/rn-signer/CHANGELOG.md | 10 ++++++++++ account-kit/rn-signer/package.json | 6 +++--- account-kit/signer/CHANGELOG.md | 4 ++++ account-kit/signer/package.json | 6 +++--- account-kit/signer/src/version.ts | 2 +- account-kit/smart-contracts/CHANGELOG.md | 11 +++++++++++ account-kit/smart-contracts/package.json | 8 ++++---- lerna.json | 2 +- 29 files changed, 126 insertions(+), 38 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fe8c56d910..3efd22b9bd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,30 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [4.8.0](https://github.com/alchemyplatform/aa-sdk/compare/v4.7.0...v4.8.0) (2025-01-08) + +### Bug Fixes + +- correctly trim implementation address ([#1261](https://github.com/alchemyplatform/aa-sdk/issues/1261)) ([5dae940](https://github.com/alchemyplatform/aa-sdk/commit/5dae940eee1c776b54804a9aac8d46fe51e89d19)) +- lost changes from other PRs ([#1259](https://github.com/alchemyplatform/aa-sdk/issues/1259)) ([6546664](https://github.com/alchemyplatform/aa-sdk/commit/6546664887a45e8b25745a3cac539cde9473e4bf)) +- maybe fix ci memory issue ([#1258](https://github.com/alchemyplatform/aa-sdk/issues/1258)) ([d92513e](https://github.com/alchemyplatform/aa-sdk/commit/d92513e2a5cf82c6857d9184ccb81c45d6ea799e)) +- skip docker rmi if no images ([#1262](https://github.com/alchemyplatform/aa-sdk/issues/1262)) ([833fb8e](https://github.com/alchemyplatform/aa-sdk/commit/833fb8e485ba170073110814f510ca52db074ed0)) + +### Features + +- add expo example ([#1204](https://github.com/alchemyplatform/aa-sdk/issues/1204)) ([bccb6e7](https://github.com/alchemyplatform/aa-sdk/commit/bccb6e7172fed90a24b5a875502cef3d0f660a8b)) +- add expo otp example ([#1243](https://github.com/alchemyplatform/aa-sdk/issues/1243)) ([30d6443](https://github.com/alchemyplatform/aa-sdk/commit/30d6443af790055f66b5d8bb0676b51f72f61b3e)) +- add ink mainnet ([#1225](https://github.com/alchemyplatform/aa-sdk/issues/1225)) ([0a6606e](https://github.com/alchemyplatform/aa-sdk/commit/0a6606e6a447f08406aa84308795118eda950531)) +- add mekong devnet support ([#1239](https://github.com/alchemyplatform/aa-sdk/issues/1239)) ([baad28a](https://github.com/alchemyplatform/aa-sdk/commit/baad28a6b1df36f66eae1fb723bbcfdc61592a51)) +- add otp and magic link example updates to the documentation ([#1247](https://github.com/alchemyplatform/aa-sdk/issues/1247)) ([1624def](https://github.com/alchemyplatform/aa-sdk/commit/1624defcd72b74b2272bff5ea40db93bc5cd4117)) +- add OTP authentication capabilities to RN Signer ([#1231](https://github.com/alchemyplatform/aa-sdk/issues/1231)) ([6ebfca5](https://github.com/alchemyplatform/aa-sdk/commit/6ebfca58a7ef617d0915661171038daa0b497068)) +- add otp example to bare rn app ([#1235](https://github.com/alchemyplatform/aa-sdk/issues/1235)) ([dbf4db9](https://github.com/alchemyplatform/aa-sdk/commit/dbf4db90b58220b184db388f43b2b2bded54d873)) +- basic ma v2 sdk integrations ([#1220](https://github.com/alchemyplatform/aa-sdk/issues/1220)) ([e513d84](https://github.com/alchemyplatform/aa-sdk/commit/e513d84406acb9dcc72d30a12dce4fbd15adeab8)), closes [#1221](https://github.com/alchemyplatform/aa-sdk/issues/1221) [#1223](https://github.com/alchemyplatform/aa-sdk/issues/1223) [#1232](https://github.com/alchemyplatform/aa-sdk/issues/1232) [#1233](https://github.com/alchemyplatform/aa-sdk/issues/1233) [#1246](https://github.com/alchemyplatform/aa-sdk/issues/1246) +- **chains:** add ink and soneium mainnet ([#1215](https://github.com/alchemyplatform/aa-sdk/issues/1215)) ([de83640](https://github.com/alchemyplatform/aa-sdk/commit/de83640936bfa43f04fa274efda5a968afc4d773)) +- **rn:** add iOS support ([#1210](https://github.com/alchemyplatform/aa-sdk/issues/1210)) ([2e3892c](https://github.com/alchemyplatform/aa-sdk/commit/2e3892cac57c517cb93d0349297feedd2ca07dfb)) +- **rn:** implement RN iOS stamper ([#1213](https://github.com/alchemyplatform/aa-sdk/issues/1213)) ([f9e3e91](https://github.com/alchemyplatform/aa-sdk/commit/f9e3e912700c35456ecdf97fa68bd1beb182f0bf)) +- update build workflow to delete unnecessary files before building ([#1240](https://github.com/alchemyplatform/aa-sdk/issues/1240)) ([d0b0924](https://github.com/alchemyplatform/aa-sdk/commit/d0b092425b09365a6acb0cb0cb798975577750d0)) + # [4.7.0](https://github.com/alchemyplatform/aa-sdk/compare/v4.6.1...v4.7.0) (2024-12-16) ### Bug Fixes diff --git a/aa-sdk/core/CHANGELOG.md b/aa-sdk/core/CHANGELOG.md index 9bb700d380..bd0aaece8f 100644 --- a/aa-sdk/core/CHANGELOG.md +++ b/aa-sdk/core/CHANGELOG.md @@ -3,6 +3,17 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [4.8.0](https://github.com/alchemyplatform/aa-sdk/compare/v4.7.0...v4.8.0) (2025-01-08) + +### Bug Fixes + +- correctly trim implementation address ([#1261](https://github.com/alchemyplatform/aa-sdk/issues/1261)) ([5dae940](https://github.com/alchemyplatform/aa-sdk/commit/5dae940eee1c776b54804a9aac8d46fe51e89d19)) +- lost changes from other PRs ([#1259](https://github.com/alchemyplatform/aa-sdk/issues/1259)) ([6546664](https://github.com/alchemyplatform/aa-sdk/commit/6546664887a45e8b25745a3cac539cde9473e4bf)) + +### Features + +- basic ma v2 sdk integrations ([#1220](https://github.com/alchemyplatform/aa-sdk/issues/1220)) ([e513d84](https://github.com/alchemyplatform/aa-sdk/commit/e513d84406acb9dcc72d30a12dce4fbd15adeab8)), closes [#1221](https://github.com/alchemyplatform/aa-sdk/issues/1221) [#1223](https://github.com/alchemyplatform/aa-sdk/issues/1223) [#1232](https://github.com/alchemyplatform/aa-sdk/issues/1232) [#1233](https://github.com/alchemyplatform/aa-sdk/issues/1233) [#1246](https://github.com/alchemyplatform/aa-sdk/issues/1246) + # [4.7.0](https://github.com/alchemyplatform/aa-sdk/compare/v4.6.1...v4.7.0) (2024-12-16) **Note:** Version bump only for package @aa-sdk/core diff --git a/aa-sdk/core/package.json b/aa-sdk/core/package.json index cb2334c52e..f2e45bcf4d 100644 --- a/aa-sdk/core/package.json +++ b/aa-sdk/core/package.json @@ -1,7 +1,7 @@ { "name": "@aa-sdk/core", "license": "MIT", - "version": "4.7.0", + "version": "4.8.0", "description": "viem based SDK that enables interactions with ERC-4337 Smart Accounts. ABIs are based off the definitions generated in @account-abstraction/contracts", "author": "Alchemy", "type": "module", diff --git a/aa-sdk/core/src/version.ts b/aa-sdk/core/src/version.ts index a6e3e3bf6d..74f2a4bc2e 100644 --- a/aa-sdk/core/src/version.ts +++ b/aa-sdk/core/src/version.ts @@ -1,3 +1,3 @@ // This file is autogenerated by inject-version.ts. Any changes will be // overwritten on commit! -export const VERSION = "4.7.0"; +export const VERSION = "4.8.0"; diff --git a/aa-sdk/ethers/CHANGELOG.md b/aa-sdk/ethers/CHANGELOG.md index 46c2f242eb..0905da9b78 100644 --- a/aa-sdk/ethers/CHANGELOG.md +++ b/aa-sdk/ethers/CHANGELOG.md @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [4.8.0](https://github.com/alchemyplatform/aa-sdk/compare/v4.7.0...v4.8.0) (2025-01-08) + +**Note:** Version bump only for package @aa-sdk/ethers + # [4.7.0](https://github.com/alchemyplatform/aa-sdk/compare/v4.6.1...v4.7.0) (2024-12-16) **Note:** Version bump only for package @aa-sdk/ethers diff --git a/aa-sdk/ethers/package.json b/aa-sdk/ethers/package.json index c31329ea67..8f85340d36 100644 --- a/aa-sdk/ethers/package.json +++ b/aa-sdk/ethers/package.json @@ -1,7 +1,7 @@ { "name": "@aa-sdk/ethers", "license": "MIT", - "version": "4.7.0", + "version": "4.8.0", "description": "Ethers.js wrapper for @aa-sdk/core", "author": "Alchemy", "type": "module", @@ -41,7 +41,7 @@ "test:run": "vitest run" }, "devDependencies": { - "@account-kit/smart-contracts": "^4.7.0", + "@account-kit/smart-contracts": "^4.8.0", "alchemy-sdk": "^3.0.0", "dotenv": "^16.0.3", "typescript": "^5.0.4", @@ -49,7 +49,7 @@ "vitest": "^2.0.4" }, "dependencies": { - "@aa-sdk/core": "^4.7.0", + "@aa-sdk/core": "^4.8.0", "@ethersproject/abi": "^5.7.0", "@ethersproject/abstract-signer": "^5.7.0", "@ethersproject/bytes": "^5.7.0", diff --git a/account-kit/core/CHANGELOG.md b/account-kit/core/CHANGELOG.md index 471aa7d17c..0b666e2b7d 100644 --- a/account-kit/core/CHANGELOG.md +++ b/account-kit/core/CHANGELOG.md @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [4.8.0](https://github.com/alchemyplatform/aa-sdk/compare/v4.7.0...v4.8.0) (2025-01-08) + +**Note:** Version bump only for package @account-kit/core + # [4.7.0](https://github.com/alchemyplatform/aa-sdk/compare/v4.6.1...v4.7.0) (2024-12-16) ### Features diff --git a/account-kit/core/package.json b/account-kit/core/package.json index 3a3c113d8f..8b8393ded9 100644 --- a/account-kit/core/package.json +++ b/account-kit/core/package.json @@ -1,6 +1,6 @@ { "name": "@account-kit/core", - "version": "4.7.0", + "version": "4.8.0", "description": "Core library for account kit that provides state management and framework indepednent abstractions across infra, Alchemy Signer, and Smart Contracts", "author": "Alchemy", "license": "MIT", @@ -45,10 +45,10 @@ "vitest": "^2.0.4" }, "dependencies": { - "@account-kit/infra": "^4.7.0", - "@account-kit/logging": "^4.7.0", - "@account-kit/signer": "^4.7.0", - "@account-kit/smart-contracts": "^4.7.0", + "@account-kit/infra": "^4.8.0", + "@account-kit/logging": "^4.8.0", + "@account-kit/signer": "^4.8.0", + "@account-kit/smart-contracts": "^4.8.0", "js-cookie": "^3.0.5", "zod": "^3.22.4", "zustand": "^5.0.0-rc.2" diff --git a/account-kit/core/src/version.ts b/account-kit/core/src/version.ts index a6e3e3bf6d..74f2a4bc2e 100644 --- a/account-kit/core/src/version.ts +++ b/account-kit/core/src/version.ts @@ -1,3 +1,3 @@ // This file is autogenerated by inject-version.ts. Any changes will be // overwritten on commit! -export const VERSION = "4.7.0"; +export const VERSION = "4.8.0"; diff --git a/account-kit/infra/CHANGELOG.md b/account-kit/infra/CHANGELOG.md index bdce241f0a..8af5ddf166 100644 --- a/account-kit/infra/CHANGELOG.md +++ b/account-kit/infra/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [4.8.0](https://github.com/alchemyplatform/aa-sdk/compare/v4.7.0...v4.8.0) (2025-01-08) + +### Features + +- add ink mainnet ([#1225](https://github.com/alchemyplatform/aa-sdk/issues/1225)) ([0a6606e](https://github.com/alchemyplatform/aa-sdk/commit/0a6606e6a447f08406aa84308795118eda950531)) +- add mekong devnet support ([#1239](https://github.com/alchemyplatform/aa-sdk/issues/1239)) ([baad28a](https://github.com/alchemyplatform/aa-sdk/commit/baad28a6b1df36f66eae1fb723bbcfdc61592a51)) +- **chains:** add ink and soneium mainnet ([#1215](https://github.com/alchemyplatform/aa-sdk/issues/1215)) ([de83640](https://github.com/alchemyplatform/aa-sdk/commit/de83640936bfa43f04fa274efda5a968afc4d773)) + # [4.7.0](https://github.com/alchemyplatform/aa-sdk/compare/v4.6.1...v4.7.0) (2024-12-16) **Note:** Version bump only for package @account-kit/infra diff --git a/account-kit/infra/package.json b/account-kit/infra/package.json index 488f71a639..2912b185b3 100644 --- a/account-kit/infra/package.json +++ b/account-kit/infra/package.json @@ -1,6 +1,6 @@ { "name": "@account-kit/infra", - "version": "4.7.0", + "version": "4.8.0", "description": "adapters for @aa-sdk/core for interacting with alchemy services", "author": "Alchemy", "license": "MIT", @@ -44,8 +44,8 @@ "vitest": "^2.0.4" }, "dependencies": { - "@aa-sdk/core": "^4.7.0", - "@account-kit/logging": "^4.7.0", + "@aa-sdk/core": "^4.8.0", + "@account-kit/logging": "^4.8.0", "eventemitter3": "^5.0.1", "zod": "^3.22.4" }, diff --git a/account-kit/infra/src/version.ts b/account-kit/infra/src/version.ts index a6e3e3bf6d..74f2a4bc2e 100644 --- a/account-kit/infra/src/version.ts +++ b/account-kit/infra/src/version.ts @@ -1,3 +1,3 @@ // This file is autogenerated by inject-version.ts. Any changes will be // overwritten on commit! -export const VERSION = "4.7.0"; +export const VERSION = "4.8.0"; diff --git a/account-kit/logging/CHANGELOG.md b/account-kit/logging/CHANGELOG.md index be59254ad7..8498bfb326 100644 --- a/account-kit/logging/CHANGELOG.md +++ b/account-kit/logging/CHANGELOG.md @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [4.8.0](https://github.com/alchemyplatform/aa-sdk/compare/v4.7.0...v4.8.0) (2025-01-08) + +**Note:** Version bump only for package @account-kit/logging + # [4.7.0](https://github.com/alchemyplatform/aa-sdk/compare/v4.6.1...v4.7.0) (2024-12-16) **Note:** Version bump only for package @account-kit/logging diff --git a/account-kit/logging/package.json b/account-kit/logging/package.json index a5b5114a5d..50e20f7578 100644 --- a/account-kit/logging/package.json +++ b/account-kit/logging/package.json @@ -1,6 +1,6 @@ { "name": "@account-kit/logging", - "version": "4.7.0", + "version": "4.8.0", "description": "Core logging library for Account Kit packages", "author": "Alchemy", "license": "MIT", diff --git a/account-kit/logging/src/version.ts b/account-kit/logging/src/version.ts index a6e3e3bf6d..74f2a4bc2e 100644 --- a/account-kit/logging/src/version.ts +++ b/account-kit/logging/src/version.ts @@ -1,3 +1,3 @@ // This file is autogenerated by inject-version.ts. Any changes will be // overwritten on commit! -export const VERSION = "4.7.0"; +export const VERSION = "4.8.0"; diff --git a/account-kit/plugingen/CHANGELOG.md b/account-kit/plugingen/CHANGELOG.md index 7561daeb2f..508d400434 100644 --- a/account-kit/plugingen/CHANGELOG.md +++ b/account-kit/plugingen/CHANGELOG.md @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [4.8.0](https://github.com/alchemyplatform/aa-sdk/compare/v4.7.0...v4.8.0) (2025-01-08) + +**Note:** Version bump only for package @account-kit/plugingen + # [4.7.0](https://github.com/alchemyplatform/aa-sdk/compare/v4.6.1...v4.7.0) (2024-12-16) **Note:** Version bump only for package @account-kit/plugingen diff --git a/account-kit/plugingen/package.json b/account-kit/plugingen/package.json index 9ab34ff9ef..ee59eda39a 100644 --- a/account-kit/plugingen/package.json +++ b/account-kit/plugingen/package.json @@ -1,6 +1,6 @@ { "name": "@account-kit/plugingen", - "version": "4.7.0", + "version": "4.8.0", "description": "A CLI tool that enables you to generate TS code for your ERC-6900 plugins", "author": "Alchemy", "license": "MIT", @@ -60,7 +60,7 @@ }, "homepage": "https://github.com/alchemyplatform/aa-sdk#readme", "dependencies": { - "@aa-sdk/core": "^4.7.0", + "@aa-sdk/core": "^4.8.0", "bundle-require": "^4.0.2", "cac": "^6.7.14", "change-case": "^5.4.3", diff --git a/account-kit/plugingen/src/version.ts b/account-kit/plugingen/src/version.ts index a6e3e3bf6d..74f2a4bc2e 100644 --- a/account-kit/plugingen/src/version.ts +++ b/account-kit/plugingen/src/version.ts @@ -1,3 +1,3 @@ // This file is autogenerated by inject-version.ts. Any changes will be // overwritten on commit! -export const VERSION = "4.7.0"; +export const VERSION = "4.8.0"; diff --git a/account-kit/react/CHANGELOG.md b/account-kit/react/CHANGELOG.md index f63366bbc7..07b47a6023 100644 --- a/account-kit/react/CHANGELOG.md +++ b/account-kit/react/CHANGELOG.md @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [4.8.0](https://github.com/alchemyplatform/aa-sdk/compare/v4.7.0...v4.8.0) (2025-01-08) + +**Note:** Version bump only for package @account-kit/react + # [4.7.0](https://github.com/alchemyplatform/aa-sdk/compare/v4.6.1...v4.7.0) (2024-12-16) ### Features diff --git a/account-kit/react/package.json b/account-kit/react/package.json index 76ce505f70..f4c449b689 100644 --- a/account-kit/react/package.json +++ b/account-kit/react/package.json @@ -1,6 +1,6 @@ { "name": "@account-kit/react", - "version": "4.7.0", + "version": "4.8.0", "description": "React components and hooks for using Account Kit", "author": "Alchemy", "license": "MIT", @@ -67,10 +67,10 @@ "vitest": "^2.0.4" }, "dependencies": { - "@account-kit/core": "^4.7.0", - "@account-kit/infra": "^4.7.0", - "@account-kit/logging": "^4.7.0", - "@account-kit/signer": "^4.7.0", + "@account-kit/core": "^4.8.0", + "@account-kit/infra": "^4.8.0", + "@account-kit/logging": "^4.8.0", + "@account-kit/signer": "^4.8.0", "@tanstack/react-form": "^0.33.0", "@tanstack/zod-form-adapter": "^0.33.0", "@wagmi/connectors": "^5.1.15", diff --git a/account-kit/react/src/version.ts b/account-kit/react/src/version.ts index a6e3e3bf6d..74f2a4bc2e 100644 --- a/account-kit/react/src/version.ts +++ b/account-kit/react/src/version.ts @@ -1,3 +1,3 @@ // This file is autogenerated by inject-version.ts. Any changes will be // overwritten on commit! -export const VERSION = "4.7.0"; +export const VERSION = "4.8.0"; diff --git a/account-kit/rn-signer/CHANGELOG.md b/account-kit/rn-signer/CHANGELOG.md index b504ab4279..dd3ebe2baa 100644 --- a/account-kit/rn-signer/CHANGELOG.md +++ b/account-kit/rn-signer/CHANGELOG.md @@ -3,6 +3,16 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [4.8.0](https://github.com/alchemyplatform/aa-sdk/compare/v4.7.0...v4.8.0) (2025-01-08) + +### Features + +- add expo example ([#1204](https://github.com/alchemyplatform/aa-sdk/issues/1204)) ([bccb6e7](https://github.com/alchemyplatform/aa-sdk/commit/bccb6e7172fed90a24b5a875502cef3d0f660a8b)) +- add OTP authentication capabilities to RN Signer ([#1231](https://github.com/alchemyplatform/aa-sdk/issues/1231)) ([6ebfca5](https://github.com/alchemyplatform/aa-sdk/commit/6ebfca58a7ef617d0915661171038daa0b497068)) +- add otp example to bare rn app ([#1235](https://github.com/alchemyplatform/aa-sdk/issues/1235)) ([dbf4db9](https://github.com/alchemyplatform/aa-sdk/commit/dbf4db90b58220b184db388f43b2b2bded54d873)) +- **rn:** add iOS support ([#1210](https://github.com/alchemyplatform/aa-sdk/issues/1210)) ([2e3892c](https://github.com/alchemyplatform/aa-sdk/commit/2e3892cac57c517cb93d0349297feedd2ca07dfb)) +- **rn:** implement RN iOS stamper ([#1213](https://github.com/alchemyplatform/aa-sdk/issues/1213)) ([f9e3e91](https://github.com/alchemyplatform/aa-sdk/commit/f9e3e912700c35456ecdf97fa68bd1beb182f0bf)) + # [4.7.0](https://github.com/alchemyplatform/aa-sdk/compare/v4.6.1...v4.7.0) (2024-12-16) ### Features diff --git a/account-kit/rn-signer/package.json b/account-kit/rn-signer/package.json index 3f7255f9b4..d89723e7d1 100644 --- a/account-kit/rn-signer/package.json +++ b/account-kit/rn-signer/package.json @@ -1,6 +1,6 @@ { "name": "@account-kit/react-native-signer", - "version": "4.7.0", + "version": "4.8.0", "author": "Alchemy", "description": "React Native compatible Account Kit signer", "source": "./src/index.tsx", @@ -147,8 +147,8 @@ "version": "0.42.2" }, "dependencies": { - "@aa-sdk/core": "^4.7.0", - "@account-kit/signer": "^4.7.0", + "@aa-sdk/core": "^4.8.0", + "@account-kit/signer": "^4.8.0", "viem": "^2.21.40" } } diff --git a/account-kit/signer/CHANGELOG.md b/account-kit/signer/CHANGELOG.md index 579a37d105..fcddf806a0 100644 --- a/account-kit/signer/CHANGELOG.md +++ b/account-kit/signer/CHANGELOG.md @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [4.8.0](https://github.com/alchemyplatform/aa-sdk/compare/v4.7.0...v4.8.0) (2025-01-08) + +**Note:** Version bump only for package @account-kit/signer + # [4.7.0](https://github.com/alchemyplatform/aa-sdk/compare/v4.6.1...v4.7.0) (2024-12-16) ### Features diff --git a/account-kit/signer/package.json b/account-kit/signer/package.json index c980d074b5..911cadd005 100644 --- a/account-kit/signer/package.json +++ b/account-kit/signer/package.json @@ -1,6 +1,6 @@ { "name": "@account-kit/signer", - "version": "4.7.0", + "version": "4.8.0", "description": "Core interfaces and clients for interfacing with the Alchemy Signer API", "author": "Alchemy", "license": "MIT", @@ -48,8 +48,8 @@ "vitest": "^2.0.4" }, "dependencies": { - "@aa-sdk/core": "^4.7.0", - "@account-kit/logging": "^4.7.0", + "@aa-sdk/core": "^4.8.0", + "@account-kit/logging": "^4.8.0", "@turnkey/http": "^2.6.2", "@turnkey/iframe-stamper": "^1.0.0", "@turnkey/viem": "^0.4.8", diff --git a/account-kit/signer/src/version.ts b/account-kit/signer/src/version.ts index a6e3e3bf6d..74f2a4bc2e 100644 --- a/account-kit/signer/src/version.ts +++ b/account-kit/signer/src/version.ts @@ -1,3 +1,3 @@ // This file is autogenerated by inject-version.ts. Any changes will be // overwritten on commit! -export const VERSION = "4.7.0"; +export const VERSION = "4.8.0"; diff --git a/account-kit/smart-contracts/CHANGELOG.md b/account-kit/smart-contracts/CHANGELOG.md index 4c15dc775e..6ca0efaa5c 100644 --- a/account-kit/smart-contracts/CHANGELOG.md +++ b/account-kit/smart-contracts/CHANGELOG.md @@ -3,6 +3,17 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [4.8.0](https://github.com/alchemyplatform/aa-sdk/compare/v4.7.0...v4.8.0) (2025-01-08) + +### Bug Fixes + +- correctly trim implementation address ([#1261](https://github.com/alchemyplatform/aa-sdk/issues/1261)) ([5dae940](https://github.com/alchemyplatform/aa-sdk/commit/5dae940eee1c776b54804a9aac8d46fe51e89d19)) +- lost changes from other PRs ([#1259](https://github.com/alchemyplatform/aa-sdk/issues/1259)) ([6546664](https://github.com/alchemyplatform/aa-sdk/commit/6546664887a45e8b25745a3cac539cde9473e4bf)) + +### Features + +- basic ma v2 sdk integrations ([#1220](https://github.com/alchemyplatform/aa-sdk/issues/1220)) ([e513d84](https://github.com/alchemyplatform/aa-sdk/commit/e513d84406acb9dcc72d30a12dce4fbd15adeab8)), closes [#1221](https://github.com/alchemyplatform/aa-sdk/issues/1221) [#1223](https://github.com/alchemyplatform/aa-sdk/issues/1223) [#1232](https://github.com/alchemyplatform/aa-sdk/issues/1232) [#1233](https://github.com/alchemyplatform/aa-sdk/issues/1233) [#1246](https://github.com/alchemyplatform/aa-sdk/issues/1246) + # [4.7.0](https://github.com/alchemyplatform/aa-sdk/compare/v4.6.1...v4.7.0) (2024-12-16) **Note:** Version bump only for package @account-kit/smart-contracts diff --git a/account-kit/smart-contracts/package.json b/account-kit/smart-contracts/package.json index 2b7853ef55..2f5127ff58 100644 --- a/account-kit/smart-contracts/package.json +++ b/account-kit/smart-contracts/package.json @@ -1,6 +1,6 @@ { "name": "@account-kit/smart-contracts", - "version": "4.7.0", + "version": "4.8.0", "description": "aa-sdk compatible interfaces for Alchemy Smart Accounts", "author": "Alchemy", "license": "MIT", @@ -51,7 +51,7 @@ "test:run": "vitest run" }, "devDependencies": { - "@account-kit/plugingen": "^4.7.0", + "@account-kit/plugingen": "^4.8.0", "change-case": "^5.1.2", "dedent": "^1.5.1", "dotenv": "^16.3.1", @@ -73,8 +73,8 @@ "homepage": "https://github.com/alchemyplatform/aa-sdk#readme", "gitHead": "ee46e8bb857de3b631044fa70714ea706d9e317d", "dependencies": { - "@aa-sdk/core": "^4.7.0", - "@account-kit/infra": "^4.7.0" + "@aa-sdk/core": "^4.8.0", + "@account-kit/infra": "^4.8.0" }, "peerDependencies": { "viem": "^2.20.0" diff --git a/lerna.json b/lerna.json index 66ec571370..ff47c95538 100644 --- a/lerna.json +++ b/lerna.json @@ -1,6 +1,6 @@ { "$schema": "node_modules/lerna/schemas/lerna-schema.json", - "version": "4.7.0", + "version": "4.8.0", "npmClient": "yarn", "conventionalCommits": true, "changelog": true, From 2d5dae9545b13d21c3d5d432509f95e3cc275317 Mon Sep 17 00:00:00 2001 From: Iyk Azorji Date: Wed, 8 Jan 2025 19:53:02 -0500 Subject: [PATCH 3/3] feat: add better error handling to prevent crashes when creating sharedPreferences (#1267) * feat: update sharedPreferences creation to properly handle creation errors gracefully * feat: add extra error handling while using getSharedPreferences() method * feat: add better error handling to prevent app crashes * fix: update linting * fix: update getSharedPreferences() implementation to create the masterKey internally * fix: remove generated gradele files * fix: refactor TEKStamper logic to reduce try-catch nesting * fix: refactor TEKStamper logic to reduce try-catch nesting * fix: fix linting * fix: change exception variables --- .../reactnativesigner/core/TEKStamper.kt | 109 ++++++++++++++---- account-kit/rn-signer/example/metro.config.js | 44 +++++-- .../functions/createSMAV2Account.mdx | 28 +++++ .../functions/createSMAV2AccountClient.mdx | 52 +++++++++ .../getDefaultAllowlistModuleAddress.mdx | 37 ++++++ ...etDefaultNativeTokenLimitModuleAddress.mdx | 37 ++++++ .../getDefaultPaymasterGuardModuleAddress.mdx | 37 ++++++ ...ultSingleSignerValidationModuleAddress.mdx | 37 ++++++ .../getDefaultTimeRangeModuleAddress.mdx | 37 ++++++ ...DefaultWebauthnValidationModuleAddress.mdx | 37 ++++++ .../functions/installValidationActions.mdx | 69 +++++++++++ .../functions/nativeSMASigner.mdx | 53 +++++++++ .../functions/serializeHookConfig.mdx | 49 ++++++++ .../functions/serializeModuleEntity.mdx | 43 +++++++ .../functions/serializeValidationConfig.mdx | 49 ++++++++ 15 files changed, 684 insertions(+), 34 deletions(-) create mode 100644 site/pages/reference/account-kit/smart-contracts/functions/createSMAV2Account.mdx create mode 100644 site/pages/reference/account-kit/smart-contracts/functions/createSMAV2AccountClient.mdx create mode 100644 site/pages/reference/account-kit/smart-contracts/functions/getDefaultAllowlistModuleAddress.mdx create mode 100644 site/pages/reference/account-kit/smart-contracts/functions/getDefaultNativeTokenLimitModuleAddress.mdx create mode 100644 site/pages/reference/account-kit/smart-contracts/functions/getDefaultPaymasterGuardModuleAddress.mdx create mode 100644 site/pages/reference/account-kit/smart-contracts/functions/getDefaultSingleSignerValidationModuleAddress.mdx create mode 100644 site/pages/reference/account-kit/smart-contracts/functions/getDefaultTimeRangeModuleAddress.mdx create mode 100644 site/pages/reference/account-kit/smart-contracts/functions/getDefaultWebauthnValidationModuleAddress.mdx create mode 100644 site/pages/reference/account-kit/smart-contracts/functions/installValidationActions.mdx create mode 100644 site/pages/reference/account-kit/smart-contracts/functions/nativeSMASigner.mdx create mode 100644 site/pages/reference/account-kit/smart-contracts/functions/serializeHookConfig.mdx create mode 100644 site/pages/reference/account-kit/smart-contracts/functions/serializeModuleEntity.mdx create mode 100644 site/pages/reference/account-kit/smart-contracts/functions/serializeValidationConfig.mdx diff --git a/account-kit/rn-signer/android/src/main/java/com/accountkit/reactnativesigner/core/TEKStamper.kt b/account-kit/rn-signer/android/src/main/java/com/accountkit/reactnativesigner/core/TEKStamper.kt index 1a7847308c..49b284ae3f 100644 --- a/account-kit/rn-signer/android/src/main/java/com/accountkit/reactnativesigner/core/TEKStamper.kt +++ b/account-kit/rn-signer/android/src/main/java/com/accountkit/reactnativesigner/core/TEKStamper.kt @@ -1,6 +1,7 @@ package com.accountkit.reactnativesigner.core import android.content.Context +import android.content.SharedPreferences import androidx.security.crypto.EncryptedSharedPreferences import androidx.security.crypto.MasterKey import com.accountkit.reactnativesigner.core.errors.NoInjectedBundleException @@ -19,6 +20,8 @@ import java.nio.ByteBuffer import java.security.KeyFactory import java.security.Security import java.security.Signature +import java.security.KeyStore +import java.security.KeyStoreException @Serializable data class ApiStamp(val publicKey: String, val scheme: String, val signature: String) @@ -27,6 +30,8 @@ data class Stamp(val stampHeaderName: String, val stampHeaderValue: String) private const val BUNDLE_PRIVATE_KEY = "BUNDLE_PRIVATE_KEY" private const val BUNDLE_PUBLIC_KEY = "BUNDLE_PUBLIC_KEY" +private const val MASTER_KEY_ALIAS = "tek_master_key" +private const val ENCRYPTED_SHARED_PREFERENCES_FILENAME = "tek_stamper_shared_prefs" class TEKStamper(context: Context) { // This is how the docs for EncryptedSharedPreferences recommend creating this setup @@ -36,12 +41,6 @@ class TEKStamper(context: Context) { // // we should explore the best practices on how to do this once we reach a phase of further // cleanup - private val masterKey = - MasterKey.Builder(context.applicationContext) - .setKeyScheme(MasterKey.KeyScheme.AES256_GCM) - // requires that the phone be unlocked - .setUserAuthenticationRequired(false) - .build() /** * We are using EncryptedSharedPreferences to store 2 pieces of data @@ -64,29 +63,35 @@ class TEKStamper(context: Context) { * * The open question is if the storage of the decrypted private key is secure enough though */ - private val sharedPreferences = - EncryptedSharedPreferences.create( - context, - "tek_stamper_shared_prefs", - masterKey, - EncryptedSharedPreferences.PrefKeyEncryptionScheme.AES256_SIV, - EncryptedSharedPreferences.PrefValueEncryptionScheme.AES256_GCM - ) + - private val tekManager = HpkeTEKManager(sharedPreferences) - init { - TinkConfig.register() + + - if (Security.getProvider(BouncyCastleProvider.PROVIDER_NAME).javaClass != - BouncyCastleProvider::class.java - ) { - Security.removeProvider(BouncyCastleProvider.PROVIDER_NAME) - } - - if (Security.getProvider(BouncyCastleProvider.PROVIDER_NAME) == null) { - Security.addProvider(BouncyCastleProvider()) + private lateinit var tekManager: HpkeTEKManager + private lateinit var sharedPreferences: SharedPreferences + + init { + try { + TinkConfig.register() + + sharedPreferences = getSharedPreferences(context) + tekManager = HpkeTEKManager(sharedPreferences) + + if (Security.getProvider(BouncyCastleProvider.PROVIDER_NAME).javaClass != + BouncyCastleProvider::class.java + ) { + Security.removeProvider(BouncyCastleProvider.PROVIDER_NAME) + } + + if (Security.getProvider(BouncyCastleProvider.PROVIDER_NAME) == null) { + Security.addProvider(BouncyCastleProvider()) + } + } catch (e: Exception){ + throw RuntimeException("Error creating master key", e) } + } fun init(): String { @@ -196,4 +201,58 @@ class TEKStamper(context: Context) { ) return Pair(compressedPublicKey, privateKey) } + + private fun createSharedPreferences(masterKey: MasterKey, context: Context): SharedPreferences { + return EncryptedSharedPreferences.create( + context, + ENCRYPTED_SHARED_PREFERENCES_FILENAME, + masterKey, + EncryptedSharedPreferences.PrefKeyEncryptionScheme.AES256_SIV, + EncryptedSharedPreferences.PrefValueEncryptionScheme.AES256_GCM + ) + } + + private fun createMasterKey(context: Context): MasterKey { + return MasterKey.Builder(context.applicationContext, MASTER_KEY_ALIAS) + .setKeyScheme(MasterKey.KeyScheme.AES256_GCM) + .setUserAuthenticationRequired(false) + .build() + } + + + private fun getSharedPreferences(context: Context): SharedPreferences { + try { + // Attempt to create or load the EncryptedSharedPreferences file + val masterKey = createMasterKey(context) + + return createSharedPreferences(masterKey, context) + } catch(e: Exception) { + // Log the Exception + e.printStackTrace() + } + + // An error occured creating or retrieving the Shared Preferences file. + // Delete the existing master key and EncryptedSharedPreferences + + // first delete the MasterKey + try { + val keyStore = KeyStore.getInstance("AndroidKeyStore") + keyStore.load(null) + keyStore.deleteEntry(MASTER_KEY_ALIAS) + } catch (keyStoreDeletionException: Exception) { + throw RuntimeException("An error occured deleting the Master Key", keyStoreDeletionException) + } + + // attempt to recreate a new EncryptedSharedPreferences file + try { + // Create a new MasterKey + val newMasterKey = createMasterKey(context) + context.getSharedPreferences(ENCRYPTED_SHARED_PREFERENCES_FILENAME, Context.MODE_PRIVATE).edit().clear().apply() + context.deleteSharedPreferences(ENCRYPTED_SHARED_PREFERENCES_FILENAME) + + return createSharedPreferences(newMasterKey, context) + } catch(retryException: Exception) { + throw RuntimeException("Couldn't create the required shared preferences file. Ensure you are properly authenticated on this device.", retryException) + } + } } \ No newline at end of file diff --git a/account-kit/rn-signer/example/metro.config.js b/account-kit/rn-signer/example/metro.config.js index 00bc69a4ea..ead41fe3b5 100644 --- a/account-kit/rn-signer/example/metro.config.js +++ b/account-kit/rn-signer/example/metro.config.js @@ -3,20 +3,46 @@ const { getDefaultConfig } = require("@react-native/metro-config"); const { getConfig } = require("react-native-builder-bob/metro-config"); const pkg = require("../package.json"); -const root = path.resolve(__dirname, ".."); +const rnSignerRoot = path.resolve(__dirname, ".."); +const projectRoot = __dirname; // handles the hoisted modules const repoRoot = path.resolve(__dirname, "../../.."); +const config = getDefaultConfig(projectRoot); + +const monorepoPackages = { + "@account-kit/signer": path.resolve(repoRoot, "account-kit/signer"), + "@aa-sdk/core": path.resolve(repoRoot, "aa-sdk/core"), + "@account-kit/logging": path.resolve(repoRoot, "account-kit/logging"), +}; + +config.watchFolders = [ + projectRoot, + rnSignerRoot, + ...Object.values(monorepoPackages), +]; + +// Let Metro know where to resolve packages and in what order +config.resolver.nodeModulesPaths = [ + path.resolve(projectRoot, "node_modules"), + path.resolve(rnSignerRoot, "node_modules"), + path.resolve(repoRoot, "node_modules"), +]; + +// Force Metro to resolve (sub)dependencies only from the `nodeModulesPaths` +config.resolver.disableHierarchicalLookup = true; + +config.resolver.extraNodeModules = { + ...config.resolver.extraNodeModules, + ...require("node-libs-react-native"), + ...monorepoPackages, + crypto: require.resolve("crypto-browserify"), + stream: require.resolve("stream-browserify"), +}; + /** * Metro configuration * https://facebook.github.io/metro/docs/configuration * */ -module.exports = { - ...getConfig(getDefaultConfig(__dirname), { - root, - pkg, - project: __dirname, - }), - watchFolders: [root, repoRoot], -}; +module.exports = config; diff --git a/site/pages/reference/account-kit/smart-contracts/functions/createSMAV2Account.mdx b/site/pages/reference/account-kit/smart-contracts/functions/createSMAV2Account.mdx new file mode 100644 index 0000000000..d789f0559b --- /dev/null +++ b/site/pages/reference/account-kit/smart-contracts/functions/createSMAV2Account.mdx @@ -0,0 +1,28 @@ +--- +# This file is autogenerated +title: createSMAV2Account +description: Overview of the createSMAV2Account method +--- + +# createSMAV2Account + +Creates an SMAV2 account using defined parameters including chain, signer, salt, factory address, and more. +Handles account initialization code, nonce generation, transaction encoding, and more to construct a modular account with optional validation hooks. + +## Import + +```ts +import { createSMAV2Account } from "@account-kit/smart-contracts"; +``` + +## Parameters + +### config + +`CreateSMAV2AccountParams` +Configuration parameters for creating an SMAV2 account. Includes chain details, signer, salt, factory address, and more. + +## Returns + +`Promise` +A promise that resolves to an `MAV2Account` providing methods for nonce retrieval, transaction execution, and more. diff --git a/site/pages/reference/account-kit/smart-contracts/functions/createSMAV2AccountClient.mdx b/site/pages/reference/account-kit/smart-contracts/functions/createSMAV2AccountClient.mdx new file mode 100644 index 0000000000..8b7bcd96ab --- /dev/null +++ b/site/pages/reference/account-kit/smart-contracts/functions/createSMAV2AccountClient.mdx @@ -0,0 +1,52 @@ +--- +# This file is autogenerated + +title: createSMAV2AccountClient +description: Overview of the createSMAV2AccountClient method +--- + +# createSMAV2AccountClient + +Creates a SMAv2 account client using the provided configuration parameters. + +## Import + +```ts +import { createSMAV2AccountClient } from "@account-kit/smart-contracts"; +``` + +## Usage + +```ts +import { http } from "viem"; +import { createSMAV2AccountClient } from "@account-kit/smart-contracts"; +import { LocalAccountSigner } from "@aa-sdk/core"; +import { sepolia } from "@account-kit/infra"; + +const MNEMONIC = "..."; +const RPC_URL = "..."; + +const signer = LocalAccountSigner.mnemonicToAccountSigner(MNEMONIC); + +const chain = sepolia; + +const transport = http(RPC_URL); + +const SMAV2SignerAccountClient = await createSMAV2AccountClient({ + chain, + signer, + transport, +}); +``` + +## Parameters + +### config + +`CreateSMAV2AccountClientParams` +The configuration parameters required to create the MAv2 account client + +## Returns + +`Promise` +A promise that resolves to a `SmartAccountClient` instance diff --git a/site/pages/reference/account-kit/smart-contracts/functions/getDefaultAllowlistModuleAddress.mdx b/site/pages/reference/account-kit/smart-contracts/functions/getDefaultAllowlistModuleAddress.mdx new file mode 100644 index 0000000000..5522e43076 --- /dev/null +++ b/site/pages/reference/account-kit/smart-contracts/functions/getDefaultAllowlistModuleAddress.mdx @@ -0,0 +1,37 @@ +--- +# This file is autogenerated +title: getDefaultAllowlistModuleAddress +description: Overview of the getDefaultAllowlistModuleAddress method +--- + +# getDefaultAllowlistModuleAddress + +Maps a given chain to a specific address of the allowlist module by its chain ID. If no direct mapping exists, it defaults to returning a specific address. + +## Import + +```ts +import { getDefaultAllowlistModuleAddress } from "@account-kit/smart-contracts"; +``` + +## Usage + +```ts +import { getDefaultAllowlistModuleAddress } from "@account-kit/smart-contracts"; +import { Chain, Address } from "viem"; + +const chain: Chain = ... +const allowlistModule: Address = getDefaultAllowlistModuleAddress(chain); +``` + +## Parameters + +### chain + +`Chain` +The chain object containing the chain ID to map + +## Returns + +`Address` +The allowlist module address associated with the specified chain ID or a default address if no specific mapping exists diff --git a/site/pages/reference/account-kit/smart-contracts/functions/getDefaultNativeTokenLimitModuleAddress.mdx b/site/pages/reference/account-kit/smart-contracts/functions/getDefaultNativeTokenLimitModuleAddress.mdx new file mode 100644 index 0000000000..54dcc49268 --- /dev/null +++ b/site/pages/reference/account-kit/smart-contracts/functions/getDefaultNativeTokenLimitModuleAddress.mdx @@ -0,0 +1,37 @@ +--- +# This file is autogenerated +title: getDefaultNativeTokenLimitModuleAddress +description: Overview of the getDefaultNativeTokenLimitModuleAddress method +--- + +# getDefaultNativeTokenLimitModuleAddress + +Maps a given chain to a specific address of the native token limit module by its chain ID. If no direct mapping exists, it defaults to returning a specific address. + +## Import + +```ts +import { getDefaultNativeTokenLimitModuleAddress } from "@account-kit/smart-contracts"; +``` + +## Usage + +```ts +import { getDefaultNativeTokenLimitModuleAddress } from "@account-kit/smart-contracts"; +import { Chain, Address } from "viem"; + +const chain: Chain = ... +const nativeTokenLimitAddress: Address = getDefaultNativeTokenLimitModuleAddress(chain); +``` + +## Parameters + +### chain + +`Chain` +The chain object containing the chain ID to map + +## Returns + +`Address` +The native token limit module address associated with the specified chain ID or a default address if no specific mapping exists diff --git a/site/pages/reference/account-kit/smart-contracts/functions/getDefaultPaymasterGuardModuleAddress.mdx b/site/pages/reference/account-kit/smart-contracts/functions/getDefaultPaymasterGuardModuleAddress.mdx new file mode 100644 index 0000000000..11e25ca3b0 --- /dev/null +++ b/site/pages/reference/account-kit/smart-contracts/functions/getDefaultPaymasterGuardModuleAddress.mdx @@ -0,0 +1,37 @@ +--- +# This file is autogenerated +title: getDefaultPaymasterGuardModuleAddress +description: Overview of the getDefaultPaymasterGuardModuleAddress method +--- + +# getDefaultPaymasterGuardModuleAddress + +Maps a given chain to a specific address of the paymaster guard module by its chain ID. If no direct mapping exists, it defaults to returning a specific address. + +## Import + +```ts +import { getDefaultPaymasterGuardModuleAddress } from "@account-kit/smart-contracts"; +``` + +## Usage + +```ts +import { getDefaultPaymasterGuardModuleAddress } from "@account-kit/smart-contracts"; +import { Chain, Address } from "viem"; + +const chain: Chain = ... +const paymasterGuardAddress: Address = getDefaultPaymasterGuardModuleAddress(chain); +``` + +## Parameters + +### chain + +`Chain` +The chain object containing the chain ID to map + +## Returns + +`Address` +The paymaster guard module address associated with the specified chain ID or a default address if no specific mapping exists diff --git a/site/pages/reference/account-kit/smart-contracts/functions/getDefaultSingleSignerValidationModuleAddress.mdx b/site/pages/reference/account-kit/smart-contracts/functions/getDefaultSingleSignerValidationModuleAddress.mdx new file mode 100644 index 0000000000..04c02888cc --- /dev/null +++ b/site/pages/reference/account-kit/smart-contracts/functions/getDefaultSingleSignerValidationModuleAddress.mdx @@ -0,0 +1,37 @@ +--- +# This file is autogenerated +title: getDefaultSingleSignerValidationModuleAddress +description: Overview of the getDefaultSingleSignerValidationModuleAddress method +--- + +# getDefaultSingleSignerValidationModuleAddress + +Maps a given chain to a specific address of the single signer validation module by its chain ID. If no direct mapping exists, it defaults to returning a specific address. + +## Import + +```ts +import { getDefaultSingleSignerValidationModuleAddress } from "@account-kit/smart-contracts"; +``` + +## Usage + +```ts +import { getDefaultSingleSignerValidationModuleAddress } from "@account-kit/smart-contracts"; +import { Chain, Address } from "viem"; + +const chain: Chain = ... +const singleSignerValidationAddress: Address = getDefaultSingleSignerValidationModuleAddress(chain); +``` + +## Parameters + +### chain + +`Chain` +The chain object containing the chain ID to map + +## Returns + +`Address` +The single signer validation module address associated with the specified chain ID or a default address if no specific mapping exists diff --git a/site/pages/reference/account-kit/smart-contracts/functions/getDefaultTimeRangeModuleAddress.mdx b/site/pages/reference/account-kit/smart-contracts/functions/getDefaultTimeRangeModuleAddress.mdx new file mode 100644 index 0000000000..3de832b874 --- /dev/null +++ b/site/pages/reference/account-kit/smart-contracts/functions/getDefaultTimeRangeModuleAddress.mdx @@ -0,0 +1,37 @@ +--- +# This file is autogenerated +title: getDefaultTimeRangeModuleAddress +description: Overview of the getDefaultTimeRangeModuleAddress method +--- + +# getDefaultTimeRangeModuleAddress + +Maps a given chain to a specific address of the time range module by its chain ID. If no direct mapping exists, it defaults to returning a specific address. + +## Import + +```ts +import { getDefaultTimeRangeModuleAddress } from "@account-kit/smart-contracts"; +``` + +## Usage + +```ts +import { getDefaultTimeRangeModuleAddress } from "@account-kit/smart-contracts"; +import { Chain, Address } from "viem"; + +const chain: Chain = ... +const timeRangeModuleAddress: Address = getDefaultTimeRangeModuleAddress(chain); +``` + +## Parameters + +### chain + +`Chain` +The chain object containing the chain ID to map + +## Returns + +`Address` +The time range module address associated with the specified chain ID or a default address if no specific mapping exists diff --git a/site/pages/reference/account-kit/smart-contracts/functions/getDefaultWebauthnValidationModuleAddress.mdx b/site/pages/reference/account-kit/smart-contracts/functions/getDefaultWebauthnValidationModuleAddress.mdx new file mode 100644 index 0000000000..fd27c9dac5 --- /dev/null +++ b/site/pages/reference/account-kit/smart-contracts/functions/getDefaultWebauthnValidationModuleAddress.mdx @@ -0,0 +1,37 @@ +--- +# This file is autogenerated +title: getDefaultWebauthnValidationModuleAddress +description: Overview of the getDefaultWebauthnValidationModuleAddress method +--- + +# getDefaultWebauthnValidationModuleAddress + +Maps a given chain to a specific address of the webauthn validation module by its chain ID. If no direct mapping exists, it defaults to returning a specific address. + +## Import + +```ts +import { getDefaultWebauthnValidationModuleAddress } from "@account-kit/smart-contracts"; +``` + +## Usage + +```ts +import { getDefaultWebauthnValidationModuleAddress } from "@account-kit/smart-contracts"; +import { Chain, Address } from "viem"; + +const chain: Chain = ... +const webauthnValidationAddress: Address = getDefaultWebauthnValidationModuleAddress(chain); +``` + +## Parameters + +### chain + +`Chain` +The chain object containing the chain ID to map + +## Returns + +`Address` +The webauthn validation module address associated with the specified chain ID or a default address if no specific mapping exists diff --git a/site/pages/reference/account-kit/smart-contracts/functions/installValidationActions.mdx b/site/pages/reference/account-kit/smart-contracts/functions/installValidationActions.mdx new file mode 100644 index 0000000000..602162dacc --- /dev/null +++ b/site/pages/reference/account-kit/smart-contracts/functions/installValidationActions.mdx @@ -0,0 +1,69 @@ +--- +# This file is autogenerated + +title: installValidationActions +description: Overview of the installValidationActions method +--- + +# installValidationActions + +Provides validation installation and uninstallation functionalities for a MA v2 client, ensuring compatibility with `SmartAccountClient`. + +## Import + +```ts +import { installValidationActions } from "@account-kit/smart-contracts"; +``` + +## Usage + +```ts +import { createSMAV2AccountClient, installValidationActions, getDefaultSingleSignerValidationModuleAddress, SingleSignerValidationModule } from "@account-kit/smart-contracts"; +import { Address } from "viem"; + +const client = (await createSMAV2AccountClient({ ... })).extend(installValidationActions); +const sessionKeyAddress: Address = "0x1234"; +const sessionKeyEntityId: number = 1; + +await client.installValidation({ +validationConfig: { +moduleAddress: getDefaultSingleSignerValidationModuleAddress( + client.chain +), +entityId: sessionKeyEntityId, +isGlobal: true, +isSignatureValidation: false, +isUserOpValidation: true, +}, +selectors: [], +installData: SingleSignerValidationModule.encodeOnInstallData({ +entityId: sessionKeyEntityId, +signer: sessionKeyAddress, +}), +hooks: [], +}); + +await client.uninstallValidation({ +moduleAddress: sessionKeyAddress, +entityId: sessionKeyEntityId, +uninstallData: SingleSignerValidationModule.encodeOnUninstallData({ +entityId: sessionKeyEntityId, +}), +hookUninstallDatas: [], +}); + +``` + +## Parameters + +### client + +`object` + +- The client instance which provides account and sendUserOperation functionality. + + ## Returns + + `object` + +- An object containing two methods, `installValidation` and `uninstallValidation`. diff --git a/site/pages/reference/account-kit/smart-contracts/functions/nativeSMASigner.mdx b/site/pages/reference/account-kit/smart-contracts/functions/nativeSMASigner.mdx new file mode 100644 index 0000000000..0052b9b056 --- /dev/null +++ b/site/pages/reference/account-kit/smart-contracts/functions/nativeSMASigner.mdx @@ -0,0 +1,53 @@ +--- +# This file is autogenerated +title: nativeSMASigner +description: Overview of the nativeSMASigner method +--- + +# nativeSMASigner + +Creates an object with methods for generating a dummy signature, signing user operation hashes, signing messages, and signing typed data. + +## Import + +```ts +import { nativeSMASigner } from "@account-kit/smart-contracts"; +``` + +## Usage + +```ts +import { nativeSMASigner } from "@account-kit/smart-contracts"; + +import { LocalAccountSigner } from "@aa-sdk/core"; + +const MNEMONIC = "...": + +const account = createSMAV2Account({ config }); + +const signer = LocalAccountSigner.mnemonicToAccountSigner(MNEMONIC); + +const messageSigner = nativeSMASigner(signer, chain, account.address); +``` + +## Parameters + +### signer + +`SmartAccountSigner` +Signer to use for signing operations + +### chain + +`Chain` +Chain object for the signer + +### accountAddress + +`Address` +address of the smart account using this signer + +## Returns + +`object` +an object with methods for signing operations and managing signatures diff --git a/site/pages/reference/account-kit/smart-contracts/functions/serializeHookConfig.mdx b/site/pages/reference/account-kit/smart-contracts/functions/serializeHookConfig.mdx new file mode 100644 index 0000000000..94b6f1f3b1 --- /dev/null +++ b/site/pages/reference/account-kit/smart-contracts/functions/serializeHookConfig.mdx @@ -0,0 +1,49 @@ +--- +# This file is autogenerated + +title: serializeHookConfig +description: Overview of the serializeHookConfig method +--- + +# serializeHookConfig + +Serializes a `HookConfig` object into a `Hex` format by encoding the hook type, presence of post/pre hooks, address, and entity ID. + +## Import + +```ts +import { serializeHookConfig } from "@account-kit/smart-contracts"; +``` + +## Usage + +```ts +import { type HookType, serializeHookConfig } from "@account-kit/smart-contracts"; +import { Address } from "viem"; + +const moduleAddress: Address = "0x1234"; +const entityId: number = 1234; +const hookType: HookType = HookType.Validation; +const hasPostHooks: boolean = false; +const hasPreHooks: boolean = true; + +const hookConfigHex = serializeHookConfig({ +moduleAddress, +entityId +hookType, +hasPostHooks, +hasPreHooks +}); +``` + +## Parameters + +### config + +`HookConfig` +The hook configuration containing address, entity ID, hook type, and post/pre hook indicators + +## Returns + +`Hex` +The serialized hook configuration in hexadecimal format diff --git a/site/pages/reference/account-kit/smart-contracts/functions/serializeModuleEntity.mdx b/site/pages/reference/account-kit/smart-contracts/functions/serializeModuleEntity.mdx new file mode 100644 index 0000000000..a95495eaa9 --- /dev/null +++ b/site/pages/reference/account-kit/smart-contracts/functions/serializeModuleEntity.mdx @@ -0,0 +1,43 @@ +--- +# This file is autogenerated + +title: serializeModuleEntity +description: Overview of the serializeModuleEntity method +--- + +# serializeModuleEntity + +Serializes a module entity into a hexadecimal format by concatenating the module address and entity ID. + +## Import + +```ts +import { serializeModuleEntity } from "@account-kit/smart-contracts"; +``` + +## Usage + +```ts +import { serializeModuleEntity } from "@account-kit/smart-contracts"; +import { Address } from "viem"; + +const moduleAddress: Address = "0x1234"; +const entityId: number = 1234; + +const moduleEntityHex = serializeModuleEntity({ + moduleAddress, + entityId, +}); +``` + +## Parameters + +### config + +`ModuleEntity` +The module entity configuration containing the module address and entity ID + +## Returns + +`Hex` +A hexadecimal string representation of the serialized module entity diff --git a/site/pages/reference/account-kit/smart-contracts/functions/serializeValidationConfig.mdx b/site/pages/reference/account-kit/smart-contracts/functions/serializeValidationConfig.mdx new file mode 100644 index 0000000000..f66a26e095 --- /dev/null +++ b/site/pages/reference/account-kit/smart-contracts/functions/serializeValidationConfig.mdx @@ -0,0 +1,49 @@ +--- +# This file is autogenerated + +title: serializeValidationConfig +description: Overview of the serializeValidationConfig method +--- + +# serializeValidationConfig + +Serializes a validation configuration into a hexadecimal string representation. This involves converting boolean flags into bitwise representation and combining them with serialized module entity data. + +## Import + +```ts +import { serializeValidationConfig } from "@account-kit/smart-contracts"; +``` + +## Usage + +```ts +import { serializeValidationConfig } from "@account-kit/smart-contracts"; +import { Address } from "viem"; + +const moduleAddress: Address = "0x1234"; +const entityId: number = 1234; +const isGlobal: boolean = true; +const isSignatureValidation: boolean = false; +const isUserOpValidation: boolean = true; + +const validationConfigHex = serializeValidationConfig({ +moduleAddress, +entityId +isGlobal, +isSignatureValidation, +isUserOpValidation +}); +``` + +## Parameters + +### config + +`ValidationConfig` +The validation configuration object containing details to serialize + +## Returns + +`Hex` +A hexadecimal string representing the serialized configuration