Skip to content

Latest commit

 

History

History
432 lines (301 loc) · 13.9 KB

CardanoBlocksAPI.md

File metadata and controls

432 lines (301 loc) · 13.9 KB

CardanoBlocksAPI

All URIs are relative to https://cardano-mainnet.blockfrost.io/api/v0

Method HTTP request Description
getBlock GET /blocks/{hash_or_number} Specific block
getBlockInEpochInSlot GET /blocks/epoch/{epoch_number}/slot/{slot_number} Specific block in a slot in an epoch
getBlockInSlot GET /blocks/slot/{slot_number} Specific block in a slot
getBlockTransactions GET /blocks/{hash_or_number}/txs Block transactions
getLatestBlock GET /blocks/latest Latest block
getNextBlocks GET /blocks/{hash_or_number}/next Listing of next blocks
getPreviousBlocks GET /blocks/{hash_or_number}/previous Listing of previous blocks
getTransactionsInLatestBlock GET /blocks/latest/txs Latest block transactions

getBlock

    open class func getBlock(hashOrNumber: String, completion: @escaping (_ data: BlockContent?, _ error: Error?) -> Void)

Specific block

Return the content of a requested block.

Example

// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new
import BlockfrostSwift

let hashOrNumber = "hashOrNumber_example" // String | Hash or number of the requested block.

// Specific block
CardanoBlocksAPI.getBlock(hashOrNumber: hashOrNumber) { (response, error) in
    guard error == nil else {
        print(error)
        return
    }

    if (response) {
        dump(response)
    }
}

Parameters

Name Type Description Notes
hashOrNumber String Hash or number of the requested block.

Return type

BlockContent

Authorization

ApiKeyAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

getBlockInEpochInSlot

    open class func getBlockInEpochInSlot(epochNumber: Int, slotNumber: Int, completion: @escaping (_ data: BlockContent?, _ error: Error?) -> Void)

Specific block in a slot in an epoch

Return the content of a requested block for a specific slot in an epoch.

Example

// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new
import BlockfrostSwift

let epochNumber = 987 // Int | Epoch for specific epoch slot.
let slotNumber = 987 // Int | Slot position for requested block.

// Specific block in a slot in an epoch
CardanoBlocksAPI.getBlockInEpochInSlot(epochNumber: epochNumber, slotNumber: slotNumber) { (response, error) in
    guard error == nil else {
        print(error)
        return
    }

    if (response) {
        dump(response)
    }
}

Parameters

Name Type Description Notes
epochNumber Int Epoch for specific epoch slot.
slotNumber Int Slot position for requested block.

Return type

BlockContent

Authorization

ApiKeyAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

getBlockInSlot

    open class func getBlockInSlot(slotNumber: Int, completion: @escaping (_ data: BlockContent?, _ error: Error?) -> Void)

Specific block in a slot

Return the content of a requested block for a specific slot.

Example

// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new
import BlockfrostSwift

let slotNumber = 987 // Int | Slot position for requested block.

// Specific block in a slot
CardanoBlocksAPI.getBlockInSlot(slotNumber: slotNumber) { (response, error) in
    guard error == nil else {
        print(error)
        return
    }

    if (response) {
        dump(response)
    }
}

Parameters

Name Type Description Notes
slotNumber Int Slot position for requested block.

Return type

BlockContent

Authorization

ApiKeyAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

getBlockTransactions

    open class func getBlockTransactions(hashOrNumber: String, count: Int? = nil, page: Int? = nil, order: SortOrder? = nil, completion: @escaping (_ data: [String]?, _ error: Error?) -> Void)

Block transactions

Return the transactions within the block.

Example

// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new
import BlockfrostSwift

let hashOrNumber = "hashOrNumber_example" // String | Hash of the requested block.
let count = 987 // Int | The number of results displayed on one page. (optional) (default to 100)
let page = 987 // Int | The page number for listing the results. (optional) (default to 1)
let order = "order_example" // SortOrder | Ordered by tx index in the block. The ordering of items from the point of view of the blockchain, not the page listing itself. By default, we return oldest first, newest last.  (optional) (default to .asc)

// Block transactions
CardanoBlocksAPI.getBlockTransactions(hashOrNumber: hashOrNumber, count: count, page: page, order: order) { (response, error) in
    guard error == nil else {
        print(error)
        return
    }

    if (response) {
        dump(response)
    }
}

Parameters

Name Type Description Notes
hashOrNumber String Hash of the requested block.
count Int The number of results displayed on one page. [optional] [default to 100]
page Int The page number for listing the results. [optional] [default to 1]
order SortOrder Ordered by tx index in the block. The ordering of items from the point of view of the blockchain, not the page listing itself. By default, we return oldest first, newest last. [optional] [default to .asc]

Return type

[String]

Authorization

ApiKeyAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

getLatestBlock

    open class func getLatestBlock(completion: @escaping (_ data: BlockContent?, _ error: Error?) -> Void)

Latest block

Return the latest block available to the backends, also known as the tip of the blockchain.

Example

// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new
import BlockfrostSwift


// Latest block
CardanoBlocksAPI.getLatestBlock() { (response, error) in
    guard error == nil else {
        print(error)
        return
    }

    if (response) {
        dump(response)
    }
}

Parameters

This endpoint does not need any parameter.

Return type

BlockContent

Authorization

ApiKeyAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

getNextBlocks

    open class func getNextBlocks(hashOrNumber: String, count: Int? = nil, page: Int? = nil, completion: @escaping (_ data: [BlockContent]?, _ error: Error?) -> Void)

Listing of next blocks

Return the list of blocks following a specific block.

Example

// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new
import BlockfrostSwift

let hashOrNumber = "hashOrNumber_example" // String | Hash of the requested block.
let count = 987 // Int | The number of results displayed on one page. (optional) (default to 100)
let page = 987 // Int | The page number for listing the results. (optional) (default to 1)

// Listing of next blocks
CardanoBlocksAPI.getNextBlocks(hashOrNumber: hashOrNumber, count: count, page: page) { (response, error) in
    guard error == nil else {
        print(error)
        return
    }

    if (response) {
        dump(response)
    }
}

Parameters

Name Type Description Notes
hashOrNumber String Hash of the requested block.
count Int The number of results displayed on one page. [optional] [default to 100]
page Int The page number for listing the results. [optional] [default to 1]

Return type

[BlockContent]

Authorization

ApiKeyAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

getPreviousBlocks

    open class func getPreviousBlocks(hashOrNumber: String, count: Int? = nil, page: Int? = nil, completion: @escaping (_ data: [BlockContent]?, _ error: Error?) -> Void)

Listing of previous blocks

Return the list of blocks preceding a specific block.

Example

// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new
import BlockfrostSwift

let hashOrNumber = "hashOrNumber_example" // String | Hash of the requested block
let count = 987 // Int | The number of results displayed on one page. (optional) (default to 100)
let page = 987 // Int | The page number for listing the results. (optional) (default to 1)

// Listing of previous blocks
CardanoBlocksAPI.getPreviousBlocks(hashOrNumber: hashOrNumber, count: count, page: page) { (response, error) in
    guard error == nil else {
        print(error)
        return
    }

    if (response) {
        dump(response)
    }
}

Parameters

Name Type Description Notes
hashOrNumber String Hash of the requested block
count Int The number of results displayed on one page. [optional] [default to 100]
page Int The page number for listing the results. [optional] [default to 1]

Return type

[BlockContent]

Authorization

ApiKeyAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

getTransactionsInLatestBlock

    open class func getTransactionsInLatestBlock(count: Int? = nil, page: Int? = nil, order: SortOrder? = nil, completion: @escaping (_ data: [String]?, _ error: Error?) -> Void)

Latest block transactions

Return the transactions within the latest block.

Example

// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new
import BlockfrostSwift

let count = 987 // Int | The number of results displayed on one page. (optional) (default to 100)
let page = 987 // Int | The page number for listing the results. (optional) (default to 1)
let order = "order_example" // SortOrder | Ordered by tx index in the block. The ordering of items from the point of view of the blockchain, not the page listing itself. By default, we return oldest first, newest last.  (optional) (default to .asc)

// Latest block transactions
CardanoBlocksAPI.getTransactionsInLatestBlock(count: count, page: page, order: order) { (response, error) in
    guard error == nil else {
        print(error)
        return
    }

    if (response) {
        dump(response)
    }
}

Parameters

Name Type Description Notes
count Int The number of results displayed on one page. [optional] [default to 100]
page Int The page number for listing the results. [optional] [default to 1]
order SortOrder Ordered by tx index in the block. The ordering of items from the point of view of the blockchain, not the page listing itself. By default, we return oldest first, newest last. [optional] [default to .asc]

Return type

[String]

Authorization

ApiKeyAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]