planetarium / NineChronicles.EthBridge

NineChronicles ⬌ Ethereum bridge
https://planetarium.github.io/NineChronicles.EthBridge/
GNU Affero General Public License v3.0
11 stars 12 forks source link

feat(bridge): use 9cscan as 9c transaction link provider #112

Open moreal opened 2 years ago

moreal commented 2 years ago

Currently, it has used https://explorer.libplanet.io/<NETWORK>/transaction/?<TX-ID> as 9c tx link. And, since November 11, 2021, the 9cscan has appeared officially. It provides chain data like transactions, blocks with very fast speed and useful features. It seems better to use the 9cscan. But, maybe we are not using it in the internal testing cluster yet. After checking it, it may be replaced easily.

moreal commented 2 years ago

In short idea, it can be easily resolved by receiving URL format (e.g. https://9cscan.com/tx/<TX-ID>).

moreal commented 1 year ago

Description

It uses Message interface to render some message to SlackMessage.

And there are types implemented Message

For example, UnwrappedEvent rendered like the below screenshot:

image

UnwrappedEvent's constructor is:

constructor(
        explorerUrl: string,
        etherscanUrl: string,
        sender: Address,
        recipient: Address,
        amount: string,
        nineChroniclesTxId: TxId,
        ethereumTransactionHash: string
    ) {

And the UnwrappedEvent concats explorerUrl and nineChroniclesTxId by calling WrappingEvent.toExplorerUrl. But the UnwrappingFailureEvent concats them manually. Yes, it's an issue about abstraction and refactoring 😞

Suggestion to solve

I think it can be solved by applying template(?).

As steps:

  1. Receive template instead of URL prefix. For instances, rename EXPLORER_ROOT_URL to EXPLORER_URL_TEMPLATE and require format like https://explorer.libplanet.io/9c-internal/transaction/?<id>. For ETHERSCAN_ROOT_URL case, it should be like https://ropsten.etherscan.io/tx/<id>.
  2. And make messages replace <id> string with the txid instead of calling combineUrl and toExplorerurl.
  3. Run yarn test:bridge and the snapshot testings may fail. Update them with yarn test:bridge -- -u and commit changes with them.
  4. Submit that as pull request and check CI.