RpcSystemAssetTracker/CronContractInvoker.cs
/// <summary>
/// Allows to send system assets using a private key
/// </summary>
/// <param name="jArray">An array of parameters: 
/// [0] MANDATORY; HEX or WIF private key, string
/// [1] MANDATORY; destination address, string
/// [2] MANDATORY; amount to send, double
/// [3] OPTIONAL;  system token hash (hex bytes string) or its name (string). Default is CRON </param>
/// [4] OPTIONAL;  remarks attribute value. Default is null 
/// [5] OPTIONAL;  system fee (decimal) . Default is zero 
/// <returns>an object with txn_hash field containing transaction hash</returns>
Allows to send system assets using a private key
Allows to send system assets using a private key
private JObject Send(JArray jArray)
        {
            JObject obj = new JObject();
            var privateKey = jArray[0].AsString().Split(';').Select(x => x.ToBytePrivateKey()).ToArray();
            var addressTo = jArray[1].AsString();
            var amount = GetDecimal(jArray[2]);
            UInt256 th = (jArray.Count > 3) ? ParseTokenHash(jArray[3].AsString()) : Blockchain.UtilityToken.Hash;
            byte[] bRemarks = (jArray.Count > 4) ? jArray[4].AsString().HexToBytes() : null;
            decimal systemFee = (jArray.Count > 5) ? (decimal)jArray[5].AsNumber() : 0.0m;
            obj["txn_hash"] = SendWithKey(privateKey, amount, systemFee, addressTo, th, bRemarks);
            return obj;
        }
private JObject Send ( JArray jArray ) { JObject obj = new JObject ( ) ; var privateKey = jArray [ 0 ] . AsString ( ) . Split ( ' ' ) . Select ( x => x . ToBytePrivateKey ( ) ) . ToArray ( ) ; var addressTo = jArray [ 1 ] . AsString ( ) ; var amount = GetDecimal ( jArray [ 2 ] ) ; UInt256 th = ( jArray . Count > 3 ) ? ParseTokenHash ( jArray [ 3 ] . AsString ( ) ) : Blockchain . UtilityToken . Hash ; byte [ ] bRemarks = ( jArray . Count > 4 ) ? jArray [ 4 ] . AsString ( ) . HexToBytes ( ) : null ; decimal systemFee = ( jArray . Count > 5 ) ? ( decimal ) jArray [ 5 ] . AsNumber ( ) : 0.0m ; obj [ " " ] = SendWithKey ( privateKey , amount , systemFee , addressTo , th , bRemarks ) ; return obj ; }
Allows to send system assets using a private key
Allows to send system assets using a private key
an object with txn_hash field containing transaction hash
an object with txn_hash field containing transaction hash
jArray
JArray
An array of parameters:
[0] MANDATORY; HEX or WIF private key, string
[1] MANDATORY; destination address, string
[2] MANDATORY; amount to send, double
[3] OPTIONAL;  system token hash (hex bytes string) or its name (string). Default is CRON
An array of parameters : [ 0 ] MANDATORY ; HEX or WIF private key string [ 1 ] MANDATORY ; destination address string [ 2 ] MANDATORY ; amount to send double [ 3 ] OPTIONAL ; system token hash ( hex bytes string ) or its name ( string ) . Default is CRON