Skip to content

Update next+walletconnect#3

Open
skullzarmy wants to merge 3 commits intomainfrom
update-next+walletconnect
Open

Update next+walletconnect#3
skullzarmy wants to merge 3 commits intomainfrom
update-next+walletconnect

Conversation

@skullzarmy
Copy link
Copy Markdown
Collaborator

No description provided.

skullzarmy and others added 2 commits March 30, 2026 00:05
…nnect-sdk

Replace @airgap/beacon-dapp, @airgap/beacon-sdk, and @taquito/beacon-wallet
with @tezos-x/octez.connect-sdk@^4.8.3 — the official @tezos-x namespace
rename per https://docs.tezos.com/dApps/migrating-from-beacon.

✨ (lib/tezos/OctezConnectWallet.ts): add OctezConnectWallet adapter

Taquito WalletProvider implementation wrapping DAppClient from
@tezos-x/octez.connect-sdk. Mirrors BeaconWallet's behaviour exactly
(same showPrepare/hideUI lifecycle, same param mapping via Taquito's
createTransferOperation etc., same signing watermark logic).

Also exports:
  - buildNetwork() helper that uses NetworkType.CUSTOM for non-mainnet,
    bypassing wallet extension internal network lookups that can fail on
    older Temple versions
  - NetworkType, PermissionScope, BeaconEvent re-exports so call sites
    only need one import

♻️ (lib/tezos/store/walletStore.ts): switch to OctezConnectWallet

- Replace all @taquito/beacon-wallet / @airgap/beacon-dapp lazy imports
  with a single lazy import of OctezConnectWallet and buildNetwork
- Wallet is constructed with network: buildNetwork(...) instead of the
  deprecated preferredNetwork enum — CUSTOM type for every non-mainnet
- initializeWallets() no longer logs noise; silently restores session
- disconnectWallet() calls wallet.clearActiveAccount() via the public
  adapter method rather than reaching into wallet.client directly
- switchNetwork() passes reset: true to destroy the DAppClient singleton
  before creating a new one for the target network

🗑️ Remove octez_connect_bug_report.md — bug resolved in 4.8.3

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…478 to keep documentation current and relevant
Copilot AI review requested due to automatic review settings March 30, 2026 07:16
@netlify
Copy link
Copy Markdown

netlify Bot commented Mar 30, 2026

Deploy Preview for tezos-next-boilerplate failed. Why did it fail? →

Name Link
🔨 Latest commit be131b8
🔍 Latest deploy log https://app.netlify.com/projects/tezos-next-boilerplate/deploys/69ca2450963a4b0008bd844d

@skullzarmy
Copy link
Copy Markdown
Collaborator Author

@josim please review the Octez.connect SDK implementation here for update.

Add .nvmrc and package.json engines field to use Node 20.x,
fixing the missing lightningcss.linux-x64-gnu.node binary error.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR migrates the Tezos wallet integration from the Beacon/Taquito BeaconWallet stack to @tezos-x/octez.connect-sdk by introducing a Taquito WalletProvider adapter and updating the Zustand wallet store accordingly.

Changes:

  • Replace Beacon-related dependencies with @tezos-x/octez.connect-sdk.
  • Update walletStore to initialize/connect/disconnect/switch networks using the new OctezConnectWallet adapter.
  • Add a new OctezConnectWallet adapter that implements Taquito’s WalletProvider over octez.connect, and regenerate the Bun lockfile.

Reviewed changes

Copilot reviewed 5 out of 7 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
package.json Removes Beacon deps and adds @tezos-x/octez.connect-sdk.
lib/tezos/store/walletStore.ts Switches store wallet type + init/connect/disconnect/network switching to octez.connect.
lib/tezos/OctezConnectWallet.ts New Taquito WalletProvider adapter built on octez.connect SDK.
bun.lock New/generated Bun lockfile reflecting dependency changes.
README.md Removes the dedicated “Security” section block.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

if (watermark !== undefined) {
bb = mergebuf(watermark, bb);
}
const watermarkedBytes = buf2hex(Buffer.from(bb));
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sign() uses Buffer.from(...) but Buffer is not imported. In Next.js client bundles (and especially Edge runtimes), Buffer is not guaranteed to be available globally, which can cause a runtime crash when signing. Import Buffer from the buffer package (or avoid Buffer entirely by converting the Uint8Array to hex without it).

Suggested change
const watermarkedBytes = buf2hex(Buffer.from(bb));
const watermarkedBytes = buf2hex(bb);

Copilot uses AI. Check for mistakes.
Comment on lines +130 to +134
async getPK(): Promise<string> {
const account = await this.client.getActiveAccount();
if (!account) throw new OctezConnectNotInitialized();
return account.publicKey ?? "";
}
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getPK() returns an empty string when account.publicKey is missing. Returning an invalid public key can cause downstream Taquito operations to fail with confusing errors; it would be safer to throw a specific error (or ensure permissions/request flow guarantees a public key is available) rather than returning "".

Copilot uses AI. Check for mistakes.
* internal network lookup, which may not recognise newer testnet names and
* would otherwise throw PARAMETERS_INVALID_ERROR.
*
* @see skills/tezos-octez-connect-patterns.md §1
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The JSDoc reference @see skills/tezos-octez-connect-patterns.md §1 points to a file/path that doesn't exist in this repository. Consider updating the reference to a real doc link/location (or removing it) so future readers can follow the guidance.

Suggested change
* @see skills/tezos-octez-connect-patterns.md §1
* @see https://docs.tezos.com/dApps/wallets/octez-connect#network-configuration

Copilot uses AI. Check for mistakes.
Comment on lines +123 to 127
// Lazily create the wallet if initializeWallets has not run yet
if (!wallet) {
const { BeaconWallet } = await import("@taquito/beacon-wallet");
const { NetworkType } = await import("@airgap/beacon-dapp");
const { OctezConnectWallet, buildNetwork } = await import("../OctezConnectWallet");
const networkConfig = NETWORK_CONFIGS[get().network];

Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

connectWallet() can lazily create a wallet when initializeWallets() hasn't run yet, but it doesn't set isInitialized to true. That allows useTezos's effect to still call initializeWallets() afterward, potentially re-creating/resetting the wallet provider right after a user-initiated connect. Consider marking the store initialized here (or have connectWallet() await initializeWallets() when !isInitialized).

Copilot uses AI. Check for mistakes.
@skullzarmy
Copy link
Copy Markdown
Collaborator Author

well it worked locally lolol

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