-
Notifications
You must be signed in to change notification settings - Fork 1
feat: improved XDM functionality in auto-xdm, add integration tests (⚠️ breaking changes) #490
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
Conversation
…confirmed transfers
…inAllowlist, nextChannelId, channels, and domainBalances
…ock production and condition checking
…r improved transaction handling, remove chain specific transfer functions (breaking change)
…nitions for better clarity and usage
…ns for improved clarity in info functions
…el handling, improving code organization and clarity in info functions
…initions and validation in info functions
…ed type definitions and improved return structures for cancelled and unconfirmed transfers
…d enhance documentation for chain readiness and XDM setup
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.
Pull Request Overview
This PR adds integration tests infrastructure and refactors the XDM (Cross-Domain Messaging) package to provide a more user-friendly API for cross-chain transfers. The changes include:
- Simplified XDM transfer API using friendly
ChainandTransferAccounttypes - New integration tests infrastructure with Docker Compose setup for testing against real blockchain nodes
- Enhanced type definitions and documentation for XDM functionality
- Updated examples to use the new simplified API
Reviewed Changes
Copilot reviewed 22 out of 23 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| yarn.lock | Added dependencies for integration tests (tsx, ts-jest, esbuild, type definitions) and workspace references |
| packages/auto-xdm/src/types.ts | New file defining friendly types for chains, accounts, channels, balances, and transfers |
| packages/auto-xdm/src/transforms.ts | New helpers to convert between JSON representations and friendly types |
| packages/auto-xdm/src/transfer.ts | Refactored transfer function with simplified API using Chain and TransferAccount types |
| packages/auto-xdm/src/info.ts | Refactored storage query functions with improved documentation and friendly return types |
| packages/auto-xdm/README.md | Updated examples to demonstrate new simplified API |
| integration-tests/* | Complete integration test infrastructure with Docker setup, helpers, and test suites |
| package.json | Added integration test scripts at root level |
| examples/auto-xdm-transfers/main.ts | Updated to use new transporterTransfer API |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Comment @cursor review or bugbot run to trigger another review on this PR
clostao
left a comment
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.
LGTM
… formats for domain and consensus handling
…e functions for enhanced type safety
vedhavyas
left a comment
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.
skimmed through integration tests.
Rest LGTM
XDM API Enhancements and Integration Test Infrastructure
Summary of Changes
This PR introduces significant improvements to the
@autonomys/auto-xdmpackage API and adds comprehensive integration test infrastructure. The changes include:transporterTransferfunctionIt got quite large, there will be a follow-up PR to improve integration tests and messenger call function typing.
Motivation and Context
The previous XDM transfer API had multiple functions (
transferToConsensus,transferToDomainAccount20Type,transferToDomainAccount32Type) that were difficult to discover and use. The new unified API:Additionally, the lack of integration tests made it difficult to verify XDM functionality end-to-end. The new integration test infrastructure:
Implementation Details
API Changes
Old API (Removed):
New API:
New Types
Chain:'consensus' | { domainId: number }- Chain identifierTransferAccount:{ accountId32: string } | { accountId20: string }- Account identifierChannel: Complete channel configuration with state, nonces, and feesChannelState:'Initiated' | 'Open' | 'Closed'DomainBalance: Domain balance entryTransfer: Transfer entry for cancelled/unconfirmed transfersNew Query Functions
chainAllowlist(api): Query chains allowed to open channelschannels(api, chain, channelId): Query specific channel configurationnextChannelId(api, chain): Get next channel ID for a chaindomainBalances(api, domainId?): Query domain balances (single or all)cancelledTransfers(api, from, to?): Query cancelled transfersunconfirmedTransfers(api, from, to?): Query unconfirmed transfersIntegration Test Infrastructure
New Directory Structure:
Key Features:
Transform Utilities
New
transforms.tsmodule provides internal utilities for:Breaking Changes
Removed Functions:
transfer()- Low-level function accepting CodectransferToConsensus()- Replaced bytransporterTransfer()transferToDomainAccount20Type()- Replaced bytransporterTransfer()transferToDomainAccount32Type()- Replaced bytransporterTransfer()Follow-ups