feat(blockchain): Implement Stellar account merge and trustline management endpoints - #312
Merged
Merged
Conversation
- WalletService.createWallet now funds new accounts via Friendbot when STELLAR_NETWORK=testnet, without failing wallet creation if funding fails. - Add POST /wallet/trustline with WalletService.addTrustline, backed by the existing anchor/trustline.utils ensureTrustline (Operation.changeTrust), now with optional custom limit support. - WalletService.getBalances returns [] for unfunded/not-found Horizon accounts instead of throwing. - Validate assetIssuer as a Stellar G-address via a custom class-validator decorator. - Add unit tests for Friendbot funding, addTrustline, and getBalances. Closes Afro-Pay#39 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
@Anuoluwapo25 is attempting to deploy a commit to the milah's projects Team on Vercel. A member of the Team first needs to authorize it. |
9 tasks
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
WalletService.createWalletnow funds new accounts via Friendbot whenSTELLAR_NETWORK=testnet, without failing wallet creation if Friendbot is unreachable.POST /wallet/trustline(AddTrustlineDto: { assetCode, assetIssuer, limit? }) backed byWalletService.addTrustline, which reuses the existingensureTrustlinehelper inanchor/trustline.utils.ts(built onOperation.changeTrust), now extended to support an optional custom limit.WalletService.getBalancesreturns[]for unfunded/not-found Horizon accounts instead of throwingNotFoundError.assetIssueris validated as a Stellar G-address via a custom class-validator decorator (StrKey.isValidEd25519PublicKey).addTrustline(created/no-op/trustline-error/missing-wallet), andgetBalances(mapped balances/empty-on-404/missing-wallet).Closes #39
Note for reviewers
wallet.service.tshas several pre-existing, unrelated compile issues onmainthat block a fulltsc/jestrun for the whole file: a missingnestjs-pinodependency (not installed), a PrismaWalletmodel missingmultisigEnabled/isFrozen/namecolumns used byenableMultisig/freezeWallet, and dead code inexportWallet/importWalletreferencing undefinedAuditCategory/AuditOperation/this.auditLog. These predate this PR and are out of scope for #39, so I left them untouched — flagging here so they're not mistaken for something this PR introduced. I verified this PR's new code introduces no new type errors and resolves the priorgetBalances-missing-on-service error in the controller.Test plan
createWalletFriendbot funding (success + failure paths)addTrustline(created, no-op/already-exists, trustline error → 400, missing wallet → 404)getBalances(mapped balances, empty array on Horizon 404, missing wallet → 404)npm testcurrently can't run end-to-end due to pre-existing unrelated breakage noted above — reviewer should confirm once that's resolved separately