fix(ts-sdk): accept TransactionSigner in getPaymentInstruction source_wallet#402
fix(ts-sdk): accept TransactionSigner in getPaymentInstruction source_wallet#402
Conversation
…_wallet Resolves "Multiple distinct signers" error when combining payment instruction with other instructions that use a real signer for the same address. source_wallet now accepts TransactionSigner | string.
📊 TypeScript Coverage ReportCoverage: 33.9% View detailed reportCoverage artifacts have been uploaded to this workflow run. |
Greptile SummaryThis PR fixes a "Multiple distinct signers" error in Confidence Score: 5/5Safe to merge — the fix is minimal, correctly scoped, and fully tested with 39/39 existing tests passing and two new targeted tests. The logic change is small and clearly correct: No files require special attention; the one unused import in Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["getPaymentInstruction(request)"] --> B{"typeof source_wallet !== 'string'\n&& isTransactionSigner(source_wallet)?"}
B -- "Yes (TransactionSigner)" --> C["isSigner = true\nwalletAddress = source_wallet.address"]
B -- "No (string)" --> D["isSigner = false\nwalletAddress = source_wallet as Address"]
C --> E["assertIsAddress(walletAddress)"]
D --> E
E --> F["findAssociatedTokenPda(owner: walletAddress)"]
F --> G{"isSigner?"}
G -- "Yes" --> H["authority = source_wallet\n(TransactionSigner, role: 2)"]
G -- "No" --> I["authority = walletAddress\n(plain Address, role: 0)"]
H --> J["getTransferInstruction(...)"]
I --> J
J --> K["Return payment_instruction"]
Reviews (1): Last reviewed commit: "chore(ts-sdk): bump version to 0.2.0-bet..." | Re-trigger Greptile |
5a01745 to
78318a0
Compare
78318a0 to
4acb790
Compare
Summary
getPaymentInstructionpreviously created aNoopSignerforsource_wallet, causing "Multiple distinct signers" errors when callers used a realTransactionSignerfor the same address on other instructions (e.g. Codama-generated clients)source_walletnow acceptsTransactionSigner | string— when a signer is passed, it's used directly as the transfer authority; when a string is passed, a plain address (no signer) is usedcreateNoopSignerusage from the payment instruction path0.2.0-beta.7Closes PRO-1072
Test plan