Пример #1
0
        public void IssueAsync()
        {
            MultiChainTests.Mocks.Asset asset = new MultiChainTests.Mocks.Asset();
            asset.Title       = "Asset1";
            asset.Description = "An Asset added by a unit test";


            JsonRpcResponse <string> response = null;

            Task.Run(async() =>
            {
                try {
                    response = await _Client.Asset.IssueAsync(TestSettings.FromAddress, new { name = asset.Title, open = true }, 10, 1, asset);
                    await _Client.Asset.SubscribeAsync(response.Result, true);
                }
                catch (JsonRpcException ex) {
                    if (ex.Error.Code != -705)
                    {
                        throw ex;
                    }
                }
            }).GetAwaiter().GetResult();

            ResponseLogger <string> .Log(response);
        }
Пример #2
0
        public void GetTotalBalancesAsync()
        {
            JsonRpcResponse <List <AssetBalanceResponse> > response = null;

            Task.Run(async() =>
            {
                response = await _Client.Wallet.GetTotalBalancesAsync();
            }).GetAwaiter().GetResult();

            ResponseLogger <List <AssetBalanceResponse> > .Log(response);
        }
Пример #3
0
        public void ListAssetsFilterAsync()
        {
            JsonRpcResponse <List <AssetResponse> > response = null;

            Task.Run(async() =>
            {
                response = await _Client.Asset.ListAssetsAsync("Asset1", true);
            }).GetAwaiter().GetResult();

            ResponseLogger <List <AssetResponse> > .Log(response);
        }
Пример #4
0
        public void GetAssetTransactionAsync()
        {
            ResponseLogger <string> .Log("This depends on the asset being created by Issue Command. Run Issue first.");

            JsonRpcResponse <ListAssetTransactionsResponse> response = null;

            Task.Run(async() =>
            {
                JsonRpcResponse <List <ListAssetTransactionsResponse> > r = await _Client.Asset.ListAssetTransactions("Asset1", true);
                response = await _Client.Asset.GetAssetTransactionAsync("Asset1", r.Result[0].TxId);
            }).GetAwaiter().GetResult();

            ResponseLogger <ListAssetTransactionsResponse> .Log(response);
        }