Skip to content

add starknet support#3125

Open
adrienlacombe wants to merge 41 commits into
cake-tech:devfrom
adrienlacombe:feat/starknet
Open

add starknet support#3125
adrienlacombe wants to merge 41 commits into
cake-tech:devfrom
adrienlacombe:feat/starknet

Conversation

@adrienlacombe

@adrienlacombe adrienlacombe commented Mar 24, 2026

Copy link
Copy Markdown

Issue Number (if Applicable): N/A

Description

Add basic Starknet support

Pull Request - Checklist

  • Initial Manual Tests Passed
  • Double check modified code and verify it with the feature/task requirements
  • Format code
  • Look for code duplication
  • Clear naming for variables and methods
  • Manual tests in accessibility mode (TalkBack on Android) passed

@adrienlacombe

Copy link
Copy Markdown
Author

@adrienlacombe adrienlacombe force-pushed the feat/starknet branch 2 times, most recently from b810892 to 2fdefe9 Compare April 15, 2026 15:36
adrienlacombe and others added 26 commits April 19, 2026 13:13
Integrate Starknet (STRK) as a new wallet type with raw id 111,
resolve migration version conflicts by shifting starknet migrations
to cases 62-63 after upstream's case 61.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The starknet.webp was using the Ethereum logo. Replace it with the
actual Starknet logo.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Remove tracked build artifacts (cw_starknet/build/) and add .gitignore
- Extract shared truncateDecimalString utility to eliminate duplication
  between StarknetBalance and StarknetTransactionInfo
- Make weiToDouble public and reuse in StarknetTransferEvent getters
- Remove redundant destinationAddressHex param from createTransaction
- Fix amount truncation: use (starknetAmount * 1e8).round() instead of .toInt()
- Add missing await on backup saveKeysFile call
- Remove dead _addStarknetListItems method from TransactionDetailsViewModel
- Simplify assetOfTransaction (both branches returned the same value)
- Extract _openAndInit helper in StarknetWalletService.openWallet
- Merge duplicate format_account_error/format_account_factory_error in Rust
- Reuse provider in send_transfer deployment check
- Fix inconsistent quote style (double -> single)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Required by cw_starknet generated FFI code which uses the
wasmBindgenName parameter added in 2.12.0.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
adrienlacombe and others added 9 commits April 19, 2026 13:13
Replace dead/rate-limited endpoints (OnFinality, Blast, Nethermind,
Alchemy-gated) with verified public nodes: Cartridge (default), Lava,
PublicNode, dRPC. Remove the Starknet-specific hardcoded fallback list
in the client; rely on the shared isEnabledForAutoSwitching path used by
every other chain.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Drop armeabi-v7a from the split (never used downstream), make x86_64
opt-in via a workflow input, remove the cache-wiping block that forced
build_runner to regenerate from scratch, and enable Gradle parallel +
build cache. Cuts one full native compile pass and avoids redundant
dart_tool/pub re-resolution on every run.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Give build.sh a separate push registry (ghcr.io/<owner>/cake_wallet) so
forks can cache their own mwebd/final rebuilds while still pulling the
shared base/bitbox/reown/monero/zcash/torch/decred layers from upstream.
Adds ensure_image() with primary → push-registry → fallback-registry
pull order, and pre-pulls final before the extract attempt so a cached
final short-circuits every intermediate build().

Also mount /root/.cargo and set CARGO_TARGET_DIR to a persistent path so
the six cargokit Rust projects (breez-sdk-spark, starknet, dnssec_proof,
payjoin, zkool2, sp_scanner) share registry + build artifacts across
runs.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The previous commit mounted /opt/cw_cache_android/root/.cargo onto
/root/.cargo, but that directory ships with the container image and
contains bin/rustup. An empty host mount replaced bin/ and cargokit
failed with "rustup not found in PATH".

Mount only the registry and git caches — the parts that actually need
to persist across runs — and leave bin/ from the image intact.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The Starknet Rust client panicked with "Expect rustls-platform-verifier
to be initialized" on every HTTPS call from Android because reqwest's
rustls stack pulls in rustls-platform-verifier-android but nothing ever
handed it the JNI context. Every balance refresh silently failed and
the wallet surfaced as Offline.

Wire up the init:
- Add a small JNI entry point in cw_starknet/rust/src/android_init.rs
  that calls rustls_platform_verifier::android::init_hosted with the
  application Context.
- Add a StarknetRust Java helper in the cakewallet app that loads the
  cw_starknet_rust shared library and calls the native init.
- Application.onCreate invokes StarknetRust.ensureInitialized so init
  runs before any Dart/Rust networking.
- Pull rustls + rustls-platform-verifier in as explicit deps, and
  install the ring CryptoProvider once from ensure_crypto_provider
  (reqwest's rustls-no-provider feature leaves this to us).
- Wire the crate-provided maven repo + classes AAR into
  cw_starknet/android/build.gradle via cargo metadata, and add a
  proguard keep for org.rustls.platformverifier.** + StarknetRust.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Remove the Starknet chain service, chain id, and supported-methods
files; strip Starknet registration from walletkit_service and the
chain-namespace / supported-methods helpers in reactions. Drop the
WalletConnect sign-and-invoke integration test plus its dead mock/stub
helpers; keep air-gapped UR flows intact.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@adrienlacombe adrienlacombe marked this pull request as ready for review April 19, 2026 12:13
Restore .github/workflows to match origin/dev so the PR against
cake-tech/cake_wallet doesn't carry fork-specific CI infrastructure:

- Drop launch_android_runner.yml (fork runner launcher)
- Restore pr_test_build_android.yml to its pull_request trigger
- Roll back the speedups and fork-aware docker cache handling in
  reusable-build.yml

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
adrienlacombe added a commit to adrienlacombe/cake_wallet that referenced this pull request Apr 19, 2026
Point pr_test_build_android + launch_android_runner at the backup
branch so we retain the push-triggered CI here while keeping
feat/starknet clean for upstream PR cake-tech#3125.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
adrienlacombe and others added 5 commits April 19, 2026 15:10
Strip the scripts paired with the .github changes already rolled back:
- scripts/android/docker/build.sh back to dev
- Delete scripts/github/{bake_android_runner_ami,provision_ephemeral_android_runner,rotate_runner_admin_token}.sh

Keep scripts/android/pubspec_gen.sh (adds --starknet to the cakewallet
app config), which is essential for Starknet to ship.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Restore formatter-only churn and drive-by fixes to origin/dev so the PR
is scoped to actual Starknet work:

- Formatter churn: send_page, select_button, transaction_details_modal,
  walletkit_service (stray blank line)
- Unrelated fixes: gradle.properties (parallel/caching), Podfile (CDN +
  iOS sim arch), encrypt.dart + its new test (AES key-length fix),
  rescan_view_model (async/try-finally), bridge_view_model (EVM
  imports), wc_connections_listing_view (unused import),
  enter_wallet_connect_uri_widget (ignore comment), wc_verify_context
  (withOpacity deprecation), secret_key.dart (trailing-ws trim)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Revert lib/{di.dart, new-ui/pages/send_page.dart, view_model/send/
send_view_model.dart} to origin/dev and re-apply only the actual
Starknet hunks. Dart format default is 80 while the project uses
page_width 100, which had reflowed ~1450 lines of these three files
into the PR; they now stand at 3 + 8 + 19 lines respectively.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Revert both files to origin/dev and re-apply only the Starknet-specific
additions (priority preferences wiring, default node, migration
versions 65/66 with stale-node repair, and the setter switch case).

net: settings_store.dart 1173 -> 37 lines; default_settings_migration
525 -> 45 lines.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
# Conflicts:
#	lib/view_model/transaction_details_view_model.dart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant