diff --git a/packages/bridge-ui/src/components/form/BridgeForm.svelte b/packages/bridge-ui/src/components/form/BridgeForm.svelte index 27da5aa61d1..02504cd1278 100644 --- a/packages/bridge-ui/src/components/form/BridgeForm.svelte +++ b/packages/bridge-ui/src/components/form/BridgeForm.svelte @@ -48,6 +48,7 @@ let memo: string = ""; let loading: boolean = false; let isFaucetModalOpen: boolean = false; + let memoError: string; $: getUserBalance($signer, $token, $fromChain); @@ -97,7 +98,7 @@ } } - $: isBtnDisabled($signer, amount, $token, tokenBalance, requiresAllowance) + $: isBtnDisabled($signer, amount, $token, tokenBalance, requiresAllowance, memoError) .then((d) => (btnDisabled = d)) .catch((e) => console.log(e)); @@ -129,7 +130,8 @@ amount: string, token: Token, tokenBalance: string, - requiresAllowance: boolean + requiresAllowance: boolean, + memoError: string, ) { if (!signer) return true; if (!tokenBalance) return true; @@ -144,6 +146,9 @@ ) ) return true; + if(memoError) { + return true; + } return false; } @@ -387,7 +392,7 @@ - + {#if loading} @@ -405,7 +410,7 @@ {:else if !requiresAllowance} @@ -413,7 +418,7 @@ {:else} diff --git a/packages/bridge-ui/src/components/form/Memo.svelte b/packages/bridge-ui/src/components/form/Memo.svelte index a19e17fcd4d..b9bd547d0c9 100644 --- a/packages/bridge-ui/src/components/form/Memo.svelte +++ b/packages/bridge-ui/src/components/form/Memo.svelte @@ -6,6 +6,18 @@ export let memo: string = ""; let showMemo: boolean = false; let tooltipOpen: boolean = false; + export let memoError: string; + + function checkSizeLimit(input) { + const bytes = (new TextEncoder().encode(input)).length; + if(bytes > 128) { + memoError = 'Max limit reached' + } else { + memoError = null; + } + } + + $: checkSizeLimit(memo); @@ -23,6 +35,7 @@ {#if showMemo} + + + {memoError ?? ''} + + {/if}