// SPDX-FileCopyrightText: © 2026 LEDGER SAS // SPDX-License-Identifier: Apache-2.0 import type { xdr } from '@stellar/stellar-sdk' import { Networks, Transaction as StellarSdkTransaction } from '@stellar/stellar-sdk' export function combine( transaction: string | xdr.TransactionEnvelope, signature: string[], publicKey: string ): string { if (signature.length !== 1) { throw new Error(`Stellar combine expects exactly one signature, got ${signature.length}`) } const unsignedTx = new StellarSdkTransaction(transaction, Networks.PUBLIC) unsignedTx.addSignature(publicKey, signature[0]) return unsignedTx.toXDR() }