Skip to content

feat(vara-eth-api): validating injected tx promise, rename Injected -> InjectedTx#2281

Merged
osipov-mit merged 6 commits intomainfrom
do-injected-tx-promise
Jan 20, 2026
Merged

feat(vara-eth-api): validating injected tx promise, rename Injected -> InjectedTx#2281
osipov-mit merged 6 commits intomainfrom
do-injected-tx-promise

Conversation

@osipov-mit
Copy link
Member

@osipov-mit osipov-mit commented Jan 6, 2026

resolves #2255

Added

  • InjectedTxPromise class for handling promise replies from injected transactions and validating promise signature

Changed

  • Renamed Injected class to InjectedTx (with backward-compatible alias)
  • Refactored injected transaction code into separate modules (tx.ts and promise.ts)
  • Updated IInjectedTransactionPromise interface: flattened reply structure, changed value from number to bigint, changed code to Hex

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 refactors the injected transaction handling in the vara-eth API by renaming the Injected class to InjectedTx (maintaining backward compatibility) and introducing promise validation functionality. The key improvement is the addition of signature validation for transaction promises returned by validators.

  • Introduced InjectedTxPromise class with signature validation capability
  • Refactored injected transaction code into separate modules (tx.ts and promise.ts)
  • Updated the IInjectedTransactionPromise interface with a flattened structure and proper types

Reviewed changes

Copilot reviewed 13 out of 14 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
apis/vara-eth/test/injected.test.ts Added tests for promise hash generation, signature validation, and account recovery
apis/vara-eth/src/types/api/injected.ts Flattened reply structure and changed value type from number to bigint, code to Hex
apis/vara-eth/src/eth/router.ts Changed validators return type from readonly Hex[] to Address[] for type safety
apis/vara-eth/src/api/injected/tx.ts Refactored to use new InjectedTxPromise class and updated RPC method names
apis/vara-eth/src/api/injected/promise.ts New class implementing promise validation with hash computation and signature verification
apis/vara-eth/src/api/injected/index.ts Added backward-compatible exports with deprecation markers
apis/vara-eth/src/api/index.ts Updated exports to include new classes
apis/vara-eth/src/api/api.ts Updated to use renamed InjectedTx class
apis/vara-eth/programs/injected/src/main.rs Added promise generation logic for testing signature validation
apis/vara-eth/programs/injected/Cargo.toml Added required dependencies for promise testing
apis/vara-eth/README.md Updated documentation with promise validation example and deprecation notice
apis/vara-eth/Cargo.toml Added workspace dependencies for gear-core libraries
apis/vara-eth/Cargo.lock Updated dependency versions
apis/vara-eth/CHANGELOG.md Documented new features and breaking changes

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@osipov-mit osipov-mit merged commit 5a7a067 into main Jan 20, 2026
14 checks passed
@osipov-mit osipov-mit deleted the do-injected-tx-promise branch January 20, 2026 13:26
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.

Validate promise

2 participants