flow_client 0.2.3-arm64-darwin-21

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.
Files changed (64) hide show
  1. checksums.yaml +7 -0
  2. data/.github/workflows/ruby.yml +37 -0
  3. data/.gitignore +13 -0
  4. data/.rspec +3 -0
  5. data/.rubocop.yml +26 -0
  6. data/CHANGELOG.md +24 -0
  7. data/CODE_OF_CONDUCT.md +84 -0
  8. data/Gemfile +12 -0
  9. data/Gemfile.lock +114 -0
  10. data/Guardfile +79 -0
  11. data/LICENSE.txt +21 -0
  12. data/README.md +747 -0
  13. data/Rakefile +12 -0
  14. data/bin/console +15 -0
  15. data/bin/setup +8 -0
  16. data/docker-compose.yml +12 -0
  17. data/flow.json +21 -0
  18. data/flow_client.gemspec +44 -0
  19. data/lib/cadence/contracts/NonFungibleToken.cdc +144 -0
  20. data/lib/cadence/templates/add-account-key.cdc +16 -0
  21. data/lib/cadence/templates/add-contract.cdc +5 -0
  22. data/lib/cadence/templates/create-account.cdc +21 -0
  23. data/lib/cadence/templates/remove-contract.cdc +5 -0
  24. data/lib/cadence/templates/update-contract.cdc +5 -0
  25. data/lib/flow/access/access_pb.rb +168 -0
  26. data/lib/flow/access/access_services_pb.rb +96 -0
  27. data/lib/flow/entities/account_pb.rb +30 -0
  28. data/lib/flow/entities/block_header_pb.rb +20 -0
  29. data/lib/flow/entities/block_pb.rb +25 -0
  30. data/lib/flow/entities/block_seal_pb.rb +19 -0
  31. data/lib/flow/entities/collection_pb.rb +23 -0
  32. data/lib/flow/entities/event_pb.rb +20 -0
  33. data/lib/flow/entities/transaction_pb.rb +47 -0
  34. data/lib/flow/execution/execution_pb.rb +65 -0
  35. data/lib/flow/execution/execution_services_pb.rb +43 -0
  36. data/lib/flow/legacy/access/access_pb.rb +157 -0
  37. data/lib/flow/legacy/access/access_services_pb.rb +89 -0
  38. data/lib/flow/legacy/entities/account_pb.rb +28 -0
  39. data/lib/flow/legacy/entities/block_header_pb.rb +20 -0
  40. data/lib/flow/legacy/entities/block_pb.rb +25 -0
  41. data/lib/flow/legacy/entities/block_seal_pb.rb +19 -0
  42. data/lib/flow/legacy/entities/collection_pb.rb +22 -0
  43. data/lib/flow/legacy/entities/event_pb.rb +20 -0
  44. data/lib/flow/legacy/entities/transaction_pb.rb +45 -0
  45. data/lib/flow/legacy/execution/execution_pb.rb +65 -0
  46. data/lib/flow/legacy/execution/execution_services_pb.rb +42 -0
  47. data/lib/flow_client/account.rb +31 -0
  48. data/lib/flow_client/block.rb +81 -0
  49. data/lib/flow_client/cadence_type.rb +185 -0
  50. data/lib/flow_client/client.rb +387 -0
  51. data/lib/flow_client/collection.rb +35 -0
  52. data/lib/flow_client/crypto.rb +62 -0
  53. data/lib/flow_client/event.rb +52 -0
  54. data/lib/flow_client/proposal_key.rb +23 -0
  55. data/lib/flow_client/signature.rb +23 -0
  56. data/lib/flow_client/signer.rb +22 -0
  57. data/lib/flow_client/transaction.rb +190 -0
  58. data/lib/flow_client/utils.rb +67 -0
  59. data/lib/flow_client/version.rb +5 -0
  60. data/lib/flow_client.rb +22 -0
  61. data/logo.svg +121 -0
  62. data/logo@2x.png +0 -0
  63. data/template.md +748 -0
  64. metadata +192 -0
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ require "rubocop/rake_task"
9
+
10
+ RuboCop::RakeTask.new
11
+
12
+ task default: %i[spec rubocop]
data/bin/console ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "bundler/setup"
5
+ require "flow_client"
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require "irb"
15
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,12 @@
1
+ version: "3"
2
+ services:
3
+ emulator:
4
+ image: gcr.io/flow-container-registry/emulator:latest
5
+ ports:
6
+ - "8080:8080"
7
+ - "3569:3569"
8
+ environment:
9
+ - FLOW_SERVICEPRIVATEKEY=4d9287571c8bff7482ffc27ef68d5b4990f9bd009a1e9fa812aae08ba167d57f
10
+ - FLOW_SERVICEKEYSIGALGO=ECDSA_P256
11
+ - FLOW_SERVICEKEYHASHALGO=SHA3_256
12
+ - FLOW_VERBOSE=true
data/flow.json ADDED
@@ -0,0 +1,21 @@
1
+ {
2
+ "emulators": {
3
+ "default": {
4
+ "port": 3569,
5
+ "serviceAccount": "emulator-account"
6
+ }
7
+ },
8
+ "contracts": {},
9
+ "networks": {
10
+ "emulator": "127.0.0.1:3569",
11
+ "mainnet": "access.mainnet.nodes.onflow.org:9000",
12
+ "testnet": "access.devnet.nodes.onflow.org:9000"
13
+ },
14
+ "accounts": {
15
+ "emulator-account": {
16
+ "address": "f8d6e0586b0a20c7",
17
+ "key": "38a7eef2053e165c2d635fb471fb26c91d9da2914a8f13c58ec210412adb2067"
18
+ }
19
+ },
20
+ "deployments": {}
21
+ }
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/flow_client/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "flow_client"
7
+ spec.version = FlowClient::VERSION
8
+ spec.authors = ["Nico du Plessis"]
9
+ spec.email = ["nico@glucode.com"]
10
+ spec.summary = "A Ruby client for the Flow blockchain"
11
+ spec.description = "A Ruby client for the Flow blockchain"
12
+ spec.homepage = "https://github.com/glucode/flow_client"
13
+ spec.license = "MIT"
14
+ spec.required_ruby_version = ">= 2.7.2"
15
+
16
+ # spec.metadata["allowed_push_host"] = "TODO: Set to 'https://mygemserver.com'"
17
+
18
+ spec.metadata["homepage_uri"] = spec.homepage
19
+ spec.metadata["source_code_uri"] = "https://github.com/glucode/flow_client"
20
+ spec.metadata["changelog_uri"] = "https://github.com/glucode/flow_client"
21
+
22
+ # Specify which files should be added to the gem when it is released.
23
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
24
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
25
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
26
+ end
27
+ spec.bindir = "exe"
28
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
29
+ spec.require_paths = ["lib"]
30
+
31
+ # Uncomment to register a new dependency of your gem
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"
39
+
40
+ # For more information and examples about making a new gem, checkout our
41
+ # guide at: https://bundler.io/guides/creating_gem.html
42
+
43
+ spec.platform = Gem::Platform::CURRENT
44
+ end
@@ -0,0 +1,144 @@
1
+ /**
2
+
3
+ ## The Flow Non-Fungible Token standard
4
+
5
+ ## `NonFungibleToken` contract interface
6
+
7
+ The interface that all non-fungible token contracts could conform to.
8
+ If a user wants to deploy a new nft contract, their contract would need
9
+ to implement the NonFungibleToken interface.
10
+
11
+ Their contract would have to follow all the rules and naming
12
+ that the interface specifies.
13
+
14
+ ## `NFT` resource
15
+
16
+ The core resource type that represents an NFT in the smart contract.
17
+
18
+ ## `Collection` Resource
19
+
20
+ The resource that stores a user's NFT collection.
21
+ It includes a few functions to allow the owner to easily
22
+ move tokens in and out of the collection.
23
+
24
+ ## `Provider` and `Receiver` resource interfaces
25
+
26
+ These interfaces declare functions with some pre and post conditions
27
+ that require the Collection to follow certain naming and behavior standards.
28
+
29
+ They are separate because it gives the user the ability to share a reference
30
+ to their Collection that only exposes the fields and functions in one or more
31
+ of the interfaces. It also gives users the ability to make custom resources
32
+ that implement these interfaces to do various things with the tokens.
33
+
34
+ By using resources and interfaces, users of NFT smart contracts can send
35
+ and receive tokens peer-to-peer, without having to interact with a central ledger
36
+ smart contract.
37
+
38
+ To send an NFT to another user, a user would simply withdraw the NFT
39
+ from their Collection, then call the deposit function on another user's
40
+ Collection to complete the transfer.
41
+
42
+ */
43
+
44
+ // The main NFT contract interface. Other NFT contracts will
45
+ // import and implement this interface
46
+ //
47
+ pub contract interface NonFungibleToken {
48
+
49
+ // The total number of tokens of this type in existence
50
+ pub var totalSupply: UInt64
51
+
52
+ // Event that emitted when the NFT contract is initialized
53
+ //
54
+ pub event ContractInitialized()
55
+
56
+ // Event that is emitted when a token is withdrawn,
57
+ // indicating the owner of the collection that it was withdrawn from.
58
+ //
59
+ // If the collection is not in an account's storage, `from` will be `nil`.
60
+ //
61
+ pub event Withdraw(id: UInt64, from: Address?)
62
+
63
+ // Event that emitted when a token is deposited to a collection.
64
+ //
65
+ // It indicates the owner of the collection that it was deposited to.
66
+ //
67
+ pub event Deposit(id: UInt64, to: Address?)
68
+
69
+ // Interface that the NFTs have to conform to
70
+ //
71
+ pub resource interface INFT {
72
+ // The unique ID that each NFT has
73
+ pub let id: UInt64
74
+ }
75
+
76
+ // Requirement that all conforming NFT smart contracts have
77
+ // to define a resource called NFT that conforms to INFT
78
+ pub resource NFT: INFT {
79
+ pub let id: UInt64
80
+ }
81
+
82
+ // Interface to mediate withdraws from the Collection
83
+ //
84
+ pub resource interface Provider {
85
+ // withdraw removes an NFT from the collection and moves it to the caller
86
+ pub fun withdraw(withdrawID: UInt64): @NFT {
87
+ post {
88
+ result.id == withdrawID: "The ID of the withdrawn token must be the same as the requested ID"
89
+ }
90
+ }
91
+ }
92
+
93
+ // Interface to mediate deposits to the Collection
94
+ //
95
+ pub resource interface Receiver {
96
+
97
+ // deposit takes an NFT as an argument and adds it to the Collection
98
+ //
99
+ pub fun deposit(token: @NFT)
100
+ }
101
+
102
+ // Interface that an account would commonly
103
+ // publish for their collection
104
+ pub resource interface CollectionPublic {
105
+ pub fun deposit(token: @NFT)
106
+ pub fun getIDs(): [UInt64]
107
+ pub fun borrowNFT(id: UInt64): &NFT
108
+ }
109
+
110
+ // Requirement for the the concrete resource type
111
+ // to be declared in the implementing contract
112
+ //
113
+ pub resource Collection: Provider, Receiver, CollectionPublic {
114
+
115
+ // Dictionary to hold the NFTs in the Collection
116
+ pub var ownedNFTs: @{UInt64: NFT}
117
+
118
+ // withdraw removes an NFT from the collection and moves it to the caller
119
+ pub fun withdraw(withdrawID: UInt64): @NFT
120
+
121
+ // deposit takes a NFT and adds it to the collections dictionary
122
+ // and adds the ID to the id array
123
+ pub fun deposit(token: @NFT)
124
+
125
+ // getIDs returns an array of the IDs that are in the collection
126
+ pub fun getIDs(): [UInt64]
127
+
128
+ // Returns a borrowed reference to an NFT in the collection
129
+ // so that the caller can read data and call methods from it
130
+ pub fun borrowNFT(id: UInt64): &NFT {
131
+ pre {
132
+ self.ownedNFTs[id] != nil: "NFT does not exist in the collection!"
133
+ }
134
+ }
135
+ }
136
+
137
+ // createEmptyCollection creates an empty Collection
138
+ // and returns it to the caller so that they can own NFTs
139
+ pub fun createEmptyCollection(): @Collection {
140
+ post {
141
+ result.getIDs().length == 0: "The created collection must be empty!"
142
+ }
143
+ }
144
+ }
@@ -0,0 +1,16 @@
1
+ transaction(publicKey: String, weight: UFix64) {
2
+ prepare(signer: AuthAccount) {
3
+ // signer.addPublicKey(publicKey.decodeHex())
4
+
5
+ let key = PublicKey(
6
+ publicKey: publicKey.decodeHex(),
7
+ signatureAlgorithm: SignatureAlgorithm.ECDSA_P256
8
+ )
9
+
10
+ signer.keys.add(
11
+ publicKey: key,
12
+ hashAlgorithm: HashAlgorithm.SHA3_256,
13
+ weight: weight
14
+ )
15
+ }
16
+ }
@@ -0,0 +1,5 @@
1
+ transaction(name: String, code: String) {
2
+ prepare(signer: AuthAccount) {
3
+ signer.contracts.add(name: name, code: code.decodeHex())
4
+ }
5
+ }
@@ -0,0 +1,21 @@
1
+ transaction(publicKeys: [String], contracts: {String: String}) {
2
+ prepare(signer: AuthAccount) {
3
+ let acct = AuthAccount(payer: signer)
4
+ for keyHex in publicKeys {
5
+ let key = PublicKey(
6
+ publicKey: keyHex.decodeHex(),
7
+ signatureAlgorithm: SignatureAlgorithm.ECDSA_P256
8
+ )
9
+
10
+ acct.keys.add(
11
+ publicKey: key,
12
+ hashAlgorithm: HashAlgorithm.SHA3_256,
13
+ weight: 1000.0
14
+ )
15
+ }
16
+
17
+ for contract in contracts.keys {
18
+ acct.contracts.add(name: contract, code: contracts[contract]!.decodeHex())
19
+ }
20
+ }
21
+ }
@@ -0,0 +1,5 @@
1
+ transaction(name: String) {
2
+ prepare(signer: AuthAccount) {
3
+ signer.contracts.remove(name: name)
4
+ }
5
+ }
@@ -0,0 +1,5 @@
1
+ transaction(name: String, code: String) {
2
+ prepare(signer: AuthAccount) {
3
+ signer.contracts.update__experimental(name: name, code: code.decodeHex())
4
+ }
5
+ }
@@ -0,0 +1,168 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # source: flow/access/access.proto
3
+
4
+ require 'google/protobuf'
5
+
6
+ require 'flow/entities/account_pb'
7
+ require 'flow/entities/block_header_pb'
8
+ require 'flow/entities/block_pb'
9
+ require 'flow/entities/collection_pb'
10
+ require 'flow/entities/event_pb'
11
+ require 'flow/entities/transaction_pb'
12
+ require 'google/protobuf/timestamp_pb'
13
+ Google::Protobuf::DescriptorPool.generated_pool.build do
14
+ add_file("flow/access/access.proto", :syntax => :proto3) do
15
+ add_message "flow.access.PingRequest" do
16
+ end
17
+ add_message "flow.access.PingResponse" do
18
+ end
19
+ add_message "flow.access.GetLatestBlockHeaderRequest" do
20
+ optional :is_sealed, :bool, 1
21
+ end
22
+ add_message "flow.access.GetBlockHeaderByIDRequest" do
23
+ optional :id, :bytes, 1
24
+ end
25
+ add_message "flow.access.GetBlockHeaderByHeightRequest" do
26
+ optional :height, :uint64, 1
27
+ end
28
+ add_message "flow.access.BlockHeaderResponse" do
29
+ optional :block, :message, 1, "flow.entities.BlockHeader"
30
+ end
31
+ add_message "flow.access.GetLatestBlockRequest" do
32
+ optional :is_sealed, :bool, 1
33
+ end
34
+ add_message "flow.access.GetBlockByIDRequest" do
35
+ optional :id, :bytes, 1
36
+ end
37
+ add_message "flow.access.GetBlockByHeightRequest" do
38
+ optional :height, :uint64, 1
39
+ end
40
+ add_message "flow.access.BlockResponse" do
41
+ optional :block, :message, 1, "flow.entities.Block"
42
+ end
43
+ add_message "flow.access.GetCollectionByIDRequest" do
44
+ optional :id, :bytes, 1
45
+ end
46
+ add_message "flow.access.CollectionResponse" do
47
+ optional :collection, :message, 1, "flow.entities.Collection"
48
+ end
49
+ add_message "flow.access.SendTransactionRequest" do
50
+ optional :transaction, :message, 1, "flow.entities.Transaction"
51
+ end
52
+ add_message "flow.access.SendTransactionResponse" do
53
+ optional :id, :bytes, 1
54
+ end
55
+ add_message "flow.access.GetTransactionRequest" do
56
+ optional :id, :bytes, 1
57
+ end
58
+ add_message "flow.access.TransactionResponse" do
59
+ optional :transaction, :message, 1, "flow.entities.Transaction"
60
+ end
61
+ add_message "flow.access.TransactionResultResponse" do
62
+ optional :status, :enum, 1, "flow.entities.TransactionStatus"
63
+ optional :status_code, :uint32, 2
64
+ optional :error_message, :string, 3
65
+ repeated :events, :message, 4, "flow.entities.Event"
66
+ optional :block_id, :bytes, 5
67
+ end
68
+ add_message "flow.access.GetAccountRequest" do
69
+ optional :address, :bytes, 1
70
+ end
71
+ add_message "flow.access.GetAccountResponse" do
72
+ optional :account, :message, 1, "flow.entities.Account"
73
+ end
74
+ add_message "flow.access.GetAccountAtLatestBlockRequest" do
75
+ optional :address, :bytes, 1
76
+ end
77
+ add_message "flow.access.AccountResponse" do
78
+ optional :account, :message, 1, "flow.entities.Account"
79
+ end
80
+ add_message "flow.access.GetAccountAtBlockHeightRequest" do
81
+ optional :address, :bytes, 1
82
+ optional :block_height, :uint64, 2
83
+ end
84
+ add_message "flow.access.ExecuteScriptAtLatestBlockRequest" do
85
+ optional :script, :bytes, 1
86
+ repeated :arguments, :bytes, 2
87
+ end
88
+ add_message "flow.access.ExecuteScriptAtBlockIDRequest" do
89
+ optional :block_id, :bytes, 1
90
+ optional :script, :bytes, 2
91
+ repeated :arguments, :bytes, 3
92
+ end
93
+ add_message "flow.access.ExecuteScriptAtBlockHeightRequest" do
94
+ optional :block_height, :uint64, 1
95
+ optional :script, :bytes, 2
96
+ repeated :arguments, :bytes, 3
97
+ end
98
+ add_message "flow.access.ExecuteScriptResponse" do
99
+ optional :value, :bytes, 1
100
+ end
101
+ add_message "flow.access.GetEventsForHeightRangeRequest" do
102
+ optional :type, :string, 1
103
+ optional :start_height, :uint64, 2
104
+ optional :end_height, :uint64, 3
105
+ end
106
+ add_message "flow.access.GetEventsForBlockIDsRequest" do
107
+ optional :type, :string, 1
108
+ repeated :block_ids, :bytes, 2
109
+ end
110
+ add_message "flow.access.EventsResponse" do
111
+ repeated :results, :message, 1, "flow.access.EventsResponse.Result"
112
+ end
113
+ add_message "flow.access.EventsResponse.Result" do
114
+ optional :block_id, :bytes, 1
115
+ optional :block_height, :uint64, 2
116
+ repeated :events, :message, 3, "flow.entities.Event"
117
+ optional :block_timestamp, :message, 4, "google.protobuf.Timestamp"
118
+ end
119
+ add_message "flow.access.GetNetworkParametersRequest" do
120
+ end
121
+ add_message "flow.access.GetNetworkParametersResponse" do
122
+ optional :chain_id, :string, 1
123
+ end
124
+ add_message "flow.access.GetLatestProtocolStateSnapshotRequest" do
125
+ end
126
+ add_message "flow.access.ProtocolStateSnapshotResponse" do
127
+ optional :serializedSnapshot, :bytes, 1
128
+ end
129
+ end
130
+ end
131
+
132
+
133
+ module Access
134
+ PingRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("flow.access.PingRequest").msgclass
135
+ PingResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("flow.access.PingResponse").msgclass
136
+ GetLatestBlockHeaderRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("flow.access.GetLatestBlockHeaderRequest").msgclass
137
+ GetBlockHeaderByIDRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("flow.access.GetBlockHeaderByIDRequest").msgclass
138
+ GetBlockHeaderByHeightRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("flow.access.GetBlockHeaderByHeightRequest").msgclass
139
+ BlockHeaderResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("flow.access.BlockHeaderResponse").msgclass
140
+ GetLatestBlockRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("flow.access.GetLatestBlockRequest").msgclass
141
+ GetBlockByIDRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("flow.access.GetBlockByIDRequest").msgclass
142
+ GetBlockByHeightRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("flow.access.GetBlockByHeightRequest").msgclass
143
+ BlockResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("flow.access.BlockResponse").msgclass
144
+ GetCollectionByIDRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("flow.access.GetCollectionByIDRequest").msgclass
145
+ CollectionResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("flow.access.CollectionResponse").msgclass
146
+ SendTransactionRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("flow.access.SendTransactionRequest").msgclass
147
+ SendTransactionResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("flow.access.SendTransactionResponse").msgclass
148
+ GetTransactionRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("flow.access.GetTransactionRequest").msgclass
149
+ TransactionResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("flow.access.TransactionResponse").msgclass
150
+ TransactionResultResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("flow.access.TransactionResultResponse").msgclass
151
+ GetAccountRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("flow.access.GetAccountRequest").msgclass
152
+ GetAccountResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("flow.access.GetAccountResponse").msgclass
153
+ GetAccountAtLatestBlockRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("flow.access.GetAccountAtLatestBlockRequest").msgclass
154
+ AccountResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("flow.access.AccountResponse").msgclass
155
+ GetAccountAtBlockHeightRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("flow.access.GetAccountAtBlockHeightRequest").msgclass
156
+ ExecuteScriptAtLatestBlockRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("flow.access.ExecuteScriptAtLatestBlockRequest").msgclass
157
+ ExecuteScriptAtBlockIDRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("flow.access.ExecuteScriptAtBlockIDRequest").msgclass
158
+ ExecuteScriptAtBlockHeightRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("flow.access.ExecuteScriptAtBlockHeightRequest").msgclass
159
+ ExecuteScriptResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("flow.access.ExecuteScriptResponse").msgclass
160
+ GetEventsForHeightRangeRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("flow.access.GetEventsForHeightRangeRequest").msgclass
161
+ GetEventsForBlockIDsRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("flow.access.GetEventsForBlockIDsRequest").msgclass
162
+ EventsResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("flow.access.EventsResponse").msgclass
163
+ EventsResponse::Result = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("flow.access.EventsResponse.Result").msgclass
164
+ GetNetworkParametersRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("flow.access.GetNetworkParametersRequest").msgclass
165
+ GetNetworkParametersResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("flow.access.GetNetworkParametersResponse").msgclass
166
+ GetLatestProtocolStateSnapshotRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("flow.access.GetLatestProtocolStateSnapshotRequest").msgclass
167
+ ProtocolStateSnapshotResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("flow.access.ProtocolStateSnapshotResponse").msgclass
168
+ end
@@ -0,0 +1,96 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # Source: flow/access/access.proto for package 'flow.access'
3
+
4
+ require 'grpc'
5
+ require 'flow/access/access_pb'
6
+
7
+ module Access
8
+ module AccessAPI
9
+ # AccessAPI is the public-facing API provided by access nodes.
10
+ class Service
11
+
12
+ include ::GRPC::GenericService
13
+
14
+ self.marshal_class_method = :encode
15
+ self.unmarshal_class_method = :decode
16
+ self.service_name = 'flow.access.AccessAPI'
17
+
18
+ # Ping is used to check if the access node is alive and healthy.
19
+ rpc :Ping, ::Access::PingRequest, ::Access::PingResponse
20
+ # Block Headers
21
+ #
22
+ # GetLatestBlockHeader gets the latest sealed or unsealed block header.
23
+ rpc :GetLatestBlockHeader, ::Access::GetLatestBlockHeaderRequest, ::Access::BlockHeaderResponse
24
+ # GetBlockHeaderByID gets a block header by ID.
25
+ rpc :GetBlockHeaderByID, ::Access::GetBlockHeaderByIDRequest, ::Access::BlockHeaderResponse
26
+ # GetBlockHeaderByHeight gets a block header by height.
27
+ rpc :GetBlockHeaderByHeight, ::Access::GetBlockHeaderByHeightRequest, ::Access::BlockHeaderResponse
28
+ # Blocks
29
+ #
30
+ # GetLatestBlock gets the full payload of the latest sealed or unsealed
31
+ # block.
32
+ rpc :GetLatestBlock, ::Access::GetLatestBlockRequest, ::Access::BlockResponse
33
+ # GetBlockByID gets a full block by ID.
34
+ rpc :GetBlockByID, ::Access::GetBlockByIDRequest, ::Access::BlockResponse
35
+ # GetBlockByHeight gets a full block by height.
36
+ rpc :GetBlockByHeight, ::Access::GetBlockByHeightRequest, ::Access::BlockResponse
37
+ # Collections
38
+ #
39
+ # GetCollectionByID gets a collection by ID.
40
+ rpc :GetCollectionByID, ::Access::GetCollectionByIDRequest, ::Access::CollectionResponse
41
+ # Transactions
42
+ #
43
+ # SendTransaction submits a transaction to the network.
44
+ rpc :SendTransaction, ::Access::SendTransactionRequest, ::Access::SendTransactionResponse
45
+ # GetTransaction gets a transaction by ID.
46
+ rpc :GetTransaction, ::Access::GetTransactionRequest, ::Access::TransactionResponse
47
+ # GetTransactionResult gets the result of a transaction.
48
+ rpc :GetTransactionResult, ::Access::GetTransactionRequest, ::Access::TransactionResultResponse
49
+ # Accounts
50
+ #
51
+ # GetAccount is an alias for GetAccountAtLatestBlock.
52
+ #
53
+ # Warning: this function is deprecated. It behaves identically to
54
+ # GetAccountAtLatestBlock and will be removed in a future version.
55
+ rpc :GetAccount, ::Access::GetAccountRequest, ::Access::GetAccountResponse
56
+ # GetAccountAtLatestBlock gets an account by address from the latest sealed
57
+ # execution state.
58
+ rpc :GetAccountAtLatestBlock, ::Access::GetAccountAtLatestBlockRequest, ::Access::AccountResponse
59
+ # GetAccountAtBlockHeight gets an account by address at the given block
60
+ # height
61
+ rpc :GetAccountAtBlockHeight, ::Access::GetAccountAtBlockHeightRequest, ::Access::AccountResponse
62
+ # Scripts
63
+ #
64
+ # ExecuteScriptAtLatestBlock executes a read-only Cadence script against the
65
+ # latest sealed execution state.
66
+ rpc :ExecuteScriptAtLatestBlock, ::Access::ExecuteScriptAtLatestBlockRequest, ::Access::ExecuteScriptResponse
67
+ # ExecuteScriptAtBlockID executes a ready-only Cadence script against the
68
+ # execution state at the block with the given ID.
69
+ rpc :ExecuteScriptAtBlockID, ::Access::ExecuteScriptAtBlockIDRequest, ::Access::ExecuteScriptResponse
70
+ # ExecuteScriptAtBlockHeight executes a ready-only Cadence script against the
71
+ # execution state at the given block height.
72
+ rpc :ExecuteScriptAtBlockHeight, ::Access::ExecuteScriptAtBlockHeightRequest, ::Access::ExecuteScriptResponse
73
+ # Events
74
+ #
75
+ # GetEventsForHeightRange retrieves events emitted within the specified block
76
+ # range.
77
+ rpc :GetEventsForHeightRange, ::Access::GetEventsForHeightRangeRequest, ::Access::EventsResponse
78
+ # GetEventsForBlockIDs retrieves events for the specified block IDs and event
79
+ # type.
80
+ rpc :GetEventsForBlockIDs, ::Access::GetEventsForBlockIDsRequest, ::Access::EventsResponse
81
+ # NetworkParameters
82
+ #
83
+ # GetNetworkParameters retrieves the Flow network details
84
+ rpc :GetNetworkParameters, ::Access::GetNetworkParametersRequest, ::Access::GetNetworkParametersResponse
85
+ # ProtocolState
86
+ #
87
+ # GetLatestProtocolStateSnapshot retrieves the latest sealed protocol state
88
+ # snapshot. Used by Flow nodes joining the network to bootstrap a
89
+ # space-efficient local state.
90
+ rpc :GetLatestProtocolStateSnapshot, ::Access::GetLatestProtocolStateSnapshotRequest, ::Access::ProtocolStateSnapshotResponse
91
+ end
92
+
93
+ Stub = Service.rpc_stub_class
94
+ end
95
+ end
96
+
@@ -0,0 +1,30 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # source: flow/entities/account.proto
3
+
4
+ require 'google/protobuf'
5
+
6
+ Google::Protobuf::DescriptorPool.generated_pool.build do
7
+ add_file("flow/entities/account.proto", :syntax => :proto3) do
8
+ add_message "flow.entities.Account" do
9
+ optional :address, :bytes, 1
10
+ optional :balance, :uint64, 2
11
+ optional :code, :bytes, 3
12
+ repeated :keys, :message, 4, "flow.entities.AccountKey"
13
+ map :contracts, :string, :bytes, 5
14
+ end
15
+ add_message "flow.entities.AccountKey" do
16
+ optional :index, :uint32, 1
17
+ optional :public_key, :bytes, 2
18
+ optional :sign_algo, :uint32, 3
19
+ optional :hash_algo, :uint32, 4
20
+ optional :weight, :uint32, 5
21
+ optional :sequence_number, :uint32, 6
22
+ optional :revoked, :bool, 7
23
+ end
24
+ end
25
+ end
26
+
27
+ module Entities
28
+ Account = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("flow.entities.Account").msgclass
29
+ AccountKey = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("flow.entities.AccountKey").msgclass
30
+ end
@@ -0,0 +1,20 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # source: flow/entities/block_header.proto
3
+
4
+ require 'google/protobuf'
5
+
6
+ require 'google/protobuf/timestamp_pb'
7
+ Google::Protobuf::DescriptorPool.generated_pool.build do
8
+ add_file("flow/entities/block_header.proto", :syntax => :proto3) do
9
+ add_message "flow.entities.BlockHeader" do
10
+ optional :id, :bytes, 1
11
+ optional :parent_id, :bytes, 2
12
+ optional :height, :uint64, 3
13
+ optional :timestamp, :message, 4, "google.protobuf.Timestamp"
14
+ end
15
+ end
16
+ end
17
+
18
+ module Entities
19
+ BlockHeader = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("flow.entities.BlockHeader").msgclass
20
+ end
@@ -0,0 +1,25 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # source: flow/entities/block.proto
3
+
4
+ require 'google/protobuf'
5
+
6
+ require 'google/protobuf/timestamp_pb'
7
+ require 'flow/entities/collection_pb'
8
+ require 'flow/entities/block_seal_pb'
9
+ Google::Protobuf::DescriptorPool.generated_pool.build do
10
+ add_file("flow/entities/block.proto", :syntax => :proto3) do
11
+ add_message "flow.entities.Block" do
12
+ optional :id, :bytes, 1
13
+ optional :parent_id, :bytes, 2
14
+ optional :height, :uint64, 3
15
+ optional :timestamp, :message, 4, "google.protobuf.Timestamp"
16
+ repeated :collection_guarantees, :message, 5, "flow.entities.CollectionGuarantee"
17
+ repeated :block_seals, :message, 6, "flow.entities.BlockSeal"
18
+ repeated :signatures, :bytes, 7
19
+ end
20
+ end
21
+ end
22
+
23
+ module Entities
24
+ Block = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("flow.entities.Block").msgclass
25
+ end