Skip to content

feat: add Stellar account asset info RPC#81

Open
khanti42 wants to merge 4 commits into
mainfrom
feat/stellar-account-asset-info
Open

feat: add Stellar account asset info RPC#81
khanti42 wants to merge 4 commits into
mainfrom
feat/stellar-account-asset-info

Conversation

@khanti42
Copy link
Copy Markdown
Contributor

Explanation

Explanation

Adds support for the custom keyring_getAccountAssetInfo RPC to expose fungible asset metadata together with Stellar classic trustline-specific fields (limit, authorized, sponsored) when available.

This PR also improves change-trust transaction tracking by passing trustline verification metadata into the background tracking flow and delaying transaction confirmation until Horizon reflects the expected trustline state. This avoids race conditions where Soroban confirms the transaction before Horizon indexing is updated.

To support this, retry and delay logic was added around Horizon trustline verification after transaction confirmation.

Additional tests were added covering:

  • keyring_getAccountAssetInfo RPC behavior
  • trustline extra field serialization
  • request routing
  • error handling
  • Horizon trustline synchronization and verification flow

References

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

@khanti42 khanti42 requested a review from a team as a code owner May 27, 2026 13:25
@khanti42
Copy link
Copy Markdown
Contributor Author

@metamaskbot publish-preview

@github-actions
Copy link
Copy Markdown

Preview builds have been published. Learn how to use preview builds in other projects.

Expand for full list of packages and versions.
@metamask-previews/stellar-wallet-snap@0.0.1-preview-e169e16

@khanti42
Copy link
Copy Markdown
Contributor Author

@metamaskbot publish-preview

@khanti42
Copy link
Copy Markdown
Contributor Author

@metamaskbot publish-preview

@github-actions
Copy link
Copy Markdown

Preview builds have been published. Learn how to use preview builds in other projects.

Expand for full list of packages and versions.
@metamask-previews/stellar-wallet-snap@0.0.1-preview-56dc705

import { BaseHandler } from '../base';

export class GetAccountAssetInfoHandler
extends BaseHandler<
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

extends BaseClientRequestHandler will give u the account (either from state or onchain)

and u can override handleAccountNotActivatedError for not activated handle

type FungibleAssetMetadata,
} from '@metamask/snaps-sdk';
import { ensureError } from '@metamask/utils';

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

you dont need this class, everything is already in onChainAccount object

* {@link OnChainAccountService.synchronize}. The persisted keyring transaction in snap state
* (by hash) is the source of truth for which account to sync.
*
* Change-trust jobs may pass `trustlineVerification`; those sync until a fresh Horizon load
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

i will suggest dont touch track transaction in this PR, or do it from other PR
becoz we have to refactor the track transaction anyway

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.

2 participants