PraiaBitcoin / PBPaperWallet

MIT License
5 stars 0 forks source link

Get the generated phrases, xpub, and address and send to paperwallet.php #1

Closed motolese closed 2 years ago

motolese commented 2 years ago

The index.html, is essentially the Bip39 of Ian Coleman, hiding the non-essential info by using css.

We need to send 3 fields to paperwallet.php

<textarea id="phrase" name="bip39_1" class="phrase private-data form-control" data-show-qr autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" form="paperwallet"></textarea>

<textarea id="account-xpub-bip84"  class="account-xpub form-control" readonly data-show-qr autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" form="paperwallet"></textarea>

<textarea class="csv form-control" rows="5" readonly autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" ></textarea>

Now the user needs to copy the info manually and the click on create wallet

      <form action="paperwallet.php" method="post" name="myform" form="paperwallet">
      <div style="width: 580px; float:left">mnemonic</div>
      <div style="width: 490px; float:left">zpub</div>
      <div style="width: 320px; float:left">address</div><br>
      <input name="bip39_1" value="" style="width: 570px; float:left" autocomplete="off"/>    
      <input name="zpub_1" value="" style="width: 500px; float:left" autocomplete="off"/>
      <input name="address_1" value="" style="width: 320px; float:left" autocomplete="off"/>
       <a href="javascript: submitform()">Create Wallet</a>
       </form>

         <script type="text/javascript">
          function submitform()
          {
             document.myform.submit();
          }
      </script>

We need a form with javascript integrated to send the fields below to paperwallet.php phrase to bip39_1 account-xpub-bip84 to xpub_1 and only the address of csv form-control to address_1

Any help is welcome!

0001024bytes commented 2 years ago

The index.html, is essentially the Bip39 of Ian Coleman, hiding the non-essential info by using css.

We need to send 3 fields to paperwallet.php

<textarea id="phrase" name="bip39_1" class="phrase private-data form-control" data-show-qr autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" form="paperwallet"></textarea>

<textarea id="account-xpub-bip84"  class="account-xpub form-control" readonly data-show-qr autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" form="paperwallet"></textarea>

<textarea class="csv form-control" rows="5" readonly autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" ></textarea>

Now the user needs to copy the info manually and the click on create wallet

      <form action="paperwallet.php" method="post" name="myform" form="paperwallet">
      <div style="width: 580px; float:left">mnemonic</div>
      <div style="width: 490px; float:left">zpub</div>
      <div style="width: 320px; float:left">address</div><br>
      <input name="bip39_1" value="" style="width: 570px; float:left" autocomplete="off"/>    
      <input name="zpub_1" value="" style="width: 500px; float:left" autocomplete="off"/>
      <input name="address_1" value="" style="width: 320px; float:left" autocomplete="off"/>
       <a href="javascript: submitform()">Create Wallet</a>
       </form>

         <script type="text/javascript">
          function submitform()
          {
             document.myform.submit();
          }
      </script>

We need a form with javascript integrated to send the fields below to paperwallet.php phrase to bip39_1 account-xpub-bip84 to xpub_1 and only the address of csv form-control to address_1

Any help is welcome!

You can get the hidden values ​​using document.getElements see the example below:

<script type="text/javascript">
    function submitform() {
        // This snippet takes the data (mnemonic, xpub, address) 
        // generated by iancoleman.
        const mnemonic = document.getElementById("phrase").value
        const xpub = document.getElementsByClassName("account-xpub")[0].value
        const addr = document.getElementsByClassName("address")[0].textContent

        if (mnemonic & xpub & addr){
            document.getElementsByName("bip39_1")[0].value = mnemonic
            document.getElementsByName("zpub_1")[0].value = xpub
            document.getElementsByName("address_1")[0].value = addr

            document.myform.submit();
        }
    }
</script>
PraiaBitcoin commented 2 years ago

Thank you, guys! Perfect solution....