feat(sdk): add admin and query SDK methods for token, fee, and oracle config - #587
Merged
Levi-Ojukwu merged 5 commits intoJul 26, 2026
Conversation
Wraps the payer_score view function so consumers can read a payer's reputation score without hand-building a Soroban simulation call. Closes Invoice-Liquidity-Network#513
Wraps the add_token and remove_token admin functions so multi-token support can be managed through the SDK instead of raw contract calls. Closes Invoice-Liquidity-Network#514
Wraps the update_fee_rate and update_max_discount admin functions so protocol economics can be configured through the SDK instead of raw contract calls. Closes Invoice-Liquidity-Network#515
Wraps the set_price_oracle and set_max_oracle_age admin functions so oracle configuration can be managed through the SDK instead of raw contract calls. Closes Invoice-Liquidity-Network#516
|
@thegreatfeez Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds the missing SDK wrappers for seven contract functions that already exist on
invoice_liquiditybut weren't exposed through@iln/sdk:getPayerScore(payer)— read-only wrapper for thepayer_scoreview functionaddToken(token, decimals)/removeToken(token)— admin wrappers for multi-token supportupdateFeeRate(rate)/updateMaxDiscount(rate)— admin wrappers for fee/discount configurationsetPriceOracle(oracle)/setMaxOracleAge(maxAgeLedgers)— admin wrappers for oracle configurationPackage Affected
Related Issue
Closes #513
Closes #514
Closes #515
Closes #516
Complexity
Changes Made
sdk/src/methods/queries.ts: addedgetPayerScore, wrapping thepayer_scoreview function (read-only simulation, no signer required)sdk/src/methods/admin.ts: addedaddToken,removeToken,updateFeeRate,updateMaxDiscount,setPriceOracle,setMaxOracleAge, following the existingsetDistributionContractpattern (simulate → assemble → sign → send → poll)sdk/src/index.ts: exported all seven new functions from the SDK's public surfacesdk/tests/queries.test.ts,addToken.test.ts,removeToken.test.ts,updateFeeRate.test.ts,updateMaxDiscount.test.ts,setPriceOracle.test.ts,setMaxOracleAge.test.ts)Changeset Included
No
.changeset/tooling is currently wired up in this repo (no.changeset/config.json, nosdk/CHANGELOG.md), so no changeset file was added.Test Evidence
Test output
Note on the full
pnpm testrun: the full SDK suite has pre-existing failures unrelated to this change —src/methods/getTokenDecimals.test.ts,src/methods/governance.test.ts,src/methods/nft.test.ts, andsdk/tests/setDistributionContract.test.ts. These fail identically onmain(confirmed by running them againstmaindirectly before this branch existed) due to a@stellar/stellar-sdkversion mismatch between what those tests' mocking approach assumes and what's actually installed (e.g.vi.spyOn(SorobanRpc, "assembleTransaction")fails withCannot redefine propertybecause that property is a non-configurable getter in the installed SDK version). None of the new tests in this PR use that broken pattern — they use the workingvi.mock("@stellar/stellar-sdk", ...)approach already established inadminControls.test.ts.Rust side: no contract code was touched.
cargo fmt --all -- --checkcurrently fails onmainitself (42 pre-existing diffs in files unrelated to this PR, e.g.contracts/fuzz/src/lib.rs,contracts/iln_distribution/src/lib.rs), and GitHub'sci.ymlworkflow run on the currentmainHEAD is already red for the same reason — confirmed viagh run list. This PR doesn't change that state either way.Breaking Change
Security Considerations
N/A — these are thin wrappers around existing, already-audited contract entrypoints (
payer_score,add_token,remove_token,update_fee_rate,update_max_discount,set_price_oracle,set_max_oracle_age). No new contract logic, no new attack surface. Address inputs that map to Soroban contract IDs (token,oracle) are validated with the existingvalidateContractIdhelper before being submitted, consistent withsetDistributionContract.Checklist