flow_client 0.2.1 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/CHANGELOG.md +6 -2
- data/Gemfile +1 -0
- data/Gemfile.lock +114 -0
- data/README.md +1 -1
- data/bin/console +0 -0
- data/flow_client.gemspec +10 -6
- data/lib/flow_client/account.rb +1 -0
- data/lib/flow_client/block.rb +14 -8
- data/lib/flow_client/cadence_type.rb +35 -15
- data/lib/flow_client/client.rb +13 -1
- data/lib/flow_client/collection.rb +3 -1
- data/lib/flow_client/crypto.rb +2 -2
- data/lib/flow_client/event.rb +5 -3
- data/lib/flow_client/proposal_key.rb +3 -1
- data/lib/flow_client/signature.rb +3 -1
- data/lib/flow_client/transaction.rb +5 -7
- data/lib/flow_client/utils.rb +0 -11
- data/lib/flow_client/version.rb +1 -1
- data/lib/flow_client.rb +1 -1
- data/template.md +4 -3
- metadata +39 -24
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 21de96857e32592f838aa28fb31ab17fa878cf26128ce81a03237d3b7a27d73a
|
4
|
+
data.tar.gz: e2b5373fa78c407825aa76e46570125bbc3f6b8794d8162492e0155412a7ea79
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 60b88b194fe808ca5a73469a4036e3cf50eba7a54b561577c371fc76e59b703264d9bd970ae8cbf81b91d39f5bac28abb14611b86a1e5c0d3fd39a761c63d1e9
|
7
|
+
data.tar.gz: 6c26d7bf1c8cb8cf26ab2e23b5f506a7f5983b349b00991e3c7cf35a5362c4a3679c3f61c2f89459aff1544bad46b12571210f2994ba9956500294803e22b7b4
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -13,8 +13,12 @@
|
|
13
13
|
- Added multiple signature support
|
14
14
|
- Added multi-party signing
|
15
15
|
- Added account creation
|
16
|
-
|
16
|
+
|
17
17
|
## [0.2.1] - 2021-11-08
|
18
18
|
|
19
19
|
- Fixed incorrect CadenceType conversions
|
20
|
-
- Updated usage examples
|
20
|
+
- Updated usage examples
|
21
|
+
|
22
|
+
## [0.2.3] - 2022-08-21
|
23
|
+
|
24
|
+
- Updated dependencies: grpc, grpc-tools, json and openssl
|
data/Gemfile
CHANGED
data/Gemfile.lock
ADDED
@@ -0,0 +1,114 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
flow_client (0.2.3)
|
5
|
+
grpc (~> 1.48.0)
|
6
|
+
grpc-tools (~> 1.48.0)
|
7
|
+
json (~> 2.6.2)
|
8
|
+
openssl (~> 3.0.0)
|
9
|
+
rlp (~> 0.7.3)
|
10
|
+
|
11
|
+
GEM
|
12
|
+
remote: https://rubygems.org/
|
13
|
+
specs:
|
14
|
+
ast (2.4.2)
|
15
|
+
coderay (1.1.3)
|
16
|
+
diff-lcs (1.5.0)
|
17
|
+
docile (1.4.0)
|
18
|
+
ffi (1.15.5)
|
19
|
+
formatador (1.1.0)
|
20
|
+
google-protobuf (3.21.6)
|
21
|
+
googleapis-common-protos-types (1.4.0)
|
22
|
+
google-protobuf (~> 3.14)
|
23
|
+
grpc (1.48.0)
|
24
|
+
google-protobuf (~> 3.19)
|
25
|
+
googleapis-common-protos-types (~> 1.0)
|
26
|
+
grpc-tools (1.48.0)
|
27
|
+
guard (2.18.0)
|
28
|
+
formatador (>= 0.2.4)
|
29
|
+
listen (>= 2.7, < 4.0)
|
30
|
+
lumberjack (>= 1.0.12, < 2.0)
|
31
|
+
nenv (~> 0.1)
|
32
|
+
notiffany (~> 0.0)
|
33
|
+
pry (>= 0.13.0)
|
34
|
+
shellany (~> 0.0)
|
35
|
+
thor (>= 0.18.1)
|
36
|
+
guard-compat (1.2.1)
|
37
|
+
guard-rspec (4.7.3)
|
38
|
+
guard (~> 2.1)
|
39
|
+
guard-compat (~> 1.1)
|
40
|
+
rspec (>= 2.99.0, < 4.0)
|
41
|
+
json (2.6.2)
|
42
|
+
listen (3.7.1)
|
43
|
+
rb-fsevent (~> 0.10, >= 0.10.3)
|
44
|
+
rb-inotify (~> 0.9, >= 0.9.10)
|
45
|
+
lumberjack (1.2.8)
|
46
|
+
method_source (1.0.0)
|
47
|
+
nenv (0.3.0)
|
48
|
+
notiffany (0.1.3)
|
49
|
+
nenv (~> 0.1)
|
50
|
+
shellany (~> 0.0)
|
51
|
+
openssl (3.0.1)
|
52
|
+
parallel (1.22.1)
|
53
|
+
parser (3.1.2.1)
|
54
|
+
ast (~> 2.4.1)
|
55
|
+
pry (0.14.1)
|
56
|
+
coderay (~> 1.1)
|
57
|
+
method_source (~> 1.0)
|
58
|
+
rainbow (3.1.1)
|
59
|
+
rake (13.0.6)
|
60
|
+
rb-fsevent (0.11.2)
|
61
|
+
rb-inotify (0.10.1)
|
62
|
+
ffi (~> 1.0)
|
63
|
+
regexp_parser (2.5.0)
|
64
|
+
rexml (3.2.5)
|
65
|
+
rlp (0.7.3)
|
66
|
+
rspec (3.11.0)
|
67
|
+
rspec-core (~> 3.11.0)
|
68
|
+
rspec-expectations (~> 3.11.0)
|
69
|
+
rspec-mocks (~> 3.11.0)
|
70
|
+
rspec-core (3.11.0)
|
71
|
+
rspec-support (~> 3.11.0)
|
72
|
+
rspec-expectations (3.11.1)
|
73
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
74
|
+
rspec-support (~> 3.11.0)
|
75
|
+
rspec-mocks (3.11.1)
|
76
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
77
|
+
rspec-support (~> 3.11.0)
|
78
|
+
rspec-support (3.11.1)
|
79
|
+
rubocop (1.36.0)
|
80
|
+
json (~> 2.3)
|
81
|
+
parallel (~> 1.10)
|
82
|
+
parser (>= 3.1.2.1)
|
83
|
+
rainbow (>= 2.2.2, < 4.0)
|
84
|
+
regexp_parser (>= 1.8, < 3.0)
|
85
|
+
rexml (>= 3.2.5, < 4.0)
|
86
|
+
rubocop-ast (>= 1.20.1, < 2.0)
|
87
|
+
ruby-progressbar (~> 1.7)
|
88
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
89
|
+
rubocop-ast (1.21.0)
|
90
|
+
parser (>= 3.1.1.0)
|
91
|
+
ruby-progressbar (1.11.0)
|
92
|
+
shellany (0.0.1)
|
93
|
+
simplecov (0.21.2)
|
94
|
+
docile (~> 1.1)
|
95
|
+
simplecov-html (~> 0.11)
|
96
|
+
simplecov_json_formatter (~> 0.1)
|
97
|
+
simplecov-html (0.12.3)
|
98
|
+
simplecov_json_formatter (0.1.4)
|
99
|
+
thor (1.2.1)
|
100
|
+
unicode-display_width (2.3.0)
|
101
|
+
|
102
|
+
PLATFORMS
|
103
|
+
ruby
|
104
|
+
|
105
|
+
DEPENDENCIES
|
106
|
+
flow_client!
|
107
|
+
guard-rspec (~> 4.7)
|
108
|
+
rake (~> 13.0)
|
109
|
+
rspec (~> 3.0)
|
110
|
+
rubocop (~> 1.22)
|
111
|
+
simplecov
|
112
|
+
|
113
|
+
BUNDLED WITH
|
114
|
+
2.3.13
|
data/README.md
CHANGED
@@ -669,7 +669,7 @@ After a transaction has been [built](#build-transactions) and [signed](#sign-tra
|
|
669
669
|
```ruby
|
670
670
|
tx_res = client.send_transaction(@transaction)
|
671
671
|
client.wait_for_transaction(tx_res.id) do |response|
|
672
|
-
|
672
|
+
# use response here
|
673
673
|
end
|
674
674
|
```
|
675
675
|
|
data/bin/console
CHANGED
File without changes
|
data/flow_client.gemspec
CHANGED
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
|
|
11
11
|
spec.description = "A Ruby client for the Flow blockchain"
|
12
12
|
spec.homepage = "https://github.com/glucode/flow_client"
|
13
13
|
spec.license = "MIT"
|
14
|
-
spec.required_ruby_version = ">= 2.
|
14
|
+
spec.required_ruby_version = ">= 2.7.2"
|
15
15
|
|
16
16
|
# spec.metadata["allowed_push_host"] = "TODO: Set to 'https://mygemserver.com'"
|
17
17
|
|
@@ -29,12 +29,16 @@ Gem::Specification.new do |spec|
|
|
29
29
|
spec.require_paths = ["lib"]
|
30
30
|
|
31
31
|
# Uncomment to register a new dependency of your gem
|
32
|
-
spec.
|
33
|
-
spec.
|
34
|
-
spec.
|
35
|
-
spec.
|
36
|
-
spec.
|
32
|
+
spec.add_runtime_dependency "grpc", "~> 1.48.0"
|
33
|
+
spec.add_runtime_dependency "grpc-tools", "~> 1.48.0"
|
34
|
+
spec.add_runtime_dependency "json", "~> 2.6.2"
|
35
|
+
spec.add_runtime_dependency "openssl", "~> 3.0.0"
|
36
|
+
spec.add_runtime_dependency "rlp", "~> 0.7.3"
|
37
|
+
|
38
|
+
spec.add_development_dependency "simplecov"
|
37
39
|
|
38
40
|
# For more information and examples about making a new gem, checkout our
|
39
41
|
# guide at: https://bundler.io/guides/creating_gem.html
|
42
|
+
|
43
|
+
spec.platform = Gem::Platform::RUBY
|
40
44
|
end
|
data/lib/flow_client/account.rb
CHANGED
data/lib/flow_client/block.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
|
+
module FlowClient
|
3
4
|
# Represents a block
|
4
5
|
class Block
|
5
6
|
attr_accessor :id,
|
@@ -9,7 +10,7 @@ module FlowClient
|
|
9
10
|
:collection_guarantees,
|
10
11
|
:block_seals,
|
11
12
|
:signatures
|
12
|
-
|
13
|
+
|
13
14
|
def initialize
|
14
15
|
@id = nil
|
15
16
|
@parent_id = nil
|
@@ -26,8 +27,12 @@ module FlowClient
|
|
26
27
|
block.parent_id = block_response.block.parent_id.unpack1("H*")
|
27
28
|
block.height = block_response.block.height
|
28
29
|
block.timestamp = FlowClient::Utils.parse_protobuf_timestamp(block_response.block.timestamp)
|
29
|
-
block.collection_guarantees = block_response.block.collection_guarantees.to_a.map
|
30
|
-
|
30
|
+
block.collection_guarantees = block_response.block.collection_guarantees.to_a.map do |cg|
|
31
|
+
FlowClient::CollectionGuarantee.parse_grpc_type(cg)
|
32
|
+
end
|
33
|
+
block.block_seals = block_response.block.block_seals.to_a.map do |seal|
|
34
|
+
FlowClient::BlockSeal.parse_grpc_type(seal)
|
35
|
+
end
|
31
36
|
block.signatures = block_response.block.signatures.to_a.map { |sig| sig.unpack1("H*") }
|
32
37
|
block
|
33
38
|
end
|
@@ -51,7 +56,9 @@ module FlowClient
|
|
51
56
|
block_seal = BlockSeal.new
|
52
57
|
block_seal.block_id = grpc_type.block_id.unpack1("H*")
|
53
58
|
block_seal.execution_receipt_id = grpc_type.execution_receipt_id.unpack1("H*")
|
54
|
-
block_seal.execution_receipt_signatures = grpc_type.execution_receipt_signatures.to_a.map
|
59
|
+
block_seal.execution_receipt_signatures = grpc_type.execution_receipt_signatures.to_a.map do |sig|
|
60
|
+
sig.unpack1("H*")
|
61
|
+
end
|
55
62
|
block_seal.result_approval_signatures = grpc_type.result_approval_signatures.to_a.map { |sig| sig.unpack1("H*") }
|
56
63
|
block_seal
|
57
64
|
end
|
@@ -61,8 +68,7 @@ module FlowClient
|
|
61
68
|
class BlockHeader
|
62
69
|
attr_accessor :id, :parent_id, :height, :timestamp
|
63
70
|
|
64
|
-
def initialize
|
65
|
-
end
|
71
|
+
def initialize; end
|
66
72
|
|
67
73
|
def self.parse_grpc_type(grpc_type)
|
68
74
|
header = BlockHeader.new
|
@@ -72,4 +78,4 @@ module FlowClient
|
|
72
78
|
header
|
73
79
|
end
|
74
80
|
end
|
75
|
-
end
|
81
|
+
end
|
@@ -1,16 +1,41 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "ostruct"
|
2
4
|
|
3
5
|
module FlowClient
|
4
6
|
module CadenceType
|
7
|
+
# Returns an OpenStruct representing a Cadence String type
|
8
|
+
#
|
9
|
+
# @example
|
10
|
+
# @arg = FlowClient::CadenceType.String("Hello world!")
|
11
|
+
#
|
12
|
+
# @param [String] the string value
|
13
|
+
#
|
14
|
+
# @returns [OpenStruct] the Cadence String struct
|
5
15
|
def self.String(value)
|
6
16
|
OpenStruct.new(type: "String", value: value.to_s)
|
7
17
|
end
|
8
18
|
|
19
|
+
# Returns an OpenStruct representing a Cadence Optional type
|
20
|
+
#
|
21
|
+
# @example
|
22
|
+
# @arg = FlowClient::CadenceType.Optional("Hello world!")
|
23
|
+
# @arg = FlowClient::CadenceType.Optional()
|
24
|
+
#
|
25
|
+
# @param [String] the string value
|
26
|
+
#
|
27
|
+
# @returns [OpenStruct] the Cadence Optional struct
|
9
28
|
def self.Optional(value = nil)
|
10
29
|
OpenStruct.new(type: "Optional", value: value)
|
11
30
|
end
|
12
31
|
|
13
|
-
|
32
|
+
# Returns an OpenStruct representing a Cadence Void type
|
33
|
+
#
|
34
|
+
# @example
|
35
|
+
# @arg = FlowClient::CadenceType.Void()
|
36
|
+
#
|
37
|
+
# @returns [OpenStruct] the Cadence Void struct
|
38
|
+
def self.Void
|
14
39
|
OpenStruct.new(type: "Void")
|
15
40
|
end
|
16
41
|
|
@@ -62,14 +87,6 @@ module FlowClient
|
|
62
87
|
OpenStruct.new(type: "UInt64", value: value.to_s)
|
63
88
|
end
|
64
89
|
|
65
|
-
def self.Int64(value)
|
66
|
-
OpenStruct.new(type: "Int64", value: value.to_s)
|
67
|
-
end
|
68
|
-
|
69
|
-
def self.UInt64(value)
|
70
|
-
OpenStruct.new(type: "UInt64", value: value.to_s)
|
71
|
-
end
|
72
|
-
|
73
90
|
def self.Int128(value)
|
74
91
|
OpenStruct.new(type: "Int128", value: value.to_s)
|
75
92
|
end
|
@@ -123,9 +140,9 @@ module FlowClient
|
|
123
140
|
end
|
124
141
|
|
125
142
|
def self.Path(domain, identifier)
|
126
|
-
|
127
|
-
"Domain can only be one of storage, private or public"
|
128
|
-
|
143
|
+
unless %w[storage private public].include? domain.to_s.downcase
|
144
|
+
raise raise ArgumentError, "Domain can only be one of storage, private or public"
|
145
|
+
end
|
129
146
|
|
130
147
|
OpenStruct.new(
|
131
148
|
type: "Path",
|
@@ -149,8 +166,11 @@ module FlowClient
|
|
149
166
|
end
|
150
167
|
|
151
168
|
def self.Composite(type, value)
|
152
|
-
valid_types = [
|
153
|
-
|
169
|
+
valid_types = %i[struct resource event contract enum]
|
170
|
+
unless valid_types.include? type
|
171
|
+
raise ArgumentError, "incorrect type, expected :struct, :resource, :event, :contract or :enum"
|
172
|
+
end
|
173
|
+
|
154
174
|
OpenStruct.new(type: type.to_s.capitalize, value: value)
|
155
175
|
end
|
156
176
|
|
@@ -162,4 +182,4 @@ module FlowClient
|
|
162
182
|
OpenStruct.new(name: name, value: value)
|
163
183
|
end
|
164
184
|
end
|
165
|
-
end
|
185
|
+
end
|
data/lib/flow_client/client.rb
CHANGED
@@ -31,6 +31,8 @@ module FlowClient
|
|
31
31
|
# Returns an account for the address specified at the latest
|
32
32
|
# block.
|
33
33
|
#
|
34
|
+
# @param [String] the address string value
|
35
|
+
#
|
34
36
|
# @return [FlowClient::Account] the account
|
35
37
|
def get_account(address)
|
36
38
|
req = Access::GetAccountAtLatestBlockRequest.new(address: to_bytes(address))
|
@@ -252,6 +254,8 @@ module FlowClient
|
|
252
254
|
|
253
255
|
# Returns the latest with height
|
254
256
|
#
|
257
|
+
# @param [Integer] block height
|
258
|
+
#
|
255
259
|
# @return [FlowClient::Block] the block
|
256
260
|
def get_block_by_height(height)
|
257
261
|
req = Access::GetBlockByHeightRequest.new(
|
@@ -265,6 +269,8 @@ module FlowClient
|
|
265
269
|
|
266
270
|
# Returns the collection with id
|
267
271
|
#
|
272
|
+
# @param [String] collection id
|
273
|
+
#
|
268
274
|
# @return [FlowClient::Collection] the collection
|
269
275
|
def get_collection_by_id(id)
|
270
276
|
req = Access::GetCollectionByIDRequest.new(
|
@@ -276,7 +282,13 @@ module FlowClient
|
|
276
282
|
|
277
283
|
# :section: Events
|
278
284
|
|
279
|
-
# Returns events of the given type between the start and end block heights
|
285
|
+
# Returns events of the given type between the start and end block heights
|
286
|
+
#
|
287
|
+
# @param [String] event name
|
288
|
+
# @param [Integer] start block height
|
289
|
+
# @param [Integer] end block height
|
290
|
+
#
|
291
|
+
# @return [FlowClient::EventsResult] the events response
|
280
292
|
def get_events(type, start_height, end_height)
|
281
293
|
req = Access::GetEventsForHeightRangeRequest.new(
|
282
294
|
type: type,
|
data/lib/flow_client/crypto.rb
CHANGED
@@ -19,7 +19,7 @@ module FlowClient
|
|
19
19
|
def self.sign(data, private_key_hex, hash_algo = HashAlgos::SHA3_256)
|
20
20
|
ssl_key = FlowClient::Crypto.key_from_hex_keys(private_key_hex)
|
21
21
|
# TODO: Fix this so that both hashing algos will work
|
22
|
-
asn = ssl_key.dsa_sign_asn1(OpenSSL::Digest.digest(
|
22
|
+
asn = ssl_key.dsa_sign_asn1(OpenSSL::Digest.digest(hash_algo, data))
|
23
23
|
r, s = OpenSSL::ASN1.decode(asn).value
|
24
24
|
combined_bytes = Utils.left_pad_bytes([r.value.to_s(16)].pack("H*").unpack("C*"), 32) +
|
25
25
|
Utils.left_pad_bytes([s.value.to_s(16)].pack("H*").unpack("C*"), 32)
|
@@ -46,7 +46,7 @@ module FlowClient
|
|
46
46
|
# Crypto::Curves::SECP256K1
|
47
47
|
#
|
48
48
|
# The 04 prefix indicating that the public key is uncompressed is stripped.
|
49
|
-
# https://datatracker.ietf.org/doc/html/rfc5480
|
49
|
+
# @see https://datatracker.ietf.org/doc/html/rfc5480
|
50
50
|
#
|
51
51
|
# Usage example:
|
52
52
|
# private_key, public_key = FlowClient::Crypto.generate_key_pair(FlowClient::Crypto::Curves::P256)
|
data/lib/flow_client/event.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module FlowClient
|
2
4
|
class EventsResult
|
3
5
|
attr_accessor :block_id,
|
@@ -9,7 +11,7 @@ module FlowClient
|
|
9
11
|
@block_id = nil
|
10
12
|
@block_height = nil
|
11
13
|
@events = nil
|
12
|
-
@block_timestamp= nil
|
14
|
+
@block_timestamp = nil
|
13
15
|
end
|
14
16
|
|
15
17
|
def self.parse_grpc_type(type)
|
@@ -28,7 +30,7 @@ module FlowClient
|
|
28
30
|
:transaction_index,
|
29
31
|
:event_index,
|
30
32
|
:payload
|
31
|
-
|
33
|
+
|
32
34
|
def initialize
|
33
35
|
@type = nil
|
34
36
|
@transaction_id = nil
|
@@ -47,4 +49,4 @@ module FlowClient
|
|
47
49
|
event
|
48
50
|
end
|
49
51
|
end
|
50
|
-
end
|
52
|
+
end
|
@@ -16,11 +16,9 @@ module FlowClient
|
|
16
16
|
:payer_address,
|
17
17
|
:authorizer_addresses,
|
18
18
|
:address_aliases,
|
19
|
+
:proposal_key,
|
19
20
|
:envelope_signatures,
|
20
|
-
:payload_signatures
|
21
|
-
:proposal_key
|
22
|
-
|
23
|
-
attr_reader :envelope_signatures, :payload_signatures
|
21
|
+
:payload_signatures
|
24
22
|
|
25
23
|
def initialize
|
26
24
|
@authorizer_addresses = []
|
@@ -36,7 +34,7 @@ module FlowClient
|
|
36
34
|
|
37
35
|
def arguments=(arguments)
|
38
36
|
arguments.to_a.each do |arg|
|
39
|
-
processed_arg = arg.
|
37
|
+
processed_arg = arg.instance_of?(OpenStruct) ? Utils.openstruct_to_json(arg) : arg
|
40
38
|
@arguments << processed_arg
|
41
39
|
end
|
42
40
|
end
|
@@ -107,7 +105,7 @@ module FlowClient
|
|
107
105
|
end
|
108
106
|
|
109
107
|
protected
|
110
|
-
|
108
|
+
|
111
109
|
def resolved_script
|
112
110
|
FlowClient::Utils.substitute_address_aliases(@script, @address_aliases)
|
113
111
|
end
|
@@ -189,4 +187,4 @@ module FlowClient
|
|
189
187
|
response
|
190
188
|
end
|
191
189
|
end
|
192
|
-
end
|
190
|
+
end
|
data/lib/flow_client/utils.rb
CHANGED
@@ -47,18 +47,7 @@ module FlowClient
|
|
47
47
|
|
48
48
|
def self.openstruct_to_json(struct)
|
49
49
|
struct.deep_to_h.to_json
|
50
|
-
# struct.each_pair.map do |key, value|
|
51
|
-
# [
|
52
|
-
# key,
|
53
|
-
# case value
|
54
|
-
# when OpenStruct then value.deep_to_h
|
55
|
-
# when Array then value.map {|el| el.class == OpenStruct ? el.deep_to_h : el}
|
56
|
-
# else value
|
57
|
-
# end
|
58
|
-
# ]
|
59
|
-
# end.to_h.to_json
|
60
50
|
end
|
61
|
-
|
62
51
|
end
|
63
52
|
end
|
64
53
|
|
data/lib/flow_client/version.rb
CHANGED
data/lib/flow_client.rb
CHANGED
data/template.md
CHANGED
@@ -669,7 +669,7 @@ After a transaction has been [built](#build-transactions) and [signed](#sign-tra
|
|
669
669
|
```ruby
|
670
670
|
tx_res = client.send_transaction(@transaction)
|
671
671
|
client.wait_for_transaction(tx_res.id) do |response|
|
672
|
-
|
672
|
+
# use response here
|
673
673
|
end
|
674
674
|
```
|
675
675
|
|
@@ -706,7 +706,7 @@ signer = FlowClient::LocalSigner.new("4d9287571c8bff7482ffc27ef68d5b4990f9bd009a
|
|
706
706
|
# Generate a public key for the new account
|
707
707
|
_private_key, public_key = FlowClient::Crypto.generate_key_pair(FlowClient::Crypto::Curves::P256)
|
708
708
|
# Create the account
|
709
|
-
|
709
|
+
new_account = client.create_account([public_key], { "ContractName": "<contract cadence code>" }, payer_account, signer)
|
710
710
|
```
|
711
711
|
|
712
712
|
```ruby
|
@@ -722,7 +722,8 @@ After the account creation transaction has been submitted you can retrieve the n
|
|
722
722
|
The new account address will be emitted in a system-level `flow.AccountCreated` event.
|
723
723
|
|
724
724
|
```ruby
|
725
|
-
|
725
|
+
new_account = client.create_account([public_key], { "ContractName": "<contract cadence code>" }, payer_account, signer)
|
726
|
+
new_account.address
|
726
727
|
```
|
727
728
|
|
728
729
|
### Generate Keys
|
metadata
CHANGED
@@ -1,79 +1,93 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flow_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nico du Plessis
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-09-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: grpc
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 1.48.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 1.48.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: grpc-tools
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 1.48.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 1.48.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: json
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 2.6.2
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: 2.6.2
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: openssl
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: 3.0.0
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
68
|
+
version: 3.0.0
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rlp
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 0.7.3
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 0.7.3
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: simplecov
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
72
86
|
requirements:
|
73
87
|
- - ">="
|
74
88
|
- !ruby/object:Gem::Version
|
75
89
|
version: '0'
|
76
|
-
type: :
|
90
|
+
type: :development
|
77
91
|
prerelease: false
|
78
92
|
version_requirements: !ruby/object:Gem::Requirement
|
79
93
|
requirements:
|
@@ -94,6 +108,7 @@ files:
|
|
94
108
|
- CHANGELOG.md
|
95
109
|
- CODE_OF_CONDUCT.md
|
96
110
|
- Gemfile
|
111
|
+
- Gemfile.lock
|
97
112
|
- Guardfile
|
98
113
|
- LICENSE.txt
|
99
114
|
- README.md
|
@@ -155,7 +170,7 @@ metadata:
|
|
155
170
|
homepage_uri: https://github.com/glucode/flow_client
|
156
171
|
source_code_uri: https://github.com/glucode/flow_client
|
157
172
|
changelog_uri: https://github.com/glucode/flow_client
|
158
|
-
post_install_message:
|
173
|
+
post_install_message:
|
159
174
|
rdoc_options: []
|
160
175
|
require_paths:
|
161
176
|
- lib
|
@@ -163,15 +178,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
163
178
|
requirements:
|
164
179
|
- - ">="
|
165
180
|
- !ruby/object:Gem::Version
|
166
|
-
version: 2.
|
181
|
+
version: 2.7.2
|
167
182
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
168
183
|
requirements:
|
169
184
|
- - ">="
|
170
185
|
- !ruby/object:Gem::Version
|
171
186
|
version: '0'
|
172
187
|
requirements: []
|
173
|
-
rubygems_version: 3.
|
174
|
-
signing_key:
|
188
|
+
rubygems_version: 3.3.20
|
189
|
+
signing_key:
|
175
190
|
specification_version: 4
|
176
191
|
summary: A Ruby client for the Flow blockchain
|
177
192
|
test_files: []
|