Skip to content

Commit 6cfced3

Browse files
committed
feat: add set_network_active RPC
1 parent d208f1f commit 6cfced3

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

lib/ckb/api.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,10 +354,17 @@ def clear_tx_pool
354354
rpc.clear_tx_pool
355355
end
356356

357+
# @return sync_state [SyncState]
357358
def sync_state
358359
Types::SyncState.from_h(rpc.sync_state)
359360
end
360361

362+
# @param state [Boolean]
363+
# @return nil
364+
def set_network_active(state)
365+
rpc.set_network_active(state)
366+
end
367+
361368
def inspect
362369
"\#<API@#{rpc.uri}>"
363370
end

spec/ckb/api_spec.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,4 +364,9 @@
364364
result = api.sync_state
365365
expect(result).to be_a(Types::SyncState)
366366
end
367+
368+
it "set_network_active should return nil" do
369+
result = api.set_network_active(true)
370+
expect(result).to be_nil
371+
end
367372
end

0 commit comments

Comments
 (0)