From c9b9c4b158e3cdd5bacbd1423a73722e1a775398 Mon Sep 17 00:00:00 2001 From: Snedashkovsky Date: Sun, 30 Oct 2022 21:04:33 +0800 Subject: [PATCH 1/6] Update ENS Resolver ABI --- ens/abis.py | 491 ++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 438 insertions(+), 53 deletions(-) diff --git a/ens/abis.py b/ens/abis.py index d994209c4c..5a62782f88 100644 --- a/ens/abis.py +++ b/ens/abis.py @@ -521,50 +521,117 @@ RESOLVER = [ { "constant": True, - "inputs": [{"name": "interfaceID", "type": "bytes4"}], - "name": "supportsInterface", - "outputs": [{"name": "", "type": "bool"}], + "inputs": [ + {"name": "node", "type": "bytes32"}, + {"name": "contentTypes", "type": "uint256"}, + ], + "name": "ABI", + "outputs": [ + {"name": "", "type": "uint256"}, + {"name": "", "type": "bytes"}, + ], "payable": False, "stateMutability": "view", "type": "function", }, { - "constant": False, + "constant": True, + "inputs": [{"name": "node", "type": "bytes32"}], + "name": "addr", + "outputs": [ + {"name": "", "type": "address"}, + ], + "payable": False, + "stateMutability": "view", + "type": "function", + }, + { + "constant": True, "inputs": [ {"name": "node", "type": "bytes32"}, - {"name": "key", "type": "string"}, - {"name": "value", "type": "string"}, + {"name": "coinType", "type": "uint256"}, ], - "name": "setText", + "name": "addr", + "outputs": [{"name": "", "type": "bytes"}], + "payable": False, + "stateMutability": "view", + "type": "function", + }, + { + "constant": True, + "inputs": [ + {"name": "", "type": "bytes32"}, + {"name": "", "type": "address"}, + {"name": "", "type": "address"}, + ], + "name": "authorisations", + "outputs": [{"name": "", "type": "bool"}], + "payable": False, + "stateMutability": "view", + "type": "function", + }, + { + "constant": False, + "inputs": [{"name": "node", "type": "bytes32"}], + "name": "clearDNSZone", "outputs": [], "payable": False, "stateMutability": "nonpayable", "type": "function", }, + { + "constant": True, + "inputs": [{"name": "node", "type": "bytes32"}], + "name": "contenthash", + "outputs": [ + {"name": "", "type": "bytes"}, + ], + "payable": False, + "stateMutability": "view", + "type": "function", + }, { "constant": True, "inputs": [ {"name": "node", "type": "bytes32"}, - {"name": "contentTypes", "type": "uint256"}, + {"name": "name", "type": "bytes32"}, + {"name": "resource", "type": "uint16"}, ], - "name": "ABI", - "outputs": [ - {"name": "contentType", "type": "uint256"}, - {"name": "data", "type": "bytes"}, + "name": "dnsRecord", + "outputs": [{"name": "", "type": "bytes"}], + "payable": False, + "stateMutability": "view", + "type": "function", + }, + { + "constant": True, + "inputs": [ + {"name": "node", "type": "bytes32"}, + {"name": "name", "type": "bytes32"}, ], + "name": "hasDNSRecords", + "outputs": [{"name": "", "type": "bool"}], "payable": False, "stateMutability": "view", "type": "function", }, { - "constant": False, + "constant": True, "inputs": [ {"name": "node", "type": "bytes32"}, - {"name": "x", "type": "bytes32"}, - {"name": "y", "type": "bytes32"}, + {"name": "interfaceID", "type": "bytes4"}, ], - "name": "setPubkey", - "outputs": [], + "name": "interfaceImplementer", + "outputs": [{"name": "", "type": "address"}], + "payable": False, + "stateMutability": "view", + "type": "function", + }, + { + "constant": False, + "inputs": [{"name": "data", "type": "bytes[]"}], + "name": "multicall", + "outputs": [{"name": "results", "type": "bytes[]"}], "payable": False, "stateMutability": "nonpayable", "type": "function", @@ -572,8 +639,8 @@ { "constant": True, "inputs": [{"name": "node", "type": "bytes32"}], - "name": "content", - "outputs": [{"name": "ret", "type": "bytes32"}], + "name": "name", + "outputs": [{"name": "", "type": "string"}], "payable": False, "stateMutability": "view", "type": "function", @@ -581,21 +648,34 @@ { "constant": True, "inputs": [{"name": "node", "type": "bytes32"}], - "name": "addr", - "outputs": [{"name": "ret", "type": "address"}], + "name": "pubkey", + "outputs": [ + {"name": "x", "type": "bytes32"}, + {"name": "y", "type": "bytes32"}, + ], "payable": False, "stateMutability": "view", "type": "function", }, { - "constant": True, + "constant": False, "inputs": [ - {"name": "node", "type": "bytes32"}, - {"name": "key", "type": "string"}, + {"name": "name", "type": "bytes"}, + {"name": "data", "type": "bytes"}, ], - "name": "text", - "outputs": [{"name": "ret", "type": "string"}], - "payable": False, + "name": "resolve", + "outputs": [{"name": "", "type": "bytes"}], + "stateMutability": "view", + "type": "function", + }, + { + "constant": False, + "inputs": [ + {"name": "response", "type": "bytes"}, + {"name": "extraData", "type": "bytes"}, + ], + "name": "resolveWithProof", + "outputs": [{"name": "", "type": "bytes"}], "stateMutability": "view", "type": "function", }, @@ -613,21 +693,38 @@ "type": "function", }, { - "constant": True, - "inputs": [{"name": "node", "type": "bytes32"}], - "name": "name", - "outputs": [{"name": "ret", "type": "string"}], + "constant": False, + "inputs": [ + {"name": "node", "type": "bytes32"}, + {"name": "coinType", "type": "uint256"}, + {"name": "a", "type": "bytes"}, + ], + "name": "setAddr", + "outputs": [], "payable": False, - "stateMutability": "view", + "stateMutability": "nonpayable", "type": "function", }, { "constant": False, "inputs": [ {"name": "node", "type": "bytes32"}, - {"name": "name", "type": "string"}, + {"name": "a", "type": "address"}, ], - "name": "setName", + "name": "setAddr", + "outputs": [], + "payable": False, + "stateMutability": "nonpayable", + "type": "function", + }, + { + "constant": False, + "inputs": [ + {"name": "node", "type": "bytes32"}, + {"name": "target", "type": "address"}, + {"name": "isAuthorised", "type": "bool"}, + ], + "name": "setAuthorisation", "outputs": [], "payable": False, "stateMutability": "nonpayable", @@ -642,25 +739,40 @@ "name": "setContent", "outputs": [], "payable": False, + "type": "function", + }, + { + "constant": False, + "inputs": [ + {"name": "node", "type": "bytes32"}, + {"name": "hash", "type": "bytes"}, + ], + "name": "setContenthash", + "outputs": [], + "payable": False, "stateMutability": "nonpayable", "type": "function", }, { - "constant": True, - "inputs": [{"name": "node", "type": "bytes32"}], - "name": "pubkey", - "outputs": [{"name": "x", "type": "bytes32"}, {"name": "y", "type": "bytes32"}], + "constant": False, + "inputs": [ + {"name": "node", "type": "bytes32"}, + {"name": "data", "type": "bytes"}, + ], + "name": "setDNSRecords", + "outputs": [], "payable": False, - "stateMutability": "view", + "stateMutability": "nonpayable", "type": "function", }, { "constant": False, "inputs": [ {"name": "node", "type": "bytes32"}, - {"name": "addr", "type": "address"}, + {"name": "interfaceID", "type": "bytes4"}, + {"name": "implementer", "type": "address"}, ], - "name": "setAddr", + "name": "setInterface", "outputs": [], "payable": False, "stateMutability": "nonpayable", @@ -669,31 +781,215 @@ { "constant": False, "inputs": [ - {"internalType": "bytes", "name": "name", "type": "bytes"}, - {"internalType": "bytes", "name": "data", "type": "bytes"}, + {"name": "node", "type": "bytes32"}, + {"name": "name", "type": "string"}, ], - "name": "resolve", - "outputs": [{"internalType": "bytes", "name": "", "type": "bytes"}], + "name": "setName", + "outputs": [], + "payable": False, + "stateMutability": "nonpayable", + "type": "function", + }, + { + "constant": False, + "inputs": [ + {"name": "node", "type": "bytes32"}, + {"name": "x", "type": "bytes32"}, + {"name": "y", "type": "bytes32"}, + ], + "name": "setPubkey", + "outputs": [], + "payable": False, + "stateMutability": "nonpayable", + "type": "function", + }, + { + "constant": False, + "inputs": [ + {"name": "node", "type": "bytes32"}, + {"name": "key", "type": "string"}, + {"name": "value", "type": "string"}, + ], + "name": "setText", + "outputs": [], + "payable": False, + "stateMutability": "nonpayable", + "type": "function", + }, + { + "constant": True, + "inputs": [{"name": "interfaceID", "type": "bytes4"}], + "name": "supportsInterface", + "outputs": [{"name": "", "type": "bool"}], + "payable": False, + "stateMutability": "pure", + "type": "function", + }, + { + "constant": True, + "inputs": [ + {"name": "node", "type": "bytes32"}, + {"name": "key", "type": "string"}, + ], + "name": "text", + "outputs": [{"name": "", "type": "string"}], + "payable": False, + "stateMutability": "view", + "type": "function", + }, + { + "constant": True, + "inputs": [{"name": "node", "type": "bytes32"}], + "name": "content", + "outputs": [{"name": "ret", "type": "bytes32"}], + "payable": False, + "type": "function", + }, + { + "constant": True, + "inputs": [], + "name": "openSeaVersion", + "outputs": [{"name": "", "type": "string"}], + "payable": False, + "stateMutability": "pure", + "type": "function", + }, + { + "constant": False, + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "payable": False, + "stateMutability": "nonpayable", + "type": "function", + }, + { + "constant": False, + "inputs": [{"name": "tokenId", "type": "uint256"}], + "name": "addTokenId", + "outputs": [], + "payable": False, + "stateMutability": "nonpayable", + "type": "function", + }, + { + "constant": True, + "inputs": [], + "name": "isOwner", + "outputs": [{"name": "", "type": "bool"}], + "payable": False, "stateMutability": "view", "type": "function", }, { "constant": False, + "inputs": [{"name": "newOwner", "type": "address"}], + "name": "transferOwnership", + "outputs": [], + "payable": False, + "stateMutability": "nonpayable", + "type": "function", + }, + { + "constant": False, + "inputs": [{"name": "uri", "type": "string"}], + "name": "setBaseURI", + "outputs": [], + "payable": False, + "stateMutability": "nonpayable", + "type": "function", + }, + { + "constant": True, + "inputs": [], + "name": "baseURI", + "outputs": [{"name": "", "type": "string"}], + "payable": False, + "stateMutability": "view", + "type": "function", + }, + { + "constant": True, + "inputs": [], + "name": "owner", + "outputs": [{"name": "", "type": "address"}], + "payable": False, + "stateMutability": "view", + "type": "function", + }, + { + "constant": True, + "inputs": [{"name": "node", "type": "bytes32"}], + "name": "getTokenId", + "outputs": [{"name": "", "type": "uint256"}], + "payable": False, + "stateMutability": "view", + "type": "function", + }, + { "inputs": [ - {"internalType": "bytes", "name": "response", "type": "bytes"}, - {"internalType": "bytes", "name": "extraData", "type": "bytes"}, + {"name": "node", "type": "bytes32"}, + {"name": "spendingPubKeyPrefix", "type": "uint256"}, + {"name": "spendingPubKey", "type": "uint256"}, + {"name": "viewingPubKeyPrefix", "type": "uint256"}, + {"name": "viewingPubKey", "type": "uint256"}, ], - "name": "resolveWithProof", - "outputs": [{"internalType": "bytes", "name": "", "type": "bytes"}], + "name": "setStealthKeys", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function", + }, + { + "inputs": [ + {"name": "node", "type": "bytes32"}, + {"name": "hash", "type": "bytes"}, + ], + "name": "setZonehash", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function", + }, + { + "inputs": [{"name": "node", "type": "bytes32"}], + "name": "zonehash", + "outputs": [{"name": "", "type": "bytes"}], "stateMutability": "view", "type": "function", }, { - "inputs": [{"name": "ensAddr", "type": "address"}], + "inputs": [], + "name": "fallbackResolver", + "outputs": [{"name": "", "type": "address"}], + "stateMutability": "view", + "type": "function", + }, + { + "inputs": [{"name": "node", "type": "bytes32"}], + "name": "stealthKeys", + "outputs": [ + {"name": "spendingPubKeyPrefix", "type": "uint256"}, + {"name": "spendingPubKey", "type": "uint256"}, + {"name": "viewingPubKeyPrefix", "type": "uint256"}, + {"name": "viewingPubKey", "type": "uint256"}, + ], + "stateMutability": "view", + "type": "function", + }, + { + "inputs": [{"name": "_ens", "type": "address"}], "payable": False, "stateMutability": "nonpayable", "type": "constructor", }, + { + "anonymous": False, + "inputs": [ + {"indexed": True, "name": "node", "type": "bytes32"}, + {"indexed": True, "name": "contentType", "type": "uint256"}, + ], + "name": "ABIChanged", + "type": "event", + }, { "anonymous": False, "inputs": [ @@ -703,6 +999,27 @@ "name": "AddrChanged", "type": "event", }, + { + "anonymous": False, + "inputs": [ + {"indexed": True, "name": "node", "type": "bytes32"}, + {"indexed": False, "name": "coinType", "type": "uint256"}, + {"indexed": False, "name": "newAddress", "type": "bytes"}, + ], + "name": "AddressChanged", + "type": "event", + }, + { + "anonymous": False, + "inputs": [ + {"indexed": True, "name": "node", "type": "bytes32"}, + {"indexed": True, "name": "owner", "type": "address"}, + {"indexed": True, "name": "target", "type": "address"}, + {"indexed": False, "name": "isAuthorised", "type": "bool"}, + ], + "name": "AuthorisationChanged", + "type": "event", + }, { "anonymous": False, "inputs": [ @@ -712,6 +1029,62 @@ "name": "ContentChanged", "type": "event", }, + { + "anonymous": False, + "inputs": [ + {"indexed": True, "name": "node", "type": "bytes32"}, + {"indexed": False, "name": "hash", "type": "bytes"}, + ], + "name": "ContenthashChanged", + "type": "event", + }, + { + "anonymous": False, + "inputs": [ + {"indexed": True, "name": "node", "type": "bytes32"}, + {"indexed": False, "name": "name", "type": "bytes"}, + {"indexed": False, "name": "resource", "type": "uint16"}, + {"indexed": False, "name": "record", "type": "bytes"}, + ], + "name": "DNSRecordChanged", + "type": "event", + }, + { + "anonymous": False, + "inputs": [ + {"indexed": True, "name": "node", "type": "bytes32"}, + {"indexed": False, "name": "name", "type": "bytes"}, + {"indexed": False, "name": "resource", "type": "uint16"}, + ], + "name": "DNSRecordDeleted", + "type": "event", + }, + { + "anonymous": False, + "inputs": [{"indexed": True, "name": "node", "type": "bytes32"}], + "name": "DNSZoneCleared", + "type": "event", + }, + { + "anonymous": False, + "inputs": [ + {"indexed": True, "name": "node", "type": "bytes32"}, + {"indexed": False, "name": "lastzonehash", "type": "bytes"}, + {"indexed": False, "name": "zonehash", "type": "bytes"}, + ], + "name": "DNSZonehashChanged", + "type": "event", + }, + { + "anonymous": False, + "inputs": [ + {"indexed": True, "name": "node", "type": "bytes32"}, + {"indexed": True, "name": "interfaceID", "type": "bytes4"}, + {"indexed": False, "name": "implementer", "type": "address"}, + ], + "name": "InterfaceChanged", + "type": "event", + }, { "anonymous": False, "inputs": [ @@ -724,10 +1097,10 @@ { "anonymous": False, "inputs": [ - {"indexed": True, "name": "node", "type": "bytes32"}, - {"indexed": True, "name": "contentType", "type": "uint256"}, + {"indexed": True, "name": "previousOwner", "type": "address"}, + {"indexed": True, "name": "newOwner", "type": "address"}, ], - "name": "ABIChanged", + "name": "OwnershipTransferred", "type": "event", }, { @@ -740,6 +1113,18 @@ "name": "PubkeyChanged", "type": "event", }, + { + "anonymous": False, + "inputs": [ + {"indexed": True, "name": "node", "type": "bytes32"}, + {"indexed": False, "name": "spendingPubKeyPrefix", "type": "uint256"}, + {"indexed": False, "name": "spendingPubKey", "type": "uint256"}, + {"indexed": False, "name": "viewingPubKeyPrefix", "type": "uint256"}, + {"indexed": False, "name": "viewingPubKey", "type": "uint256"}, + ], + "name": "StealthKeyChanged", + "type": "event", + }, { "anonymous": False, "inputs": [ From 3f411076e048e66ed4a851d396894a33e56658c4 Mon Sep 17 00:00:00 2001 From: Snedashkovsky Date: Mon, 31 Oct 2022 17:26:43 +0800 Subject: [PATCH 2/6] Avoid getting 2 resolver functions named `addr` --- ens/base_ens.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ens/base_ens.py b/ens/base_ens.py index aa277c2e13..f8442f728c 100644 --- a/ens/base_ens.py +++ b/ens/base_ens.py @@ -104,7 +104,12 @@ def _decode_ensip10_resolve_data( extended_resolver: Union["Contract", "AsyncContract"], fn_name: str, ) -> Any: - func = extended_resolver.get_function_by_name(fn_name) + # avoid getting 2 resolver functions named `addr` + func = ( + extended_resolver.get_function_by_signature("addr(bytes32)") + if fn_name == "addr" + else extended_resolver.get_function_by_name(fn_name) + ) output_types = get_abi_output_types(func.abi) decoded = self.w3.codec.decode(output_types, contract_call_result) From b33215cbabce0b5e08cc4b290508dde093c6ff5c Mon Sep 17 00:00:00 2001 From: Snedashkovsky Date: Tue, 1 Nov 2022 11:47:50 +0800 Subject: [PATCH 3/6] Add newsfragment --- newsfragments/1839.feature.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 newsfragments/1839.feature.rst diff --git a/newsfragments/1839.feature.rst b/newsfragments/1839.feature.rst new file mode 100644 index 0000000000..489357d8d0 --- /dev/null +++ b/newsfragments/1839.feature.rst @@ -0,0 +1 @@ +Update ENS Resolver ABI \ No newline at end of file From 2e5140fe7a2ce5f14e8829c96fb4a20778fb03e3 Mon Sep 17 00:00:00 2001 From: fselmo Date: Thu, 6 Jul 2023 16:54:39 -0600 Subject: [PATCH 4/6] Match ABI of ENS: Public Resolver 2 - abi taken from: https://etherscan.io/address/0x4976fb03c32e5b8cfe2b6ccb31c09ba78ebaba41#code --- ens/abis.py | 745 ++++++++++++++++++++++++---------------------------- 1 file changed, 346 insertions(+), 399 deletions(-) diff --git a/ens/abis.py b/ens/abis.py index 5a62782f88..4427ff6489 100644 --- a/ens/abis.py +++ b/ens/abis.py @@ -519,16 +519,298 @@ ] RESOLVER = [ + { + "inputs": [{"internalType": "contract ENS", "name": "_ens", "type": "address"}], + "payable": False, + "stateMutability": "nonpayable", + "type": "constructor", + }, + { + "anonymous": False, + "inputs": [ + { + "indexed": True, + "internalType": "bytes32", + "name": "node", + "type": "bytes32", + }, + { + "indexed": True, + "internalType": "uint256", + "name": "contentType", + "type": "uint256", + }, + ], + "name": "ABIChanged", + "type": "event", + }, + { + "anonymous": False, + "inputs": [ + { + "indexed": True, + "internalType": "bytes32", + "name": "node", + "type": "bytes32", + }, + { + "indexed": False, + "internalType": "address", + "name": "a", + "type": "address", + }, + ], + "name": "AddrChanged", + "type": "event", + }, + { + "anonymous": False, + "inputs": [ + { + "indexed": True, + "internalType": "bytes32", + "name": "node", + "type": "bytes32", + }, + { + "indexed": False, + "internalType": "uint256", + "name": "coinType", + "type": "uint256", + }, + { + "indexed": False, + "internalType": "bytes", + "name": "newAddress", + "type": "bytes", + }, + ], + "name": "AddressChanged", + "type": "event", + }, + { + "anonymous": False, + "inputs": [ + { + "indexed": True, + "internalType": "bytes32", + "name": "node", + "type": "bytes32", + }, + { + "indexed": True, + "internalType": "address", + "name": "owner", + "type": "address", + }, + { + "indexed": True, + "internalType": "address", + "name": "target", + "type": "address", + }, + { + "indexed": False, + "internalType": "bool", + "name": "isAuthorised", + "type": "bool", + }, + ], + "name": "AuthorisationChanged", + "type": "event", + }, + { + "anonymous": False, + "inputs": [ + { + "indexed": True, + "internalType": "bytes32", + "name": "node", + "type": "bytes32", + }, + { + "indexed": False, + "internalType": "bytes", + "name": "hash", + "type": "bytes", + }, + ], + "name": "ContenthashChanged", + "type": "event", + }, + { + "anonymous": False, + "inputs": [ + { + "indexed": True, + "internalType": "bytes32", + "name": "node", + "type": "bytes32", + }, + { + "indexed": False, + "internalType": "bytes", + "name": "name", + "type": "bytes", + }, + { + "indexed": False, + "internalType": "uint16", + "name": "resource", + "type": "uint16", + }, + { + "indexed": False, + "internalType": "bytes", + "name": "record", + "type": "bytes", + }, + ], + "name": "DNSRecordChanged", + "type": "event", + }, + { + "anonymous": False, + "inputs": [ + { + "indexed": True, + "internalType": "bytes32", + "name": "node", + "type": "bytes32", + }, + { + "indexed": False, + "internalType": "bytes", + "name": "name", + "type": "bytes", + }, + { + "indexed": False, + "internalType": "uint16", + "name": "resource", + "type": "uint16", + }, + ], + "name": "DNSRecordDeleted", + "type": "event", + }, + { + "anonymous": False, + "inputs": [ + { + "indexed": True, + "internalType": "bytes32", + "name": "node", + "type": "bytes32", + } + ], + "name": "DNSZoneCleared", + "type": "event", + }, + { + "anonymous": False, + "inputs": [ + { + "indexed": True, + "internalType": "bytes32", + "name": "node", + "type": "bytes32", + }, + { + "indexed": True, + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4", + }, + { + "indexed": False, + "internalType": "address", + "name": "implementer", + "type": "address", + }, + ], + "name": "InterfaceChanged", + "type": "event", + }, + { + "anonymous": False, + "inputs": [ + { + "indexed": True, + "internalType": "bytes32", + "name": "node", + "type": "bytes32", + }, + { + "indexed": False, + "internalType": "string", + "name": "name", + "type": "string", + }, + ], + "name": "NameChanged", + "type": "event", + }, + { + "anonymous": False, + "inputs": [ + { + "indexed": True, + "internalType": "bytes32", + "name": "node", + "type": "bytes32", + }, + { + "indexed": False, + "internalType": "bytes32", + "name": "x", + "type": "bytes32", + }, + { + "indexed": False, + "internalType": "bytes32", + "name": "y", + "type": "bytes32", + }, + ], + "name": "PubkeyChanged", + "type": "event", + }, + { + "anonymous": False, + "inputs": [ + { + "indexed": True, + "internalType": "bytes32", + "name": "node", + "type": "bytes32", + }, + { + "indexed": True, + "internalType": "string", + "name": "indexedKey", + "type": "string", + }, + { + "indexed": False, + "internalType": "string", + "name": "key", + "type": "string", + }, + ], + "name": "TextChanged", + "type": "event", + }, { "constant": True, "inputs": [ - {"name": "node", "type": "bytes32"}, - {"name": "contentTypes", "type": "uint256"}, + {"internalType": "bytes32", "name": "node", "type": "bytes32"}, + {"internalType": "uint256", "name": "contentTypes", "type": "uint256"}, ], "name": "ABI", "outputs": [ - {"name": "", "type": "uint256"}, - {"name": "", "type": "bytes"}, + {"internalType": "uint256", "name": "", "type": "uint256"}, + {"internalType": "bytes", "name": "", "type": "bytes"}, ], "payable": False, "stateMutability": "view", @@ -536,11 +818,9 @@ }, { "constant": True, - "inputs": [{"name": "node", "type": "bytes32"}], + "inputs": [{"internalType": "bytes32", "name": "node", "type": "bytes32"}], "name": "addr", - "outputs": [ - {"name": "", "type": "address"}, - ], + "outputs": [{"internalType": "address payable", "name": "", "type": "address"}], "payable": False, "stateMutability": "view", "type": "function", @@ -548,11 +828,11 @@ { "constant": True, "inputs": [ - {"name": "node", "type": "bytes32"}, - {"name": "coinType", "type": "uint256"}, + {"internalType": "bytes32", "name": "node", "type": "bytes32"}, + {"internalType": "uint256", "name": "coinType", "type": "uint256"}, ], "name": "addr", - "outputs": [{"name": "", "type": "bytes"}], + "outputs": [{"internalType": "bytes", "name": "", "type": "bytes"}], "payable": False, "stateMutability": "view", "type": "function", @@ -560,19 +840,19 @@ { "constant": True, "inputs": [ - {"name": "", "type": "bytes32"}, - {"name": "", "type": "address"}, - {"name": "", "type": "address"}, + {"internalType": "bytes32", "name": "", "type": "bytes32"}, + {"internalType": "address", "name": "", "type": "address"}, + {"internalType": "address", "name": "", "type": "address"}, ], "name": "authorisations", - "outputs": [{"name": "", "type": "bool"}], + "outputs": [{"internalType": "bool", "name": "", "type": "bool"}], "payable": False, "stateMutability": "view", "type": "function", }, { "constant": False, - "inputs": [{"name": "node", "type": "bytes32"}], + "inputs": [{"internalType": "bytes32", "name": "node", "type": "bytes32"}], "name": "clearDNSZone", "outputs": [], "payable": False, @@ -581,11 +861,9 @@ }, { "constant": True, - "inputs": [{"name": "node", "type": "bytes32"}], + "inputs": [{"internalType": "bytes32", "name": "node", "type": "bytes32"}], "name": "contenthash", - "outputs": [ - {"name": "", "type": "bytes"}, - ], + "outputs": [{"internalType": "bytes", "name": "", "type": "bytes"}], "payable": False, "stateMutability": "view", "type": "function", @@ -593,12 +871,12 @@ { "constant": True, "inputs": [ - {"name": "node", "type": "bytes32"}, - {"name": "name", "type": "bytes32"}, - {"name": "resource", "type": "uint16"}, + {"internalType": "bytes32", "name": "node", "type": "bytes32"}, + {"internalType": "bytes32", "name": "name", "type": "bytes32"}, + {"internalType": "uint16", "name": "resource", "type": "uint16"}, ], "name": "dnsRecord", - "outputs": [{"name": "", "type": "bytes"}], + "outputs": [{"internalType": "bytes", "name": "", "type": "bytes"}], "payable": False, "stateMutability": "view", "type": "function", @@ -606,11 +884,11 @@ { "constant": True, "inputs": [ - {"name": "node", "type": "bytes32"}, - {"name": "name", "type": "bytes32"}, + {"internalType": "bytes32", "name": "node", "type": "bytes32"}, + {"internalType": "bytes32", "name": "name", "type": "bytes32"}, ], "name": "hasDNSRecords", - "outputs": [{"name": "", "type": "bool"}], + "outputs": [{"internalType": "bool", "name": "", "type": "bool"}], "payable": False, "stateMutability": "view", "type": "function", @@ -618,40 +896,40 @@ { "constant": True, "inputs": [ - {"name": "node", "type": "bytes32"}, - {"name": "interfaceID", "type": "bytes4"}, + {"internalType": "bytes32", "name": "node", "type": "bytes32"}, + {"internalType": "bytes4", "name": "interfaceID", "type": "bytes4"}, ], "name": "interfaceImplementer", - "outputs": [{"name": "", "type": "address"}], + "outputs": [{"internalType": "address", "name": "", "type": "address"}], "payable": False, "stateMutability": "view", "type": "function", }, { "constant": False, - "inputs": [{"name": "data", "type": "bytes[]"}], + "inputs": [{"internalType": "bytes[]", "name": "data", "type": "bytes[]"}], "name": "multicall", - "outputs": [{"name": "results", "type": "bytes[]"}], + "outputs": [{"internalType": "bytes[]", "name": "results", "type": "bytes[]"}], "payable": False, "stateMutability": "nonpayable", "type": "function", }, { "constant": True, - "inputs": [{"name": "node", "type": "bytes32"}], + "inputs": [{"internalType": "bytes32", "name": "node", "type": "bytes32"}], "name": "name", - "outputs": [{"name": "", "type": "string"}], + "outputs": [{"internalType": "string", "name": "", "type": "string"}], "payable": False, "stateMutability": "view", "type": "function", }, { "constant": True, - "inputs": [{"name": "node", "type": "bytes32"}], + "inputs": [{"internalType": "bytes32", "name": "node", "type": "bytes32"}], "name": "pubkey", "outputs": [ - {"name": "x", "type": "bytes32"}, - {"name": "y", "type": "bytes32"}, + {"internalType": "bytes32", "name": "x", "type": "bytes32"}, + {"internalType": "bytes32", "name": "y", "type": "bytes32"}, ], "payable": False, "stateMutability": "view", @@ -660,31 +938,9 @@ { "constant": False, "inputs": [ - {"name": "name", "type": "bytes"}, - {"name": "data", "type": "bytes"}, - ], - "name": "resolve", - "outputs": [{"name": "", "type": "bytes"}], - "stateMutability": "view", - "type": "function", - }, - { - "constant": False, - "inputs": [ - {"name": "response", "type": "bytes"}, - {"name": "extraData", "type": "bytes"}, - ], - "name": "resolveWithProof", - "outputs": [{"name": "", "type": "bytes"}], - "stateMutability": "view", - "type": "function", - }, - { - "constant": False, - "inputs": [ - {"name": "node", "type": "bytes32"}, - {"name": "contentType", "type": "uint256"}, - {"name": "data", "type": "bytes"}, + {"internalType": "bytes32", "name": "node", "type": "bytes32"}, + {"internalType": "uint256", "name": "contentType", "type": "uint256"}, + {"internalType": "bytes", "name": "data", "type": "bytes"}, ], "name": "setABI", "outputs": [], @@ -695,9 +951,9 @@ { "constant": False, "inputs": [ - {"name": "node", "type": "bytes32"}, - {"name": "coinType", "type": "uint256"}, - {"name": "a", "type": "bytes"}, + {"internalType": "bytes32", "name": "node", "type": "bytes32"}, + {"internalType": "uint256", "name": "coinType", "type": "uint256"}, + {"internalType": "bytes", "name": "a", "type": "bytes"}, ], "name": "setAddr", "outputs": [], @@ -708,8 +964,8 @@ { "constant": False, "inputs": [ - {"name": "node", "type": "bytes32"}, - {"name": "a", "type": "address"}, + {"internalType": "bytes32", "name": "node", "type": "bytes32"}, + {"internalType": "address", "name": "a", "type": "address"}, ], "name": "setAddr", "outputs": [], @@ -720,9 +976,9 @@ { "constant": False, "inputs": [ - {"name": "node", "type": "bytes32"}, - {"name": "target", "type": "address"}, - {"name": "isAuthorised", "type": "bool"}, + {"internalType": "bytes32", "name": "node", "type": "bytes32"}, + {"internalType": "address", "name": "target", "type": "address"}, + {"internalType": "bool", "name": "isAuthorised", "type": "bool"}, ], "name": "setAuthorisation", "outputs": [], @@ -733,19 +989,8 @@ { "constant": False, "inputs": [ - {"name": "node", "type": "bytes32"}, - {"name": "hash", "type": "bytes32"}, - ], - "name": "setContent", - "outputs": [], - "payable": False, - "type": "function", - }, - { - "constant": False, - "inputs": [ - {"name": "node", "type": "bytes32"}, - {"name": "hash", "type": "bytes"}, + {"internalType": "bytes32", "name": "node", "type": "bytes32"}, + {"internalType": "bytes", "name": "hash", "type": "bytes"}, ], "name": "setContenthash", "outputs": [], @@ -756,8 +1001,8 @@ { "constant": False, "inputs": [ - {"name": "node", "type": "bytes32"}, - {"name": "data", "type": "bytes"}, + {"internalType": "bytes32", "name": "node", "type": "bytes32"}, + {"internalType": "bytes", "name": "data", "type": "bytes"}, ], "name": "setDNSRecords", "outputs": [], @@ -768,9 +1013,9 @@ { "constant": False, "inputs": [ - {"name": "node", "type": "bytes32"}, - {"name": "interfaceID", "type": "bytes4"}, - {"name": "implementer", "type": "address"}, + {"internalType": "bytes32", "name": "node", "type": "bytes32"}, + {"internalType": "bytes4", "name": "interfaceID", "type": "bytes4"}, + {"internalType": "address", "name": "implementer", "type": "address"}, ], "name": "setInterface", "outputs": [], @@ -781,8 +1026,8 @@ { "constant": False, "inputs": [ - {"name": "node", "type": "bytes32"}, - {"name": "name", "type": "string"}, + {"internalType": "bytes32", "name": "node", "type": "bytes32"}, + {"internalType": "string", "name": "name", "type": "string"}, ], "name": "setName", "outputs": [], @@ -793,9 +1038,9 @@ { "constant": False, "inputs": [ - {"name": "node", "type": "bytes32"}, - {"name": "x", "type": "bytes32"}, - {"name": "y", "type": "bytes32"}, + {"internalType": "bytes32", "name": "node", "type": "bytes32"}, + {"internalType": "bytes32", "name": "x", "type": "bytes32"}, + {"internalType": "bytes32", "name": "y", "type": "bytes32"}, ], "name": "setPubkey", "outputs": [], @@ -806,9 +1051,9 @@ { "constant": False, "inputs": [ - {"name": "node", "type": "bytes32"}, - {"name": "key", "type": "string"}, - {"name": "value", "type": "string"}, + {"internalType": "bytes32", "name": "node", "type": "bytes32"}, + {"internalType": "string", "name": "key", "type": "string"}, + {"internalType": "string", "name": "value", "type": "string"}, ], "name": "setText", "outputs": [], @@ -818,9 +1063,9 @@ }, { "constant": True, - "inputs": [{"name": "interfaceID", "type": "bytes4"}], + "inputs": [{"internalType": "bytes4", "name": "interfaceID", "type": "bytes4"}], "name": "supportsInterface", - "outputs": [{"name": "", "type": "bool"}], + "outputs": [{"internalType": "bool", "name": "", "type": "bool"}], "payable": False, "stateMutability": "pure", "type": "function", @@ -828,313 +1073,15 @@ { "constant": True, "inputs": [ - {"name": "node", "type": "bytes32"}, - {"name": "key", "type": "string"}, + {"internalType": "bytes32", "name": "node", "type": "bytes32"}, + {"internalType": "string", "name": "key", "type": "string"}, ], "name": "text", - "outputs": [{"name": "", "type": "string"}], - "payable": False, - "stateMutability": "view", - "type": "function", - }, - { - "constant": True, - "inputs": [{"name": "node", "type": "bytes32"}], - "name": "content", - "outputs": [{"name": "ret", "type": "bytes32"}], - "payable": False, - "type": "function", - }, - { - "constant": True, - "inputs": [], - "name": "openSeaVersion", - "outputs": [{"name": "", "type": "string"}], - "payable": False, - "stateMutability": "pure", - "type": "function", - }, - { - "constant": False, - "inputs": [], - "name": "renounceOwnership", - "outputs": [], - "payable": False, - "stateMutability": "nonpayable", - "type": "function", - }, - { - "constant": False, - "inputs": [{"name": "tokenId", "type": "uint256"}], - "name": "addTokenId", - "outputs": [], - "payable": False, - "stateMutability": "nonpayable", - "type": "function", - }, - { - "constant": True, - "inputs": [], - "name": "isOwner", - "outputs": [{"name": "", "type": "bool"}], - "payable": False, - "stateMutability": "view", - "type": "function", - }, - { - "constant": False, - "inputs": [{"name": "newOwner", "type": "address"}], - "name": "transferOwnership", - "outputs": [], - "payable": False, - "stateMutability": "nonpayable", - "type": "function", - }, - { - "constant": False, - "inputs": [{"name": "uri", "type": "string"}], - "name": "setBaseURI", - "outputs": [], - "payable": False, - "stateMutability": "nonpayable", - "type": "function", - }, - { - "constant": True, - "inputs": [], - "name": "baseURI", - "outputs": [{"name": "", "type": "string"}], - "payable": False, - "stateMutability": "view", - "type": "function", - }, - { - "constant": True, - "inputs": [], - "name": "owner", - "outputs": [{"name": "", "type": "address"}], - "payable": False, - "stateMutability": "view", - "type": "function", - }, - { - "constant": True, - "inputs": [{"name": "node", "type": "bytes32"}], - "name": "getTokenId", - "outputs": [{"name": "", "type": "uint256"}], + "outputs": [{"internalType": "string", "name": "", "type": "string"}], "payable": False, "stateMutability": "view", "type": "function", }, - { - "inputs": [ - {"name": "node", "type": "bytes32"}, - {"name": "spendingPubKeyPrefix", "type": "uint256"}, - {"name": "spendingPubKey", "type": "uint256"}, - {"name": "viewingPubKeyPrefix", "type": "uint256"}, - {"name": "viewingPubKey", "type": "uint256"}, - ], - "name": "setStealthKeys", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function", - }, - { - "inputs": [ - {"name": "node", "type": "bytes32"}, - {"name": "hash", "type": "bytes"}, - ], - "name": "setZonehash", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function", - }, - { - "inputs": [{"name": "node", "type": "bytes32"}], - "name": "zonehash", - "outputs": [{"name": "", "type": "bytes"}], - "stateMutability": "view", - "type": "function", - }, - { - "inputs": [], - "name": "fallbackResolver", - "outputs": [{"name": "", "type": "address"}], - "stateMutability": "view", - "type": "function", - }, - { - "inputs": [{"name": "node", "type": "bytes32"}], - "name": "stealthKeys", - "outputs": [ - {"name": "spendingPubKeyPrefix", "type": "uint256"}, - {"name": "spendingPubKey", "type": "uint256"}, - {"name": "viewingPubKeyPrefix", "type": "uint256"}, - {"name": "viewingPubKey", "type": "uint256"}, - ], - "stateMutability": "view", - "type": "function", - }, - { - "inputs": [{"name": "_ens", "type": "address"}], - "payable": False, - "stateMutability": "nonpayable", - "type": "constructor", - }, - { - "anonymous": False, - "inputs": [ - {"indexed": True, "name": "node", "type": "bytes32"}, - {"indexed": True, "name": "contentType", "type": "uint256"}, - ], - "name": "ABIChanged", - "type": "event", - }, - { - "anonymous": False, - "inputs": [ - {"indexed": True, "name": "node", "type": "bytes32"}, - {"indexed": False, "name": "a", "type": "address"}, - ], - "name": "AddrChanged", - "type": "event", - }, - { - "anonymous": False, - "inputs": [ - {"indexed": True, "name": "node", "type": "bytes32"}, - {"indexed": False, "name": "coinType", "type": "uint256"}, - {"indexed": False, "name": "newAddress", "type": "bytes"}, - ], - "name": "AddressChanged", - "type": "event", - }, - { - "anonymous": False, - "inputs": [ - {"indexed": True, "name": "node", "type": "bytes32"}, - {"indexed": True, "name": "owner", "type": "address"}, - {"indexed": True, "name": "target", "type": "address"}, - {"indexed": False, "name": "isAuthorised", "type": "bool"}, - ], - "name": "AuthorisationChanged", - "type": "event", - }, - { - "anonymous": False, - "inputs": [ - {"indexed": True, "name": "node", "type": "bytes32"}, - {"indexed": False, "name": "hash", "type": "bytes32"}, - ], - "name": "ContentChanged", - "type": "event", - }, - { - "anonymous": False, - "inputs": [ - {"indexed": True, "name": "node", "type": "bytes32"}, - {"indexed": False, "name": "hash", "type": "bytes"}, - ], - "name": "ContenthashChanged", - "type": "event", - }, - { - "anonymous": False, - "inputs": [ - {"indexed": True, "name": "node", "type": "bytes32"}, - {"indexed": False, "name": "name", "type": "bytes"}, - {"indexed": False, "name": "resource", "type": "uint16"}, - {"indexed": False, "name": "record", "type": "bytes"}, - ], - "name": "DNSRecordChanged", - "type": "event", - }, - { - "anonymous": False, - "inputs": [ - {"indexed": True, "name": "node", "type": "bytes32"}, - {"indexed": False, "name": "name", "type": "bytes"}, - {"indexed": False, "name": "resource", "type": "uint16"}, - ], - "name": "DNSRecordDeleted", - "type": "event", - }, - { - "anonymous": False, - "inputs": [{"indexed": True, "name": "node", "type": "bytes32"}], - "name": "DNSZoneCleared", - "type": "event", - }, - { - "anonymous": False, - "inputs": [ - {"indexed": True, "name": "node", "type": "bytes32"}, - {"indexed": False, "name": "lastzonehash", "type": "bytes"}, - {"indexed": False, "name": "zonehash", "type": "bytes"}, - ], - "name": "DNSZonehashChanged", - "type": "event", - }, - { - "anonymous": False, - "inputs": [ - {"indexed": True, "name": "node", "type": "bytes32"}, - {"indexed": True, "name": "interfaceID", "type": "bytes4"}, - {"indexed": False, "name": "implementer", "type": "address"}, - ], - "name": "InterfaceChanged", - "type": "event", - }, - { - "anonymous": False, - "inputs": [ - {"indexed": True, "name": "node", "type": "bytes32"}, - {"indexed": False, "name": "name", "type": "string"}, - ], - "name": "NameChanged", - "type": "event", - }, - { - "anonymous": False, - "inputs": [ - {"indexed": True, "name": "previousOwner", "type": "address"}, - {"indexed": True, "name": "newOwner", "type": "address"}, - ], - "name": "OwnershipTransferred", - "type": "event", - }, - { - "anonymous": False, - "inputs": [ - {"indexed": True, "name": "node", "type": "bytes32"}, - {"indexed": False, "name": "x", "type": "bytes32"}, - {"indexed": False, "name": "y", "type": "bytes32"}, - ], - "name": "PubkeyChanged", - "type": "event", - }, - { - "anonymous": False, - "inputs": [ - {"indexed": True, "name": "node", "type": "bytes32"}, - {"indexed": False, "name": "spendingPubKeyPrefix", "type": "uint256"}, - {"indexed": False, "name": "spendingPubKey", "type": "uint256"}, - {"indexed": False, "name": "viewingPubKeyPrefix", "type": "uint256"}, - {"indexed": False, "name": "viewingPubKey", "type": "uint256"}, - ], - "name": "StealthKeyChanged", - "type": "event", - }, - { - "anonymous": False, - "inputs": [ - {"indexed": True, "name": "node", "type": "bytes32"}, - {"indexed": True, "name": "indexedKey", "type": "string"}, - {"indexed": False, "name": "key", "type": "string"}, - ], - "name": "TextChanged", - "type": "event", - }, ] REVERSE_RESOLVER = [ From dfc55c8f9ac8720a54e9153d02705d122d8aa569 Mon Sep 17 00:00:00 2001 From: fselmo Date: Thu, 6 Jul 2023 16:58:15 -0600 Subject: [PATCH 5/6] Clarify that the ABI belongs to ENS Public Resolver 2 - rename ``RESOLVER`` constant to ``PUBLIC_RESOLVER_2`` to better clarify what ABI we are trying to use as default --- ens/abis.py | 2 +- ens/async_ens.py | 2 +- ens/ens.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ens/abis.py b/ens/abis.py index 4427ff6489..8345a46b07 100644 --- a/ens/abis.py +++ b/ens/abis.py @@ -518,7 +518,7 @@ }, ] -RESOLVER = [ +PUBLIC_RESOLVER_2 = [ { "inputs": [{"internalType": "contract ENS", "name": "_ens", "type": "address"}], "payable": False, diff --git a/ens/async_ens.py b/ens/async_ens.py index 78d16065c5..b29f24b79c 100644 --- a/ens/async_ens.py +++ b/ens/async_ens.py @@ -107,7 +107,7 @@ def __init__( ens_addr = addr if addr else ENS_MAINNET_ADDR self.ens = self.w3.eth.contract(abi=abis.ENS, address=ens_addr) - self._resolver_contract = self.w3.eth.contract(abi=abis.RESOLVER) + self._resolver_contract = self.w3.eth.contract(abi=abis.PUBLIC_RESOLVER_2) self._reverse_resolver_contract = self.w3.eth.contract( abi=abis.REVERSE_RESOLVER ) diff --git a/ens/ens.py b/ens/ens.py index ee6123060b..df963c37c2 100644 --- a/ens/ens.py +++ b/ens/ens.py @@ -107,7 +107,7 @@ def __init__( ens_addr = addr if addr else ENS_MAINNET_ADDR self.ens = self.w3.eth.contract(abi=abis.ENS, address=ens_addr) - self._resolver_contract = self.w3.eth.contract(abi=abis.RESOLVER) + self._resolver_contract = self.w3.eth.contract(abi=abis.PUBLIC_RESOLVER_2) self._reverse_resolver_contract = self.w3.eth.contract( abi=abis.REVERSE_RESOLVER ) From 045c9c19ee8f242e3b37fb201c6ed59c2194ee6f Mon Sep 17 00:00:00 2001 From: fselmo Date: Thu, 6 Jul 2023 17:10:33 -0600 Subject: [PATCH 6/6] Extended Public Resolver 2 ABI with Extended Resolver ABI --- ens/abis.py | 25 +++++++++++++++++++++++++ ens/async_ens.py | 4 +++- ens/ens.py | 4 +++- 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/ens/abis.py b/ens/abis.py index 8345a46b07..cd6c71c7f3 100644 --- a/ens/abis.py +++ b/ens/abis.py @@ -1084,6 +1084,31 @@ }, ] +PUBLIC_RESOLVER_2_EXTENDED = PUBLIC_RESOLVER_2 + [ + { + "constant": False, + "inputs": [ + {"internalType": "bytes", "name": "name", "type": "bytes"}, + {"internalType": "bytes", "name": "data", "type": "bytes"}, + ], + "name": "resolve", + "outputs": [{"internalType": "bytes", "name": "", "type": "bytes"}], + "stateMutability": "view", + "type": "function", + }, + { + "constant": False, + "inputs": [ + {"internalType": "bytes", "name": "response", "type": "bytes"}, + {"internalType": "bytes", "name": "extraData", "type": "bytes"}, + ], + "name": "resolveWithProof", + "outputs": [{"internalType": "bytes", "name": "", "type": "bytes"}], + "stateMutability": "view", + "type": "function", + }, +] + REVERSE_RESOLVER = [ { "constant": True, diff --git a/ens/async_ens.py b/ens/async_ens.py index b29f24b79c..b27fc429a1 100644 --- a/ens/async_ens.py +++ b/ens/async_ens.py @@ -107,7 +107,9 @@ def __init__( ens_addr = addr if addr else ENS_MAINNET_ADDR self.ens = self.w3.eth.contract(abi=abis.ENS, address=ens_addr) - self._resolver_contract = self.w3.eth.contract(abi=abis.PUBLIC_RESOLVER_2) + self._resolver_contract = self.w3.eth.contract( + abi=abis.PUBLIC_RESOLVER_2_EXTENDED + ) self._reverse_resolver_contract = self.w3.eth.contract( abi=abis.REVERSE_RESOLVER ) diff --git a/ens/ens.py b/ens/ens.py index df963c37c2..4c78d6d95e 100644 --- a/ens/ens.py +++ b/ens/ens.py @@ -107,7 +107,9 @@ def __init__( ens_addr = addr if addr else ENS_MAINNET_ADDR self.ens = self.w3.eth.contract(abi=abis.ENS, address=ens_addr) - self._resolver_contract = self.w3.eth.contract(abi=abis.PUBLIC_RESOLVER_2) + self._resolver_contract = self.w3.eth.contract( + abi=abis.PUBLIC_RESOLVER_2_EXTENDED + ) self._reverse_resolver_contract = self.w3.eth.contract( abi=abis.REVERSE_RESOLVER )