flow_client 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -5
- data/README.md +28 -9
- data/lib/flow_client/client.rb +1 -1
- data/lib/flow_client/transaction.rb +1 -0
- data/lib/flow_client/utils.rb +1 -1
- data/lib/flow_client/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 77827a004fe0125e3476d61a0f50a93d4d27d69e7212ba72415650568efc34a6
|
4
|
+
data.tar.gz: 5d7a508b6113ba6ee5822ef729f165552186b4b4b961305b2deb395356705850
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4931c719ba25d3114cca80f94b5417c0f8347bb192cd9796250b6eda7cc290aa37dee0bef5cc2ec2a14ebde548c5916998b639dcce1dfbd3d95b52fded0a3e1f
|
7
|
+
data.tar.gz: e73cc7e7dd2d2ae170d55b821cf930816d6f9a640ecf16be396c482a963d262790d0b40c6844f3561152fa498fd898104fdad7c252b660fe9dba67d4148a4149
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
flow_client (0.1.
|
4
|
+
flow_client (0.1.1)
|
5
5
|
digest-sha3
|
6
6
|
ecdsa
|
7
7
|
grpc
|
@@ -22,15 +22,11 @@ GEM
|
|
22
22
|
ffi (1.15.3)
|
23
23
|
formatador (0.3.0)
|
24
24
|
google-protobuf (3.17.3-universal-darwin)
|
25
|
-
google-protobuf (3.17.3-x86_64-linux)
|
26
25
|
googleapis-common-protos-types (1.1.0)
|
27
26
|
google-protobuf (~> 3.14)
|
28
27
|
grpc (1.38.0-universal-darwin)
|
29
28
|
google-protobuf (~> 3.15)
|
30
29
|
googleapis-common-protos-types (~> 1.0)
|
31
|
-
grpc (1.38.0-x86_64-linux)
|
32
|
-
google-protobuf (~> 3.15)
|
33
|
-
googleapis-common-protos-types (~> 1.0)
|
34
30
|
grpc-tools (1.38.0)
|
35
31
|
guard (2.17.0)
|
36
32
|
formatador (>= 0.2.4)
|
data/README.md
CHANGED
@@ -1,15 +1,25 @@
|
|
1
1
|
# FlowClient
|
2
2
|
|
3
|
-
FlowClient is a Ruby gRPC client for
|
3
|
+
FlowClient is a Ruby gRPC client for Flow (onflow.org)
|
4
4
|
|
5
|
-
|
5
|
+
#### Accounts
|
6
6
|
- [x] Get account information
|
7
|
-
|
8
|
-
|
9
|
-
- [
|
7
|
+
|
8
|
+
#### Scripts
|
9
|
+
- [x] Execute scripts
|
10
|
+
|
11
|
+
#### Transactions
|
12
|
+
- [x] Send a transaction
|
13
|
+
- [x] Get a transaction
|
14
|
+
- [x] Single account signing
|
15
|
+
- [ ] Multi account signing
|
10
16
|
- [ ] secp256k1 keys
|
11
17
|
- [x] prime256v1 keys
|
12
18
|
|
19
|
+
### Flow Data
|
20
|
+
- [x] Get events
|
21
|
+
- [x] Get block
|
22
|
+
|
13
23
|
## Installation
|
14
24
|
|
15
25
|
Add this line to your application's Gemfile:
|
@@ -31,10 +41,19 @@ Or install it yourself as:
|
|
31
41
|
```ruby
|
32
42
|
# Connect to the Flow testnet
|
33
43
|
client = FlowClient::Client.new("access.devnet.nodes.onflow.org:9000")
|
34
|
-
|
35
|
-
# Ping the blockchain
|
36
44
|
res = client.ping
|
45
|
+
```
|
46
|
+
### Events
|
37
47
|
|
48
|
+
```ruby
|
49
|
+
get_events(type, start_height, end_height)
|
50
|
+
res = client.get_events("A.0b2a3299cc857e29.TopShot.Deposit", 12913388, 12913389)
|
51
|
+
```
|
52
|
+
|
53
|
+
### Scripts
|
54
|
+
|
55
|
+
```ruby
|
56
|
+
args = [{ type: "Address", value: "0xAlice" }.to_json]
|
38
57
|
# Execute a Cadence script
|
39
58
|
res = client.execute_script(script, args)
|
40
59
|
```
|
@@ -51,13 +70,13 @@ transaction.arguments = [
|
|
51
70
|
{ type: "Address", value: user_address }.to_json
|
52
71
|
]
|
53
72
|
transaction.proposer_key_sequence_number = sequence_number
|
54
|
-
transaction.payer_address = "
|
73
|
+
transaction.payer_address = "0xAlice"
|
55
74
|
transaction.authorizer_addresses = ["0xAlice"]
|
56
75
|
transaction.add_envelope_signature("0xAlice", 0, key)
|
57
76
|
res = client.send_transaction(transaction)
|
58
77
|
```
|
59
78
|
|
60
|
-
### Address
|
79
|
+
### Address Alias Resolution
|
61
80
|
|
62
81
|
Using address aliases is handy for switching between different environments.
|
63
82
|
|
data/lib/flow_client/client.rb
CHANGED
@@ -62,7 +62,7 @@ module FlowClient
|
|
62
62
|
def send_transaction(transaction)
|
63
63
|
transaction.address_aliases = @address_aliases
|
64
64
|
req = Access::SendTransactionRequest.new(
|
65
|
-
transaction: transaction.
|
65
|
+
transaction: transaction.to_protobuf_message
|
66
66
|
)
|
67
67
|
@stub.send_transaction(req)
|
68
68
|
end
|
data/lib/flow_client/utils.rb
CHANGED
@@ -30,7 +30,7 @@ module FlowClient
|
|
30
30
|
def self.substitute_address_aliases(script_or_transaction, aliases = {})
|
31
31
|
new_string = script_or_transaction
|
32
32
|
aliases.each do |key, value|
|
33
|
-
new_string = new_string.gsub(
|
33
|
+
new_string = new_string.gsub(key.to_s, value.to_s)
|
34
34
|
end
|
35
35
|
new_string
|
36
36
|
end
|
data/lib/flow_client/version.rb
CHANGED