Skip to content
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

is a signature necessary for transaction->toEnvelopeXdrBase64(); #32

Closed
arduent opened this issue Sep 22, 2023 · 2 comments
Closed

is a signature necessary for transaction->toEnvelopeXdrBase64(); #32

arduent opened this issue Sep 22, 2023 · 2 comments

Comments

@arduent
Copy link

arduent commented Sep 22, 2023

Soneso/StellarSDK/Transaction.php

Why does it have to be signed? Stellar Laboratory lets you import unsigned XDR envelopes so that they may be signed.

Can the signature requirement be removed or maybe it needs a new function/parameter? But the function still works with signatures, without the check. If something else in the SDK needs a signature I'm not sure this is the place to check.

/**
 * @throws Exception if transaction is not signed.
 */
public function toEnvelopeXdr(): XdrTransactionEnvelope
{
    if (count($this->getSignatures()) == 0) {
        throw new Exception("Transaction must be signed by at least one signer. Use transaction.sign().");
    }
    $xdrTransaction = $this->toXdr();
    $v1Envelope = new XdrTransactionV1Envelope($xdrTransaction, $this->getSignatures());
    $type = new XdrEnvelopeType(XdrEnvelopeType::ENVELOPE_TYPE_TX);
    $xdrEnvelope = new XdrTransactionEnvelope($type);
    $xdrEnvelope->setV1($v1Envelope);
    return $xdrEnvelope;
}

https://laboratory.stellar.org/#txsigner

If i comment out the sig check the the XDR imports just fine. But maybe this breaks something else in the SDK.

@christian-rogobete
Copy link
Contributor

Hello @arduent,

it seams that you have an old version of the SDK. I can not find this check in the current version of the SDK. But I need to remove the comment because it dose not throw.

Thanks

@christian-rogobete
Copy link
Contributor

see also #8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants