Esempio n. 1
0
        public string GetOwner(string treatailAssetId)
        {
            var url    = string.Format("{0}/GetOwner/{1}", _assetServiceBaseUrl, treatailAssetId);
            var result = ServicesHelper.CallService(ServiceAction.GET, _apiKey, url, null);

            return(JsonConvert.DeserializeObject <string>(result));
        }
Esempio n. 2
0
        public decimal GetTTLBalance(string privateKeyHex)
        {
            var url    = string.Format("{0}/GetTTLBalance", _walletServiceBaseUrl);
            var result = ServicesHelper.CallService(ServiceAction.POST, _apiKey, url, JsonConvert.SerializeObject(new { privateKeyHex = privateKeyHex }));

            return(JsonConvert.DeserializeObject <decimal>(result));
        }
Esempio n. 3
0
        public bool Create()
        {
            var url    = string.Format("{0}/Create", _walletServiceBaseUrl);
            var result = ServicesHelper.CallService(ServiceAction.GET, _apiKey, url, null);
            var wallet = JsonConvert.DeserializeObject <Wallet>(result);

            if (wallet == null || string.IsNullOrEmpty(wallet.Address) || string.IsNullOrEmpty(wallet.PrivateKey))
            {
                return(false);
            }

            return(true);
        }
Esempio n. 4
0
        public bool Transfer(string treatailAssetId, string fromAddress, string toAddress)
        {
            var transferRequest = new AssetTransferRequest
            {
                PrivateKeyHex   = _privateKeyHex,
                TreatailAssetId = treatailAssetId,
                FromAddress     = fromAddress,
                ToAddress       = toAddress
            };

            var url    = string.Format("{0}/Transfer", _assetServiceBaseUrl);
            var result = ServicesHelper.CallService(ServiceAction.POST, _apiKey, url, JsonConvert.SerializeObject(transferRequest));

            return(JsonConvert.DeserializeObject <bool>(result));
        }
Esempio n. 5
0
        public bool Transfer(string fromAddress, string toAddress, int amount)
        {
            var transferRequest = new TokenTransferRequest
            {
                PrivateKeyHex = _privateKeyHex,
                FromAddress   = fromAddress,
                ToAddress     = toAddress,
                Amount        = amount
            };

            var url    = string.Format("{0}/Transfer", _tokenServiceBaseUrl);
            var result = ServicesHelper.CallService(ServiceAction.POST, _apiKey, url, JsonConvert.SerializeObject(transferRequest));

            return(JsonConvert.DeserializeObject <bool>(result));
        }
Esempio n. 6
0
        public bool Create(string treatailAssetId, string ownerAddress, string assetDetails, bool chargeTTL)
        {
            var createRequest = new AssetCreateRequest
            {
                PrivateKeyHex   = _privateKeyHex,
                TreatailAssetId = treatailAssetId,
                OwnerAddress    = ownerAddress,
                AssetDetails    = assetDetails,
                ChargeTTL       = chargeTTL
            };

            var url    = string.Format("{0}/Create", _assetServiceBaseUrl);
            var result = ServicesHelper.CallService(ServiceAction.POST, _apiKey, url, JsonConvert.SerializeObject(createRequest));

            return(JsonConvert.DeserializeObject <bool>(result));
        }