Skip to content

Commit

Permalink
hack suppport for protocol 13 TransactionEnvelope.
Browse files Browse the repository at this point in the history
  • Loading branch information
abuiles committed Apr 7, 2020
1 parent 0378269 commit 6965206
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
7 changes: 6 additions & 1 deletion src/transaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ export class Transaction {
}
this._networkPassphrase = networkPassphrase;

// temp hack
envelope = envelope.value();

// since this transaction is immutable, save the tx
this.tx = envelope.tx();
this.source = StrKey.encodeEd25519PublicKey(
Expand Down Expand Up @@ -243,7 +246,9 @@ export class Transaction {
toEnvelope() {
const tx = this.tx;
const signatures = this.signatures;
const envelope = new xdr.TransactionEnvelope({ tx, signatures });
const envelope = new xdr.TransactionEnvelope.envelopeTypeTx(
new xdr.TransactionV1Envelope({ tx, signatures })
);

return envelope;
}
Expand Down
5 changes: 3 additions & 2 deletions src/transaction_builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,13 +208,14 @@ export class TransactionBuilder {

this.timebounds.minTime = UnsignedHyper.fromString(this.timebounds.minTime.toString());
this.timebounds.maxTime = UnsignedHyper.fromString(this.timebounds.maxTime.toString())

attrs.timeBounds = new xdr.TimeBounds(this.timebounds);

const xtx = new xdr.Transaction(attrs);
xtx.operations(this.operations);

const xenv = new xdr.TransactionEnvelope({ tx: xtx });

const xenv = xdr.TransactionEnvelope.envelopeTypeTx(new xdr.TransactionV1Envelope({ tx: xtx }));
const tx = new Transaction(xenv, this.networkPassphrase);

this.source.incrementSequenceNumber();
Expand Down

0 comments on commit 6965206

Please sign in to comment.