Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
blockTag(blockTag) {
if (blockTag == null) {
return "latest";
}
if (blockTag === "earliest") {
return "0x0";
}
if (blockTag === "latest" || blockTag === "pending") {
return blockTag;
}
if (typeof (blockTag) === "number" || isHexString(blockTag)) {
return hexValue(blockTag);
}
throw new Error("invalid blockTag");
}
// Requires a hash, optionally requires 0x prefix; returns prefixed lowercase hash.
Formatter.prototype.blockTag = function (blockTag) {
if (blockTag == null) {
return "latest";
}
if (blockTag === "earliest") {
return "0x0";
}
if (blockTag === "latest" || blockTag === "pending") {
return blockTag;
}
if (typeof (blockTag) === "number" || bytes_1.isHexString(blockTag)) {
return bytes_1.hexValue(blockTag);
}
throw new Error("invalid blockTag");
};
// Requires a hash, optionally requires 0x prefix; returns prefixed lowercase hash.
["gasLimit", "gasPrice", "nonce", "value"].forEach(function (key) {
if (transaction[key] == null) {
return;
}
var value = bytes_1.hexValue(transaction[key]);
if (key === "gasLimit") {
key = "gas";
}
result[key] = value;
});
["from", "to", "data"].forEach(function (key) {
function getTransactionString(transaction) {
var result = [];
for (var key in transaction) {
if (transaction[key] == null) {
continue;
}
var value = bytes_1.hexlify(transaction[key]);
if ({ gasLimit: true, gasPrice: true, nonce: true, value: true }[key]) {
value = bytes_1.hexValue(value);
}
result.push(key + "=" + value);
}
return result.join("&");
}
function getResult(result) {
function getTransactionString(transaction) {
const result = [];
for (let key in transaction) {
if (transaction[key] == null) {
continue;
}
let value = hexlify(transaction[key]);
if ({ gasLimit: true, gasPrice: true, nonce: true, value: true }[key]) {
value = hexValue(value);
}
result.push(key + "=" + value);
}
return result.join("&");
}
function getResult(result) {
["gasLimit", "gasPrice", "nonce", "value"].forEach(function (key) {
if (transaction[key] == null) {
return;
}
const value = hexValue(transaction[key]);
if (key === "gasLimit") {
key = "gas";
}
result[key] = value;
});
["from", "to", "data"].forEach(function (key) {
position: Promise.resolve(position).then(function (p) { return bytes_1.hexValue(p); })
})];
position: Promise.resolve(position).then((p) => hexValue(p))
});