Sending coins
Let's see the example.
import * as Quras from `quras-js` const rpcServer = new Quras.rpc.RPCClient(Quras.CONST.QURAS_NETWORK.MAIN); Quras.api.qurasDB.getBalance(Quras.CONST.QURAS_NETWORK.MAIN, 'DknmAbcap8RnUpkLQvbXTwTXqFJMjN4QPz') // Get the balance of from address. .then((data) => { const balance = new Quras.wallet.Balance(data) var scriptHash = Quras.wallet.getScriptHashFromAddress('Dqf3UKe1f5FBWduGxHp8RMqP29dL6DgGS1'); // To address. const outputs = [{ assetId: Quras.CONST.ASSET_ID['QRS'], // The type of asset that you want to send. value: 2, // amount to send. fee: 0.2, // fee scriptHash: scriptHash // The scripthash of "To address". }] const testTx = Quras.tx.Transaction.createContractTx(balance, outputs) // create a transaction. testTx.sign('20164b85226c67cb6d8fe114f3b91af3f2dfc52dcf05d708e9eca80c8d739481'); // Sign the transaction using private key rpcServer.sendRawTransaction(testTx.serialize()) // Send the transaction to RPC Server. .then((data) => { console.log(data); }) .catch ((error) => { console.log("error"); }); }) .catch((error) => { console.log(error) });
You can send your coin to other address like this, above.