From 53f1477804ae02656b55027bad47f14508d0b5b1 Mon Sep 17 00:00:00 2001 From: web3rover <7037606+web3rover@users.noreply.github.com> Date: Tue, 24 Dec 2024 18:25:31 +0530 Subject: [PATCH] fix: reduce commands Co-authored-by: Jesus Lanchas --- vips/vip-410/bscmainnet.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/vips/vip-410/bscmainnet.ts b/vips/vip-410/bscmainnet.ts index 7e450196d..680b8b37c 100644 --- a/vips/vip-410/bscmainnet.ts +++ b/vips/vip-410/bscmainnet.ts @@ -213,7 +213,19 @@ const commands = emissions.map(emission => { ], dstChainId: emission.chainId, }; -}); +}).reduce((accumulator, currentValue) => { + const command = accumulator.find( + it => it.target == currentValue.target && it.dstChainId == currentValue.dstChainId, + ); + if (!command) { + accumulator.push(currentValue); + } else { + command.params[0].push(currentValue.params[0][0]); + command.params[1].push(currentValue.params[1][0]); + command.params[2].push(currentValue.params[2][0]); + } + return accumulator; + }, []); export const vip410 = () => { const meta = {