@@ -10,6 +10,7 @@ module CKB
1010 class API
1111 attr_reader :rpc
1212 attr_reader :system_script_out_point
13+ attr_reader :system_script_group_out_point
1314 attr_reader :system_script_code_hash
1415 attr_reader :dao_out_point
1516 attr_reader :dao_code_hash
@@ -18,10 +19,12 @@ def initialize(host: CKB::RPC::DEFAULT_URL, mode: MODE::TESTNET)
1819 @rpc = CKB ::RPC . new ( host : host )
1920 if mode == MODE ::TESTNET
2021 # Testnet system script code_hash
21- expected_code_hash = "0xa76801d09a0eabbfa545f1577084b6f3bafb0b6250e7f5c89efcfd4e3499fb55 "
22+ expected_code_hash = "0x664b03c55410dd7d694a73779fa86edd7f069ee17fd79b0fef4c4fec0377b9a6 "
2223 # For testnet chain, we can assume the second cell of the first transaction
2324 # in the genesis block contains default lock script we can use here.
2425 system_cell_transaction = genesis_block . transactions . first
26+
27+ system_scipt_group_transaction = genesis_block . transactions [ 1 ]
2528 out_point = Types ::OutPoint . new (
2629 tx_hash : system_cell_transaction . hash ,
2730 index : "1"
@@ -32,6 +35,11 @@ def initialize(host: CKB::RPC::DEFAULT_URL, mode: MODE::TESTNET)
3235 raise "System script code_hash error!" unless code_hash == expected_code_hash
3336
3437 set_system_script_cell ( out_point , code_hash )
38+ group_out_point = Types ::OutPoint . new (
39+ tx_hash : system_scipt_group_transaction . hash ,
40+ index : "0"
41+ )
42+ set_system_script_group_cell ( group_out_point )
3543
3644 dao_out_point = Types ::OutPoint . new (
3745 tx_hash : system_cell_transaction . hash ,
@@ -51,6 +59,11 @@ def set_system_script_cell(out_point, code_hash)
5159 @system_script_code_hash = code_hash
5260 end
5361
62+ # @param out_point [CKB::Types::OutPoint]
63+ def set_system_script_group_cell ( out_point )
64+ @system_script_group_out_point = out_point
65+ end
66+
5467 def set_dao_cell ( out_point , code_hash )
5568 @dao_out_point = out_point
5669 @dao_code_hash = code_hash
@@ -140,6 +153,10 @@ def compute_transaction_hash(transaction)
140153 rpc . compute_transaction_hash ( transaction . to_h )
141154 end
142155
156+ def compute_script_hash ( script_h )
157+ rpc . compute_script_hash ( script_h )
158+ end
159+
143160 # @return [CKB::Type::Peer]
144161 def local_node_info
145162 Types ::Peer . from_h (
0 commit comments