Skip to content

Commit

Permalink
Fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
yorhodes committed May 3, 2024
1 parent 8f4a214 commit f115d48
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 9 deletions.
22 changes: 16 additions & 6 deletions typescript/sdk/src/ism/metadata/aggregation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import { AggregationIsmConfig } from '../types.js';

import { BaseMetadataBuilder, MetadataBuilder } from './builder.js';

// null indicates that metadata is NOT INCLUDED for this submodule
// empty or 0x string indicates that metadata is INCLUDED but NULL
export interface AggregationIsmMetadata {
submoduleMetadata: Array<string | null>;
}
Expand All @@ -20,16 +22,24 @@ export class AggregationIsmMetadataBuilder

async build(
message: DispatchedMessage,
ismConfig: WithAddress<AggregationIsmConfig>,
config: WithAddress<AggregationIsmConfig>,
): Promise<string> {
const metadatas = await Promise.all(
ismConfig.modules.map((module) =>
const results = await Promise.allSettled(
config.modules.map((module) =>
this.base.build(message, module as DerivedIsmConfigWithAddress),
),
);
return AggregationIsmMetadataBuilder.encode({
submoduleMetadata: metadatas,
});
const submoduleMetadata = results.map((r) =>
r.status === 'fulfilled' ? r.value : null,
);
const included = submoduleMetadata.filter((m) => m !== null).length;
if (included < config.threshold) {
throw new Error(
`Only built ${included} of ${config.threshold} required modules`,
);
}

return AggregationIsmMetadataBuilder.encode({ submoduleMetadata });
}

static rangeIndex(index: number): number {
Expand Down
4 changes: 2 additions & 2 deletions typescript/sdk/src/ism/metadata/multisig.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ const fixtures: Fixture[] = files
.map((contents) => {
const type = contents.type as MultisigMetadata['type'];

const { dummy, ...signatureValues } = contents.signatures;
const { dummy: _dummy, ...signatureValues } = contents.signatures;
const signatures = Object.values<SignatureLike>(signatureValues);

let decoded: MultisigMetadata;
if (type === ModuleType.MERKLE_ROOT_MULTISIG) {
const { dummy, ...branchValues } = contents.prefix.proof;
const { dummy: _dummy, ...branchValues } = contents.prefix.proof;
const branch = Object.values<string>(branchValues);
decoded = {
type,
Expand Down
2 changes: 1 addition & 1 deletion typescript/sdk/src/ism/metadata/multisig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ export class MultisigMetadataBuilder
metadata: string,
type: ModuleType.MERKLE_ROOT_MULTISIG | ModuleType.MESSAGE_ID_MULTISIG,
): MultisigMetadata {
const prefix =
const prefix: any =
type === ModuleType.MERKLE_ROOT_MULTISIG
? this.decodeProofPrefix(metadata)
: this.decodeSimplePrefix(metadata);
Expand Down

0 comments on commit f115d48

Please sign in to comment.