-
Notifications
You must be signed in to change notification settings - Fork 516
txnbuild: Add txnbuild helper for sending a payment to a smart contract #5642
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
Conversation
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.
Pull Request Overview
This PR adds txnbuild helpers for sending a payment to a smart contract and for restoring an asset balance via a new restore footprint operation. It also updates fee handling and adjusts integration tests to use the new helper signatures while removing legacy fee parameters.
- Introduces NewAssetBalanceRestoration and NewPaymentToContract functions with configurable Soroban fee values.
- Updates integration tests to use the new Preflight functions without separate minFee values.
- Refactors code across txnbuild and integration tests to align with these helper changes.
Reviewed Changes
Copilot reviewed 22 out of 22 changed files in this pull request and generated no comments.
File | Description |
---|---|
txnbuild/restore_footprint.go | Adds a helper for constructing asset balance restoration operations. |
txnbuild/invoke_host_function.go | Adds a helper for constructing payment-to-contract operations with updated fee handling. |
Integration tests (various files) | Adjust test calls to use the new helper function signatures by removing extra fee parameters. |
Horizon integration tests | Update fee-bump and Preflight function calls to support the new txnbuild APIs. |
Comments suppressed due to low confidence (2)
services/horizon/internal/integration/integration.go:816
- Double-check that all callers of PreflightHostFunctions have been updated to handle the new signature returning a single value, as the removal of minFee could cause runtime issues if any outdated expectation remains.
return function
services/horizon/internal/integration/invokehostfunction_test.go:130
- [nitpick] Consider defining a named constant for 'HostFunctionTypeHostFunctionTypeUploadContractWasm' to improve code clarity and reduce potential typos in repeated usage.
assert.Equal(t, invokeHostFunctionOpJson.Function, "HostFunctionTypeHostFunctionTypeUploadContractWasm")
@sreuland can you take another look at the PR? |
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.
lgtm, nice work!
PR Checklist
PR Structure
otherwise).
services/friendbot
, orall
ordoc
if the changes are broad or impact manypackages.
Thoroughness
.md
files, etc... affected by this change). Take a look in the
docs
folder for a given service,like this one.
Release planning
CHANGELOG.md
within the component folder structure. For example, if I changed horizon, then I updated (services/horizon/CHANGELOG.md. I add a new line item describing the change and reference to this PR. If I don't update a CHANGELOG, I acknowledge this PR's change may not be mentioned in future release notes.semver, or if it's mainly a patch change. The PR is targeted at the next
release branch if it's not a patch change.
What
Close #5626
Update txnbuild to support constructing SAC payments to contracts with default fees so that simulateTransaction calls to rpc are not necessary.
Also fixes a bug in txnbuild where the max fee in the transaction envelope did not include the additional soroban resource fee.
Why
see #5626
Known limitations
[N/A]