a simplified nodejs server that creates a secret uuid endpoint, only to be known by the Sequence Indexer endpoint to ensure noone else can call your code
- clone down repo
$ mv .env.example .env
and complete theNGROK_ENDPOINT=
$ pnpm install
$ npx nodemon index.ts
- register the endpoint that gets printed to terminal in example webhook code
- to have your webhook called by Sequence, mint a collectible from the Sequence Builder for the registered contract address in step 5
- Response: POST /<your_endpoint_id>
- Content-Type: application/octet-stream
- Body (in raw, to be parsed):
id
(number) -- id of the requesttype
(string) -- the type of indexed response (i.e.BLOCK_ADDED
)blockNumber
(number) -- the block number from the blockchainblockHash
(string) -- the block header hash of the block the event was included in from the blockchainparentBlockHash
(string) -- the block hash of the parent blockcontractAddress
(string) -- the contract address that is being listened tocontractType
(string) -- whether the contract type is anERC20
,ERC721
, orERC1155
txnHash
(string) -- the transaction hash of where the event is included intxnIndex
(number) -- the position of a transaction in a blocktxnData
(object) -- the native transaction detailsfrom
(string) -- the wallet / contract address for who sent the transactionto
(string) -- the wallet / contract address for who the transaction is forvalue
(string) -- the value of the transaction
txnLogIndex
(number) -- the position of the logged event in the blocklogDataType
(string) -- the type of event log (e.g.TOKEN_TRANSFER
)ts
(datetime) -- the time and date of the eventLog
(object) -- an object containing the log informationraw
address
(string) -- the contract address the event is emitted fromtopics
([string]) -- an array of indexed topic hashes, (e.g. computed as ethers.utils.id("Transfer(address,address,uint256)"))data
(string) -- the calldata of the transactionblockNumber
(string) -- the block number in hextransactionHash
(string) -- the hash of the transaction for the blocktransactionIndex
(string) -- the position in hex of the transaction in the blockblockHash
(string) -- the hash of the block the transaction is forlogIndex
(string) -- the index in hex of the log event emitted
contractType
(string) -- whether the contract type is anERC20
,ERC721
, orERC1155
transferEvent
([object]) -- the transfered event details- object
operator
(string) -- the initiator of the transactionfrom
(string) -- the address transfer event is fromto
(string) -- the address the transfer event is totokenIds
([string]) -- a list of the token IDsamounts
([string]) -- the respective to the token IDs, the amount the transfer event is for
- object