Skip to content
This repository was archived by the owner on Jan 22, 2025. It is now read-only.
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: solana-labs/solana-web3.js
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.47.2
Choose a base ref
...
head repository: solana-labs/solana-web3.js
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v1.47.3
Choose a head ref
  • 2 commits
  • 2 files changed
  • 1 contributor

Commits on Jul 2, 2022

  1. Copy the full SHA
    88a5d74 View commit details
  2. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    0d598b7 View commit details
Showing with 26 additions and 19 deletions.
  1. +8 −9 src/connection.ts
  2. +18 −10 src/transaction.ts
17 changes: 8 additions & 9 deletions src/connection.ts
Original file line number Diff line number Diff line change
@@ -3051,15 +3051,6 @@ export class Connection {
}
});

const checkBlockHeight = async () => {
try {
const blockHeight = await this.getBlockHeight(commitment);
return blockHeight;
} catch (_e) {
return -1;
}
};

const expiryPromise = new Promise<
| {__type: TransactionStatus.BLOCKHEIGHT_EXCEEDED}
| {__type: TransactionStatus.TIMED_OUT; timeoutMs: number}
@@ -3088,6 +3079,14 @@ export class Connection {
} else {
let config =
strategy as BlockheightBasedTransactionConfirmationStrategy;
const checkBlockHeight = async () => {
try {
const blockHeight = await this.getBlockHeight(commitment);
return blockHeight;
} catch (_e) {
return -1;
}
};
(async () => {
let currentBlockHeight = await checkBlockHeight();
if (done) return;
28 changes: 18 additions & 10 deletions src/transaction.ts
Original file line number Diff line number Diff line change
@@ -258,17 +258,25 @@ export class Transaction {
) {
if (!opts) {
return;
} else if (
Object.prototype.hasOwnProperty.call(opts, 'lastValidBlockHeight')
) {
const newOpts = opts as TransactionBlockhashCtor;
Object.assign(this, newOpts);
this.recentBlockhash = newOpts.blockhash;
this.lastValidBlockHeight = newOpts.lastValidBlockHeight;
}
if (opts.feePayer) {
this.feePayer = opts.feePayer;
}
if (opts.signatures) {
this.signatures = opts.signatures;
}
if (Object.prototype.hasOwnProperty.call(opts, 'lastValidBlockHeight')) {
const {blockhash, lastValidBlockHeight} =
opts as TransactionBlockhashCtor;
this.recentBlockhash = blockhash;
this.lastValidBlockHeight = lastValidBlockHeight;
} else {
const oldOpts = opts as TransactionCtorFields_DEPRECATED;
Object.assign(this, oldOpts);
this.recentBlockhash = oldOpts.recentBlockhash;
const {recentBlockhash, nonceInfo} =
opts as TransactionCtorFields_DEPRECATED;
if (nonceInfo) {
this.nonceInfo = nonceInfo;
}
this.recentBlockhash = recentBlockhash;
}
}