Skip to content

Commit

Permalink
[WIP] Start an integration test to show Mantle payment detection works
Browse files Browse the repository at this point in the history
  • Loading branch information
MantisClone committed Sep 17, 2023
1 parent 7e0a253 commit 8dffa34
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions packages/integration-test/test/scheduled/eth-input-data.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,30 @@ describe('ETH Fee proxy detection test-suite', () => {
expect(balance.events[0].amount).toBe('5000000000000000000');
expect(balance.events[0].timestamp).toBe(1679673933);
});
it('getBalance of ETHFeeProxy request on Mantle', async () => {
const pnFactory = new PaymentNetworkFactory(mockAdvancedLogic, CurrencyManager.getDefault());
const mockRequest = createMockNativeTokenRequest({
network: 'mantle',
requestId: '01b3b6fe1ac1031f96d1c44714766be12fd3ef7047d2b7c04f9bd4b7ea928edc64',
paymentAddress: '0x4E64C2d06d19D13061e62E291b2C4e9fe5679b93',
salt: '4b297a41ff3b247a',
feeAddress: '0x35d0e078755cd84d3e0656caab417dee1d7939c7',
feeAmount: '0',
nativeTokenCode: 'MNT',
});

const detector = pnFactory.getPaymentNetworkFromRequest(mockRequest);
expect(detector).not.toBeNull();
const balance = await detector!.getBalance(mockRequest);

expect(balance.balance).toBe('5000000000000000000'); // 5 MATIC
expect(balance.events).toHaveLength(1);
expect(balance.events[0].name).toBe('payment');
const params = balance.events[0].parameters as PaymentTypes.ETHPaymentNetworkEventParameters;
expect(params?.to).toBe('0x4E64C2d06d19D13061e62E291b2C4e9fe5679b93');
expect(balance.events[0].amount).toBe('5000000000000000000');
expect(balance.events[0].timestamp).toBe(1679673933);
});
it('getBalance=0 for an ETHFeeProxy request paid with conversion', async () => {
const pnFactory = new PaymentNetworkFactory(mockAdvancedLogic, CurrencyManager.getDefault());
const mockRequest = createMockNativeTokenRequest({
Expand Down

0 comments on commit 8dffa34

Please sign in to comment.