File tree Expand file tree Collapse file tree
apps/kyberswap-interface/src/pages/CrossChainSwap/adapters Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -265,7 +265,7 @@ export class AcrossAdapter extends BaseSwapAdapter {
265265
266266 return {
267267 txHash : getAcrossFillTxHash ( res ) ,
268- status : mapAcrossDepositStatus ( res ) ,
268+ status : mapAcrossDepositStatus ( res , { txTimestamp : params . timestamp } ) ,
269269 }
270270 } catch ( error ) {
271271 console . error ( 'Error fetching transaction status:' , error )
Original file line number Diff line number Diff line change 11import { AcrossDepositStatusResponse } from 'pages/CrossChainSwap/adapters/AcrossAdapter/types'
22import { SwapStatus } from 'pages/CrossChainSwap/adapters/BaseSwapAdapter'
33
4+ const ACROSS_STATUS_ERROR_GRACE_PERIOD = 2 * 60 * 60 * 1_000
5+
6+ interface AcrossDepositStatusOptions {
7+ txTimestamp ?: number
8+ now ?: number
9+ }
10+
411export const getAcrossFillTxHash = ( statusResponse : AcrossDepositStatusResponse ) : string => {
512 return statusResponse . fillTxnRef || statusResponse . fillTx || ''
613}
714
8- export const mapAcrossDepositStatus = ( statusResponse : AcrossDepositStatusResponse ) : SwapStatus [ 'status' ] => {
15+ export const mapAcrossDepositStatus = (
16+ statusResponse : AcrossDepositStatusResponse ,
17+ options : AcrossDepositStatusOptions = { } ,
18+ ) : SwapStatus [ 'status' ] => {
919 if ( statusResponse . error ) {
20+ const { txTimestamp, now = Date . now ( ) } = options
21+ const isWithinIndexingGracePeriod = txTimestamp ? now - txTimestamp < ACROSS_STATUS_ERROR_GRACE_PERIOD : false
22+
23+ if ( isWithinIndexingGracePeriod ) {
24+ return 'Processing'
25+ }
26+
1027 return 'Failed'
1128 }
1229
Original file line number Diff line number Diff line change @@ -217,7 +217,7 @@ export class KyberAcrossAdapter extends BaseSwapAdapter {
217217
218218 return {
219219 txHash : getAcrossFillTxHash ( res ) ,
220- status : mapAcrossDepositStatus ( res ) ,
220+ status : mapAcrossDepositStatus ( res , { txTimestamp : params . timestamp } ) ,
221221 }
222222 } catch ( error ) {
223223 console . error ( 'Error fetching transaction status:' , error )
You can’t perform that action at this time.
0 commit comments