• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

cowprotocol / cow-sdk / #1780

29 May 2025 01:25PM UTC coverage: 76.278% (-1.2%) from 77.485%
#1780

Pull #324

shoom3301
chore: unknown status
Pull Request #324: feat(bridge): track order progress

485 of 689 branches covered (70.39%)

Branch coverage included in aggregate %.

27 of 76 new or added lines in 13 files covered. (35.53%)

2 existing lines in 2 files now uncovered.

1097 of 1385 relevant lines covered (79.21%)

20.11 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

23.53
/src/bridging/providers/across/getDepositParams.ts
1
import { TransactionReceipt } from '@ethersproject/abstract-provider'
2
import { getAcrossDepositEvents, getCowTradeEvents } from './util'
3
import { SupportedChainId } from '../../../chains'
4
import { BridgingDepositParams } from '../../types'
5
import { log } from '../../../common/utils/log'
6

7
export async function getDepositParams(
8
  chainId: SupportedChainId,
9
  orderId: string,
10
  txReceipt: TransactionReceipt,
11
): Promise<BridgingDepositParams | null> {
12
  const depositEvents = getAcrossDepositEvents(chainId, txReceipt.logs)
1✔
13

14
  if (depositEvents.length === 0) {
1!
15
    return null
1✔
16
  }
17

NEW
18
  const cowTradeEvents = getCowTradeEvents(chainId, txReceipt.logs)
×
19

20
  // Find relative position for the orderId in the settlement tx
NEW
21
  const orderTradeIndex = cowTradeEvents.findIndex((event) => event.orderUid === orderId)
×
22

NEW
23
  if (orderTradeIndex < 0) return null
×
24

NEW
25
  const depositEvent = depositEvents[orderTradeIndex]
×
26

NEW
27
  if (!depositEvent) {
×
NEW
28
    log(`Trade event found at index ${orderTradeIndex} but only ${depositEvents.length} deposit events available`)
×
NEW
29
    return null
×
30
  }
31

NEW
32
  return {
×
33
    inputTokenAddress: depositEvent.inputToken,
34
    outputTokenAddress: depositEvent.outputToken,
35
    inputAmount: BigInt(depositEvent.inputAmount.toString()),
36
    outputAmount: BigInt(depositEvent.outputAmount.toString()),
37
    owner: depositEvent.depositor,
38
    quoteTimestamp: parseInt(depositEvent.quoteTimestamp.toString()),
39
    fillDeadline: parseInt(depositEvent.fillDeadline.toString()),
40
    recipient: depositEvent.recipient,
41
    sourceChainId: chainId,
42
    destinationChainId: parseInt(depositEvent.destinationChainId.toString()),
43
    bridgingId: depositEvent.depositId.toString(),
44
  }
45
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc