feat: bridge tx

This commit is contained in:
Anthony Laibe 2022-11-24 13:58:53 +01:00 committed by Anthony Laibe
parent 5b69985b18
commit 4c29c97591
1 changed files with 13 additions and 0 deletions

View File

@ -27,6 +27,7 @@ const (
ENSRelease
ENSSetPubKey
StickersBuy
Bridge
)
const EstimateUsername = "RandomUsername"
const EstimatePubKey = "0x04bb2024ce5d72e45d4a4f8589ae657ef9745855006996115a23a1af88d536cf02c0524a585fce7bfa79d6a9669af735eda6205d6c7e5b3cdc2b8ff7b2fa1f0b56"
@ -35,6 +36,14 @@ func (s SendType) isTransfer() bool {
return s == Transfer
}
func (s SendType) isAvailableBetween(from, to *params.Network) bool {
if s != Bridge {
return true
}
return from.ChainID != to.ChainID
}
func (s SendType) isAvailableFor(network *params.Network) bool {
if s == Transfer {
return true
@ -345,6 +354,10 @@ func (r *Router) suggestedRoutes(ctx context.Context, sendType SendType, account
continue
}
if !sendType.isAvailableBetween(network, dest) {
continue
}
if len(preferedChainIDs) > 0 && !containsNetworkChainID(network, preferedChainIDs) {
continue
}