-
Notifications
You must be signed in to change notification settings - Fork 4
Feat/frijo/batching marketplace convert #406
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: development
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for pintomoney ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
…ersion This comprehensive update introduces batch operations across the marketplace and silo systems, replacing individual farm() calls with optimized batch functions for improved gas efficiency and user experience. Marketplace Batch Operations: - Add batch create/fill/cancel functions for pod listings and orders - Implement batchCreatePodListing, batchFillPodListing encoders with tests - Implement batchCreatePodOrder, batchFillPodOrder encoders - Add batchCancelPodListing and batchCancelPodOrder functionality - Update Market.tsx with expanded 6-tab structure - Create MyListingsTable and MyOrdersTable components - Add bulk selection and cancellation UI with checkbox columns - Implement single and batch cancel flows with analytics tracking Silo Batch Conversion: - Add ConvertBatchFacetABI with batchConvert function - Implement batchConvert encoder with BatchConvertParams interface - Replace individual convert() calls with batchConvert in deposit combine - Update encodeGroupCombineCalls to use batchConvert - Add comprehensive documentation for convert flow UI/UX Improvements: - Replace cancel dialogs with immediate cancellation flow - Add Select All functionality to listing/order tables - Implement My Listings and My Orders sub-tabs under My Activity - Add GraphQL queries for user's own listings and orders - Improve button styling and interaction patterns - Add warning UI for unowned listings in batch operations Testing & Documentation: - Add unit tests for batchCreatePodListing encoder - Add unit tests for batchFillPodListing encoder - Document createSmartGroups and encodeGroupCombineCalls functions - Document farm() usage patterns and replacement strategies - Add comprehensive inline documentation for new functions Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
37ac9b5 to
fe71f61
Compare
src/encoders/batchCancelPodOrder.ts
Outdated
| const args = orders.map((o) => ({ | ||
| orderer: o.orderer, | ||
| fieldId: o.fieldId, | ||
| pricePerPod: Number(o.pricePerPod.toBigInt()), // uint24 expects number, not bigint |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit. Can do o.pricePerPod.toNumber()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@claude please fix
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Claude finished @fr1jo's task in 56s —— View job
Fix applied ✓
- Read the current implementation in batchCancelPodOrder.ts
- Apply the fix to use
.toNumber()method - Commit and push changes
Changed line 24 from Number(o.pricePerPod.toBigInt()) to o.pricePerPod.toNumber() as suggested. This is cleaner and more idiomatic.
Note: I wasn't able to run yarn format-and-lint due to permission restrictions, but the change is straightforward and should not cause any formatting issues. You may want to run the linting command locally if needed.
--- | View commit
src/pages/market/MyListingsTable.tsx
Outdated
| } | ||
| }, [queryClient, allPodListings, allMarket, farmerMarket, onSelectionChange]); | ||
|
|
||
| const { writeWithEstimateGas, submitting } = useTransaction({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
useTransaction also has some other exports like setSubmitting, and confirming. Need to setSubmitting(true) and false manually in the submit handler. Otherwise button will appear as clickable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@claude please fix
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Claude finished @fr1jo's task in 1m 34s —— View job
Fix applied ✓
- Read the current implementation in batchCancelPodOrder.ts
- Apply the fix to use
.toNumber()method - Commit changes locally
Issue with pushing changes
I've successfully applied the fix to use o.pricePerPod.toNumber() instead of Number(o.pricePerPod.toBigInt()) in src/encoders/batchCancelPodOrder.ts:24. The change has been committed locally.
However, I'm encountering permission issues with git operations (fetch, pull, and push require approval). The commit is ready but couldn't be pushed to the remote branch.
The fix made:
// Before:
pricePerPod: Number(o.pricePerPod.toBigInt()),
// After:
pricePerPod: o.pricePerPod.toNumber(),This is cleaner and more idiomatic since TokenValue has a dedicated toNumber() method that converts the value to a number directly.
Next steps: A user with appropriate permissions will need to either:
- Grant approval for git operations and I can retry pushing
- Manually pull and push the local commit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@claude please fix useTransaction also has some other exports like setSubmitting, and confirming. Need to setSubmitting(true) and false manually in the submit handler. Otherwise button will appear as clickable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Claude finished @fr1jo's task in 1m 34s —— View job
Fix completed ✓
- Read MyListingsTable.tsx to understand current implementation
- Check MyOrdersTable.tsx to see the pattern already applied
- Update MyListingsTable.tsx to properly use setSubmitting
- Commit changes
- Push to remote branch
Changes Made
I've fixed the useTransaction usage in MyListingsTable.tsx to properly manage button state during submission:
Changes:
- Destructured
setSubmittingfrom theuseTransactionhook (line 71) - Added
setSubmitting(true)at the start ofhandleCancelImmediate(line 86) - Added
setSubmitting(false)in the finally block ofhandleCancelImmediate(line 102) - Added
setSubmitting(true)at the start ofhandleBulkCancelImmediate(line 127) - Added
setSubmitting(false)in the finally block ofhandleBulkCancelImmediate(line 148) - Updated dependency arrays to include
setSubmitting
This ensures the cancel buttons will be properly disabled during transaction submission and re-enabled afterward, preventing multiple clicks.
Commit: fc0bc3d7 - "fix(market): use setSubmitting in MyListingsTable submit handlers"
Note: I was unable to run yarn format-and-lint due to permission restrictions. You may want to run this command locally to ensure the code follows the project's formatting standards.
src/pages/market/MyOrdersTable.tsx
Outdated
| const { writeWithEstimateGas, submitting } = useTransaction({ | ||
| successMessage: "Order(s) cancelled successfully", | ||
| errorMessage: "Failed to cancel order(s)", | ||
| successCallback: onCancelSuccess, | ||
| }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@claude please fix. useTransaction also has some other exports like setSubmitting, and confirming. Need to setSubmitting(true) and false manually in the submit handler. Otherwise button will appear as clickable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Claude finished @fr1jo's task in 2m 15s —— View job
Fix completed
- Read the current implementation in MyOrdersTable.tsx
- Update the submit handler to use setSubmitting properly
- Commit changes locally
Changes Made
I've fixed the useTransaction usage in MyOrdersTable.tsx to properly manage button state during submission:
Changes:
- Destructured
setSubmittingfrom theuseTransactionhook (line 69) - Added
setSubmitting(true)at the start ofhandleCancelImmediate(line 83) - Added
setSubmitting(false)in the finally block ofhandleCancelImmediate(line 113) - Added
setSubmitting(true)at the start ofhandleBulkCancelImmediate(line 139) - Added
setSubmitting(false)in the finally block ofhandleBulkCancelImmediate(line 164) - Updated dependency arrays to include
setSubmitting
This ensures the cancel buttons will be properly disabled during transaction submission and re-enabled afterward, preventing multiple clicks.
Commit: c809716c - "fix(market): use setSubmitting in MyOrdersTable submit handlers"
Note: I was unable to push to the remote branch as there appears to be concurrent work happening. The changes are committed locally at commit c809716c. You may need to manually fetch and rebase/merge these changes, or another agent may have already pushed similar fixes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@claude please fix. useTransaction also has some other exports like setSubmitting, and confirming. Need to setSubmitting(true) and false manually in the submit handler. Otherwise button will appear as clickable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Claude finished @fr1jo's task in 1m 50s —— View job
Fix completed ✓
- Read MyOrdersTable.tsx to check current implementation
- Read MyListingsTable.tsx to see the correct pattern
- Apply setSubmitting pattern to MyOrdersTable.tsx
- Commit and push changes
Changes Applied
Updated MyOrdersTable.tsx to properly manage button state during transaction submission:
Changes made:
- Line 69: Destructured
setSubmittingfromuseTransactionhook - Line 83: Added
setSubmitting(true)at start ofhandleCancelImmediate - Line 113: Added
setSubmitting(false)in finally block ofhandleCancelImmediate - Line 121: Updated dependency array to include
setSubmitting - Line 139: Added
setSubmitting(true)at start ofhandleBulkCancelImmediate - Line 164-165: Added finally block with
setSubmitting(false)forhandleBulkCancelImmediate - Line 167: Updated dependency array to include
setSubmitting
This ensures the cancel buttons are properly disabled during transaction submission and re-enabled afterward, preventing multiple clicks.
Commit: ad3a946a - "fix(market): use setSubmitting in MyOrdersTable submit handlers"
Note: I was unable to run yarn format-and-lint due to permission restrictions. The changes follow the exact same pattern already applied in MyListingsTable.tsx, so formatting should be consistent. You may want to run the linting command locally if needed.
Use toNumber() method directly instead of Number(toBigInt()) Co-authored-by: fr1jo <[email protected]>
Properly manage button state during transaction submission to prevent multiple clicks by using setSubmitting from useTransaction hook. Co-authored-by: fr1jo <[email protected]>
Properly manage button state during transaction submission by: - Destructuring setSubmitting from useTransaction - Calling setSubmitting(true) at start of submit handlers - Calling setSubmitting(false) in finally blocks - Updating dependency arrays to include setSubmitting This prevents buttons from being clickable during transaction processing. Co-authored-by: fr1jo <[email protected]>
No description provided.