Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: chainflip explorer link #8529

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open

Conversation

gomesalexandre
Copy link
Contributor

@gomesalexandre gomesalexandre commented Jan 9, 2025

Description

Does what it says on the box - effectively steals the GraphQL query (although simplified) from https://scan.chainflip.io to get swapId from the Txid, and uses that in place of regular explorer Tx link when ready.
Confirmed with @CumpsD we can use the endpoint, although internal.
Note the when ready above: it takes some time for things to be indexed on the flip side of things, e.g a minute or so for EVM sells.

Issue (if applicable)

closes #8517

Risk

High Risk PRs Require 2 approvals

Low

What protocols, transaction types, wallets or contract interactions might be affected by this PR?

Testing

  • Notice long-poll of chainflip GraphQL endpoint to get the swapId (filter network requests by graphql)
  • When swapId is indexed, sell explorer Tx link changes from regular explorer Tx link to Chainflip Scan swap Tx link

Engineering

  • ^

Operations

  • 🏁 My feature is behind a flag and doesn't require operations testing (yet)
  • ^

Screenshots (if applicable)

  • New trade flow
Screenshot 2025-01-09 at 22 21 12
  • Old trade flow
Screenshot 2025-01-09 at 22 27 46

@gomesalexandre gomesalexandre marked this pull request as ready for review January 9, 2025 18:32
@gomesalexandre gomesalexandre requested a review from a team as a code owner January 9, 2025 18:32
@CumpsD
Copy link
Contributor

CumpsD commented Jan 9, 2025

@gomesalexandre is it an option to link to the deposit channel instead of the swap? cos we have that information available the moment we open the channel (start the swap ui screen)

This link looks like this: https://scan.chainflip.io/channels/6071496-Bitcoin-26902

And we have the 6071496-Bitcoin-26902 part available (actually, I think we have the entire url available when starting the swap)

@0xApotheosis
Copy link
Member

gm @CumpsD - from a user perspective it seems that the swap URL is more relevant/useful (shows gas fee, rate, total fees etc). Is there a reason we'd want to show the deposit channel URL instead?

@0xApotheosis 0xApotheosis self-assigned this Jan 10, 2025
@CumpsD
Copy link
Contributor

CumpsD commented Jan 10, 2025

You're right, swap page is the best :)

The future walletless swapper might use the deposit page perhaps, since that provides the info to verify the deposit address for the security minded

Copy link
Member

@0xApotheosis 0xApotheosis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good, though didn't work for me on my test BTC to ARB swap:

Screenshot 2025-01-10 at 15 24 50 Screenshot 2025-01-10 at 15 24 57 Screenshot 2025-01-10 at 15 27 51

Note the URLs, and lack of graphQL queries. I should have got a jam - I'll retry with that.

Comment on lines +37 to +47
query: `
query GetStringSearchResults($searchString: String!) {
txRefs: allTransactionRefs(filter: {ref: {equalTo: $searchString}}) {
nodes {
swap: swapRequestBySwapRequestId {
nativeId
}
}
}
}
`,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking: I'd prefer to see this query extracted as a constant for readability/maintainability.

Comment on lines +80 to +82
return maybeChainflipSwapId
? `${baseUrl}${maybeChainflipSwapId}`
: `${defaultExplorerBaseUrl}${id}`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧠

Copy link
Member

@0xApotheosis 0xApotheosis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, it did work for an ETH on Arb to an ETH swap - perhaps an issue with Chainflip boost (which I used for the first trade)?

Successful TX with expected link: https://jam.dev/c/346b94e5-d8cc-4eec-829c-cb43db01b739

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Show Chainflip swap URL on swaps
3 participants