Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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 ];
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) {
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
};
},
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';
}
}
)}
);
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 && extra.to_name &&
)}
{(extra && extra.to_name &&
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>}*/}
{/*/>*/}
{/*
TRX
#{extra.hash}
<table>
<tbody>
</tbody></table>
{/**/}
{(extra && extra.hash &&
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>} />
TRX
<table>
<tbody>
</tbody>
</table>
);
case "TRANSFERASSETCONTRACT":
return (
Address() {
return tronWeb.address.fromHex(string);
}
};
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(),