Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
} else {
if (this.fee > 0) {
try {
newTx = await this.addFee(this.neon.wallet.accounts[0].address, newTx, this.fee);
} catch (error) {
console.log(error);
}
}
}
} else {
newTx.outputs = this.assetIntentOverrides.outlets;
newTx.inputs = this.assetIntentOverrides.inputs;
}
newTx.addAttribute(tx.TxAttrUsage.Script, u.reverseHex(fromScript));
const uniqTag = `from NEOLine at ${new Date().getTime()}`;
newTx.addAttribute(tx.TxAttrUsage.Remark1, u.reverseHex(u.str2hexstring(uniqTag)));
resolve(newTx);
});
}
): Promise {
const protocol = {
type: "String",
value: "addr"
};
const empty = {
type: "String",
value: ""
};
const tld = domain.split(".").reverse()[0];
const regExp = new RegExp(`.${tld}$`);
const subdomain = domain.replace(regExp, "");
const hashSubdomain = u.sha256(u.str2hexstring(subdomain));
const hashDomain = u.sha256(u.str2hexstring(tld));
const hashName = u.sha256(hashSubdomain.concat(hashDomain));
const parsedName = sc.ContractParam.byteArray(hashName, "name");
const args = [protocol, parsedName, empty];
const sb = new sc.ScriptBuilder();
const script = sb.emitAppCall(contract, operation, args).str;
const res = await rpc.Query.invokeScript(script).execute(url);
return rpc.StringParser(res.result.stack[0]);
}
const protocol = {
type: "String",
value: "addr"
};
const empty = {
type: "String",
value: ""
};
const tld = domain.split(".").reverse()[0];
const regExp = new RegExp(`.${tld}$`);
const subdomain = domain.replace(regExp, "");
const hashSubdomain = u.sha256(u.str2hexstring(subdomain));
const hashDomain = u.sha256(u.str2hexstring(tld));
const hashName = u.sha256(hashSubdomain.concat(hashDomain));
const parsedName = sc.ContractParam.byteArray(hashName, "name");
const args = [protocol, parsedName, empty];
const sb = new sc.ScriptBuilder();
const script = sb.emitAppCall(contract, operation, args).str;
const res = await rpc.Query.invokeScript(script).execute(url);
return rpc.StringParser(res.result.stack[0]);
}
newTx.script = sb.str;
} catch (error) {
reject(error);
}
try {
newTx = await this.addFee(fromAddress, newTx, amount + parseFloat(this.pramsData.networkFee));
} catch (error) {
this.chrome.windowCallback({
error: ERRORS.INSUFFICIENT_FUNDS,
return: requestTarget.Deploy,
ID: this.messageID
});
window.close();
}
const uniqTag = `from NEOLine at ${new Date().getTime()}`;
newTx.addAttribute(tx.TxAttrUsage.Remark1, u.reverseHex(u.str2hexstring(uniqTag)));
newTx.gas = new Fixed8(amount);
resolve(newTx);
});
}
function processAscii(data: string): string {
return u.str2hexstring(decodeURIComponent(data));
}
if (fromScript.length !== 40 || toScript.length !== 40) {
throw new Error('target address error');
}
const newTx = new tx.InvocationTransaction();
newTx.script = sc.createScript({
scriptHash: scriptHash.startsWith('0x') && scriptHash.length === 42 ? scriptHash.substring(2) : scriptHash,
operation: 'transfer',
args: [
u.reverseHex(fromScript),
u.reverseHex(toScript),
amount * Math.pow(10, decimals)
]
}) + 'f1';
newTx.addAttribute(tx.TxAttrUsage.Script, u.reverseHex(fromScript));
const uniqTag = `from NEOLine at ${new Date().getTime()}`;
newTx.addAttribute(tx.TxAttrUsage.Remark1, u.reverseHex(u.str2hexstring(uniqTag)));
return newTx;
}
public claimGAS(claims: Array, value: number): Observable {