// Start adds the rpc path to the router. func (this *JsonRpcServer) Start(config *server.ServerConfig, router *gin.Engine) { router.POST(config.HTTP.JsonRpcEndpoint, this.handleFunc) this.running = true }
// Starting the server means registering all the handlers with the router. func (this *RestServer) Start(config *server.ServerConfig, router *gin.Engine) { // Accounts router.GET("/accounts", parseSearchQuery, this.handleAccounts) router.GET("/accounts/:address", addressParam, this.handleAccount) router.GET("/accounts/:address/storage", addressParam, this.handleStorage) router.GET("/accounts/:address/storage/:key", addressParam, keyParam, this.handleStorageAt) // Blockchain router.GET("/blockchain", this.handleBlockchainInfo) router.GET("/blockchain/chain_id", this.handleChainId) router.GET("/blockchain/genesis_hash", this.handleGenesisHash) router.GET("/blockchain/latest_block_height", this.handleLatestBlockHeight) router.GET("/blockchain/latest_block", this.handleLatestBlock) router.GET("/blockchain/blocks", parseSearchQuery, this.handleBlocks) router.GET("/blockchain/block/:height", heightParam, this.handleBlock) // Consensus router.GET("/consensus", this.handleConsensusState) router.GET("/consensus/validators", this.handleValidatorList) // Events router.POST("/event_subs", this.handleEventSubscribe) router.GET("/event_subs/:id", this.handleEventPoll) router.DELETE("/event_subs/:id", this.handleEventUnsubscribe) // NameReg router.GET("/namereg", parseSearchQuery, this.handleNameRegEntries) router.GET("/namereg/:key", nameParam, this.handleNameRegEntry) // Network router.GET("/network", this.handleNetworkInfo) router.GET("/network/client_version", this.handleClientVersion) router.GET("/network/moniker", this.handleMoniker) router.GET("/network/listening", this.handleListening) router.GET("/network/listeners", this.handleListeners) router.GET("/network/peers", this.handlePeers) router.GET("/network/peers/:address", peerAddressParam, this.handlePeer) // Tx related (TODO get txs has still not been implemented) router.POST("/txpool", this.handleBroadcastTx) router.GET("/txpool", this.handleUnconfirmedTxs) // Code execution router.POST("/calls", this.handleCall) router.POST("/codecalls", this.handleCallCode) // Unsafe router.GET("/unsafe/pa_generator", this.handleGenPrivAcc) router.POST("/unsafe/txpool", parseTxModifier, this.handleTransact) router.POST("/unsafe/namereg/txpool", this.handleTransactNameReg) router.POST("/unsafe/tx_signer", this.handleSignTx) this.running = true }
// Start the server. func (this *ServerServer) Start(config *server.ServerConfig, router *gin.Engine) { router.POST("/server", this.handleFunc) this.running = true }