diff --git a/src/handlers/evm/index.ts b/src/handlers/evm/index.ts index 0486798..94ad4bb 100644 --- a/src/handlers/evm/index.ts +++ b/src/handlers/evm/index.ts @@ -1,5 +1,5 @@ -import { EthersAdapter } from "../../adapter/EthersAdapter"; import erc20Abi from "../../abi/erc20.json"; +import { EthersAdapter } from "../../adapter/EthersAdapter"; import { Contract, @@ -20,8 +20,8 @@ import { NATIVE_EVM_TOKEN_ADDRESS, uint256MaxValue, } from "../../constants"; -import { Utils } from "./utils"; import { TokensChains } from "../../utils/TokensChains"; +import { Utils } from "./utils"; const ethersAdapter = new EthersAdapter(); @@ -45,13 +45,15 @@ export class EvmHandler extends Utils { overrides, }); - await this.validateBalanceAndApproval({ - data: { - ...data, - overrides: gasData, - }, - params, - }); + if (!data.bypassBalanceChecks) { + await this.validateBalanceAndApproval({ + data: { + ...data, + overrides: gasData, + }, + params, + }); + } const tx = { to: target, diff --git a/src/index.ts b/src/index.ts index e3e279f..fddc56a 100644 --- a/src/index.ts +++ b/src/index.ts @@ -158,7 +158,10 @@ export class Squid extends TokensChains { data.signer as EvmWallet, ); - return this.handlers.evm.executeRoute({ data, params: evmParams }); + return this.handlers.evm.executeRoute({ + data, + params: evmParams, + }); case ChainType.COSMOS: const cosmosParams = this.handlers.cosmos.populateRouteParams(this, data.route.params); diff --git a/src/types/index.ts b/src/types/index.ts index cf975c9..7556580 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -1,14 +1,14 @@ import { - ChainData, - Token, - RouteRequest, RouteResponse as _RouteResponse, + ChainData, DepositAddressResponse, + RouteRequest, + Token, } from "@0xsquid/squid-types"; import { SigningStargateClient } from "@cosmjs/stargate"; -import { EvmWallet, TransactionResponse, RpcProvider, Contract, GasData } from "./ethers"; import { TxRaw } from "cosmjs-types/cosmos/tx/v1beta1/tx"; +import { Contract, EvmWallet, GasData, RpcProvider, TransactionResponse } from "./ethers"; export * from "@0xsquid/squid-types"; export * from "./cosmos"; @@ -42,6 +42,7 @@ export type ExecuteRoute = { route: _RouteResponse["route"]; executionSettings?: ExecutionSettings; overrides?: OverrideParams; + bypassBalanceChecks?: boolean; signerAddress?: string; // cosmos specific };