Module: TezosClient::RpcInterface::Helper
- Included in:
- TezosClient::RpcInterface
- Defined in:
- lib/tezos_client/rpc_interface/helper.rb
Instance Method Summary collapse
- #activate_account_operation(args) ⇒ Object
- #counter(args) ⇒ Object
- #forge_operation(operation:, **options) ⇒ Object
- #origination_operation(args) ⇒ Object
- #preapply_operation(operation:, **options) ⇒ Object
- #reveal_operation(args) ⇒ Object
- #run_operation(operation:, **options) ⇒ Object
- #transaction_operation(args) ⇒ Object
Instance Method Details
#activate_account_operation(args) ⇒ Object
42 43 44 45 46 47 48 |
# File 'lib/tezos_client/rpc_interface/helper.rb', line 42 def activate_account_operation(args) { kind: "activate_account", pkh: args.fetch(:pkh), secret: args.fetch(:secret) } end |
#counter(args) ⇒ Object
62 63 64 65 66 |
# File 'lib/tezos_client/rpc_interface/helper.rb', line 62 def counter(args) args.fetch(:counter) do contract_counter(args.fetch(:from)) + 1 end end |
#forge_operation(operation:, **options) ⇒ Object
78 79 80 |
# File 'lib/tezos_client/rpc_interface/helper.rb', line 78 def forge_operation(operation:, **) forge_operations(operations: [operation], **) end |
#origination_operation(args) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/tezos_client/rpc_interface/helper.rb', line 26 def origination_operation(args) operation = { kind: "origination", balance: args.fetch(:amount, 0).to_satoshi.to_s, source: args.fetch(:from), gas_limit: args.fetch(:gas_limit, 0.1).to_satoshi.to_s, storage_limit: args.fetch(:storage_limit, 0.06).to_satoshi.to_s, counter: counter(args).to_s, fee: args.fetch(:fee, 0.05).to_satoshi.to_s, } operation[:script] = args[:script] if args[:script] operation end |
#preapply_operation(operation:, **options) ⇒ Object
68 69 70 71 |
# File 'lib/tezos_client/rpc_interface/helper.rb', line 68 def preapply_operation(operation:, **) res = preapply_operations(operations: [operation], **) res[0] end |
#reveal_operation(args) ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/tezos_client/rpc_interface/helper.rb', line 50 def reveal_operation(args) { kind: "reveal", source: args.fetch(:from), fee: args.fetch(:fee, 0.05).to_satoshi.to_s, counter: counter(args).to_s, gas_limit: args.fetch(:gas_limit, 0.1).to_satoshi.to_s, storage_limit: args.fetch(:storage_limit, 0).to_satoshi.to_s, public_key: args.fetch(:public_key) } end |
#run_operation(operation:, **options) ⇒ Object
73 74 75 76 |
# File 'lib/tezos_client/rpc_interface/helper.rb', line 73 def run_operation(operation:, **) res = run_operations(operations: [operation], **) res[0] end |
#transaction_operation(args) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/tezos_client/rpc_interface/helper.rb', line 8 def transaction_operation(args) operation = { kind: "transaction", amount: args.fetch(:amount).to_satoshi.to_s, source: args.fetch(:from), destination: args.fetch(:to), gas_limit: args.fetch(:gas_limit, 0.1).to_satoshi.to_s, storage_limit: args.fetch(:storage_limit, 0.006).to_satoshi.to_s, counter: counter(args).to_s, fee: args.fetch(:fee, 0.05).to_satoshi.to_s } if args[:parameters] operation[:parameters] = args[:parameters] end operation end |