Skip to content

chore(tron): type unvalidated API payloads in the Tron services - #624

Open
ulissesferreira wants to merge 1 commit into
mainfrom
chore/tron-lint-suppressions-service-source-any
Open

ulissesferreira wants to merge 1 commit into
mainfrom
chore/tron-lint-suppressions-service-source-any

Conversation

@ulissesferreira

Copy link
Copy Markdown
Contributor

Description

Removes the typescript/no-unsafe-* suppressions for the Tron services that consume unvalidated API and TronWeb payloads (73 violations across 6 files). Every fix is a typing change: any values are replaced by real types, or by unknown narrowed with hasProperty() own-property checks plus typeof guards, so no runtime behaviour changes. No any casts, @ts-expect-error, or lint suppressions were added.

Changes

  • packages/tron-wallet-snap/src/services/confirmation/ConfirmationHandler.ts — typed the deserializeTransaction result as TronwebTypes.Transaction['raw_data'] (validated by assertTransactionStructure right after) (no-unsafe-assignment, no-unsafe-argument)
  • packages/tron-wallet-snap/src/services/send/SendService.ts — typed the txJsonToPb protobuf handle as unknown; it is only passed back into TronWeb helpers (no-unsafe-assignment)
  • packages/tron-wallet-snap/src/services/transaction-expiration-refresher/TransactionExpirationRefresherService.ts — same txJsonToPb handle typing (no-unsafe-assignment)
  • packages/tron-wallet-snap/src/services/transactions/TransactionsMapper.ts — added readString/readNumber/readCallValues own-property readers for the Full Node caller_address/transferTo_address/callValueInfo/call_value/contract_address/frozen_balance_v2 fields and dropped the as any casts on those sites (no-unsafe-member-access, no-unsafe-assignment, no-unsafe-call, no-unsafe-argument, no-unsafe-return)
  • packages/tron-wallet-snap/src/services/transactions/TransactionsService.ts — narrowed call_value with hasProperty() + typeof instead of casting the contract value to any (no-unsafe-member-access)
  • packages/tron-wallet-snap/src/services/wallet/WalletService.ts — catch clauses now take unknown and read code/message through getErrorCode/getErrorMessage own-property readers, dropped the (signedTx as any).signature cast (TronWeb types signature: string[]), typed the deserialized transaction, and removed the redundant params as any after validateRequest already narrowed it (no-unsafe-assignment, no-unsafe-member-access, no-unsafe-call, no-unsafe-argument)
  • oxlint-suppressions.json — regenerated with --prune-suppressions

Quality gates

  • yarn lint:oxlint packages/tron-wallet-snap — clean, 6 suppressions entries (73 violations) removed
  • tsc --noEmit — clean
  • vitest run — 63 files / 1052 tests pass
  • oxfmt --check — clean

@ulissesferreira
ulissesferreira force-pushed the chore/tron-lint-suppressions-service-source-any branch from 26dd990 to 9ddefdc Compare November 18, 2026 09:41
@sonarqubecloud

Copy link
Copy Markdown

This branch was previously deployed

1 inactive (outdated) deployment
default-branch — 26dd990b Deployed Nov 17, 2026 by ulissesferreira via Determine whether this PR is a release PR #2388
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant