From ee9da5aa3d4a241021767d193a0c4753df985e7d Mon Sep 17 00:00:00 2001 From: Akash Date: Thu, 27 Jun 2024 18:50:16 +0530 Subject: [PATCH] chore : refactor --- .env.example | 5 ++++- package.json | 2 +- scripts/deploy/helpers/send-msg/allPathTest.ts | 16 ++++++++-------- scripts/deploy/utils/utils.ts | 3 ++- .../rpcConfig/constants/defaultFinalityBucket.ts | 6 ++++++ scripts/rpcConfig/constants/index.ts | 1 + scripts/rpcConfig/constants/reSyncInterval.ts | 6 +++++- scripts/rpcConfig/rpcConfig.ts | 14 ++------------ src/index.ts | 3 +++ 9 files changed, 32 insertions(+), 24 deletions(-) diff --git a/.env.example b/.env.example index 70bb342e..b9d6f9e4 100644 --- a/.env.example +++ b/.env.example @@ -80,4 +80,7 @@ BLAST_RPC='' # SOCKET_OWNER_ADDRESS="" # SOCKET_SIGNER_KEY=xxx -POLYNOMIAL_RPC=' ' +POLYNOMIAL_RPC='' + +DL_API_DEV_URL='' +DL_API_PROD_URL='' \ No newline at end of file diff --git a/package.json b/package.json index f347019c..0fc0e121 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@socket.tech/dl-core", "license": "UNLICENSED", - "version": "2.11.0", + "version": "2.11.0-test.3", "description": "Smart contracts for socket data layer.", "main": "./dist/src/index.js", "types": "./dist/src/index.d.ts", diff --git a/scripts/deploy/helpers/send-msg/allPathTest.ts b/scripts/deploy/helpers/send-msg/allPathTest.ts index e5b4e4db..857a9163 100644 --- a/scripts/deploy/helpers/send-msg/allPathTest.ts +++ b/scripts/deploy/helpers/send-msg/allPathTest.ts @@ -31,8 +31,8 @@ interface RequestObj { const API_BASE_URL = mode == DeploymentMode.DEV - ? "https://raf5spoep4.execute-api.us-east-1.amazonaws.com/dev/v1" - : "https://prod.dlapi.socket.tech"; + ? process.env.DL_API_DEV_URL + : process.env.DL_API_PROD_URL; const getSiblingSlugs = (chainSlug: ChainSlug): ChainSlug[] => { console.log(chainSlug, isMainnet(chainSlug)); if (isTestnet(chainSlug)) @@ -157,18 +157,18 @@ export const sendMessagesToAllPaths = async (params: { // value = 100 let executionParams = - "0x0100000000000000000000000000000000000000000000000000000000000064"; + "0x0100000000000000000000000000000000000000000000000000000000000000"; let transmissionParams = - "0x0000000000000000000000000000000000000000000000000000000000000000"; + "0x0101000000010000000000000000000000000000000000000000000000000000"; let data = counter.interface.encodeFunctionData( "remoteAddOperation", [ siblingSlug, amount, msgGasLimit, - // executionParams, - ethers.constants.HashZero, - ethers.constants.HashZero, + executionParams, + // ethers.constants.HashZero, + transmissionParams, ] ); let to = counter.address; @@ -190,7 +190,7 @@ export const sendMessagesToAllPaths = async (params: { const gasLimit: number | string | undefined = chainSlug === ChainSlug.ARBITRUM || chainSlug === ChainSlug.ARBITRUM_SEPOLIA - ? 200000 + ? 2000000 : overrides(chainSlug)?.gasLimit ? overrides(chainSlug).gasLimit.toString() : undefined; diff --git a/scripts/deploy/utils/utils.ts b/scripts/deploy/utils/utils.ts index 2eec2b5a..577d59e4 100644 --- a/scripts/deploy/utils/utils.ts +++ b/scripts/deploy/utils/utils.ts @@ -116,7 +116,8 @@ export const verify = async ( return true; } catch (error) { console.log("Error during verification", error); - if (error.toString().includes("Contract source code already verified")) return true; + if (error.toString().includes("Contract source code already verified")) + return true; } return false; diff --git a/scripts/rpcConfig/constants/defaultFinalityBucket.ts b/scripts/rpcConfig/constants/defaultFinalityBucket.ts index 0e07a4e0..e6504b21 100644 --- a/scripts/rpcConfig/constants/defaultFinalityBucket.ts +++ b/scripts/rpcConfig/constants/defaultFinalityBucket.ts @@ -2,6 +2,12 @@ import { ChainSlug } from "../../../src/enums/chainSlug"; import { FinalityBucket } from "../../../src/socket-types"; +export const getDefaultFinalityBucket = ( + chainSlug: ChainSlug +): FinalityBucket => { + return defaultFinalityBucket[chainSlug] ?? FinalityBucket.fast; +}; + export const defaultFinalityBucket = { [ChainSlug.POLYGON_MAINNET]: FinalityBucket.medium, [ChainSlug.MAINNET]: FinalityBucket.medium, diff --git a/scripts/rpcConfig/constants/index.ts b/scripts/rpcConfig/constants/index.ts index 701451b6..337f4860 100644 --- a/scripts/rpcConfig/constants/index.ts +++ b/scripts/rpcConfig/constants/index.ts @@ -1,5 +1,6 @@ export * from "./batcherSupportedChainSlug"; export * from "./reSyncInterval"; +export * from "./defaultFinalityBucket"; export * from "./explorers"; export * from "./icons"; export * from "./rpc"; diff --git a/scripts/rpcConfig/constants/reSyncInterval.ts b/scripts/rpcConfig/constants/reSyncInterval.ts index 91ecbcd9..7e04e215 100644 --- a/scripts/rpcConfig/constants/reSyncInterval.ts +++ b/scripts/rpcConfig/constants/reSyncInterval.ts @@ -1,4 +1,8 @@ -import { ChainSlug } from "../../../src"; +import { ChainSlug } from "../../../src/enums/chainSlug"; + +export const getReSyncInterval = (chainSlug: ChainSlug) => { + return reSyncInterval[chainSlug] ?? 0; +}; export const reSyncInterval = { [ChainSlug.POLYGON_MAINNET]: 256, diff --git a/scripts/rpcConfig/rpcConfig.ts b/scripts/rpcConfig/rpcConfig.ts index 84a0d1c3..c31ff762 100644 --- a/scripts/rpcConfig/rpcConfig.ts +++ b/scripts/rpcConfig/rpcConfig.ts @@ -20,7 +20,6 @@ import { FinalityBucket, } from "../../src"; import { - reSyncInterval, explorers, icons, batcherSupportedChainSlugs, @@ -28,8 +27,9 @@ import { rpcs, version, getFinality, + getReSyncInterval, + getDefaultFinalityBucket, } from "./constants"; -import { defaultFinalityBucket } from "./constants/defaultFinalityBucket"; import { getChainTxData } from "./txdata-builder/generate-calldata"; import dotenv from "dotenv"; @@ -164,13 +164,3 @@ export const generateProdConfig = async (txData: TxData): Promise => { chainSlugToId: ChainSlugToId, }; }; - -export const getDefaultFinalityBucket = ( - chainSlug: ChainSlug -): FinalityBucket => { - return defaultFinalityBucket[chainSlug] ?? FinalityBucket.fast; -}; - -export const getReSyncInterval = (chainSlug: ChainSlug) => { - return reSyncInterval[chainSlug] ?? 0; -}; diff --git a/src/index.ts b/src/index.ts index aa1241ef..c1b28926 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,5 +1,8 @@ import { DeploymentMode } from "./socket-types"; export { getFinality } from "../scripts/rpcConfig/constants/finality"; +export { getDefaultFinalityBucket } from "../scripts/rpcConfig/constants/defaultFinalityBucket"; +export { getReSyncInterval } from "../scripts/rpcConfig/constants/reSyncInterval"; + export * from "./socket-types"; export * from "./enums"; export * from "./addresses";