2323 />
2424
2525 <div class =" form__container-send-input" >
26- <div class =" form__container-send-input-toggle" >
27- <button
28- :class =" !isSendSpark && 'form__container-send-input-toggle-active'"
29- @click =" toggleIsSendSpark(false)"
30- >
31- To address
32- </button >
33- <button
34- :class =" isSendSpark && 'form__container-send-input-toggle-active'"
35- @click =" toggleIsSendSpark(true)"
36- >
37- To Spark address
38- </button >
39- </div >
40-
41- <send-address-input
42- v-if =" !isSendSpark"
26+ <send-spark-address-input
4327 ref =" addressInputTo"
4428 class =" no-margin"
29+ title =" To address"
4530 :value =" addressTo"
4631 :network =" (network as BitcoinNetwork)"
4732 @update:input-address =" inputAddressTo"
4833 @toggle:show-contacts =" toggleSelectContactTo"
4934 />
50-
5135 <send-contacts-list
52- v-if =" !isSendSpark"
5336 class =" no-margin"
5437 :show-accounts =" isOpenSelectContactTo"
5538 :account-info =" accountInfo"
5942 @update:paste-from-clipboard =" addressInputTo.pasteFromClipboard()"
6043 @close =" toggleSelectContactTo"
6144 />
62-
63- <send-spark-address-input
64- v-if =" isSendSpark"
65- ref =" sparkAddressInputTo"
66- class =" no-margin"
67- :value =" sparkAddressInput"
68- :network =" (network as BitcoinNetwork)"
69- @update:input-address =" inputSparkAddressTo"
70- />
7145 </div >
7246
7347 <send-token-select
144118 <div class =" send-transaction__buttons-send" >
145119 <base-button
146120 :title =" sendButtonTitle"
147- :click =" isSendSpark ? sendSparkAction : sendAction"
121+ :click ="
122+ !isAddress(addressTo, network.networkInfo)
123+ ? sendSparkAction
124+ : sendAction
125+ "
148126 :disabled =" !isInputsValid"
149127 />
150128 </div >
@@ -221,7 +199,6 @@ const loadingAsset = new BTCToken({
221199});
222200
223201const addressInputTo = ref ();
224- const sparkAddressInput = ref ();
225202const isSendSpark = ref (false );
226203const selected: string = route .params .id as string ;
227204const paramNFTData: NFTItem = JSON .parse (
@@ -321,17 +298,12 @@ const sendButtonTitle = computed(() => {
321298});
322299
323300const isInputsValid = computed <boolean >(() => {
324- if (isSendSpark .value ) {
325- if (! isSparkAddress (sparkAddressInput .value )) {
326- return false ;
327- }
328- } else {
329- if (
330- ! isAddress (addressTo .value , (props .network as BitcoinNetwork ).networkInfo )
331- )
332- return false ;
301+ if (
302+ ! isSparkAddress (addressTo .value ) &&
303+ ! isAddress (addressTo .value , (props .network as BitcoinNetwork ).networkInfo )
304+ ) {
305+ return false ;
333306 }
334-
335307 if (
336308 props .isSendToken &&
337309 ! isValidDecimals (sendAmount .value , selectedAsset .value .decimals ! )
@@ -411,10 +383,6 @@ const inputAddressTo = (text: string) => {
411383 addressTo .value = text ;
412384};
413385
414- const inputSparkAddressTo = (address : string ) => {
415- sparkAddressInput .value = address ;
416- };
417-
418386const toggleSelectContactFrom = (open : boolean ) => {
419387 isOpenSelectContactFrom .value = open ;
420388};
@@ -447,10 +415,6 @@ const toggleSelectFee = () => {
447415 isOpenSelectFee .value = ! isOpenSelectFee .value ;
448416};
449417
450- const toggleIsSendSpark = (value : boolean ) => {
451- isSendSpark .value = value ;
452- };
453-
454418const selectFee = (type : GasPriceTypes ) => {
455419 selectedFee .value = type ;
456420 isOpenSelectFee .value = false ;
@@ -469,8 +433,8 @@ const selectNFT = (item: NFTItemWithCollectionName) => {
469433const sendSparkAction = async () => {
470434 const keyring = new PublicKeyRing ();
471435 const fromAccountInfo = await keyring .getAccount (addressFrom .value );
472-
473436 const toAmount = toBN (toBase (sendAmount .value , selectedAsset .value .decimals ));
437+
474438 router .push ({
475439 name: RouterNames .verifySendToSpark .name ,
476440 query: {
@@ -492,7 +456,7 @@ const sendSparkAction = async () => {
492456 fromAddressName: fromAccountInfo .name ,
493457 gasFee: gasCostValues .value [selectedFee .value ],
494458 gasPriceType: selectedFee .value ,
495- toAddress: sparkAddressInput .value ,
459+ toAddress: addressTo .value ,
496460 }),
497461 " utf8"
498462 ).toString (" base64" ),
@@ -514,7 +478,7 @@ const sendAction = async () => {
514478
515479 if (props .isSendToken ) {
516480 txInfo .outputs .push ({
517- address: isSendSpark . value ? sparkAddressInput . value : addressTo .value ,
481+ address: addressTo .value ,
518482 value: toAmount .toNumber (),
519483 });
520484 } else {
0 commit comments