Add PaymentDestination interface for lightweight server destinations#128
Merged
Add PaymentDestination interface for lightweight server destinations#128
Conversation
Introduces a minimal PaymentDestination interface that only requires
getAccountId() and getSources() - the bare minimum needed for server
middleware destinations. This allows sprites and other services to
operate without a full connection_token.
Changes:
- Add PaymentDestination interface to @atxp/common
- Update Account type to extend PaymentDestination
- Add AccountIdDestination class that implements PaymentDestination
using just an accountId string (no connection_token required)
- Update server ATXPConfig.destination type from Account to PaymentDestination
This enables servers to use:
new AccountIdDestination('abc123')
instead of requiring:
new ATXPAccount(connectionString)
Existing code using ATXPAccount continues to work unchanged since
Account extends PaymentDestination.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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.
Summary
PaymentDestinationinterface to@atxp/common- minimal interface for server destinationsAccounttype to extendPaymentDestination(backwards compatible)AccountIdDestinationclass - lightweight destination using just an accountIdATXPConfig.destinationtype fromAccounttoPaymentDestinationMotivation
Sprites and other services that receive payments don't need a full connection_token to operate. They only need:
getAccountId()- to identify where payments gogetSources()- to provide payment options (public endpoint, no auth)This change allows servers to use:
Instead of requiring a full connection string:
Changes
New interface (
types.ts):Updated Account (
types.ts):New class (
accountIdDestination.ts):atxp:abc123or unqualifiedabc123)/account/{id}/sourcesendpoint (no auth needed)Test plan
AccountIdDestination🤖 Generated with Claude Code