i try to integrate blockchain in my spring boot project
i’m not familiar with blockchain so i try hard to learn
I created contract.sol
pragma solidity ^0.8.0;
contract PaymentContract {
struct Payment {
string payer;
string payee;
uint256 amount;
}
Payment[] public payments;
function addPayment(string memory _payer, string memory _payee, uint256 _amount) public {
payments.push(Payment(_payer, _payee, _amount));
}
function getPayment(uint256 index) public view returns (string memory, string memory, uint256) {
Payment memory payment = payments[index];
return (payment.payer, payment.payee, payment.amount);
}
}
after that i run
truffle compile
truffle migrate
i have already installed WEB3J and add it to my environnement variables
when run this command to generate java class
web3j truffle generate build/contracts/PaymentContract.json -o src/main/java -p com.example.demo.contracts
i have this error
web3j generate solidity -a build/contracts/PaymentContract.json -o src/main/java -p com.example.demo.contracts
>>
_ _____ _
| | |____ (_)
__ _____| |__ / /_
/ / / _ '_ |
V V / __/ |_) |.___/ / |
_/_/ ___|_.__/ ____/| |
_/ |
|__/
by Web3Labs
Cannot deserialize value of type `org.web3j.protocol.core.methods.response.AbiDefinition[]` from Object value (token `JsonToken.START_OBJECT`)
at [Source: REDACTED (`StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION` disabled); line: 1, column: 1]
or there is any other solution with interact directly with contract from java
i have tried to upgrade the web3j but i couldn’t find any other version
current version
web3j -v
>>
_ _____ _
| | |____ (_)
__ _____| |__ / /_
/ / / _ '_ |
V V / __/ |_) |.___/ / |
_/_/ ___|_.__/ ____/| |
_/ |
|__/
by Web3Labs
Version: 1.6.0
Build timestamp: 2024-05-27 15:59:33.591 UTC