chore: assert amulet.admin is present before building commands that need it (#2326)
* Assert amulet.admin is present before building commands that need it fetchAmulet() returns AssetBody with admin: PartyId typed as always present, but parseAssets does no runtime validation of the registry response it comes from. Three call sites (preapproval create command, traffic buyMemberTraffic, namespace tap) pass amulet.admin straight into ledger commands unchecked -- if a registry response is missing it, this silently builds a command (e.g. transfer preapproval) with an undefined expectedDso instead of failing loudly. Add one guard in fetchAmulet() that protects all three call sites. Fixes #1797 Signed-off-by: ayushsingh82 <ayushsinghmi711@gmail.com> * Move admin (DSO) party validation into parseAssets Validating the registry response's admin field in fetchAmulet() only covered the amulet call site. parseAssets is the shared function that converts raw registry data into AssetBody for all callers (amulet, token transfer, token utxos), so the guard belongs there instead. Adds a unit test covering the missing-admin case. Signed-off-by: ayushsingh82 <ayushsinghmi711@gmail.com> * Add explicit return type to parseAssets Address review feedback: annotate the return type as AssetBody[] instead of relying on inference. Signed-off-by: ayushsingh82 <ayushsinghmi711@gmail.com> --------- Signed-off-by: ayushsingh82 <ayushsinghmi711@gmail.com> Co-authored-by: rukmini-basu-da <126689545+rukmini-basu-da@users.noreply.github.com>
A
Ayush Singh committed
346463ab2daa9303e857130765df4467e0ce1315
Parent: cbe69bf
Committed by GitHub <noreply@github.com>
on 8/25/2026, 6:06:41 PM