From 2fa83e41166732af127f23919386d2641cbc7ce0 Mon Sep 17 00:00:00 2001 From: George Date: Wed, 7 Aug 2024 19:53:49 -0700 Subject: [PATCH 1/4] Fix missing methods in TypeScript defs --- types/index.d.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/types/index.d.ts b/types/index.d.ts index 61069c78..1f726764 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -1019,6 +1019,7 @@ export class FeeBumpTransaction extends TransactionI { ); feeSource: string; innerTransaction: Transaction; + get operations(): Operation[]; } export class Transaction< @@ -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; @@ -1085,6 +1088,7 @@ export class TransactionBuilder { envelope: string | xdr.TransactionEnvelope, networkPassphrase: string ): Transaction | FeeBumpTransaction; + } export namespace TransactionBuilder { From ee78e6029a636da32df595418352ff69155e051c Mon Sep 17 00:00:00 2001 From: George Date: Wed, 7 Aug 2024 19:54:20 -0700 Subject: [PATCH 2/4] Add changelog entry --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 93e1e8bc..1d28a02b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## Unreleased +### Fixed +* Add missing methods to TypeScript definitions ([]()). + ## [`v12.1.0`](https://github.com/stellar/js-stellar-base/compare/v12.0.1...v12.1.0) From d5569a38ab973384622c2f2442622be361e60ff6 Mon Sep 17 00:00:00 2001 From: George Date: Wed, 7 Aug 2024 19:55:34 -0700 Subject: [PATCH 3/4] Fixup changelog link --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1d28a02b..26b228c1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ ## Unreleased ### Fixed -* Add missing methods to TypeScript definitions ([]()). +* Add missing methods to TypeScript definitions ([#766](https://github.com/stellar/js-stellar-base/pull/766)). ## [`v12.1.0`](https://github.com/stellar/js-stellar-base/compare/v12.0.1...v12.1.0) From c5c5f9b5984615f340ce90901d23b320e85b165c Mon Sep 17 00:00:00 2001 From: George Date: Tue, 27 Aug 2024 14:03:07 -0700 Subject: [PATCH 4/4] Add typing fixups to ensure new functions are typed right --- types/test.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/types/test.ts b/types/test.ts index 2b5fcb4c..f54cd8ba 100644 --- a/types/test.ts +++ b/types/test.ts @@ -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)