Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
)
// Load the sender's identity and construct the best human readable
// version of sender name.
const senderIdentity = await Identity.findOne({
where: {
ethAddress: sender
}
})
const senderName =
senderIdentity !== null &&
senderIdentity.firstName &&
senderIdentity.lastName
? `${senderIdentity.firstName || ''} ${senderIdentity.lastName ||
''} (${web3Utils.toChecksumAddress(sender)})`
: web3Utils.toChecksumAddress(sender)
// Dynamic variables used when evaluating the template.
const templateVars = {
config: this.config,
sender,
senderName,
dappUrl: this.config.dappUrl,
ipfsGatewayUrl: this.config.ipfsGatewayUrl,
messageHash
}
// Load the identities of all the receivers.
const identities = await Identity.findAll({
where: { ethAddress: { [Sequelize.Op.or]: receivers } }
})
set: function (val) {
if(val) {
defaultAccount = utils.toChecksumAddress(formatters.inputAddressFormatter(val));
}
// update defaultBlock
methods.forEach(function(method) {
method.defaultAccount = defaultAccount;
});
return val;
},
enumerable: true
tx.blockNumber = utils.hexToNumber(tx.blockNumber);
if (tx.transactionIndex !== null)
tx.transactionIndex = utils.hexToNumber(tx.transactionIndex);
tx.nonce = utils.hexToNumber(tx.nonce);
tx.gas = utils.hexToNumber(tx.gas);
tx.gasPrice = outputBigNumberFormatter(tx.gasPrice);
tx.value = outputBigNumberFormatter(tx.value);
if (tx.to && utils.isAddress(tx.to)) { // tx.to could be `0x0` or `null` while contract creation
tx.to = utils.toChecksumAddress(tx.to);
} else {
tx.to = null; // set to `null` if invalid address
}
if (tx.from) {
tx.from = utils.toChecksumAddress(tx.from);
}
return tx;
};
const assertEvent = (receipt, eventName, expectedArgs = {}, index = 0) => {
const event = getEventAt(receipt, eventName, index)
assert(typeof event === 'object', `could not find an emitted ${eventName} event ${index === 0 ? '' : `at index ${index}`}`)
for (const arg of Object.keys(expectedArgs)) {
let foundArg = event.args[arg]
if (isBN(foundArg)) foundArg = foundArg.toString()
if (isAddress(foundArg)) foundArg = toChecksumAddress(foundArg)
let expectedArg = expectedArgs[arg]
if (isBN(expectedArg)) expectedArg = expectedArg.toString()
if (isAddress(foundArg)) expectedArg = toChecksumAddress(expectedArg)
assert.equal(foundArg, expectedArg, `${eventName} event ${arg} value does not match`)
}
}
getMintHelperAddress(pool_env)
{
var address;
if(pool_env == 'test')
{
address = deployedContractInfo.networks.testnet.contracts.mintforwarder.blockchain_address;
}else if(pool_env == 'staging'){
address = deployedContractInfo.networks.staging.contracts.mintforwarder.blockchain_address;
}else if(pool_env == 'production'){
address = deployedContractInfo.networks.mainnet.contracts.mintforwarder.blockchain_address;
}
return web3utils.toChecksumAddress(address)
console.error('no pool env set', pool_env)
},
)}
{tx.txType === 'received' && tx.from && (
<label>
{this.props.isPending ? 'Pending' : 'Received'} from
</label>
<address>{toChecksumAddress(tx.from)}</address>
)}
{tx.txType === 'sent' && tx.to && (
<label>{this.props.isPending ? 'Pending' : 'Sent'} to</label>
<address>{toChecksumAddress(tx.to)}</address>
)}
{tx.txType === 'exported' && tx.exportedTo && (
<label>{this.props.isPending ? 'Pending' : 'Exported'} to</label>
{tx.exportedTo} blockchain
)}
{tx.txType === 'import-requested' && tx.importedFrom && (
<label>
{this.props.isPending
? 'Pending import request'
: 'Import requested'}{' '}</label>
constructor(address: string) {
if (!isAddress(address)) {
throw new TypeError(`Invalid address ${address}`);
}
super(Web3Utils.toChecksumAddress(address));
}
}
const searchCustom = this.customTokens.find(item => {
return (
utils.toChecksumAddress(item.address) ===
utils.toChecksumAddress(addr)
);
});
secp256k1.ecdsa.accountFromPublicKey = (publicKey) => {
let publicHash;
if (typeof publicKey === 'string') {
publicHash = web3Utils.sha3(`0x${publicKey.slice(4)}`);
} else {
const ecKey = secp256k1.ec.keyFromPublic(publicKey);
const publicKeyHex = `0x${ecKey.getPublic(false, 'hex').slice(2)}`;
publicHash = web3Utils.sha3(publicKeyHex);
}
const address = web3Utils.toChecksumAddress(`0x${publicHash.slice(-40)}`);
return address;
};