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: improve MessageV0.getAccountKeys API ergonomics #28042

Merged
merged 1 commit into from Sep 24, 2022

Conversation

jstarry
Copy link
Member

@jstarry jstarry commented Sep 24, 2022

Problem

The ergonomics of MessageV0.getAcccountKeys isn't great when writing code that can handle legacy or v0 messages:

const accountKeysFromLookups = txWithMeta.meta?.loadedAddresses;
const accountKeys = message.getAccountKeys(accountKeysFromLookups && {
  accountKeysFromLookups,
});

Summary of Changes

Allow args in GetAccountKeysArgs to be undefined or null for improved ergonomics:

const accountKeys = message.getAccountKeys({
  accountKeysFromLookups: txWithMeta.meta?.loadedAddresses,
});

Fixes #

@jstarry jstarry added the automerge Merge this Pull Request automatically once CI passes label Sep 24, 2022
@codecov
Copy link

codecov bot commented Sep 24, 2022

Codecov Report

Merging #28042 (4ff5186) into master (e6687b8) will increase coverage by 0.3%.
The diff coverage is 97.0%.

@@            Coverage Diff            @@
##           master   #28042     +/-   ##
=========================================
+ Coverage    77.3%    77.6%   +0.3%     
=========================================
  Files          55       55             
  Lines        2889     2918     +29     
  Branches      402      406      +4     
=========================================
+ Hits         2234     2267     +33     
+ Misses        514      510      -4     
  Partials      141      141             

@mergify mergify bot merged commit 7810387 into solana-labs:master Sep 24, 2022
@jstarry jstarry deleted the web3/get-account-keys-dev-x branch September 24, 2022 05:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge Merge this Pull Request automatically once CI passes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant