Conversation
feat: enhance restricted address handling in App.vue and index.vue
devop: prep release 2.15
|
💼 Build Files |
WalkthroughThis PR removes three networks (Shiden, ShidenEVM, Bitrock) from the system, including their enum entries, module definitions, and all associated mappings across activity handlers, asset handlers, and hardware wallet configs. Additionally, it enhances wallet restriction checks across multiple UI components and updates development dependencies. Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes
Possibly related PRs
Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
packages/extension/src/libs/json-tree-view/JsonTreeViewItem.vue (1)
95-104: ThegetValueColorfunction uses an invalid switch-ts API method.Line 103 calls
.otherwise(), but the switch-ts library (latest version 1.1.1 on npm) only provides.default()as the fallback method. This will cause a runtime error: "otherwise is not a function". Replace.otherwise()with.default().packages/extension/src/providers/ethereum/ui/send-transaction/index.vue (1)
303-306: Missing initial restriction check on mount.The
isRestrictedstate is only updated whenselectAccountFromis called, but not on initial mount. If the initially selected account is restricted, the user could attempt to send until they switch accounts.Consider adding a restriction check in
onMounted:🔎 Proposed fix
onMounted(async () => { trackSendEvents(SendEventType.SendOpen, { network: props.network.name }); fetchAssets().then(setBaseCosts); + isWalletRestricted(addressFrom.value).then(res => (isRestricted.value = res)); });
🧹 Nitpick comments (2)
packages/extension/src/providers/ethereum/ui/send-transaction/index.vue (1)
715-720: Consider handling the async restriction check more robustly.The restriction check is fire-and-forget, which is fine for non-blocking UI, but the
fetchAssets()call on line 718 runs in parallel. If the user acts quickly before the restriction check completes, they could proceed with a restricted account.Consider awaiting the restriction check or at least ensuring the UI reflects a loading state until both operations complete.
packages/extension/src/ui/action/views/restricted/index.vue (1)
100-116: Props and emit definitions are correct.The new
isAddressRestrictedandrestrictedAddressprops, along with therestricted:switchAccountemit, properly extend the component's API.Minor note: For primitive defaults, you can simplify to
default: falseanddefault: ''instead of factory functions, but the current approach is also valid.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
yarn.lockis excluded by!**/yarn.lock,!**/*.lock
📒 Files selected for processing (37)
package.json(1 hunks)packages/extension-bridge/package.json(1 hunks)packages/extension/env.d.ts(1 hunks)packages/extension/package.json(7 hunks)packages/extension/src/libs/dapp-list/index.ts(0 hunks)packages/extension/src/libs/json-tree-view/JsonTreeViewItem.vue(1 hunks)packages/extension/src/providers/ethereum/libs/activity-handlers/providers/etherscan/configs.ts(0 hunks)packages/extension/src/providers/ethereum/libs/assets-handlers/assetinfo-mew.ts(0 hunks)packages/extension/src/providers/ethereum/libs/assets-handlers/token-lists.ts(0 hunks)packages/extension/src/providers/ethereum/libs/assets-handlers/types/tokenbalance-mew.ts(0 hunks)packages/extension/src/providers/ethereum/networks/bitrock.ts(0 hunks)packages/extension/src/providers/ethereum/networks/index.ts(0 hunks)packages/extension/src/providers/ethereum/networks/sdn.ts(0 hunks)packages/extension/src/providers/ethereum/networks/skale/skale-base.ts(2 hunks)packages/extension/src/providers/ethereum/ui/eth-connect-dapp.vue(5 hunks)packages/extension/src/providers/ethereum/ui/send-transaction/index.vue(5 hunks)packages/extension/src/providers/polkadot/libs/activity-handlers/providers/subscan/configs.ts(0 hunks)packages/extension/src/providers/polkadot/networks/astar/shiden.ts(0 hunks)packages/extension/src/providers/polkadot/networks/index.ts(0 hunks)packages/extension/src/ui/action/App.vue(6 hunks)packages/extension/src/ui/action/views/restricted/index.vue(3 hunks)packages/hw-wallets/package.json(2 hunks)packages/hw-wallets/src/ledger/ethereum/configs.ts(0 hunks)packages/hw-wallets/src/trezor/ethereum/configs.ts(0 hunks)packages/keyring/package.json(1 hunks)packages/name-resolution/package.json(1 hunks)packages/request/package.json(1 hunks)packages/signers/bitcoin/package.json(1 hunks)packages/signers/ethereum/package.json(1 hunks)packages/signers/kadena/package.json(1 hunks)packages/signers/massa/package.json(1 hunks)packages/signers/polkadot/package.json(1 hunks)packages/storage/package.json(1 hunks)packages/swap/package.json(1 hunks)packages/types/package.json(1 hunks)packages/types/src/networks.ts(0 hunks)packages/utils/package.json(1 hunks)
💤 Files with no reviewable changes (14)
- packages/hw-wallets/src/ledger/ethereum/configs.ts
- packages/hw-wallets/src/trezor/ethereum/configs.ts
- packages/extension/src/providers/polkadot/networks/index.ts
- packages/extension/src/providers/polkadot/libs/activity-handlers/providers/subscan/configs.ts
- packages/extension/src/providers/ethereum/libs/assets-handlers/types/tokenbalance-mew.ts
- packages/extension/src/providers/ethereum/libs/activity-handlers/providers/etherscan/configs.ts
- packages/extension/src/providers/ethereum/libs/assets-handlers/token-lists.ts
- packages/extension/src/providers/ethereum/networks/sdn.ts
- packages/extension/src/providers/ethereum/networks/bitrock.ts
- packages/extension/src/providers/ethereum/libs/assets-handlers/assetinfo-mew.ts
- packages/extension/src/libs/dapp-list/index.ts
- packages/extension/src/providers/ethereum/networks/index.ts
- packages/extension/src/providers/polkadot/networks/astar/shiden.ts
- packages/types/src/networks.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: buildAll
🔇 Additional comments (35)
packages/extension/src/providers/ethereum/networks/skale/skale-base.ts (1)
233-235: Add missing SkaleExorde endpoint or remove network entirely.The defensive fallback pattern at lines 233-235 is appropriate and prevents runtime errors. However, verification found that SkaleExorde network exists in the codebase but is missing from the
NetworkEndpointsconfiguration, causing it to silently use an empty activity handler. Either add the SkaleExorde endpoint to the Etherscan configs, or remove the network files if it's being deprecated.package.json (1)
35-37: LGTM! DevDependency updates applied.The commitlint and SWC tooling updates look appropriate for maintaining the development environment.
packages/swap/package.json (1)
44-46: LGTM! DevDependency updates applied.The TypeScript tooling, prettier, and vitest version bumps are consistent with the broader monorepo maintenance.
Also applies to: 53-53, 58-59
packages/signers/massa/package.json (1)
35-35: LGTM! DevDependency updates applied.The development tooling updates including Polkadot utilities, TypeScript tooling, prettier, and vitest are appropriate.
Also applies to: 37-37, 39-40, 47-47, 52-53
packages/extension-bridge/package.json (1)
47-47: LGTM! DevDependency updates applied.The development tooling updates are consistent with the broader monorepo maintenance efforts.
Also applies to: 49-51, 58-58, 62-62, 64-64
packages/name-resolution/package.json (1)
25-27: LGTM! DevDependency updates applied.The development tooling updates including viem for testing are appropriate.
Also applies to: 34-34, 39-41
packages/request/package.json (1)
34-36: LGTM! DevDependency updates applied.The development tooling updates are consistent with the monorepo-wide maintenance.
Also applies to: 43-43, 48-49
packages/hw-wallets/package.json (2)
25-27: LGTM! DevDependency updates applied.The development tooling updates are consistent with other packages in the monorepo.
Also applies to: 34-34, 39-40
55-56: Runtime dependencies for Ledger hardware wallet libraries are secure with no known vulnerabilities.@ledgerhq/hw-app-btc (^10.13.0) was scanned for known vulnerabilities and no issues were found, and @ledgerhq/hw-app-eth (^6.47.1) has 0 vulnerabilities or license issues detected. Both packages are from the official LedgerHQ repositories. @zondax/ledger-substrate is maintained by a reputable blockchain security company and undergoes rigorous security testing. No compatibility issues between these packages and existing Ledger/Polkadot infrastructure are documented.
packages/signers/bitcoin/package.json (1)
35-37: LGTM! DevDependency updates applied.The development tooling updates are consistent with the broader monorepo maintenance.
Also applies to: 44-44, 49-50
packages/signers/ethereum/package.json (1)
35-37: LGTM! Development tooling updates.The devDependency updates are appropriate and include minor version bumps for TypeScript ESLint tooling, Prettier, Vitest, and Node type definitions. These changes improve tooling without affecting runtime behavior.
Also applies to: 44-44, 49-50
packages/utils/package.json (2)
33-35: LGTM! Development tooling updates.The devDependency updates include minor version bumps for TypeScript ESLint tooling, Prettier, Vitest, and Node type definitions. These are low-risk tooling improvements.
Also applies to: 42-42, 48-49
27-27: @polkadot/util-crypto version 14.0.1 is already integrated and in use.The codebase is already using version 14.0.1 (confirmed in yarn.lock at multiple dependency paths). The functions currently in use—
encodeAddress,blake2AsU8a,mnemonicToMiniSecret,base64Encode, andbase64Decode—are core functions unaffected by the breaking changes (which involved removal of deprecated function signatures). The package.json update reflects the version already deployed and tested.packages/storage/package.json (1)
30-32: LGTM! Development tooling updates.The devDependency updates are appropriate and consist of minor version bumps for TypeScript ESLint tooling, Prettier, Vitest, and Node type definitions. No runtime impact.
Also applies to: 39-39, 44-45
packages/signers/kadena/package.json (1)
31-31: LGTM! Development tooling updates.The devDependency updates include a major version bump for
@polkadot/util-crypto(13.x → 14.x) and minor version bumps for TypeScript ESLint tooling, Prettier, Vitest, and Node type definitions. Since@polkadot/util-cryptois only a devDependency in this package, the major version bump poses minimal risk to runtime behavior.Also applies to: 33-35, 42-42, 47-48
packages/types/package.json (1)
28-30: LGTM! Development tooling updates.The devDependency updates include minor version bumps for TypeScript ESLint tooling, Prettier, and Node type definitions. These are low-risk improvements to development tooling.
Also applies to: 37-37, 42-42
packages/extension/package.json (4)
3-3: LGTM! Version bump aligns with release.The version bump from
2.14.0to2.15.0is consistent with the PR title "Release v2.15".
26-26: LGTM! Dependency updates for runtime and development tooling.The remaining dependency updates include minor and patch version bumps for various packages including Amplitude analytics, Vue ecosystem packages, and development tooling. These updates are generally low-risk improvements.
Also applies to: 82-82, 93-93, 103-103, 108-109, 120-120, 123-123, 125-125, 129-129, 134-135, 138-138, 141-142
47-55: Verify actual @polkadot/keyring version before reviewing breaking changes concern.The review comment incorrectly references
@polkadot/keyring@^14.0.1, but the latest available version is 13.5.3. Verify the actual package.json to identify the real versions in use. While concern about breaking changes is valid in principle, the specific version cited does not exist, invalidating the review's premise. Once actual versions are confirmed, consult the official CHANGELOG to assess impact on wallet functionality and transaction signing.
79-79: Remove or correct the switch-ts dependency version.The specified version
^2.0.0does not exist on npm. The latest available version is 1.1.1. Additionally, switch-ts is not used anywhere in the codebase. Either remove this unused dependency or update it to a valid version like^1.1.1if it's intentionally needed.Likely an incorrect or invalid review comment.
packages/signers/polkadot/package.json (2)
34-36: LGTM! Development tooling updates.The devDependency updates include minor version bumps for TypeScript ESLint tooling, Prettier, Vitest, and Node type definitions. These are low-risk tooling improvements.
Also applies to: 43-43, 48-49
25-25: Verify @polkadot/util and @polkadot/util-crypto upgrade to v14.0.1.The runtime dependencies have been updated to @polkadot/util ^14.0.1 and @polkadot/util-crypto ^14.0.1, representing major version bumps from 13.x. @polkadot/util-crypto v14.0.1 was published 3 days ago. The codebase uses
mnemonicToMiniSecretfrom @polkadot/util-crypto. While these are major version changes that could introduce breaking changes, detailed breaking change information for v14.0.0 is not currently available. Test the Polkadot signer functionality with the new versions to ensure compatibility.packages/keyring/package.json (2)
37-53: Dev dependency updates look reasonable.Standard maintenance updates for TypeScript tooling, Prettier, and Vitest. These are minor/patch version bumps.
33-33: No action needed. The codebase is already using @polkadot/util v14.0.1 across multiple packages (keyring, extension, hw-wallets, signers/polkadot), and no breaking changes were identified for this version. The byte utilities used in testing (u8aWrapBytes, u8aToHex, stringToU8a) remain compatible with v14.packages/extension/src/providers/ethereum/ui/send-transaction/index.vue (2)
440-443: Error message and validation logic for restricted addresses is correct.The error message is clear and the early return ensures it takes precedence over other validation errors.
584-590: Validation correctly blocks sending from restricted addresses.The
isValidSendcomputed property properly returnsfalsewhen the address is restricted.packages/extension/src/ui/action/views/restricted/index.vue (2)
5-14: Conditional UI for IP vs. address restriction is well implemented.The mutually exclusive
v-ifconditions properly display different messages based on the restriction type.
30-39: Switch Address functionality for restricted addresses looks good.The "Switch Address" option is correctly shown only for address restrictions (not IP restrictions), allowing users to switch to an unrestricted account.
packages/extension/src/providers/ethereum/ui/eth-connect-dapp.vue (4)
36-52: Conditional UI for restricted wallet addresses is well implemented.The UI correctly shows different information messages based on the restriction status, with clear contact information for users who believe they've been incorrectly flagged.
68-68: Connect button correctly disabled for restricted wallets.The
:disabled="isRestricted"binding properly prevents users from connecting with a restricted address.
134-136: Initial restriction check on mount is correct.The async check runs after setting up the display address and identicon, which is appropriate.
177-184: Restriction check on address change is correctly placed.The check runs when the selected address changes, updating the UI accordingly. Note that
identicon.valueis set after the async restriction check starts, which is fine since they're independent.packages/extension/src/ui/action/App.vue (3)
172-175: Good use of typed reactive state for address restriction.The explicit typing
{ isRestricted: boolean; address: string }improves code clarity and type safety.
439-453: checkAddress implementation is correct.The function properly resets the restriction state before checking, preventing stale state issues. The async pattern with await ensures the state is updated before proceeding.
461-491: Address change flow correctly gates operations on restriction status.The
await checkAddress(newAccount)ensures restriction is checked before proceeding with domain state updates and messaging. This prevents restricted accounts from being registered with dapps.
Summary by CodeRabbit
New Features
Removed Features
✏️ Tip: You can customize this high-level summary in your review settings.