#Transaction keeps failing from JS soroban client until the contract is called via CLI

9 messages · Page 1 of 1 (latest)

thick socket
#

I've got an issue that I'm having trouble figuring out. I have this smart contract with a function that transfers funds from the sender to the contract, and writes some data into persistent storage. Nothing too complicated. When I call this function for the first time after a while of inactivity, the sendTransaction call succeeds, but the result from getTransaction using the hash from sendTransaction will return a failed transaction.

However, when I copy/paste the parameters and make the exact same call on the CLI, it works. And after that, all subsequent calls to the same function using the JS client will work even if they didn't work before. Has anyone run into this issue before?

stray violet
thick socket
#

Still working on a consistent way to reproduce the error, but so far it seems that the issue is not caused by my contract, but rather the SAC. Trying to call an SAC via the JS Soroban client results in a transaction with status FAILED, but calling the SAC using the CLI works for some reason. I'll make a new thread to focus on that issue more clearly.

viral garden
#

if transaction works from CLI, but not from JS client, there is a very high chance that your JS client logic is incorrect

#

i.e. the contract is clearly there and functional if you can interact with it from CLI

soft wadi
#

Sounds like an expiration issue. The CLI will restore expired entries for you if any are expired in the preflight. This would explain why it worked for your JS code after running the CLI

tacit path
#

@soft wadi can you share some code snippets in JS how you restore the expired entries? Is there any doc available that can help me understand what are entries from a client/JS prospective?

soft wadi
#

@golden lily Is that still valid^