Skip to content

Hot labs Wallet connect#574

Merged
Ebube111 merged 2 commits intostagingfrom
wallet-connect
Jan 21, 2026
Merged

Hot labs Wallet connect#574
Ebube111 merged 2 commits intostagingfrom
wallet-connect

Conversation

@Ebube111
Copy link
Collaborator

@Ebube111 Ebube111 commented Jan 21, 2026

Summary by CodeRabbit

  • Updates

    • Switched to a connector-based wallet flow for improved sign-in/out and session handling
    • Enhanced transaction submission with fallbacks for broader wallet compatibility
    • Updated core dependencies for stability and performance
  • Bug Fixes / Chores

    • Removed legacy wallet modal styles
    • Minor fixes and type/serialization improvements for token balances and constants

✏️ Tip: You can customize this high-level summary in your review settings.

@vercel
Copy link

vercel bot commented Jan 21, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
potlock-next-app Ready Ready Preview, Comment Jan 21, 2026 10:00am

Request Review

@Ebube111 Ebube111 changed the title Hot Wallet connect Hot labs Wallet connect Jan 21, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 21, 2026

Walkthrough

Migrates NEAR wallet integration from @near-wallet-selector to @hot-labs/near-connect (NearConnector), removes Next.js transpilePackages config, updates dependencies (including near-api-js), refactors wallet client and event handling to use a connector, and adjusts related imports and small logic/typing tweaks across multiple files.

Changes

Cohort / File(s) Summary
Wallet Integration Migration
src/common/blockchains/near-protocol/client.ts
Replace wallet-selector flow with NearConnector: connector-based init, event handling, signIn/signOut, wallet getters, buildAction via actionCreators.functionCall, and transaction signing with signAndSendTransaction + fallback to signAndSendTransactions; removed callbackUrl from CallProps.
Wallet Providers & Hooks
src/common/wallet/components/providers.tsx, src/common/wallet/hooks/user-session.ts
Switch availability/isSignedIn/account reads to use walletApi.connector and walletApi.isSignedIn; replace wallet-selector events with wallet:signIn/wallet:signOut; simplified signOut call and added error swallow.
Package & Build Configuration
package.json, next.config.js
Add @hot-labs/near-connect ^0.8.2; remove many @near-wallet-selector/* deps; bump near-api-js to 6.5.1; add browserslist, lightningcss, and resolutions; remove transpilePackages from Next config.
Constants, Types & Imports
src/common/constants.ts, src/common/contracts/core/sybil-resistance/client.ts, src/entities/_shared/account/model/effects.ts, src/pages/_app.tsx
Use direct parseNearAmount import; switch Provider type import to local ./interfaces; convert AccountView to type-only import; remove modal-ui CSS import.
Token & Donation Effects
src/entities/_shared/token/hooks/fungible.ts, src/features/donation/models/effects/...-donation.ts (campaign-ft, direct-ft, group-list, group-pot)
Coerce accountSummary.amount to string before numeric conversions; remove default parameter values from .then callbacks (finalExecutionOutcomes).
Contracts Minor Update
src/common/contracts/core/campaigns/client.ts
Added a console.log("create campaign") in an else branch.

Sequence Diagram

sequenceDiagram
    participant User as User/App
    participant Connector as NearConnector<br/>(Wallet)
    participant Client as WalletClient<br/>/ State
    participant NEAR as NEAR<br/>Network

    User->>Client: initialize connector
    Client->>Connector: new NearConnector(...)
    Connector-->>Connector: load manifest
    Connector->>Client: emit wallet:signIn
    Client->>Client: update isSignedIn, accountId

    User->>Connector: connect & select wallet
    Connector->>NEAR: request connection
    NEAR-->>Connector: confirm connection
    Connector->>Client: emit wallet:signIn / provide getConnectedWallet()

    User->>Client: sign & send transaction
    alt connector supports signAndSendTransaction
        Client->>Connector: signAndSendTransaction(tx)
    else
        Client->>Connector: signAndSendTransactions(txs)
    end
    Connector->>NEAR: send signed tx(s)
    NEAR-->>Connector: transaction result

    User->>Client: sign out
    Connector->>Client: emit wallet:signOut
    Client->>Client: clear wallet/account state
    Connector->>Connector: disconnect
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • Campaign SEO Fix 3 #450 — touches wallet integration and package dependency changes that overlap with this connector migration.
  • Issues handled  #447 — modifies the same NEAR wallet client; directly related to connector vs wallet-selector changes.
  • Added Sitemap #452 — also updates NEAR wallet integration in client.ts with conflicting/overlapping edits.

Suggested reviewers

  • Prometheo
  • Jikugodwill

Poem

🐰 Hopping through code with nimble feet,

I swapped selectors for connectors neat.
Manifests load and sign-ins sing,
Transactions choose the proper wing.
A little log, dependencies sweet — hooray, some carrots to eat!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Hot labs Wallet connect' accurately captures the main objective of the pull request, which is to replace the wallet-selector integration with @hot-labs/near-connect throughout the codebase.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In `@src/common/blockchains/near-protocol/client.ts`:
- Around line 206-230: The catch block currently retries with
wallet.signAndSendTransactions for any error from wallet.signAndSendTransaction,
which can hide real transaction failures; change the logic so you only fall back
when the error clearly indicates the method is unsupported (e.g., check
error.name/message for patterns like "is not a function"/"not defined"/"not
supported" or error instanceof TypeError) before calling
wallet.signAndSendTransactions, otherwise rethrow the original error; ensure you
still reference wallet.signAndSendTransaction, wallet.signAndSendTransactions
and outcome, and wrap the fallback call in its own try/catch so any fallback
failure is surfaced rather than silently swallowed.
- Around line 232-239: The code incorrectly casts outcome to
FinalExecutionOutcome causing type mismatch between signAndSendTransaction,
signAndSendTransactions, and callMultiple; change the fallback to detect whether
outcome is an array and return the correct shape instead of forcing a cast: use
Array.isArray(outcome) to return outcome as FinalExecutionOutcome[] for
signAndSendTransactions paths or outcome as FinalExecutionOutcome for
single-transaction paths, update the providers.getTransactionLastResult handling
to only cast the single-result branch, and ensure callMultiple returns the
array-returning signAndSendTransactions result (or unwrap it consistently) so
the API return types for signAndSendTransaction, signAndSendTransactions, and
callMultiple remain consistent.
🧹 Nitpick comments (2)
src/common/contracts/core/campaigns/client.ts (1)

80-83: Avoid console.log side-effects in contract client.

This adds runtime noise to a shared client layer; prefer logging in the consuming layer or via a centralized logger with environment guards.

🛠️ Suggested change
-  } else {
-    console.log("create campaign");
+  } else {
     return contractApi.call<CreateCampaignParams["args"], Campaign>("create_campaign", {

As per learnings, keep the contract client layer free of side-effect/error-handling logic.

src/common/blockchains/near-protocol/client.ts (1)

18-23: Consider removing unused callbackUrl from CallProps.

The callbackUrl property is defined but not used in the call method. The callMultiple method's _callbackUrl parameter is also explicitly marked as unused with an underscore prefix. Consider removing these if callback URLs are no longer supported by the NearConnector API.

♻️ Suggested fix
 type CallProps<A extends object = Record<string, unknown>> = {
   args?: A;
   gas?: string;
   deposit?: string;
-  callbackUrl?: string;
 };

Comment on lines +206 to +230
try {
if (!("signAndSendTransaction" in wallet)) {
throw new Error("Wallet does not support signAndSendTransaction");
}

outcome = await wallet.signAndSendTransaction({
signerId,
receiverId: transaction.receiverId,
actions: transaction.actions,
});
} catch (error) {
// Fallback for wallets that only support signAndSendTransactions
if ("signAndSendTransactions" in wallet) {
outcome = await wallet.signAndSendTransactions({
transactions: [
{
receiverId: transaction.receiverId,
actions: transaction.actions,
},
],
});
} else {
throw error;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Overly broad catch may swallow legitimate transaction errors.

The fallback logic catches all errors from signAndSendTransaction, including actual transaction failures, and attempts signAndSendTransactions instead. This could mask real errors (e.g., insufficient funds, contract panics) by retrying with a different method.

Consider checking the error type or message to only fall back when the method isn't supported:

🔧 Suggested fix
     try {
       if (!("signAndSendTransaction" in wallet)) {
         throw new Error("Wallet does not support signAndSendTransaction");
       }

       outcome = await wallet.signAndSendTransaction({
         signerId,
         receiverId: transaction.receiverId,
         actions: transaction.actions,
       });
     } catch (error) {
-      // Fallback for wallets that only support signAndSendTransactions
-      if ("signAndSendTransactions" in wallet) {
+      // Fallback for wallets that only support signAndSendTransactions (method not available)
+      const isMethodNotSupported =
+        error instanceof Error &&
+        (error.message.includes("does not support signAndSendTransaction") ||
+          error.message.includes("not a function") ||
+          error.message.includes("not implemented"));
+
+      if (isMethodNotSupported && "signAndSendTransactions" in wallet) {
         outcome = await wallet.signAndSendTransactions({
           transactions: [
             {
               receiverId: transaction.receiverId,
               actions: transaction.actions,
             },
           ],
         });
       } else {
         throw error;
       }
     }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
try {
if (!("signAndSendTransaction" in wallet)) {
throw new Error("Wallet does not support signAndSendTransaction");
}
outcome = await wallet.signAndSendTransaction({
signerId,
receiverId: transaction.receiverId,
actions: transaction.actions,
});
} catch (error) {
// Fallback for wallets that only support signAndSendTransactions
if ("signAndSendTransactions" in wallet) {
outcome = await wallet.signAndSendTransactions({
transactions: [
{
receiverId: transaction.receiverId,
actions: transaction.actions,
},
],
});
} else {
throw error;
}
}
try {
if (!("signAndSendTransaction" in wallet)) {
throw new Error("Wallet does not support signAndSendTransaction");
}
outcome = await wallet.signAndSendTransaction({
signerId,
receiverId: transaction.receiverId,
actions: transaction.actions,
});
} catch (error) {
// Fallback for wallets that only support signAndSendTransactions (method not available)
const isMethodNotSupported =
error instanceof Error &&
(error.message.includes("does not support signAndSendTransaction") ||
error.message.includes("not a function") ||
error.message.includes("not implemented"));
if (isMethodNotSupported && "signAndSendTransactions" in wallet) {
outcome = await wallet.signAndSendTransactions({
transactions: [
{
receiverId: transaction.receiverId,
actions: transaction.actions,
},
],
});
} else {
throw error;
}
}
🤖 Prompt for AI Agents
In `@src/common/blockchains/near-protocol/client.ts` around lines 206 - 230, The
catch block currently retries with wallet.signAndSendTransactions for any error
from wallet.signAndSendTransaction, which can hide real transaction failures;
change the logic so you only fall back when the error clearly indicates the
method is unsupported (e.g., check error.name/message for patterns like "is not
a function"/"not defined"/"not supported" or error instanceof TypeError) before
calling wallet.signAndSendTransactions, otherwise rethrow the original error;
ensure you still reference wallet.signAndSendTransaction,
wallet.signAndSendTransactions and outcome, and wrap the fallback call in its
own try/catch so any fallback failure is surfaced rather than silently
swallowed.

Comment on lines 232 to 239
const result = providers.getTransactionLastResult(outcome as FinalExecutionOutcome);

// Some wallets don't return a last result; return the outcome instead.
if (result === undefined) {
throw new Error("Unable to determine transaction result.");
return outcome as unknown as R;
}

return result as R;
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# First, check if `@hot-labs/near-connect` exists and find type definitions
fd -t f -e "d.ts" "near-connect" node_modules 2>/dev/null | head -5

Repository: PotLock/potlock-nextjs-app

Length of output: 52


🏁 Script executed:

#!/bin/bash
# Examine the file in question to understand context
cat -n src/common/blockchains/near-protocol/client.ts | sed -n '220,250p'

Repository: PotLock/potlock-nextjs-app

Length of output: 1075


🏁 Script executed:

#!/bin/bash
# Search for signAndSendTransaction methods and their usage
rg "signAndSendTransaction" src/common/blockchains/near-protocol/client.ts -B 5 -A 5

Repository: PotLock/potlock-nextjs-app

Length of output: 1109


🏁 Script executed:

#!/bin/bash
# Check if there are type definitions or interfaces that define these methods
rg "signAndSendTransaction" --type ts --type d.ts -A 3 2>/dev/null | head -50

Repository: PotLock/potlock-nextjs-app

Length of output: 52


🏁 Script executed:

#!/bin/bash
# Check file imports and type definitions at the top
cat -n src/common/blockchains/near-protocol/client.ts | head -50

Repository: PotLock/potlock-nextjs-app

Length of output: 1890


🏁 Script executed:

#!/bin/bash
# Search for wallet type/interface definition in the file
rg "wallet.*:" src/common/blockchains/near-protocol/client.ts -B 2 -A 2 | head -40

Repository: PotLock/potlock-nextjs-app

Length of output: 506


🏁 Script executed:

#!/bin/bash
# Search for FinalExecutionOutcome definition
rg "FinalExecutionOutcome" src/common/blockchains/near-protocol/client.ts

Repository: PotLock/potlock-nextjs-app

Length of output: 233


🏁 Script executed:

#!/bin/bash
# Check what signAndSendTransactions returns in callMultiple function
cat -n src/common/blockchains/near-protocol/client.ts | sed -n '242,260p'

Repository: PotLock/potlock-nextjs-app

Length of output: 789


🏁 Script executed:

#!/bin/bash
# Find NearWalletBase type definition
find node_modules/@hot-labs/near-connect -name "*.d.ts" -o -name "*.ts" 2>/dev/null | xargs grep -l "NearWalletBase" 2>/dev/null | head -5

Repository: PotLock/potlock-nextjs-app

Length of output: 298


🏁 Script executed:

#!/bin/bash
# Search for signAndSendTransaction method signature in near-connect
find node_modules/@hot-labs/near-connect -type f \( -name "*.d.ts" -o -name "*.ts" \) 2>/dev/null -exec grep -l "signAndSendTransaction" {} \;

Repository: PotLock/potlock-nextjs-app

Length of output: 318


🏁 Script executed:

#!/bin/bash
# Try to locate and read the type definitions
fd "\.d\.ts$" node_modules/@hot-labs/near-connect 2>/dev/null | head -3

Repository: PotLock/potlock-nextjs-app

Length of output: 257


🏁 Script executed:

#!/bin/bash
# Read the types file to find NearWalletBase
cat node_modules/@hot-labs/near-connect/build/types.d.ts

Repository: PotLock/potlock-nextjs-app

Length of output: 4616


🏁 Script executed:

#!/bin/bash
# Also check InjectedWallet
cat node_modules/@hot-labs/near-connect/build/InjectedWallet.d.ts

Repository: PotLock/potlock-nextjs-app

Length of output: 1108


Fix type incompatibility between signAndSendTransaction and signAndSendTransactions return types.

signAndSendTransaction returns FinalExecutionOutcome, but signAndSendTransactions (fallback on line 225) returns Array<FinalExecutionOutcome>. The type cast on line 232 incorrectly asserts the outcome as FinalExecutionOutcome when the fallback path provides an array. Additionally, callMultiple (line 258) returns signAndSendTransactions directly, which is an array, creating inconsistent return types across the API.

🤖 Prompt for AI Agents
In `@src/common/blockchains/near-protocol/client.ts` around lines 232 - 239, The
code incorrectly casts outcome to FinalExecutionOutcome causing type mismatch
between signAndSendTransaction, signAndSendTransactions, and callMultiple;
change the fallback to detect whether outcome is an array and return the correct
shape instead of forcing a cast: use Array.isArray(outcome) to return outcome as
FinalExecutionOutcome[] for signAndSendTransactions paths or outcome as
FinalExecutionOutcome for single-transaction paths, update the
providers.getTransactionLastResult handling to only cast the single-result
branch, and ensure callMultiple returns the array-returning
signAndSendTransactions result (or unwrap it consistently) so the API return
types for signAndSendTransaction, signAndSendTransactions, and callMultiple
remain consistent.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In `@package.json`:
- Line 30: The dependency "@hot-labs/near-connect" referenced in package.json is
actively maintained and tied to HERE Wallet—verify it meets our
stability/compatibility requirements by running integration tests against the
current ^0.8.2 release and reviewing its changelog for breaking changes; if
compatibility is confirmed, either keep the caret range (^0.8.2) or update the
version to the latest published release, and add a short note in our dependency
documentation (e.g., DEPENDENCIES.md) mentioning its pre-1.0 status and that it
was validated for our app; if it fails compatibility, pin to a known-good
version or replace it with an alternative.
- Line 78: The package.json pins "near-api-js": "6.5.1" which is incompatible
with existing imports (e.g., near-api-js/lib/utils/format,
near-api-js/lib/providers/provider, and Account) because v6 split into
`@near-js/`* packages; either revert this dependency to a v2.x that matches
current codebase or migrate all imports to the new modular packages per the
official MIGRATION.md (replace legacy imports and usages of Account and internal
paths with the appropriate `@near-js/`* modules; note `@near-js/transactions` is
already present). Also align version pinning style with project convention (use
caret ranges like ^2.x for near-api-js or document why exact pins are required)
and treat react-day-picker (8.10.1) similarly.
🧹 Nitpick comments (2)
package.json (2)

68-68: Consider moving build tools to devDependencies.

browserslist and lightningcss are typically build-time tools rather than runtime dependencies. Unless they are required at runtime (e.g., for server-side CSS processing), consider moving them to devDependencies to reduce production bundle size.

Also applies to: 75-75


111-113: Document the reason for the @noble/curves resolution override.

The @noble/curves resolution forces version ^1.8.0 to resolve version conflicts across transitive dependencies. Different versions of @near-js/crypto (used by viem/wagmi dependencies) require conflicting versions: older versions expect 1.2.0, while newer versions expect 1.8.1+. This resolution ensures compatibility by enforcing a minimum version across the entire dependency tree. Consider adding a comment in package.json or README.md explaining this constraint and referencing the @near-js/crypto version alignment, to help future maintainers understand when it can be removed or updated.

"@ebay/nice-modal-react": "^1.2.13",
"@formkit/tempo": "^0.1.2",
"@hookform/resolvers": "^3.9.1",
"@hot-labs/near-connect": "^0.8.2",
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check npm registry info for `@hot-labs/near-connect`
curl -s https://registry.npmjs.org/@hot-labs/near-connect | jq '{name: .name, description: .description, "dist-tags": .["dist-tags"], time: .time | keys[-5:], maintainers: .maintainers}'

Repository: PotLock/potlock-nextjs-app

Length of output: 463


@hot-labs/near-connect is actively maintained and associated with HERE Wallet.

The package is properly published on npm with recent version releases (0.8.0–0.8.2) and maintained by the HERE Wallet ecosystem. However, note that it's still in pre-1.0 development phase—verify compatibility with your application's stability requirements.

🤖 Prompt for AI Agents
In `@package.json` at line 30, The dependency "@hot-labs/near-connect" referenced
in package.json is actively maintained and tied to HERE Wallet—verify it meets
our stability/compatibility requirements by running integration tests against
the current ^0.8.2 release and reviewing its changelog for breaking changes; if
compatibility is confirmed, either keep the caret range (^0.8.2) or update the
version to the latest published release, and add a short note in our dependency
documentation (e.g., DEPENDENCIES.md) mentioning its pre-1.0 status and that it
was validated for our app; if it fails compatibility, pin to a known-good
version or replace it with an alternative.

"lucide-react": "^0.378.0",
"markdown-truncate": "^1.1.1",
"near-api-js": "^2.1.4",
"near-api-js": "6.5.1",
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🌐 Web query:

near-api-js 6.5.1 breaking changes from version 2 release notes

💡 Result:

Do you mean: (A) "What breaking changes are introduced in near-api-js v6.5.1 compared to the v2.x release (i.e., a migration summary)?" or (B) "Show the breaking changes listed in the near-api-js v2 release notes and how v6.5.1 relates to them?"


🏁 Script executed:

# Check the dependency versions in package.json to verify consistency
cd . && cat -n package.json | sed -n '1,100p' | head -100

Repository: PotLock/potlock-nextjs-app

Length of output: 4346


🌐 Web query:

near-api-js changelog v6 breaking changes migration guide

💡 Result:

Short answer — see the official near-api-js CHANGELOG and Migration guide on the GitHub repo for v6 breaking changes and step-by-step migration instructions: GitHub CHANGELOG.md and MIGRATION.md. [1][2]

Helpful links:

  • near-api-js repository (CHANGELOG + MIGRATION.md). [1]
  • NEAR docs / near-api-js overview (context on package changes). [2]

If you want, I can open MIGRATION.md and extract the v6 breaking changes and exact code migration examples for you. Which would you prefer?

Sources:
[1] near/near-api-js (GitHub) — repository files including CHANGELOG.md and MIGRATION.md.
[2] NEAR docs — NEAR JavaScript API overview.


🏁 Script executed:

# Search for near-api-js usage in the codebase
rg "near-api-js" --type ts --type tsx --type js --type json -A 3 -B 1

Repository: PotLock/potlock-nextjs-app

Length of output: 97


🌐 Web query:

near-api-js v6.0.0 breaking changes what changed from v2

💡 Result:

Short summary — biggest breaking changes from near-api-js v2 → v6:

  • Library restructured and renamed into modular @near-js/* packages (no single monolithic near-api-js). You now import only needed packages (accounts, providers, signers, transactions, tokens, etc.). [1][2]
  • New high-level client/typed APIs and primitives (Account/TypedContract, actionCreators, Token helpers) and a Signer abstraction (KeyPairSigner) replacing many old keystore/signing flows — code that used old classes/constructors must be updated to new types & method names. [1][2][3]
  • Tree-shakeable, modern ESM-first packages and examples; different import paths and usage patterns (CDN paths and package names changed). Expect to update imports throughout your codebase. [1][3]
  • Provider and RPC changes: new providers packages and helper factories (e.g., fallback RPC provider patterns); RPC URL/key handling and provider APIs differ. Update RPC/provider construction and RPC calls. [1][3]
  • Transactions and utilities reorganized (actionCreators, tokens with NEAR.toUnits/ toDecimal, transaction composition) — transaction construction/signing APIs changed. [1][3]
  • Overall developer UX / performance improvements (smaller bundles, clearer separation of concerns) but requires explicit migration steps (update package names, imports, constructors, and some method signatures). [1][2]

If you want, I can:

  • produce a targeted migration checklist for your code (showing old v2 snippets → new v6/@near-js equivalents), or
  • search for any specific API you use and give the exact replacement.

Sources: NEAR docs on the new @near-js packages and examples; near-api-js GitHub README; @near-js/client npm docs. [1][2][3]

References
[1] NEAR docs — NEAR API / @near-js packages.
[2] near/near-api-js GitHub (README).
[3] @near-js/client (npm) documentation.


🏁 Script executed:

# Search for near-api-js imports and usage in the codebase
rg "near-api-js|from.*near-api-js" -A 2 -B 1

Repository: PotLock/potlock-nextjs-app

Length of output: 7336


🏁 Script executed:

# Also check more dependencies to understand the pinning pattern
cat -n package.json | grep -E '"[^"]+": "[0-9]' | head -20

Repository: PotLock/potlock-nextjs-app

Length of output: 217


🏁 Script executed:

# Check if `@near-js` packages are already in package.json
grep -E '"@near-js/' package.json

Repository: PotLock/potlock-nextjs-app

Length of output: 108


🏁 Script executed:

# Check how many files are using old near-api-js imports
rg "from ['\"]near-api-js" --count

Repository: PotLock/potlock-nextjs-app

Length of output: 851


Critical: near-api-js v6.5.1 has major breaking changes that make the codebase incompatible.

near-api-js v6 fundamentally restructured the library from a monolithic package to modular @near-js/* packages. The codebase currently imports from the old v2 structure (e.g., near-api-js/lib/utils/format, near-api-js/lib/providers/provider, Account from near-api-js) in at least 17 files, which no longer exists in v6. Only partial migration has occurred (@near-js/transactions is installed, but old imports still dominate).

Either migrate all imports to the new @near-js/* packages following the official MIGRATION.md guide, or revert to near-api-js v2.x that the codebase was designed for.

Regarding version pinning: near-api-js uses exact pinning (6.5.1) while most dependencies use caret ranges (^x.y.z). This also applies to react-day-picker (8.10.1). If intentional, document why; otherwise align with project convention.

🤖 Prompt for AI Agents
In `@package.json` at line 78, The package.json pins "near-api-js": "6.5.1" which
is incompatible with existing imports (e.g., near-api-js/lib/utils/format,
near-api-js/lib/providers/provider, and Account) because v6 split into
`@near-js/`* packages; either revert this dependency to a v2.x that matches
current codebase or migrate all imports to the new modular packages per the
official MIGRATION.md (replace legacy imports and usages of Account and internal
paths with the appropriate `@near-js/`* modules; note `@near-js/transactions` is
already present). Also align version pinning style with project convention (use
caret ranges like ^2.x for near-api-js or document why exact pins are required)
and treat react-day-picker (8.10.1) similarly.

@Ebube111 Ebube111 merged commit 111b32d into staging Jan 21, 2026
3 of 5 checks passed
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