From 44990713d31147b6941d36afce167fedbd47f9a9 Mon Sep 17 00:00:00 2001 From: KostasCherv Date: Mon, 3 Feb 2025 13:52:49 +0100 Subject: [PATCH 1/3] chore: add abstract --- src/constants/index.ts | 10 ++++++++++ src/index.ts | 16 ++++++++++++++++ src/lib/types/index.ts | 4 ++++ src/utils/isAbstract.ts | 3 +++ src/utils/relayAddress.ts | 9 +++++++++ 5 files changed, 42 insertions(+) create mode 100644 src/utils/isAbstract.ts diff --git a/src/constants/index.ts b/src/constants/index.ts index 2e7c6ab..0aa8f1a 100644 --- a/src/constants/index.ts +++ b/src/constants/index.ts @@ -19,6 +19,11 @@ export const GELATO_RELAY_ERC2771_ZKSYNC_ADDRESS = export const GELATO_RELAY_1BALANCE_ERC2771_ZKSYNC_ADDRESS = "0x97015cD4C3d456997DD1C40e2a18c79108FCc412"; +export const GELATO_RELAY_ERC2771_ABSTRACT_ADDRESS = + "0xACeD988c5B5Fe3f11848c728D9a5f66Cf34c9e73"; +export const GELATO_RELAY_1BALANCE_ERC2771_ABSTRACT_ADDRESS = + "0xD4bb348BD06877F52b0033f444048459108Fd9A0"; + export const GELATO_RELAY_CONCURRENT_ERC2771_ADDRESS = "0x8598806401A63Ddf52473F1B3C55bC9E33e2d73b"; export const GELATO_RELAY_1BALANCE_CONCURRENT_ERC2771_ADDRESS = @@ -28,3 +33,8 @@ export const GELATO_RELAY_CONCURRENT_ERC2771_ZKSYNC_ADDRESS = "0xBa4082F4961c8Fb76231995C967CD9aa40f321b5"; export const GELATO_RELAY_1BALANCE_CONCURRENT_ERC2771_ZKSYNC_ADDRESS = "0xB8828e4c662D1a7e4f3d1f622EfAE6B63D852ED8"; + +export const GELATO_RELAY_CONCURRENT_ERC2771_ABSTRACT_ADDRESS = + "0xbbCe89ACdD86D0130BDc3f1fe37C3aEDd79fc1F4"; +export const GELATO_RELAY_1BALANCE_CONCURRENT_ERC2771_ABSTRACT_ADDRESS = + "0x0BdB9f40DCD2a56b2c5233D9d8d6FD49b5eeadA7"; diff --git a/src/index.ts b/src/index.ts index e26bca0..8285715 100644 --- a/src/index.ts +++ b/src/index.ts @@ -28,6 +28,10 @@ import { GELATO_RELAY_URL, GELATO_RELAY_CONCURRENT_ERC2771_ZKSYNC_ADDRESS, GELATO_RELAY_1BALANCE_CONCURRENT_ERC2771_ZKSYNC_ADDRESS, + GELATO_RELAY_1BALANCE_CONCURRENT_ERC2771_ABSTRACT_ADDRESS, + GELATO_RELAY_1BALANCE_ERC2771_ABSTRACT_ADDRESS, + GELATO_RELAY_CONCURRENT_ERC2771_ABSTRACT_ADDRESS, + GELATO_RELAY_ERC2771_ABSTRACT_ADDRESS, } from "./constants"; import { WebsocketHandler } from "./utils/index.js"; @@ -80,9 +84,15 @@ export class GelatoRelay { relayERC2771zkSync: config?.contract?.relayERC2771zkSync ?? GELATO_RELAY_ERC2771_ZKSYNC_ADDRESS, + relayERC2771Abstract: + config?.contract?.relayERC2771Abstract ?? + GELATO_RELAY_ERC2771_ABSTRACT_ADDRESS, relay1BalanceERC2771zkSync: config?.contract?.relay1BalanceERC2771zkSync ?? GELATO_RELAY_1BALANCE_ERC2771_ZKSYNC_ADDRESS, + relay1BalanceERC2771Abstract: + config?.contract?.relay1BalanceERC2771Abstract ?? + GELATO_RELAY_1BALANCE_ERC2771_ABSTRACT_ADDRESS, relayConcurrentERC2771: config?.contract?.relayConcurrentERC2771 ?? GELATO_RELAY_CONCURRENT_ERC2771_ADDRESS, @@ -92,9 +102,15 @@ export class GelatoRelay { relayConcurrentERC2771zkSync: config?.contract?.relayConcurrentERC2771zkSync ?? GELATO_RELAY_CONCURRENT_ERC2771_ZKSYNC_ADDRESS, + relayConcurrentERC2771Abstract: + config?.contract?.relayConcurrentERC2771Abstract ?? + GELATO_RELAY_CONCURRENT_ERC2771_ABSTRACT_ADDRESS, relay1BalanceConcurrentERC2771zkSync: config?.contract?.relay1BalanceConcurrentERC2771zkSync ?? GELATO_RELAY_1BALANCE_CONCURRENT_ERC2771_ZKSYNC_ADDRESS, + relay1BalanceConcurrentERC2771Abstract: + config?.contract?.relay1BalanceConcurrentERC2771Abstract ?? + GELATO_RELAY_1BALANCE_CONCURRENT_ERC2771_ABSTRACT_ADDRESS, }, }; }; diff --git a/src/lib/types/index.ts b/src/lib/types/index.ts index 1d546fa..8d4f4cc 100644 --- a/src/lib/types/index.ts +++ b/src/lib/types/index.ts @@ -60,11 +60,15 @@ export type Config = { relayERC2771: string; relay1BalanceERC2771: string; relayERC2771zkSync: string; + relayERC2771Abstract: string; relay1BalanceERC2771zkSync: string; + relay1BalanceERC2771Abstract: string; relayConcurrentERC2771: string; relay1BalanceConcurrentERC2771: string; relayConcurrentERC2771zkSync: string; + relayConcurrentERC2771Abstract: string; relay1BalanceConcurrentERC2771zkSync: string; + relay1BalanceConcurrentERC2771Abstract: string; }; }; diff --git a/src/utils/isAbstract.ts b/src/utils/isAbstract.ts new file mode 100644 index 0000000..96c7b0f --- /dev/null +++ b/src/utils/isAbstract.ts @@ -0,0 +1,3 @@ +export const isAbstract = (chainId: bigint): boolean => { + return chainId === BigInt(2741); +}; diff --git a/src/utils/relayAddress.ts b/src/utils/relayAddress.ts index ab86026..8771035 100644 --- a/src/utils/relayAddress.ts +++ b/src/utils/relayAddress.ts @@ -4,6 +4,7 @@ import { ERC2771Type } from "../lib/erc2771/types"; import { Config } from "../lib/types"; import { isZkSync } from "./isZkSync"; +import { isAbstract } from "./isAbstract"; export const getGelatoRelayERC2771Address = ( payload: { @@ -17,18 +18,26 @@ export const getGelatoRelayERC2771Address = ( case ERC2771Type.CallWithSyncFee: return isZkSync(chainId) ? getAddress(config.contract.relayERC2771zkSync) + : isAbstract(chainId) + ? getAddress(config.contract.relayERC2771Abstract) : getAddress(config.contract.relayERC2771); case ERC2771Type.SponsoredCall: return isZkSync(chainId) ? getAddress(config.contract.relay1BalanceERC2771zkSync) + : isAbstract(chainId) + ? getAddress(config.contract.relay1BalanceERC2771Abstract) : getAddress(config.contract.relay1BalanceERC2771); case ERC2771Type.ConcurrentCallWithSyncFee: return isZkSync(chainId) ? getAddress(config.contract.relayConcurrentERC2771zkSync) + : isAbstract(chainId) + ? getAddress(config.contract.relayConcurrentERC2771Abstract) : getAddress(config.contract.relayConcurrentERC2771); case ERC2771Type.ConcurrentSponsoredCall: return isZkSync(chainId) ? getAddress(config.contract.relay1BalanceConcurrentERC2771zkSync) + : isAbstract(chainId) + ? getAddress(config.contract.relay1BalanceConcurrentERC2771Abstract) : getAddress(config.contract.relay1BalanceConcurrentERC2771); default: // eslint-disable-next-line no-case-declarations From 1e4a4e175e9e0c43c34b877895d7ba7e2fdbd70c Mon Sep 17 00:00:00 2001 From: KostasCherv Date: Mon, 3 Feb 2025 13:55:38 +0100 Subject: [PATCH 2/3] chore: update dependencies --- package.json | 4 ++-- yarn.lock | 20 ++++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/package.json b/package.json index 5222750..0b07d9a 100644 --- a/package.json +++ b/package.json @@ -39,10 +39,10 @@ }, "dependencies": { "@changesets/cli": "^2.27.1", - "axios": "1.7.7", + "axios": "1.7.9", "isomorphic-ws": "^5.0.0", "viem": "2.20.1", - "ws": "^8.5.0" + "ws": "^8.18.0" }, "lint-staged": { "*.{js,json,md,ts}": "yarn format", diff --git a/yarn.lock b/yarn.lock index 9193440..faa1e17 100644 --- a/yarn.lock +++ b/yarn.lock @@ -497,7 +497,7 @@ __metadata: "@types/node": "npm:16.18.25" "@typescript-eslint/eslint-plugin": "npm:^5.59.1" "@typescript-eslint/parser": "npm:^5.59.1" - axios: "npm:1.7.7" + axios: "npm:1.7.9" dotenv: "npm:^16.0.3" eslint: "npm:^8.39.0" eslint-config-prettier: "npm:^8.8.0" @@ -511,7 +511,7 @@ __metadata: prettier: "npm:^2.8.8" typescript: "npm:5.0.4" viem: "npm:2.20.1" - ws: "npm:^8.5.0" + ws: "npm:^8.18.0" languageName: unknown linkType: soft @@ -1084,14 +1084,14 @@ __metadata: languageName: node linkType: hard -"axios@npm:1.7.7": - version: 1.7.7 - resolution: "axios@npm:1.7.7" +"axios@npm:1.7.9": + version: 1.7.9 + resolution: "axios@npm:1.7.9" dependencies: follow-redirects: "npm:^1.15.6" form-data: "npm:^4.0.0" proxy-from-env: "npm:^1.1.0" - checksum: 10c0/4499efc89e86b0b49ffddc018798de05fab26e3bf57913818266be73279a6418c3ce8f9e934c7d2d707ab8c095e837fc6c90608fb7715b94d357720b5f568af7 + checksum: 10c0/b7a41e24b59fee5f0f26c1fc844b45b17442832eb3a0fb42dd4f1430eb4abc571fe168e67913e8a1d91c993232bd1d1ab03e20e4d1fee8c6147649b576fc1b0b languageName: node linkType: hard @@ -4689,9 +4689,9 @@ __metadata: languageName: node linkType: hard -"ws@npm:^8.5.0": - version: 8.16.0 - resolution: "ws@npm:8.16.0" +"ws@npm:^8.18.0": + version: 8.18.0 + resolution: "ws@npm:8.18.0" peerDependencies: bufferutil: ^4.0.1 utf-8-validate: ">=5.0.2" @@ -4700,7 +4700,7 @@ __metadata: optional: true utf-8-validate: optional: true - checksum: 10c0/a7783bb421c648b1e622b423409cb2a58ac5839521d2f689e84bc9dc41d59379c692dd405b15a997ea1d4c0c2e5314ad707332d0c558f15232d2bc07c0b4618a + checksum: 10c0/25eb33aff17edcb90721ed6b0eb250976328533ad3cd1a28a274bd263682e7296a6591ff1436d6cbc50fa67463158b062f9d1122013b361cec99a05f84680e06 languageName: node linkType: hard From 5aaa1213a0de174b9cf66061d3db05a378217045 Mon Sep 17 00:00:00 2001 From: KostasCherv Date: Mon, 3 Feb 2025 13:55:56 +0100 Subject: [PATCH 3/3] Bump package version --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 0b07d9a..3f1f37b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@gelatonetwork/relay-sdk-viem", - "version": "1.2.0", + "version": "1.3.0", "description": "SDK to integrate with Gelato Relay with viem", "main": "dist/index.js", "types": "dist/index.d.ts", @@ -49,4 +49,4 @@ "*.{ts,js}": "yarn lint" }, "packageManager": "yarn@4.1.1" -} +} \ No newline at end of file