PKG -- [sdk] Restore previous account resolution ordering #1910
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #1818
This restores the old behaviour which influenced ordering of account resolution in the SDK before #1532. Essentially, the currentUser account ended up always being resolved in the second
collectAccounts
call, after all of the other accounts (i.e. custom authz functions) had been resolved in the first call.fcl-js/packages/sdk/src/resolve/resolve-accounts.js
Lines 132 to 133 in 99e03af
This nuance made a guarantee that the custom authz functions would resolve first, and that the
pre-authz
service would always know addresses resolved by the custom authz function.IMO we should avoid exposing addresses/keyIds to
pre-authz
anyways and shouldn't be giving any guarnatee on ordering here as it's prone to error and only held together by a nuance of the design (how can we even guarantee whose authz function runs first? which gets priority?) - but this is a separate issue and the goal here is to restore functionality.