Skip to content

Commit

Permalink
remove web3js
Browse files Browse the repository at this point in the history
  • Loading branch information
bh2smith committed Mar 20, 2024
1 parent e05bee2 commit 352e34d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
14 changes: 10 additions & 4 deletions src/chains/ethereum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
{
Expand Down Expand Up @@ -117,9 +119,13 @@ export const relayTransaction = async (
signedTransaction: FeeMarketEIP1559Transaction
): Promise<Bytes> => {
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 (
Expand Down
2 changes: 0 additions & 2 deletions src/config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Common } from "@ethereumjs/common";
import { ethers } from "ethers";
import Web3 from "web3";

const config = {
chainId: 11155111,
Expand All @@ -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,
Expand Down

0 comments on commit 352e34d

Please sign in to comment.