diff --git a/bin/app.ts b/bin/app.ts index 7eae226d..919eba04 100644 --- a/bin/app.ts +++ b/bin/app.ts @@ -330,6 +330,7 @@ Object.values(SUPPORTED_CHAINS).forEach((chainId) => { envVars['RPC_TENDERLY'] = process.env[`RPC_TENDERLY`] || '' envVars['RPC_1'] = process.env[`RPC_1`] || '' envVars['RPC_8453'] = process.env[`RPC_8453`] || '' +envVars['RPC_130'] = process.env[`RPC_130`] || '' envVars['DL_REACTOR_TENDERLY'] = process.env[`DL_REACTOR_TENDERLY`] || '' envVars['QUOTER_TENDERLY'] = process.env[`QUOTER_TENDERLY`] || '' envVars['PERMIT2_TENDERLY'] = process.env[`PERMIT2_TENDERLY`] || '' diff --git a/lib/handlers/check-order-status/util.ts b/lib/handlers/check-order-status/util.ts index c41fd1d1..03f4420f 100644 --- a/lib/handlers/check-order-status/util.ts +++ b/lib/handlers/check-order-status/util.ts @@ -248,6 +248,8 @@ export const AVERAGE_BLOCK_TIME = (chainId: ChainId): number => { return 12 case ChainId.ARBITRUM_ONE: return 1 + case ChainId.UNICHAIN: + return 1 case ChainId.BASE: return 2 case ChainId.POLYGON: diff --git a/lib/util/chain.ts b/lib/util/chain.ts index 01b00653..bf127222 100644 --- a/lib/util/chain.ts +++ b/lib/util/chain.ts @@ -1,5 +1,6 @@ export enum ChainId { MAINNET = 1, + UNICHAIN = 130, BASE = 8453, OPTIMISM = 10, ARBITRUM_ONE = 42161, @@ -17,4 +18,5 @@ export const SUPPORTED_CHAINS = [ ChainId.GĂ–RLI, ChainId.ARBITRUM_ONE, ChainId.BASE, + ChainId.UNICHAIN, ] diff --git a/test/integ/repositories/dynamo-repository.test.ts b/test/integ/repositories/dynamo-repository.test.ts index 68a9f051..9622c996 100644 --- a/test/integ/repositories/dynamo-repository.test.ts +++ b/test/integ/repositories/dynamo-repository.test.ts @@ -142,6 +142,12 @@ const PRIORITY_ORDER_1 = { cosigner: '0xsigner', } +const PRIORITY_ORDER_2 = { + ...PRIORITY_ORDER_1, + chainId: 130, + orderHash: '0x12', +} + const DUTCHV3_1 = { orderHash: '0x42161', offerer: '0xmaker', @@ -195,6 +201,7 @@ describe('OrdersRepository put item test', () => { expect(() => { mockTime(1) ordersRepository.putOrderAndUpdateNonceTransaction(PRIORITY_ORDER_1 as unknown as UniswapXOrderEntity) + ordersRepository.putOrderAndUpdateNonceTransaction(PRIORITY_ORDER_2 as unknown as UniswapXOrderEntity) }).not.toThrow() }) @@ -248,10 +255,11 @@ describe('OrdersRepository getOrders test', () => { it('should successfully get orders given an orderStatus', async () => { const queryResult = await ordersRepository.getOrders(10, { orderStatus: ORDER_STATUS.OPEN }) - expect(queryResult.orders).toHaveLength(4) + expect(queryResult.orders).toHaveLength(5) expect(queryResult.orders).toContainEqual(expect.objectContaining(MOCK_ORDER_1)) expect(queryResult.orders).toContainEqual(expect.objectContaining(MOCK_ORDER_2)) expect(queryResult.orders).toContainEqual(expect.objectContaining(PRIORITY_ORDER_1)) + expect(queryResult.orders).toContainEqual(expect.objectContaining(PRIORITY_ORDER_2)) expect(queryResult.orders).toContainEqual(expect.objectContaining(DUTCHV3_1)) }) @@ -435,10 +443,10 @@ describe('OrdersRepository getOrders test with pagination', () => { let orders = await ordersRepository.getOrders(1, { orderStatus: ORDER_STATUS.OPEN }) expect(orders.orders).toHaveLength(1) allOrders = allOrders.concat(orders.orders) - orders = await ordersRepository.getOrders(4, { orderStatus: ORDER_STATUS.OPEN }, orders.cursor) - expect(orders.orders).toHaveLength(3) + orders = await ordersRepository.getOrders(5, { orderStatus: ORDER_STATUS.OPEN }, orders.cursor) + expect(orders.orders).toHaveLength(4) allOrders = allOrders.concat(orders.orders) - expect(allOrders).toHaveLength(4) + expect(allOrders).toHaveLength(5) expect(allOrders).toContainEqual(expect.objectContaining(MOCK_ORDER_1)) expect(allOrders).toContainEqual(expect.objectContaining(MOCK_ORDER_2)) expect(allOrders).toContainEqual(expect.objectContaining(DUTCHV3_1)) @@ -468,22 +476,24 @@ describe('OrdersRepository getOrders test with pagination', () => { }) it('should throw an Error for cursor with the wrong index', async () => { - const orders = await ordersRepository.getOrders(3, { orderStatus: ORDER_STATUS.OPEN }) - expect(orders.orders).toHaveLength(3) + const orders = await ordersRepository.getOrders(4, { orderStatus: ORDER_STATUS.OPEN }) + expect(orders.orders).toHaveLength(4) expect(orders.orders).toContainEqual(expect.objectContaining(MOCK_ORDER_5)) expect(orders.orders).toContainEqual(expect.objectContaining(DUTCHV3_1)) expect(orders.orders).toContainEqual(expect.objectContaining(PRIORITY_ORDER_1)) + expect(orders.orders).toContainEqual(expect.objectContaining(PRIORITY_ORDER_2)) await expect(() => ordersRepository.getOrders(0, { offerer: 'riley.eth' }, orders.cursor)).rejects.toThrow( Error('Invalid cursor.') ) }) it('should throw an Error for cursor with the wrong cursor', async () => { - const orders = await ordersRepository.getOrders(3, { orderStatus: ORDER_STATUS.OPEN }) - expect(orders.orders).toHaveLength(3) + const orders = await ordersRepository.getOrders(4, { orderStatus: ORDER_STATUS.OPEN }) + expect(orders.orders).toHaveLength(4) expect(orders.orders).toContainEqual(expect.objectContaining(MOCK_ORDER_5)) expect(orders.orders).toContainEqual(expect.objectContaining(DUTCHV3_1)) expect(orders.orders).toContainEqual(expect.objectContaining(PRIORITY_ORDER_1)) + expect(orders.orders).toContainEqual(expect.objectContaining(PRIORITY_ORDER_2)) await expect(() => ordersRepository.getOrders(0, { offerer: 'riley.eth' }, 'wrong_cursor')).rejects.toThrow( Error('Invalid cursor.') ) @@ -536,11 +546,12 @@ describe('OrdersRepository getOrders test with sorting', () => { sort: 'between(1,3)', desc: true, }) - expect(queryResult.orders).toHaveLength(5) + expect(queryResult.orders).toHaveLength(6) expect(queryResult.orders).toContainEqual(expect.objectContaining(MOCK_ORDER_2)) expect(queryResult.orders).toContainEqual(expect.objectContaining(MOCK_ORDER_1)) expect(queryResult.orders).toContainEqual(expect.objectContaining(MOCK_ORDER_5)) expect(queryResult.orders).toContainEqual(expect.objectContaining(PRIORITY_ORDER_1)) + expect(queryResult.orders).toContainEqual(expect.objectContaining(PRIORITY_ORDER_2)) expect(queryResult.orders).toContainEqual(expect.objectContaining(DUTCHV3_1)) }) @@ -551,13 +562,13 @@ describe('OrdersRepository getOrders test with sorting', () => { sort: 'between(1,3)', desc: false, }) - expect(queryResult.orders).toHaveLength(5) - expect(queryResult.orders[0]).toEqual(expect.objectContaining(MOCK_ORDER_5)) - expect(queryResult.orders[1]).toEqual(expect.objectContaining(PRIORITY_ORDER_1)) - expect(queryResult.orders[2]).toEqual(expect.objectContaining(DUTCHV3_1)) - expect(queryResult.orders[3]).toEqual(expect.objectContaining(MOCK_ORDER_1)) - expect(queryResult.orders[4]).toEqual(expect.objectContaining(MOCK_ORDER_2)) - + expect(queryResult.orders).toHaveLength(6) + expect(queryResult.orders[0]).toEqual(expect.objectContaining(PRIORITY_ORDER_2)) + expect(queryResult.orders[1]).toEqual(expect.objectContaining(MOCK_ORDER_5)) + expect(queryResult.orders[2]).toEqual(expect.objectContaining(PRIORITY_ORDER_1)) + expect(queryResult.orders[3]).toEqual(expect.objectContaining(DUTCHV3_1)) + expect(queryResult.orders[4]).toEqual(expect.objectContaining(MOCK_ORDER_1)) + expect(queryResult.orders[5]).toEqual(expect.objectContaining(MOCK_ORDER_2)) }) }) diff --git a/test/unit/fixtures.ts b/test/unit/fixtures.ts index e5c6e9a6..6b7daa03 100644 --- a/test/unit/fixtures.ts +++ b/test/unit/fixtures.ts @@ -60,6 +60,12 @@ export const MOCK_PROVIDER_MAP = new Map([ getBlockNumber: providerGetLatestBlockMock, }, ], + [ + ChainId.UNICHAIN, + { + getBlockNumber: providerGetLatestBlockMock, + }, + ], [ ChainId.BASE, {