Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

target es2020 #50

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions src/examples/simpleSim.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import MevShareClient from "../index"
import { JsonRpcProvider, Wallet } from "ethers"
import env from './lib/env'

async function main() {
const provider = new JsonRpcProvider(env.providerUrl, {chainId: 1, name: "mainnet"})
const block = await provider.getBlockNumber()
const { gasPrice } = await provider.getFeeData()
const authSigner = new Wallet(env.authKey)
const wallet = new Wallet(env.senderKey)
const client = MevShareClient.useEthereumMainnet(authSigner)
const tx = {
to: "0x0000000000000000000000000000000000000000",
data: '0x42',
chainId: 1,
gasPrice,
gasLimit: 42000,
}
const bundle = [
{tx: await wallet.signTransaction(tx), canRevert: false},
]
const bundleParams = {
inclusion: {
block: block + 1,
maxBlock: block + 10,
},
body: bundle,
}
const simResult = await client.simulateBundle(bundleParams)
console.log('simResult', simResult)
}

main()
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */

/* Language and Environment */
"target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
"target": "es2020", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
// "jsx": "preserve", /* Specify what JSX code is generated. */
// "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */
Expand Down