Description
readContractState (src/contract/read.ts) builds a real invocation operation (const _operation = contract.call(method, ...(args as any[]))) but then never uses it — the variable is prefixed _operation and immediately discarded (flagged by tsc --noEmit as TS6133: '_operation' is declared but its value is never read). Instead, the function calls server.simulateTransaction({ toEnvelope: () => ({ toXDR: () => '' }) as any } as any) — i.e. it simulates a hand-faked "envelope" whose XDR is always the empty string, completely unrelated to method/args. In its current form, calling readContractState(client, 'get_escrow', [escrowId]) for any method or arguments performs the exact same meaningless simulation every time and cannot possibly return real contract state.
Component
SDK
Difficulty
🔴 Hard
Tasks
Acceptance Criteria
Estimated Time
2-3 days
Description
readContractState(src/contract/read.ts) builds a real invocation operation (const _operation = contract.call(method, ...(args as any[]))) but then never uses it — the variable is prefixed_operationand immediately discarded (flagged bytsc --noEmitasTS6133: '_operation' is declared but its value is never read). Instead, the function callsserver.simulateTransaction({ toEnvelope: () => ({ toXDR: () => '' }) as any } as any)— i.e. it simulates a hand-faked "envelope" whose XDR is always the empty string, completely unrelated tomethod/args. In its current form, callingreadContractState(client, 'get_escrow', [escrowId])for any method or arguments performs the exact same meaningless simulation every time and cannot possibly return real contract state.Component
SDK
Difficulty
🔴 Hard
Tasks
operation(source account fromserver.getAccount, sequence number, network passphrase fromclient.getNetworkPassphrase()) instead of the empty-XDR stubsimulateTransactionmethod/argsAcceptance Criteria
readContractStatesimulates the actual requested contract call, not a hardcoded empty envelopeEstimated Time
2-3 days