Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit 490328e

Browse files
authored
Merge branch 'main' into client-l1-txHash
2 parents 9a8ec6f + 53ec9d5 commit 490328e

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

clients/IntermediaryClient.ts

+17
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { type UserOperationStruct } from "../typechain-types/contracts/SCBridgeW
1414
import { IAccount } from "./utils";
1515
import { hashState } from "./State";
1616
import { convertInvoice } from "./Accounting";
17+
import { chains } from "../src/chains";
1718

1819
/**
1920
* The IntermediaryCoordinator orchestrates an intermediary's participation in the network. It contains
@@ -72,7 +73,23 @@ export class IntermediaryCoordinator {
7273
const targetNetwork = await targetClient.getHostNetwork();
7374

7475
if (targetNetwork !== htlc.invoice.chain) {
76+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
77+
const sourceChain = chains.find((c) => c.chainID === htlc.invoice.chain)!;
78+
79+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
80+
const targetChain = chains.find((c) => c.chainID === targetNetwork)!;
81+
82+
const sourceAmount = htlc.invoice.amount;
83+
7584
htlc.invoice = convertInvoice(htlc.invoice, targetNetwork);
85+
const targetAmount = htlc.invoice.amount;
86+
87+
this.uiLog(
88+
`currency conversion from ${sourceAmount} ${sourceChain.symbol} to ${targetAmount} ${targetChain.symbol}`,
89+
);
90+
this.uiLog(
91+
` at [${sourceChain.exchangeRate} / ${targetChain.exchangeRate}] exchange rate`,
92+
);
7693
}
7794

7895
const fee = 0; // for example

src/chains.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ export const chains: ChainData[] = [
6363
chainID: 534351n,
6464
url: "https://sepolia-rpc.scroll.io",
6565
name: "scroll",
66-
symbol: "ETH",
6766
explorer: "https://sepolia.scrollscan.com/",
67+
symbol: "scrETH",
6868
exchangeRate: 1,
6969
},
7070
];

0 commit comments

Comments
 (0)