From 352e34dc3e8859121baece7cad2b17b6fcda1308 Mon Sep 17 00:00:00 2001 From: Ben Smith Date: Wed, 20 Mar 2024 12:08:38 +0100 Subject: [PATCH] remove web3js --- package.json | 3 +-- src/chains/ethereum.ts | 14 ++++++++++---- src/config.ts | 2 -- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index e04c580..49ce36b 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,6 @@ "hash.js": "^1.1.7", "keccak": "^3.0.4", "near-api-js": "^3.0.3", - "opensea-js": "^7.0.9", - "web3": "^4.5.0" + "opensea-js": "^7.0.9" } } diff --git a/src/chains/ethereum.ts b/src/chains/ethereum.ts index ec7dfab..13385a4 100644 --- a/src/chains/ethereum.ts +++ b/src/chains/ethereum.ts @@ -14,7 +14,7 @@ import { NO_DEPOSIT, getNearAccount, provider as nearProvider } from "./near"; import { GasPriceResponse, GasPrices, TxPayload } from "../types"; import { getMultichainContract } from "../mpc_contract"; import { getFirstNonZeroGasPrice } from "../utils/gasPrice"; -import { common, provider, web3 } from "../config"; +import { common, provider } from "../config"; export const deriveEthAddress = async ( derivationPath: string @@ -78,6 +78,8 @@ export const createPayload = async ( maxPriorityFeePerGas, }; console.log("TxData:", transactionDataWithGasLimit); + // const ethersTx: Transaction = ethers.Transaction.from(transactionDataWithGasLimit as TransactionLike); + // console.log("EthersTX", JSON.stringify(ethersTx)); const transaction = FeeMarketEIP1559Transaction.fromTxData( transactionDataWithGasLimit, { @@ -117,9 +119,13 @@ export const relayTransaction = async ( signedTransaction: FeeMarketEIP1559Transaction ): Promise => { const serializedTx = bytesToHex(signedTransaction.serialize()); - const relayed = await web3.eth.sendSignedTransaction(serializedTx); - console.log("Transaction Confirmed:", relayed.transactionHash); - return relayed.transactionHash; + // const relayed = await web3.eth.sendSignedTransaction(serializedTx); + const relayed: ethers.TransactionResponse = await provider.send( + "eth_sendRawTransaction", + [serializedTx] + ); + console.log("Transaction Confirmed:", relayed.hash); + return relayed.hash; }; export const requestSignature = async ( diff --git a/src/config.ts b/src/config.ts index dfaf6dd..d3ee1f7 100644 --- a/src/config.ts +++ b/src/config.ts @@ -1,6 +1,5 @@ import { Common } from "@ethereumjs/common"; import { ethers } from "ethers"; -import Web3 from "web3"; const config = { chainId: 11155111, @@ -10,7 +9,6 @@ const config = { chain: "sepolia", }; -export const web3 = new Web3(config.providerUrl); export const common = new Common({ chain: config.chain }); export const provider = new ethers.JsonRpcProvider( config.providerUrl,