Skip to content

port contract id search back to master#2684

Merged
piyalbasu merged 4 commits intomasterfrom
bugfix/contract-id-search-master
Apr 15, 2026
Merged

port contract id search back to master#2684
piyalbasu merged 4 commits intomasterfrom
bugfix/contract-id-search-master

Conversation

@piyalbasu
Copy link
Copy Markdown
Contributor

Closes #2677

Porting the changes from #2679 to the master branch

Copilot AI review requested due to automatic review settings April 6, 2026 16:19
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Ports contract-ID (Soroban token) support into master so the extension can handle Stellar Expert asset search results that return contract token IDs instead of only {code}-{issuer} identifiers.

Changes:

  • Update balance lookup to match Soroban balances by contract ID.
  • Enhance asset search mapping to construct ManageAssetCurrency rows from Stellar Expert contract-ID records.
  • Add unit + e2e test coverage for contract-ID asset search and swap error messaging.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
extension/src/popup/helpers/balance.ts Adds contract-ID matching branch in findAssetBalance.
extension/src/popup/helpers/tests/balance.test.js Adds unit tests for classic vs contract-ID balance matching.
extension/src/popup/components/swap/SwapAmount/hooks/useSimulateSwapData.tsx Centralizes swap error display logic and adds contract-ID-specific messaging.
extension/src/popup/components/swap/SwapAmount/hooks/tests/useSimulateSwapData.test.ts Adds unit tests for getSwapErrorMessage.
extension/src/popup/components/manageAssets/SearchAsset/hooks/useAssetLookup.ts Maps Stellar Expert contract-ID search records into Manage Assets rows.
extension/e2e-tests/helpers/stubs.ts Adds Stellar Expert asset-search stub returning a contract-ID record.
extension/e2e-tests/addAssetContractSearch.test.ts Adds e2e coverage for contract-ID search results (“Already Added”, “Add”, and add-flow).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +295 to +299
if (isContractId(record.asset)) {
return {
code: record.code || record.tomlInfo?.code || "",
issuer: record.asset,
contract: record.asset,
Copy link

Copilot AI Apr 6, 2026

Choose a reason for hiding this comment

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

The Stellar Expert search mapping now emits contract-ID assets (issuer/contract both set to the contract ID). Downstream in this hook, BlockAid bulk scanning builds asset_ids as ${code}-${issuer} for all returned rows when the search term is not a contract ID; that will end up scanning code-<contractId> for these results, which the existing logic/comments indicate is intended only for classic assets. Consider filtering contract-ID rows out of the BlockAid scan path (e.g., skip rows where isContractId(row.issuer) / row.contract is set) or updating the scan identifier format if BlockAid supports contract assets.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@copilot apply changes based on this feedback

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Applied in commit 6441f61. Added !isContractId(record.issuer) guard in addBlockaidScanResults so contract-ID rows (where issuer is a Soroban contract ID) are skipped when building asset_ids for the BlockAid bulk scan — preventing malformed ${code}-${contractId} identifiers from being sent.

Comment thread extension/e2e-tests/addAssetContractSearch.test.ts
Comment thread extension/e2e-tests/addAssetContractSearch.test.ts
Comment thread extension/e2e-tests/addAssetContractSearch.test.ts
@piyalbasu piyalbasu merged commit aac50f3 into master Apr 15, 2026
9 checks passed
@piyalbasu piyalbasu deleted the bugfix/contract-id-search-master branch April 15, 2026 22:12
@github-actions github-actions bot mentioned this pull request Apr 16, 2026
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.

Update asset search to handle contract tokens

4 participants