Skip to content

Commit

Permalink
Fix TypeScript definition for new static TransactionBuilder constru…
Browse files Browse the repository at this point in the history
…ctor (#665)

* Add version bump to publish
* Fixup docs
  • Loading branch information
Shaptic authored Aug 7, 2023
1 parent 9eac156 commit 7c85cc4
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 10 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "stellar-base",
"version": "10.0.0-soroban.5",
"version": "10.0.0-soroban.6",
"description": "Low-level support library for the Stellar network.",
"main": "./lib/index.js",
"browser": {
Expand Down
24 changes: 16 additions & 8 deletions src/transaction_builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ export const TimeoutInfinite = 0;
* {@link SorobanDataBuilder} to construct complicated combinations of
* parameters without mucking with XDR directly. **Note:** For
* non-contract(non-Soroban) transactions, this has no effect.
*
*/
export class TransactionBuilder {
constructor(sourceAccount, opts = {}) {
Expand Down Expand Up @@ -170,6 +169,11 @@ export class TransactionBuilder {
* @returns {TransactionBuilder} a "prepared" builder instance with the same
* configuration and operations as the given transaction
*
* @warning This does not clone the transaction's
* {@link xdr.SorobanTransactionData} (if applicable), use
* {@link SorobanDataBuilder} and {@link TransactionBuilder.setSorobanData}
* as needed, instead..
*
* @todo This cannot clone {@link FeeBumpTransaction}s, yet.
*/
static cloneFrom(tx, opts = {}) {
Expand Down Expand Up @@ -515,16 +519,20 @@ export class TransactionBuilder {
}

/**
* Set the {SorobanTransactionData}. For non-contract(non-Soroban)
* transactions, this setting has no effect. In the case of Soroban
* transactions, set to an instance of SorobanTransactionData. This can
* typically be obtained from the simulation response based on a transaction
* with a InvokeHostFunctionOp. It provides necessary resource estimations for
* contract invocation.
* Sets the transaction's internal Soroban transaction data (resources,
* footprint, etc.).
*
* For non-contract(non-Soroban) transactions, this setting has no effect. In
* the case of Soroban transactions, this is either an instance of
* {@link xdr.SorobanTransactionData} or a base64-encoded string of said
* structure. This is usually obtained from the simulation response based on a
* transaction with a Soroban operation (e.g.
* {@link Operation.invokeHostFunction}, providing necessary resource
* and storage footprint estimations for contract invocation.
*
* @param {xdr.SorobanTransactionData | string} sorobanData the
* {@link xdr.SorobanTransactionData} as a raw xdr object or a base64
* string to be decoded then set as Transaction.Ext.SorobanData
* string to be decoded
*
* @returns {TransactionBuilder}
* @see {SorobanDataBuilder}
Expand Down
5 changes: 4 additions & 1 deletion types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1029,7 +1029,10 @@ export class TransactionBuilder {
build(): Transaction;
setNetworkPassphrase(networkPassphrase: string): this;

static cloneFrom(tx: Transaction): TransactionBuilder;
static cloneFrom(
tx: Transaction,
optionOverrides?: TransactionBuilder.TransactionBuilderOptions
): TransactionBuilder;
static buildFeeBumpTransaction(
feeSource: Keypair | string,
baseFee: string,
Expand Down

0 comments on commit 7c85cc4

Please sign in to comment.