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
44 45 46 47 48 49 50 |
# File 'lib/tezos_client/rpc_interface/helper.rb', line 44 def activate_account_operation(args) { kind: "activate_account", pkh: args.fetch(:pkh), secret: args.fetch(:secret) } end |
#counter(args) ⇒ Object
64 65 66 67 68 |
# File 'lib/tezos_client/rpc_interface/helper.rb', line 64 def counter(args) args.fetch(:counter) do contract_counter(args.fetch(:from)) + 1 end end |
#forge_operation(operation:, **options) ⇒ Object
80 81 82 |
# File 'lib/tezos_client/rpc_interface/helper.rb', line 80 def forge_operation(operation:, **) forge_operations(operations: [operation], **) end |
#origination_operation(args) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/tezos_client/rpc_interface/helper.rb', line 23 def origination_operation(args) manager = (args.fetch(:manager) { args.fetch(:from) }) operation = { kind: "origination", delegatable: args.fetch(:delegatable, false), spendable: args.fetch(:spendable, false), 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, managerPubkey: manager } operation[:script] = args[:script] if args[:script] operation end |
#preapply_operation(operation:, **options) ⇒ Object
70 71 72 73 |
# File 'lib/tezos_client/rpc_interface/helper.rb', line 70 def preapply_operation(operation:, **) res = preapply_operations(operations: [operation], **) res[0] end |
#reveal_operation(args) ⇒ Object
52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/tezos_client/rpc_interface/helper.rb', line 52 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
75 76 77 78 |
# File 'lib/tezos_client/rpc_interface/helper.rb', line 75 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 |
# 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 } operation[:parameters] = args[:parameters] if args[:parameters] operation end |