-
Create a few end user accounts:
const Orbs = require("orbs-client-sdk");
const sender = Orbs.createAccount();
const receiver = Orbs.createAccount();
-
Create a client instance:
const virtualChainId = 42;
const client = new Orbs.Client("http://node-endpoint.com", virtualChainId, "TEST_NET", new Orbs.LocalSigner(sender));
-
Send a transaction:
const [tx, txId] = await client.createTransaction( "BenchmarkToken", "transfer", [Orbs.argUint64(10), Orbs.argAddress(receiver.address)]);
const response = await client.sendTransaction(tx);
-
Check the transaction status:
const response = await client.getTransactionStatus(txId);
-
Deploy a smart contract:
const sources = [
readFileSync(`${__dirname}/../contract/increment_base.go`),
readFileSync(`${__dirname}/../contract/increment_functions.go`)
];
const [deploymentTx, deploymentTxId] = await client.createDeployTransaction("Inc", Orbs.PROCESSOR_TYPE_NATIVE, ...sources);
const deploymentResponse = await client.sendTransaction(deploymentTx);
-
Call a smart contract method:
const query = await client.createQuery("BenchmarkToken", "getBalance", [Orbs.argAddress(receiver.address)]);
const response = await client.sendQuery(query);