tezos_client 1.3.1 → 1.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1e2dc6502a81aa8acb23cab552f03edbb1c94d7e21bfa2e653f9d662b0f2f5b5
4
- data.tar.gz: 807c964c0919c93331e3e45610195705bed3ead65ca71a51f46b13d557ba4b14
3
+ metadata.gz: a4767efa7b67fc781a2bee7f46beefc6a40f649fc4d3639fd279f1a0fcf76ed4
4
+ data.tar.gz: 4fef498bf7d952d82202ee4323efa107f7456b2d2f4aabfaabc5fb20cd451a9d
5
5
  SHA512:
6
- metadata.gz: 6b8d7f60f470bc533c3305cc33c007614b87461c5c0ec64e9d0a535ded2ba5707108cd5c359b89b5f292d215a2aa1ed2eaeffed9c55efa6a0c8f0dd51b46d08a
7
- data.tar.gz: 80532f0a06a7f8d4e810c80ef4c90ddac5e1bf4513bb17e10bc2b1659ed0e7319ed620649f655285d03fe34b1e5a971359d7fa676192f02b0089c17a08f8bd39
6
+ metadata.gz: 4fcdbd1fca67c85791fd3259c29d140417f2712d458cb61d57136fe035a3aacbecfd89a1de8f47db0772481251fc6b670696044c3e424042b80afd59265530ab
7
+ data.tar.gz: 3a6eeff8a54d35eddaf62da354b420718805f110e2996838aab6b6a564f1e44a57bd5572a1b5a3717cec311234820e5ebbd51fb18d908064eaff861862b0f0ad
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- tezos_client (1.3.1)
4
+ tezos_client (1.3.2)
5
5
  active_interaction (~> 3.7)
6
6
  activesupport (~> 6.0.0)
7
7
  base58 (~> 0.2.3)
data/README.md CHANGED
@@ -27,7 +27,8 @@ need the tezos version (not Dune version)
27
27
  [SmartPy](https://smartpy.io/)
28
28
 
29
29
  ```bash
30
- sh <(curl -s https://SmartPy.io/SmartPyBasic/SmartPy.sh) local-install /
30
+ sh <(curl -s https://smartpy.io/dev-20200924-23b26494361d96abf034bdbb1ad1af396f95fd61/cli/SmartPy.sh) local-install-auto
31
+ export PATH=$PATH:$HOME/smartpy-cli/
31
32
  ```
32
33
 
33
34
  ### TypeScript (for dev)
@@ -165,14 +165,19 @@ class TezosClient
165
165
  end
166
166
 
167
167
  def call_contract(dry_run: false, entrypoint:, params:, params_type:, **args)
168
+ _entrypoint = select_entrypoint(
169
+ contract_address: args[:to],
170
+ entrypoint: entrypoint
171
+ )
172
+
168
173
  json_params = micheline_params(
169
174
  params: params,
170
- entrypoint: entrypoint,
175
+ entrypoint: _entrypoint,
171
176
  params_type: params_type
172
177
  )
173
178
 
174
179
  transfer_args = args.merge(
175
- entrypoint: entrypoint,
180
+ entrypoint: _entrypoint,
176
181
  parameters: json_params,
177
182
  dry_run: dry_run
178
183
  )
@@ -180,6 +185,18 @@ class TezosClient
180
185
  transfer(transfer_args)
181
186
  end
182
187
 
188
+ def select_entrypoint(contract_address:, entrypoint:)
189
+ entrypoints = entrypoints(contract_address)["entrypoints"].keys
190
+
191
+ if entrypoints.count == 0
192
+ "default"
193
+ elsif entrypoints.include?(entrypoint)
194
+ entrypoint
195
+ else
196
+ raise ::ArgumentError, "entrypoint #{entrypoint} not found in #{entrypoints}"
197
+ end
198
+ end
199
+
183
200
  def inject_raw_operations(secret_key:, raw_operations:, dry_run: false, **args)
184
201
  public_key = secret_key_to_public_key(secret_key)
185
202
  from = public_key_to_address(public_key)
@@ -26,6 +26,7 @@ class TezosClient
26
26
  :block_operations,
27
27
  :contract_storage_type,
28
28
  :entrypoint,
29
- :entrypoints
29
+ :entrypoints,
30
+ :select_entrypoint
30
31
  end
31
32
  end
@@ -22,7 +22,7 @@ class TezosClient::Tools::HashToMicheline < ActiveInteraction::Base
22
22
  # }
23
23
  hash :params, strip: false
24
24
  hash :storage_type, strip: false, default: {}
25
- interface :blockchain_client, methods: %i[entrypoint entrypoints], default: -> { TezosClient.new }
25
+ interface :blockchain_client, methods: %i[entrypoint entrypoints select_entrypoint], default: -> { TezosClient.new }
26
26
 
27
27
  # if storage_type is not received, it is fetched from the blockchain using
28
28
  # contract_address and entrypoint (that are mandatory in this case)
@@ -83,18 +83,10 @@ class TezosClient::Tools::HashToMicheline < ActiveInteraction::Base
83
83
  end
84
84
 
85
85
  def _entrypoint
86
- @_entrypoint ||= select_entrypoint
87
- end
88
-
89
- def select_entrypoint
90
- entrypoints = blockchain_client.entrypoints(contract_address)["entrypoints"].keys
91
- if entrypoints.count == 0
92
- "default"
93
- elsif entrypoints.include?(entrypoint)
94
- entrypoint
95
- else
96
- errors.add(:entrypoint, :not_found)
97
- end
86
+ @_entrypoint ||= blockchain_client.select_entrypoint(
87
+ contract_address: contract_address,
88
+ entrypoint: entrypoint
89
+ )
98
90
  end
99
91
 
100
92
  def _storage_type
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class TezosClient
4
- VERSION = "1.3.1"
4
+ VERSION = "1.3.2"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tezos_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.1
4
+ version: 1.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pierre Michard
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-09-24 00:00:00.000000000 Z
11
+ date: 2020-09-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -317,7 +317,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
317
317
  - !ruby/object:Gem::Version
318
318
  version: '0'
319
319
  requirements: []
320
- rubygems_version: 3.0.3
320
+ rubygems_version: 3.0.8
321
321
  signing_key:
322
322
  specification_version: 4
323
323
  summary: Wrapper to the tezos client.