From 736ca726c4fe04b79fbf62cc0387162d0f92ace3 Mon Sep 17 00:00:00 2001 From: finned-palmer Date: Sat, 10 Jul 2021 09:44:18 -0500 Subject: [PATCH] Add sig to valid patp in send component --- pkg/btc-wallet/src/js/components/lib/send.js | 31 +++++++++++++------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/pkg/btc-wallet/src/js/components/lib/send.js b/pkg/btc-wallet/src/js/components/lib/send.js index f3b050643..d5b675631 100644 --- a/pkg/btc-wallet/src/js/components/lib/send.js +++ b/pkg/btc-wallet/src/js/components/lib/send.js @@ -68,18 +68,22 @@ const Send = ({ stopSending, value, conversion }) => { const checkPayee = (e) => { setError(''); - let payeeReceived = e.target.value; - let isPatp = ob.isValidPatp(payeeReceived); - let isAddress = validate(payeeReceived); - if (isPatp) { - let command = { 'check-payee': payeeReceived }; + const validPatPCommand = (validPatP) => { + let command = { 'check-payee': validPatP }; api.btcWalletCommand(command); setTimeout(() => { setCheckingPatp(false); }, 5000); setCheckingPatp(true); setPayeeType('ship'); - setPayee(payeeReceived); + setPayee(validPatP); + }; + + let payeeReceived = e.target.value; + let isPatp = ob.isValidPatp(payeeReceived); + let isAddress = validate(payeeReceived); + if (isPatp) { + validPatPCommand(payeeReceived); } else if (isAddress) { setPayee(payeeReceived); setReady(true); @@ -87,11 +91,16 @@ const Send = ({ stopSending, value, conversion }) => { setPayeeType('address'); setValidPayee(true); } else { - setPayee(payeeReceived); - setReady(false); - setCheckingPatp(false); - setPayeeType(''); - setValidPayee(false); + const possibleValidPatPMissingSig = '~'.concat(payeeReceived); + if (ob.isValidPatp(possibleValidPatPMissingSig)) { + validPatPCommand(possibleValidPatPMissingSig); + } else { + setPayee(payeeReceived); + setReady(false); + setCheckingPatp(false); + setPayeeType(''); + setValidPayee(false); + } } };