Skip to content

Comments

feat: add_all_tlds_and paymentid#682

Closed
Candy9797 wants to merge 4 commits intoenkryptcom:mainfrom
Candy9797:feat/support_all_tlds_and_pid
Closed

feat: add_all_tlds_and paymentid#682
Candy9797 wants to merge 4 commits intoenkryptcom:mainfrom
Candy9797:feat/support_all_tlds_and_pid

Conversation

@Candy9797
Copy link
Contributor

@Candy9797 Candy9797 commented May 9, 2025

Summary by CodeRabbit

  • New Features

    • Expanded support for name resolution to include PaymentId names and additional blockchain TLDs.
    • Added integration with new SDK-based resolvers for EVM, Solana, and PaymentId protocols.
    • Introduced timeout configuration for name resolution requests.
  • Improvements

    • Enhanced name resolution accuracy by passing network provider information during address resolution in transaction and swap interfaces.
    • Improved type safety and structure for blockchain protocols and payment ID chains.
  • Bug Fixes

    • Improved error handling and fallback mechanisms in reverse name resolution.
  • Chores

    • Updated dependencies and configuration to support new SDKs and features.

@coderabbitai
Copy link

coderabbitai bot commented May 9, 2025

"""

Walkthrough

This update enhances the name resolution logic by introducing support for PaymentId names and expanding TLD support through the integration of the @web3-name-sdk/core SDK. Method signatures for name resolution functions are extended to accept an optional chain/provider parameter, and new dependencies are added to accommodate Solana and PaymentId features.

Changes

File(s) Change Summary
packages/extension/package.json
packages/name-resolution/package.json
Added dependencies: @bonfida/spl-name-service, @solana/web3.js, @web3-name-sdk/core.
packages/extension/src/libs/name-resolver/index.ts
packages/name-resolution/src/index.ts
packages/name-resolution/src/types.ts
Updated resolveName and resolveAddress method signatures to accept an optional chain/provider parameter.
packages/extension/src/providers/ethereum/ui/send-transaction/index.vue
packages/extension/src/providers/solana/ui/send-transaction/index.vue
packages/extension/src/ui/action/views/swap/index.vue
Modified calls to resolveName to pass the network provider as an additional argument.
packages/name-resolution/src/sid/index.ts Refactored SIDResolver to use SDK-based resolvers for EVM, Solana, and PaymentId. Expanded TLD support, added timeout handling, PaymentId integration, and reworked method implementations.
packages/name-resolution/src/sid/types.ts Extended SIDOptions with a timeout property. Added types/enums/constants for protocol, PaymentId chains, methods, and timeout presets.
packages/name-resolution/src/sid/utils.ts Added isValidPaymentId utility function for PaymentId format validation.
packages/name-resolution/tsconfig.json Added path alias for @web3-name-sdk/core and formatting update.

Sequence Diagram(s)

sequenceDiagram
    participant UI as UI Component
    participant NameResolver as GenericNameResolver
    participant SDK as Web3NameSDK/SolanaSDK/PaymentIdSDK

    UI->>NameResolver: resolveName(name, coins, providerChain)
    NameResolver->>NameResolver: iterate coins
    NameResolver->>SDK: resolveAddress(name, coin, providerChain)
    SDK-->>NameResolver: resolved address or null
    NameResolver-->>UI: resolved address or null
Loading
sequenceDiagram
    participant App as Application
    participant SIDResolver
    participant PaymentIdSDK
    participant SolanaSDK
    participant Web3NameSDK

    App->>SIDResolver: resolveAddress(name, coin, paymentIdChain)
    alt PaymentId name
        SIDResolver->>PaymentIdSDK: handlePaymentIdGetAddress(name, paymentIdChain)
        PaymentIdSDK-->>SIDResolver: address or null
    else Solana TLD
        SIDResolver->>SolanaSDK: resolveAddress(name, coin)
        SolanaSDK-->>SIDResolver: address or null
    else EVM/Other TLD
        SIDResolver->>Web3NameSDK: resolveAddress(name, coin)
        Web3NameSDK-->>SIDResolver: address or null
    end
    SIDResolver-->>App: address or null
Loading

Suggested reviewers

  • gamalielhere
  • olgakup
  • kvhnuke
    """

Tip

⚡️ Faster reviews with caching
  • CodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 16th. To opt out, configure Review - Disable Cache at either the organization or repository level. If you prefer to disable all data retention across your organization, simply turn off the Data Retention setting under your Organization Settings.

Enjoy the performance boost—your workflow just got faster.


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 34c9791 and 6606496.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (2)
  • packages/name-resolution/package.json (1 hunks)
  • packages/name-resolution/src/types.ts (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/name-resolution/package.json
  • packages/name-resolution/src/types.ts
✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@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: 3

🔭 Outside diff range comments (1)
packages/extension/src/libs/name-resolver/index.ts (1)

17-26: ⚠️ Potential issue

Critical issue: providerChain parameter is not used

The method signature has been updated to accept the providerChain parameter, but this parameter is not passed to the underlying resolveAddress method call. This will prevent PaymentId name resolution from working correctly despite UI components passing the provider.

Apply this fix to pass the providerChain parameter to the resolveAddress method:

  async resolveName(name: string, coins: CoinType[], providerChain?: string): Promise<string | null> {
    let response: string | null = null;
    for (const coin of coins) {
      response = await this.nameResolver
-       .resolveAddress(name, coin)
+       .resolveAddress(name, coin, providerChain)
        .catch(() => null);
      if (response) return response;
    }
    return response;
  }
🧹 Nitpick comments (7)
packages/name-resolution/src/sid/utils.ts (1)

1-2: PaymentId validation implementation looks good.

The regex correctly validates the basic PaymentId format (alphanumeric@alphanumeric), aligning with the PR objective to add PaymentId support.

Consider adding support for common special characters in the local part of the PaymentId if required by the standard specification. For example:

-const paymentIdRegex = /^[a-zA-Z0-9]+@[a-zA-Z0-9]+$/
+const paymentIdRegex = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9]+$/

Additionally, consider adding unit tests for this utility function to ensure correctness.

packages/name-resolution/src/types.ts (1)

155-155: Type inconsistency between method signatures

The isSupportedName method uses the PaymentIdChain type for the paymentIdChain parameter, while resolveAddress uses string. This inconsistency could lead to type confusion.

Consider using the same type for consistency:

- public abstract isSupportedName(name: string, paymentIdChain?:PaymentIdChain): boolean;
+ public abstract isSupportedName(name: string, paymentIdChain?: string): boolean;

Or adjust resolveAddress to use the more specific type if appropriate:

- public abstract resolveAddress(name: string, coint: CoinType, paymentIdChain?: string): Promise<string | null>;
+ public abstract resolveAddress(name: string, coint: CoinType, paymentIdChain?: PaymentIdChain): Promise<string | null>;
packages/name-resolution/src/sid/types.ts (2)

6-7: Terminate the timeout property with a semicolon for stylistic consistency

All other members in the SIDOptions interface are terminated with semicolons (;). Although TypeScript’s ASI handles the missing delimiter, keeping the interface homogeneous avoids unnecessary diffs and potential ESLint/TS-lint noise.

-  timeout?: number
+  timeout?: number;

18-25: Freeze and strongly-type the PAYMENT_ID_CHAINS_MAP

Today the map is a mutable plain object whose value type is an inferred union of the numeric literals (0 | 1 | …). Converting it to a readonly as const map (or Record<string, PaymentIdChain>) eliminates accidental mutation and guarantees that look-ups return only valid PaymentIdChain values.

-export const PAYMENT_ID_CHAINS_MAP = {
+export const PAYMENT_ID_CHAINS_MAP = {
   "bitcoin": 0,
   "ethereum": 1,
   "solana": 2,
   "tron": 3,
   "aptos": 4,
   "sui": 5,
-};
+} as const;

You may also want to give it an explicit type:

export const PAYMENT_ID_CHAINS_MAP: Record<string, PaymentIdChain> = {};
packages/name-resolution/src/sid/index.ts (3)

85-93: Remove stray console.log or gate it behind a debug flag

console.log in library code can spam consumer logs. Either remove it or guard it with a debug flag/environment variable.


86-89: Typo: cointcoin (or remove the param)

The parameter is named coint, which is likely a misspelling of coin. If it’s unused (as it appears), consider deleting it to satisfy noUnusedParameters; otherwise, rename for clarity.

-public async resolveAddress(
-  name: string,
-  coint: CoinType,
-  paymentIdChain?: string,
+public async resolveAddress(
+  name: string,
+  coin: CoinType,
+  paymentIdChain?: string,

110-112: Normalize TLD case to avoid false negatives

getTLD(name) may return mixed-case strings (user input). Convert to lowercase when checking membership:

-return this.supportedTLDs.includes(getTLD(name)) || isValidPaymentId(name);
+return (
+  this.supportedTLDs.includes(getTLD(name).toLowerCase()) ||
+  isValidPaymentId(name)
+);
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c6d81f2 and 0bdcceb.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (14)
  • packages/extension/package.json (2 hunks)
  • packages/extension/src/libs/name-resolver/index.ts (1 hunks)
  • packages/extension/src/providers/ethereum/ui/send-transaction/index.vue (1 hunks)
  • packages/extension/src/providers/kadena/ui/send-transaction/index.vue (1 hunks)
  • packages/extension/src/providers/polkadot/ui/send-transaction/index.vue (1 hunks)
  • packages/extension/src/providers/solana/ui/send-transaction/index.vue (1 hunks)
  • packages/extension/src/ui/action/views/swap/index.vue (1 hunks)
  • packages/name-resolution/package.json (1 hunks)
  • packages/name-resolution/src/index.ts (1 hunks)
  • packages/name-resolution/src/sid/index.ts (1 hunks)
  • packages/name-resolution/src/sid/types.ts (1 hunks)
  • packages/name-resolution/src/sid/utils.ts (1 hunks)
  • packages/name-resolution/src/types.ts (2 hunks)
  • packages/name-resolution/tsconfig.json (1 hunks)
🧰 Additional context used
🪛 Biome (1.9.4)
packages/name-resolution/src/sid/index.ts

[error] 98-100: Other switch clauses can erroneously access this declaration.
Wrap the declaration in a block to restrict its access to the switch clause.

The declaration is defined in this switch clause:

Unsafe fix: Wrap the declaration in a block.

(lint/correctness/noSwitchDeclarations)


[error] 103-105: Other switch clauses can erroneously access this declaration.
Wrap the declaration in a block to restrict its access to the switch clause.

The declaration is defined in this switch clause:

Unsafe fix: Wrap the declaration in a block.

(lint/correctness/noSwitchDeclarations)

🔇 Additional comments (14)
packages/name-resolution/package.json (2)

52-52:

Details

❓ Verification inconclusive

Verify Solana dependency compatibility and version security.

The addition of the Solana web3.js library supports the integration of Solana blockchain-based name resolution.


🏁 Script executed:

#!/bin/bash
# Check for the latest version of @solana/web3.js and any known security advisories

# Get the latest version from npm
echo "Checking latest version of @solana/web3.js:"
npm view @solana/web3.js version

# Check for any known vulnerabilities
echo "Checking for known vulnerabilities:"
npm audit --package @solana/web3.js

Length of output: 606


Review Solana web3.js Dependency Version and Security

  • packages/name-resolution/package.json (Line 52) pins
    @solana/web3.js: "^1.98.0".
    Latest patch release is 1.98.2, which falls within this range—no immediate version bump is required.
  • The npm audit --package @solana/web3.js check failed due to a missing lockfile. To fully vet for vulnerabilities:
    1. Generate a lockfile (e.g., npm install --package-lock-only).
    2. Run npm audit in the project root or integrate a dependency-scanning step in your CI.
    3. Address any advisories before merging.

Please verify that a lockfile is committed and that the audit report is clean.


54-54:

Details

❓ Verification inconclusive

Verify web3-name-sdk dependency compatibility.

The addition of the @web3-name-sdk/core package enables the expanded TLD handling and PaymentId resolution support as specified in the PR objectives.


🏁 Script executed:

#!/bin/bash
# Check for the latest version of @web3-name-sdk/core and its GitHub repository status

# Get the latest version from npm
echo "Checking latest version of @web3-name-sdk/core:"
npm view @web3-name-sdk/core version

# Check for GitHub repository info
echo "Checking GitHub repository info and activity:"
npm view @web3-name-sdk/core repository.url

Length of output: 296


Confirm @web3-name-sdk/core Version & Maintenance Status

The npm registry shows you’re already using the latest release (0.4.1), but the package metadata does not expose a repository URL, making it hard to audit maintenance activity and future breaking changes. Please verify:

  • File: packages/name-resolution/package.json (line 54): dependency is "@web3-name-sdk/core": "^0.4.1".
  • That 0.4.1 fully supports the expanded TLD handling and PaymentId resolution your PR requires.
  • The upstream GitHub repository is active, matches this package, and has no pending breaking changes.
  • Whether you should pin or widen the version range for future compatibility.
packages/extension/package.json (2)

27-27:

Details

❓ Verification inconclusive

Verify Bonfida SPL name service compatibility.

The addition of Bonfida's SPL name service library supports Solana-based domain resolution in the extension.


🏁 Script executed:

#!/bin/bash
# Check for the latest version of @bonfida/spl-name-service and any known security advisories

# Get the latest version from npm
echo "Checking latest version of @bonfida/spl-name-service:"
npm view @bonfida/spl-name-service version

# Check for any known vulnerabilities
echo "Checking for known vulnerabilities:"
npm audit --package @bonfida/spl-name-service

Length of output: 646


Verify @bonfida/spl-name-service Version and Security Audit

  • packages/extension/package.json lists "@bonfida/spl-name-service": "^3.0.10", which is the latest published version (3.0.10).

  • The audit command failed due to a missing lockfile. Please generate one and rerun the audit:

    cd packages/extension
    npm install --package-lock-only
    npm audit --package @bonfida/spl-name-service

    or manually review npm advisories for any vulnerabilities before merging.

No further changes are needed if no security issues are found.


82-82:

Details

❓ Verification inconclusive

Verify viem dependency compatibility.

The addition of viem, a modern TypeScript interface for Ethereum, provides improved type safety and performance for blockchain interactions in the extension.


🏁 Script executed:

#!/bin/bash
# Check for the latest version of viem and any known security advisories

# Get the latest version from npm
echo "Checking latest version of viem:"
npm view viem version

# Check for any known vulnerabilities
echo "Checking for known vulnerabilities:"
npm audit --package viem

Length of output: 562


Dependency Compatibility Verified for viem

The caret range ^2.23.12 already covers the latest viem@2.29.1. No known advisories were flagged for viem itself, but since the audit in this sandbox failed for lack of a lockfile, please confirm in your project:

  • Generate your lockfile and run the audit in your repo context:
    npm install --package-lock-only
    npm audit --package viem
  • Ensure no vulnerabilities are reported before merging.
packages/extension/src/providers/ethereum/ui/send-transaction/index.vue (1)

673-673:

Details

✅ Verification successful

Check name resolution protocol support.

The code specifies an array of supported protocols ([props.network.name as CoinType, 'ETH']).


🏁 Script executed:

#!/bin/bash
# Verify that the array of supported protocols is consistent with other implementations
# and that all the required protocols are included

echo "Checking for other CoinType arrays in name resolution calls:"
find src/providers -name "*.vue" -o -name "*.ts" | xargs grep -n "CoinType" --color=always

echo "Checking if PaymentId is included in name resolution protocols:"
find packages/name-resolution/src -name "*.ts" | xargs grep -n "PaymentId" --color=always

Length of output: 3380


#!/bin/bash
# Display the context around line 673 in the send-transaction component
sed -n '650,740p' packages/extension/src/providers/ethereum/ui/send-transaction/index.vue

🏁 Script executed:

#!/bin/bash
# Search for all CoinType usages in the extension provider code
grep -R "CoinType" -n packages/extension/src/providers

# Show the surrounding lines around the protocol array in send-transaction component
sed -n '650,720p' packages/extension/src/providers/ethereum/ui/send-transaction/index.vue

Length of output: 2862


Ethereum name resolution protocols are correct.
The array [props.network.name as CoinType, 'ETH'] matches the pattern used across providers (e.g. Polkadot, Solana, Kadena) and properly includes both the coin-type and the ENS ticker for ENS lookups. No additional protocols (such as PaymentIdChain) are required here.

packages/extension/src/providers/solana/ui/send-transaction/index.vue (1)

696-701: Good addition of provider parameter to support expanded name resolution capabilities.

The addition of the network provider parameter to the resolveName method call is consistent with the enhancement of name resolution capabilities in the PR. This change enables the method to utilize provider-specific information when resolving addresses.

packages/extension/src/providers/polkadot/ui/send-transaction/index.vue (1)

380-385: Correctly implemented provider parameter for name resolution.

The addition of the network provider parameter to the resolveName method call is consistent with changes in other components and supports the enhanced name resolution capabilities being introduced, particularly for PaymentId support.

packages/extension/src/ui/action/views/swap/index.vue (1)

406-411: Properly aligned with name resolution enhancements.

The third parameter (provider) has been correctly added to the resolveName method call, maintaining consistency with similar changes in other components. This change supports the expanded TLD handling and PaymentId integration in the name resolution system.

packages/name-resolution/tsconfig.json (1)

5-5: Module configuration updated to support the Web3 Name SDK integration.

The TypeScript configuration has been properly updated to support the integration of the @web3-name-sdk/core package. The changes include:

  1. Changing moduleResolution to "bundler" for modern module resolution
  2. Updating module to "es2020" to enable modern JavaScript features
  3. Adding TypeScript declaration file generation
  4. Adding paths mapping for the SDK to ensure proper module resolution

These changes are necessary to support the refactoring of the SIDResolver to use SDK-based resolvers for EVM, Solana, and PaymentId protocols.

Also applies to: 11-18

packages/extension/src/providers/kadena/ui/send-transaction/index.vue (1)

402-406: LGTM - Added provider context for name resolution

The code correctly passes the network provider as a third parameter to the name resolver, which enables protocol-specific name resolution including PaymentId.

packages/name-resolution/src/index.ts (2)

49-52: LGTM - Added PaymentId chain support to resolveAddress method

The parameter addition is consistent with the updated BaseResolver interface and allows for PaymentId name resolution.


54-54: LGTM - Updated SID resolver call to utilize the new parameter

The code correctly passes the paymentIdChain parameter to the SID resolver, enabling PaymentId name resolution.

packages/name-resolution/src/types.ts (2)

2-2: LGTM - Added PaymentIdChain type import

The import has been correctly updated to include the PaymentIdChain type from sid/types.


149-151: LGTM - Updated BaseResolver.resolveAddress signature

The method signature has been correctly updated to support the optional paymentIdChain parameter.

Comment on lines +103 to +107
const address = await this.web3NameResolver.getAddress(name, {
timeout: this.timeout,
});
return parseInt(address, 16) === 0 ? null : address;
}
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Avoid parseInt for zero-address detection

parseInt('0x…', 16) can overflow Number.MAX_SAFE_INTEGER, and any non-numeric characters after the first invalid hex digit are silently ignored. A safer test is to compare against the canonical zero address:

-return parseInt(address, 16) === 0 ? null : address;
+return /^0x0{40}$/i.test(address) ? null : address;

If the SDK already returns null/undefined on failure, you can omit the check entirely.

📝 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
const address = await this.web3NameResolver.getAddress(name, {
timeout: this.timeout,
});
return parseInt(address, 16) === 0 ? null : address;
}
const address = await this.web3NameResolver.getAddress(name, {
timeout: this.timeout,
});
return /^0x0{40}$/i.test(address) ? null : address;
}
🧰 Tools
🪛 Biome (1.9.4)

[error] 103-105: Other switch clauses can erroneously access this declaration.
Wrap the declaration in a block to restrict its access to the switch clause.

The declaration is defined in this switch clause:

Unsafe fix: Wrap the declaration in a block.

(lint/correctness/noSwitchDeclarations)

Comment on lines +96 to +108
switch (tld) {
case "sol":
const solAddress = await this.solanaNameResolver.getAddress({
name,
});
return solAddress;
default:
const address = await this.web3NameResolver.getAddress(name, {
timeout: this.timeout,
});
return parseInt(address, 16) === 0 ? null : address;
}
}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix lexical-declaration leak inside switch cases

Declaring const variables directly in a case clause without wrapping it in braces violates the ECMAScript spec and is flagged by Biome (noSwitchDeclarations).
Wrap each clause in its own block to contain the scope:

switch (tld) {
-  case "sol":
-    const solAddress = await this.solanaNameResolver.getAddress({
-      name,
-    });
-    return solAddress;
-  default:
-    const address = await this.web3NameResolver.getAddress(name, {
-      timeout: this.timeout,
-    });
-    return parseInt(address, 16) === 0 ? null : address;
+  case "sol": {
+    const solAddress = await this.solanaNameResolver.getAddress({ name });
+    return solAddress;
+  }
+  default: {
+    const address = await this.web3NameResolver.getAddress(name, {
+      timeout: this.timeout,
+    });
+    return parseInt(address, 16) === 0 ? null : address;
+  }
}
📝 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
switch (tld) {
case "sol":
const solAddress = await this.solanaNameResolver.getAddress({
name,
});
return solAddress;
default:
const address = await this.web3NameResolver.getAddress(name, {
timeout: this.timeout,
});
return parseInt(address, 16) === 0 ? null : address;
}
}
switch (tld) {
case "sol": {
const solAddress = await this.solanaNameResolver.getAddress({ name });
return solAddress;
}
default: {
const address = await this.web3NameResolver.getAddress(name, {
timeout: this.timeout,
});
return parseInt(address, 16) === 0 ? null : address;
}
}
}
🧰 Tools
🪛 Biome (1.9.4)

[error] 98-100: Other switch clauses can erroneously access this declaration.
Wrap the declaration in a block to restrict its access to the switch clause.

The declaration is defined in this switch clause:

Unsafe fix: Wrap the declaration in a block.

(lint/correctness/noSwitchDeclarations)


[error] 103-105: Other switch clauses can erroneously access this declaration.
Wrap the declaration in a block to restrict its access to the switch clause.

The declaration is defined in this switch clause:

Unsafe fix: Wrap the declaration in a block.

(lint/correctness/noSwitchDeclarations)

"compilerOptions": {
"lib": ["ESNext", "dom"],
"moduleResolution": "node",
"moduleResolution": "bundler",
Copy link
Contributor

Choose a reason for hiding this comment

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

this change cannot be done

"sourceMap": true,
"target": "es5",
"module": "commonjs",
"module": "es2020",
Copy link
Contributor

Choose a reason for hiding this comment

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

same here
we have to maintain commonjs

"switch-ts": "^1.1.1",
"url-parse": "^1.5.10",
"uuid": "^11.1.0",
"viem": "^2.23.12",
Copy link
Contributor

Choose a reason for hiding this comment

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

doesnt seem like you are using this package

Comment on lines 402 to 406
.resolveName(
text,
[props.network.name as CoinType],
props.network?.provider as string,
)
Copy link
Contributor

Choose a reason for hiding this comment

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

you dont seem to support kadena so this change is not necessary

Comment on lines 381 to 385
.resolveName(
text,
[props.network.name as CoinType, 'DOT', 'KSM'],
props.network?.provider as string,
)
Copy link
Contributor

Choose a reason for hiding this comment

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

you dont seem to support polkadot so this change is not necessary

@Candy9797 Candy9797 requested a review from kvhnuke May 13, 2025 04:41
@kvhnuke
Copy link
Contributor

kvhnuke commented May 14, 2025

merged into #691

@kvhnuke kvhnuke closed this May 14, 2025
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