Last active
February 17, 2025 08:25
-
-
Save donma/1bfa7f4b47a3de32252205612922cea0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /// 詐騙的錢包 | |
| var addressInfo = GetAcccountResponse("TS64QAQEL5GfbB61C86ZSJjfkVi6kPFmEA"); | |
| /// 正常的錢包 | |
| //var addressInfo = GetAcccountResponse("TNGF6UPkjHfRytykSDRgrEuu4UbhixXZ6K"); | |
| if (addressInfo != null) | |
| { | |
| Console.WriteLine("Query Address:"); | |
| Console.WriteLine(addressInfo.address); | |
| Console.WriteLine("Owner Permission Info:"); | |
| Console.WriteLine("Permission_name =>" + addressInfo.owner_permission.permission_name); | |
| foreach (var permissionAddress in addressInfo.owner_permission.keys) | |
| { | |
| Console.WriteLine(permissionAddress.address); | |
| } | |
| } | |
| /* | |
| Query Address: | |
| TS64QAQEL5GfbB61C86ZSJjfkVi6kPFmEA | |
| Owner Permission Info: | |
| Permission_name =>Djjdodnrbrhdo | |
| TFP6sR2ZbsnWFfdv192HxEh2gbw2JnCXW9 | |
| */ | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /// <summary> | |
| /// 取得錢包資訊 | |
| /// </summary> | |
| /// <param name="targetAddress"></param> | |
| /// <returns></returns> | |
| static GetAccountResponse GetAcccountResponse(string targetAddress) | |
| { | |
| var client = new RestClient("https://api.trongrid.io"); | |
| var request = new RestRequest("/wallet/getaccount", Method.Post); | |
| request.AddHeader("accept", "application/json"); | |
| request.AddHeader("content-type", "application/json"); | |
| var body = new | |
| { | |
| address = targetAddress, | |
| visible = true | |
| }; | |
| request.AddJsonBody(body); | |
| var response = client.ExecuteAsync(request).Result; | |
| if (response.IsSuccessful) | |
| { | |
| var result = JsonConvert.DeserializeObject<GetAccountResponse>(response.Content); | |
| return result; | |
| } | |
| else | |
| { | |
| //Console.WriteLine($"Error: {response.StatusCode} - {response.ErrorMessage}"); | |
| return null; | |
| } | |
| } | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class GetAccountResponse | |
| { | |
| public string address { get; set; } | |
| public int balance { get; set; } | |
| public long create_time { get; set; } | |
| public long latest_opration_time { get; set; } | |
| public int free_net_usage { get; set; } | |
| public long latest_consume_time { get; set; } | |
| public long latest_consume_free_time { get; set; } | |
| public int net_window_size { get; set; } | |
| public bool net_window_optimized { get; set; } | |
| public AccountResource account_resource { get; set; } | |
| public OwnerPermission owner_permission { get; set; } | |
| public List<ActivePermission> active_permission { get; set; } | |
| public List<FrozenV2> frozenV2 { get; set; } | |
| public List<AssetV2> assetV2 { get; set; } | |
| public List<FreeAssetNetUsageV2> free_asset_net_usageV2 { get; set; } | |
| public bool asset_optimized { get; set; } | |
| public class AccountResource | |
| { | |
| public long latest_consume_time_for_energy { get; set; } | |
| public int energy_window_size { get; set; } | |
| public bool energy_window_optimized { get; set; } | |
| } | |
| public class Key | |
| { | |
| public string address { get; set; } | |
| public int weight { get; set; } | |
| } | |
| public class OwnerPermission | |
| { | |
| public string permission_name { get; set; } | |
| public int threshold { get; set; } | |
| public List<Key> keys { get; set; } | |
| } | |
| public class ActivePermission | |
| { | |
| public string type { get; set; } | |
| public int id { get; set; } | |
| public string permission_name { get; set; } | |
| public int threshold { get; set; } | |
| public string operations { get; set; } | |
| public List<Key> keys { get; set; } | |
| } | |
| public class AssetV2 | |
| { | |
| public string key { get; set; } | |
| public object value { get; set; } | |
| } | |
| public class FreeAssetNetUsageV2 | |
| { | |
| public string key { get; set; } | |
| public int value { get; set; } | |
| } | |
| public class FrozenV2 | |
| { | |
| public string type { get; set; } | |
| } | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment