Exemplo n.º 1
0
 public static bool ClaimGas(Net net, byte[] privateKey)
 {
     using (var keyPair = new KeyPair(privateKey))
     {
         var address     = keyPair.address;
         var unclaimed   = GetUnclaimed(net, address);
         var tx          = BuildClamTx(unclaimed, net, address);
         var signedHexTx = SignAndSerialize(tx, keyPair);
         var rpc         = new NeoRpc.Rpc(net);
         var status      = rpc.SendRawTransaction(signedHexTx);
         return(status);
     }
 }
Exemplo n.º 2
0
 public static bool SendAsset(Net net, string toAddress, byte[] privateKey,
   string assetId, string amount)
 {
   if (assetId.ToLower() != neoId.ToLower() && assetId.ToLower() != gasId.ToLower())
   {
     throw new Exception(String.Format("This assetId ({0}) isn't supported!", assetId));
   }
   using (var keyPair = new KeyPair(privateKey))
   {
     var address = keyPair.address;
     var unspent = GetUnspent(net, address)[assetId.GetNameFromAssetId().ToUpper()];
     var tx = BuildContractTx(unspent, net, address, toAddress, amount, assetId);
     var signedHexTx = SignAndSerialize(tx, keyPair);
     var rpc = new NeoRpc.Rpc(net);
     var status = rpc.SendRawTransaction(signedHexTx);
     return status;
   }
 }