Skip to content

Commit

Permalink
use map for supported chains
Browse files Browse the repository at this point in the history
  • Loading branch information
coffeexcoin committed Oct 1, 2024
1 parent 5fd7990 commit 398c5a5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/agw-client/src/actions/verifyHash.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ import { getAction } from 'viem/utils';
import UniversalSignatureValidatorAbi from '../abis/UniversalSigValidator.js';
import { UNIVERSAL_SIGNATURE_VALIDATOR_ADDRESS } from '../constants.js';

Check warning on line 28 in packages/agw-client/src/actions/verifyHash.ts

View check run for this annotation

Codecov / codecov/patch

packages/agw-client/src/actions/verifyHash.ts#L27-L28

Added lines #L27 - L28 were not covered by tests

const supportedChains: (number | undefined)[] = [abstractTestnet.id];
const supportedChains: Record<number, Chain> = {
[abstractTestnet.id]: abstractTestnet,
};

Check warning on line 32 in packages/agw-client/src/actions/verifyHash.ts

View check run for this annotation

Codecov / codecov/patch

packages/agw-client/src/actions/verifyHash.ts#L30-L32

Added lines #L30 - L32 were not covered by tests

/**
* Verifies a message hash onchain using ERC-6492.
Expand All @@ -43,7 +45,7 @@ export async function verifyHash<chain extends Chain>(
const { address, factory, factoryData, hash, signature, ...rest } =
parameters;

Check warning on line 46 in packages/agw-client/src/actions/verifyHash.ts

View check run for this annotation

Codecov / codecov/patch

packages/agw-client/src/actions/verifyHash.ts#L41-L46

Added lines #L41 - L46 were not covered by tests

if (!supportedChains.includes(client.chain.id)) {
if (!supportedChains[client.chain.id]) {
return await viemVerifyHash(client, parameters);
}

Check warning on line 50 in packages/agw-client/src/actions/verifyHash.ts

View check run for this annotation

Codecov / codecov/patch

packages/agw-client/src/actions/verifyHash.ts#L48-L50

Added lines #L48 - L50 were not covered by tests

Expand Down

0 comments on commit 398c5a5

Please sign in to comment.