Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main-v2' into feat/solana-signing
Browse files Browse the repository at this point in the history
  • Loading branch information
odcey committed Dec 3, 2024
2 parents 660d030 + 9334ea0 commit 117152d
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 16 deletions.
20 changes: 11 additions & 9 deletions src/handlers/evm/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { EthersAdapter } from "../../adapter/EthersAdapter";
import erc20Abi from "../../abi/erc20.json";
import { EthersAdapter } from "../../adapter/EthersAdapter";

import {
Contract,
Expand All @@ -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();

Expand All @@ -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,
Expand Down
5 changes: 4 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,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);
Expand Down
13 changes: 7 additions & 6 deletions src/types/index.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
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 { VersionedTransaction } from "@solana/web3.js";
import { Wallet } from "@project-serum/anchor";
import { VersionedTransaction } from "@solana/web3.js";
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";
Expand Down Expand Up @@ -50,6 +50,7 @@ export type ExecuteRoute = {
route: _RouteResponse["route"];
executionSettings?: ExecutionSettings;
overrides?: OverrideParams;
bypassBalanceChecks?: boolean;
signerAddress?: string; // cosmos specific
};

Expand Down

0 comments on commit 117152d

Please sign in to comment.