Class: TezosClient::OperationArray

Inherits:
Operation
  • Object
show all
Defined in:
lib/tezos_client/operations/operation_array.rb

Instance Method Summary collapse

Methods inherited from Operation

#initialize

Constructor Details

This class inherits a constructor from TezosClient::Operation

Instance Method Details

#post_initialize(operations:, **args) ⇒ Object



4
5
6
# File 'lib/tezos_client/operations/operation_array.rb', line 4

def post_initialize(operations:, **args)
  @operations = operations.clone
end

#rpc_operation_argsObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/tezos_client/operations/operation_array.rb', line 8

def rpc_operation_args
  @rpc_operation_args ||= begin
    initial_counter = rpc_interface.contract_counter(@args.fetch(:from)) + 1

    operations.map.with_index do |operation, index|
      counter = (initial_counter + index)
      operation_kind = operation.delete(:kind)

      operation_klass(operation_kind).new(
        operation
          .merge(@args.slice(:from))
          .merge(
            rpc_interface: rpc_interface,
            counter: counter
        )
      ).rpc_operation_args
    end
  end
end