Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
b887c34
refactor: update ERC20CommerceEscrowWrapper deployment script to supp…
rodrigopavezi Dec 9, 2025
e5c1743
Update packages/smart-contracts/src/lib/artifacts/AuthCaptureEscrow/i…
rodrigopavezi Dec 9, 2025
ebb9c68
chore: update TheGraph API URLs and clean up client logic
rodrigopavezi Dec 9, 2025
3216bf7
Merge branch 'feat/commerce-escrow-eth-sepolia-deployment' of https:/…
rodrigopavezi Dec 9, 2025
6ab211b
test: enhance request-client.js tests with real timers and payment op…
rodrigopavezi Dec 10, 2025
8e6d598
test: update request-client.js tests to use advanced fake timers
rodrigopavezi Dec 10, 2025
f9a4cbc
test: refactor request-client.js tests to use jest.spyOn for mocking …
rodrigopavezi Dec 10, 2025
885bf17
test: improve request-client.js tests with mock server resets and tim…
rodrigopavezi Dec 10, 2025
04617bf
test: ensure proper mock restoration in request-client.js tests
rodrigopavezi Dec 11, 2025
ad93c7e
test: simplify timer management in request-client.js tests
rodrigopavezi Dec 11, 2025
0d7798b
test: replace jest fake timers with setTimeout in request-client.js t…
rodrigopavezi Dec 11, 2025
8b72a4b
test: enhance request-client.js tests with improved readability and s…
rodrigopavezi Dec 11, 2025
6394b8f
test: extend timeout for request-client.js tests to improve reliability
rodrigopavezi Dec 11, 2025
e5c3f3a
test: update erc20-commerce-escrow-wrapper tests to use real wrapper …
rodrigopavezi Dec 11, 2025
4079433
refactor: prepare ERC20CommerceEscrowWrapper for Create2 deployment (…
MantisClone Dec 11, 2025
bfe6cfe
feat: add ERC20CommerceEscrowWrapper deployed addresses for Sepolia a…
MantisClone Dec 12, 2025
6e9d4ca
chore: add .ignore to .gitignore for improved file management
MantisClone Dec 12, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,7 @@ tsconfig.build.tsbuildinfo
/packages/smart-contracts/.slither-cache/
/packages/smart-contracts/crytic-export/

.nx-cache/
.nx-cache/

# A place to store AI-generated or temporary files
.ignore/
198 changes: 0 additions & 198 deletions BASE_SEPOLIA_README.md

This file was deleted.

2 changes: 1 addition & 1 deletion packages/payment-detection/codegen.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
overwrite: true
schema: 'https://subgraph.satsuma-prod.com/e2e4905ab7c8/request-network--434873/request-payments-sepolia/api'
schema: 'https://api.studio.thegraph.com/query/67444/request-payments-sepolia/version/latest'
documents: src/thegraph/queries/*.graphql
generates:
src/thegraph/generated/graphql.ts:
Expand Down
24 changes: 1 addition & 23 deletions packages/payment-detection/src/thegraph/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ const THE_GRAPH_STUDIO_URL =
const THE_GRAPH_EXPLORER_URL =
'https://gateway.thegraph.com/api/$API_KEY/subgraphs/id/$SUBGRAPH_ID';

const THE_GRAPH_ALCHEMY_URL =
'https://subgraph.satsuma-prod.com/e2e4905ab7c8/request-network--434873/request-payments-$NETWORK/api';

const THE_GRAPH_URL_MANTLE_TESTNET =
'https://graph.testnet.mantle.xyz/subgraphs/name/requestnetwork/request-payments-mantle-testnet';

Expand All @@ -23,19 +20,6 @@ const THE_GRAPH_URL_MANTLE =
const THE_GRAPH_URL_CORE =
'https://thegraph.coredao.org/subgraphs/name/requestnetwork/request-payments-core';

const THE_GRAPH_ALCHEMY_CHAINS: CurrencyTypes.ChainName[] = [
'arbitrum-one',
'avalanche',
'base',
'bsc',
'fantom',
'mainnet',
'matic',
'sepolia',
'optimism',
'zksyncera',
];

const THE_GRAPH_EXPLORER_SUBGRAPH_ID: Partial<Record<CurrencyTypes.ChainName, string>> = {
['arbitrum-one']: '3MtDdHbzvBVNBpzUTYXGuDDLgTd1b8bPYwoH1Hdssgp9',
avalanche: 'A27V4PeZdKHeyuBkehdBJN8cxNtzVpXvYoqkjHUHRCFp',
Expand Down Expand Up @@ -159,10 +143,8 @@ export const getTheGraphClientUrl = (
'$API_KEY',
theGraphExplorerApiKey || '',
).replace('$SUBGRAPH_ID', theGraphExplorerSubgraphId || '');
const theGraphAlchemyUrl = THE_GRAPH_ALCHEMY_URL.replace('$NETWORK', chain);

const shouldUseTheGraphExplorer = !!theGraphExplorerApiKey && !!theGraphExplorerSubgraphId;
const shouldUseAlchemy = THE_GRAPH_ALCHEMY_CHAINS.includes(chain);

switch (true) {
case chain === 'private':
Expand All @@ -174,10 +156,6 @@ export const getTheGraphClientUrl = (
case chain === 'core':
return THE_GRAPH_URL_CORE;
default:
return shouldUseTheGraphExplorer
? theGraphExplorerUrl
: shouldUseAlchemy
? theGraphAlchemyUrl
: theGraphStudioUrl;
return shouldUseTheGraphExplorer ? theGraphExplorerUrl : theGraphStudioUrl;
}
};
4 changes: 2 additions & 2 deletions packages/payment-detection/test/thegraph/client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ describe('getTheGraphClientUrl', () => {
const url = getTheGraphClientUrl('base', { url: 'test' });
expect(url).toBe('test');
});
it('should build the correct URL for network supported by Alchemy', () => {
it('should build the correct URL for network using TheGraph Studio', () => {
const url = getTheGraphClientUrl('base');
expect(url).toBe(
'https://subgraph.satsuma-prod.com/e2e4905ab7c8/request-network--434873/request-payments-base/api',
'https://api.studio.thegraph.com/query/67444/request-payments-base/version/latest',
);
});
it('should build the correct URL when using TheGraph Explorer API key', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ const wallet = Wallet.fromMnemonic(mnemonic).connect(provider);
const network: CurrencyTypes.EvmChainName = 'sepolia';
const erc20ContractAddress = '0x9FBDa871d559710256a2502A2517b794B482Db40';

// Get the real wrapper address from the deployed contract
const wrapperAddress = getCommerceEscrowWrapperAddress(network);

const mockAuthorizeParams: AuthorizePaymentParams = {
paymentReference: '0x0123456789abcdef',
payer: wallet.address,
Expand Down Expand Up @@ -75,7 +78,9 @@ describe('erc20-commerce-escrow-wrapper', () => {
describe('getCommerceEscrowWrapperAddress', () => {
it('should return address when wrapper is deployed on testnet', () => {
const address = getCommerceEscrowWrapperAddress(network);
expect(address).toBe('0x1234567890123456789012345678901234567890');
// Verify it returns a valid Ethereum address
expect(address).toMatch(/^0x[0-9a-fA-F]{40}$/);
expect(address).not.toBe('0x0000000000000000000000000000000000000000');
});

it('should throw when wrapper not found on mainnet', () => {
Expand All @@ -91,19 +96,12 @@ describe('erc20-commerce-escrow-wrapper', () => {
}).toThrow('No deployment for network: unsupported-network.');
});

it('should return different addresses for different supported networks', () => {
it('should return a valid address for sepolia network', () => {
const sepoliaAddress = getCommerceEscrowWrapperAddress('sepolia');
const goerliAddress = getCommerceEscrowWrapperAddress('goerli');
const mumbaiAddress = getCommerceEscrowWrapperAddress('mumbai');

// Verify all addresses are valid hex-formatted addresses
[sepoliaAddress, goerliAddress, mumbaiAddress].forEach((addr) => {
expect(addr).toMatch(/^0x[0-9a-fA-F]{40}$/);
expect(addr).not.toBe('0x0000000000000000000000000000000000000000');
});

// Verify all addresses are different
expect(new Set([sepoliaAddress, goerliAddress, mumbaiAddress]).size).toBe(3);
// Verify the address is valid hex-formatted address
expect(sepoliaAddress).toMatch(/^0x[0-9a-fA-F]{40}$/);
expect(sepoliaAddress).not.toBe('0x0000000000000000000000000000000000000000');
});
});

Expand Down Expand Up @@ -226,7 +224,7 @@ describe('erc20-commerce-escrow-wrapper', () => {
expect(result).toBe('1000000000000000000');
expect(mockGetErc20Allowance).toHaveBeenCalledWith(
wallet.address,
'0x1234567890123456789012345678901234567890', // wrapper address
wrapperAddress, // real wrapper address from deployment
provider,
erc20ContractAddress,
);
Expand Down Expand Up @@ -631,7 +629,7 @@ describe('erc20-commerce-escrow-wrapper', () => {
});

expect(wallet.sendTransaction).toHaveBeenCalledWith({
to: '0x1234567890123456789012345678901234567890',
to: wrapperAddress,
data: expect.stringMatching(/^0x[a-fA-F0-9]+$/),
value: 0,
});
Expand All @@ -648,7 +646,7 @@ describe('erc20-commerce-escrow-wrapper', () => {
});

expect(wallet.sendTransaction).toHaveBeenCalledWith({
to: '0x1234567890123456789012345678901234567890',
to: wrapperAddress,
data: expect.stringMatching(/^0x[a-fA-F0-9]+$/),
value: 0,
});
Expand All @@ -665,7 +663,7 @@ describe('erc20-commerce-escrow-wrapper', () => {
});

expect(wallet.sendTransaction).toHaveBeenCalledWith({
to: '0x1234567890123456789012345678901234567890',
to: wrapperAddress,
data: expect.stringMatching(/^0x[a-fA-F0-9]+$/),
value: 0,
});
Expand All @@ -682,7 +680,7 @@ describe('erc20-commerce-escrow-wrapper', () => {
});

expect(wallet.sendTransaction).toHaveBeenCalledWith({
to: '0x1234567890123456789012345678901234567890',
to: wrapperAddress,
data: expect.stringMatching(/^0x[a-fA-F0-9]+$/),
value: 0,
});
Expand All @@ -699,7 +697,7 @@ describe('erc20-commerce-escrow-wrapper', () => {
});

expect(wallet.sendTransaction).toHaveBeenCalledWith({
to: '0x1234567890123456789012345678901234567890',
to: wrapperAddress,
data: expect.stringMatching(/^0x[a-fA-F0-9]+$/),
value: 0,
});
Expand All @@ -716,7 +714,7 @@ describe('erc20-commerce-escrow-wrapper', () => {
});

expect(wallet.sendTransaction).toHaveBeenCalledWith({
to: '0x1234567890123456789012345678901234567890',
to: wrapperAddress,
data: expect.stringMatching(/^0x[a-fA-F0-9]+$/),
value: 0,
});
Expand Down
Loading