diff --git a/apollo/src/aggregation/aggregation.service.ts b/apollo/src/aggregation/aggregation.service.ts index ff5030a..5e406c6 100644 --- a/apollo/src/aggregation/aggregation.service.ts +++ b/apollo/src/aggregation/aggregation.service.ts @@ -187,41 +187,59 @@ export class AggregationService extends PrismaClient implements OnModuleInit { }; if (version === 'lnv2') { - const sourceNode = this.lnv2Service.transfers.find((item) => Number(item.chainConfig.id) === sourceChainId); + const sourceNode = this.lnv2Service.transfers.find( + (item) => Number(item.chainConfig.id) === sourceChainId + ); const sourceTokenInfo = sourceNode?.chainConfig.tokens.find( (item) => item.address.toLowerCase() === sourceToken.toLowerCase() ); if (sourceTokenInfo === undefined) { return '0'; } - const couple = sourceNode.chainConfig.couples.find((item) => - Number(item.chain.id) === targetChainId && - item.protocol.name.startsWith('lnv2') && - item.symbol.from === sourceTokenInfo.symbol); + const couple = sourceNode.chainConfig.couples.find( + (item) => + Number(item.chain.id) === targetChainId && + item.protocol.name.startsWith('lnv2') && + item.symbol.from === sourceTokenInfo.symbol + ); if (couple === undefined) { return '0'; } - const targetNode = this.lnv2Service.transfers.find((item) => Number(item.chainConfig.id) === targetChainId); - const targetTokenInfo = targetNode?.chainConfig.tokens.find((item) => item.symbol === couple.symbol.to); + const targetNode = this.lnv2Service.transfers.find( + (item) => Number(item.chainConfig.id) === targetChainId + ); + const targetTokenInfo = targetNode?.chainConfig.tokens.find( + (item) => item.symbol === couple.symbol.to + ); if (targetTokenInfo === undefined) { return '0'; } return transferDecimals(amount, sourceTokenInfo.decimals - targetTokenInfo.decimals); } else { - const srcChainConfig = this.lnv3Service.transfers.find((item) => Number(item.chainConfig.id) === sourceChainId)?.chainConfig; - const dstChainConfig = this.lnv3Service.transfers.find((item) => Number(item.chainConfig.id) === targetChainId)?.chainConfig; + const srcChainConfig = this.lnv3Service.transfers.find( + (item) => Number(item.chainConfig.id) === sourceChainId + )?.chainConfig; + const dstChainConfig = this.lnv3Service.transfers.find( + (item) => Number(item.chainConfig.id) === targetChainId + )?.chainConfig; - const srcToken = srcChainConfig?.tokens.find((token) => token.address.toLowerCase() === sourceToken.toLowerCase()); + const srcToken = srcChainConfig?.tokens.find( + (token) => token.address.toLowerCase() === sourceToken.toLowerCase() + ); const couple = srcChainConfig?.couples.find( - (couple) => Number(couple.chain.id) === targetChainId && couple.protocol.name === 'lnv3' && couple.symbol.from === srcToken.symbol); + (couple) => + Number(couple.chain.id) === targetChainId && + couple.protocol.name === 'lnv3' && + couple.symbol.from === srcToken.symbol + ); const dstTokenSymbol = couple?.symbol.to; const dstToken = dstChainConfig?.tokens.find((token) => token.symbol === dstTokenSymbol); const srcDecimals = srcToken?.decimals; const dstDecimals = dstToken?.decimals; if (srcDecimals === undefined || dstDecimals === undefined) { - return '0'; + return '0'; } return transferDecimals(amount, srcDecimals - dstDecimals); @@ -237,7 +255,9 @@ export class AggregationService extends PrismaClient implements OnModuleInit { }): boolean { const { sourceChainId, targetChainId, sourceToken, targetToken, version } = params; if (version === 'lnv2') { - const sourceNode = this.lnv2Service.transfers.find((item) => Number(item.chainConfig.id) === sourceChainId); + const sourceNode = this.lnv2Service.transfers.find( + (item) => Number(item.chainConfig.id) === sourceChainId + ); if (sourceNode === undefined) { return false; } @@ -247,14 +267,18 @@ export class AggregationService extends PrismaClient implements OnModuleInit { if (sourceTokenInfo === undefined) { return false; } - const couple = sourceNode.chainConfig.couples.find((item) => - Number(item.chain.id) === targetChainId && - item.protocol.name.startsWith('lnv2') && - item.symbol.from === sourceTokenInfo.symbol); + const couple = sourceNode.chainConfig.couples.find( + (item) => + Number(item.chain.id) === targetChainId && + item.protocol.name.startsWith('lnv2') && + item.symbol.from === sourceTokenInfo.symbol + ); if (couple === undefined) { return false; } - const targetNode = this.lnv2Service.transfers.find((item) => Number(item.chainConfig.id) === targetChainId); + const targetNode = this.lnv2Service.transfers.find( + (item) => Number(item.chainConfig.id) === targetChainId + ); if (targetNode === undefined) { return false; } @@ -263,21 +287,39 @@ export class AggregationService extends PrismaClient implements OnModuleInit { ); return targetTokenInfo.address.toLowerCase() === targetToken.toLowerCase(); } else { - const srcChainConfig = this.lnv3Service.transfers.find((item) => Number(item.chainConfig.id) === sourceChainId)?.chainConfig; - const dstChainConfig = this.lnv3Service.transfers.find((item) => Number(item.chainConfig.id) === targetChainId)?.chainConfig; + const srcChainConfig = this.lnv3Service.transfers.find( + (item) => Number(item.chainConfig.id) === sourceChainId + )?.chainConfig; + const dstChainConfig = this.lnv3Service.transfers.find( + (item) => Number(item.chainConfig.id) === targetChainId + )?.chainConfig; if (srcChainConfig === undefined || dstChainConfig === undefined) { - return false; + return false; } - const srcToken = srcChainConfig.tokens.find((token) => token.address.toLowerCase() === sourceToken.toLowerCase()); - const dstToken = dstChainConfig.tokens.find((token) => token.address.toLowerCase() === targetToken.toLowerCase()); + const srcToken = srcChainConfig.tokens.find( + (token) => token.address.toLowerCase() === sourceToken.toLowerCase() + ); + const dstToken = dstChainConfig.tokens.find( + (token) => token.address.toLowerCase() === targetToken.toLowerCase() + ); if (srcToken === undefined || dstToken === undefined) { - return false; + return false; } const srcCouple = srcChainConfig?.couples.find( - (couple) => Number(couple.chain.id) === targetChainId && couple.protocol.name === 'lnv3' && couple.symbol.from === srcToken.symbol && couple.symbol.to === dstToken.symbol); + (couple) => + Number(couple.chain.id) === targetChainId && + couple.protocol.name === 'lnv3' && + couple.symbol.from === srcToken.symbol && + couple.symbol.to === dstToken.symbol + ); const dstCouple = dstChainConfig?.couples.find( - (couple) => Number(couple.chain.id) === sourceChainId && couple.protocol.name === 'lnv3' && couple.symbol.from === dstToken.symbol && couple.symbol.to === srcToken.symbol); + (couple) => + Number(couple.chain.id) === sourceChainId && + couple.protocol.name === 'lnv3' && + couple.symbol.from === dstToken.symbol && + couple.symbol.to === srcToken.symbol + ); return srcCouple !== undefined && dstCouple !== undefined; } } diff --git a/apollo/src/graphql.ts b/apollo/src/graphql.ts index 4ad13e9..c9c3f2e 100644 --- a/apollo/src/graphql.ts +++ b/apollo/src/graphql.ts @@ -1,4 +1,3 @@ - /* * ------------------------------------------------------- * THIS FILE WAS AUTOMATICALLY GENERATED (DO NOT MODIFY) @@ -9,126 +8,217 @@ /* eslint-disable */ export class HistoryRecord { - id: string; - fromChain: string; - toChain: string; - bridge: string; - reason?: Nullable; - nonce: BigInt; - requestTxHash: string; - responseTxHash?: Nullable; - sender: string; - recipient: string; - sendToken: string; - recvToken: string; - sendAmount: string; - recvAmount?: Nullable; - startTime: number; - endTime?: Nullable; - result: number; - fee: string; - feeToken: string; - messageNonce?: Nullable; - sendTokenAddress?: Nullable; - recvTokenAddress?: Nullable; - sendOuterTokenAddress?: Nullable; - recvOuterTokenAddress?: Nullable; - guardSignatures?: Nullable; - relayer?: Nullable; - endTxHash?: Nullable; - confirmedBlocks?: Nullable; - needWithdrawLiquidity?: Nullable; - lastRequestWithdraw?: Nullable; - extData?: Nullable; + id: string; + fromChain: string; + toChain: string; + bridge: string; + reason?: Nullable; + nonce: BigInt; + requestTxHash: string; + responseTxHash?: Nullable; + sender: string; + recipient: string; + sendToken: string; + recvToken: string; + sendAmount: string; + recvAmount?: Nullable; + startTime: number; + endTime?: Nullable; + result: number; + fee: string; + feeToken: string; + messageNonce?: Nullable; + sendTokenAddress?: Nullable; + recvTokenAddress?: Nullable; + sendOuterTokenAddress?: Nullable; + recvOuterTokenAddress?: Nullable; + guardSignatures?: Nullable; + relayer?: Nullable; + endTxHash?: Nullable; + confirmedBlocks?: Nullable; + needWithdrawLiquidity?: Nullable; + lastRequestWithdraw?: Nullable; + extData?: Nullable; } export class HistoryRecords { - total: number; - records?: Nullable[]>; + total: number; + records?: Nullable[]>; } export class LnBridgeRelayInfo { - id: string; - version: string; - nonce: BigInt; - targetNonce?: Nullable; - fromChain: string; - toChain: string; - bridge: string; - relayer: string; - sendToken?: Nullable; - tokenKey?: Nullable; - transactionHash: string; - timestamp: number; - margin?: Nullable; - protocolFee?: Nullable; - baseFee?: Nullable; - liquidityFeeRate?: Nullable; - slashCount?: Nullable; - withdrawNonce?: Nullable; - lastTransferId?: Nullable; - cost?: Nullable; - profit?: Nullable; - heartbeatTimestamp?: Nullable; - messageChannel?: Nullable; - transferLimit?: Nullable; - softTransferLimit?: Nullable; - paused?: Nullable; - dynamicFee?: Nullable; - dynamicFeeExpire?: Nullable; - dynamicFeeSignature?: Nullable; + id: string; + version: string; + nonce: BigInt; + targetNonce?: Nullable; + fromChain: string; + toChain: string; + bridge: string; + relayer: string; + sendToken?: Nullable; + tokenKey?: Nullable; + transactionHash: string; + timestamp: number; + margin?: Nullable; + protocolFee?: Nullable; + baseFee?: Nullable; + liquidityFeeRate?: Nullable; + slashCount?: Nullable; + withdrawNonce?: Nullable; + lastTransferId?: Nullable; + cost?: Nullable; + profit?: Nullable; + heartbeatTimestamp?: Nullable; + messageChannel?: Nullable; + transferLimit?: Nullable; + softTransferLimit?: Nullable; + paused?: Nullable; + dynamicFee?: Nullable; + dynamicFeeExpire?: Nullable; + dynamicFeeSignature?: Nullable; } export class LnBridgeRelayInfos { - total: number; - records?: Nullable[]>; + total: number; + records?: Nullable[]>; } export class SortedLnBridgeRelayInfos { - transferLimit: BigInt; - records?: Nullable[]>; + transferLimit: BigInt; + records?: Nullable[]>; } export class SupportChains { - fromChain: string; - toChains?: Nullable[]>; + fromChain: string; + toChains?: Nullable[]>; } export class HealthInfo { - name?: Nullable; - callTimes?: Nullable; + name?: Nullable; + callTimes?: Nullable; } export abstract class IQuery { - abstract historyRecordById(id?: Nullable): Nullable | Promise>; - - abstract historyRecordByTxHash(txHash?: Nullable): Nullable | Promise>; - - abstract firstHistoryRecord(fromChain?: Nullable, toChain?: Nullable, bridge?: Nullable, results?: Nullable[]>, relayer?: Nullable, token?: Nullable, order?: Nullable, notsubmited?: Nullable): Nullable | Promise>; - - abstract historyRecords(sender?: Nullable, recipient?: Nullable, relayer?: Nullable, needWithdrawLiquidity?: Nullable, fromChains?: Nullable[]>, toChains?: Nullable[]>, bridges?: Nullable[]>, row?: Nullable, page?: Nullable, results?: Nullable[]>, recvTokenAddress?: Nullable, order?: Nullable): Nullable | Promise>; - - abstract checkLnBridgeExist(fromChainId?: Nullable, toChainId?: Nullable, fromToken?: Nullable, toToken?: Nullable, version?: Nullable): Nullable | Promise>; - - abstract tasksHealthCheck(name?: Nullable): Nullable[]> | Promise[]>>; - - abstract queryRelayRecords(fromChain?: Nullable, toChain?: Nullable, bridge?: Nullable, relayer?: Nullable, row?: Nullable): Nullable | Promise>; - - abstract queryLnBridgeRelayInfos(fromChain?: Nullable, toChain?: Nullable, version?: Nullable, bridge?: Nullable, relayer?: Nullable, row?: Nullable, page?: Nullable): Nullable | Promise>; - - abstract sortedLnBridgeRelayInfos(fromChain?: Nullable, toChain?: Nullable, version?: Nullable, bridge?: Nullable, token?: Nullable, row?: Nullable, amount?: Nullable, decimals?: Nullable): Nullable | Promise>; - - abstract queryLnBridgeSupportChains(tokenKey?: Nullable): Nullable[]> | Promise[]>>; - - abstract queryMaxTransfer(fromChain?: Nullable, toChain?: Nullable, bridge?: Nullable, token?: Nullable, balance?: Nullable): Nullable | Promise>; + abstract historyRecordById( + id?: Nullable + ): Nullable | Promise>; + + abstract historyRecordByTxHash( + txHash?: Nullable + ): Nullable | Promise>; + + abstract firstHistoryRecord( + fromChain?: Nullable, + toChain?: Nullable, + bridge?: Nullable, + results?: Nullable[]>, + relayer?: Nullable, + token?: Nullable, + order?: Nullable, + notsubmited?: Nullable + ): Nullable | Promise>; + + abstract historyRecords( + sender?: Nullable, + recipient?: Nullable, + relayer?: Nullable, + needWithdrawLiquidity?: Nullable, + fromChains?: Nullable[]>, + toChains?: Nullable[]>, + bridges?: Nullable[]>, + row?: Nullable, + page?: Nullable, + results?: Nullable[]>, + recvTokenAddress?: Nullable, + order?: Nullable + ): Nullable | Promise>; + + abstract checkLnBridgeExist( + fromChainId?: Nullable, + toChainId?: Nullable, + fromToken?: Nullable, + toToken?: Nullable, + version?: Nullable + ): Nullable | Promise>; + + abstract tasksHealthCheck( + name?: Nullable + ): Nullable[]> | Promise[]>>; + + abstract queryRelayRecords( + fromChain?: Nullable, + toChain?: Nullable, + bridge?: Nullable, + relayer?: Nullable, + row?: Nullable + ): Nullable | Promise>; + + abstract queryLnBridgeRelayInfos( + fromChain?: Nullable, + toChain?: Nullable, + version?: Nullable, + bridge?: Nullable, + relayer?: Nullable, + row?: Nullable, + page?: Nullable + ): Nullable | Promise>; + + abstract sortedLnBridgeRelayInfos( + fromChain?: Nullable, + toChain?: Nullable, + version?: Nullable, + bridge?: Nullable, + token?: Nullable, + row?: Nullable, + amount?: Nullable, + decimals?: Nullable + ): Nullable | Promise>; + + abstract queryLnBridgeSupportChains( + tokenKey?: Nullable + ): Nullable[]> | Promise[]>>; + + abstract queryMaxTransfer( + fromChain?: Nullable, + toChain?: Nullable, + bridge?: Nullable, + token?: Nullable, + balance?: Nullable + ): Nullable | Promise>; } export abstract class IMutation { - abstract signConfirmedBlock(id?: Nullable, relayer?: Nullable, block?: Nullable, timestamp?: Nullable, signature?: Nullable): Nullable | Promise>; - - abstract signHeartBeat(fromChainId?: Nullable, toChainId?: Nullable, version?: Nullable, relayer?: Nullable, tokenAddress?: Nullable, softTransferLimit?: Nullable, timestamp?: Nullable, signature?: Nullable): Nullable | Promise>; - - abstract signDynamicFee(fromChainId?: Nullable, toChainId?: Nullable, version?: Nullable, relayer?: Nullable, tokenAddress?: Nullable, dynamicFee?: Nullable, dynamicFeeExpire?: Nullable, dynamicFeeSignature?: Nullable, timestamp?: Nullable, signature?: Nullable): Nullable | Promise>; + abstract signConfirmedBlock( + id?: Nullable, + relayer?: Nullable, + block?: Nullable, + timestamp?: Nullable, + signature?: Nullable + ): Nullable | Promise>; + + abstract signHeartBeat( + fromChainId?: Nullable, + toChainId?: Nullable, + version?: Nullable, + relayer?: Nullable, + tokenAddress?: Nullable, + softTransferLimit?: Nullable, + timestamp?: Nullable, + signature?: Nullable + ): Nullable | Promise>; + + abstract signDynamicFee( + fromChainId?: Nullable, + toChainId?: Nullable, + version?: Nullable, + relayer?: Nullable, + tokenAddress?: Nullable, + dynamicFee?: Nullable, + dynamicFeeExpire?: Nullable, + dynamicFeeSignature?: Nullable, + timestamp?: Nullable, + signature?: Nullable + ): Nullable | Promise>; } export type BigInt = any; diff --git a/apollo/src/lnv2/lnv2.service.ts b/apollo/src/lnv2/lnv2.service.ts index 847ff30..5e49bb5 100644 --- a/apollo/src/lnv2/lnv2.service.ts +++ b/apollo/src/lnv2/lnv2.service.ts @@ -363,81 +363,81 @@ export class Lnv2Service implements OnModuleInit { // batch get status from target chain on sycing historical phase async queryFillInfos(indexInfo: BridgeIndexInfo, latestTimestamp: number) { - const url = indexInfo.url; - const query = `query { lnv2RelayRecords(first: 30, orderBy: timestamp, orderDirection: asc, where: {timestamp_gt: "${latestTimestamp}", slasher: null}) { id, timestamp, transactionHash, fee } }`; - return await axios - .post(url, { - query: query, - variables: null, - }).then((res) => res.data?.data?.lnv2RelayRecords); + const url = indexInfo.url; + const query = `query { lnv2RelayRecords(first: 30, orderBy: timestamp, orderDirection: asc, where: {timestamp_gt: "${latestTimestamp}", slasher: null}) { id, timestamp, transactionHash, fee } }`; + return await axios + .post(url, { + query: query, + variables: null, + }) + .then((res) => res.data?.data?.lnv2RelayRecords); } async batchFetchStatus(transfer: PartnerT3, indexInfo: BridgeIndexInfo) { - try { - let latestTimestamp = this.fetchCache[indexInfo.index].latestFillInfoTimestamp; - // stop sync history when timestamp set to zero - if (latestTimestamp === 0) { - return; - } else if (latestTimestamp === -1) { - const firstRecord = await this.aggregationService.queryHistoryRecordFirst( - { - toChain: transfer.chainConfig.code, - bridge: this.bridgeName(indexInfo), - result: RecordStatus.success, - }, - { nonce: 'desc' } - ); - latestTimestamp = firstRecord ? firstRecord.endTime : -1; - } - const relayRecords = await this.queryFillInfos(indexInfo, latestTimestamp); - if (relayRecords.length === 0) { - this.fetchCache[indexInfo.index].latestFillInfoTimestamp = 0; - this.logger.log(`lnv2 the batch sync end, chain: ${transfer.chainConfig.code}, lastTime: ${latestTimestamp}`); - return; - } - let batchAddCount = 0; - for (const relayRecord of relayRecords) { - // ignore slashed transfer - let rmvedTransferId = relayRecord.id; - if (rmvedTransferId.startsWith(`${transfer.chainConfig.id}-`)) { - rmvedTransferId = rmvedTransferId.replace(`${transfer.chainConfig.id}-`, ''); - } - const uncheckedRecord = await this.aggregationService - .queryHistoryRecordFirst({ - id: { - endsWith: rmvedTransferId, - } - }); - // the record exist but not finished - if (uncheckedRecord?.endTxHash === '' ) { - const updateData = { - result: RecordStatus.success, - responseTxHash: relayRecord.transactionHash, - endTxHash: relayRecord.transactionHash, - endTime: Number(relayRecord.timestamp), - }; - - await this.aggregationService.updateHistoryRecord({ - where: { id: uncheckedRecord.id }, - data: updateData, - }); - this.fetchCache[indexInfo.index].latestFillInfoTimestamp = updateData.endTime; - batchAddCount += 1; - } else if (uncheckedRecord) { - this.fetchCache[indexInfo.index].latestFillInfoTimestamp = Number(relayRecord.timestamp); - } - } - if (batchAddCount > 0) { - this.logger.log( - `lnv2 [${transfer.chainConfig.code}] batch fetch status, count: ${batchAddCount}` - ); - } - } catch(error) { - this.logger.warn(`batch fetch lnv2 status failed, error ${error}`); + try { + let latestTimestamp = this.fetchCache[indexInfo.index].latestFillInfoTimestamp; + // stop sync history when timestamp set to zero + if (latestTimestamp === 0) { + return; + } else if (latestTimestamp === -1) { + const firstRecord = await this.aggregationService.queryHistoryRecordFirst( + { + toChain: transfer.chainConfig.code, + bridge: this.bridgeName(indexInfo), + result: RecordStatus.success, + }, + { nonce: 'desc' } + ); + latestTimestamp = firstRecord ? firstRecord.endTime : -1; } - } - + const relayRecords = await this.queryFillInfos(indexInfo, latestTimestamp); + if (relayRecords.length === 0) { + this.fetchCache[indexInfo.index].latestFillInfoTimestamp = 0; + this.logger.log( + `lnv2 the batch sync end, chain: ${transfer.chainConfig.code}, lastTime: ${latestTimestamp}` + ); + return; + } + let batchAddCount = 0; + for (const relayRecord of relayRecords) { + // ignore slashed transfer + let rmvedTransferId = relayRecord.id; + if (rmvedTransferId.startsWith(`${transfer.chainConfig.id}-`)) { + rmvedTransferId = rmvedTransferId.replace(`${transfer.chainConfig.id}-`, ''); + } + const uncheckedRecord = await this.aggregationService.queryHistoryRecordFirst({ + id: { + endsWith: rmvedTransferId, + }, + }); + // the record exist but not finished + if (uncheckedRecord?.endTxHash === '') { + const updateData = { + result: RecordStatus.success, + responseTxHash: relayRecord.transactionHash, + endTxHash: relayRecord.transactionHash, + endTime: Number(relayRecord.timestamp), + }; + await this.aggregationService.updateHistoryRecord({ + where: { id: uncheckedRecord.id }, + data: updateData, + }); + this.fetchCache[indexInfo.index].latestFillInfoTimestamp = updateData.endTime; + batchAddCount += 1; + } else if (uncheckedRecord) { + this.fetchCache[indexInfo.index].latestFillInfoTimestamp = Number(relayRecord.timestamp); + } + } + if (batchAddCount > 0) { + this.logger.log( + `lnv2 [${transfer.chainConfig.code}] batch fetch status, count: ${batchAddCount}` + ); + } + } catch (error) { + this.logger.warn(`batch fetch lnv2 status failed, error ${error}`); + } + } // fetch status from target chain and source chain(slash result) // 1. relayed, finished @@ -454,7 +454,7 @@ export class Lnv2Service implements OnModuleInit { fromChain: transfer.chainConfig.code, bridge: this.bridgeName(indexInfo), endTxHash: '', - } + }, }) .then((result) => result.records); @@ -543,11 +543,15 @@ export class Lnv2Service implements OnModuleInit { } private findPartnerByChainId(chainId: number) { - return this.transferService.transfers.find((item) => Number(item.chainConfig.id) === chainId) ?? null; + return ( + this.transferService.transfers.find((item) => Number(item.chainConfig.id) === chainId) ?? null + ); } private findPartnerByChainName(chainName: string) { - return this.transferService.transfers.find((item) => item.chainConfig.code === chainName) ?? null; + return ( + this.transferService.transfers.find((item) => item.chainConfig.code === chainName) ?? null + ); } private findTokenPair( @@ -586,9 +590,10 @@ export class Lnv2Service implements OnModuleInit { ); return null; } - const targetInfo = targetPartner.chainConfig.tokens.find( - (item) => item.address.toLowerCase() === targetAddress.toLowerCase() - ) ?? null; + const targetInfo = + targetPartner.chainConfig.tokens.find( + (item) => item.address.toLowerCase() === targetAddress.toLowerCase() + ) ?? null; if (targetInfo?.symbol.toLowerCase() !== couple.symbol.to.toLowerCase()) { this.logger.warn( `verify target token failed ${transfer.chainConfig.code}-${sourceAddress}->${targetChainId}-${targetAddress}, symbol ${targetInfo?.symbol}, couple-to ${couple.symbol.to}` @@ -664,7 +669,7 @@ export class Lnv2Service implements OnModuleInit { record.sourceToken, Number(transfer.chainConfig.id), record.targetToken, - indexInfo.bridgeType, + indexInfo.bridgeType ); if (tokenPair === null) { // add nonce to skip this record @@ -788,7 +793,7 @@ export class Lnv2Service implements OnModuleInit { record.sourceToken, record.remoteChainId, record.targetToken, - indexInfo.bridgeType, + indexInfo.bridgeType ); if (tokenPair === null) { // add nonce to skip this record @@ -847,9 +852,7 @@ export class Lnv2Service implements OnModuleInit { size += 1; } if (size > 0) { - this.logger.log( - `update lnv2 relay info from source, size: ${size}` - ); + this.logger.log(`update lnv2 relay info from source, size: ${size}`); } } catch (error) { this.logger.warn(`fetchFeeInfoFromSource failed, error ${error}`); @@ -905,7 +908,7 @@ export class Lnv2Service implements OnModuleInit { record.sourceToken, record.remoteChainId, record.targetToken, - indexInfo.bridgeType, + indexInfo.bridgeType ); if (tokenPair === null) { // add nonce to skip this record @@ -974,9 +977,7 @@ export class Lnv2Service implements OnModuleInit { size += 1; } if (size > 0) { - this.logger.log( - `update lnv2 relay info for opposite, size ${size}` - ); + this.logger.log(`update lnv2 relay info for opposite, size ${size}`); } } catch (error) { this.logger.warn(`fetchRelayInfo failed, error ${error}`); diff --git a/apollo/src/lnv3/lnv3.service.ts b/apollo/src/lnv3/lnv3.service.ts index c185933..4f3e2c1 100644 --- a/apollo/src/lnv3/lnv3.service.ts +++ b/apollo/src/lnv3/lnv3.service.ts @@ -19,7 +19,12 @@ export class Lnv3Service implements OnModuleInit { private fetchCache = new Array(this.transferService.transfers.length) .fill('') - .map((_) => ({ latestNonce: -1, latestRelayerInfoNonce: -1, latestFillInfoTimestamp: -1, isSyncingHistory: false })); + .map((_) => ({ + latestNonce: -1, + latestRelayerInfoNonce: -1, + latestFillInfoTimestamp: -1, + isSyncingHistory: false, + })); protected fetchSendDataInterval = 5000; @@ -56,7 +61,8 @@ export class Lnv3Service implements OnModuleInit { private getDestChain(idOrName: string): PartnerT2 | null { return ( this.transferService.transfers.find( - (transfer) => transfer.chainConfig.id.toString() === idOrName || transfer.chainConfig.code === idOrName + (transfer) => + transfer.chainConfig.id.toString() === idOrName || transfer.chainConfig.code === idOrName ) ?? null ); } @@ -64,8 +70,7 @@ export class Lnv3Service implements OnModuleInit { private getTokenInfo(transfer: PartnerT2, address: string): ChainToken | null { return ( transfer.chainConfig.tokens.find( - (token) => - token.address.toLowerCase() === address.toLowerCase() + (token) => token.address.toLowerCase() === address.toLowerCase() ) ?? null ); } @@ -77,71 +82,89 @@ export class Lnv3Service implements OnModuleInit { transferId: string ): string { if (transferId.startsWith(`${fromChainId}-`)) { - const rmvedChainId = transferId.replace(`${fromChainId}-`, ''); - return `${transfer.chainConfig.code.split('-')[0]}-${fromChainId}-${toChainId}-lnv3-${rmvedChainId}`; + const rmvedChainId = transferId.replace(`${fromChainId}-`, ''); + return `${transfer.chainConfig.code.split('-')[0]}-${fromChainId}-${toChainId}-lnv3-${rmvedChainId}`; } else { - return `${transfer.chainConfig.code.split('-')[0]}-${fromChainId}-${toChainId}-lnv3-${transferId}`; + return `${transfer.chainConfig.code.split('-')[0]}-${fromChainId}-${toChainId}-lnv3-${transferId}`; } } async queryRecordInfo(transfer: PartnerT2, latestNonce: number) { - if (transfer.level0Indexer === Level0Indexer.ponder) { - const url = this.transferService.ponderEndpoint; - const query = `query { lnv3TransferRecords(limit: 50, orderBy: "nonce", orderDirection: "asc", where: {localChainId: "${transfer.chainConfig.id}", nonce_gt: "${latestNonce}"}) { items { id, nonce, messageNonce, remoteChainId, provider, sourceToken, targetToken, sourceAmount, targetAmount, sender, receiver, timestamp, transactionHash, fee, transferId, hasWithdrawn } }}`; - return await axios - .post(url, { - query: query, - variables: null, - }).then((res) => res.data?.data?.lnv3TransferRecords.items); - } else { - const url = transfer.indexerUrl; - const query = `query { lnv3TransferRecords(first: 20, orderBy: nonce, orderDirection: asc, skip: ${latestNonce}) { id, nonce, messageNonce, remoteChainId, provider, sourceToken, targetToken, sourceAmount, targetAmount, sender, receiver, timestamp, transactionHash, fee, transferId, hasWithdrawn } }`; - return await axios - .post(url, { - query: query, - variables: null, - }).then((res) => res.data?.data?.lnv3TransferRecords); - } + if (transfer.level0Indexer === Level0Indexer.ponder) { + const url = this.transferService.ponderEndpoint; + const query = `query { lnv3TransferRecords(limit: 50, orderBy: "nonce", orderDirection: "asc", where: {localChainId: "${transfer.chainConfig.id}", nonce_gt: "${latestNonce}"}) { items { id, nonce, messageNonce, remoteChainId, provider, sourceToken, targetToken, sourceAmount, targetAmount, sender, receiver, timestamp, transactionHash, fee, transferId, hasWithdrawn } }}`; + return await axios + .post(url, { + query: query, + variables: null, + }) + .then((res) => res.data?.data?.lnv3TransferRecords.items); + } else { + const url = transfer.indexerUrl; + const query = `query { lnv3TransferRecords(first: 20, orderBy: nonce, orderDirection: asc, skip: ${latestNonce}) { id, nonce, messageNonce, remoteChainId, provider, sourceToken, targetToken, sourceAmount, targetAmount, sender, receiver, timestamp, transactionHash, fee, transferId, hasWithdrawn } }`; + return await axios + .post(url, { + query: query, + variables: null, + }) + .then((res) => res.data?.data?.lnv3TransferRecords); + } } async queryProviderInfo(transfer: PartnerT2, latestNonce: number) { - if (transfer.level0Indexer === Level0Indexer.ponder) { - const url = this.transferService.ponderEndpoint; - const query = `query { lnv3RelayUpdateRecords(limit: 50, orderBy: "nonce", orderDirection: "asc", where: {localChainId: "${transfer.chainConfig.id}", nonce_gt: "${latestNonce}"}) { items { id, updateType, remoteChainId, provider, transactionHash, timestamp, sourceToken, targetToken, penalty, baseFee, liquidityFeeRate, transferLimit, paused } }}`; - - return await axios.post(url, { - query: query, - variables: null, - }).then((res) => res.data?.data?.lnv3RelayUpdateRecords.items); - } else { - const query = `query { lnv3RelayUpdateRecords(first: 50, orderBy: nonce, orderDirection: asc, skip: ${latestNonce}) { id, updateType, remoteChainId, provider, transactionHash, timestamp, sourceToken, targetToken, penalty, baseFee, liquidityFeeRate, transferLimit, paused } }`; - return await axios.post(transfer.indexerUrl, { - query: query, - variables: null, - }).then((res) => res.data?.data?.lnv3RelayUpdateRecords); - } - } + if (transfer.level0Indexer === Level0Indexer.ponder) { + const url = this.transferService.ponderEndpoint; + const query = `query { lnv3RelayUpdateRecords(limit: 50, orderBy: "nonce", orderDirection: "asc", where: {localChainId: "${transfer.chainConfig.id}", nonce_gt: "${latestNonce}"}) { items { id, updateType, remoteChainId, provider, transactionHash, timestamp, sourceToken, targetToken, penalty, baseFee, liquidityFeeRate, transferLimit, paused } }}`; - async queryRecordRelayStatus(toChain: PartnerT2, transferId: string) { - const url = toChain.level0Indexer === Level0Indexer.ponder ? this.transferService.ponderEndpoint : toChain.indexerUrl; - const id = toChain.level0Indexer === Level0Indexer.ponder ? `${toChain.chainConfig.id}-${transferId}` : transferId; - const query = `query { lnv3RelayRecord(id: "${id}") { id, relayer, timestamp, transactionHash, slashed, requestWithdrawTimestamp, fee }}`; return await axios - .post(url, { + .post(url, { query: query, variables: null, + }) + .then((res) => res.data?.data?.lnv3RelayUpdateRecords.items); + } else { + const query = `query { lnv3RelayUpdateRecords(first: 50, orderBy: nonce, orderDirection: asc, skip: ${latestNonce}) { id, updateType, remoteChainId, provider, transactionHash, timestamp, sourceToken, targetToken, penalty, baseFee, liquidityFeeRate, transferLimit, paused } }`; + return await axios + .post(transfer.indexerUrl, { + query: query, + variables: null, + }) + .then((res) => res.data?.data?.lnv3RelayUpdateRecords); + } + } + + async queryRecordRelayStatus(toChain: PartnerT2, transferId: string) { + const url = + toChain.level0Indexer === Level0Indexer.ponder + ? this.transferService.ponderEndpoint + : toChain.indexerUrl; + const id = + toChain.level0Indexer === Level0Indexer.ponder + ? `${toChain.chainConfig.id}-${transferId}` + : transferId; + const query = `query { lnv3RelayRecord(id: "${id}") { id, relayer, timestamp, transactionHash, slashed, requestWithdrawTimestamp, fee }}`; + return await axios + .post(url, { + query: query, + variables: null, }) .then((res) => res.data?.data?.lnv3RelayRecord); } async queryRecordWithdrawStatus(transfer: PartnerT2, transferId: string) { - const url = transfer.level0Indexer === Level0Indexer.ponder ? this.transferService.ponderEndpoint : transfer.indexerUrl; - const id = transfer.level0Indexer === Level0Indexer.ponder ? `${transfer.chainConfig.id}-${transferId}` : transferId; - const query = `query { lnv3TransferRecord(id: "${id}") { id, hasWithdrawn }}`; - return await axios + const url = + transfer.level0Indexer === Level0Indexer.ponder + ? this.transferService.ponderEndpoint + : transfer.indexerUrl; + const id = + transfer.level0Indexer === Level0Indexer.ponder + ? `${transfer.chainConfig.id}-${transferId}` + : transferId; + const query = `query { lnv3TransferRecord(id: "${id}") { id, hasWithdrawn }}`; + return await axios .post(url, { - query: query, - variables: null, + query: query, + variables: null, }) .then((res) => res.data?.data?.lnv3TransferRecord); } @@ -182,7 +205,12 @@ export class Lnv3Service implements OnModuleInit { const result = RecordStatus.pending; const endTime = 0; await this.aggregationService.createHistoryRecord({ - id: this.genID(transfer, transfer.chainConfig.id.toString(), record.remoteChainId, record.id), + id: this.genID( + transfer, + transfer.chainConfig.id.toString(), + record.remoteChainId, + record.id + ), relayer: record.provider.toLowerCase(), fromChain: transfer.chainConfig.code, toChain: toChain.chainConfig.code, @@ -230,91 +258,90 @@ export class Lnv3Service implements OnModuleInit { // batch get status from target chain on sycing historical phase async queryFillInfos(transfer: PartnerT2, latestTimestamp: number) { - if (transfer.level0Indexer === Level0Indexer.ponder) { - const url = this.transferService.ponderEndpoint; - const query = `query { lnv3RelayRecords(limit: 50, orderBy: "timestamp", orderDirection: "asc", where: {localChainId: "${transfer.chainConfig.id}", slashed: false, timestamp_gt: "${latestTimestamp}"}) { items { id, timestamp, requestWithdrawTimestamp, relayer, transactionHash, slashed, fee } }}`; - return await axios - .post(url, { - query: query, - variables: null, - }).then((res) => res.data?.data?.lnv3RelayRecords.items); - } else { - const url = transfer.indexerUrl; - const query = `query { lnv3RelayRecords(first: 20, orderBy: timestamp, orderDirection: asc, where: {timestamp_gt: "${latestTimestamp}", slashed: false}) { id, timestamp, requestWithdrawTimestamp, relayer, transactionHash, slashed, fee } }`; - return await axios - .post(url, { - query: query, - variables: null, - }).then((res) => res.data?.data?.lnv3RelayRecords); - } + if (transfer.level0Indexer === Level0Indexer.ponder) { + const url = this.transferService.ponderEndpoint; + const query = `query { lnv3RelayRecords(limit: 50, orderBy: "timestamp", orderDirection: "asc", where: {localChainId: "${transfer.chainConfig.id}", slashed: false, timestamp_gt: "${latestTimestamp}"}) { items { id, timestamp, requestWithdrawTimestamp, relayer, transactionHash, slashed, fee } }}`; + return await axios + .post(url, { + query: query, + variables: null, + }) + .then((res) => res.data?.data?.lnv3RelayRecords.items); + } else { + const url = transfer.indexerUrl; + const query = `query { lnv3RelayRecords(first: 20, orderBy: timestamp, orderDirection: asc, where: {timestamp_gt: "${latestTimestamp}", slashed: false}) { id, timestamp, requestWithdrawTimestamp, relayer, transactionHash, slashed, fee } }`; + return await axios + .post(url, { + query: query, + variables: null, + }) + .then((res) => res.data?.data?.lnv3RelayRecords); + } } async batchFetchStatus(transfer: PartnerT2, index: number) { - try { - let latestTimestamp = this.fetchCache[index].latestFillInfoTimestamp; - // stop sync history when timestamp set to zero - if (latestTimestamp === 0) { - return; - } else if (latestTimestamp === -1) { - const firstRecord = await this.aggregationService.queryHistoryRecordFirst( - { - toChain: transfer.chainConfig.code, - bridge: `lnv3`, - }, - { nonce: 'desc' } - ); - latestTimestamp = firstRecord ? firstRecord.endTime : -1; - } - const relayRecords = await this.queryFillInfos(transfer, latestTimestamp); - if (relayRecords.length === 0) { - this.fetchCache[index].latestFillInfoTimestamp = 0; - this.logger.log(`the batch sync end, chain: ${transfer.chainConfig.code}`); - return; - } - let size = 0; - for (const relayRecord of relayRecords) { - // ignore slashed transfer - if (relayRecord.slashed) continue; - let rmvedTransferId = relayRecord.id; - if (rmvedTransferId.startsWith(`${transfer.chainConfig.id}-`)) { - rmvedTransferId = rmvedTransferId.replace(`${transfer.chainConfig.id}-`, ''); - } - const uncheckedRecord = await this.aggregationService - .queryHistoryRecordFirst({ - id: { - endsWith: rmvedTransferId, - } - }); - // the record exist but not finished - if (uncheckedRecord?.endTxHash === '' ) { - const updateData = { - result: RecordStatus.success, - responseTxHash: relayRecord.transactionHash, - endTxHash: relayRecord.transactionHash, - endTime: Number(relayRecord.timestamp), - relayer: relayRecord.relayer.toLowerCase(), - needWithdrawLiquidity: false, - lastRequestWithdraw: Number(relayRecord.requestWithdrawTimestamp), - }; - - await this.aggregationService.updateHistoryRecord({ - where: { id: uncheckedRecord.id }, - data: updateData, - }); - this.fetchCache[index].latestFillInfoTimestamp = updateData.endTime; - size += 1; - } else if (uncheckedRecord) { - this.fetchCache[index].latestFillInfoTimestamp = Number(relayRecord.timestamp); - } - } - if (size > 0) { - this.logger.log( - `lnv3 [${transfer.chainConfig.code}] batch fetch status, size: ${size}` - ); - } - } catch(error) { - this.logger.warn(`batch fetch lnv3 status failed, error ${error}`); + try { + let latestTimestamp = this.fetchCache[index].latestFillInfoTimestamp; + // stop sync history when timestamp set to zero + if (latestTimestamp === 0) { + return; + } else if (latestTimestamp === -1) { + const firstRecord = await this.aggregationService.queryHistoryRecordFirst( + { + toChain: transfer.chainConfig.code, + bridge: `lnv3`, + }, + { nonce: 'desc' } + ); + latestTimestamp = firstRecord ? firstRecord.endTime : -1; + } + const relayRecords = await this.queryFillInfos(transfer, latestTimestamp); + if (relayRecords.length === 0) { + this.fetchCache[index].latestFillInfoTimestamp = 0; + this.logger.log(`the batch sync end, chain: ${transfer.chainConfig.code}`); + return; + } + let size = 0; + for (const relayRecord of relayRecords) { + // ignore slashed transfer + if (relayRecord.slashed) continue; + let rmvedTransferId = relayRecord.id; + if (rmvedTransferId.startsWith(`${transfer.chainConfig.id}-`)) { + rmvedTransferId = rmvedTransferId.replace(`${transfer.chainConfig.id}-`, ''); + } + const uncheckedRecord = await this.aggregationService.queryHistoryRecordFirst({ + id: { + endsWith: rmvedTransferId, + }, + }); + // the record exist but not finished + if (uncheckedRecord?.endTxHash === '') { + const updateData = { + result: RecordStatus.success, + responseTxHash: relayRecord.transactionHash, + endTxHash: relayRecord.transactionHash, + endTime: Number(relayRecord.timestamp), + relayer: relayRecord.relayer.toLowerCase(), + needWithdrawLiquidity: false, + lastRequestWithdraw: Number(relayRecord.requestWithdrawTimestamp), + }; + + await this.aggregationService.updateHistoryRecord({ + where: { id: uncheckedRecord.id }, + data: updateData, + }); + this.fetchCache[index].latestFillInfoTimestamp = updateData.endTime; + size += 1; + } else if (uncheckedRecord) { + this.fetchCache[index].latestFillInfoTimestamp = Number(relayRecord.timestamp); + } } + if (size > 0) { + this.logger.log(`lnv3 [${transfer.chainConfig.code}] batch fetch status, size: ${size}`); + } + } catch (error) { + this.logger.warn(`batch fetch lnv3 status failed, error ${error}`); + } } async fetchStatus(transfer: PartnerT2, index: number) { @@ -403,7 +430,7 @@ export class Lnv3Service implements OnModuleInit { size += 1; //this.logger.log( - //`lnv3 [${transfer.chain}->${toChain.chain}] new status id: ${record.id} relayed responseTxHash: ${relayRecord.transactionHash}` + //`lnv3 [${transfer.chain}->${toChain.chain}] new status id: ${record.id} relayed responseTxHash: ${relayRecord.transactionHash}` //); } // query withdrawLiquidity result @@ -431,11 +458,9 @@ export class Lnv3Service implements OnModuleInit { } } } - + if (size > 0) { - this.logger.log( - `lnv3 [${transfer.chainConfig.code}] update record status, size: ${size}` - ); + this.logger.log(`lnv3 [${transfer.chainConfig.code}] update record status, size: ${size}`); } } catch (error) { this.logger.warn(`fetch lnv3 status failed, error ${error}`); @@ -452,12 +477,26 @@ export class Lnv3Service implements OnModuleInit { } private getMessageChannel(transfer: PartnerT2, toChain: string): ChainMessager | null { - return transfer.chainConfig.couples.find((couple) => couple.chain.code === toChain && couple.protocol.name === 'lnv3')?.messager ?? null; + return ( + transfer.chainConfig.couples.find( + (couple) => couple.chain.code === toChain && couple.protocol.name === 'lnv3' + )?.messager ?? null + ); } - private getCouple(transfer: PartnerT2, toChain: string, fromTokenSymbol: string): ChainCouple | null { - return transfer.chainConfig.couples.find( - (couple) => couple.chain.code === toChain && couple.protocol.name === 'lnv3' && couple.symbol.from === fromTokenSymbol) ?? null; + private getCouple( + transfer: PartnerT2, + toChain: string, + fromTokenSymbol: string + ): ChainCouple | null { + return ( + transfer.chainConfig.couples.find( + (couple) => + couple.chain.code === toChain && + couple.protocol.name === 'lnv3' && + couple.symbol.from === fromTokenSymbol + ) ?? null + ); } async fetchProviderInfo(transfer: PartnerT2, index: number) { @@ -489,7 +528,7 @@ export class Lnv3Service implements OnModuleInit { transfer.chainConfig.id, record.remoteChainId, record.provider.toLowerCase(), - record.sourceToken.toLowerCase(), + record.sourceToken.toLowerCase() ); const relayerInfo = await this.aggregationService.queryLnBridgeRelayInfoById({ id: id, @@ -508,7 +547,9 @@ export class Lnv3Service implements OnModuleInit { if (fromToken === null || couple === null) { latestNonce += 1; this.fetchCache[index].latestRelayerInfoNonce = latestNonce; - this.logger.warn(`cannot find fromToken or couple, couple ${couple}, fromToken ${fromToken?.symbol}, fromChain: ${transfer.chainConfig.code}, toChain: ${toChain.chainConfig.code}`); + this.logger.warn( + `cannot find fromToken or couple, couple ${couple}, fromToken ${fromToken?.symbol}, fromChain: ${transfer.chainConfig.code}, toChain: ${toChain.chainConfig.code}` + ); continue; } // if not exist create @@ -570,9 +611,7 @@ export class Lnv3Service implements OnModuleInit { this.fetchCache[index].latestRelayerInfoNonce = latestNonce; } if (size > 0) { - this.logger.log( - `lnv3 [${transfer.chainConfig.code}] update relayer info, size: ${size}` - ); + this.logger.log(`lnv3 [${transfer.chainConfig.code}] update relayer info, size: ${size}`); } } catch (error) { this.logger.warn(`fetch lnv3bridge relayer records failed, error ${error}`); diff --git a/apollo/src/lnv3/transfer.service.ts b/apollo/src/lnv3/transfer.service.ts index 943272c..3af8c2e 100644 --- a/apollo/src/lnv3/transfer.service.ts +++ b/apollo/src/lnv3/transfer.service.ts @@ -28,109 +28,109 @@ export class TransferService extends BaseTransferServiceT2 { public readonly ponderEndpoint = this.configService.get('PONDER_LNV3_ENDPOINT'); formalChainTransfers: PartnerT2[] = [ - { - level0Indexer: Level0Indexer.thegraph, - indexerUrl: this.polygonEndpoint, - chainConfig: HelixChain.polygon, - }, - { - level0Indexer: Level0Indexer.thegraph, - indexerUrl: this.arbitrumEndpoint, - chainConfig: HelixChain.arbitrum, - }, - { - level0Indexer: Level0Indexer.thegraph, - indexerUrl: this.bscEndpoint, - chainConfig: HelixChain.bsc, - }, - { - level0Indexer: Level0Indexer.thegraph, - indexerUrl: this.lineaEndpoint, - chainConfig: HelixChain.linea, - }, - { - level0Indexer: Level0Indexer.thegraph, - indexerUrl: this.opEndpoint, - chainConfig: HelixChain.op, - }, - { - level0Indexer: Level0Indexer.thegraph, - indexerUrl: this.gnosisEndpoint, - chainConfig: HelixChain.gnosis, - }, - { - level0Indexer: Level0Indexer.thegraph, - indexerUrl: this.mantleEndpoint, - chainConfig: HelixChain.mantle, - }, - { - level0Indexer: Level0Indexer.thegraph, - indexerUrl: this.scrollEndpoint, - chainConfig: HelixChain.scroll, - }, - { - level0Indexer: Level0Indexer.thegraph, - indexerUrl: this.darwiniaEndpoint, - chainConfig: HelixChain.darwiniaDvm, - }, - { - level0Indexer: Level0Indexer.thegraph, - indexerUrl: this.blastEndpoint, - chainConfig: HelixChain.blast, - }, - { - level0Indexer: Level0Indexer.thegraph, - indexerUrl: this.astarZkEVMEndpoint, - chainConfig: HelixChain.astarZkevm, - }, - { - level0Indexer: Level0Indexer.thegraph, - indexerUrl: this.moonbeamEndpoint, - chainConfig: HelixChain.moonbeam, - }, + { + level0Indexer: Level0Indexer.thegraph, + indexerUrl: this.polygonEndpoint, + chainConfig: HelixChain.polygon, + }, + { + level0Indexer: Level0Indexer.thegraph, + indexerUrl: this.arbitrumEndpoint, + chainConfig: HelixChain.arbitrum, + }, + { + level0Indexer: Level0Indexer.thegraph, + indexerUrl: this.bscEndpoint, + chainConfig: HelixChain.bsc, + }, + { + level0Indexer: Level0Indexer.thegraph, + indexerUrl: this.lineaEndpoint, + chainConfig: HelixChain.linea, + }, + { + level0Indexer: Level0Indexer.thegraph, + indexerUrl: this.opEndpoint, + chainConfig: HelixChain.op, + }, + { + level0Indexer: Level0Indexer.thegraph, + indexerUrl: this.gnosisEndpoint, + chainConfig: HelixChain.gnosis, + }, + { + level0Indexer: Level0Indexer.thegraph, + indexerUrl: this.mantleEndpoint, + chainConfig: HelixChain.mantle, + }, + { + level0Indexer: Level0Indexer.thegraph, + indexerUrl: this.scrollEndpoint, + chainConfig: HelixChain.scroll, + }, + { + level0Indexer: Level0Indexer.thegraph, + indexerUrl: this.darwiniaEndpoint, + chainConfig: HelixChain.darwiniaDvm, + }, + { + level0Indexer: Level0Indexer.thegraph, + indexerUrl: this.blastEndpoint, + chainConfig: HelixChain.blast, + }, + { + level0Indexer: Level0Indexer.thegraph, + indexerUrl: this.astarZkEVMEndpoint, + chainConfig: HelixChain.astarZkevm, + }, + { + level0Indexer: Level0Indexer.thegraph, + indexerUrl: this.moonbeamEndpoint, + chainConfig: HelixChain.moonbeam, + }, ]; testChainTransfers: PartnerT2[] = [ - { - level0Indexer: Level0Indexer.thegraph, - indexerUrl: this.ethereumEndpoint, - chainConfig: HelixChain.sepolia, - }, - { - level0Indexer: Level0Indexer.thegraph, - indexerUrl: this.arbitrumEndpoint, - chainConfig: HelixChain.arbitrumSepolia, - }, - { - level0Indexer: Level0Indexer.thegraph, - indexerUrl: this.zksyncEndpoint, - chainConfig: HelixChain.zksyncSepolia, - }, - { - level0Indexer: Level0Indexer.ponder, - indexerUrl: this.taikoEndpoint, - chainConfig: HelixChain.taikoHekla, - }, - { - level0Indexer: Level0Indexer.ponder, - indexerUrl: this.beraEndpoint, - chainConfig: HelixChain.bera, - }, - { - level0Indexer: Level0Indexer.ponder, - indexerUrl: this.morphEndpoint, - chainConfig: HelixChain.morph, - }, - { - level0Indexer: Level0Indexer.ponder, - indexerUrl: this.morphEndpoint, - chainConfig: HelixChain.morph, - }, - { - level0Indexer: Level0Indexer.thegraph, - indexerUrl: this.baseEndpoint, - chainConfig: HelixChain.baseSepolia, - }, + { + level0Indexer: Level0Indexer.thegraph, + indexerUrl: this.ethereumEndpoint, + chainConfig: HelixChain.sepolia, + }, + { + level0Indexer: Level0Indexer.thegraph, + indexerUrl: this.arbitrumEndpoint, + chainConfig: HelixChain.arbitrumSepolia, + }, + { + level0Indexer: Level0Indexer.thegraph, + indexerUrl: this.zksyncEndpoint, + chainConfig: HelixChain.zksyncSepolia, + }, + { + level0Indexer: Level0Indexer.ponder, + indexerUrl: this.taikoEndpoint, + chainConfig: HelixChain.taikoHekla, + }, + { + level0Indexer: Level0Indexer.ponder, + indexerUrl: this.beraEndpoint, + chainConfig: HelixChain.bera, + }, + { + level0Indexer: Level0Indexer.ponder, + indexerUrl: this.morphEndpoint, + chainConfig: HelixChain.morph, + }, + { + level0Indexer: Level0Indexer.ponder, + indexerUrl: this.morphEndpoint, + chainConfig: HelixChain.morph, + }, + { + level0Indexer: Level0Indexer.thegraph, + indexerUrl: this.baseEndpoint, + chainConfig: HelixChain.baseSepolia, + }, ]; readonly addressToTokenInfo: { [key: string]: AddressTokenMap } = {};