The signTx is the method that will call the Wallet for the user to accept or reject the transaction.
import { PhantasmaLink, ScriptBuilder, Address, Base16 } from 'phantasma-ts';
let gasPrice = 100000;
let gasLimit = 210000;
// Link variable is from the Connect to the Wallet example.
if (!Link.account) {
// Account not logged in.
return;
}
const from = Address.FromText(String(Link.account.address));
const payload = Base16.encode('Example.' + contractName);
const sb = new ScriptBuilder();
const myScript = sb.AllowGas(from, Address.Null, gasPrice, gasLimit)
.CallContract(contractName, contractMethod, args)
.SpendGas(from)
.EndScript();
Link.signTx(myScript, payload, async function (txHash) {
console.log(txHash);
function () {
// Error On Sending the transaction.
});