Skip to content

Commit

Permalink
Start outerEnums population
Browse files Browse the repository at this point in the history
  • Loading branch information
jacogr committed Aug 29, 2023
1 parent 5334c1e commit 6cd341c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
6 changes: 3 additions & 3 deletions packages/types/src/interfaces/metadata/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -314,9 +314,9 @@ export interface OpaqueMetadata extends WrapperOpaque<Bytes> {}

/** @name OuterEnums15 */
export interface OuterEnums15 extends Struct {
readonly callEnumType: SiLookupTypeId;
readonly eventEnumType: SiLookupTypeId;
readonly errorEnumType: SiLookupTypeId;
readonly callType: SiLookupTypeId;
readonly eventType: SiLookupTypeId;
readonly errorType: SiLookupTypeId;
}

/** @name PalletCallMetadataLatest */
Expand Down
6 changes: 3 additions & 3 deletions packages/types/src/interfaces/metadata/v15.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ export const v15: DefinitionsTypes = {
signedExtensions: 'Vec<SignedExtensionMetadataV14>'
},
OuterEnums15: {
callEnumType: 'SiLookupTypeId',
eventEnumType: 'SiLookupTypeId',
errorEnumType: 'SiLookupTypeId'
callType: 'SiLookupTypeId',
eventType: 'SiLookupTypeId',
errorType: 'SiLookupTypeId'
},
PalletMetadataV15: {
name: 'Text',
Expand Down
24 changes: 12 additions & 12 deletions packages/types/src/metadata/v14/toV15.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,25 @@ export function toV15 (registry: Registry, v14: MetadataV14, _: number): Metadat

// We need the UncheckedExtrinsic to extract the types, at least for v14
// which does have these details embedded (previous-gen won't populate)
const unchecked = v14.lookup.types
.find(({ type: { path } }) =>
path.join('::') === 'sp_runtime::generic::unchecked_extrinsic::UncheckedExtrinsic'
)
?.type.params.map(({ type }) =>
type.unwrapOr(0)
);
const unchecked = v14.lookup.types.find(({ type: { path } }) =>
path.join('::') === 'sp_runtime::generic::unchecked_extrinsic::UncheckedExtrinsic'
);

return registry.createTypeUnsafe('MetadataV15', [
unchecked
? objectSpread({}, v14, {
extrinsic: registry.createTypeUnsafe('ExtrinsicMetadataV15', [
objectSpread({}, v14.extrinsic, {
addressType: unchecked[0],
callType: unchecked[1],
extraType: unchecked[3],
signatureType: unchecked[2]
addressType: unchecked.type.params[0].type.unwrapOr(0),
callType: unchecked.type.params[1].type.unwrapOr(0),
extraType: unchecked.type.params[3].type.unwrapOr(0),
signatureType: unchecked.type.params[2].type.unwrapOr(0)
})
])
]),
outerEnums: registry.createTypeUnsafe('OuterEnums15', [{
callType: unchecked.type.params[1].type.unwrapOr(0)
// FIXME We need to add the eventType & errorType in here
}])
})
: v14
]);
Expand Down

0 comments on commit 6cd341c

Please sign in to comment.