firefly icon indicating copy to clipboard operation
firefly copied to clipboard

Struct array be not retuen from custom smart contracts via created REST-API by FireFly.

Open ivis-tsukioka opened this issue 3 years ago • 2 comments
trafficstars

I deployed custom smart contracts to Quorum on FireFly using truffle. And I have generated REST-API for the contract using FireFly API.

I cannot get expected output from "getFunction"(below src) which return Struct array(Definitions.CustomToken[]). But I can get expected output from another function which return Definitions.CustomToken.

This behavior is similar to another issue.

I cannot understand why "getFunction" don`t return Struct array. Could you help me please?

This is my simplified smartcontract code :

pragma solidity >=0.4.22 <0.9.0;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "./Definitions.sol";

contract Logic is ERC721Enumerable {


    function getFunction(uint256[] memory Ids) 
        public 
        view 
        returns (Definitions.CustomToken[] memory)
    {
        // (abridgement) get or create Definitions.CustomToken[]

        return tokenList;
    }
}
pragma solidity >=0.4.22 <0.9.0;

contract Definitions {

    struct CustomToken {
        uint256 tokenId; 
        string tokenNm; 
        uint256 createdAt; 
    }
}

expected output from REST-API for the contract:

{
  "": [
    {
      "tokenId": "integer",
      "tokenNm": "string",
      "createdAt": "integer",
    },
    {
      "tokenId": "integer",
      "tokenNm": "string",
      "createdAt": "integer",
    }
  ]
}

but effective output:

{
    "output": [
        {},
        {}
    ]
}

ivis-tsukioka avatar Aug 31 '22 03:08 ivis-tsukioka

Thanks for reporting this. Can you please confirm which version of FireFly you were running when you saw this behavior?

I will attempt to reproduce this report back here with what I find.

nguyer avatar Aug 31 '22 12:08 nguyer

Thanks for reporting this. Can you please confirm which version of FireFly you were running when you saw this behavior?

=> I am using v1.0.2 FireFly

ff@ubuntu:~$ ff version
{
  "Version": "v1.0.2",
  "License": "Apache-2.0"
}

ivis-tsukioka avatar Sep 01 '22 00:09 ivis-tsukioka