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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 87ed7168d26cbb7536a092ffcadf3dc4bd904e435b645d77613b234de57b2814
4
- data.tar.gz: '0597dab8df420ebf1fbd725d1c66c2dca400139e5081cd650f92ad0e584fb974'
3
+ metadata.gz: 77827a004fe0125e3476d61a0f50a93d4d27d69e7212ba72415650568efc34a6
4
+ data.tar.gz: 5d7a508b6113ba6ee5822ef729f165552186b4b4b961305b2deb395356705850
5
5
  SHA512:
6
- metadata.gz: a7eb018463210fd5fd26074070fa62395e1e21008b66926421c04181d91f93e405a8196721e5a4383d1ba25f909695300a5a5245233574043d1ce4d9912befc7
7
- data.tar.gz: 0df2fd04cfcfb19da4552261fa6ec44288b8e3bc806620cedd45496734255d3e71c340335a7bb1e4e1fc6f29ebb9941ce30fb3dd6d4a760d9c1c8c6572f50cd5
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.0)
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 the Flow blockchain (onflow.org)
3
+ FlowClient is a Ruby gRPC client for Flow (onflow.org)
4
4
 
5
- - [x] Ping the blockchain
5
+ #### Accounts
6
6
  - [x] Get account information
7
- - [x] Execute a script
8
- - [x] Single signature transactions
9
- - [ ] Multi signature transactions
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 = "76ecd94a2bb02327"
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 alias resolution
79
+ ### Address Alias Resolution
61
80
 
62
81
  Using address aliases is handy for switching between different environments.
63
82
 
@@ -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.message
65
+ transaction: transaction.to_protobuf_message
66
66
  )
67
67
  @stub.send_transaction(req)
68
68
  end
@@ -136,6 +136,7 @@ module FlowClient
136
136
  end
137
137
 
138
138
  protected
139
+
139
140
  def resolved_script
140
141
  FlowClient::Utils.substitute_address_aliases(@script, @address_aliases)
141
142
  end
@@ -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("#{key}", "#{value}")
33
+ new_string = new_string.gsub(key.to_s, value.to_s)
34
34
  end
35
35
  new_string
36
36
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FlowClient
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flow_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nico du Plessis