Module: TezosClient::RpcInterface::Operations

Included in:
TezosClient::RpcInterface
Defined in:
lib/tezos_client/rpc_interface/operations.rb

Instance Method Summary collapse

Instance Method Details

#broadcast_operation(data) ⇒ Object



42
43
44
# File 'lib/tezos_client/rpc_interface/operations.rb', line 42

def broadcast_operation(data)
  post("injection/operation?chain=main", data)
end

#forge_operations(operations:, **options) ⇒ Object



34
35
36
37
38
39
40
# File 'lib/tezos_client/rpc_interface/operations.rb', line 34

def forge_operations(operations:, **options)
  content = {
    branch: options.fetch(:branch),
    contents: operations
  }
  post("chains/main/blocks/head/helpers/forge/operations", content)
end

#pack_data(data:, type:) ⇒ Object



50
51
52
53
54
55
56
# File 'lib/tezos_client/rpc_interface/operations.rb', line 50

def pack_data(data:, type:)
  content = {
      data: data,
      type: type
  }
  post("/chains/main/blocks/head/helpers/scripts/pack_data", content)
end

#pending_operationsObject



46
47
48
# File 'lib/tezos_client/rpc_interface/operations.rb', line 46

def pending_operations
  get("chains/main/mempool/pending_operations")
end

#preapply_operations(operations:, **options) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/tezos_client/rpc_interface/operations.rb', line 8

def preapply_operations(operations:, **options)
  content = {
    protocol: options.fetch(:protocol),
    branch: options.fetch(:branch),
    contents: operations,
    signature: options.fetch(:signature)
  }

  res = post("chains/main/blocks/head/helpers/preapply/operations",
             [content])
  res[0]["contents"]
end

#run_operations(operations:, **options) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/tezos_client/rpc_interface/operations.rb', line 21

def run_operations(operations:, **options)
  content = {
    operation: {
      branch: options.fetch(:branch),
      contents: operations,
      signature: options.fetch(:signature)
    },
    chain_id: options.fetch(:chain_id)
  }
  res = post("chains/main/blocks/head/helpers/scripts/run_operation", content)
  res["contents"]
end