How to use the tronweb.address 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 TronLink / tronlink-extension / packages / backgroundScript / index.js View on Github external
return resolve({
                                    success: true,
                                    data: signedTransaction,
                                    uuid
                                });
                            }
                            return this.walletService.queueConfirmation({
                                type: CONFIRMATION_TYPE.STRING,
                                hostname,
                                signedTransaction,
                                input
                            }, uuid, resolve);
                        }

                        const contractType = transaction.raw_data.contract[ 0 ].type;
                        const contractAddress = TronWeb.address.fromHex(input.contract_address);
                        const {
                            mapped,
                            error
                        } = await transactionBuilder(Number(chainType) === 1 ? NodeService.sunWeb.sidechain : NodeService.sunWeb.mainchain, contractType, input); // NodeService.getCurrentNode()
                        if(error) {
                            return resolve({
                                success: false,
                                data: 'Invalid transaction provided',
                                uuid
                            });
                        }
                        const signedTransaction = await account.sign(
                            mapped.transaction || mapped,
                            Number(chainType) === 1 ? NodeService.sunWeb.sidechain : NodeService.sunWeb.mainchain
                        );
                        const whitelist = this.walletService.contractWhitelist[ input.contract_address ];
github TronLink / tronlink-extension / packages / popup / src / controllers / ConfirmationController / index.js View on Github external
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 });
        }

        if (input.resource) {
            meta.push({
                key: 'CONFIRMATIONS.RESOURCE',
                value: formatMessage({ id: `CONFIRMATIONS.RESOURCE.${ input.resource }` })
            });
        }

        if (input.function_selector) {
github TronLink / tronlink-extension / packages / lib / utils.js View on Github external
getAccountAtIndex(mnemonic, index = 0) {
        const seed = bip39.mnemonicToSeed(mnemonic);
        const node = bip32.fromSeed(seed);
        const child = node.derivePath(`m/44'/195'/${ index }'/0/0`);
        const privateKey = child.privateKey.toString('hex');
        const address = TronWeb.address.fromPrivateKey(privateKey);

        return {
            privateKey,
            address
        };
    },
github TronLink / tronlink-extension / app / popup / src / pages / Transactions / Transaction / index.js View on Github external
case 'FreezeBalanceContract':
                return (
                    
                );

            case 'VoteWitnessContract':
                return (
                    
                );

            case 'ParticipateAssetIssueContract':
                return TronWeb.address.fromHex(this.props.raw.parameter.value.to_address);

            case 'UnfreezeBalanceContract':
                return null;

            case 'CreateSmartContract':
                return null;

            default:
                return 'Unknown address';
        }
	}
github tronscan / tronscan-frontend / src / hw / ledger / TransactionConfirmation / index.jsx View on Github external
)}
              
          
      );

      case "TRIGGERSMARTCONTRACT":
      return (
        
          <div>
            <h5>Send TRC20</h5>
          </div>
          
              {TronWeb.address.fromHex(contractParams.owner_address)}
            
              {extra.to}
            
                  {extra.to_name}
                
              {TronWeb.address.fromHex(contractParams.contract_address)}
            
                  {extra.to_name}
                <table>
            <tbody>
            
            </tbody></table>
            {(extra &amp;&amp; extra.to_name &amp;&amp; 
                
            )}
            
            {(extra &amp;&amp; extra.to_name &amp;&amp;
github tronscan / tronscan-frontend / src / hw / ledger / TransactionConfirmation / index.jsx View on Github external
switch (contract.type.toUpperCase()) {
    case "TRANSFERCONTRACT":
      return (
        
          <div>
            <h5>Send TRX</h5>
          </div>
          
                {TronWeb.address.fromHex(contractParams.owner_address)}
              
                {TronWeb.address.fromHex(contractParams.to_address)}
              */}
                {/* <span>Loading...</span>}*/}
                {/*/&gt;*/}
              {/*
                 TRX
              
                    
                      #{extra.hash}
                    
                <table>
            <tbody>
              
              </tbody></table>
              {/**/}
              
              {(extra &amp;&amp; extra.hash &amp;&amp;
github tronscan / tronscan-frontend / src / hw / ledger / TransactionConfirmation / index.js View on Github external
const contractParams = contract.parameter.value;

  switch (contract.type.toUpperCase()) {
    case "TRANSFERCONTRACT":
      return (
        
          <div>
            <h5>Send TRX</h5>
          </div>
          
                {TronWeb.address.fromHex(contractParams.owner_address)}
              
                {TronWeb.address.fromHex(contractParams.to_address)}
              
                 <span>Loading...</span>} /&gt;
              
                 TRX
              <table>
            <tbody>
              
              
              
              
            </tbody>
          </table>
        
      );

    case "TRANSFERASSETCONTRACT":
      return (
github TronLink / tronlink-extension / packages / popup / src / controllers / RestoreAccountController / stages / PrivateKeyImport / index.js View on Github external
onChange({ target: { value } }) {
        const { accounts } = this.props;
        const address = TronWeb.address.fromPrivateKey(value);
        let isValid = false;
        let error = '';
        if(address) {
            isValid = true;
            error = '';
        }else{
            isValid = false;
            error = 'EXCEPTION.FORMAT_ERROR';
        }
        if(address in accounts) {
            isValid = false;
            error = 'EXCEPTION.ACCOUNT_EXIST';
        }
        if(value === '')error = '';
        this.setState({
            privateKey: value.trim(),

tronweb

JavaScript SDK that encapsulates the TRON HTTP API

MIT
Latest version published 3 months ago

Package Health Score

80 / 100
Full package analysis