About the Scripts category

DappHero now has the ability to let users run scripts in their webpage and access the underlying DappHero engine. This category we will share (and hope others share!) their scripts for doing specific tasks.

To get started with scripts, you can add the following to your HTML:

  <script>
    document.addEventListener(
      "dappHeroConfigLoaded",
      ({ detail: dappHero }) => {
        // Inside here you can listen to any event you want
        console.log("DappHero Has Loaded!");

        // For projects with auto-invoked method, you will want to filter on your event name. 
        // Auto-invoked methods are polled every 500ms, so without a filter, this will be noisy.

        dappHero.listenToTransactionStatusChange(data => {
          console.log("Listening to transtaction status change", data);
         });

        // This is how you can listen to any blockchain level contract events your smart contract emits
        dappHero.listenToSmartContractBlockchainEvent((data) => {
           console.log("The blockChain Events: ", data);
         });

      }
    );
  </script>