Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
getIqonURLFor(obj, png = false, size = 0) {
let address = null;
if (obj instanceof Nimiq.Wallet) {
address = obj.address.toUserFriendlyAddress().split(" ").join("");
} else if (obj instanceof Nimiq.Address) {
address = obj.toUserFriendlyAddress().split(" ").join("");
} else if (typeof obj == "string") {
address = obj.split(" ").join("");
}
if (address == null) {
this.theWrapper.callbacks.error("UtilHelper:getIqonURLFor", NimiqWrapper.ERROR_MESSAGES.BAD_PARAM_TYPE);
} else {
if (png) {
if (size > 0) {
return "https://icons.mopsus.com/icon/" + address + "." + size + ".png"
} else {
return "https://icons.mopsus.com/icon/" + address + ".png";
}
} else {
return "https://icons.mopsus.com/icon/" + address + ".svg";sendTransaction(fromWallet, options = { }, callback = (receipt) => { }) {
let txDetails = {
sender : fromWallet,
recipient : Nimiq.Address.fromUserFriendlyAddress("NQ07 0000 0000 0000 0000 0000 0000 0000 0000"),
value : 0,
fee : 0,
validity : this.theWrapper.blockHeight,
extraData : null
};
if (options.amount) txDetails.value = options.amount;
if (options.expiration) txDetails.validity = options.expiration;
if (options.address) {
if (typeof options.address == "string") {
txDetails.recipient = Nimiq.Address.fromUserFriendlyAddress(options.address);
} else {
txDetails.recipient = options.address;
}
}
if (options.fee) {
if (options.fee > 0) {
if (options.fee < 138) {
this.theWrapper.callbacks.error("TransactionHelper:sendTransaction", NimiqWrapper.ERROR_MESSAGES.BAD_FEE);
} else {
txDetails.fee = options.fee;
}
} else {
this.theWrapper.callbacks.error("TransactionHelper:sendTransaction", NimiqWrapper.ERROR_MESSAGES.BAD_FEE);
}
}initMiner(options = { }) {
this.minerOptions = {
pool : true,
addr : Nimiq.Address.fromUserFriendlyAddress("NQ07 0000 0000 0000 0000 0000 0000 0000 0000"),
data : new Uint8Array(0),
host : "us.nimpool.io",
port : 8444
};
if (options.soloMine) this.minerOptions.pool = false;
if (options.poolHost) this.minerOptions.host = options.poolHost;
if (options.poolPort) this.minerOptions.port = options.poolPort;
if (options.extraData) {
if (typeof options.extraData == "string") {
this.minerOptions.data = Nimiq.BufferUtils.fromAscii(options.extraData);
} else if (options.extraData instanceof Uint8Array) {
this.minerOptions.data = options.extraData;
} else {
this.theWrapper.callbacks.error("MinerHelper:initMiner", NimiqWrapper.ERROR_MESSAGES.BAD_DATA);
}