LedgerJS – How to P2SH sign multiple transactions from multiple wallets in 1 function call?

First some explanation

I have made 2 raw transactions via Electrum using my Nano S Ledger as seed and exported them to .txn files.

let rawTx1 = "02000000000101bf00f7aca2e0d393ad0a762224ad4cd5a10d9950804fbc5a22fe970918301179000000001716001400ce8131595e014b45ec6ca49495d547ab8bd872fdffffff02a08601000000000017a91457fd0d41e459a4227b8932327786cf512d99399987bc72ca..."; let rawTx2 = "02000000000101bf00f7aca2e0d393ad0a762224ad4cd5a10d9950804fbc5a22fe970918301179000000001716001400ce8131595e014b45ec6ca49495d547ab8bd872fdffffff02a08601000000000017a914a66dff1bf27dd1a5944b5bc9ff2b0f410efb64cd87bc72ca..."; 

Then I turned them into UTXO objects using the splitTransaction() function:

const UTXO1 = await btc.splitTransaction(rawTx1, true); const UTXO2 = await btc.splitTransaction(rawTx2, true); 

Next, I get the Wallet public keys I used for these transactions:

const wallet_1 = await btc.getWalletPublicKey("m/49'/1'/1'", false, true); const wallet_2 = await btc.getWalletPublicKey("m/49'/1'/2'", false, true); 

So transaction 1 was made with wallet 1 and transaction 2 with wallet 2. According to LedgerJS, I have to respect that order when calling the signP2SH() function:

btc.signP2SHTransaction([[UTXO1, 1, wallet_1.publicKey], [UTXO2, 1, wallet_2.publicKey]],     ["m/49'/1'/1'", "m/49'/1'/2'"],     btc.serializeTransactionOutputs(???).toString('hex') ); 

Here,

[UTXO1, 1, wallet_1.publicKey] 

are the Transaction object, output index, and redeem script in that order. And

["m/49'/1'/1'", "m/49'/1'/2'"] 

are the derivation paths of both of my wallets.

My question is about the third line:

btc.serializeTransactionOutputs(???).toString('hex') 

I know for a single transaction from a single wallet, I just toss in the UTXO1 in there:

btc.serializeTransactionOutputs(UTXO1).toString('hex') 

But now that I have multiple UTXO’s, I don’t know what to fill in there anymore. Any ideas?

How call different Classes on button in Ui-Component. Magento2

I create the ui_component which code is

<?xml version="1.0" encoding="UTF-8"?> <form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">     <argument name="data" xsi:type="array">         <item name="js_config" xsi:type="array">             <item name="provider" xsi:type="string">makeanoffer_edit.makeanoffer_data_source</item>             <item name="deps" xsi:type="string">makeanoffer_edit.makeanoffer_data_source</item>         </item>         <item name="label" xsi:type="string" translate="true">Make An Offer</item>          <item name="config" xsi:type="array">             <item name="dataScope" xsi:type="string">data</item>             <item name="namespace" xsi:type="string">makeanoffer_edit</item>         </item>         <item name="template" xsi:type="string">templates/form/collapsible</item>          <item name="buttons" xsi:type="array">             <item name="back" xsi:type="string">PME\MakeAnOffer\Block\Adminhtml\MakeAnOffer\Edit\BackButton</item>             <!-- <item name="delete" xsi:type="string">PME\MakeAnOffer\Block\Adminhtml\MakeAnOffer\Edit\DeleteButton</item> -->             <item name="reset" xsi:type="string">PME\MakeAnOffer\Block\Adminhtml\MakeAnOffer\Edit\ResetButton</item>             <item name="save_and_continue" xsi:type="string">PME\MakeAnOffer\Block\Adminhtml\MakeAnOffer\Edit\RejectButton</item>             <item name="save" xsi:type="string">PME\MakeAnOffer\Block\Adminhtml\MakeAnOffer\Edit\AcceptButton</item>             <!-- <item name="accept" xsi:type="string">PME\MakeAnOffer\Block\Adminhtml\MakeAnOffer\Edit\AcceptButton</item> -->          </item>             </argument>     <dataSource name="makeanoffer_data_source">         <argument name="dataProvider" xsi:type="configurableObject">             <argument name="class" xsi:type="string">PME\MakeAnOffer\Model\MakeAnOffer\DataProvider</argument>             <argument name="name" xsi:type="string">makeanoffer_data_source</argument>             <argument name="primaryFieldName" xsi:type="string">makeanoffer_id</argument>             <argument name="requestFieldName" xsi:type="string">id</argument>              <argument name="data" xsi:type="array">                 <item name="config" xsi:type="array">                     <item name="submit_url" xsi:type="url" path="makeanoffer/index/acceptoffer"/>                 </item>             </argument>             <!--  <argument name="data" xsi:type="array">                 <item name="config" xsi:type="array">                     <item name="submit_url" xsi:type="url" path="makeanoffer/index/acceptoffer"/>                 </item>             </argument> -->          </argument>         <argument name="data" xsi:type="array">             <item name="js_config" xsi:type="array">                 <item name="component" xsi:type="string">Magento_Ui/js/form/provider</item>             </item>         </argument>     </dataSource>     <fieldset name="general">         <argument name="data" xsi:type="array">             <item name="config" xsi:type="array">                 <item name="label" xsi:type="string"/>             </item>         </argument>         <field name="makeanoffer_id">             <argument name="data" xsi:type="array">                 <item name="config" xsi:type="array">                     <item name="visible" xsi:type="boolean">false</item>                     <item name="dataType" xsi:type="string">text</item>                     <item name="formElement" xsi:type="string">input</item>                     <item name="source" xsi:type="string">makeanoffer</item>                 </item>             </argument>         </field>         <field name="product_name">             <argument name="data" xsi:type="array">                 <item name="config" xsi:type="array">                     <item name="label" xsi:type="string">Product Name:</item>                     <item name="visible" xsi:type="boolean">true</item>                     <item name="dataType" xsi:type="string">text</item>                     <item name="disabled" xsi:type="boolean">true</item>                     <item name="formElement" xsi:type="string">input</item>                     <item name="source" xsi:type="string">makeanoffer</item>                 </item>             </argument>         </field>         <field name="name">             <argument name="data" xsi:type="array">                 <item name="config" xsi:type="array">                     <item name="label" xsi:type="string">Customer Name:</item>                       <item name="visible" xsi:type="boolean">true</item>                     <item name="dataType" xsi:type="string">text</item>                     <item name="formElement" xsi:type="string">input</item>                     <item name="disabled" xsi:type="boolean">true</item>                     <item name="source" xsi:type="string">makeanoffer</item>                     <item name="validation" xsi:type="array">                         <item name="required-entry" xsi:type="boolean">false</item>                     </item>                 </item>             </argument>         </field>         <field name="email">             <argument name="data" xsi:type="array">                 <item name="config" xsi:type="array">                     <item name="label" xsi:type="string">Customer Email:</item>                     <item name="visible" xsi:type="boolean">true</item>                     <item name="dataType" xsi:type="string">text</item>                     <item name="disabled" xsi:type="boolean">true</item>                     <item name="formElement" xsi:type="string">input</item>                     <item name="source" xsi:type="string">makeanoffer</item>                 </item>             </argument>         </field>         <field name="pnumber">             <argument name="data" xsi:type="array">                 <item name="config" xsi:type="array">                     <item name="label" xsi:type="string">Customer PhoneNo:</item>                     <item name="visible" xsi:type="boolean">true</item>                     <item name="dataType" xsi:type="string">text</item>                     <item name="disabled" xsi:type="boolean">true</item>                     <item name="formElement" xsi:type="string">input</item>                     <item name="source" xsi:type="string">makeanoffer</item>                 </item>             </argument>         </field>         <field name="offer_time">             <argument name="data" xsi:type="array">                 <item name="config" xsi:type="array">                     <item name="label" xsi:type="string">Offerd at time:</item>                     <item name="visible" xsi:type="boolean">true</item>                     <item name="dataType" xsi:type="string">text</item>                     <item name="disabled" xsi:type="boolean">true</item>                     <item name="formElement" xsi:type="string">input</item>                     <item name="source" xsi:type="string">makeanoffer</item>                 </item>             </argument>         </field>          <field name="message">             <argument name="data" xsi:type="array">                 <item name="config" xsi:type="array">                     <item name="label" xsi:type="string">Customer Message:</item>                     <item name="visible" xsi:type="boolean">true</item>                     <item name="dataType" xsi:type="string">text</item>                     <item name="disabled" xsi:type="boolean">true</item>                     <item name="formElement" xsi:type="string">input</item>                     <item name="source" xsi:type="string">makeanoffer</item>                 </item>             </argument>         </field>         <field name="product_price">             <argument name="data" xsi:type="array">                 <item name="config" xsi:type="array">                     <item name="label" xsi:type="string">Product Price:</item>                     <item name="visible" xsi:type="boolean">true</item>                     <item name="dataType" xsi:type="string">text</item>                     <item name="disabled" xsi:type="boolean">true</item>                     <item name="formElement" xsi:type="string">input</item>                     <item name="source" xsi:type="string">makeanoffer</item>                 </item>             </argument>         </field>         <field name="offeramount">             <argument name="data" xsi:type="array">                 <item name="config" xsi:type="array">                     <item name="label" xsi:type="string">Offerd Price:</item>                     <item name="visible" xsi:type="boolean">true</item>                     <item name="dataType" xsi:type="string">text</item>                     <item name="disabled" xsi:type="boolean">true</item>                     <item name="formElement" xsi:type="string">input</item>                     <item name="source" xsi:type="string">makeanoffer</item>                 </item>             </argument>         </field>              </fieldset>  </form> 

now my question is I created two buttons first is Accept Offer and other is Reject Offer I want to call different classes on the each class but they both call the same class because of the submit_url now how can I set these two buttons to call the different classes and my Second Question is if I change the name of the Accept Button from save to somthing else then it do not call my class the same issue is withe Reject Button as well if I change the name from “save_and_continue” to something else it do not works.

enter image description here

Ajax call always returns in error from controller Magento 2

From my controller, I return a JSON data to my Ajax call but it always goes in the error section, even when it’s not an error.

 jQuery.ajax({         type: 'POST',         url: '/yxcustomer/index/emailpreferences',         data: {"category1": category1,"category2":category2 , "category3":category3,"category4":category4,"category5":category5,"category6":category6,"category7":category7,                "latest1":latest1,"latest2":latest2,"latest3":latest3,"latest4":latest4,                "frequency":frequency,                "email":email,"firstName":firstName , "lastName":lastName},         dataType: "json",         success: function (data) {             console.log("data response success prefe " + JSON.stringify(data));          },         error: function (error) {             console.log("data response error prefe " + JSON.stringify(error));         }     }); 

Controller code

 protected $  resultJsonFactory;    public function __construct(     \Magento\Framework\Controller\Result\JsonFactory $  resultJsonFactory,     \Magento\Framework\App\Action\Context $  context ) {     $  this->resultJsonFactory = $  resultJsonFactory;     parent::__construct($  context); }    public function execute()   {     try{        return  $  this->resultJsonFactory->create()->setData(['success' => true,'contact'=>json_encode($  contact) ,'message' => $  this->messageManager->addSuccessMessage("Successfully updated email preferences")]);     } catch (Exception $  e) {         return  $  this->resultJsonFactory->create()->setData(['success' => false,'message' => $  this->messageManager->addErrorMessage('Email preferences cannot be updated')]);                 } } 

Still that success code

$  this->resultJsonFactory->create()->setData(['success' => true,'contact'=>json_encode($  contact) ,'message' => $  this->messageManager->addSuccessMessage("Successfully updated email preferences")]) 

Always goes in ajax error part

error: function (error) {} 

What am I doing wrong, is there some Magento 2 issue?

Fatal error: Uncaught Error: Call to a member function loadTemplate() on null in

Estou recebendo o seguinte erro ao tentar renderizar o template com twig:

Fatal error: Uncaught Error: Call to a member function loadTemplate() on null in E:\xampp\htdocs\mvc\App\Controllers\Erro\NotFoundController.php:8 Stack trace: #0 E:\xampp\htdocs\mvc\bootstrap.php(20): App\Controllers\Erro\NotFoundController->index() #1 E:\xampp\htdocs\mvc\index.php(17): require(‘E:\xampp\htdocs…’) #2 {main} thrown in E:\xampp\htdocs\mvc\App\Controllers\Erro\NotFoundController.php on line 8.

Minha class LoadTemplate:

public function init() {     $  twig = new \Twig_Environment($  this->loader(), [         'debug' => true,         'cache' => ROOT . '/Cache',         'auto_reload' => true,     ]);      return $  this->twig; }  private function loader() {      $  this->loader = new \Twig_Loader_Filesystem(ROOT . '/App/Views');     return $  this->loader; } 

onde estou chamando:

class NotFoundController extends BaseController { public function index() {     $  dados = ['titulo' => 'Erro404'];     $  template = $  this->twig->loadTemplate('/Erro/erro404.html');     $  template->display($  dados); } 

}

Can we call submit handler of one form into another form?

Can we call submit handler of one form into another form?

I have two forms say user profile form and choose membership plan I want to unset submit function of choose membership plan and want to show in user profile form and also both forms field must save.

like multi-step form.

    <?php    function myform_form_alter(&$  form, &$  form_state, $  form_id){    if($  form_id === "ms_membership_list_memberships_form")    {    $  form['#validate'][] = "_myform_form_submit_handler";    }      if($  form_id === "user_profile_form")     {        $  form['#validate'][] = "_myform_form2_submit_handler";         }       }  function _myform_form_submit_handler($  form, &$  form_state) {         $  form_state['rebuild'] = TRUE;   $  form_state['redirect'] = '/user/1/edit';       } function _myform_form2_submit_handler($  form, &$  form_state) {     $  form_state['rebuild'] = TRUE;   $  form_state['redirect'] = '/ms/checkout';      }   ?> 

Automatic Call Recorder from Appliqato; Recovering recordings from its saved calls folder

I have been using automatic call recorder to save some important calls. I saved them in the app i.e. in saved section beside inbox in app but when I tried to share it with google drive then it stopped playing on phone. Earlier it used to play. It did not come on google drive either. Can you guide how to retrieve those recordings? I haven’t deleted them for sure. As per Appliqato, saved recordings do not get deleted unlike those in inbox based on internal storage size limit and are saved in saved calls folder. Can somebody guide me in retrieving those files? They are very important.

Call custom emergency number from lockscreen

Ok, basically, what I want, is to provide Android phone to child, locked by passcode (or gesture), and allow the child to call parents (two numbers) from locked device.

My current available target device is SDK 22, Android 5.1, but I will not limit the answers to this target.

What is not correct answer:

  • something along the lines of setting ICE info, this won’t allow to call, just to display ICE phone numbers
  • modifying the SIM card data, as this is not possible generally and not available in my case
  • solutions requiring ROOTing the device, as this is not possible in my case
  • solutions using CALL_PRIVILEGED, as this permission is protected and not achievable without ROOTing the device or having custom ROM
  • Solutions using Samsung or other proprietary emergency dialers, as the devices I target, do not use any such measure, and look like this

What I’ve tried to do is

  • Creating custom notification intent on the lockscreen, which would use ACTION_CALL intent and android.permission.CALL_PHONE permission
    • this is not working solution, as CALL_PHONE requires unlocking the device
  • Creating custom notification intent on the lockscreen, which would send out SMS to pre-defined numbers
    • this works, however it might be pricey, and I consider this the last resort option
    • this also does/might not resolve the emergency cases, child might got into, because the reaction time depends on parents having the phone volume up and calling back right-away