Prepare for swap to global V2 weight defs (#5280)

This commit is contained in:
Jaco
2022-10-20 11:46:23 +03:00
committed by GitHub
parent 5bd2a664ec
commit 40393ddc1e
@@ -430,12 +430,13 @@ function registerTypes (lookup: PortableRegistry, lookups: Record<string, string
const weightDef = lookup.getTypeDef(`Lookup${weight[0]}`);
// we have a complex structure
if (Array.isArray(weightDef.sub) && weightDef.sub.length !== 1) {
lookup.registry.register({
Weight: 'SpWeightsWeightV2Weight'
});
}
lookup.registry.register({
Weight: Array.isArray(weightDef.sub) && weightDef.sub.length !== 1
// we have a complex structure
? 'SpWeightsWeightV2Weight'
// single entry, fallback to weight V1
: 'WeightV1'
});
}
}