Skip to content

feat(wallet-extensions): add Noir Wallet connector for Zcash - #111

Merged
towanTG merged 2 commits into
swapkit:feat/noir-walletfrom
NoirWallet:feat/noir-wallet-zcash
Aug 25, 2026
Merged

feat(wallet-extensions): add Noir Wallet connector for Zcash#111
towanTG merged 2 commits into
swapkit:feat/noir-walletfrom
NoirWallet:feat/noir-wallet-zcash

Conversation

@harry1115

Copy link
Copy Markdown
Contributor

Summary

  • Adds a NOIR_WALLET connector backed by the Noir Wallet browser
    extension (window.noirwallet), following the same injected-provider
    pattern as the Vultisig and Petra connectors.
  • Registers Chain.Zcash on the UTXO toolbox, overriding getBalance,
    transfer, and signMessage to delegate to the extension, which spends
    from the shielded pool and builds/signs transactions internally.
  • Memo'd transfers throw wallet_noir_wallet_memo_not_supported: the
    extension cannot attach OP_RETURN data to transparent recipients, so
    OP_RETURN-based routes (Maya) are rejected explicitly with a clear error
    instead of failing silently on-chain. Deposit-address routes (NEAR
    Intents) are fully supported and verified with a live mainnet swap.
  • No new dependency — the connector talks to window.noirwallet directly.
  • Registration follows the Petra precedent: wallet-extensions subpath +
    loadWallet/SKWallets/SKWalletsSupportedChains only.

Dependency note

This PR requires @swapkit/helpers with WalletOption.NOIR_WALLET and the
wallet_noir_wallet_* error codes (22201-22203) — companion change
submitted to the SwapKit monorepo. CI will stay red until that helpers
release is published; all checks pass locally against a patched helpers
build simulating the release.

Notes for reviewers

  • Noir Wallet reports the shielded-pool spendable balance via
    zcash_getBalance().available, not the transparent address' on-chain
    UTXO set, so the displayed balance intentionally won't match a block
    explorer lookup of the transparent address.
  • Bought ZEC arrives at the transparent address and requires a user-approved
    shield inside the wallet before it becomes spendable — by design for a
    shielded-first wallet.

Test plan

  • bun run build:ci — full build + .d.ts generation
  • Package type-checks and bun biome check — clean
  • bun test packages/wallet-extensions/src/noir-wallet/__tests__/noir-wallet.test.ts — 7/7 passing
  • Manual verification with a real Noir Wallet extension build, including a live mainnet swap via NEAR Intents
  • CI green once the @swapkit/helpers release containing WalletOption.NOIR_WALLET is published

Adds a NOIR_WALLET connector backed by the Noir Wallet browser
extension (window.noirwallet). The connector registers Chain.Zcash with
the UTXO toolbox, overriding getBalance/transfer/signMessage to
delegate to the extension, which spends from the shielded pool and
builds/signs transactions internally.

Memo'd transfers throw wallet_noir_wallet_memo_not_supported since the
extension cannot attach OP_RETURN data to transparent recipients, so
OP_RETURN-based routes (Maya) are rejected explicitly while
deposit-address routes (NEAR Intents) are fully supported.

Requires @swapkit/helpers with WalletOption.NOIR_WALLET and the
wallet_noir_wallet_* error codes (companion change in the SwapKit
monorepo).
@towanTG
towanTG changed the base branch from develop to feat/noir-wallet August 25, 2026 12:29
@towanTG
towanTG merged commit 611926a into swapkit:feat/noir-wallet Aug 25, 2026
towanTG added a commit that referenced this pull request Aug 26, 2026
…sed) (#144)

* feat(wallet-extensions): add Noir Wallet connector for Zcash (#111)

Adds a NOIR_WALLET connector backed by the Noir Wallet browser
extension (window.noirwallet). The connector registers Chain.Zcash with
the UTXO toolbox, overriding getBalance/transfer/signMessage to
delegate to the extension, which spends from the shielded pool and
builds/signs transactions internally.

Memo'd transfers throw wallet_noir_wallet_memo_not_supported since the
extension cannot attach OP_RETURN data to transparent recipients, so
OP_RETURN-based routes (Maya) are rejected explicitly while
deposit-address routes (NEAR Intents) are fully supported.

Requires @swapkit/helpers with WalletOption.NOIR_WALLET and the
wallet_noir_wallet_* error codes (companion change in the SwapKit
monorepo).

* fix(noir-wallet): compile against helpers 5.0.2 via TON_CONNECT-style option shim

helpers 5.0.x shipped without the extensible WalletOption registry
(swapkit/sdk#346 unmerged), so NOIR_WALLET moves outside the enum the same
way TON_CONNECT does: a dedicated option.ts with the literal const + type,
threaded through loadWallet's match union and SKWallets literal keys.

Interim error keys until the registry ships the wallet_noir_wallet_* range
(80101-80103): wallet_provider_not_found, core_wallet_connection_failed,
wallet_walletconnect_method_not_supported — each with an info payload
carrying the NOIR_WALLET wallet tag and reason.

Unwind together with the tonconnect shim once sdk#346 is released.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* chore: adopt @swapkit 2026-08-25 release (helpers 5.1.0 registry)

Bump @swapkit/* ranges to today's sdk release train so every package
resolves the single helpers@5.1.0 copy carrying the extensible
WalletOption/error registries (swapkit/sdk#346). Lockfile regenerated
with the CI-pinned bun 1.3.13 from a clean node_modules.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* feat(noir-wallet): adopt helpers 5.1.0 registry, drop option shim

Replace the TON_CONNECT-style option shim with the real extensible
registries from @swapkit/helpers 5.1.0 (swapkit/sdk#346): register.ts
declares the WalletOptionRegistry/SwapKitErrorRegistry augmentations and
registers NOIR_WALLET plus wallet_noir_wallet_* codes 80101-80103 in the
reserved extension range. Connector, loadWallet, and SKWallets go back to
WalletOption.NOIR_WALLET; semantic error keys are restored; the register
module is side-effect-imported in utils.ts before the match reads it.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* refactor(tonconnect): adopt helpers 5.1.0 registry, drop option shim

Unwind the TON_CONNECT outside-the-enum literal shim now that the
extensible WalletOption registry shipped (swapkit/sdk#346, helpers
5.1.0): tonconnect/register.ts declares the WalletOptionRegistry
augmentation and registers the option; index/utils/types/tests go back
to WalletOption.TON_CONNECT with no casts. Runtime value unchanged.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* chore: settle bun.lock @near-js dedupe under bun 1.3.13 frozen check

The lock carried develop's hoisted @near-js/crypto+transactions 2.5.0
entries alongside nested 2.5.1 pins; bun 1.3.13's frozen validation
flags the stale split. Regenerated so both dedupe to 2.5.1 —
bun install --frozen-lockfile now passes clean.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* chore: add generated dep changeset for @swapkit bump

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* docs: add README and adding-a-wallet guide (registry pattern)

Documents the connector + register.ts workflow against the
@swapkit/helpers 5.1.0 extensible registries, the loadWallet/SKWallets
wiring, and the gotchas that bit during the Noir Wallet review:
type/runtime registration skew, sideEffects tree-shaking, dual-copy
helpers lockfile forks, and the vacuous walletType test trap.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* feat(wallets): expose @swapkit/wallets/register roll-up entry

Apps that reference registered wallet options at module scope (e.g. the
SwapKit UI's static wallet dialog list) evaluate WalletOption.NOIR_WALLET
before any connector or loadWallet module runs — without a register import
the list silently contains undefined. Roll up the per-wallet register
modules into src/register.ts, exported as @swapkit/wallets/register;
loadWallet now imports the roll-up.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Jimi <691742@gmail.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
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.

2 participants