Updating the Orders component

Now let's update the Orders.js component, which is the most elaborate component, given that we have to generate multiple products. Let's start by creating a function to get all the orders related to the current user, as shown in the following code:

async getOrders(amount) {    const pendingSellerOrdersLength = parseInt(await contract.methods.getOrdersLength(this.bytes32('seller'), user).call())    const pendingBuyerOrdersLength = parseInt(await contract.methods.getOrdersLength(this.bytes32('buyer'), user).call())    const completedOrdersLength = parseInt(await contract.methods.getOrdersLength(this.bytes32('completed'), user).call()) const conditionSeller = (amount > pendingSellerOrdersLength) ? 0 : pendingSellerOrdersLength ...

Get Mastering Ethereum now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.