Expose limit on Stellar OperationChangeTrust in Android/Kotlin bindings (needed to delete/update trustlines)
Is your feature request related to a problem? Please describe. On Android (using wallet-core-kotlin-android), the generated Java/Kotlin bindings for Stellar do not expose a setLimit(...) (or equivalent) on Stellar.OperationChangeTrust.Builder. Because of this, we cannot reduce or delete a trustline (i.e., set limit = 0) using Wallet Core on Android, even though Stellar requires the limit field for update/delete. This prevents us from programmatically removing trustlines or tightening limits from an Android app. The same request works in other official Stellar tooling/SDKs. (Refs: Horizon/CLI/SDK docs and XDR spec.) Stellar Docs +1 stellar.github.io stellar-sdk.readthedocs.io Go Packages
Describe the solution you'd like Expose the limit field on the Android/Kotlin binding of OperationChangeTrust, e.g.:
val op = Stellar.OperationChangeTrust.newBuilder()
.setAsset(asset)
.setLimit(0L) // delete trustline
.build()
Under the hood this maps to ChangeTrustOp.limit (XDR int64, 7-decimals scaled like other amounts). Parity with Swift/C++ bindings would be ideal.
Describe alternatives you've considered Building the raw XDR manually on Android and signing it ourselves (fragile and increases maintenance risk). Using a different Stellar SDK just to construct the XDR with limit=0, then signing separately (adds an extra dependency and complicates the pipeline).
Performing the operation on iOS/desktop where bindings expose limit, then relaying the signed XDR to Android (not great for Android-only apps).
Checklist
- [ ] Add limit to Android/Kotlin OperationChangeTrust builder API
- [ ] Map to XDR ChangeTrustOp.limit (int64)
- [ ] Unit tests: create, update, and delete (limit=0) trustline cases
- [ ] Ensure parity with Swift and C++ bindings
- [ ] Update docs/samples to show deleting a trustline via setLimit(0)
Resources
-
Stellar Horizon “Change Trust” (attributes include limit) – developers.stellar.org. Stellar Docs
-
Stellar CLI: stellar tx new change-trust (--limit flag; 0 removes trustline). Stellar Docs
-
JS SDK Operation.changeTrust (limit; 0 deletes) & docs page. stellar.github
-
Python SDK ChangeTrust (limit; 0 deletes). stellar-sdk
-
XDR spec (Go bindings): ChangeTrustOp { Line; Limit Int64 }. Go Packages
Additional context Environment: Android, wallet-core-kotlin-android (latest), Kotlin 1.9.x, AGP 8.x. Current code compiles but there is no .setLimit(...) on Stellar.OperationChangeTrust.Builder, so we can only create a trustline at max limit but cannot reduce or delete it. Exposing limit would restore feature parity with Stellar’s official toolchain and enable apps to fully manage trustlines on Android.
This is also needed for iOS also.
Hi @RaduPaun, @luciansvnc, unfortunately, we don't have resources to work on the feature request. If you have time, please feel free to open a PR with the necessary changes. Please let me know if you need any advices, like where to find the implementation, how to test etc