File tree Expand file tree Collapse file tree 5 files changed +142
-0
lines changed
Expand file tree Collapse file tree 5 files changed +142
-0
lines changed Original file line number Diff line number Diff line change 1+ # frozen_string_literal: true
2+
3+ module CKB
4+ module Types
5+ class CellTransaction
6+ attr_reader :created_by , :consumed_by
7+
8+ # @param created_by [Types::TransactionPoint]
9+ # @param consumed_by [Types::TransactionPoint | nil]
10+ def initialize ( created_by :, consumed_by : nil )
11+ @created_by = created_by
12+ @consumed_by = consumed_by
13+ end
14+
15+ def to_h
16+ {
17+ created_by : @created_by ,
18+ consumed_by : @consumed_by
19+ }
20+ end
21+
22+ def self . from_h ( hash )
23+ return if hash . nil?
24+
25+ consumed_by = hash [ :consumed_by ]
26+
27+ new (
28+ created_by : TransactionPoint . from_h ( cell [ :created_by ] ) ,
29+ consumed_by : consumed_by ? TransactionPoint . from_h ( consumed_by ) : nil
30+ )
31+ end
32+ end
33+ end
34+ end
Original file line number Diff line number Diff line change 1+ # frozen_string_literal: true
2+
3+ module CKB
4+ module Types
5+ class LiveCell
6+ attr_reader :cell_output , :created_by
7+
8+ # @param cell_output [Types::Output]
9+ # @param created_by [Types::TransactionPoint]
10+ def initialize ( cell_output :, created_by :)
11+ @cell_output = cell_output
12+ @created_by = created_by
13+ end
14+
15+ def to_h
16+ {
17+ cell_output : @cell_output . to_h ,
18+ created_by : @created_by . to_h
19+ }
20+ end
21+
22+ def self . from_h ( hash )
23+ return if hash . nil?
24+
25+ new (
26+ cell_output : Output . from_h ( hash [ :cell_output ] ) ,
27+ created_by : TransactionPoint . from_h ( hash [ :created_by ] )
28+ )
29+ end
30+ end
31+ end
32+ end
Original file line number Diff line number Diff line change 1+ # frozen_string_literal: true
2+
3+ module CKB
4+ module Types
5+ class LockHashIndexState
6+ attr_reader :lock_hash , :block_number , :block_hash
7+
8+ # @param lock_hash [String]
9+ # @param block_number [String] number
10+ # @param block_hash [String]
11+ def initialize ( lock_hash :, block_number :, block_hash :)
12+ @lock_hash = lock_hash
13+ @block_number = block_number
14+ @block_hash = block_hash
15+ end
16+
17+ def to_h
18+ {
19+ lock_hash : @lock_hash ,
20+ block_number : @block_number ,
21+ block_hash : @block_hash
22+ }
23+ end
24+
25+ def self . from_h ( hash )
26+ return if hash . nil?
27+
28+ new (
29+ lock_hash : hash [ :lock_hash ] ,
30+ block_numebr : hash [ :block_number ] ,
31+ block_hash : hash [ :block_hash ]
32+ )
33+ end
34+ end
35+ end
36+ end
Original file line number Diff line number Diff line change 1+ # frozen_string_literal: true
2+
3+ module CKB
4+ module Types
5+ class TransactionPoint
6+ attr_reader :block_number , :tx_hash , :index
7+
8+ # @param block_number [String]
9+ # @param tx_hash [String]
10+ # @param index [String]
11+ def initialize ( block_number :, tx_hash :, index :)
12+ @block_number = block_number
13+ @tx_hash = tx_hash
14+ @index = index
15+ end
16+
17+ def to_h
18+ {
19+ block_number : @block_number ,
20+ tx_hash : @tx_hash ,
21+ index : @index
22+ }
23+ end
24+
25+ def self . from_h ( hash )
26+ return if hash . nil?
27+
28+ new (
29+ block_number : hash [ :block_number ] ,
30+ tx_hash : hash [ :tx_hash ] ,
31+ index : hash [ :index ]
32+ )
33+ end
34+ end
35+ end
36+ end
Original file line number Diff line number Diff line change 2121require_relative "peer"
2222require_relative "tx_pool_info"
2323require_relative "dry_run_result"
24+ require_relative "transaction_point"
25+ require_relative "lock_hash_index_state"
26+ require_relative "live_cell"
27+ require_relative "cell_transaction"
2428
2529module CKB
2630 module Types
You can’t perform that action at this time.
0 commit comments