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: cross chain swaps - tx status #27740

Closed
wants to merge 139 commits into from
Closed
Show file tree
Hide file tree
Changes from 135 commits
Commits
Show all changes
139 commits
Select commit Hold shift + click to select a range
d421170
chore: setup bridge status controller skeleton
infiniteflower Oct 9, 2024
5128ef6
chore: add more types from portfolio
infiniteflower Oct 10, 2024
bb507f7
chore: add validators for bridge tx status response
infiniteflower Oct 10, 2024
6f03761
chore: add tests for bridge status validators
infiniteflower Oct 10, 2024
36098cb
chore: remove import
infiniteflower Oct 10, 2024
73704bc
chore: add txStatuses to BridgeStatusController
infiniteflower Oct 16, 2024
78da668
feat: get bridge tx status fetching working
infiniteflower Oct 17, 2024
7729e6c
chore: remove unused var
infiniteflower Oct 17, 2024
853e16c
chore: rename method
infiniteflower Oct 17, 2024
e6a4838
chore: skeleton for polling
infiniteflower Oct 17, 2024
ec5acfc
fix: didn't update renaming here
infiniteflower Oct 17, 2024
2f1d40f
chore: refactor naming to reflect polling
infiniteflower Oct 21, 2024
f62dbfd
chore: bump refresh to 30 sec
infiniteflower Oct 21, 2024
6750b38
feat: store polling tokens by txHash so we can have multiple of them
infiniteflower Oct 22, 2024
073f07a
chore: use txHistory objects instead
infiniteflower Oct 22, 2024
d6f5770
fix: not being able to fetch pending bridge status, should not cache …
infiniteflower Oct 23, 2024
0fa3346
chore: update tests
infiniteflower Oct 23, 2024
ee41112
fix: improve typing
infiniteflower Oct 23, 2024
ff9f9fe
feat: get button to switch to dest chain working
infiniteflower Oct 23, 2024
418c41e
chore: hide switch to dest chain btn conditionally
infiniteflower Oct 23, 2024
278350f
chore: speed up bridge status polling
infiniteflower Oct 23, 2024
c3735f3
fix: handle bridge status returning 500 sometimes better
infiniteflower Oct 24, 2024
35dd9db
fix: improperly setting the initial tx history item state
infiniteflower Oct 24, 2024
61b280c
chore: remove unneeded vars
infiniteflower Oct 24, 2024
60c8960
chore: show pending info for source and dest tx
infiniteflower Oct 24, 2024
cba30f0
fix: update validators for bridge status response
infiniteflower Oct 24, 2024
e1b43a6
chore: clean up
infiniteflower Oct 24, 2024
1c432de
fix: properly show the bridge status or the confirmed status
infiniteflower Oct 24, 2024
448de26
chore: refactor
infiniteflower Oct 24, 2024
3854ecc
chore: improve type naming
infiniteflower Oct 24, 2024
b30b8d1
feat: get status POC working on source and dest
infiniteflower Oct 25, 2024
3a1a282
chore: wipe bridge status on clear activity tab data
infiniteflower Oct 26, 2024
517a03b
chore: persist the bridge status
infiniteflower Oct 26, 2024
7786554
chore: add tests and refactor some code
infiniteflower Oct 26, 2024
ef4236f
chore: remove unneeded code
infiniteflower Oct 26, 2024
8ee18d6
chore: add more tests for bridge status controller
infiniteflower Oct 28, 2024
796b816
chore: remove switch to chain btn from tx list item
infiniteflower Oct 28, 2024
fab795b
chore: remove actual code to switch chains for bridge
infiniteflower Oct 28, 2024
22ece80
chore: add get state action
infiniteflower Oct 29, 2024
a347961
chore: add wip for bridge process steps and refactor some names
infiniteflower Oct 29, 2024
a25f622
fix: not importing react
infiniteflower Oct 29, 2024
877fb17
fix: not persisting bridge status controller data
infiniteflower Oct 30, 2024
389a5da
chore: setup bridge tx details skeleton
infiniteflower Oct 30, 2024
4e298e8
feat: get nonce value into bridge tx details
infiniteflower Oct 30, 2024
db9b578
feat: get most data into the bridge tx details page, just need to sty…
infiniteflower Oct 31, 2024
bde8781
chore: use proper capitalization on status
infiniteflower Oct 31, 2024
4873476
chore: add color to status, adjust bridge step component
infiniteflower Oct 31, 2024
ba6abd3
chore: remove special bridge history item for dest chain incoming tx
infiniteflower Nov 1, 2024
5f402f6
chore: add spinning animation
infiniteflower Nov 1, 2024
ec660b5
chore: wip for bridge steps
infiniteflower Nov 4, 2024
72dac90
chore: get hollow circle icon working
infiniteflower Nov 5, 2024
08978ea
chore: set color for circles
infiniteflower Nov 5, 2024
3302752
chore: improve the step text
infiniteflower Nov 5, 2024
c12fadd
chore: hide explorer links if not available
infiniteflower Nov 5, 2024
3fa433e
feat: get proper status and text for steps
infiniteflower Nov 5, 2024
32d1e16
chore: add dots and lines for steps progress
infiniteflower Nov 5, 2024
f0f7346
chore: adjust spacing, fix explorer buttons
infiniteflower Nov 5, 2024
a5abe22
chore: adjust spacing, add dividers
infiniteflower Nov 5, 2024
abe652a
chore: adjust tx detail sizing
infiniteflower Nov 5, 2024
fc4d30e
fix: explorer links text hover color not working
infiniteflower Nov 5, 2024
e8c2414
chore: share step status between dots and text
infiniteflower Nov 5, 2024
c0c7661
chore: refactor unused var
infiniteflower Nov 5, 2024
a84586a
chore: use dest token amount as bridge amount
infiniteflower Nov 5, 2024
c08e417
chore: update text to past tense
infiniteflower Nov 5, 2024
ebd2d50
chore: move progress bar to own component
infiniteflower Nov 5, 2024
4d5fef5
chore: color the nodes and edges properly of the progress bar
infiniteflower Nov 5, 2024
8136630
chore: clean up unused code
infiniteflower Nov 5, 2024
907f344
chore: remove dev code
infiniteflower Nov 5, 2024
ffacfd0
chore: add dest chain icon to bridge type
infiniteflower Nov 5, 2024
92fb816
fix: possibly missing status
infiniteflower Nov 5, 2024
ab84f82
fix: tx details crashing
infiniteflower Nov 5, 2024
b1da248
fix: alignment of icon with long network name
infiniteflower Nov 5, 2024
8be3548
fix: missing react keys
infiniteflower Nov 5, 2024
eec0cf5
fix: clearing activity tab data for bridge status would fail b/c we t…
infiniteflower Nov 5, 2024
27cd147
feat: restart polling when bridge status controller is created on bro…
infiniteflower Nov 5, 2024
017babd
chore: add comments
infiniteflower Nov 5, 2024
614b06c
chore: use avatar network
infiniteflower Nov 5, 2024
19df414
fix: only have 1 spinner at a time
infiniteflower Nov 5, 2024
0d614bd
chore: setup bridge tx segment tracker
infiniteflower Nov 5, 2024
fb3a1e2
chore: get all 3 segment types working
infiniteflower Nov 5, 2024
5d1b2b0
feat: style bridge tx segments
infiniteflower Nov 5, 2024
660f70d
fix: transaction number should line up with segment
infiniteflower Nov 5, 2024
e05002d
fix: use css grid to align the progress bar dots and desc
infiniteflower Nov 5, 2024
8095960
chore: remove dev code
infiniteflower Nov 5, 2024
ca1c0bb
chore: remove margins for icon
infiniteflower Nov 5, 2024
c5e8699
chore: improve spacing for progress bar steps
infiniteflower Nov 5, 2024
5d51b50
feat: add clock time to step desc, format text color
infiniteflower Nov 5, 2024
b34c219
chore: add comments
infiniteflower Nov 6, 2024
92c093b
feat: show bridge icon in activity item
infiniteflower Nov 6, 2024
92a4ccf
feat: animate the segment
infiniteflower Nov 6, 2024
d64a7f6
chore: add stories for bridge step list, fix line going into circle
infiniteflower Nov 6, 2024
23da194
feat: animate pulse, fix edge colors, increase current step font weig…
infiniteflower Nov 6, 2024
3f8e39b
fix: type error
infiniteflower Nov 6, 2024
a00b119
fix: make step line always below the cricle
infiniteflower Nov 6, 2024
7486803
chore: fix comment
infiniteflower Nov 6, 2024
618be6d
fix: actually make line always below the hollow circle
infiniteflower Nov 6, 2024
943dcac
chore: add test for restart of polling for pending txHistory items on…
infiniteflower Nov 7, 2024
b3922c3
chore: use i18n for all bridge status strings
infiniteflower Nov 7, 2024
c9403c2
chore: remove logs
infiniteflower Nov 7, 2024
620c30e
chore: don't send up bridge status txHistory with sentry state
infiniteflower Nov 7, 2024
50ae960
chore: log error
infiniteflower Nov 7, 2024
c435536
fix: bridge tx details screen crashing while bridge pending
infiniteflower Nov 8, 2024
9c32bd0
fix: react prop type missing bridge
infiniteflower Nov 8, 2024
d594886
chore: add bridge status to mock store
infiniteflower Nov 8, 2024
c22b857
chore: add bridgeStatusState to mock-state
infiniteflower Nov 8, 2024
a40aafc
fix: fix tests
infiniteflower Nov 8, 2024
5328e08
fix: broken tests
infiniteflower Nov 8, 2024
c2dd2b2
fix: broken tests
infiniteflower Nov 8, 2024
a34164a
fix: remove dev code
infiniteflower Nov 8, 2024
8297515
fix: broken tests
infiniteflower Nov 8, 2024
81b965b
fix: broken tests
infiniteflower Nov 8, 2024
dd0e116
fix: broken tests
infiniteflower Nov 8, 2024
5c7c96c
fix: broken tests
infiniteflower Nov 8, 2024
5390088
chore: move bridge status types to shared
infiniteflower Nov 8, 2024
ad21e69
fix: broken stories
infiniteflower Nov 8, 2024
d04af6f
fix: auto fix lint issues
infiniteflower Nov 8, 2024
37ccb3a
fix: lint errors
infiniteflower Nov 11, 2024
a10d4e8
fix: lint errors
infiniteflower Nov 11, 2024
f9ccb5c
fix: lint errors
infiniteflower Nov 11, 2024
af2f357
fix: storybook errors
infiniteflower Nov 11, 2024
3244912
fix: broken e2e tests
infiniteflower Nov 11, 2024
e849b83
fix: lint error
infiniteflower Nov 11, 2024
d94a464
chore: use i18n for Bridge to networkName
infiniteflower Nov 14, 2024
a2e12e4
chore: give bridge text in activity item more space
infiniteflower Nov 14, 2024
9d71e54
fix: show bridge amount as source token
infiniteflower Nov 14, 2024
4f9bdf3
chore: update snapshots
infiniteflower Nov 14, 2024
f76f9e6
chore: make restartPollingForIncompleteHistoryItems private
infiniteflower Nov 20, 2024
92036aa
chore: testing if we privacy snapshots break in CI
infiniteflower Nov 20, 2024
36fe4cc
chore: construct a fallback network configuration if user has not add…
infiniteflower Nov 21, 2024
94a7847
chore: rename file and hook to be more specific
infiniteflower Nov 21, 2024
8635d76
chore: move hooks to ui hooks folder
infiniteflower Nov 21, 2024
e479812
fix: broken import
infiniteflower Nov 21, 2024
a2ae97c
chore: adjust font sizes
infiniteflower Nov 21, 2024
9d98926
fix: lint error
infiniteflower Nov 21, 2024
076a868
fix: lint error
infiniteflower Nov 21, 2024
d1ac948
chore: make a decToPrefixedHex util and use it in bridgeStatus code
infiniteflower Nov 22, 2024
fa941e9
chore: add source and dest network names when bridge complete
infiniteflower Nov 22, 2024
3cbea13
fix: text alignment issues with bridge tx details, remove fiat values
infiniteflower Nov 22, 2024
b074101
fix: lint errors
infiniteflower Nov 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .storybook/test-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ const state = {
url: 'https://metamask.github.io/test-dapp/',
},
metamask: {
bridgeStatusState: {
txHistory: {},
},
announcements: {
22: {
id: 22,
Expand Down
65 changes: 65 additions & 0 deletions app/_locales/en/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions app/images/hollow-circle.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions app/scripts/constants/sentry-state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,11 @@ export const SENTRY_BACKGROUND_STATE = {
quotesRefreshCount: true,
},
},
BridgeStatusController: {
bridgeStatusState: {
txHistory: false,
},
},
CronjobController: {
jobs: false,
},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,213 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`BridgeStatusController constructor rehydrates the tx history state 1`] = `
{
"0xsrcTxHash1": {
"account": "0xaccount1",
"estimatedProcessingTimeInSeconds": 15,
"initialDestAssetBalance": undefined,
"pricingData": undefined,
"quote": {
"bridgeId": "lifi",
"bridges": [
"across",
],
"destAsset": {
"address": "0x0000000000000000000000000000000000000000",
"chainId": 10,
"coinKey": "ETH",
"decimals": 18,
"icon": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2/logo.png",
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2/logo.png",
"name": "ETH",
"priceUSD": "2478.63",
"symbol": "ETH",
},
"destChainId": 10,
"destTokenAmount": "990654755978612",
"feeData": {
"metabridge": {
"amount": "8750000000000",
"asset": {
"address": "0x0000000000000000000000000000000000000000",
"chainId": 42161,
"coinKey": "ETH",
"decimals": 18,
"icon": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2/logo.png",
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2/logo.png",
"name": "ETH",
"priceUSD": "2478.7",
"symbol": "ETH",
},
},
},
"requestId": "197c402f-cb96-4096-9f8c-54aed84ca776",
"srcAsset": {
"address": "0x0000000000000000000000000000000000000000",
"chainId": 42161,
"coinKey": "ETH",
"decimals": 18,
"icon": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2/logo.png",
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2/logo.png",
"name": "ETH",
"priceUSD": "2478.7",
"symbol": "ETH",
},
"srcChainId": 42161,
"srcTokenAmount": "991250000000000",
"steps": [
{
"action": "bridge",
"destAmount": "990654755978612",
"destAsset": {
"address": "0x0000000000000000000000000000000000000000",
"chainId": 10,
"coinKey": "ETH",
"decimals": 18,
"icon": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2/logo.png",
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2/logo.png",
"name": "ETH",
"priceUSD": "2478.63",
"symbol": "ETH",
},
"destChainId": 10,
"protocol": {
"displayName": "Across",
"icon": "https://raw.githubusercontent.com/lifinance/types/main/src/assets/icons/bridges/acrossv2.png",
"name": "across",
},
"srcAmount": "991250000000000",
"srcAsset": {
"address": "0x0000000000000000000000000000000000000000",
"chainId": 42161,
"coinKey": "ETH",
"decimals": 18,
"icon": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2/logo.png",
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2/logo.png",
"name": "ETH",
"priceUSD": "2478.7",
"symbol": "ETH",
},
"srcChainId": 42161,
},
],
},
"slippagePercentage": 0,
"startTime": 1729964825189,
"status": {
"srcChain": {
"chainId": 42161,
"txHash": "0xsrcTxHash1",
},
"status": "PENDING",
},
"targetContractAddress": "0x23981fC34e69eeDFE2BD9a0a9fCb0719Fe09DbFC",
},
}
`;

exports[`BridgeStatusController startPollingForBridgeTxStatus sets the inital tx history state 1`] = `
{
"0xsrcTxHash1": {
"account": "0xaccount1",
"estimatedProcessingTimeInSeconds": 15,
"initialDestAssetBalance": undefined,
"pricingData": undefined,
"quote": {
"bridgeId": "lifi",
"bridges": [
"across",
],
"destAsset": {
"address": "0x0000000000000000000000000000000000000000",
"chainId": 10,
"coinKey": "ETH",
"decimals": 18,
"icon": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2/logo.png",
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2/logo.png",
"name": "ETH",
"priceUSD": "2478.63",
"symbol": "ETH",
},
"destChainId": 10,
"destTokenAmount": "990654755978612",
"feeData": {
"metabridge": {
"amount": "8750000000000",
"asset": {
"address": "0x0000000000000000000000000000000000000000",
"chainId": 42161,
"coinKey": "ETH",
"decimals": 18,
"icon": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2/logo.png",
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2/logo.png",
"name": "ETH",
"priceUSD": "2478.7",
"symbol": "ETH",
},
},
},
"requestId": "197c402f-cb96-4096-9f8c-54aed84ca776",
"srcAsset": {
"address": "0x0000000000000000000000000000000000000000",
"chainId": 42161,
"coinKey": "ETH",
"decimals": 18,
"icon": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2/logo.png",
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2/logo.png",
"name": "ETH",
"priceUSD": "2478.7",
"symbol": "ETH",
},
"srcChainId": 42161,
"srcTokenAmount": "991250000000000",
"steps": [
{
"action": "bridge",
"destAmount": "990654755978612",
"destAsset": {
"address": "0x0000000000000000000000000000000000000000",
"chainId": 10,
"coinKey": "ETH",
"decimals": 18,
"icon": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2/logo.png",
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2/logo.png",
"name": "ETH",
"priceUSD": "2478.63",
"symbol": "ETH",
},
"destChainId": 10,
"protocol": {
"displayName": "Across",
"icon": "https://raw.githubusercontent.com/lifinance/types/main/src/assets/icons/bridges/acrossv2.png",
"name": "across",
},
"srcAmount": "991250000000000",
"srcAsset": {
"address": "0x0000000000000000000000000000000000000000",
"chainId": 42161,
"coinKey": "ETH",
"decimals": 18,
"icon": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2/logo.png",
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2/logo.png",
"name": "ETH",
"priceUSD": "2478.7",
"symbol": "ETH",
},
"srcChainId": 42161,
},
],
},
"slippagePercentage": 0,
"startTime": 1729964825189,
"status": {
"srcChain": {
"chainId": 42161,
"txHash": "0xsrcTxHash1",
},
"status": "PENDING",
},
"targetContractAddress": "0x23981fC34e69eeDFE2BD9a0a9fCb0719Fe09DbFC",
},
}
`;
Loading
Loading