Chainlink.Request 没有 `add` 功能

Chainlink.Request doesn't have `add` function

现在我正在使用这个依赖项:"@chainlink/contracts": "^0.1.7" 和 solc v0.8

面临这个问题:Member "add" not found or not visible after argument-dependent lookup in struct Chainlink.Request memory

Chainlink.Request 没有 add 功能...请告诉我如何解决它。

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

contract ContractName is Ownable, ChainlinkClient {
    constructor() {
         setPublicChainlinkToken();
    }

    function requestData(
        address _oracle,
        bytes32 _jobId,
        string memory _endpoint,
        string memory _round,
        string memory _seasonId
    ) public {
        Chainlink.Request memory req =
            buildChainlinkRequest(_jobId, address(this), this.fulfill.selector);
        req.add(req, "endpoint", _endpoint);
        req.add(req, "round", _round);
        req.add(req, "season_id", _seasonId);

        sendChainlinkRequestTo(_oracle, req, fee_);
    }

enter image description here

编辑:始终对仍在开发 b运行ch 中的合同感到厌倦。话虽这么说,v0.8 Chainlink 客户端现在已经脱离了开发 b运行ch,这个答案仍然相关。

我 运行 遇到了同样的问题,并联系了 Chainlink 团队的 Avneet。原来这是由从 v0.7 开始的 Solidity 语言的变化引起的:

Breaking change in v0.7:

using A for B only affects the contract it is mentioned in. Previously, the effect was inherited. Now, you have to repeat the using statement in all derived contracts that make use of the feature. https://docs.soliditylang.org/en/v0.7.0/070-breaking-changes.html

因此,您需要添加 using Chainlink for Chainlink.Request; 到你的合同的顶部,像这样:

contract MyClient {
  using Chainlink for Chainlink.Request;