From 4dc484df0b3c6b27da905c5011473289016db598 Mon Sep 17 00:00:00 2001 From: doug <4741454+douglance@users.noreply.github.com> Date: Tue, 3 Dec 2024 06:50:33 -0500 Subject: [PATCH] feat: enables edu chain fastwithdrawal (#2103) Co-authored-by: Bartek --- .../src/util/orbitChainsData.json | 3 ++- packages/scripts/src/addOrbitChain/provider.ts | 14 +++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/packages/arb-token-bridge-ui/src/util/orbitChainsData.json b/packages/arb-token-bridge-ui/src/util/orbitChainsData.json index 259c700f50..a36f632393 100644 --- a/packages/arb-token-bridge-ui/src/util/orbitChainsData.json +++ b/packages/arb-token-bridge-ui/src/util/orbitChainsData.json @@ -670,7 +670,8 @@ "name": "EDU", "symbol": "EDU", "logoUrl": "/images/EduChainTokenLogo.png" - } + }, + "fastWithdrawalTime": 3600000 } }, { diff --git a/packages/scripts/src/addOrbitChain/provider.ts b/packages/scripts/src/addOrbitChain/provider.ts index c29faa0d4f..d7287dedb7 100644 --- a/packages/scripts/src/addOrbitChain/provider.ts +++ b/packages/scripts/src/addOrbitChain/provider.ts @@ -6,13 +6,21 @@ export const getProvider = (chainInfo: { name: string; chainId: number; }) => { + const THROTTLE_LIMIT = 10; + const connection: ConnectionInfo = { url: chainInfo.rpcUrl, - timeout: 30000, + timeout: 300000, allowGzip: true, skipFetchSetup: true, - throttleLimit: 3, - throttleSlotInterval: 1000, + throttleLimit: THROTTLE_LIMIT, + throttleSlotInterval: 3000, + throttleCallback: async (attempt: number) => { + // Always retry until we hit the THROTTLE_LIMIT + // Otherwise, it only throttles for specific response codes + // Return true to continue retrying, false to stop + return attempt <= THROTTLE_LIMIT; + }, headers: { Accept: "*/*", "Accept-Encoding": "gzip, deflate, br",