NEWTON
Asked
3 months ago
38
views
0
Hey! I have a contract deployed on Testnet. Let's say its address is 0x1234
.
I want to get its ABI somehow, but I don't have the code of the contract, because it wasn't deployed by me.
I'm using StarkNet.py to interact with StarkNet.
Does anyone know the answer?
0xa483...6765fa
asked
3 months ago
1
Accepted answer
Hey, to get the contract ABI using StarkNet.py just use the Client
's get_class_by_hash
method.
However, it requires you to know the contract's class_hash
. If you don't know it you will have to use a second method to get it.
Here is a short example of how to get an ABI of your contract.
client = GatewayClient(net="some_net")
address = 0x1234
class_hash = await client.get_class_hash_at(contract_address=address)
abi = (await client.get_class_by_hash(class_hash=class_hash)).abi
You can also go to starkscan.co and see class details. ABI is included there. Example: OpenZeppelin Universal Deployer
war-in
answered
3 months ago
How can I connect to deployed StarkNet contract using starknetjs?
How can I interact with my contract on Starknet using starknetjs?
How can I verify a contract on starkscan or voyager after deploying the contract
How to submit a StarkNet contract?
How to setup local Starknet node with Account contracts?
Why abi of warp compiled contract does not match original solidity abi?
What is the difference between tempvar/let in Cairo Lang? How to use allow_locals and local?
How to convert tokens on starknet? Any DEXs AMMs?
Warp Traspiler error: the warp-related package was not found. How do I generate python packages?
Cairo: let vs tempvar what is the difference?
What is Starknet.js?
How to use multicall with protostar 0.9.0?
How to use Access Control in Cairo language securely?
Python issues with Pathfinder