eth_newBlockFilter RPC 方法
To use the eth_newBlockFilter method on the Avalanche C-Chain, ensure that the end of your URL includes ext/bc/C/rpc.
參數
此方法不接受任何參數
退貨
結果
字串
載入中...
請求
1curl https://docs-demo.avalanche-mainnet.quiknode.pro \2-X POST \3-H "Content-Type: application/json" \4--data '{5"jsonrpc": "2.0",6"method": "eth_newBlockFilter",7"params": [],8"id": 679}'
1curl https://docs-demo.avalanche-mainnet.quiknode.pro \2-X POST \3-H "Content-Type: application/json" \4--data '{5"jsonrpc": "2.0",6"method": "eth_newBlockFilter",7"params": [],8"id": 679}'
1import { 核心 } from '@quicknode/sdk'23const 核心 = new Core({4endpointUrl: "https://docs-demo.avalanche-mainnet.quiknode.pro",5})67core.client.createBlockFilter()8
1import { 核心 } from '@quicknode/sdk'23const 核心 = new Core({4endpointUrl: "https://docs-demo.avalanche-mainnet.quiknode.pro",5})67core.client.createBlockFilter()8
1import { ethers } from "ethers";23(async () => {4const provider = new ethers.JsonRpcProvider(5"https://docs-demo.avalanche-mainnet.quiknode.pro"6);7const filterId = await provider.send("eth_newBlockFilter");8console.log(filterId);9const logs = await provider.send("eth_getFilterChanges", [filterId]);10console.log(logs);11})();12
1import { ethers } from "ethers";23(async () => {4const provider = new ethers.JsonRpcProvider(5"https://docs-demo.avalanche-mainnet.quiknode.pro"6);7const filterId = await provider.send("eth_newBlockFilter");8console.log(filterId);9const logs = await provider.send("eth_getFilterChanges", [filterId]);10console.log(logs);11})();12
1出自 web3 import Web3, HTTPProvider2w3 = Web3(HTTPProvider('https://docs-demo.avalanche-mainnet.quiknode.pro'))3newBlockFilterId = w3.eth.filter('latest')4print(newBlockFilterId)
1出自 web3 import Web3, HTTPProvider2w3 = Web3(HTTPProvider('https://docs-demo.avalanche-mainnet.quiknode.pro'))3newBlockFilterId = w3.eth.filter('latest')4print(newBlockFilterId)