From ae863aaecf8679d1dfbbbc5cd140e5c5f4654c5e Mon Sep 17 00:00:00 2001 From: Chad Ostrowski <221614+chadoh@users.noreply.github.com> Date: Tue, 30 Jul 2024 14:26:27 -0400 Subject: [PATCH] fix: default auth entry sig expiration to 5-10min Fixes #983 --- src/contract/assembled_transaction.ts | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/src/contract/assembled_transaction.ts b/src/contract/assembled_transaction.ts index aca36910e..aa859dace 100644 --- a/src/contract/assembled_transaction.ts +++ b/src/contract/assembled_transaction.ts @@ -698,19 +698,6 @@ export class AssembledTransaction { return this.send(); }; - private getStorageExpiration = async () => { - const entryRes = await this.server.getLedgerEntries( - new Contract(this.options.contractId).getFootprint() - ); - if ( - !entryRes.entries || - !entryRes.entries.length || - !entryRes.entries[0].liveUntilLedgerSeq - ) - throw new Error("failed to get ledger entry"); - return entryRes.entries[0].liveUntilLedgerSeq; - }; - /** * Get a list of accounts, other than the invoker of the simulation, that * need to sign auth entries in this transaction. @@ -793,15 +780,15 @@ export class AssembledTransaction { * currently supported! */ signAuthEntries = async ({ - expiration = this.getStorageExpiration(), + expiration = (async () => + (await this.server.getLatestLedger()).sequence + 100)(), signAuthEntry = this.options.signAuthEntry, publicKey = this.options.publicKey, }: { /** * When to set each auth entry to expire. Could be any number of blocks in * the future. Can be supplied as a promise or a raw number. Default: - * contract's current `persistent` storage expiration date/ledger - * number/block. + * about 8.3 minutes from now. */ expiration?: number | Promise; /**