-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixing issue for wallet integration [SLT-270] #3194
Conversation
WalkthroughThe changes in the Changes
Possibly related PRs
Suggested labels
Suggested reviewers
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
Deploying sanguine-fe with
|
Latest commit: |
ffffb07
|
Status: | ✅ Deploy successful! |
Preview URL: | https://bab01a07.sanguine-fe.pages.dev |
Branch Preview URL: | https://fix-explorer-graphql.sanguine-fe.pages.dev |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (3)
packages/rest-api/src/controllers/destinationTxController.ts (3)
53-54
: LGTM: Improved token information retrieval and decimal calculation.The use of
tokenAddressToToken
and the modifiedgetTokenDecimals
call address the PR objectives by ensuring correct token verification and decimal calculation. This should resolve the issues with incorrect decimal values and token symbols.Consider adding a comment explaining the purpose of
tokenAddressToToken
, as it's crucial for understanding the fix:+ // Retrieve token information to ensure correct symbol is used const tokenInfo = tokenAddressToToken(chainID.toString(), tokenAddress)
60-62
: LGTM: Updated response structure with correct token information.The changes to the response structure, including the addition of
chainID
and the derivation oftokenSymbol
fromtokenInfo
, align well with the PR objectives. This ensures that the correct symbol is returned, addressing the issue mentioned in the PR description.Consider adding a log or comment when
tokenInfo
is not available, as this might indicate an unexpected scenario:tokenSymbol: tokenInfo ? tokenInfo?.symbol : null, + // Log if tokenInfo is not available for debugging purposes + tokenInfo || console.log(`Warning: No token info found for chainID ${chainID} and address ${tokenAddress}`),
Action Required: Address Remaining Uses of
toInfo.tokenSymbol
The verification process identified a remaining direct use of
toInfo.tokenSymbol
in the codebase:
explorer-ui/pages/tx/[kappa].tsx: tokenSymbol={toInfo.tokenSymbol}
Please update this instance to utilize the new
tokenAddressToToken
utility to ensure consistency and prevent potential issues related to wallet integration.🔗 Analysis chain
Line range hint
1-76
: Summary: Effective implementation addressing the wallet integration issue.The changes made in this file successfully address the PR objectives by:
- Introducing a new utility function
tokenAddressToToken
to verify and retrieve correct token information.- Modifying the response structure to include the correct
chainID
andtokenSymbol
.- Updating the token decimal calculation to use the correct
chainID
.These modifications should effectively resolve the edge case where incorrect values were being returned due to improper indexing of a specific contract in the explorer.
To ensure the changes are consistent across the codebase, please run the following verification script:
This script will help ensure that the changes are consistently applied across the codebase and that there are no remaining instances of the old pattern that could lead to similar issues.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the usage of tokenAddressToToken and related changes # Test 1: Check for other occurrences of tokenAddressToToken echo "Checking for other uses of tokenAddressToToken:" rg "tokenAddressToToken" --type typescript # Test 2: Verify the import in other files echo "Verifying import in other files:" rg "import.*from '../utils/tokenAddressToToken'" --type typescript # Test 3: Check for any remaining direct uses of toInfo.tokenSymbol echo "Checking for any remaining direct uses of toInfo.tokenSymbol:" rg "toInfo\.tokenSymbol" --type typescript # Test 4: Verify consistent use of chainID in getTokenDecimals echo "Verifying consistent use of chainID in getTokenDecimals:" rg "getTokenDecimals\([^)]*\)" --type typescriptLength of output: 789
Script:
#!/bin/bash # Description: Verify the usage of tokenAddressToToken and related changes # Test 1: Check for other occurrences of tokenAddressToToken echo "Checking for other uses of tokenAddressToToken:" rg "tokenAddressToToken" --glob "*.ts" --glob "*.tsx" # Test 2: Verify the import in other files echo "Verifying import in other files:" rg "import.*from '../utils/tokenAddressToToken'" --glob "*.ts" --glob "*.tsx" # Test 3: Check for any remaining direct uses of toInfo.tokenSymbol echo "Checking for any remaining direct uses of toInfo.tokenSymbol:" rg "toInfo\.tokenSymbol" --glob "*.ts" --glob "*.tsx" # Test 4: Verify consistent use of chainID in getTokenDecimals echo "Verifying consistent use of chainID in getTokenDecimals:" rg "getTokenDecimals\([^)]*\)" --glob "*.ts" --glob "*.tsx"Length of output: 5348
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
⛔ Files ignored due to path filters (1)
yarn.lock
is excluded by!**/yarn.lock
,!**/*.lock
📒 Files selected for processing (1)
- packages/rest-api/src/controllers/destinationTxController.ts (2 hunks)
🔇 Additional comments (2)
packages/rest-api/src/controllers/destinationTxController.ts (2)
5-5
: LGTM: New utility function import.The import of
tokenAddressToToken
aligns with the PR objectives and is necessary for the subsequent changes in the controller function.
51-51
: LGTM: Enhanced destructuring oftoInfo
.The inclusion of
chainID
in the destructuring is consistent with the PR objectives and necessary for the new token verification process. The use of the spread operator for the remaining properties is a good practice for maintaining flexibility.
Bundle ReportChanges will increase total bundle size by 11.69kB (0.03%) ⬆️. This is within the configured threshold ✅ Detailed changes
ℹ️ *Bundle size includes cached data from a previous commit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (2)
packages/explorer-ui/pages/tx/[kappa].tsx (2)
160-163
: LGTM: Improved token symbol derivation for sent amount.The change correctly implements the
addressToSymbol
function to derive the token symbol, addressing the PR objective. This should resolve the issue of incorrect symbol display for the sent amount.Consider destructuring the
fromInfo
object to improve code readability:-tokenSymbol={addressToSymbol({ - tokenAddress: fromInfo.tokenAddress, - chainId: fromInfo.chainID, -})} +tokenSymbol={addressToSymbol({ + tokenAddress, + chainId: chainID, +})}This change would require destructuring
fromInfo
earlier in the component:const { tokenAddress, chainID, value } = fromInfo;
189-192
: LGTM: Improved token symbol derivation for received amount.The change correctly implements the
addressToSymbol
function to derive the token symbol for the received amount, addressing the PR objective. This should resolve the issue of incorrect symbol display for the received amount.For consistency with the suggested improvement for the sent amount, consider destructuring the
toInfo
object:-tokenSymbol={addressToSymbol({ - tokenAddress: toInfo.tokenAddress, - chainId: toInfo.chainID, -})} +tokenSymbol={addressToSymbol({ + tokenAddress, + chainId: chainID, +})}This change would require destructuring
toInfo
earlier in the component:const { tokenAddress, chainID, value } = toInfo;
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
📒 Files selected for processing (1)
- packages/explorer-ui/pages/tx/[kappa].tsx (3 hunks)
🔇 Additional comments (1)
packages/explorer-ui/pages/tx/[kappa].tsx (1)
13-13
: LGTM: New utility function import.The import of the
addressToSymbol
function from the utils module is correctly placed and aligns with the PR objectives to improve token symbol derivation.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #3194 +/- ##
====================================================
+ Coverage 40.97344% 90.56974% +49.59630%
====================================================
Files 459 54 -405
Lines 25641 1018 -24623
Branches 342 82 -260
====================================================
- Hits 10506 922 -9584
+ Misses 14383 93 -14290
+ Partials 752 3 -749
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
* update bl * remove global solidity extension settings * use monorepo support in global workspace only * - use Solidity extension for formatting *.sol files - use `forge fmt` as formatter in Solidity extension * REST API Improvements [SLT-179] (#3133) * fix swaptxinfo function * Updates test coverage command * migrating to using token addresses instead of symbols * fix linting errors * fixing swaptxinfocontroller * new tests and new functionality --------- Co-authored-by: abtestingalpha <[email protected]> * Publish - @synapsecns/[email protected] - @synapsecns/[email protected] * fix harmony proxy (#3149) Co-authored-by: Trajan0x <[email protected]> * merging rfq indexer into monorepo [SLT-164] [SLT-176] (#3136) * merging rfq indexer into monorepo * nuke .env * fix commands * fix package name * test coverage script * rough pass at docs and some linting and fixes yarn * Upgrades wagmi & rainbowkit * indxer * Adds invisible but used packages * +recent-invalid-fills [SLT-188] * Moves wagmi to root * new endpoints and clean up linting --------- Co-authored-by: Trajan0x <[email protected]> Co-authored-by: abtestingalpha <[email protected]> Co-authored-by: parodime <[email protected]> * Publish - @synapsecns/[email protected] - @synapsecns/[email protected] - @synapsecns/[email protected] * Adds /destinationTokens route [SLT-204] (#3151) * Adds /destinationTokens route * ZeroAddress & NativeGasAddress * Adds test for native gas tokens * Checksums incoming token address params * Publish - @synapsecns/[email protected] * boba pause (#3150) * boba pause * only boba to txns * Publish - @synapsecns/[email protected] * fix(synapse-interface): Reorders validation to check existence first (#3156) * Reorders validation to check existence first * Removes duplicates * Publish - @synapsecns/[email protected] * Fix boba pause (#3158) * Publish - @synapsecns/[email protected] * update bl * feat(rest-api): Adds Swagger for api docs [SLT-205] (#3159) * Adds Swagger for api docs * Replace prepended verb Get routes with nouns * Adds dev flag for swagger serverUrl * Publish - @synapsecns/[email protected] - @synapsecns/[email protected] - @synapsecns/[email protected] - @synapsecns/[email protected] * Pulls version from package json (#3160) * Publish - @synapsecns/[email protected] * Require vs import due to file location (#3161) * Require vs import due to file location * Publish - @synapsecns/[email protected] * Prevent caching of api docs (#3162) * Publish - @synapsecns/[email protected] * feat(contracts-rfq): relay/prove/claim with different address [SLT-130] (#3138) * init. solidity ^. FbV2 relay/prove/claim overloads * +IFastBridgeV2, explicit address0 cast, func scope & inheritdoc fixes * pragma lock, contract relabel * feat: start scoping V2 tests * test: override relayer role scenarios, no longer enforced by V2 * test: finish the parity test * test: the management methods * test: dst chain scenarios * test: bridge * test: prove * test: claim * test: dispute * test: refund * test: bridge reverts * remove redundant extend. rearrange inherit list * revert 0.8.20 in favor of user (non-ws) setting --------- Co-authored-by: ChiTimesChi <[email protected]> * Publish - [email protected] * fix(promexporter): make spans better (#3164) * move the errors * [goreleaser] * fix v to w * changing native token address standard [SLT-210] (#3157) * changing native token address standard * fixing tests * normalizeNativeTokenAddress middleware, additional tests --------- Co-authored-by: abtestingalpha <[email protected]> * Publish - @synapsecns/[email protected] * Refactoring rfq-indexer API and adding swagger docs [SLT-228] (#3167) * refactoring and adding swagger * remove testing scripts * fix typos and consistency with 404 errors * Publish - @synapsecns/[email protected] * fix read mes (#3168) * Publish - @synapsecns/[email protected] - [email protected] - @synapsecns/[email protected] * fix(opbot): use submitter get tx status [SLT-158] (#3134) * use experimental logger to debug * fix lint * [goreleaser] * use submitter instead of client * [goreleaser] * [goreleaser] * fix(synapse-interface): Additional checks on screen [SLT-166] (#3152) * Additional checks on screen * Adds checks on chain/token changes * Publish - @synapsecns/[email protected] * feat(synapse-interface): confirm new price [SLT-150] (#3084) * add bridge quote history middleware * request user confirm changes when quoted price updates * add conditions for displaying confirm change state * track initial quote initializing confirm change state * specify output delta threshold * callback functions to handle initialize/accept/reset confirm changes flow * quote countdown timer animation to signal refresh * implement automatic refresh intervals * mouse move to refresh automatic intervals * add i8n translations for button text --------- Co-authored-by: abtestingalpha <[email protected]> * Publish - @synapsecns/[email protected] * fix: formatted bridge fee amount (#3165) * Publish - @synapsecns/[email protected] * fix(contracts-rfq): CI workflows [SLT-245] (#3178) * fix: license, files * fix: package name * build: update solhint to latest * build: remove prettier dependencies * fix: solhint workflows * build: update solhint in other packages as well * chore: solhint rules, exceptions * fix: silence linter warnings in tests * chore: forge fmt * add variable to test linter CI * Revert "add variable to test linter CI" This reverts commit 0629309. * Publish - @synapsecns/[email protected] - @synapsecns/[email protected] - @synapsecns/[email protected] * feat(api): bridge limits [SLT-165] (#3179) * adds `/bridgeLimits` route, controller * fetch best sdk quote for min/max origin amounts * add tests * implement middleware to normalize addresses * adds swagger doc * Publish - @synapsecns/[email protected] * fix(contracts-rfq): limit the amount of solhint warnings [SLT-245] (#3182) * ci: limit the amount of solhint warnings * refactor: move the errors into the separate interface * refactor: errors imports in tests * Publish - @synapsecns/[email protected] * ci: Solidity gas diff [SLT-259] (#3181) * ci: run tests w/o coverage first for better visibility * test: malform the test to check the adjusted workflow * Revert "test: malform the test to check the adjusted workflow" This reverts commit e7db6e1. * ci: add gas-diff workflow * try changing the contract to trigger gas diffs * retrigger the workflow * ci: provide the correct report path * ci: run on pull requests only * ci: save gas reports in monorepo root * Revert "ci: run on pull requests only" This reverts commit 0a01d60. * Revert "try changing the contract to trigger gas diffs" This reverts commit 91bc03e. * refactor: wrap if statement * refactor: exclude `solidity-devops` package in a more generic way * ci: run tests w/o coverage for `solidity-devops`, add comments * add generic comment to trigger `solidity-devops` workflows * Revert "add generic comment to trigger `solidity-devops` workflows" This reverts commit cc35a43. * Publish - @synapsecns/[email protected] * fix(contracts-core): set very high gas limit for intensive tests [SLT-259] (#3186) * fix: set very high gas limit for intensive tests * ci: speed up solidity coverage * Publish - @synapsecns/[email protected] * feat(rest-api): Adds validateRouteExists validation [SLT-260] (#3180) * Adds validateRouteExists validation * Remove timeouts for 400s * Publish - @synapsecns/[email protected] * add duplicate command warning (#3174) Co-authored-by: Trajan0x <[email protected]> * reduce solhint warnings on FbV2 (#3189) * reduce solhint warnings on FbV2 * fix whitespace * Publish - @synapsecns/[email protected] * ci: solidity gas diff options [SLT-267] (#3193) * ci: ignore test files in gas diff report * add some changes to the test files * ci: define some options for gas-diff * try changing the contract to trigger gas diffs * Revert "try changing the contract to trigger gas diffs" This reverts commit 4504e3c. * Revert "add some changes to the test files" This reverts commit 7e7d6cb. * prove w/ tx id [SLT-181] (#3169) * prove w/ tx id SLT-181 * +proveOther tests, forge fmt * fmt * fmt * Publish - @synapsecns/[email protected] * fix(sdk-router): disable ARB airdrop tests (#3195) * Publish - @synapsecns/[email protected] - @synapsecns/[email protected] - @synapsecns/[email protected] - @synapsecns/[email protected] * Fixing issue for wallet integration [SLT-270] (#3194) * slight modification to graphql call * fixing explorer frontend as well * Publish - @synapsecns/[email protected] - @synapsecns/[email protected] * store relayer on relay [SLT-182] (#3170) * store relayer on relay [SLT-182] * +tests, zeroAddr check, fmt * Publish - @synapsecns/[email protected] * Adjust text to trigger build (#3199) * Publish - @synapsecns/[email protected] * feat(synapse-interface): refund RFQ transaction [SLT-272] (#3197) * Txn transaction refund tracking * Update store to support tracking * Query FastBridge contract for `bridgeStatuses` to find refund status * Track bridge transaction `bridgeQuote.routerAddress` in store * Fetch FastBridge contract address when only provided router address * add translations --------- Co-authored-by: aureliusbtc <[email protected]> Co-authored-by: ChiTimesChi <[email protected]> Co-authored-by: abtestingalpha <[email protected]> Co-authored-by: Defi-Moses <[email protected]> Co-authored-by: trajan0x <[email protected]> Co-authored-by: Trajan0x <[email protected]> Co-authored-by: parodime <[email protected]> Co-authored-by: abtestingalpha <[email protected]> Co-authored-by: abtestingalpha <[email protected]> Co-authored-by: parodime <[email protected]> Co-authored-by: vro <[email protected]> Co-authored-by: ChiTimesChi <[email protected]> Co-authored-by: bigboydiamonds <[email protected]> Co-authored-by: bigboydiamonds <[email protected]>
Fixing the return for this specific edge case:
https://api.synapseprotocol.com/destinationTx?originChainId=1&txHash=0x1fb8e977e6ba84a0655dd3d62c16c1e0f9748245387c80387fa8a1574db96a02
The problem was that we had not indexed a specific contract in the explorer, meaning that the wrong values were returned (improper decimals and bridged asset instead of the final asset). We also add a verification of using the tokenAddress to generate the symbol (which always returns the final or beginning asset) instead of relying on tokenSymbol, which is assigned during the bridge_event (so will be the bridged token instead of the start/end asset)
I also add a small nit for the frontend explorer here.
Summary by CodeRabbit
New Features
chainID
andtokenSymbol
.chainID
andtokenAddress
.Bug Fixes
tokenDecimals
to utilizechainID
directly.cac5153: explorer-ui preview link
4c81004: explorer-ui preview link