github.com/shyftnetwork/go-empyrean@v1.8.3-0.20191127201940-fbfca9338f04/shyftBlockExplorerApi/routes.go (about)

     1  package main
     2  
     3  //@NOTE Shyft setting up endpoints
     4  import "net/http"
     5  
     6  //Route stuct
     7  type Route struct {
     8  	Name        string
     9  	Method      string
    10  	Pattern     string
    11  	HandlerFunc http.HandlerFunc
    12  }
    13  
    14  //Routes routes
    15  type Routes []Route
    16  
    17  var routes = Routes{
    18  	Route{
    19  		"GetAccount",
    20  		"GET",
    21  		"/api/get_account/{address}",
    22  		GetAccount,
    23  	},
    24  	Route{
    25  		"GetAccountTxs",
    26  		"GET",
    27  		"/api/get_account_txs/{address}",
    28  		GetAccountTxs,
    29  	},
    30  	Route{
    31  		"GetAllAccounts",
    32  		"GET",
    33  		"/api/get_all_accounts",
    34  		GetAllAccounts,
    35  	},
    36  	Route{
    37  		"GetAllBlocks",
    38  		"GET",
    39  		"/api/get_all_blocks",
    40  		GetAllBlocks,
    41  	},
    42  	Route{
    43  		"GetBlock",
    44  		"GET",
    45  		"/api/get_block/{blockNumber}",
    46  		GetBlock,
    47  	},
    48  	Route{
    49  		"GetAllTransactions",
    50  		"GET",
    51  		"/api/get_all_transactions",
    52  		GetAllTransactions,
    53  	},
    54  	Route{
    55  		"GetTransaction",
    56  		"GET",
    57  		"/api/get_transaction/{txHash}",
    58  		GetTransaction,
    59  	},
    60  	Route{
    61  		Name:        "GetRecentBlock",
    62  		Method:      "GET",
    63  		Pattern:     "/api/get_recent_block",
    64  		HandlerFunc: GetRecentBlock,
    65  	},
    66  	Route{
    67  		Name:        "GetAllTransactionsFromBlock",
    68  		Method:      "GET",
    69  		Pattern:     "/api/get_all_transactions_from_block/{blockNumber}",
    70  		HandlerFunc: GetAllTransactionsFromBlock,
    71  	},
    72  	Route{
    73  		Name:        "GetAllBlocksMinedByAddress",
    74  		Method:      "GET",
    75  		Pattern:     "/api/get_blocks_mined/{coinbase}",
    76  		HandlerFunc: GetAllBlocksMinedByAddress,
    77  	},
    78  	Route{
    79  		"GetInternalTransactions",
    80  		"GET",
    81  		"/api/get_internal_transactions/",
    82  		GetInternalTransactions,
    83  	},
    84  	Route{
    85  		"GetInternalTransactionsByHash",
    86  		"GET",
    87  		"/api/get_internal_transactions/{txHash}",
    88  		GetInternalTransactionsByHash,
    89  	},
    90  	Route{
    91  		"BroadcastTx",
    92  		"GET",
    93  		"/api/broadcast_tx/{transaction_hash}",
    94  		BroadcastTx,
    95  	},
    96  }