Skip to content

feat(contracts): add scValI128 and scValU64 helpers for Soroban numeric encoding - #214

Open
Jerry-Tekh wants to merge 3 commits into
StellarState:devfrom
Jerry-Tekh:dev
Open

feat(contracts): add scValI128 and scValU64 helpers for Soroban numeric encoding#214
Jerry-Tekh wants to merge 3 commits into
StellarState:devfrom
Jerry-Tekh:dev

Conversation

@Jerry-Tekh

@Jerry-Tekh Jerry-Tekh commented Aug 25, 2026

Copy link
Copy Markdown

Summary

Adds centralized helpers for encoding Soroban ScVal Symbol and Address values, plus comprehensive unit tests for verify-payment.service transaction build & error handling.

Changes

  • src/services/stellar/utils/scval.utils.ts: Added scValSymbol(value) and scValAddress(address) helpers
  • tests/unit/utils/scval.utils.test.ts: Added unit tests for ScVal helpers
  • tests/unit/services/stellar/verify-payment.service.test.ts: Added 15+ test cases covering verifyPaymentTransaction()

Test Coverage

  • Mock Horizon.Server.transactions() responses for success and error codes
  • Payment amount delta comparison logic (within and outside allowed delta)
  • Retry behavior on 503 and network socket timeout
  • Transaction state transitions and conflict detection
  • Operation index disambiguation

Closes #145
Closes #152
Closes #153

…ic encoding

Implements helper functions for encoding Soroban ScVal i128 and u64
numeric values:
- scValI128(amount): encodes bigint or string to i128 ScVal
- scValU64(val): encodes number to u64 ScVal

Includes unit tests verifying boundary values (0, max u64, large i128
stroop values).

Closes StellarState#153
@drips-wave

drips-wave Bot commented Aug 25, 2026

Copy link
Copy Markdown

@Jerry-Tekh Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

… ScVal encoding

Adds centralized helpers for encoding Soroban ScVal Symbol and Address values:
- scValSymbol(value): encodes string to symbol ScVal
- scValAddress(address): encodes Stellar address to ScVal

Includes unit tests verifying ScVal serialization and deserialization.

Closes StellarState#152
…rror handling

Adds comprehensive unit tests covering verifyPaymentTransaction():
- Mock Horizon.Server.transactions() responses for success and error codes
- Payment amount delta comparison logic (within and outside allowed delta)
- Retry behavior on 503 and network socket timeout
- Transaction state transitions and conflict detection
- Operation index disambiguation

Closes StellarState#145
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant