11using IotaExplorerNet . Domain . Common . Extensions ;
22using IotaExplorerNet . Domain . Common . Interfaces ;
3+ using IotaExplorerNet . Domain . Common . Responses ;
4+ using IotaWalletNet . Domain . Common . Extensions ;
5+ using IotaWalletNet . Domain . Common . Interfaces ;
6+ using IotaWalletNet . Domain . Common . Models . Output . FeatureTypes ;
7+ using IotaWalletNet . Domain . Common . Models . Output . OutputTypes ;
38using Microsoft . Extensions . DependencyInjection ;
9+ using Newtonsoft . Json ;
410
511namespace IotaExplorerNet . Main
612{
@@ -19,18 +25,39 @@ static async Task Main(string[] args)
1925
2026 ITestnetExplorerApi testnetExplorerApi = testnetExplorerProvider ( BASE_URL ) ;
2127
22- var x = await testnetExplorerApi . GetNftBalanceAsync ( "rms1qptynkddm3gjgmuwtstfzy529j4r55z9r5qeszedxncy3p5uurerwm85n0r" ) ;
23- Console . WriteLine ( x ) ;
24- string s = @"{""outputs"":[{""metadata"":{""blockId"":""0x022000902b1a41014c66343e8106e0373d1ebef0c46c02322ef2f0d193b64b9b"",""transactionId"":""0x3ad68d91450e60e613d4d350ef4c7a47724c3bcab3466ef5811c4f668349371f"",""outputIndex"":0,""isSpent"":false,""milestoneIndexBooked"":7456755,""milestoneTimestampBooked"":1695952313,""ledgerIndex"":7693149},""output"":{""type"":6,""amount"":""92000"",""nftId"":""0x48179e2655a99ce58b24cacb10e1d8f466af302cc8e1b5fb08bd7d6c00d5aa57"",""unlockConditions"":[{""type"":0,""address"":{""type"":0,""pubKeyHash"":""0x5649d9addc51246f8e5c1691128a2caa3a50451d01980b2d34f048869ce0f237""}}],""immutableFeatures"":[{""type"":1,""address"":{""type"":16,""nftId"":""0xc9210f64c3455f6ffbcb7bb7af587dafea79a9f1158db5512068d2fae293ce7f""}},{""type"":2,""data"":""0x7b227374616e64617264223a224952433237222c2276657273696f6e223a2276312e30222c2274797065223a226170706c69636174696f6e2f6a736f6e222c22757269223a2268747470733a2f2f6769746875622e636f6d2f546f6b656e4761746557656233222c226e616d65223a224964656e74697479546f6b656e222c22636f6c6c656374696f6e4e616d65223a6e756c6c2c226973737565724e616d65223a6e756c6c2c226465736372697074696f6e223a6e756c6c2c22726f79616c74696573223a7b7d2c2261747472696275746573223a5b7b22747261697454797065223a2276657273696f6e222c2276616c7565223a22312e30227d2c7b22747261697454797065223a22757365726e616d65222c2276616c7565223a224461736861204e616e676c65227d2c7b22747261697454797065223a2261646472657373222c2276616c7565223a22726d7331717074796e6b64646d33676a676d7577747374667a793532396a347235357a3972357165737a6564786e63793370357575726572776d38356e3072227d5d2c22696e7465726e616c41747472696275746573223a5b5d7d""}]}}]}
25- " ;
26- //var xx= JsonConvert.DeserializeObject<NftBalancesResponse>(x.Content!);
28+ //var x = await testnetExplorerApi.GetNftBalanceAsync("rms1qptynkddm3gjgmuwtstfzy529j4r55z9r5qeszedxncy3p5uurerwm85n0r");
29+ //Console.WriteLine(x);
2730
2831 //AddressBalanceResponse addressBalanceResponse = await testnetExplorerApi.GetAddressBalance("rms1qptynkddm3gjgmuwtstfzy529j4r55z9r5qeszedxncy3p5uurerwm85n0r");
2932 //Console.WriteLine(addressBalanceResponse);
3033
31- //var r = await testnetExplorerApi.GetTransactionAsync("0xc7246c93cf58541d040d791104be7fee3c7a5e7d73fae3a09dadd47f6c56ee4c");
32- //Console.WriteLine(r);
33- //0x8137f2fc2f2874ffa036e38450b8922d552d4d77880e8ce52a0100bbdd9546dd block
34+ var x = await testnetExplorerApi . GetTransactionHistoryAsync ( "rms1qp2qnal79rglwe2mc60ee8crhk2pnk4yt0v4jt6kuwz8sactau6yyevsatr" ) ;
35+ Console . WriteLine ( JsonConvert . SerializeObject ( x . Content , Formatting . Indented ) ) ;
36+ TransactionHistoryResponse transactionHistoryResponse = x . Content ! ;
37+
38+ var outputIdsList = transactionHistoryResponse . Items . Select ( x => x . OutputId ) . ToList ( ) ;
39+
40+ foreach ( var outputId in outputIdsList )
41+ {
42+ var r = await testnetExplorerApi . GetOutputDetailsAsync ( outputId ) ;
43+ var outputDetails = r . Content ! ;
44+ if ( outputDetails . Output ! . Output ! . Type != 3 )
45+ continue ;
46+
47+ var basicOutput = ( BasicOutput ) outputDetails . Output . Output ;
48+ if ( basicOutput . Features ? . Any ( x => x . Type == 2 ) == true )
49+ {
50+ // The collection is not null and contains an element with Type == 2
51+ var metadata = ( MetadataFeature ) basicOutput . Features . First ( x => x . Type == 2 ) ;
52+ string data = metadata . Data . FromHexString ( ) ;
53+
54+ Console . WriteLine ( data ) ;
55+ }
56+
57+
58+ }
59+
60+
3461 }
3562 }
3663}
0 commit comments