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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f1f8f12f908c49ce5756071ab22a00025ebc80e302a88dbb19d791a2a2ee0af7
4
- data.tar.gz: 0ebfdd822d9e54dff53e5476e14d0efb0efdc19eeecb0ccea7ac2b084f4e9871
3
+ metadata.gz: f74160e71e9ecbab5d26c3bc14717c2d1b6a3a251d109c00728f1e6d21dd9bae
4
+ data.tar.gz: 84fb8e4ed5a1db8ab7226b47fb872fd8b605ee469dc2e004b67e3ea4274405f5
5
5
  SHA512:
6
- metadata.gz: 87571212aa8c01d333209a63a0d0357210a794990e9de3461849e6e7e4cca80bcdbcf94fcd026172c18e209018ce2ed2d97d2c384c67c9a8a6a5c4eefc1246f5
7
- data.tar.gz: a01b21eea03a9512c36e06f59ca104bbc08a9df01fd1f4bf9bb47ecf2d0b8a4cf36c095afdd3db62fa1d7588e46541f880ed99a650d0f89a0d5b670b27a9ab35
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
@@ -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
@@ -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
@@ -1,4 +1,4 @@
1
1
  module Universa
2
2
  # Current gem version
3
- VERSION = "0.2.2"
3
+ VERSION = "0.2.3"
4
4
  end
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.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-06 00:00:00.000000000 Z
11
+ date: 2018-12-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: farcall