Skip to content

Commit

Permalink
stellar#76: use txBuilder.setSorobanData
Browse files Browse the repository at this point in the history
  • Loading branch information
sreuland committed May 16, 2023
1 parent 3e9f2d0 commit 6b2c183
Show file tree
Hide file tree
Showing 2 changed files with 245 additions and 207 deletions.
20 changes: 5 additions & 15 deletions src/transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,24 +82,14 @@ export function assembleTransaction(
}),
);

// apply the pre-built Soroban Tx Ext from simulation onto the Tx
txnBuilder.setExt(buildExt(simulation.transactionData));

return txnBuilder.build();
}

function buildExt(sorobanTxDataStr: string) {
const sorobanTxData: xdr.SorobanTransactionData = xdr.SorobanTransactionData.fromXDR(
sorobanTxDataStr,
// apply the pre-built Soroban Tx Data from simulation onto the Tx
const sorobanTxData = xdr.SorobanTransactionData.fromXDR(
simulation.transactionData,
"base64",
);
txnBuilder.setSorobanData(sorobanTxData);

// TODO - remove this workaround to use constructor on js-xdr union
// and use the typescript generated static factory method once fixed
// https://github.com/stellar/dts-xdr/issues/5
// @ts-ignore
const txExt = new xdr.TransactionExt(1, sorobanTxData);
return txExt;
return txnBuilder.build();
}

function buildContractAuth(auths: string[]): xdr.ContractAuth[] {
Expand Down
Loading

0 comments on commit 6b2c183

Please sign in to comment.