- The
multicallClaim function is not assigning the eventPassNft to new owners. Use registerOwnership to assign them and update the existing test to check that.
- It's taking the first order to get the contractAddress. What happen if the following orders doesn't have the same contractAddress ? Same for eventPassId ? This function should be renamed to claimOrdersForEventPassId, it should check that all the orders are with the same
contractAddress and eventPassId since otherwise it's breaking. It should preferably take also as arguments directly the contractAddress and eventPassId.
- The integration test is far too thin !! Ideally we would need unit + integration test. I'm expecting many edge cases will break this function that is kind of long and weirdly organised. Look at:
try {
await adminSdk.UpdateOrdersStatus({
updates: orders.map((order) => ({
_set: {
status: OrderStatus_Enum.Completed,
},
where: {
id: {
_eq: order.id,
},
},
})),
});
} catch (e) {
console.error(e);
await adminSdk.UpdateOrdersStatus({
updates: orders.map((order) => ({
_set: {
status: OrderStatus_Enum.Error,
},
where: {
id: {
_eq: order.id,
},
},
})),
});
}
We should have a try catch that take the whole function (just after the initial checks) By the way I don't see check like checkOrder. It should check the total of orders quantity to be sure there is enough.
- Deprecate
checkOrder , claimOrder. We shouldn't instantiate the sdk like this anymore and use a master wallet. Using the gasless should be the norm.
multicallClaimfunction is not assigning the eventPassNft to new owners. UseregisterOwnershipto assign them and update the existing test to check that.contractAddressandeventPassIdsince otherwise it's breaking. It should preferably take also as arguments directly thecontractAddressandeventPassId.We should have a try catch that take the whole function (just after the initial checks) By the way I don't see check like
checkOrder. It should check the total of orders quantity to be sure there is enough.checkOrder,claimOrder. We shouldn't instantiate the sdk like this anymore and use a master wallet. Using the gasless should be the norm.