Skip to content

Conversation

@jeasonstudio
Copy link
Collaborator

[中文版模板 / Chinese template]

💡 Background and solution

🔗 Related issue link

@jeasonstudio jeasonstudio requested a review from Copilot October 14, 2025 08:48
@changeset-bot
Copy link

changeset-bot bot commented Oct 14, 2025

🦋 Changeset detected

Latest commit: cdff3b8

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@ant-design/web3-ledger Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented Oct 14, 2025

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

Project Deployment Preview Comments Updated (UTC)
ant-design-web3 Ready Ready Preview Comment Oct 15, 2025 5:56am

@github-actions
Copy link

github-actions bot commented Oct 14, 2025

Preview is ready

@coderabbitai
Copy link

coderabbitai bot commented Oct 14, 2025

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat-new-provider-ledger

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.

@socket-security
Copy link

socket-security bot commented Oct 14, 2025

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Added@​ledgerhq/​device-transport-kit-web-hid@​1.2.08410092100100
Added@​ledgerhq/​device-management-kit@​0.9.186100100100100
Added@​ledgerhq/​device-signer-kit-ethereum@​1.8.0100100100100100

View full report

Copy link

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 introduces a new Ledger hardware wallet provider for Ant Design Web3, enabling integration with Ledger devices through WebHID API. The implementation provides secure hardware wallet connectivity with device management, message signing capabilities, and React hooks for device interaction.

Key changes:

  • Adds complete Ledger wallet adapter package with React provider and hooks
  • Implements device discovery, connection management, and Ethereum signing functionality
  • Provides comprehensive documentation and examples for Ledger integration

Reviewed Changes

Copilot reviewed 28 out of 30 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
packages/ledger/package.json Package configuration with Ledger SDK dependencies
packages/ledger/src/ledger/*.ts Core Ledger device management hooks and utilities
packages/ledger/src/wallets/ledger.tsx Main Ledger wallet factory implementation
packages/ledger/src/provider/*.tsx React providers for Ledger integration
packages/ledger/src/types.ts TypeScript interfaces for Ledger wallet types
packages/ledger/docs/* Documentation and usage examples
.changeset/vast-tools-poke.md Changeset for the new feature
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

},

signMessage: async (message: string) => {
console.log('Signing message:', message);
Copy link

Copilot AI Oct 14, 2025

Choose a reason for hiding this comment

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

Console.log statements should be removed or replaced with proper logging mechanism. These debug logs will appear in production code.

Copilot uses AI. Check for mistakes.
return {
name: 'Ledger',
adapter,
icon: undefined, // TODO: Add Ledger icon
Copy link

Copilot AI Oct 14, 2025

Choose a reason for hiding this comment

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

TODO comment indicates incomplete implementation. The icon should be implemented or the TODO should be tracked in an issue.

Copilot uses AI. Check for mistakes.
setDeviceStatus(state.deviceStatus);

// Extract current app name if available
const appName = (state as any)?.currentApp?.name;
Copy link

Copilot AI Oct 14, 2025

Choose a reason for hiding this comment

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

Using 'any' type defeats TypeScript's type safety. Define proper types for the state object or use more specific type assertion.

Suggested change
const appName = (state as any)?.currentApp?.name;
const appName = (typeof state === 'object' && state !== null && 'currentApp' in state && typeof (state as { currentApp?: { name?: string } }).currentApp?.name === 'string')
? (state as { currentApp: { name: string } }).currentApp.name
: undefined;

Copilot uses AI. Check for mistakes.
selectWallet(wallet);
}
}
}, [wallets]);
Copy link

Copilot AI Oct 14, 2025

Choose a reason for hiding this comment

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

The useEffect dependency array includes 'wallets' but the effect also depends on 'autoConnect', 'latestWalletNameRef.current', and 'adapterName'. Missing dependencies could cause stale closures.

Suggested change
}, [wallets]);
}, [wallets, autoConnect, adapterName, latestWalletNameRef]);

Copilot uses AI. Check for mistakes.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.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.

1 participant