From 05eb2327049a550802be91ae0d11866591d5cd70 Mon Sep 17 00:00:00 2001 From: shaojunda Date: Wed, 25 Nov 2020 14:07:15 +0800 Subject: [PATCH] refactor: add default indexer url --- lib/ckb/indexer/api.rb | 2 +- lib/ckb/rpc.rb | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/ckb/indexer/api.rb b/lib/ckb/indexer/api.rb index b393e97e..4432751f 100644 --- a/lib/ckb/indexer/api.rb +++ b/lib/ckb/indexer/api.rb @@ -6,7 +6,7 @@ class API attr_reader :rpc DEFAULT_LIMIT = 1000 - def initialize(indexer_host, timeout_config = {}) + def initialize(indexer_host = CKB::RPC::DEFAULT_INDEXER_URL, timeout_config = {}) @rpc = CKB::RPC.new(host: indexer_host, timeout_config: timeout_config) end diff --git a/lib/ckb/rpc.rb b/lib/ckb/rpc.rb index 946ce80b..67f06cf7 100644 --- a/lib/ckb/rpc.rb +++ b/lib/ckb/rpc.rb @@ -25,6 +25,7 @@ class RPC attr_reader :uri, :http DEFAULT_URL = "http://localhost:8114" + DEFAULT_INDEXER_URL = "http://localhost:8116" def initialize(host: DEFAULT_URL, timeout_config: {}) @uri = URI(host)