From 459af6be56bab00d61362def62972e78e568042d Mon Sep 17 00:00:00 2001 From: pilot <8565879+odcey@users.noreply.github.com> Date: Fri, 7 Mar 2025 10:15:03 +0100 Subject: [PATCH 1/4] chore: add chainId param when sending evm transaction --- src/handlers/evm/index.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/handlers/evm/index.ts b/src/handlers/evm/index.ts index b6f53022..b9fc175a 100644 --- a/src/handlers/evm/index.ts +++ b/src/handlers/evm/index.ts @@ -59,6 +59,7 @@ export class EvmHandler extends Utils { to: target, data: _data, value, + chainId: Number(params.fromChain.chainId), ...gasData, } as TransactionRequest; @@ -178,6 +179,7 @@ export class EvmHandler extends Utils { return (data.signer as EvmWallet).sendTransaction({ to: params.preHook ? params.preHook.fundToken : params.fromToken.address, data: approveData, + chainId: Number(params.fromChain.chainId), ...overrides, }); } From d32efa7e6ed372de420da94d17dc53cc82fb3f03 Mon Sep 17 00:00:00 2001 From: jmd3v Date: Mon, 10 Mar 2025 10:20:55 -0300 Subject: [PATCH 2/4] fix actions/cache@v4 --- .github/workflows/unit-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index c9eda042..fbab3393 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -30,7 +30,7 @@ jobs: run: echo "::set-output name=dir::$(yarn cache dir)" - name: Cache yarn dependencies - uses: actions/cache@v1 + uses: actions/cache@v4 with: path: ${{ steps.yarn-cache.outputs.dir }} key: yarn-${{ hashFiles('**/yarn.lock') }} From dc93f18d7cd2d4e5f2cff8ec9116e1e1d52bc2fd Mon Sep 17 00:00:00 2001 From: genaroibc Date: Mon, 10 Mar 2025 14:08:51 -0300 Subject: [PATCH 3/4] test: fix tests --- src/adapter/HttpAdapter.ts | 4 ++-- src/handlers/evm/index.spec.ts | 3 +++ src/index.spec.ts | 2 +- src/index.ts | 4 ++-- src/types/http.ts | 2 +- 5 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/adapter/HttpAdapter.ts b/src/adapter/HttpAdapter.ts index 0e91186e..c0ee0fda 100644 --- a/src/adapter/HttpAdapter.ts +++ b/src/adapter/HttpAdapter.ts @@ -9,7 +9,7 @@ export default class HttpAdapter { constructor(config: RequestConfig) { this.axios = axios.create({ ...omit(config, ["config"]), - baseURL: config?.baseUrl, + baseURL: config?.baseURL, timeout: config?.timeout, }); @@ -20,7 +20,7 @@ export default class HttpAdapter { setConfig(config: RequestConfig) { if (!config) throw new Error("config object undefined"); - this.axios = axios.create({ ...config, baseURL: config.baseUrl }); + this.axios = axios.create({ ...config, baseURL: config.baseURL }); } get = async (url: string, config?: { [key: string]: any }): Promise => { diff --git a/src/handlers/evm/index.spec.ts b/src/handlers/evm/index.spec.ts index b5e79d39..5ad62b4b 100644 --- a/src/handlers/evm/index.spec.ts +++ b/src/handlers/evm/index.spec.ts @@ -61,6 +61,9 @@ describe("EvmHandler", () => { } as unknown as ExecuteRoute; const params = { fromAmount: "10000000000000000", + fromChain: { + chainId: "1", + }, } as unknown as RouteParamsPopulated; describe("executeRoute method", () => { diff --git a/src/index.spec.ts b/src/index.spec.ts index bea7ae31..7bd4f30c 100644 --- a/src/index.spec.ts +++ b/src/index.spec.ts @@ -67,7 +67,7 @@ describe("Squid", () => { toToken: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE", fromAddress: "0x95222290dd7278aa3ddd389cc1e1d165cc4bafe5", toAddress: "0x95222290dd7278aa3ddd389cc1e1d165cc4bafe5", - fromAmount: "5000000000000", + fromAmount: "1000000000000000000", slippage: 1.5, }); diff --git a/src/index.ts b/src/index.ts index 97089d6e..31d58d40 100644 --- a/src/index.ts +++ b/src/index.ts @@ -53,7 +53,7 @@ export class Squid extends TokensChains { } this.httpInstance = new HttpAdapter({ - baseUrl: config?.baseUrl || baseUrl, + baseURL: config?.baseUrl || baseUrl, config, headers: { "x-integrator-id": config.integratorId, @@ -69,7 +69,7 @@ export class Squid extends TokensChains { setConfig(config: Config) { this.httpInstance = new HttpAdapter({ - baseUrl: config?.baseUrl || baseUrl, + baseURL: config?.baseUrl || baseUrl, config, headers: { "x-integrator-id": config.integratorId || "squid-sdk", diff --git a/src/types/http.ts b/src/types/http.ts index 046a8e6d..06aef755 100644 --- a/src/types/http.ts +++ b/src/types/http.ts @@ -4,7 +4,7 @@ import { Config } from "."; export type HttpResponse = AxiosResponse; export interface RequestConfig { - baseUrl?: string; + baseURL?: string; config?: Config; headers?: Record; timeout?: number; From 959c3e6f76413d3b68b0f0dc3c3ca49246c903b4 Mon Sep 17 00:00:00 2001 From: genaroibc Date: Mon, 10 Mar 2025 14:13:36 -0300 Subject: [PATCH 4/4] refactor: simplify axios config creation --- src/adapter/HttpAdapter.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/adapter/HttpAdapter.ts b/src/adapter/HttpAdapter.ts index c0ee0fda..77d748bb 100644 --- a/src/adapter/HttpAdapter.ts +++ b/src/adapter/HttpAdapter.ts @@ -20,7 +20,7 @@ export default class HttpAdapter { setConfig(config: RequestConfig) { if (!config) throw new Error("config object undefined"); - this.axios = axios.create({ ...config, baseURL: config.baseURL }); + this.axios = axios.create(config); } get = async (url: string, config?: { [key: string]: any }): Promise => {