Chore/tron remove advisory fee#77
Conversation
The `exact` and `upto` schemes advertised a facilitator fee via `getExtra`
and injected `extra.fee` into payment requirements, but the fee was never
signed and the on-chain Permit2 proxy only transferred `amount` (no split).
This dead "advisory" fee created confusion and an unused allowance cushion
without any actual fee payment.
Removed all fee plumbing from both schemes (client allowance, server
injection, facilitator advertisement, register config). The GasFree scheme
keeps its fee handling intact (signed + enforced via TIP-712). Cleaned up
the now-dead `validateFee` helper and its error constants in `shared/fee.ts`.
- exact/client/permit2.ts: ensureAllowance uses amount only
- exact/server/scheme.ts: drop buildFeeInfo injection
- exact/facilitator/{scheme,register}.ts: drop feeConfig param + getExtra ad
- upto/{client,server,facilitator}: mirror exact changes
- shared/fee.ts: remove validateFee + FEE_ constants, update docs
- tests: drop fee-plumbing.test.ts, trim validateFee tests, fix allowance test
- Collapse single-param constructors to one line (exact/upto facilitator) - Remove double blank line left by validateFee deletion in shared/fee.ts - Drop fee-plumbing.test.ts reference from README test list
- main README: add BSC testnet USDT, generalize USDC settle bullet to USDC/USDT,
rewrite mainnet section (drop EPS, fix stale 'commented-ready' framing), document
MCP examples in main line + env Loaded-by column, fix 'three lines' -> 'four lines'
- fetch/README + basic/README: fix stale signer signatures after the
(client, wallet) -> (wallet, options) refactor: createClientEvmSigner(wallet,
{ network, rpcUrl }), createClientTronSigner(wallet, { network, apiKey }),
createFacilitatorEvmSigner(wallet, { network, rpcUrl }),
createFacilitatorTronSigner(wallet, { network, apiKey })
# Conflicts: # examples/typescript/README.md # typescript/packages/mechanisms/tron/README.md # typescript/packages/mechanisms/tron/test/unit/fee-plumbing.test.ts
matrix-agent116
left a comment
There was a problem hiding this comment.
Summary
This PR removes the advisory-fee configuration and metadata from the TRON exact and upto schemes, so those schemes now transfer exactly the requested amount and no longer accept fee config through TronFacilitatorConfig or their facilitator constructors. I traced the removals through the source, tests, and the GasFree path — the change is clean, internally consistent, and the GasFree fee handling is correctly left untouched. The docs updates accurately match constants.ts. Looks mergeable; I have one minor consistency note below.
Improvement list
- (nit) Minor asymmetry between the two server schemes:
ExactTronScheme.enhancePaymentRequirementsbuildsrequirementsWithoutFeeand spreads it in the final return, whereasUptoTronScheme.enhancePaymentRequirementsspreads the rawpaymentRequirementsand only overridesextra. Both are functionally correct (thefeefield lives only underextra), but aligning them would make the intent clearer.
Otherwise this is good to go. Verified: the removed validateFee helper and its error constants are unused elsewhere in src; GasFree still relies on the retained resolveBaseFee/isTokenAllowed/readFeeFromExtra helpers; filterAffordableRequirements still calls readFeeFromExtra and simply becomes a no-op for exact/upto (fee absent) while remaining correct for GasFree.
| : undefined); | ||
|
|
||
| return Promise.resolve({ | ||
| ...paymentRequirements, |
There was a problem hiding this comment.
[nit] Minor consistency nit: the exact server scheme spreads requirementsWithoutFee here, but this upto path spreads the raw paymentRequirements and only overrides extra. It's functionally equivalent (the fee field lives only under extra), but mirroring the exact scheme's requirementsWithoutFee pattern would make the fee-stripping intent clearer and keep the two schemes symmetric.
Surface fee-stripping intent explicitly and keep the upto and exact server schemes symmetric. Functionally equivalent; behavior unchanged.
- balance.ts: scheme-aware affordability — exact/upto ignore stale extra.fee, only exact_gasfree adds the enforced relayer fee - selection.test.ts: update assertions for new fee semantics + add exact_gasfree affordability tests - README.md: fix signer example (ClientTronWallet/FacilitatorTronWallet, wallet+options API, both async), fix exact-only text, complete exports table with upto/gasfree/batch-settlement subpaths - examples README: remove stale EPS row (not registered as runnable token) - fee.ts: add GasFreeTronFeeConfig alias reflecting current semantics - test helpers/signer-wallet: replace stale AgentWallet references with ClientTronWallet (fixes broken JSDoc link)
Description
Tests
Checklist