fcl-js
fcl-js copied to clipboard
PKG -- [sdk] Restore previous account resolution ordering
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.
https://github.com/onflow/fcl-js/blob/99e03af76e526593e5c989e43754ce23420e317f/packages/sdk/src/resolve/resolve-accounts.js#L132-L133
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.