Skip to content

Commit

Permalink
Support the new Indexer schema
Browse files Browse the repository at this point in the history
  • Loading branch information
igorsereda committed Aug 6, 2024
1 parent e3511e6 commit 08a4a48
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@ l1_transaction {
l1_account
l2_account
timestamp
inbox_message {
type
level
index
}
}
l2_transaction {
level
Expand All @@ -30,4 +25,9 @@ l2_transaction {
id
}
timestamp
}
inbox_message {
type
level
index
}`;
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ l2_transaction {
l1_account
l2_account
timestamp
outbox_message {
level
index
commitment {
hash
}
proof
cemented_at
}
outbox_message {
level
index
commitment {
hash
}
proof
cemented_at
}`;
20 changes: 12 additions & 8 deletions src/bridgeDataProviders/dipDupBridgeDataProvider/dtos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,15 @@ interface InboxMessageDto {
index: number;
}

interface OutboxMessageDto {
level: number;
index: number;
commitment: { hash: string; } | null;
proof: string | null;
cemented_at: string;
cemented_level: number;
}

interface TezosTicketDto {
token: TezosTokenDto;
}
Expand All @@ -40,7 +49,6 @@ interface DepositL1TransactionDto {
l1_account: string;
l2_account: string;
timestamp: string;
inbox_message: InboxMessageDto;
}

interface DepositL2TransactionDto {
Expand All @@ -57,6 +65,7 @@ interface DepositL2TransactionDto {
export interface BridgeDepositDto {
l1_transaction: DepositL1TransactionDto;
l2_transaction: DepositL2TransactionDto | null;
inbox_message: InboxMessageDto | null;
}

interface WithdrawalL1TransactionDto {
Expand All @@ -65,6 +74,7 @@ interface WithdrawalL1TransactionDto {
counter: number;
nonce: number | null;
timestamp: string;
outbox_message: OutboxMessageDto;
}

interface WithdrawalL2TransactionDto {
Expand All @@ -79,18 +89,12 @@ interface WithdrawalL2TransactionDto {
l1_account: string;
l2_account: string;
timestamp: string;
outbox_message: {
level: number;
index: number;
commitment: { hash: string; } | null;
proof: string | null;
cemented_at: string | null;
}
}

export interface BridgeWithdrawalDto {
l1_transaction: WithdrawalL1TransactionDto | null;
l2_transaction: WithdrawalL2TransactionDto;
outbox_message: OutboxMessageDto | null;
}

export interface BridgeOperationDto {
Expand Down
14 changes: 7 additions & 7 deletions src/bridgeDataProviders/dipDupBridgeDataProvider/mappers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,10 @@ export const mapBridgeWithdrawalDtoToWithdrawalBridgeTokenTransfer = (dto: Bridg
}
: undefined;
const rollupData = {
outboxMessageLevel: dto.l2_transaction.outbox_message.level,
outboxMessageIndex: dto.l2_transaction.outbox_message.index,
commitment: dto.l2_transaction.outbox_message.commitment?.hash || '',
proof: dto.l2_transaction.outbox_message.proof || ''
outboxMessageLevel: dto.outbox_message?.level || 0,
outboxMessageIndex: dto.outbox_message?.index || 0,
commitment: dto.outbox_message?.commitment?.hash || '',
proof: dto.outbox_message?.proof || ''
};
const id = bridgeUtils.convertOperationDataToTokenTransferId(etherlinkOperation.hash, etherlinkOperation.logIndex);

Expand Down Expand Up @@ -178,9 +178,9 @@ export const mapBridgeWithdrawalDtoToWithdrawalBridgeTokenTransfer = (dto: Bridg
receiver,
etherlinkOperation,
rollupData: {
outboxMessageLevel: dto.l2_transaction.outbox_message.level,
outboxMessageIndex: dto.l2_transaction.outbox_message.index,
estimatedOutboxMessageExecutionTimestamp: dto.l2_transaction.outbox_message.cemented_at || undefined
outboxMessageLevel: dto.outbox_message?.level || 0,
outboxMessageIndex: dto.outbox_message?.index || 0,
estimatedOutboxMessageExecutionTimestamp: dto.outbox_message?.cemented_at || undefined
}
};
}
Expand Down

0 comments on commit 08a4a48

Please sign in to comment.