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

Fix TypeScript definition for new static TransactionBuilder constructor #665

Merged
merged 4 commits into from
Aug 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading