Skip to content

Conversation

@rodrigopavezi
Copy link
Member

@rodrigopavezi rodrigopavezi commented Dec 9, 2025

Summary

This PR deploys the ERC20CommerceEscrowWrapper contract to Sepolia and Base networks, enabling the Commerce Escrow payment flow for Request Network on these chains. It also cleans up deprecated deployment infrastructure and migrates The Graph endpoints.

Why

The ERC20CommerceEscrowWrapper is needed to support the Commerce Escrow payment pattern—where payments are authorized, captured, and can be refunded—integrated with Request Network's fee proxy system. Deploying to Sepolia enables testnet development, while Base deployment enables production use on a low-cost L2.

The Graph migration from Alchemy/Satsuma to The Graph Studio consolidates our subgraph infrastructure and removes dependency on the deprecated Alchemy-hosted endpoints.

The deployment script cleanup removes one-off tooling that was created for initial deployment exploration but is no longer needed now that we use the standard Create2 deployment flow.

Deployments Completed ✅

@MantisClone completed the Create2 deployments to both networks:

Network Address Block Verified
Sepolia 0xc9b2eCBc2bfb38908f0Ee59729875959A09E6Ea5 9822153
Base 0x9A73b3774183d07d4a2b585B04982F2Ec672B03b 39363932

Block Explorer Links:

Description of the changes

Smart Contract Artifacts

  • Updated ERC20CommerceEscrowWrapper artifact with deployed addresses for Sepolia and Base
  • Updated AuthCaptureEscrow artifact with Sepolia address (0xF81E3F293c92CaCfc0d723d2D8183e39Cc3AEdC7, block 9795220)
  • Removed deprecated network entries (goerli, mumbai, base-sepolia placeholder) from ERC20CommerceEscrowWrapper
  • Removed base-sepolia entry from ERC20FeeProxy artifact

Deployment Script Cleanup

  • Removed deploy-erc20-commerce-escrow-wrapper.ts — superseded by Create2 deployment flow
  • Removed deploy-base-sepolia.sh interactive deployment script
  • Removed test-base-sepolia-deployment.ts test script
  • Removed update-base-sepolia-addresses.js utility script
  • Removed BASE_SEPOLIA_README.md documentation
  • Removed hardhat task registration for deploy-erc20-commerce-escrow-wrapper

The Graph Endpoint Migration

  • Switched GraphQL codegen schema from Alchemy/Satsuma to The Graph Studio — Alchemy endpoints are being deprecated
  • Removed THE_GRAPH_ALCHEMY_URL and THE_GRAPH_ALCHEMY_CHAINS constants
  • Updated getTheGraphClientUrl() to prefer The Graph Explorer when API key is available, otherwise fall back to Studio URL
  • Updated test expectations to use Studio URLs

Request Client Test Improvements

  • Added jest.restoreAllMocks() to global afterEach — fixes spy leakage between tests causing flaky failures
  • Added mockServer.resetHandlers() in test setup/teardown
  • Replaced direct mock assignments with jest.spyOn() for Etherscan provider methods — proper cleanup
  • Added paymentOptions to RequestNetwork constructor in tests
  • Added disablePaymentDetection option to createRequest calls
  • Replaced jest.advanceTimersByTime() with real setTimeout delays — improves test stability

Payment Processor Test Updates

  • Updated erc20-commerce-escrow-wrapper.test.ts to use dynamic wrapper addresses via getCommerceEscrowWrapperAddress(network) — tests now use real deployed addresses instead of placeholders

…ort network-specific contract addresses

- Introduced NETWORK_CONTRACTS for managing contract addresses by network.
- Updated deployment logic to use existing ERC20FeeProxy if available, or deploy a new one.
- Modified AuthCaptureEscrow address retrieval to be network-specific.
- Updated Sepolia deployment address for AuthCaptureEscrow and ERC20CommerceEscrowWrapper.
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 9, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

Removed Base Sepolia deployment scripts and helpers; updated several contract artifact network entries (AuthCaptureEscrow, ERC20FeeProxy, ERC20CommerceEscrowWrapper); switched The Graph endpoints from Alchemy/Satsuma to The Graph Studio/Explorer; adjusted tests and RequestNetwork API for payment-detection wiring and timers.

Changes

Cohort / File(s) Change Summary
Removed Base Sepolia deployment scripts
packages/smart-contracts/scripts/deploy-erc20-commerce-escrow-wrapper.ts, packages/smart-contracts/scripts/deploy-base-sepolia.sh, packages/smart-contracts/scripts/test-base-sepolia-deployment.ts, packages/smart-contracts/scripts/update-base-sepolia-addresses.js, BASE_SEPOLIA_README.md
Deleted deployment helper script, interactive shell deploy script, test deploy helper, address-update utility, and Base Sepolia README — removing automated/manual Base Sepolia deployment tooling and documentation.
Hardhat task removal
packages/smart-contracts/hardhat.config.ts
Removed import and Hardhat task registration for deploy-erc20-commerce-escrow-wrapper, including its flags and task wiring.
AuthCaptureEscrow artifact update
packages/smart-contracts/src/lib/artifacts/AuthCaptureEscrow/index.ts
Updated version 0.1.0 sepolia deployment address to 0xF81E3F293c92CaCfc0d723d2D8183e39Cc3AEdC7, set creationBlockNumber to 9795220, and adjusted surrounding comments.
ERC20CommerceEscrowWrapper artifact edits
packages/smart-contracts/src/lib/artifacts/ERC20CommerceEscrowWrapper/index.ts
Removed several testnet entries (base-sepolia, goerli, mumbai), updated sepolia to a concrete address and base (mainnet-like) entry to a concrete address and creationBlockNumber; comments updated.
ERC20FeeProxy artifact edits
packages/smart-contracts/src/lib/artifacts/ERC20FeeProxy/index.ts
Removed the base-sepolia deployment entry under version 0.2.0 (data-only change).
The Graph codegen config
packages/payment-detection/codegen.yml
Switched GraphQL schema endpoint from a Satsuma/Alchemy-hosted URL to The Graph Studio/versioned URL; generation settings otherwise unchanged.
The Graph client logic & tests
packages/payment-detection/src/thegraph/client.ts, packages/payment-detection/test/thegraph/client.test.ts
Removed Alchemy-specific constants/fallback and shouldUseAlchemy logic; getTheGraphClientUrl now prefers The Graph Explorer when API key+subgraph ID present, else falls back to Studio URL. Updated test expectation to match Studio/Explorer URL construction.
Request-client.js tests & public API
packages/request-client.js/test/index.test.ts
Test plumbing: restore real timers in afterEach, reset MSW handlers consistently, replace some mocks with jest.spyOn, use short real delays. Tests now construct RequestNetwork with optional paymentOptions and call createRequest with optional disablePaymentDetection. Public signatures changed: RequestNetwork constructor accepts optional paymentOptions, and RequestNetwork.createRequest accepts optional disablePaymentDetection: boolean.
Payment-processor ERC20 wrapper tests
packages/payment-processor/test/payment/erc20-commerce-escrow-wrapper.test.ts
Tests now obtain wrapper address via getCommerceEscrowWrapperAddress(network), assert valid non-zero addresses (instead of hardcoded addresses), and update encoding/allowance checks to use dynamic wrapperAddress; removed multi-network cross-checks.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

  • Pay attention to deleted deployment scripts and any CI/CD or ops automation referencing them.
  • Verify artifact address and creationBlockNumber updates for consistency across artifacts.
  • Confirm The Graph endpoint switch produces correct runtime URLs and that codegen remains compatible.
  • Review RequestNetwork API changes for backward compatibility and update callers/tests relying on constructor/createRequest signatures.
  • Inspect tests for timing and mocking changes to ensure stability and avoid flakiness.

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: refactoring the deployment script to support network-specific contract addresses, which aligns with the primary objective of adding NETWORK_CONTRACTS and making deployments network-aware.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Description check ✅ Passed The PR description is comprehensive, well-structured, and covers all major changes including deployments, cleanup, and migrations with clear justification.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/commerce-escrow-eth-sepolia-deployment

Comment @coderabbitai help to get the list of available commands and usage tips.

@greptile-apps
Copy link

greptile-apps bot commented Dec 9, 2025

Greptile Overview

Greptile Summary

Refactored the deployment script to support network-specific contract addresses through a NETWORK_CONTRACTS configuration map, enabling the script to either reuse existing ERC20FeeProxy contracts or deploy new ones based on network availability. Updated deployment addresses for Sepolia network with actual contract addresses, replacing previous placeholder values.

Changes:

  • Introduced NETWORK_CONTRACTS map to manage AuthCaptureEscrow and ERC20FeeProxy addresses per network
  • Added conditional logic to reuse existing ERC20FeeProxy when available (e.g., Sepolia) or deploy new one when not configured
  • Updated Sepolia AuthCaptureEscrow address to 0xF81E3F293c92CaCfc0d723d2D8183e39Cc3AEdC7
  • Updated Sepolia ERC20CommerceEscrowWrapper address to 0x4062C5c38b14A90f9293010a72b53FA3b400bD46
  • Removed deprecated network entries (goerli, mumbai) from ERC20CommerceEscrowWrapper artifact
  • Enhanced error handling with network validation check

Issues:

  • Comment in AuthCaptureEscrow artifact claims "same address as sepolia via CREATE2" but addresses differ between Sepolia and Base networks

Confidence Score: 4/5

  • This PR is safe to merge after fixing the misleading comment
  • The refactoring improves code maintainability by centralizing network configurations and adds proper error handling. The logic correctly handles both existing and new ERC20FeeProxy deployments. One minor issue: a comment incorrectly states addresses match across networks when they don't, which should be corrected to avoid confusion.
  • packages/smart-contracts/src/lib/artifacts/AuthCaptureEscrow/index.ts requires a comment correction

Important Files Changed

File Analysis

Filename Score Overview
packages/smart-contracts/scripts/deploy-erc20-commerce-escrow-wrapper.ts 4/5 Refactored deployment script to support network-specific contract addresses via NETWORK_CONTRACTS map, with logic to reuse existing ERC20FeeProxy when available
packages/smart-contracts/src/lib/artifacts/AuthCaptureEscrow/index.ts 3/5 Updated Sepolia deployment address from placeholder to actual address 0xF81E3F293c92CaCfc0d723d2D8183e39Cc3AEdC7, but comment about CREATE2 addresses is now misleading
packages/smart-contracts/src/lib/artifacts/ERC20CommerceEscrowWrapper/index.ts 5/5 Updated Sepolia deployment address from placeholder to actual address 0x4062C5c38b14A90f9293010a72b53FA3b400bD46, removed unused network entries (goerli, mumbai, commented mainnet/matic)

Sequence Diagram

sequenceDiagram
    participant Script as Deployment Script
    participant Config as NETWORK_CONTRACTS
    participant Network as Network Check
    participant ERC20FeeProxy as ERC20FeeProxy
    participant AuthCaptureEscrow as AuthCaptureEscrow
    participant Wrapper as ERC20CommerceEscrowWrapper

    Script->>Network: Get network name
    Script->>Config: Lookup network in NETWORK_CONTRACTS
    alt Network not configured
        Config-->>Script: throw Error
    end
    
    Config-->>Script: Return network config
    
    alt ERC20FeeProxy exists in config
        Script->>Script: Use existing ERC20FeeProxy address
    else ERC20FeeProxy not in config
        Script->>ERC20FeeProxy: Deploy new ERC20FeeProxy
        ERC20FeeProxy-->>Script: Return deployed address
    end
    
    Script->>Config: Get AuthCaptureEscrow address
    Config-->>Script: Return network-specific address
    
    Script->>Wrapper: Deploy with (authCaptureEscrowAddress, erc20FeeProxyAddress)
    Wrapper-->>Script: Return deployed address
    
    Script->>Script: Log deployment summary
Loading

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

coderabbitai[bot]
coderabbitai bot previously approved these changes Dec 9, 2025
rodrigopavezi and others added 3 commits December 9, 2025 13:18
…ndex.ts

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
- Changed TheGraph API schema URL to the latest version.
- Removed unused Alchemy URL and related logic from the client.
- Updated test to reflect the new URL structure for TheGraph Studio.
…tions

- Added jest.useRealTimers() in afterEach to ensure real timers are used in tests.
- Updated RequestNetwork instantiation in multiple tests to include paymentOptions with a getSubgraphClient function returning undefined.
- Modified jest.useFakeTimers() to use the advanceTimers option for better control in balance retrieval tests.
- Ensured consistency in timer usage across multiple test cases.
…EtherscanProvider methods

- Updated tests to utilize jest.spyOn for better readability and maintainability when mocking EtherscanProvider's getHistory and getNetwork methods.
- Ensured consistent mocking approach across multiple test cases.
…er management

- Added mockServer.resetHandlers() in beforeEach and afterAll to ensure a clean state for tests.
- Incorporated jest.useRealTimers() and jest.useFakeTimers() for better control over timer behavior in tests.
- Enabled and disabled payment detection in tests to validate balance retrieval functionality.
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f9a4cbc and 885bf17.

📒 Files selected for processing (1)
  • packages/request-client.js/test/index.test.ts (9 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*

⚙️ CodeRabbit configuration file

**/*: - Only comment on issues that would block merging — ignore minor or stylistic concerns.

  • Restrict feedback to errors, security risks, or functionality-breaking problems.
  • Do not post comments on code style, formatting, or non-critical improvements.
  • Keep reviews short: flag only issues that make the PR unsafe to merge.
  • Limit review comments to 3–5 items maximum, unless additional blockers exist.
  • Group similar issues into a single comment instead of posting multiple notes.
  • Skip repetition — if a pattern repeats, mention it once at a summary level only.
  • Do not add general suggestions; focus strictly on merge-blocking concerns.
  • If there are no critical problems, respond with minimal approval (e.g., 'Looks good'). Do not add additional review.
  • Avoid line-by-line commentary unless it highlights a critical bug or security hole.
  • Highlight only issues that could cause runtime errors, data loss, or severe maintainability issues.
  • Ignore minor optimization opportunities — focus solely on correctness and safety.
  • Provide a top-level summary of critical blockers rather than detailed per-line notes.
  • Comment only when the issue must be resolved before merge — otherwise, remain silent.
  • When in doubt, err on the side of fewer comments — brevity and blocking issues only.
  • Avoid posting any refactoring issues

Files:

  • packages/request-client.js/test/index.test.ts
🧠 Learnings (21)
📓 Common learnings
Learnt from: MantisClone
Repo: RequestNetwork/requestNetwork PR: 1486
File: packages/smart-contracts/deploy/deploy-zk-single-request-proxy.ts:1-24
Timestamp: 2024-11-11T16:10:26.692Z
Learning: The team prefers to maintain individual deployment scripts for each network in `packages/smart-contracts/deploy`, rather than consolidating them into a unified script.
Learnt from: MantisClone
Repo: RequestNetwork/requestNetwork PR: 1478
File: packages/smart-contracts/scripts-create2/contract-setup/setupSingleRequestProxyFactory.ts:38-43
Timestamp: 2024-11-05T05:33:32.481Z
Learning: In the RequestNetwork codebase, setup scripts such as `setupSingleRequestProxyFactory.ts` do not include contract existence checks before interacting with contracts, even though scripts like `check-deployer.ts` do include such checks.
Learnt from: aimensahnoun
Repo: RequestNetwork/requestNetwork PR: 1633
File: packages/smart-contracts/scripts/test-deploy-erc20-recurring-payment-proxy.ts:16-16
Timestamp: 2025-06-23T09:32:16.214Z
Learning: Test deployment scripts in the RequestNetwork repository (files with `test-deploy-` prefix) use the same deployer address for multiple roles for simplicity in local testing environments. Production deployments use separate addresses configured through environment variables.
Learnt from: MantisClone
Repo: RequestNetwork/requestNetwork PR: 1481
File: packages/integration-test/test/scheduled/erc20-proxy.test.ts:0-0
Timestamp: 2024-11-05T16:53:05.280Z
Learning: In `packages/integration-test/test/scheduled/erc20-proxy.test.ts`, when upgrading dependencies like `ethers`, additional error handling test cases for contract interactions and provider errors may not be necessary.
Learnt from: MantisClone
Repo: RequestNetwork/requestNetwork PR: 1478
File: packages/smart-contracts/scripts-create2/contract-setup/update-fee-proxies.ts:29-31
Timestamp: 2024-10-30T17:54:34.513Z
Learning: When logging missing contract deployments in `updateFeeProxies`, prefer using `console.warn` over `console.info` to highlight potential issues.
Learnt from: MantisClone
Repo: RequestNetwork/requestNetwork PR: 1487
File: packages/payment-processor/test/payment/single-request-proxy.test.ts:237-246
Timestamp: 2024-11-08T18:24:06.144Z
Learning: In `packages/payment-processor/test/payment/single-request-proxy.test.ts`, when asserting the `feeProxyUsed` in emitted events from `SingleRequestProxyFactory`, retrieve the `erc20FeeProxy` (or `ethereumFeeProxy`) public variable from the `SingleRequestProxyFactory` contract instead of using `wallet.address`.
Learnt from: MantisClone
Repo: RequestNetwork/requestNetwork PR: 1487
File: packages/payment-processor/test/payment/single-request-proxy.test.ts:198-206
Timestamp: 2024-11-08T18:24:19.095Z
Learning: In tests for `SingleRequestProxyFactory`, the `feeProxyUsed` in events should be verified by retrieving the `ethereumFeeProxy` public variable from the `SingleRequestProxyFactory` contract, not `wallet.address`.
Learnt from: aimensahnoun
Repo: RequestNetwork/requestNetwork PR: 1488
File: packages/smart-contracts/src/lib/artifacts/SingleRequestProxyFactory/index.ts:5-5
Timestamp: 2024-11-12T16:52:41.557Z
Learning: When the smart contracts are not being modified, types like `SingleRequestProxyFactory` in `packages/smart-contracts/src/lib/artifacts/SingleRequestProxyFactory/index.ts` should remain unchanged, even if terminology elsewhere in the code is updated.
Learnt from: MantisClone
Repo: RequestNetwork/requestNetwork PR: 1474
File: packages/smart-contracts/scripts/test-deploy-single-request-proxy.ts:14-32
Timestamp: 2024-10-28T20:00:25.780Z
Learning: In test files, such as `packages/smart-contracts/scripts/test-deploy-single-request-proxy.ts`, extensive error handling and input validation are considered unnecessary.
Learnt from: MantisClone
Repo: RequestNetwork/requestNetwork PR: 1478
File: packages/smart-contracts/scripts-create2/contract-setup/setupSingleRequestProxyFactory.ts:30-36
Timestamp: 2024-11-05T05:33:36.551Z
Learning: In the RequestNetwork project, admin scripts like `setupSingleRequestProxyFactory.ts` in `packages/smart-contracts/scripts-create2/contract-setup/` do not require extensive error checking.
📚 Learning: 2024-11-05T16:53:05.280Z
Learnt from: MantisClone
Repo: RequestNetwork/requestNetwork PR: 1481
File: packages/integration-test/test/scheduled/erc20-proxy.test.ts:0-0
Timestamp: 2024-11-05T16:53:05.280Z
Learning: In `packages/integration-test/test/scheduled/erc20-proxy.test.ts`, when upgrading dependencies like `ethers`, additional error handling test cases for contract interactions and provider errors may not be necessary.

Applied to files:

  • packages/request-client.js/test/index.test.ts
📚 Learning: 2024-10-28T16:03:33.215Z
Learnt from: MantisClone
Repo: RequestNetwork/requestNetwork PR: 1474
File: packages/payment-processor/test/payment/single-request-proxy.test.ts:251-270
Timestamp: 2024-10-28T16:03:33.215Z
Learning: When testing the payment-processor module, specifically in `packages/payment-processor/test/payment/single-request-proxy.test.ts`, it's acceptable to omit tests for partial payments if they have already been covered at the smart-contract level.

Applied to files:

  • packages/request-client.js/test/index.test.ts
📚 Learning: 2024-10-17T18:30:55.410Z
Learnt from: MantisClone
Repo: RequestNetwork/requestNetwork PR: 1453
File: packages/smart-contracts/test/contracts/ERC20SingleRequestProxy.test.ts:150-152
Timestamp: 2024-10-17T18:30:55.410Z
Learning: In `packages/smart-contracts/test/contracts/ERC20SingleRequestProxy.test.ts`, the skipped test `'should process a partial payment correctly'` exists intentionally to show that partial payments are supported without duplicating previous happy-path tests.

Applied to files:

  • packages/request-client.js/test/index.test.ts
📚 Learning: 2024-10-29T08:02:02.600Z
Learnt from: aimensahnoun
Repo: RequestNetwork/requestNetwork PR: 1474
File: packages/payment-processor/test/payment/single-request-proxy.test.ts:138-139
Timestamp: 2024-10-29T08:02:02.600Z
Learning: When testing invalid requests in `packages/payment-processor/test/payment/single-request-proxy.test.ts`, it's acceptable to use `ts-expect-error` to suppress TypeScript errors when the request intentionally lacks required properties.

Applied to files:

  • packages/request-client.js/test/index.test.ts
📚 Learning: 2024-11-06T14:48:18.698Z
Learnt from: MantisClone
Repo: RequestNetwork/requestNetwork PR: 1484
File: packages/advanced-logic/test/extensions/payment-network/any-to-near.test.ts:0-0
Timestamp: 2024-11-06T14:48:18.698Z
Learning: In `packages/advanced-logic/test/extensions/payment-network/any-to-near.test.ts`, when the existing happy path tests are deemed sufficient, additional test cases may not be necessary.

Applied to files:

  • packages/request-client.js/test/index.test.ts
📚 Learning: 2024-12-18T03:53:54.370Z
Learnt from: MantisClone
Repo: RequestNetwork/requestNetwork PR: 1482
File: packages/payment-processor/test/payment/erc-20-private-payment-hinkal.test.ts:38-38
Timestamp: 2024-12-18T03:53:54.370Z
Learning: In `packages/payment-processor/test/payment/erc-20-private-payment-hinkal.test.ts`, mainnet RPC is intentionally used for real on-chain tests as confirmed by MantisClone.

Applied to files:

  • packages/request-client.js/test/index.test.ts
📚 Learning: 2024-11-08T18:24:06.144Z
Learnt from: MantisClone
Repo: RequestNetwork/requestNetwork PR: 1487
File: packages/payment-processor/test/payment/single-request-proxy.test.ts:237-246
Timestamp: 2024-11-08T18:24:06.144Z
Learning: In `packages/payment-processor/test/payment/single-request-proxy.test.ts`, when asserting the `feeProxyUsed` in emitted events from `SingleRequestProxyFactory`, retrieve the `erc20FeeProxy` (or `ethereumFeeProxy`) public variable from the `SingleRequestProxyFactory` contract instead of using `wallet.address`.

Applied to files:

  • packages/request-client.js/test/index.test.ts
📚 Learning: 2024-12-06T10:32:50.647Z
Learnt from: rodrigopavezi
Repo: RequestNetwork/requestNetwork PR: 1510
File: .circleci/config.yml:0-0
Timestamp: 2024-12-06T10:32:50.647Z
Learning: It's acceptable to exclude the following packages from unit tests in CI: `requestnetwork/smart-contracts`, `requestnetwork/payment-detection`, `requestnetwork/payment-processor`, and `requestnetwork/integration-test`.

Applied to files:

  • packages/request-client.js/test/index.test.ts
📚 Learning: 2024-11-21T09:06:12.938Z
Learnt from: rodrigopavezi
Repo: RequestNetwork/requestNetwork PR: 1475
File: packages/transaction-manager/test/unit/utils/test-data.ts:87-119
Timestamp: 2024-11-21T09:06:12.938Z
Learning: In `packages/transaction-manager/test/unit/utils/test-data.ts`, mocks like `fakeEpkCipherProvider` do not require extensive test coverage for input validation and error handling.

Applied to files:

  • packages/request-client.js/test/index.test.ts
📚 Learning: 2024-11-22T13:30:25.703Z
Learnt from: rodrigopavezi
Repo: RequestNetwork/requestNetwork PR: 1475
File: packages/transaction-manager/test/unit/utils/test-data.ts:165-205
Timestamp: 2024-11-22T13:30:25.703Z
Learning: In `packages/transaction-manager/test/unit/utils/test-data.ts`, modifying `storedRawData` in the `FakeLitProtocolProvider` class may break existing functionality, so it should be left as is.

Applied to files:

  • packages/request-client.js/test/index.test.ts
📚 Learning: 2024-07-17T15:06:14.563Z
Learnt from: MantisClone
Repo: RequestNetwork/requestNetwork PR: 1386
File: packages/request-client.js/src/api/request-network.ts:25-25
Timestamp: 2024-07-17T15:06:14.563Z
Learning: The `persistTransaction()` function in the `no-persist-http-data-access.ts` file is tested in the `in-memory-request.test.ts` file, which is separate from the typical `index.test.ts` file to avoid test interference.

Applied to files:

  • packages/request-client.js/test/index.test.ts
📚 Learning: 2024-10-29T08:03:10.463Z
Learnt from: aimensahnoun
Repo: RequestNetwork/requestNetwork PR: 1474
File: packages/payment-processor/test/payment/single-request-proxy.test.ts:225-228
Timestamp: 2024-10-29T08:03:10.463Z
Learning: In 'packages/payment-processor/test/payment/single-request-proxy.test.ts' (TypeScript), when testing with an invalid proxy address, we should not use the zero address.

Applied to files:

  • packages/request-client.js/test/index.test.ts
📚 Learning: 2024-10-29T09:00:54.169Z
Learnt from: aimensahnoun
Repo: RequestNetwork/requestNetwork PR: 1474
File: packages/payment-processor/src/payment/single-request-proxy.ts:202-209
Timestamp: 2024-10-29T09:00:54.169Z
Learning: In the `packages/payment-processor/src/payment/single-request-proxy.ts` file, within the `payWithEthereumSingleRequestProxy` function, the current error handling is acceptable as per the project's expectations.

Applied to files:

  • packages/request-client.js/test/index.test.ts
📚 Learning: 2024-11-05T16:58:18.471Z
Learnt from: MantisClone
Repo: RequestNetwork/requestNetwork PR: 1481
File: packages/payment-detection/test/provider.test.ts:25-25
Timestamp: 2024-11-05T16:58:18.471Z
Learning: In `provider.test.ts`, when testing `getDefaultProvider`, we use a chain that Infura supports but is not in our own RPC list (such as `maticmum`) to ensure that the function correctly falls back to `InfuraProvider`.

Applied to files:

  • packages/request-client.js/test/index.test.ts
📚 Learning: 2024-12-04T05:05:19.610Z
Learnt from: MantisClone
Repo: RequestNetwork/requestNetwork PR: 1482
File: packages/payment-processor/test/payment/erc-20-private-payment-hinkal.test.ts:0-0
Timestamp: 2024-12-04T05:05:19.610Z
Learning: The function `createRequestForHinkal` in `erc-20-private-payment-hinkal.test.ts` is intended for testing purposes only and should remain in the test directory.

Applied to files:

  • packages/request-client.js/test/index.test.ts
📚 Learning: 2024-12-06T11:27:46.988Z
Learnt from: rodrigopavezi
Repo: RequestNetwork/requestNetwork PR: 1512
File: packages/integration-test/test/lit-protocol.test.ts:9-31
Timestamp: 2024-12-06T11:27:46.988Z
Learning: In the `waitForConfirmation` function within `packages/integration-test/test/lit-protocol.test.ts`, checking for the request state being `CREATED` or `PENDING` is correct as per design.

Applied to files:

  • packages/request-client.js/test/index.test.ts
📚 Learning: 2024-07-17T13:57:39.144Z
Learnt from: MantisClone
Repo: RequestNetwork/requestNetwork PR: 1386
File: packages/request-client.js/src/api/request-network.ts:74-145
Timestamp: 2024-07-17T13:57:39.144Z
Learning: The data passed to the `preparePaymentRequest` method in the `RequestNetwork` class is reliably formatted by the transaction manager, negating the need for additional error handling for data formatting within this method.

Applied to files:

  • packages/request-client.js/test/index.test.ts
📚 Learning: 2024-12-09T18:59:04.613Z
Learnt from: MantisClone
Repo: RequestNetwork/requestNetwork PR: 1482
File: packages/payment-processor/src/payment/erc-20-private-payment-hinkal.ts:80-99
Timestamp: 2024-12-09T18:59:04.613Z
Learning: In the `RequestNetwork` codebase, payment processor functions such as `payErc20ProxyRequestFromHinkalShieldedAddress` in `packages/payment-processor/src/payment/erc-20-private-payment-hinkal.ts` should not include explicit request validation or try/catch blocks, and should rely on the underlying components (like `hinkalObject`) to handle error reporting.

Applied to files:

  • packages/request-client.js/test/index.test.ts
📚 Learning: 2024-11-05T05:33:36.189Z
Learnt from: MantisClone
Repo: RequestNetwork/requestNetwork PR: 1478
File: packages/smart-contracts/scripts-create2/contract-setup/setupSingleRequestProxyFactory.ts:26-28
Timestamp: 2024-11-05T05:33:36.189Z
Learning: In the `requestNetwork` project's TypeScript setup scripts located in `packages/smart-contracts/scripts-create2/contract-setup`, `Promise.all` is used for asynchronous network setup tasks to maintain consistency across scripts.

Applied to files:

  • packages/request-client.js/test/index.test.ts
📚 Learning: 2024-07-15T14:13:23.019Z
Learnt from: MantisClone
Repo: RequestNetwork/requestNetwork PR: 1428
File: packages/payment-processor/src/payment/near-conversion.ts:20-21
Timestamp: 2024-07-15T14:13:23.019Z
Learning: Ensure that `mockedNearWalletConnection` in test files uses the `NearProvider` type instead of `any`.

Applied to files:

  • packages/request-client.js/test/index.test.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build-and-test

- Added jest.restoreAllMocks() in afterEach to guarantee that all mocks are reset after each test, improving test isolation and reliability.
- Removed the advanceTimers option from jest.useFakeTimers() to streamline timer behavior in balance retrieval tests.
- Ensured consistent timer usage across multiple test cases for improved test clarity.
…ests

- Updated tests to use setTimeout instead of jest.advanceTimersByTime for better clarity and reliability in timing behavior.
- Removed jest.useFakeTimers() calls to streamline timer management across multiple test cases.
…tructure

- Refactored test cases to improve code readability by aligning indentation and formatting.
- Ensured consistent use of async/await patterns and added timeout for the test case to prevent premature termination.
- Maintained functionality for enabling and disabling payment detection while validating balance retrieval.
- Increased timeout duration for a specific test case to prevent premature termination and ensure accurate results during execution.
…address

- Introduced the real wrapper address from the deployed contract for improved accuracy in tests.
- Enhanced address validation checks to ensure returned addresses are valid Ethereum addresses.
- Simplified test cases by removing unnecessary comparisons and focusing on the sepolia network address.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SDK - Deploy the ERC20CommerceEscrowWrapper on Sepolia and Base Migrate Request Network SDK from Alchemy Subgraphs to TheGraph Subgraph Studio

4 participants