Skip to content

Commit

Permalink
remove all reamining web3
Browse files Browse the repository at this point in the history
  • Loading branch information
bh2smith committed Mar 20, 2024
1 parent 352e34d commit 859cea8
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 443 deletions.
21 changes: 6 additions & 15 deletions examples/mint-nft.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,13 @@
import { signAndSendTransaction, web3 } from "../src/chains/ethereum";
import { ethers } from "ethers";
import { signAndSendTransaction } from "../src/chains/ethereum";
import { setupAccount } from "./setup";

const run = async (): Promise<void> => {
const sender = await setupAccount();
const functionSignature = web3.eth.abi.encodeFunctionCall(
{
name: "safeMint",
type: "function",
inputs: [
{
type: "address",
name: "to",
},
],
},
["0xAA5FcF171dDf9FE59c985A28747e650C2e9069cA"]
);

const iface = new ethers.Interface(["function safeMint(address to)"]);
const functionSignature = iface.encodeFunctionData("safeMint", [
"0xAA5FcF171dDf9FE59c985A28747e650C2e9069cA",
]);
await signAndSendTransaction(
sender,
"0xAA5FcF171dDf9FE59c985A28747e650C2e9069cA",
Expand Down
3 changes: 2 additions & 1 deletion examples/opensea.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { OpenSeaSDK, Chain, OrderSide } from "opensea-js";
import { setupAccount } from "./setup";
import { provider, signAndSendTransaction } from "../src/chains/ethereum";
import { signAndSendTransaction } from "../src/chains/ethereum";
import { openSeaInterface } from "../src/utils/interfaces";
import { sleep } from "../src/utils/sleep";
import * as readline from "readline";
import { provider } from "../src/config";

const rl = readline.createInterface({
input: process.stdin,
Expand Down
4 changes: 1 addition & 3 deletions src/chains/ethereum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { BN } from "bn.js";
import { ethers } from "ethers";
import { providers as nearProviders } from "near-api-js";
import { functionCall } from "near-api-js/lib/transaction";
import { Bytes } from "web3";
import {
deriveChildPublicKey,
najPublicKeyStrToUncompressedHexPoint,
Expand Down Expand Up @@ -117,9 +116,8 @@ export const reconstructSignature = (

export const relayTransaction = async (
signedTransaction: FeeMarketEIP1559Transaction
): Promise<Bytes> => {
): Promise<string> => {
const serializedTx = bytesToHex(signedTransaction.serialize());
// const relayed = await web3.eth.sendSignedTransaction(serializedTx);
const relayed: ethers.TransactionResponse = await provider.send(
"eth_sendRawTransaction",
[serializedTx]
Expand Down
Loading

0 comments on commit 859cea8

Please sign in to comment.