smartcontract Paypal.sol
function addHistory(address sender, address receiver, uint256 _amount, string memory _message) private {
sendReceive memory newSend;
newSend.action = "-";
newSend.amount = _amount;
newSend.message = _message;
newSend.otherPartyAddress = receiver;
if(names[receiver].hasName){
newSend.otherPartyName = names[receiver].name;
}
history[sender].push(newSend);
sendReceive memory newReceive;
newReceive.action = "+";
newReceive.amount = _amount;
newReceive.message = _message;
newReceive.otherPartyAddress = sender;
if(names[sender].hasName){
newReceive.otherPartyName = names[sender].name;
}
history[receiver].push(newReceive);
}
function getMyHistory(address _user) public view returns(sendReceive[] memory){
return history[_user];
}