Something weird and new happening after upgrading moralis and server, when I use this contract method the callback fires endlessly!
marketContract.value.methods.addItemToMarket(props.token_address, props.token_id, askingPriceWei.value, 0).send({from: sender})
.on('receipt', receipt => {
console.log('receipt:', receipt)
})
.on('error', (err) => {
console.log('error selling nft:', err)
})
}
Contract:
/**
* @dev Adds a new item to the market
* @param token_address - nft erc721 address
* @param token_id - nft token id
* @param askingPrice - asking price in wei
* @param expiresAt - time in hours when sale end
*/
function _addItemToMarket(
address token_address,
uint256 token_id,
uint256 askingPrice,
uint256 expiresAt
)
internal
{
require(askingPrice > 0, "Price should be greater than 0");
if (expiresAt != 0) require(expiresAt > block.timestamp + 1 minutes, "Listing should be more than 1 minute in the future");
address owner_of = IERC721Upgradeable(token_address).ownerOf(token_id);
bytes32 item_id = keccak256(
abi.encodePacked(
block.timestamp,
owner_of,
token_id,
token_address,
askingPrice
)
);
marketItemByTokenId[token_address][token_id] = MarketItem({
item_id: item_id,
token_id: token_id,
token_address: token_address,
owner_of: owner_of,
askingPrice: askingPrice,
expiresAt: expiresAt
});
emit ItemAdded(
item_id,
token_id,
token_address,
owner_of,
askingPrice,
expiresAt
);
}
Iām in the middle of testing new contracts, while also upgrading code and dependencies, but it doesnāt make senseā¦ what could cause the callback to keep firing?
server v0.0.255 & āmoralisā: ā^0.0.39ā