tezos_client 1.3.1 → 1.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +2 -1
- data/lib/tezos_client.rb +19 -2
- data/lib/tezos_client/commands.rb +2 -1
- data/lib/tezos_client/tools/hash_to_micheline.rb +5 -13
- data/lib/tezos_client/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a4767efa7b67fc781a2bee7f46beefc6a40f649fc4d3639fd279f1a0fcf76ed4
|
4
|
+
data.tar.gz: 4fef498bf7d952d82202ee4323efa107f7456b2d2f4aabfaabc5fb20cd451a9d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4fcdbd1fca67c85791fd3259c29d140417f2712d458cb61d57136fe035a3aacbecfd89a1de8f47db0772481251fc6b670696044c3e424042b80afd59265530ab
|
7
|
+
data.tar.gz: 3a6eeff8a54d35eddaf62da354b420718805f110e2996838aab6b6a564f1e44a57bd5572a1b5a3717cec311234820e5ebbd51fb18d908064eaff861862b0f0ad
|
data/Gemfile.lock
CHANGED
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://
|
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)
|
data/lib/tezos_client.rb
CHANGED
@@ -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:
|
175
|
+
entrypoint: _entrypoint,
|
171
176
|
params_type: params_type
|
172
177
|
)
|
173
178
|
|
174
179
|
transfer_args = args.merge(
|
175
|
-
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)
|
@@ -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
|
-
|
88
|
-
|
89
|
-
|
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
|
data/lib/tezos_client/version.rb
CHANGED
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.
|
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-
|
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.
|
320
|
+
rubygems_version: 3.0.8
|
321
321
|
signing_key:
|
322
322
|
specification_version: 4
|
323
323
|
summary: Wrapper to the tezos client.
|