ton_sdk_client 1.18.0 → 1.19.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 93ce3efefeae7a25614a74726af1c93fa4a8f8eb0ad897ea0ba6d41b76946102
4
- data.tar.gz: 87f3ebd814144ac4967711f626e6fcc948c8e12042a76ab93f472ac99cc68669
3
+ metadata.gz: c6868c6fe12ffd4126d1eeb38b3030a3ed5d7f035dae0fec74b9d84db10114c4
4
+ data.tar.gz: e54ded382e777172f4c55f900900b8bb05c8eb92e446a7a14da9940183cf84a6
5
5
  SHA512:
6
- metadata.gz: 2f33cc5939351b95af854b363bb5064db95a201ce674b90264fe261313c73e8d0faacc18de8b2cfae6d2f0fabde134eaa3b11011685db868423ae51c3ae85665
7
- data.tar.gz: d557d9920669edfa03f2b5ccf395897fd56970bb9f78c3a58e24e32cd07d3478600f9f34d834ac15e18ad1a951c942d2b7bc03235cd51c8e53b22b0bae3a4acf
6
+ metadata.gz: 7d72968fce6441bc33b7c39eb1901acbeeea916aeb44975775bbe2bd95d0bd45d5cba2b80a175a5b259f00c171e5b1868fb22cdaa947a9c2786a62aad42548f5
7
+ data.tar.gz: 2677cd3d469893a7404b23df694fd756650ca90775d80d990556fa39d2fd3c36e19539be190031b17d291d466c7f14b74c32255f7a4fac1787c1b6109ddb5442
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # TON SDK client in Ruby and for Ruby
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/ton_sdk_client.png)](https://badge.fury.io/rb/ton_sdk_client)
4
- [![TON SDK version](https://img.shields.io/badge/TON%20SDK%20version-1.18.0-green)](https://github.com/tonlabs/TON-SDK/tree/1.18.0)
4
+ [![TON SDK version](https://img.shields.io/badge/TON%20SDK%20version-1.19.0-green)](https://github.com/tonlabs/TON-SDK/tree/1.19.0)
5
5
 
6
6
  Ruby gem-client bindings for [TON SDK](https://github.com/tonlabs/TON-SDK) which allows one to communicate with [FreeTON](https://freeton.org) blockchain in Ruby.
7
7
 
@@ -9,7 +9,7 @@ Note that there're 2 types of versions:
9
9
  * `TonSdk::VERSION` - the version of the gem
10
10
  * `TonSdk::NATIVE_SDK_VERSION` - the version of the original SDK
11
11
 
12
- and they don't necessarily have to match each other.
12
+ and they may not always match each other.
13
13
 
14
14
 
15
15
 
@@ -549,43 +549,33 @@ module TonSdk
549
549
  end
550
550
 
551
551
  class AbiContract
552
- attr_reader :abi_version, :header, :functions, :events, :data
552
+ attr_reader :abi_version, :header, :functions, :events, :data, :fields
553
553
 
554
- def initialize(abi_version: nil, header: [], functions: [], events: [], data: [])
554
+ def initialize(
555
+ abi_version: nil,
556
+ header: [],
557
+ functions: [],
558
+ events: [],
559
+ data: [],
560
+ fields: []
561
+ )
555
562
  @abi_version = abi_version
556
-
557
- # in case if an argument has been passed as nil,
558
- # a default value should be used instead
559
-
560
- @header = header || []
561
- @functions = functions || []
562
- @events = events || []
563
- @data = data || []
563
+ @header = header
564
+ @functions = functions
565
+ @events = events
566
+ @data = data
567
+ @fields = fields
564
568
  end
565
569
 
566
570
  def to_h
567
- @header.compact! if !@header.nil?
568
-
569
- fn_h_s = if !@functions.nil?
570
- @functions.compact.map(&:to_h)
571
- end
572
-
573
- ev_h_s = if !@events.nil?
574
- @events.compact.map(&:to_h)
575
- end
576
-
577
- dt_h_s = if !@data.nil?
578
- @data.compact.map(&:to_h)
579
- end
580
-
581
571
  {
582
572
  abi_version: @abi_version,
583
573
  :"ABI version" => @abi_version, #TODO
584
-
585
574
  header: @header,
586
- functions: fn_h_s,
587
- events: ev_h_s,
588
- data: dt_h_s,
575
+ functions: @functions&.map(&:to_h),
576
+ events: @events&.map(&:to_h),
577
+ data: @data&.map(&:to_h),
578
+ fields: @fields
589
579
  }
590
580
  end
591
581
 
@@ -610,12 +600,19 @@ module TonSdk
610
600
  j["data"].compact.map {|x| AbiData.from_json(x) }
611
601
  end
612
602
 
603
+ fl_s = if j["fields"].nil?
604
+ []
605
+ else
606
+ j["fields"].compact.map {|x| AbiParam.from_json(x) }
607
+ end
608
+
613
609
  self.new(
614
610
  abi_version: j["ABI version"],
615
611
  header: j["header"],
616
612
  functions: fn_s,
617
613
  events: ev_s,
618
- data: dt_s
614
+ data: dt_s,
615
+ fields: fl_s
619
616
  )
620
617
  end
621
618
  end
@@ -656,6 +653,9 @@ module TonSdk
656
653
  end
657
654
  end
658
655
 
656
+ ParamsOfDecodeAccountData = Struct.new(:abi, :data, keyword_init: true)
657
+ ResultOfDecodeData = Struct.new(:data)
658
+
659
659
 
660
660
  #
661
661
  # functions
@@ -772,5 +772,22 @@ module TonSdk
772
772
  end
773
773
  end
774
774
  end
775
+
776
+ def self.decode_account_data(ctx, params)
777
+ Interop::request_to_native_lib(ctx, "abi.decode_account_data", params) do |resp|
778
+ if resp.success?
779
+ yield NativeLibResponsetResult.new(
780
+ result: ResultOfDecodeData.new(
781
+ resp.result["data"]
782
+ )
783
+ )
784
+ else
785
+ yield resp
786
+ end
787
+ end
788
+ end
789
+
790
+
791
+
775
792
  end
776
793
  end
@@ -51,6 +51,9 @@ module TonSdk
51
51
  ParamsOfDecompressZstd = Struct.new(:compressed)
52
52
  ResultOfDecompressZstd = Struct.new(:decompressed)
53
53
 
54
+ ParamsOfGetAddressType = Struct.new(:address)
55
+ ResultOfGetAddressType = Struct.new(:address_type)
56
+
54
57
 
55
58
  #
56
59
  # functions
@@ -60,7 +63,7 @@ module TonSdk
60
63
  Interop::request_to_native_lib(ctx, "utils.convert_address", params) do |resp|
61
64
  if resp.success?
62
65
  yield NativeLibResponsetResult.new(
63
- result: Utils::ResultOfConvertAddress.new(resp.result["address"])
66
+ result: ResultOfConvertAddress.new(resp.result["address"])
64
67
  )
65
68
  else
66
69
  yield resp
@@ -72,7 +75,7 @@ module TonSdk
72
75
  Interop::request_to_native_lib(ctx, "utils.calc_storage_fee", params) do |resp|
73
76
  if resp.success?
74
77
  yield NativeLibResponsetResult.new(
75
- result: Utils::ResultOfCalcStorageFee.new(resp.result["fee"])
78
+ result: ResultOfCalcStorageFee.new(resp.result["fee"])
76
79
  )
77
80
  else
78
81
  yield resp
@@ -84,7 +87,7 @@ module TonSdk
84
87
  Interop::request_to_native_lib(ctx, "utils.compress_zstd", params) do |resp|
85
88
  if resp.success?
86
89
  yield NativeLibResponsetResult.new(
87
- result: Utils::ResultOfCompressZstd.new(resp.result["compressed"])
90
+ result: ResultOfCompressZstd.new(resp.result["compressed"])
88
91
  )
89
92
  else
90
93
  yield resp
@@ -96,7 +99,19 @@ module TonSdk
96
99
  Interop::request_to_native_lib(ctx, "utils.decompress_zstd", params) do |resp|
97
100
  if resp.success?
98
101
  yield NativeLibResponsetResult.new(
99
- result: Utils::ParamsOfDecompressZstd.new(resp.result["decompressed"])
102
+ result: ParamsOfDecompressZstd.new(resp.result["decompressed"])
103
+ )
104
+ else
105
+ yield resp
106
+ end
107
+ end
108
+ end
109
+
110
+ def self.get_address_type(ctx, params)
111
+ Interop::request_to_native_lib(ctx, "utils.get_address_type", params) do |resp|
112
+ if resp.success?
113
+ yield NativeLibResponsetResult.new(
114
+ result: ResultOfGetAddressType.new(resp.result["address_type"])
100
115
  )
101
116
  else
102
117
  yield resp
@@ -1,4 +1,4 @@
1
1
  module TonSdk
2
- VERSION = "1.18.0"
3
- NATIVE_SDK_VERSION = "1.18.0"
2
+ VERSION = "1.19.0"
3
+ NATIVE_SDK_VERSION = "1.19.0"
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ton_sdk_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.18.0
4
+ version: 1.19.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Maslakov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-07-05 00:00:00.000000000 Z
11
+ date: 2021-07-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi