@al2blockchain/helysia

    0.1.6 • Public • Published

    Helysia Token Library

    npm (scoped) npm bundle size (minified)

    A ready-to-use set of utilities to interact with the Helysia Token.

    Use

    See the build/index.html file.

    <html>
      <head>
        <!-- Other head tags -->
        <script src="https://unpkg.com/web3@latest/dist/web3.min.js"></script> 
        <script src="https://unpkg.com/@al2blockchain/helysia@latest"></script> 
      </head>
      <body>   
        <h3>Helysia Token - Venta</h3>
        Cantidad Tokens
        <input type="number" id="tokensVenta" value=100 size="5">
        Precio <span id="precioVenta"></span>
        Cuenta
        <input type="text" id="cuenta" size="44">
        <button id="sale-button">Comprar</button>
     
        <script type="text/javascript">
          // init the library
          Helysia.init({
            chainId: 4,  // custom chainId
          })
          .then(() => {
            // get the account
            Helysia.getAccount()
            .then(account => {
              var cuenta = document.getElementById('cuenta');
              cuenta.value = account;
            })
            .catch(e => console.error(e.message))
     
            // get the price for sale
            Helysia.getPrice('BUY')
            .then(price => {
              var precioVenta = document.getElementById('precioVenta');
              precioVenta.innerHTML = price;
            })
            .catch(e => console.error(e.message))
     
            // sale button
            Helysia.button(
              {
                buttonId: 'sale-button',
                tokensId: 'tokensVenta',
                type: 'BUY',
              }, (e)=>{
                console.error('error callback', e.message);
              },(tx)=>{
                console.log('success callback', tx);
              }
            );
          })
          .catch(e => {
            console.error(e.message);
          });
        </script> 
      </body>
    </html>

    Develop

    npm install
    npm start
    

    Install

    npm i @al2blockchain/helysia

    DownloadsWeekly Downloads

    9

    Version

    0.1.6

    License

    ISC

    Unpacked Size

    888 kB

    Total Files

    5

    Last publish

    Collaborators

    • vicnala