Watch contract on mainnet
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,4 +1,5 @@
|
||||
node_modules/
|
||||
|
||||
.env
|
||||
*.json
|
||||
*.txt
|
||||
|
||||
3
Kitbash.json
Normal file
3
Kitbash.json
Normal file
File diff suppressed because one or more lines are too long
@@ -70,5 +70,5 @@ async function mintPunk() {
|
||||
// // mintNFT("data:application/json;base64," + base64.encode(data))
|
||||
// })
|
||||
|
||||
// mintOwnerNFT()
|
||||
mintPunk()
|
||||
mintOwnerNFT()
|
||||
// mintPunk()
|
||||
|
||||
15
watch.js
15
watch.js
@@ -8,12 +8,13 @@ const API_URL = process.env.API_URL;
|
||||
import { createAlchemyWeb3 } from "@alch/alchemy-web3"
|
||||
const web3 = createAlchemyWeb3(API_URL);
|
||||
|
||||
import contractABI from './MoonbirdPunks.json' assert { type: 'json' }
|
||||
// import contractABI from './MoonbirdPunks.json' assert { type: 'json' }
|
||||
import contractABI from './Kitbash.json' assert { type: 'json' }
|
||||
|
||||
// create options object
|
||||
const options = {
|
||||
dappId: 'd30463f1-eb29-42b8-8059-e5596e13d0fe',
|
||||
networkId: 3,
|
||||
networkId: 1,
|
||||
system: 'ethereum', // optional, defaults to ethereum
|
||||
transactionHandlers: [event => console.log(event.transaction)],
|
||||
ws: WebSocket, // only neccessary in server environments
|
||||
@@ -23,13 +24,13 @@ const options = {
|
||||
|
||||
// initialize and connect to the api
|
||||
const blocknative = new BlocknativeSdk(options)
|
||||
const contractAddress = "0x7d82a88Efb60Bb83B3f1665757c20D07E5C0f3ED"
|
||||
const methodName = "ownerMint"
|
||||
const contractAddress = "0x5ff1863753C1920C38c7BaE94576f2831eF99695"
|
||||
const methodName = "mint"
|
||||
// const methodName = "flipSaleState"
|
||||
|
||||
await blocknative.configuration({
|
||||
scope: contractAddress, // [required] - either 'global' or valid Ethereum address
|
||||
// filters: [{"contractCall.methodName":methodName}],
|
||||
filters: [{"contractCall.methodName":methodName}],
|
||||
abi: contractABI.abi, // [optional] - valid contract ABI
|
||||
watchAddress: true // [optional] - Whether the server should automatically watch the "scope" value if it is an address
|
||||
})
|
||||
@@ -43,8 +44,8 @@ const {
|
||||
details // initial account details which are useful for internal tracking: address
|
||||
} = blocknative.account(contractAddress)
|
||||
|
||||
// console.log(`Watching for ${methodName} on ${contractAddress}...`)
|
||||
console.log(`Watching for all methods on ${contractAddress}...`)
|
||||
console.log(`Watching for ${methodName} on ${contractAddress}...`)
|
||||
// console.log(`Watching for all methods on ${contractAddress}...`)
|
||||
|
||||
const nftContract = new web3.eth.Contract(contractABI.abi, contractAddress);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user