Join the discussion on Telegram
Why this matters
backend/src/services/sorobanService.ts line 36:
return StrKey.encodeContract(Buffer.from(addr.contractId() as any));
And the identical pattern in backend/src/workers/soroban-event-worker.ts line 55. The as any cast hides a real type mismatch between the SDK's Hash opaque and Node's Buffer. The SDK exposes proper helpers — StrKey.encodeContract accepts the hash buffer directly in recent SDK versions, or the buffer can be obtained without any via Buffer.from(hash.value as Uint8Array) or hash.value as Uint8Array.
Acceptance criteria
Files to touch
backend/src/services/sorobanService.ts (line 36)
backend/src/workers/soroban-event-worker.ts (line 55)
Out of scope
- Replacing the manual decoders with the SDK's higher-level
scValToNative
Join the discussion on Telegram
Why this matters
backend/src/services/sorobanService.tsline 36:And the identical pattern in
backend/src/workers/soroban-event-worker.tsline 55. Theas anycast hides a real type mismatch between the SDK'sHashopaque and Node'sBuffer. The SDK exposes proper helpers —StrKey.encodeContractaccepts the hash buffer directly in recent SDK versions, or the buffer can be obtained withoutanyviaBuffer.from(hash.value as Uint8Array)orhash.value as Uint8Array.Acceptance criteria
as anyin both files and use the correct typed source for the contract hash bytesC...address (the existing decode test should cover this)Files to touch
backend/src/services/sorobanService.ts(line 36)backend/src/workers/soroban-event-worker.ts(line 55)Out of scope
scValToNative