How to use the tronweb.toUtf8 function in tronweb

To help you get started, we’ve selected a few tronweb examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github tronscan / tronscan-frontend / src / components / blockchain / Transaction / info / SetAccountIdContract.js View on Github external
export default function SetAccountIdContract({contract}){
  // const name = useFetch(contract.hash)
  return(
    
      
      <div>
      {toUtf8(contract.account_id)}
              
            
              
            <table>
          <tbody>
          
          </tbody>
      </table>
          {JSON.stringify(contract.cost) != "{}" &amp;&amp; (
            
          )}
          {contract.signature_addresses &amp;&amp; contract.signature_addresses.length &gt; 1 &amp;&amp; (
            
          )}
          
      </div>
    
  )
}
github TronLink / tronlink-extension / packages / popup / src / controllers / ConfirmationController / index.js View on Github external
}

        if (input.amount && contractType === 'TransferContract') {
            meta.push({ key: 'CONFIRMATIONS.COST', value: formatNumber(input.amount / 1000000) });
        } else if (input.amount) {
            meta.push({ key: 'CONFIRMATIONS.COST', value: formatNumber(input.amount) });
        }

        if (input.frozen_balance) {
            meta.push({ key: 'CONFIRMATIONS.COST', value: formatNumber(input.frozen_balance / 1000000) });
        }

        if (input.asset_name) {
            meta.push({
                key: 'CONFIRMATIONS.TOKEN',
                value: this.tokensMap[TronWeb.toUtf8(input.asset_name)].split('_')[0] + ' (' + TronWeb.toUtf8(input.asset_name) + ')'
            });
        }

        if (input.token_id) {
            meta.push({ key: 'CONFIRMATIONS.TOKEN', value: input.token_id });
        }

        if (input.to_address) {
            const address = TronWeb.address.fromHex(input.to_address);
            const trimmed = [
                address.substr(0, 16),
                address.substr(28)
            ].join('...');

            meta.push({ key: 'CONFIRMATIONS.RECIPIENT', value: trimmed });
        }
github tronscan / tronscan-frontend / src / hw / ledger / TransactionConfirmation / index.jsx View on Github external
)}
            
          
        
      );


    case "WITNESSCREATECONTRACT":
      return (
        
          <div>
            <h5>Apply for Super Representative</h5>
          </div>
          {TronWeb.toUtf8(contractParams.url)}
                      
                        #{extra.hash}
                      
                  <table>
            <tbody>
              </tbody>
          </table>
              {(extra &amp;&amp; extra.hash &amp;&amp; 
                  
              )}
            
        
      );


    case "WITNESSUPDATECONTRACT":
      return (
github tronscan / tronscan-frontend / src / components / tools / TransactionViewer / Contract.js View on Github external
<small>{tu("issue_a_new_asset")}</small>
                            
                        
                        {toUtf8(contract.name)}{contract.trx_num / ONE_TRX} : {contract.num}
                                {contract.end_time - contract.start_time &gt; 1000 ?   : "-"}
                            
                                {contract.end_time - contract.start_time &gt; 1000 ?   : "-"}
                            {toUtf8(contract.description)}<table>
                            <tbody>
                            
                            
                            
                            
                            
                            
                            
                            
                            </tbody>
                        </table>
                    
                );
            case "PROPOSALCREATECONTRACT":
                return (
                    
                        <div>
                            <h5>
                                <i></i>
                                {tu("proposal_create_contract")}
                                <small>{tu("proposal_create")}</small>
                            </h5>
                        </div>
                        <table></table>
github tronscan / tronscan-frontend / src / components / tools / TransactionViewer / Contract.js View on Github external
);

            case "ACCOUNTUPDATECONTRACT":
                return (
                    
                        <div>
                            <h5>
                                <i></i>
                                {tu("account_update_contract")}
                                <small>{tu("update_account_name")}</small>
                            </h5>
                        </div>
                        {toUtf8(contract['account_name'])}<table>
                            <tbody>
                            
                            
                            </tbody>
                        </table>
                    
                );
            case "ACCOUNTCREATECONTRACT":
                return (
                    
                        <div>
                            <h5>
                                <i></i>
                                {tu("account_create_contract")}
                                <small>{tu("account_create")}</small>
                            </h5>
                        </div>
                        <table>
                            <tbody></tbody></table>
github tronscan / tronscan-frontend / src / utils / tronWeb.js View on Github external
async getTokenExtraInfo(ID) {
      let tokenID = ID;
      if (typeof tokenID !== "number") {
        tokenID = TronWeb.toUtf8(tokenID);
        if (tokenID === "_")
          return { id: 0, decimals: 6, token_name: "TRX" };
        else
          tokenID = parseInt(tokenID);
      }

      const token = await Client.getTokens({ id: tokenID });
      if (token.total == 1) {
        return { id: tokenID, decimals: token.tokens[0].precision, token_name: token.tokens[0].name };
      }
      return { id: -1, decimals: 0, token_name: "" };;
    }
github tronscan / tronscan-frontend / src / components / tools / TransactionViewer / Contract.js View on Github external
{toUtf8(contract.name)}{contract.trx_num / ONE_TRX} : {contract.num}
                                {contract.end_time - contract.start_time &gt; 1000 ?   : "-"}
                            
                                {contract.end_time - contract.start_time &gt; 1000 ?   : "-"}
                            {toUtf8(contract.description)}<table>
                            <tbody>
                            
                            
                            
                            
                            
                            
                            
                            
                            </tbody>
                        </table>
                    
                );
            case "PROPOSALCREATECONTRACT":
                return (
                    
                        <div>
                            <h5>
                                <i></i>
                                {tu("proposal_create_contract")}
                                <small>{tu("proposal_create")}</small>
                            </h5>
                        </div>
                        <table>
                            <tbody></tbody></table>
github tronscan / tronscan-frontend / src / hw / ledger / TransactionConfirmation / index.jsx View on Github external
);

      case "EXCHANGECREATECONTRACT":
        return (
          
            <div>
              <h5>Exchange Create</h5>
            </div>
            
                {extra.token1}[{TronWeb.toUtf8(contractParams.first_token_id)}]&lt;
                =&gt;{extra.token2}[{TronWeb.toUtf8(contractParams.second_token_id)}]
              
                  :
                  
              
                      
                        #{extra.hash}
                      
                  <table>
              <tbody>
              
              
              </tbody></table>

              {(extra &amp;&amp; extra.hash &amp;&amp; 
                   
                )}

tronweb

JavaScript SDK that encapsulates the TRON HTTP API

MIT
Latest version published 2 months ago

Package Health Score

84 / 100
Full package analysis