{"openapi":"3.0.3","info":{"title":"Walnut API","description":"","license":{"name":""},"version":"1.1.0"},"paths":{"/v1/classes/{class_hash}":{"post":{"tags":["Contract class details"],"operationId":"get_class_handler","parameters":[{"name":"class_hash","in":"path","description":"Contract class hash","required":true,"schema":{"type":"string"}},{"name":"include_source_code","in":"query","description":"Whether to include the source code in the response","required":false,"schema":{"type":"boolean","nullable":true}},{"name":"rpc_urls","in":"query","description":"Comma-separated list of additional RPC URLs to check","required":false,"schema":{"type":"string","nullable":true}}],"responses":{"200":{"description":"Returns if the contract class is verified or not","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetClassResponse"}}}}}}},"/v1/classes/{class_hash}/contracts":{"get":{"tags":["Contract class verification"],"operationId":"get_contracts_by_class_hash_handler","parameters":[{"name":"class_hash","in":"path","description":"Class hash","required":true,"schema":{"type":"string"}},{"name":"rpc_urls","in":"query","description":"Comma-separated list of additional RPC URLs to check","required":false,"schema":{"type":"string","nullable":true}}],"responses":{"200":{"description":"Returns all contracts with the given class hash","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetContractsByClassHashResponse"}}}},"400":{"description":"Invalid class hash format or chain ID"},"404":{"description":"No contracts found for the given class hash"},"500":{"description":"Internal server error"}}}},"/v1/contracts/{contract_address}":{"post":{"tags":["Contract details"],"operationId":"get_contract_handler","parameters":[{"name":"contract_address","in":"path","description":"Contract address","required":true,"schema":{"type":"string"}},{"name":"rpc_urls","in":"query","description":"Comma-separated list of additional RPC URLs to check","required":false,"schema":{"type":"string","nullable":true}},{"name":"include_source_code","in":"query","description":"Whether to include the source code in the response","required":false,"schema":{"type":"boolean","nullable":true}},{"name":"include_abi","in":"query","description":"Whether to include the ABI in the response","required":false,"schema":{"type":"boolean","nullable":true}}],"responses":{"200":{"description":"Returns the contract data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetContractResponse"}}}},"404":{"description":"Contract not found for contract address","content":{"text/plain":{"schema":{"type":"string"}}}}}}},"/v1/contracts/{contract_address}/entrypoints":{"get":{"tags":["Contract entrypoints"],"operationId":"get_contract_entrypoints_handler","parameters":[{"name":"contract_address","in":"path","description":"Contract address","required":true,"schema":{"type":"string"}},{"name":"rpc_urls","in":"query","description":"Comma-separated list of additional RPC URLs to check","required":false,"schema":{"type":"string","nullable":true}}],"responses":{"200":{"description":"Returns the list of entry points of the contract","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContractAbiResponse"}}}},"404":{"description":"Contract not found"},"500":{"description":"Internal server error"}}}},"/v1/decode-calldata":{"post":{"tags":["Calldata Decoder"],"operationId":"decode_calldata_handler","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CalldataDecoderRequest"}}},"required":true},"responses":{"200":{"description":"Successfully decoded calldata","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CalldataDecoderResponse"}}}},"400":{"description":"Invalid request parameters"},"500":{"description":"Internal server error"}}}},"/v1/search/{search_hash}":{"post":{"tags":["Search for transaction, contract or class"],"operationId":"get_search_handler","parameters":[{"name":"search_hash","in":"path","description":"Search for transaction, contract or class","required":true,"schema":{"type":"string"}},{"name":"rpc_urls","in":"query","description":"Comma-separated list of additional RPC URLs to check","required":false,"schema":{"type":"string","nullable":true}}],"responses":{"200":{"description":"Returns the transaction, contract or class","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SearchResponse"}}}},"404":{"description":"Transaction, contract or class not found for the hash","content":{"text/plain":{"schema":{"type":"string"}}}}}}},"/v1/verification/{verification_status_id}/status":{"post":{"tags":["Contract class verification status"],"operationId":"get_verification_status_handler","parameters":[{"name":"verification_status_id","in":"path","description":"Verification status identifier","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Returns the status of the contract class verification","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VerificationStatusResponse"}}}},"404":{"description":"Verification status not found"},"500":{"description":"Internal server error"}}}},"/v1/verify":{"post":{"tags":["Contract class verification"],"operationId":"verify_handler_with_rpc","requestBody":{"description":"Class name, class hash, RPC URL, and source code to verify","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VerificationPayloadWithRpc"}}},"required":true},"responses":{"200":{"description":"Class verification has started","content":{"text/plain":{"schema":{"type":"string"}}}},"400":{"description":"An error occurred during verification; an error message will be returned","content":{"text/plain":{"schema":{"type":"string"}}}}}}},"/v1/{chain_id}/classes/{class_hash}":{"post":{"tags":["Contract class verification"],"operationId":"get_class_handler_with_chain_id","parameters":[{"name":"chain_id","in":"path","description":"Chain identifier","required":true,"schema":{"$ref":"#/components/schemas/ChainId"}},{"name":"class_hash","in":"path","description":"Contract class hash","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Returns the verified contract class data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetClassResponseWithSourceCode"}}}},"404":{"description":"Contract class not found for the given chain_id and class_hash","content":{"text/plain":{"schema":{"type":"string"}}}}}}},"/v1/{chain_id}/verify":{"post":{"tags":["Contract class verification"],"operationId":"verify_handler","parameters":[{"name":"chain_id","in":"path","description":"Chain identifier","required":true,"schema":{"$ref":"#/components/schemas/ChainId"}}],"requestBody":{"description":"Contract name, contract address or class hash, and source code to verify","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VerificationPayload"}}},"required":true},"responses":{"200":{"description":"Contract successfully verified","content":{"text/plain":{"schema":{"type":"string"}}}},"400":{"description":"An error occurred during verification; an error message will be returned","content":{"text/plain":{"schema":{"type":"string"}}}}}}}},"components":{"schemas":{"CalldataDecoderRequest":{"type":"object","required":["sender_address","calldata","transaction_version","chain_id"],"properties":{"block_number":{"type":"integer","format":"int64","nullable":true,"minimum":0},"calldata":{"type":"string"},"chain_id":{"type":"string"},"sender_address":{"type":"string"},"transaction_version":{"type":"integer","format":"int32","minimum":0}}},"CalldataDecoderResponse":{"type":"object","required":["decoded_calldata","raw_calldata","transaction_version","network","sender_address"],"properties":{"block_number":{"type":"integer","format":"int64","nullable":true,"minimum":0},"decoded_calldata":{"type":"array","items":{"$ref":"#/components/schemas/ContractCall"}},"network":{"type":"string"},"num_calls":{"type":"integer","format":"int32","nullable":true,"minimum":0},"raw_calldata":{"type":"array","items":{"type":"string"}},"sender_address":{"type":"string"},"transaction_version":{"type":"integer","format":"int32","minimum":0}}},"ChainId":{"type":"string","enum":["sn_mainnet","sn_sepolia"]},"ContractAbiResponse":{"type":"object","required":["entry_point_datas"],"properties":{"entry_point_datas":{"type":"array","items":{"type":"array","items":{"allOf":[{"type":"string"},{"$ref":"#/components/schemas/Function"}]}}}}},"ContractInfo":{"type":"object","required":["address","networks"],"properties":{"address":{"type":"string"},"deployment_time":{"type":"string","nullable":true},"networks":{"type":"array","items":{"$ref":"#/components/schemas/ESource"}}}},"GetClassResponse":{"type":"object","required":["verified","declared_sources"],"properties":{"declared_sources":{"type":"array","items":{"$ref":"#/components/schemas/ESource"}},"source":{"type":"string","nullable":true},"source_code":{"type":"object","additionalProperties":{"type":"string"},"nullable":true},"verified":{"type":"boolean"}}},"GetClassResponseWithSourceCode":{"type":"object","required":["source_code","source"],"properties":{"source":{"type":"string"},"source_code":{"type":"object","additionalProperties":{"type":"string"}}}},"GetContractResponse":{"type":"object","required":["class_hash","verified","deployed_sources","cairo_version"],"properties":{"abi":{"type":"string","nullable":true},"cairo_version":{"type":"string"},"class_hash":{"type":"string"},"deployed_sources":{"type":"array","items":{"$ref":"#/components/schemas/ESource"}},"source":{"type":"string","nullable":true},"source_code":{"type":"object","additionalProperties":{"type":"string"},"nullable":true},"verified":{"type":"boolean"}}},"GetContractsByClassHashResponse":{"type":"object","required":["class_hash","total_count","contracts"],"properties":{"class_hash":{"type":"string"},"contracts":{"type":"array","items":{"$ref":"#/components/schemas/ContractInfo"}},"total_count":{"type":"integer","minimum":0}}},"SearchResponse":{"type":"object","required":["transactions","classes","contracts"],"properties":{"classes":{"type":"array","items":{"$ref":"#/components/schemas/Data"}},"contracts":{"type":"array","items":{"$ref":"#/components/schemas/Data"}},"transactions":{"type":"array","items":{"$ref":"#/components/schemas/Data"}}}},"VerificationPayload":{"allOf":[{"$ref":"#/components/schemas/ContractIdentifier"},{"type":"object","required":["contract_name","source_code"],"properties":{"contract_name":{"type":"string"},"source_code":{"type":"object","additionalProperties":{"type":"string"},"example":"{ \"src/lib.cairo\": \"// lib.cairo source code\", \"src/utils/util1.cairo\": \"// util1.cairo source code\" }"}}}]},"VerificationPayloadWithRpc":{"type":"object","required":["source_code"],"properties":{"cairo_version":{"type":"string","nullable":true},"class_hash":{"type":"string","nullable":true},"class_hashes":{"type":"array","items":{"type":"string"},"nullable":true},"class_name":{"type":"string","nullable":true},"class_names":{"type":"array","items":{"type":"string"},"nullable":true},"rpc_url":{"type":"string","nullable":true},"source_code":{"type":"object","additionalProperties":{"type":"string"},"example":"{ \"src/lib.cairo\": \"// lib.cairo source code\", \"src/utils/util1.cairo\": \"// util1.cairo source code\" }"}}},"VerificationStatusResponse":{"type":"object","required":["verification_statuses"],"properties":{"error_message":{"type":"string","nullable":true},"verification_request":{"allOf":[{"$ref":"#/components/schemas/VerificationRequestRow"}],"nullable":true},"verification_statuses":{"type":"array","items":{"$ref":"#/components/schemas/VerificationStatusSerializable"}}}}}},"tags":[{"name":"Contract class verification","description":"We currently support the following cairo version & scarb version: 2.6.*"}]}