-
Notifications
You must be signed in to change notification settings - Fork 149
feat(bridge): add Near provider and provider feature-flags #6466
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
Open
anxolin
wants to merge
65
commits into
develop
Choose a base branch
from
add-near-provider
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 10 commits
Commits
Show all changes
65 commits
Select commit
Hold shift + click to select a range
fc8fe40
feat: add near provider
anxolin 061e268
chore: fix dependency mismatch
anxolin f5602e2
chore: remove excessive log
shoom3301 4b0b6b5
fix(explorer): detect near bridge provider
shoom3301 b64c3fa
chore: fix build
shoom3301 be8d895
feat(bridge): add feature-flags for bridge providers
shoom3301 1833297
Merge pull request #6475 from cowprotocol/add-near-provider-fix-statu…
shoom3301 04a6b3c
Merge branch 'develop' into add-near-provider
shoom3301 e73913d
chore: update SDK
shoom3301 d2eee95
chore: update SDK
shoom3301 c822c8d
Merge branch 'develop' of https://github.com/cowprotocol/cowswap into…
shoom3301 569a1d6
chore: temporary remove new networks
shoom3301 efe62d9
chore: temporary remove new networks
shoom3301 775d027
chore: fix imports
shoom3301 b148777
chore: remove patch
shoom3301 d895c28
chore: remove patch
shoom3301 0b09210
chore: remove patch
shoom3301 e533132
chore: remove patch
shoom3301 dd81e96
chore: update sdk
shoom3301 d53dbae
Merge branch 'develop' of https://github.com/cowprotocol/cowswap into…
shoom3301 379ab42
chore: revert new chains
shoom3301 0b9b2f5
chore: update sdk
shoom3301 999cd60
Merge remote-tracking branch 'origin/add-near-provider' into add-near…
shoom3301 73ef069
chore: revert revert new chains
shoom3301 54f3e79
fix: support intermediate and dest token diff decimals
shoom3301 b4fc3b2
chore: fix typings
shoom3301 9374b10
Merge branch 'develop' into add-near-provider
shoom3301 b3fb189
chore: fix surplusAmount logic
shoom3301 7c3cb15
chore: add tests
shoom3301 3413761
chore: fix operator
shoom3301 db4015f
Merge branch 'develop' of https://github.com/cowprotocol/cowswap into…
shoom3301 9b76807
fix: fix total costs calculations
shoom3301 8866fbf
fix: fix custom recipient for ReceiverAccountBridgeProvider
shoom3301 5a7a641
refactor: add address to token logo data
shoom3301 22ba543
fix: add tooltip for bridgeReceiverOverride
shoom3301 6ae3d95
chore: update sdk
shoom3301 f361e77
chore: fix issues
shoom3301 804014e
Merge branch 'develop' of https://github.com/cowprotocol/cowswap into…
shoom3301 5c890fc
chore: update en
shoom3301 9881aea
fix: adjust displayed amounts in bridge details
shoom3301 568d93d
chore: update sdk
shoom3301 f31c3a9
chore: update sdk
shoom3301 7563ae1
feat: add info about no intermediate tokens
shoom3301 9f27b05
chore: revert fast fix
shoom3301 d827166
fix: fix intermediate != destination token amounts
shoom3301 1f6b39a
chore: update SDK
shoom3301 531a85e
chore: fix build
shoom3301 ef47556
chore: fix tests
shoom3301 5caba8c
chore: fix build
shoom3301 353134c
chore: update sdk
shoom3301 b950962
fix(explorer): do not show zero fillTimeInSeconds
shoom3301 3561642
fix(explorer): fix fillTimeInSeconds display
shoom3301 adf99f3
fix: fix SameBuyAndSellToken error handling
shoom3301 2b67d43
chore: update sdk
shoom3301 42cab4c
fix: hide receive info tooltip for bridging
shoom3301 6c57d3e
fix: disable permits for ReceiverAccountBridgeProvider
shoom3301 5e79198
fix: hide ReceiveAmount for near provider
shoom3301 76ae8d3
fix: fix bridge buyAmount
shoom3301 14cd4ca
chore: update sdk
shoom3301 f088644
fix: do not override quote error when another one started
shoom3301 9b365e3
chore: fix price impact calculations
shoom3301 a6ba5de
fix: enable permits for near bridge provider
shoom3301 cf8f4b2
chore: update sdk
shoom3301 75a51b2
fix: reset appData hooks when sell token changes
shoom3301 66577c7
chore: update sdk
shoom3301 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
apps/cowswap-frontend/src/entities/bridgeProvider/BridgeProvidersUpdater.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| import { useSetAtom } from 'jotai' | ||
| import { useEffect } from 'react' | ||
|
|
||
| import { useFeatureFlags } from '@cowprotocol/common-hooks' | ||
| import { DefaultBridgeProvider } from '@cowprotocol/sdk-bridging' | ||
|
|
||
| import { bridgeProvidersAtom } from './bridgeProvidersAtom' | ||
|
|
||
| import { | ||
| acrossBridgeProvider, | ||
| bridgingSdk, | ||
| bungeeBridgeProvider, | ||
| nearIntentsBridgeProvider, | ||
| } from '../../tradingSdk/bridgingSdk' | ||
|
|
||
| function toggleProvider(providers: Set<DefaultBridgeProvider>, provider: DefaultBridgeProvider, flag: boolean): void { | ||
| if (flag) { | ||
| providers.add(provider) | ||
| } else { | ||
| providers.delete(provider) | ||
| } | ||
| } | ||
|
|
||
| export function BridgeProvidersUpdater(): null { | ||
| const setBridgeProviders = useSetAtom(bridgeProvidersAtom) | ||
| const { isNearIntentsBridgeProviderEnabled, isAcrossBridgeProviderEnabled, isBungeeBridgeProviderEnabled } = | ||
| useFeatureFlags() | ||
|
|
||
| useEffect(() => { | ||
| // Skip updating till all flags are loaded | ||
| if ( | ||
| [isNearIntentsBridgeProviderEnabled, isAcrossBridgeProviderEnabled, isBungeeBridgeProviderEnabled].some( | ||
| (v) => typeof v !== 'boolean', | ||
| ) | ||
| ) { | ||
| return | ||
| } | ||
|
|
||
| setBridgeProviders((providers) => { | ||
| const newProviders = new Set(providers) | ||
|
|
||
| toggleProvider(newProviders, bungeeBridgeProvider, isBungeeBridgeProviderEnabled) | ||
| toggleProvider(newProviders, nearIntentsBridgeProvider, isNearIntentsBridgeProviderEnabled) | ||
| toggleProvider(newProviders, acrossBridgeProvider, isAcrossBridgeProviderEnabled) | ||
|
|
||
| bridgingSdk.setAvailableProviders([...newProviders].map((p) => p.info.dappId)) | ||
|
|
||
| return newProviders | ||
| }) | ||
| }, [ | ||
| isNearIntentsBridgeProviderEnabled, | ||
| isAcrossBridgeProviderEnabled, | ||
| isBungeeBridgeProviderEnabled, | ||
| setBridgeProviders, | ||
| ]) | ||
|
|
||
| return null | ||
| } | ||
6 changes: 3 additions & 3 deletions
6
apps/cowswap-frontend/src/entities/bridgeProvider/bridgeProvidersAtom.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| import { atom } from 'jotai' | ||
|
|
||
| import { isProd } from '@cowprotocol/common-utils' | ||
| import { DefaultBridgeProvider } from '@cowprotocol/sdk-bridging' | ||
|
|
||
| import { bridgeProviders } from 'tradingSdk/bridgingSdk' | ||
| import { bungeeBridgeProvider } from 'tradingSdk/bridgingSdk' | ||
|
|
||
| export const bridgeProvidersAtom = atom(isProd ? [bridgeProviders[0]] : bridgeProviders) | ||
| export const bridgeProvidersAtom = atom(new Set<DefaultBridgeProvider>([bungeeBridgeProvider])) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,3 @@ | ||
| export { useBridgeSupportedNetworks, useBridgeSupportedNetwork } from './useBridgeSupportedNetworks' | ||
| export { useBridgeSupportedTokens } from './useBridgeSupportedTokens' | ||
| export { BridgeProvidersUpdater } from './BridgeProvidersUpdater' |
9 changes: 0 additions & 9 deletions
9
apps/cowswap-frontend/src/entities/bridgeProvider/useBridgeProviders.ts
This file was deleted.
Oops, something went wrong.
9 changes: 9 additions & 0 deletions
9
apps/cowswap-frontend/src/entities/bridgeProvider/useBridgeProvidersIds.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| import { useAtomValue } from 'jotai' | ||
|
|
||
| import { bridgeProvidersAtom } from './bridgeProvidersAtom' | ||
|
|
||
| export function useBridgeProvidersIds(): string[] { | ||
| const providers = useAtomValue(bridgeProvidersAtom) | ||
|
|
||
| return [...providers].map((p) => p.info.dappId) | ||
| } |
246 changes: 0 additions & 246 deletions
246
apps/cowswap-frontend/src/entities/bridgeProvider/useBridgeSupportedNetworks.test.tsx
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.