Class: Chain::Transaction::ClientModule
- Inherits:
-
ClientModule
- Object
- ClientModule
- Chain::Transaction::ClientModule
- Defined in:
- lib/chain/transaction.rb
Instance Attribute Summary
Attributes inherited from ClientModule
Instance Method Summary collapse
-
#build(builder = nil) { ... } ⇒ Template
Build an unsigned transaction from a set of actions.
-
#build_batch(builders) ⇒ BatchResponse<Template>
Build multiple unsigned transactions from multiple sets of actions.
-
#query(opts = {}) ⇒ Query
List all transactions, optionally filtered.
-
#submit(template) ⇒ SubmitResponse
Submit a signed transaction to the blockchain.
-
#submit_batch(templates) ⇒ BatchResponse<SubmitResponse>
Submit multiple signed transactions to the blockchain.
Methods inherited from ClientModule
Constructor Details
This class inherits a constructor from Chain::ClientModule
Instance Method Details
#build(builder = nil) { ... } ⇒ Template
Build an unsigned transaction from a set of actions.
60 61 62 63 64 65 66 67 68 69 |
# File 'lib/chain/transaction.rb', line 60 def build(builder = nil, &block) if builder.nil? builder = Builder.new(&block) end client.conn.singleton_batch_request( 'build-transaction', [builder] ) { |item| Template.new(item) } end |
#build_batch(builders) ⇒ BatchResponse<Template>
Build multiple unsigned transactions from multiple sets of actions.
74 75 76 77 78 79 |
# File 'lib/chain/transaction.rb', line 74 def build_batch(builders) client.conn.batch_request( 'build-transaction', builders ) { |item| Template.new(item) } end |
#query(opts = {}) ⇒ Query
List all transactions, optionally filtered
109 110 111 |
# File 'lib/chain/transaction.rb', line 109 def query(opts = {}) Query.new(client, opts) end |
#submit(template) ⇒ SubmitResponse
Submit a signed transaction to the blockchain.
84 85 86 87 88 89 |
# File 'lib/chain/transaction.rb', line 84 def submit(template) client.conn.singleton_batch_request( 'submit-transaction', {transactions: [template]} ) { |item| SubmitResponse.new(item) } end |
#submit_batch(templates) ⇒ BatchResponse<SubmitResponse>
Submit multiple signed transactions to the blockchain.
94 95 96 97 98 99 |
# File 'lib/chain/transaction.rb', line 94 def submit_batch(templates) client.conn.batch_request( 'submit-transaction', {transactions: templates} ) { |item| SubmitResponse.new(item) } end |