public async Task <decimal> GetBalance(string TokenName) { var myAddress = GetAddress(); var result = await _assetClient.GetAssetAsync(TokenName, myAddress); return(result.Value); }
/// <summary> /// show Asset of designated publickeyAddress /// </summary> /// <param name="client"></param> /// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns> public static async Task <decimal> ShowAsset() { var client = SetClient(); var assetClient = new AssetClient(client); //var myaddress = new PublicKeyAddress(Utils.GetUser0KeyPair());だめ var myaddress = new PublicKeyAddress(PublicKey.Parse("0338f9e2e7ad512fe039adaa509f7b555fb88719144945bd94f58887d8d54fed78")); var result = await assetClient.GetAssetAsync(TableName, myaddress); return(result.Value); }
/// <summary> /// show Asset of designated publickeyAddress /// </summary> /// <param name="client"></param> /// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns> public async Task <decimal> ShowAsset() { var client = this.SetClient(); var assetClient = new AssetClient(client); AssetTypesRegisterer.RegisterTypes(); var myaddress = new PublicKeyAddress(Utils.GetUser0KeyPair()); var result = await assetClient.GetAssetAsync(TableName, myaddress); return(result.Value); }
/// <summary> /// show Asset of designated publickeyAddress /// </summary> /// <param name="client"></param> private static async Task ShowAsset(IClient client) { // AssetClient has access to asset endpoints var assetClient = new AssetClient(client); var addresses = new Address[] { new PublicKeyAddress(Utils.GetUser0KeyPair()), new PublicKeyAddress(Utils.GetUser1KeyPair()), }; foreach (var address in addresses) { var result = await assetClient.GetAssetAsync(TableName, address); Console.WriteLine($"address={address}, amount={result.Value}"); } }
/// <summary> /// show Asset of designated publickeyAddress /// </summary> /// <param name="client"></param> /// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns> public async Task <decimal> ShowAsset(string publickey) { PublicKeyAddress myaddress = null; var client = this.SetClient(); var assetClient = new AssetClient(client); AssetTypesRegisterer.RegisterTypes(); try { var value = PublicKey.Parse(publickey); myaddress = new PublicKeyAddress(value); } catch (Exception) { return(0m); } var result = await assetClient.GetAssetAsync(TableName, myaddress); return(result.Value); }