Breakout and test NativePasswordRequired logic#68
Merged
bootsboogie merged 19 commits intodevelopfrom Sep 9, 2021
Merged
Conversation
0xdef1cafe
requested changes
Sep 8, 2021
src/context/WalletProvider/NativeWallet/NativePasswordRequired/NativePasswordRequired.tsx
Outdated
Show resolved
Hide resolved
src/context/WalletProvider/NativeWallet/NativePasswordRequired/NativePasswordRequired.tsx
Outdated
Show resolved
Hide resolved
src/context/WalletProvider/NativeWallet/NativePasswordRequired/NativePasswordRequired.tsx
Outdated
Show resolved
Hide resolved
0xdef1cafe
approved these changes
Sep 8, 2021
cjthompson
reviewed
Sep 8, 2021
...PasswordRequired/hooks/useInitializeWalletFromStorage/useInitializeWalletFromStorage.test.ts
Outdated
Show resolved
Hide resolved
cjthompson
reviewed
Sep 8, 2021
...PasswordRequired/hooks/useInitializeWalletFromStorage/useInitializeWalletFromStorage.test.ts
Outdated
Show resolved
Hide resolved
cjthompson
reviewed
Sep 8, 2021
...ativePasswordRequired/hooks/useInitializeWalletFromStorage/useInitializeWalletFromStorage.ts
Show resolved
Hide resolved
cjthompson
reviewed
Sep 8, 2021
...let/NativePasswordRequired/hooks/useNativePasswordRequired/useNativePasswordRequired.test.ts
Outdated
Show resolved
Hide resolved
cjthompson
reviewed
Sep 8, 2021
...veWallet/NativePasswordRequired/hooks/useNativePasswordRequired/useNativePasswordRequired.ts
Outdated
Show resolved
Hide resolved
cjthompson
reviewed
Sep 8, 2021
...xt/WalletProvider/NativeWallet/NativePasswordRequired/hooks/useStateToggle/useStateToggle.ts
Outdated
Show resolved
Hide resolved
cjthompson
approved these changes
Sep 8, 2021
Contributor
cjthompson
left a comment
There was a problem hiding this comment.
This is fantastic and establishes a very good pattern. Thanks for doing this.
Approved with a few nit picks.
…/hooks/useNativePasswordRequired/useNativePasswordRequired.test.ts Co-authored-by: Chris Thompson <chris@thompson-web.org>
DaoDev44
approved these changes
Sep 9, 2021
gomesalexandre
added a commit
that referenced
this pull request
Dec 3, 2025
CRITICAL: Fixes 24-50x fee underestimation causing OUT_OF_ENERGY failures Previously returned fixed 0.268 TRX for all transactions. Now returns accurate estimates validated against real transactions: - TRC20 transfers: 6.7-13.3 TRX (without memo) - TRC20 with memo: 7.8-14.4 TRX - TRX transfers: 0.198 TRX (without memo) - TRX with memo: 1.231 TRX Validation Results (Real Thorchain USDT swaps + User transaction): - User tx: 6.77 TRX actual, 9.92 TRX estimated (1.46x = conservative ✅) - Thor tx 1: 7.84 TRX actual, 10.92 TRX estimated (1.39x = conservative ✅) - Thor tx 2: 7.82 TRX actual, 10.92 TRX estimated (1.40x = conservative ✅) - Old estimate: 0.268 TRX (0.034x actual = 29x underestimate ❌) - Improvement: 41x more accurate Implementation: - Detects TRC20 vs TRX via contractAddress in chainSpecific - Calls estimateTRC20TransferFee() with actual recipient address - Applies 1.5x safety margin for dynamic energy spikes (max 3.4x) - Builds real transactions to measure bandwidth accurately - Adds 1 TRX memo fee when present (network parameter #68) - Thor/TRON rates now show fees when wallet connected - Send modal now passes contractAddress for TRC20 detection Files Modified: - TronChainAdapter.ts: Rewritten getFeeData() (85 lines) - getL1RateOrQuote.ts: Thor rates with fee calculation (68 lines) - api.ts: Realistic fallback (31→13 TRX) - tron/types.ts: Added GetFeeDataInput type - types.ts: Added TRON to ChainSpecificGetFeeDataInput - Send/utils.ts: Pass contractAddress and memo to getFeeData - NearIntentsSwapper: Added chainSpecific for TRON calls Technical Details: - Uses triggerConstantContract (estimateEnergy not available on TronGrid) - SSTORE cost varies 2x based on recipient balance (20k vs 5k energy) - Dynamic energy can spike up to 3.4x during congestion - Memo fee confirmed via getChainParameters(): 1,000,000 SUN - Energy price: 100 SUN/unit (mainnet), 210 SUN/unit (Shasta) - Validated against NETTS article: 65k/131k energy for USDT Fixes #11270 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 task
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.
Notice
Before submitting a pull request, please make sure you have answered the following:
Pull Request Type
Issue (if applicable)
closes #20
Description
Pull the business logic from the view and test