Skip to content

Commit 4e7d661

Browse files
committed
feat: add cell data
1 parent 8a8a7f9 commit 4e7d661

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

lib/ckb/types/cell_data.rb

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# frozen_string_literal: true
2+
3+
module CKB
4+
module Types
5+
class CellData
6+
attr_accessor :content, :hash
7+
8+
# @param content [String]
9+
# @param hash [String]
10+
def initialize(content:, hash:)
11+
@content = content
12+
@hash = hash
13+
end
14+
15+
def to_h
16+
{
17+
content: content,
18+
hash: hash
19+
}
20+
end
21+
22+
def self.from_h(hash)
23+
return if hash.nil?
24+
25+
new(
26+
content: hash[:content],
27+
hash: hash[:hash]
28+
)
29+
end
30+
end
31+
end
32+
end

0 commit comments

Comments
 (0)