-
Notifications
You must be signed in to change notification settings - Fork 314
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
set timeout after simulation and before sign #951
Conversation
Currently marked as draft because TransactionBuilder throws an exception when you try to simulate the transaction without time bounds set:
Also you can't set the timeout after the max time is already set so cloning the transaction and then calling
You get the same error if you use I've tried working around it by doing this: const timeoutInSeconds =
this.assembled.options.timeoutInSeconds ?? DEFAULT_TIMEOUT;
const timeoutTimestamp =
Math.floor(Date.now() / 1000) + timeoutInSeconds + 1;
this.assembled.built = TransactionBuilder.cloneFrom(this.assembled.built!, {
fee: this.assembled.built!.fee,
timebounds: {
minTime: 0,
maxTime: timeoutTimestamp,
},
}).build(); But this gets me a |
@chadoh @BlaineHeffron you probably need to inject the const timeoutInSeconds = this.assembled.options.timeoutInSeconds ?? DEFAULT_TIMEOUT;
this.assembled.built = TransactionBuilder.cloneFrom(this.assembled.built!)
.setTimeout(timeoutInSeconds)
.setSorobanData(new SorobanDataBuilder(this.assembled.built!.[dig and get the data structure out]).build())
.build(); |
…ons` said to (stellar#952) This also formats the file using our eslint config.
…fron/js-stellar-sdk into timeout-before-signing
With the following changes all e2e tests are passing.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Looks good. Feel free to use my syntax or keep yours.
cleaner way to pass sorobanData Co-authored-by: Chad Ostrowski <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
coupla minor comments ⬇️ also can you add a changelog entry?
…fron/js-stellar-sdk into timeout-before-signing
cleaner way to pass sorobanData Co-authored-by: Chad Ostrowski <[email protected]>
…fron/js-stellar-sdk into timeout-before-signing
rebased and added CL entry |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work!!
Timeout for a transaction is now set to start after the simulation returns and before it is signed and sent. This makes sure its more in line with the time used in the retry logic. We also increased the default value to 60 from 10 seconds so that people using freighter have time to review and sign the transaction.
This gives enough time to avoid the txTooLate error in #950