-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
This example uses [Blocknative's SDK](https://github.com/blocknative/sdk) to watch the Ethereum mempool looking for the transaction activating the Dotdotdots(NFT) Smart Contract minting. | ||
`npm install` then `node index.js` | ||
This plays on the article from Pawel Urbanek - [Hunting for Rare NFTs in the Ethereum Dark Forest](https://pawelurbanek.com/ethereum-mempool-monitoring) | ||
Please checkout all the awesome products from [Blocknative](https://www.blocknative.com) | ||
[Blocknative Docs](https://docs.blocknative.com/) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import BlocknativeSdk from 'bnc-sdk'; | ||
import WebSocket from 'ws'; | ||
import { dotDotDotAbi } from './abi.js'; | ||
|
||
const DOT_CONTRACT_ADDRESS = "0x67Ed645EC1994c60d7e3664CA2bEd0A56B48595F"; | ||
const DOT_CONTRACT_ABI = dotDotDotAbi; | ||
const DOT_ADMIN_ADDRESS = "0xd29dcbd273d73714eb6bea7bd4f8d99d0fbc3398" | ||
|
||
const options = { | ||
dappId: '25b387fb-bf21-42ec-a093-9d37e4267a7a', | ||
networkId: 1, | ||
system: 'ethereum', | ||
ws: WebSocket, | ||
transactionHandlers: [async (event) => await mint(event.transaction)], | ||
onerror: (error) => {console.error('error!!! ', error)} | ||
} | ||
|
||
const main = async () => { | ||
const sdk = new BlocknativeSdk(options) | ||
console.log('listening until error msg is seen...') | ||
await sdk.configuration({ | ||
scope: DOT_CONTRACT_ADDRESS, | ||
abi: DOT_CONTRACT_ABI, | ||
filters: [ | ||
{ from: DOT_ADMIN_ADDRESS }, | ||
{ "contractCall.methodName": "flipSaleState" }, | ||
{ status: "pending" } | ||
], | ||
watchAddress: true | ||
}) | ||
} | ||
|
||
const mint = async (txData) => { | ||
await signer.sendTransaction({ | ||
to: DOT_CONTRACT_ADDRESS, | ||
data: mintOne, | ||
type: 2, | ||
value: ETHER.div(100).mul(5), | ||
maxFeePerGas: BigNumber.from(txData.maxFeePerGas).sub(1), | ||
maxPriorityFeePerGas: txData.maxPriorityFeePerGas, | ||
gasLimit: 200000, | ||
chainId: 1 | ||
}) | ||
} | ||
|
||
await main() |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.