Skip to content

Latest TransactionsH #45

Description

@Horlabrainmoore
#import <Foundation/Foundation.h>

dispatch_semaphore_t sema = dispatch_semaphore_create(0);

NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://graphql.bitquery.io"]
   cachePolicy:NSURLRequestUseProtocolCachePolicy
   timeoutInterval:10.0];
NSDictionary *headers = @{
   @"Content-Type": @"application/json",
   @"Authorization": @"Bearer undefined"
};

[request setAllHTTPHeaderFields:headers];
NSData *postData = [[NSData alloc] initWithData:[@"{\"query\":\"query ($network: BitcoinNetwork!, $limit: Int!, $offset: Int!, $from: ISO8601DateTime, $till: ISO8601DateTime) {\\n  bitcoin(network: $network) {\\n    transactions(\\n      options: {desc: [\\\"block.height\\\", \\\"index\\\"], limit: $limit, offset: $offset}\\n      time: {since: $from, till: $till}\\n    ) {\\n      block {\\n        timestamp {\\n          time(format: \\\"%Y-%m-%d %H:%M:%S\\\")\\n        }\\n        height\\n      }\\n      inputValue\\n      input_value_usd: inputValue(in: USD)\\n      outputCount\\n      inputCount\\n      index\\n      hash\\n      feeValue\\n      fee_value_usd: feeValue(in: USD)\\n    }\\n  }\\n}\\n\",\"variables\":\"{\\n  \\\"limit\\\": 10,\\n  \\\"offset\\\": 0,\\n  \\\"network\\\": \\\"bitcoin\\\",\\n  \\\"from\\\": \\\"2026-01-22T07:28:39.000Z\\\",\\n  \\\"till\\\": \\\"2026-01-22T08:13:39.999Z\\\",\\n  \\\"dateFormat\\\": \\\"%Y-%m-%d\\\"\\n}\"}" dataUsingEncoding:NSUTF8StringEncoding]];
[request setHTTPBody:postData];

[request setHTTPMethod:@"POST"];

NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
   if (error) {
      NSLog(@"%@", error);
      dispatch_semaphore_signal(sema);
   } else {
      NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
      NSError *parseError = nil;
      NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
      NSLog(@"%@",responseDictionary);
      dispatch_semaphore_signal(sema);
   }
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);HHHHYYY

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions