안녕하세요.
caver-java 이용시 view 함수 call 시에 이상현상?
view 함수를 call 시에 js 버전과 java 버전에서 리턴되는값이 달라서 질문을 남깁니다.
Caver caver = new Caver();
caver.setCurrentProvider(new HttpService(ServerConstants.KLAYTN_BABOBAB_WEBSOCKET));
Contract contract = caver.contract.create(cacheUtilBO.getNftConfig().getViewAbi(), cacheUtilBO.getNftConfig().getViewAddress());
List<Object> arguments = new ArrayList<>();
arguments.add(tokenId);
List<Type> types = contract.getMethod("getHeroInfo").call(arguments);
해당 코드 입니다.
tokenId 를 66번을 넣었는데 리턴되는값은 102로 나옵니다…
js 버전에서는 정상적으로 66으로 나옵니다.
무엇을 잘 못했는지 감도차도 안오네요…ㅠㅜ
view address : 0x46C4AC18F54472B5E87Fc24Bf10B94d46437Cd5f
아래는 abi 입니다.
[{"inputs":[{"internalType":"address","name":"_NFTStaking","type":"address"},{"internalType":"address","name":"_houseCore","type":"address"},{"internalType":"address","name":"_houseNFT","type":"address"},{"internalType":"address","name":"_mthzCore","type":"address"},{"internalType":"address","name":"_mthzNFT","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"constant":true,"inputs":[{"internalType":"uint256","name":"_gen1","type":"uint256"},{"internalType":"uint256","name":"_gen2","type":"uint256"},{"internalType":"uint256","name":"_count1","type":"uint256"},{"internalType":"uint256","name":"_count2","type":"uint256"}],"name":"getBreedPrice","outputs":[{"internalType":"uint256","name":"zmt","type":"uint256"},{"internalType":"uint256","name":"mgold","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getLimitSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"getLockTimeList","outputs":[{"components":[{"internalType":"uint256","name":"generation","type":"uint256"},{"internalType":"uint256","name":"endTime","type":"uint256"}],"internalType":"struct HeroView.TimeLockData[]","name":"result","type":"tuple[]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getTotalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"heroOwnerOf","outputs":[{"internalType":"address","name":"result","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"houseOwnerOf","outputs":[{"internalType":"address","name":"result","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"getExpectedRewardAmountUsingAddress","outputs":[{"internalType":"uint256","name":"result","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"_houseTokenId","type":"uint256"}],"name":"getExpectedRewardAmountUsingToken","outputs":[{"internalType":"uint256","name":"result","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getTotalHouseList","outputs":[{"components":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bool","name":"staked","type":"bool"},{"internalType":"string","name":"description","type":"string"},{"internalType":"string","name":"grade","type":"string"},{"internalType":"string","name":"name","type":"string"},{"internalType":"uint256","name":"level","type":"uint256"},{"internalType":"uint256","name":"generation","type":"uint256"},{"internalType":"uint256","name":"totalHash","type":"uint256"},{"internalType":"uint256","name":"myHash","type":"uint256"}],"internalType":"struct ViewTotal.HouseStatus[]","name":"result","type":"tuple[]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"getMyHouseTokenList","outputs":[{"components":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bool","name":"staked","type":"bool"}],"internalType":"struct ViewTotal.TokenList[]","name":"result","type":"tuple[]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"_heroTokenId","type":"uint256"}],"name":"getHeroInfo","outputs":[{"components":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"birthTime","type":"uint256"},{"internalType":"uint256","name":"generation","type":"uint256"},{"internalType":"string","name":"grade","type":"string"},{"internalType":"uint256","name":"breedCount","type":"uint256"},{"internalType":"bool","name":"staked","type":"bool"}],"internalType":"struct ViewTotal.HeroStatus","name":"result","type":"tuple"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"_houseTokenId","type":"uint256"}],"name":"getHouseInfo","outputs":[{"components":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bool","name":"staked","type":"bool"},{"internalType":"string","name":"description","type":"string"},{"internalType":"string","name":"grade","type":"string"},{"internalType":"string","name":"name","type":"string"},{"internalType":"uint256","name":"level","type":"uint256"},{"internalType":"uint256","name":"generation","type":"uint256"},{"internalType":"uint256","name":"totalHash","type":"uint256"},{"internalType":"uint256","name":"myHash","type":"uint256"}],"internalType":"struct ViewTotal.HouseStatus","name":"result","type":"tuple"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"getMyZeroGenerationTokenList","outputs":[{"internalType":"uint256[]","name":"result","type":"uint256[]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"getMyHeroData","outputs":[{"components":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"birthTime","type":"uint256"},{"internalType":"uint256","name":"generation","type":"uint256"},{"internalType":"string","name":"grade","type":"string"},{"internalType":"uint256","name":"breedCount","type":"uint256"},{"internalType":"bool","name":"staked","type":"bool"}],"internalType":"struct ViewTotal.HeroStatus[]","name":"result","type":"tuple[]"}],"payable":false,"stateMutability":"view","type":"function"}]