contract ERC721 {
function balanceOf(address _owner) external view returns (uint256);
function ownerOf(uint256 _tokenId) external view returns (address);
function safeTransferFrom(address _from, address _to, uint256 _tokenId, bytes data) external payable;
function safeTransferFrom(address _from, address _to, uint256 _tokenId) external payable;
function transferFrom(address _from, address _to, uint256 _tokenId) external payable;
function approve(address _approved, uint256 _tokenId) external payable;
function setApprovalForAll(address _operator, bool _approved) external;
function getApproved(uint256 _tokenId) external view returns (address);
function isApprovedForAll(address _owner, address _operator) external view returns (bool);
function supportsInterface(bytes4 interfaceID) external view returns (bool);
event Transfer(address indexed _from, address indexed _to, uint256 _tokenId);
event Approval(address indexed _owner, address indexed _approved, uint256 _tokenId);
event ApprovalForAll(address indexed _owner, address indexed _operator, bool _approved);
}
from web3 import Web3
import web3
CONTRACT = '0x22C1f6050E56d2876009903609a2cC3fEf83B415' # 合约地址
HTTPProvider = "https://dai.poa.network" # 主网HttpProvider
--- 打开abi json文件
with open('contracts/contract_abi.json', 'r') as contract_abi:
abi = json.load(contract_abi)
--- 提供HTTPProvider,链上互动的接口
w3 = Web3(Web3.HTTPProvider(HTTPProvider))
--- 检查HTTPProvider
print(w3.isConnected())