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

docs: make the comments on using the new confirmTransaction clearer #29251

Merged
merged 5 commits into from
Dec 19, 2022

Conversation

GHesericsu
Copy link
Contributor

Problem

Connection.confirmTransaction using TransactionSignature is deprecated but the docs comment on using the new confirmTransaction wasn't clear

Summary of Changes

Clearer comment on using the new confirmTransaction method

Fixes #

@github-actions github-actions bot added the web3.js Related to the JavaScript client label Dec 14, 2022
@mergify mergify bot added the community Community contribution label Dec 14, 2022
@mergify mergify bot requested a review from a team December 14, 2022 01:52
@@ -3603,7 +3603,7 @@ export class Connection {
commitment?: Commitment,
): Promise<RpcResponseAndContext<SignatureResult>>;

/** @deprecated Instead, call `confirmTransaction` using a `TransactionConfirmationConfig` */
/** @deprecated Instead, call `confirmTransaction` and pass in `BlockheightBasedTransactionConfirmationStrategy` or `DurableNonceTransactionConfirmationStrategy` */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, one thing that this introduces is the possibility that – when we add a third strategy – someone could forget to update this comment.

Does this work?

  1. Extract BlockheightBasedTransactionConfirmationStrategy | DurableNonceTransactionConfirmationStrategy into a union type called TransactionConfirmationStrategy.
  2. Refer to it here using {@link TransactionConfirmationStrategy}

I think that should make the docs autolink to that type, where folks can see the up-to-date list of strategies.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @steveluscher thanks for the suggestion. I updated the PR. Hope this works. My comment describing TransactionConfirmationStrategy may need work. Thanks.

@steveluscher
Copy link
Contributor

Thanks for the submission!

@mergify mergify bot dismissed steveluscher’s stale review December 19, 2022 18:07

Pull request has been modified.

commitment?: Commitment,
): Promise<RpcResponseAndContext<SignatureResult>>;

/** @deprecated Instead, call `confirmTransaction` using a `TransactionConfirmationConfig` */
/** @deprecated Instead, call `confirmTransaction` and pass in {@link TransactionConfirmationStrategy} @ */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does the trailing @ do here? Was that an accident?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah typo. Fixed.

* @param {ConfirmOptions} [options]
* @returns {Promise<TransactionSignature>}
*/
export async function sendAndConfirmRawTransaction(
connection: Connection,
rawTransaction: Buffer,
confirmationStrategy: BlockheightBasedTransactionConfirmationStrategy,
confirmationStrategy: TransactionConfirmationStrategy,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ooh, nice. You found a bug!

@codecov
Copy link

codecov bot commented Dec 19, 2022

Codecov Report

Merging #29251 (5d9e2ff) into master (456a819) will increase coverage by 0.1%.
The diff coverage is 100.0%.

@@            Coverage Diff            @@
##           master   #29251     +/-   ##
=========================================
+ Coverage    76.4%    76.5%   +0.1%     
=========================================
  Files          54       54             
  Lines        3120     3120             
  Branches      468      468             
=========================================
+ Hits         2385     2389      +4     
+ Misses        571      567      -4     
  Partials      164      164             

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
community Community contribution web3.js Related to the JavaScript client
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants