Skip to content

Commit

Permalink
Add configurable info link for prtoect modal
Browse files Browse the repository at this point in the history
  • Loading branch information
Adamj1232 committed Aug 31, 2023
1 parent 3e90b90 commit ab74db8
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
3 changes: 2 additions & 1 deletion packages/core/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,5 @@ export const STORAGE_KEYS = {

export const MOBILE_WINDOW_WIDTH = 768

export const BN_PROTECT_RPC_URL = 'https://rpc.blocknative.com/boost'
export const BN_BOOST_RPC_URL = 'https://rpc.blocknative.com/boost'
export const BN_BOOST_INFO_URL = 'https://docs.blocknative.com/blocknative-mev-protection/transaction-boost-alpha'
4 changes: 3 additions & 1 deletion packages/core/src/validation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,8 @@ const accountCenterInitOptions = Joi.object({
position: commonPositions,
minimal: Joi.boolean(),
containerElement: Joi.string(),
hideTransactionProtectionBtn: Joi.boolean()
hideTransactionProtectionBtn: Joi.boolean(),
transactionProtectionInfoLink: Joi.boolean()
})

const accountCenter = Joi.object({
Expand All @@ -192,6 +193,7 @@ const accountCenter = Joi.object({
expanded: Joi.boolean(),
minimal: Joi.boolean(),
hideTransactionProtectionBtn: Joi.boolean(),
transactionProtectionInfoLink: Joi.boolean(),
containerElement: Joi.string()
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import { configuration } from '../../configuration.js'
import SecondaryTokenTable from './SecondaryTokenTable.svelte'
import { updateChainRPC } from '../../provider.js'
import { BN_PROTECT_RPC_URL } from '../../constants.js'
import { BN_BOOST_RPC_URL, BN_BOOST_INFO_URL } from '../../constants.js'
export let expanded: boolean
Expand Down Expand Up @@ -76,7 +76,7 @@
await updateChainRPC(
primaryWallet.provider,
validAppChain,
validAppChain?.protectedRpcUrl || BN_PROTECT_RPC_URL
validAppChain?.protectedRpcUrl || BN_BOOST_RPC_URL
)
enableTransactionProtection = false
} catch (error) {
Expand Down Expand Up @@ -332,6 +332,8 @@
<EnableTransactionProtectionModal
onDismiss={() => (enableTransactionProtection = false)}
onEnable={() => enableProtectionRPC()}
transactionProtectionInfoLink={$accountCenter$.transactionProtectionInfoLink ||
BN_BOOST_INFO_URL}
/>
{/if}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
export let onEnable: () => void
export let onDismiss: () => void
export let transactionProtectionInfoLink: string
</script>

<style>
Expand Down Expand Up @@ -86,8 +87,7 @@
<div>
{$_('modals.confirmTransactionProtection.description')}
<a
href={connect.iDontHaveAWalletLink ||
'https://ethereum.org/en/wallets/find-wallet/#main-content'}
href={transactionProtectionInfoLink}
target="_blank"
rel="noreferrer noopener"
class="no-link"
Expand Down

0 comments on commit ab74db8

Please sign in to comment.