Skip to content

Commit

Permalink
fix: default auth entry sig expiration to 5-10min
Browse files Browse the repository at this point in the history
Fixes #983
  • Loading branch information
chadoh committed Sep 9, 2024
1 parent 5bb10f6 commit ae863aa
Showing 1 changed file with 3 additions and 16 deletions.
19 changes: 3 additions & 16 deletions src/contract/assembled_transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -698,19 +698,6 @@ export class AssembledTransaction<T> {
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.
Expand Down Expand Up @@ -793,15 +780,15 @@ export class AssembledTransaction<T> {
* 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<number>;
/**
Expand Down

0 comments on commit ae863aa

Please sign in to comment.