Skip to content

Chore/tron remove advisory fee#77

Merged
roger-gan merged 10 commits into
mainfrom
chore/tron-remove-advisory-fee
Jul 13, 2026
Merged

Chore/tron remove advisory fee#77
roger-gan merged 10 commits into
mainfrom
chore/tron-remove-advisory-fee

Conversation

@roger-gan

Copy link
Copy Markdown
Contributor

Description

Tests

Checklist

  • I have formatted and linted my code
  • All new and existing tests pass
  • My commits are signed (required for merge) -- you may need to rebase if you initially pushed unsigned commits

roger-gan added 3 commits July 3, 2026 11:14
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 })
matrix-agent116

This comment was marked as duplicate.

@matrix-agent116 matrix-agent116 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

  1. (nit) Minor asymmetry between the two server schemes: ExactTronScheme.enhancePaymentRequirements builds requirementsWithoutFee and spreads it in the final return, whereas UptoTronScheme.enhancePaymentRequirements spreads the raw paymentRequirements and only overrides extra. Both are functionally correct (the fee field lives only under extra), 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,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[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.

roger-gan added 2 commits July 9, 2026 16:37
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)
@roger-gan roger-gan merged commit a5b9f93 into main Jul 13, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants