resigtry handler method
()
| 135 | |
| 136 | //resigtry handler method |
| 137 | func (this *restServer) registryMethod() { |
| 138 | |
| 139 | getMethodMap := map[string]Action{ |
| 140 | GET_CONN_COUNT: {name: "getconnectioncount", handler: rest.GetConnectionCount}, |
| 141 | GET_SYNC_STATUS: {name: "getsyncstatus", handler: rest.GetNodeSyncStatus}, |
| 142 | GET_BLK_TXS_BY_HEIGHT: {name: "getblocktxsbyheight", handler: rest.GetBlockTxsByHeight}, |
| 143 | GET_BLK_BY_HEIGHT: {name: "getblockbyheight", handler: rest.GetBlockByHeight}, |
| 144 | GET_BLK_BY_HASH: {name: "getblockbyhash", handler: rest.GetBlockByHash}, |
| 145 | GET_BLK_HEIGHT: {name: "getblockheight", handler: rest.GetBlockHeight}, |
| 146 | GET_BLK_HASH: {name: "getblockhash", handler: rest.GetBlockHash}, |
| 147 | GET_TX: {name: "gettransaction", handler: rest.GetTransactionByHash}, |
| 148 | GET_CONTRACT_STATE: {name: "getcontract", handler: rest.GetContractState}, |
| 149 | GET_SMTCOCE_EVT_TXS: {name: "getsmartcodeeventbyheight", handler: rest.GetSmartCodeEventTxsByHeight}, |
| 150 | GET_SMTCOCE_EVTS: {name: "getsmartcodeeventbyhash", handler: rest.GetSmartCodeEventByTxHash}, |
| 151 | GET_BLK_HGT_BY_TXHASH: {name: "getblockheightbytxhash", handler: rest.GetBlockHeightByTxHash}, |
| 152 | GET_STORAGE: {name: "getstorage", handler: rest.GetStorage}, |
| 153 | GET_BALANCE: {name: "getbalance", handler: rest.GetBalance}, |
| 154 | GET_ALLOWANCE: {name: "getallowance", handler: rest.GetAllowance}, |
| 155 | GET_MERKLE_PROOF: {name: "getmerkleproof", handler: rest.GetMerkleProof}, |
| 156 | GET_GAS_PRICE: {name: "getgasprice", handler: rest.GetGasPrice}, |
| 157 | GET_MEMPOOL_TXCOUNT: {name: "getmempooltxcount", handler: rest.GetMemPoolTxCount}, |
| 158 | GET_MEMPOOL_TXSTATE: {name: "getmempooltxstate", handler: rest.GetMemPoolTxState}, |
| 159 | GET_VERSION: {name: "getversion", handler: rest.GetNodeVersion}, |
| 160 | GET_NETWORKID: {name: "getnetworkid", handler: rest.GetNetworkId}, |
| 161 | } |
| 162 | |
| 163 | postMethodMap := map[string]Action{ |
| 164 | POST_RAW_TX: {name: "sendrawtransaction", handler: rest.SendRawTransaction}, |
| 165 | } |
| 166 | this.postMap = postMethodMap |
| 167 | this.getMap = getMethodMap |
| 168 | } |
| 169 | func (this *restServer) getPath(url string) string { |
| 170 | |
| 171 | if strings.Contains(url, strings.TrimRight(GET_BLK_TXS_BY_HEIGHT, ":height")) { |