Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: allow either boolean value for nonParticipation offline keyregs #866

Merged
merged 2 commits into from
Apr 25, 2024

Conversation

joe-p
Copy link
Contributor

@joe-p joe-p commented Apr 25, 2024

Fixes a bug in the typing that would make the user think they need to set nonParticipation to true.

Also removed nonParticipation: true from the example file.

Current behavior

  algosdk.makeKeyRegistrationTxnWithSuggestedParams(
    addr,
    undefined,
    undefined,
    undefined,
    undefined,
    undefined,
    undefined,
    suggestedParams,
    undefined,
    false,
    undefined
  )
No overload matches this call.
  Overload 1 of 2, '(from: string, note: Uint8Array | undefined, voteKey: string | Uint8Array, selectionKey: string | Uint8Array, voteFirst: number, voteLast: number, voteKeyDilution: number, suggestedParams: SuggestedParams, rekeyTo?: string | undefined, nonParticipation?: false | undefined, stateProofKey?: string | ... 1 more ... | undefined): Transaction', gave the following error.
    Argument of type 'undefined' is not assignable to parameter of type 'string | Uint8Array'.
  Overload 2 of 2, '(from: string, note: Uint8Array | undefined, voteKey: undefined, selectionKey: undefined, voteFirst: undefined, voteLast: undefined, voteKeyDilution: undefined, suggestedParams: SuggestedParams, rekeyTo?: string | undefined, nonParticipation?: true | undefined, stateProofKey?: undefined): Transaction', gave the following error.
    Argument of type 'false' is not assignable to parameter of type 'true'.ts(2769)
makeTxn.ts(141, 17): The call would have succeeded against this implementation, but implementation signatures of overloads are not externally visible.

New Behavior

  algosdk.makeKeyRegistrationTxnWithSuggestedParams(
    addr,
    undefined,
    undefined,
    undefined,
    undefined,
    undefined,
    undefined,
    suggestedParams,
    undefined,
    false,
    undefined
  )

No error displayed

Copy link
Contributor

@jasonpaulos jasonpaulos left a comment

Choose a reason for hiding this comment

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

Nice catch, this looks like a good improvement

@jasonpaulos jasonpaulos merged commit 981905a into algorand:develop Apr 25, 2024
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants