universa 0.2.2 → 0.2.3
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 +4 -4
- data/README.md +1 -0
- data/lib/universa/contract.rb +15 -1
- data/lib/universa/umi.rb +5 -1
- data/lib/universa/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f74160e71e9ecbab5d26c3bc14717c2d1b6a3a251d109c00728f1e6d21dd9bae
|
4
|
+
data.tar.gz: 84fb8e4ed5a1db8ab7226b47fb872fd8b605ee469dc2e004b67e3ea4274405f5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9890b396912ca79946e53dd8c0281ed8e0dd8af765733e58633681d880de844c04ccd5f356de73575f5a5b09c4d3e896550b2d76b608eda131c55e1d7c1c2aa6
|
7
|
+
data.tar.gz: b4292f597680e2f6f9558d008108f2c4fead1e42a73118c0fa154e2ae1a8c68f8b4829071d4e59acf6ec73ff2cff01f1ba0e5ad980a23f4aac664232bb2093d0
|
data/README.md
CHANGED
@@ -8,6 +8,7 @@ Java library using Universa's UMI protocol.
|
|
8
8
|
|
9
9
|
## News
|
10
10
|
|
11
|
+
- added syntax sugar for TransactionPack
|
11
12
|
- alfa version of the local FS-based contract store.
|
12
13
|
- ability to edit `contract.state` and `contract.transactional` in new revisions.
|
13
14
|
- fixed errors with interchange builder and set based objects
|
data/lib/universa/contract.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'bigdecimal'
|
2
|
+
|
1
3
|
module Universa
|
2
4
|
|
3
5
|
# Adapter for Universa ChangeOwnerPermission
|
@@ -20,6 +22,18 @@ module Universa
|
|
20
22
|
end
|
21
23
|
|
22
24
|
|
25
|
+
# adapter for Universa TransactionPack
|
26
|
+
class TransactionPack < RemoteAdapter
|
27
|
+
remote_class "com.icodici.universa.contract.TransactionPack"
|
28
|
+
|
29
|
+
# Unpack the transaction pack
|
30
|
+
# @return [TransactionPack] unpacked
|
31
|
+
def self.unpack(packed_transaction)
|
32
|
+
packed_transaction.force_encoding('binary')
|
33
|
+
invoke_static 'unpack', packed_transaction
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
23
37
|
# Adapter for Universa +HashId+ class, helps to avoid confusion when using different
|
24
38
|
# representations of the ID.
|
25
39
|
class HashId < RemoteAdapter
|
@@ -209,7 +223,7 @@ module Universa
|
|
209
223
|
# Helper for many token-like contracts containing state.data.amount
|
210
224
|
# @return [BigDecimal] amount or nil
|
211
225
|
def amount
|
212
|
-
v = state[:amount] and BigDecimal(v.to_s)
|
226
|
+
v = state[:amount] and BigDecimal.new(v.to_s)
|
213
227
|
end
|
214
228
|
|
215
229
|
# Write helper for many token-like contracts containing state.data.amount. Saves value
|
data/lib/universa/umi.rb
CHANGED
@@ -234,6 +234,7 @@ module Universa
|
|
234
234
|
|
235
235
|
# convert ruby arguments array to corresponding UMI values
|
236
236
|
def prepare_args args
|
237
|
+
raise "pp bug" if args == [:pretty_print] # this often happens whilte tracing
|
237
238
|
args.map {|x|
|
238
239
|
if x.respond_to?(:_as_umi_arg)
|
239
240
|
x._as_umi_arg(self)
|
@@ -241,7 +242,7 @@ module Universa
|
|
241
242
|
case x
|
242
243
|
when Set
|
243
244
|
# Make a Java Set
|
244
|
-
r = call("instantiate","Set", x.to_a.map{|i| i._as_umi_arg(self)})
|
245
|
+
r = call("instantiate", "Set", x.to_a.map {|i| i._as_umi_arg(self)})
|
245
246
|
# Ref will garbage collect it
|
246
247
|
Ref.new(self, r)
|
247
248
|
# but we need a ref struct only:
|
@@ -250,6 +251,9 @@ module Universa
|
|
250
251
|
{__type: 'unixtime', seconds: x.to_i}
|
251
252
|
when String
|
252
253
|
x.encoding == Encoding::BINARY ? {__type: 'binary', base64: Base64.encode64(x)} : x
|
254
|
+
when RemoteAdapter
|
255
|
+
# this need special treatment with direct call:
|
256
|
+
x.__getobj__._as_umi_arg(self)
|
253
257
|
else
|
254
258
|
x
|
255
259
|
end
|
data/lib/universa/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: universa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- sergeych
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-12-
|
11
|
+
date: 2018-12-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: farcall
|