1

I have a smart contract running on Ropstein testnet. It includes an HTTP call to a third-party API which responds with a JSON. However, the _callback function doesn't seem to be invoking for some reason. Any clues? The relevant chunk of code:

function __callback(bytes32 queryId, string memory result) public override {
        emit APIResponse(result);
        if (msg.sender != provable_cbAddress()) revert();
        // rest of the code
    }

    function executeAPICall() private {
        if (provable_getPrice("URL") > msg.sender.balance) {
           emit Failure("Provable query was NOT sent, please add some ETH to cover for the query fee");
        } else {
            emit OK("Trying to fetch API..");
            provable_query("URL", "json(http://ip).property");
        }
    }

I'm sure that the query (or, well, the blockchain-side of it) is getting executed as it logs the OK event, but there's no APIResponse event present. Does it perhaps require the API to be served over HTTPS?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.