Skip to content

Commit

Permalink
Add missing methods to TypeScript definitions (#766)
Browse files Browse the repository at this point in the history
  • Loading branch information
Shaptic authored Sep 12, 2024
1 parent 83c4960 commit ed89fec
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## Unreleased

### Fixed
* Add missing methods to TypeScript definitions ([#766](https://github.com/stellar/js-stellar-base/pull/766)).
* Fix the TypeScript definition of `walkInvocationTree` to allow void returns on the callback function as intended rather than forcing a `return null` ([#765](https://github.com/stellar/js-stellar-base/pull/765)).


Expand Down
4 changes: 4 additions & 0 deletions types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1019,6 +1019,7 @@ export class FeeBumpTransaction extends TransactionI {
);
feeSource: string;
innerTransaction: Transaction;
get operations(): Operation[];
}

export class Transaction<
Expand Down Expand Up @@ -1058,7 +1059,9 @@ export class TransactionBuilder {
options?: TransactionBuilder.TransactionBuilderOptions
);
addOperation(operation: xdr.Operation): this;
addOperationAt(op: xdr.Operation, i: number): this;
clearOperations(): this;
clearOperationAt(i: number): this;
addMemo(memo: Memo): this;
setTimeout(timeoutInSeconds: number): this;
setTimebounds(min: Date | number, max: Date | number): this;
Expand All @@ -1085,6 +1088,7 @@ export class TransactionBuilder {
envelope: string | xdr.TransactionEnvelope,
networkPassphrase: string
): Transaction | FeeBumpTransaction;

}

export namespace TransactionBuilder {
Expand Down
6 changes: 4 additions & 2 deletions types/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,13 @@ const transaction = new StellarSdk.TransactionBuilder(account, {
minAmountA: "10000",
minAmountB: "20000",
})
).addOperation(
).addOperationAt(
StellarSdk.Operation.setOptions({
setFlags: (StellarSdk.AuthImmutableFlag | StellarSdk.AuthRequiredFlag) as StellarSdk.AuthFlag,
clearFlags: (StellarSdk.AuthRevocableFlag | StellarSdk.AuthClawbackEnabledFlag) as StellarSdk.AuthFlag,
})
}),
0
).clearOperationAt(2
).addMemo(new StellarSdk.Memo(StellarSdk.MemoText, 'memo'))
.setTimeout(5)
.setTimebounds(Date.now(), Date.now() + 5000)
Expand Down

0 comments on commit ed89fec

Please sign in to comment.