feat: add approve commands (create-claim, nft, erc20)#8
Conversation
Add `bulla approve` subcommand with three operations: - `create-claim` — BullaApprovalRegistry.approveCreateClaim - `nft` — BullaClaimV2.approve (ERC721) - `erc20` — ERC20.approve Each has build (unsigned tx) and execute (sign+send) variants. Adds ABIs, domain types, encoder port/adapter, service layer, CLI options/validation/commands, and registry support for bullaApprovalRegistry + bullaClaimV2 contract addresses. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Set 'approved' as default for --approval-type option - Add explicit validateApprovalType() with InvalidApprovalTypeError - Add unit tests for approve service (11 tests) and validation (16 tests) - Add e2e tests for all 3 approve build commands + help output Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
bengobeil
left a comment
There was a problem hiding this comment.
Still no support for approve transfers for BullaInvoice and BullaFrendLendV2. Write tests to confirm. Perhaps the whole e2e flow would be: mint invoice, approve transfer, then transfer, check that nft has changed ownership
bengobeil
left a comment
There was a problem hiding this comment.
Still no support for approve transfers for BullaInvoice and BullaFrendLendV2
Adds `bulla invoice approve-nft` and `bulla frendlend approve-nft` subcommands. Removes standalone `bulla approve nft`. Both target BullaClaimV2 via the registry since all claims are ERC721 on that contract regardless of which controller created them. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Pushed changes: approve-nft is now a subcommand on both |
…t commands - buildApproveNft now targets the controller contract (BullaInvoice or BullaFrendLendV2) for controlled claims, not BullaClaimV2 directly - Added transfer-nft subcommand to invoice and frendlend - Added full lifecycle e2e tests: mint -> approve -> transfer -> verify ownership (per claim type, execute mode with anvil) - Extended BullaClaimV2 ABI with transferFrom and ownerOf Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Addressed all 3 review comments: (1) approve-nft and transfer-nft now target the controller contract (BullaInvoice or BullaFrendLendV2) instead of BullaClaimV2 directly. (2) Full lifecycle e2e tests using execute mode with anvil: invoice create->approve->transfer->check ownership, frendlend offer->accept->approve->transfer->check ownership. (3) Added invoice transfer-nft and frendlend transfer-nft subcommands. 178 unit + 4 e2e tests pass, 9 lifecycle tests skipped without anvil. |
Uses publicnode.com Sepolia RPC as default when SEPOLIA_RPC_URL env var is not set, so approve/transfer lifecycle tests always run. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Round 3 review — all feedback addressed1.
|
- Create NftTransferService as Effect Context service with buildApproveNft and buildTransferNft methods - Use Layer.effect factory (makeNftTransferServiceLayer) to create controller-specific service instances (Invoice, FrendLend, Claim) - Provide NftTransferService via pipe in invoice/frendlend commands - Switch from transferFrom to safeTransferFrom for NFT transfers - Clean up approve-service.ts to only contain create-claim and ERC20 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
safeTransferFrom through the controller reverts with ERC721InsufficientApproval when called by an approved (non-owner) party on the deployed Sepolia contracts. transferFrom works correctly for the same flow (approve → transfer by approved party). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The 3-arg safeTransferFrom(address,address,uint256) is an external wrapper that internally calls the 4-arg public version. By calling the 4-arg safeTransferFrom(address,address,uint256,bytes) directly with empty bytes, we avoid any msg.sender issues in the external-to-public delegation path. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Hardhat's well-known test accounts (0xf39Fd6e..., 0x70997970...) have EOF contracts deployed on Sepolia, causing safeTransferFrom to call onERC721Received and revert. Clear account code via anvil_setCode after fork starts so these addresses behave as EOAs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
🎉 This PR is included in version 0.0.7 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Implements DEV-2391. Adds bulla approve subcommand with three operations: create-claim (BullaApprovalRegistry.approveCreateClaim), nft (BullaClaimV2.approve ERC721), erc20 (ERC20.approve). Each has build and execute variants. Adds ABIs, domain types, encoder port/adapter, service layer, CLI options/validation/commands, and registry support for bullaApprovalRegistry + bullaClaimV2 addresses.