Solidity – ChainlinkClient.sol v0.8.0 Not Working with request.add()

chainlinkoraclessoliditysolidity-0.8.xtruffle

Im am relatively new to using ChainLinks ORACLE contract in solidity. I have recently managed to successfully integrate their VRFConsumerBase.sol in my consumer contract to generate random numbers. However, when i want to integrate and use their Client to make simple Get request to my API, it throws this error upon compiling

CompileError: TypeError: Member "add" not found or not visible after argument-dependent lookup in struct Chainlink.Request memory

I am currently using Truffle v5.1.65 & Sol 0.8.0. I am importing my ChainLink files as shown below :

import "@chainlink/contracts/src/v0.8/dev/ChainlinkClient.sol";

Here's My function :

    function uploadTokenDataToServer(NFT memory nft) public{

     require(LINK.balanceOf(address(this)) >= linkFee, "Not enough LINK - fill contract with faucet");


    Chainlink.Request memory request = buildChainlinkRequest(jobId, address(this), this.confirmUpload.selector);
    
    string memory finalURL = append(nft.ID,nft.creator,nft.desc) ;
    
    request.add("get", finalURL);
  
    return sendChainlinkRequestTo(oracle, request, linkFee);
}

It seems that the add function is not being detected when compiling. Any help would be greatly appreciated.

Best Answer

The solidity v0.8 contracts for Chainlink are still in active development, use the v0.6 contracts until they are ready.

import "@chainlink/contracts/src/v0.6/ChainlinkClient.sol";

For future reference, the contracts are currently in the dev folder of the v0.8 directory, indicating they aren't ready for production.

Related Topic