Skip to content

Commit

Permalink
Remove references to supported chainID
Browse files Browse the repository at this point in the history
  • Loading branch information
theref committed Dec 16, 2024
1 parent a2ebaba commit 1c286e3
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 20 deletions.
4 changes: 1 addition & 3 deletions packages/taco/src/conditions/base/rpc.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
import { z } from 'zod';

import { Condition } from '../condition';
import { SUPPORTED_CHAIN_IDS } from '../const';
import {
EthAddressOrUserAddressSchema,
OmitConditionType,
paramOrContextParamSchema,
returnValueTestSchema,
} from '../shared';
import createUnionSchema from '../zod';

export const RpcConditionType = 'rpc';

export const rpcConditionSchema = z.object({
conditionType: z.literal(RpcConditionType).default(RpcConditionType),
chain: createUnionSchema(SUPPORTED_CHAIN_IDS),
chain: z.number(),
method: z.enum(['eth_getBalance']),
parameters: z.union([
z.array(EthAddressOrUserAddressSchema).nonempty(),
Expand Down
8 changes: 0 additions & 8 deletions packages/taco/src/conditions/const.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { ChainId } from '@nucypher/shared';
import {
USER_ADDRESS_PARAM_DEFAULT,
USER_ADDRESS_PARAM_EXTERNAL_EIP4361,
Expand All @@ -9,13 +8,6 @@ export const CONTEXT_PARAM_REGEXP = new RegExp('^:[a-zA-Z_][a-zA-Z0-9_]*$');

export const CONTEXT_PARAM_PREFIX = ':';

export const SUPPORTED_CHAIN_IDS = [
ChainId.POLYGON,
ChainId.AMOY,
ChainId.SEPOLIA,
ChainId.ETHEREUM_MAINNET,
];

export const USER_ADDRESS_PARAMS = [
USER_ADDRESS_PARAM_EXTERNAL_EIP4361,
// Ordering matters, this should always be last
Expand Down
4 changes: 2 additions & 2 deletions packages/taco/test/conditions/compound-condition.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { ChainId } from '@nucypher/shared';
import { describe, expect, it } from 'vitest';

import { ContractCondition } from '../../src/conditions/base/contract';
Expand All @@ -8,7 +9,6 @@ import {
compoundConditionSchema,
CompoundConditionType,
} from '../../src/conditions/compound-condition';
import { SUPPORTED_CHAIN_IDS } from '../../src/conditions/const';
import {
testContractConditionObj,
testRpcConditionObj,
Expand Down Expand Up @@ -135,7 +135,7 @@ describe('validation', () => {
const multichainCondition: CompoundConditionProps = {
conditionType: CompoundConditionType,
operator: 'and',
operands: SUPPORTED_CHAIN_IDS.map((chain) => ({
operands: [ChainId.SEPOLIA, ChainId.AMOY].map((chain) => ({
...testRpcConditionObj,
chain,
})),
Expand Down
7 changes: 0 additions & 7 deletions packages/taco/test/conditions/conditions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { beforeAll, describe, expect, it } from 'vitest';

import { initialize } from '../../src';
import { CompoundCondition } from '../../src/conditions/compound-condition';
import { SUPPORTED_CHAIN_IDS } from '../../src/conditions/const';
import { ConditionContext } from '../../src/conditions/context';

describe('conditions', () => {
Expand Down Expand Up @@ -53,10 +52,4 @@ describe('conditions', () => {
expect(asObj).toBeDefined();
expect(asObj[':time']).toBe(100);
});

it('has supported chains consistent with shared', async () => {
const chainIdsAndNames = Object.values(ChainId);
const chainIds = chainIdsAndNames.filter((id) => typeof id === 'number');
expect(SUPPORTED_CHAIN_IDS).toEqual(chainIds);
});
});

0 comments on commit 1c286e3

Please sign in to comment.