Invoke a Script
This functionality is currently disabled and will be re‑enabled according to the roadmap
import { PhantasmaAPI, ScriptBuilder } from "phantasma-sdk-ts";
const CHAIN_NAME = "main";
const NETWORK_API_URL = "https://testnet.phantasma.info/rpc";
const NETWORK_PEER_URL = undefined;
const NEXUS_NAME = "testnet"; // For mainnet use this "mainnet"
let RPC = new PhantasmaAPI('https://testnet.phantasma.info/rpc', undefined as any, 'testnet');
async function GetMasterCount(){
let sb = new ScriptBuilder();
let script = sb
.CallContract("stake", "GetMasterCount", [])
.EndScript();
let myScript = sb.str;
let txResult = await RPC.invokeRawScript(CHAIN_NAME, myScript);
// this will return the data in a VMObject in Base16, you need to decode it.
return txResult;
}
Last updated