test_sdk1 1.0.2 → 1.0.3

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: fc912ab6a40cae5e4fb436cd53e64f9d8e312ef47d538dd2bb9aa82e31b12a39
4
- data.tar.gz: a560cc02719b199ce0ee21921aadcfbf1d6def7a5d92326de4bdf9539b9ff7fd
3
+ metadata.gz: 5b89def3f15a842a7ddc8c15b72f04e2cddf49b781fb8d838addcd7854e5dfc4
4
+ data.tar.gz: 980521ad36c1ea8acc77e573ff24cd961d3de5f55e12e3a609d2a64b2ec5e074
5
5
  SHA512:
6
- metadata.gz: c26c3679268634a2f6859367b5caa1281589dcc01fbaeb189b7fda3d6ad710fd86d9d7329fdbb371eda4bbc032bd799cea3063f66d6739df2ce422539ee77763
7
- data.tar.gz: 359258d4d8bd9e817eda41ddc86644a618f897c0e412d18f14474934ea899e8694aaaa168b15ec8d44c326253edd8a75241c623769ff105e0c7a0898b65a5c1d
6
+ metadata.gz: 15907f268c7f6e4fb4f30ca4bb42518c545d8c01f6803db931381ac76a22c360771a788e435062d862302ba3b4e7da320f2a0069dba9c984b2cbe4bad7907757
7
+ data.tar.gz: fce9046fe2e0f2978f949b8c2ae09585a5936225b50137a622f48f0c87ac101c1b92d11bb4b89d90030e89ed3d6d4ea51794a21908bbb8061c7c486be4f106fd
data/README.md CHANGED
@@ -47,6 +47,20 @@ bundle exec rspec
47
47
  bundle exec rspec -fd
48
48
  ```
49
49
 
50
+ ## How run each test file individually
51
+ ```bash
52
+ git checkout main
53
+ # Run the test
54
+ rspec spec/file_name.rb
55
+ # To see the test results in detail
56
+ rspec -fd spec/file_name.rb
57
+ # Example:
58
+ rspec spec/testnet_spec.rb
59
+ # To see results in details
60
+ rspec -fd spec/testnet_spec.rb
61
+ ```
62
+
63
+
50
64
  ## How to generate docs
51
65
  ```bash
52
66
  gem install yard
@@ -56,6 +70,22 @@ yardoc lib/**/*.rb lib/*.rb - README.md LICENSE CONTRIBUTING.md SECURITY.md
56
70
  yardoc --help
57
71
  ```
58
72
 
73
+ ## Documentation:
74
+ ### Casper-Ruby-Sdk RPC
75
+ * [info_get_peers](https://github.com/saitgulmez/testing/blob/main/docs/rpc.md#info_get_peers)
76
+ * [chain_get_StateRootHash](https://github.com/saitgulmez/testing/blob/main/docs/rpc.md#get-state_root_hash)
77
+ * [info_get_deploy](https://github.com/saitgulmez/testing/blob/main/docs/rpc.md#get-deploy)
78
+ * [info_get_status](https://github.com/saitgulmez/testing/blob/main/docs/rpc.md#get-status)
79
+ * [chain_get_block_transfers](https://github.com/saitgulmez/testing/blob/main/docs/rpc.md#get-block-transfers)
80
+ * [chain_get_block](https://github.com/saitgulmez/testing/blob/main/docs/rpc.md#get-block-by-hash)
81
+ * [chain_get_eraInfo_by_SwitchBlock](https://github.com/saitgulmez/testing/blob/main/docs/rpc.md#get-era-summary-by-switch-block-hash)
82
+ * [state_get_item](https://github.com/saitgulmez/testing/blob/main/docs/rpc.md#get--state-item)
83
+ * [state_get_dictionary_item](https://github.com/saitgulmez/testing/blob/main/docs/rpc.md#get-dictionary-item)
84
+ * [state_get_balance](https://github.com/saitgulmez/testing/blob/main/docs/rpc.md#get-account-balance)
85
+ * [state_get_AuctionInfo](https://github.com/saitgulmez/testing/blob/main/docs/rpc.md#get-auction-state)
86
+ * [put_deploy](https://github.com/saitgulmez/testing/blob/main/docs/rpc.md#put-deploy)
87
+
88
+
59
89
  ## Usage examples
60
90
  ### Get 5 peer IP addresses randomly
61
91
  ```ruby
@@ -139,9 +169,9 @@ end
139
169
 
140
170
 
141
171
  ## TODO
142
- - [x] Ruby version of CLType primitives
143
- - [x] Ruby version for Casper domain-specific objects
144
- - [x] Serialization of Casper domain-specific objects
172
+ - [ ] Ruby version of CLType primitives
173
+ - [ ] Ruby version for Casper domain-specific objects
174
+ - [ ] Serialization of Casper domain-specific objects
145
175
  - [ ] ED25519/SECP256K1 key pairs Wrappers implemented
146
176
  - [ ] PutDeploy call implemented and tested
147
- - [x] SDK calls will return Casper domain-specific objects
177
+ - [ ] SDK calls will return Casper domain-specific objects
data/lib/entity/group.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  module Casper
2
2
  module Entity
3
3
  # Group
4
- class Group
4
+ class Group
5
5
 
6
6
  # @param [String] group
7
7
  # @param [Array<CLURef>] keys
@@ -2,7 +2,8 @@ require_relative './deploy_executable_item_internal.rb'
2
2
 
3
3
  module Casper
4
4
  module Entity
5
- # Stored contract referenced by a named key existing in the signer's Account context, entry point and an instance of RuntimeArgs.
5
+ # Stored contract referenced by a named key existing in the signer's Account context,
6
+ # entry point and an instance of RuntimeArgs.
6
7
  class StoredContractByName < DeployExecutableItemInternal
7
8
 
8
9
  # @param [String] name
@@ -2,7 +2,8 @@ require_relative './deploy_executable_item_internal.rb'
2
2
 
3
3
  module Casper
4
4
  module Entity
5
- # Stored versioned contract referenced by its ContractPackageHash, entry point and an instance of RuntimeArgs.
5
+ # Stored versioned contract referenced by its ContractPackageHash,
6
+ # entry point and an instance of RuntimeArgs.
6
7
  class StoredVersionedContractByHash < DeployExecutableItemInternal
7
8
 
8
9
  # @param [String] hash
@@ -3,7 +3,7 @@ require_relative './deploy_executable_item_internal.rb'
3
3
  module Casper
4
4
  module Entity
5
5
  # Stored versioned contract referenced by a named key existing in the signer's Account context,
6
- # entry point and an instance of RuntimeArgs.
6
+ # entry point and an instance of RuntimeArgs.
7
7
  class StoredVersionedContractByName < DeployExecutableItemInternal
8
8
 
9
9
  # @param [String] name
@@ -8,9 +8,8 @@ require 'active_support/core_ext/hash/keys'
8
8
  require 'timeout'
9
9
  require 'net/http'
10
10
  require_relative './rpc_error.rb'
11
-
12
11
  module Casper
13
- # Class for interacting with the network via RPC
12
+ # Interacting with the network via RPC
14
13
  class RpcClient
15
14
  attr_accessor :ip_address, :port, :url, :state_root_hash
16
15
 
@@ -20,6 +20,7 @@ require_relative '../types/cl_tuple_type.rb'
20
20
  require_relative '../types/cl_any_type.rb'
21
21
  require_relative '../types/cl_public_key_type.rb'
22
22
 
23
+ # Byte serializer for CLType
23
24
  class CLTypeSerizalizer
24
25
 
25
26
  def self.serialize_cl_type(cl_type)
@@ -20,6 +20,7 @@ require_relative '../types/cl_public_key.rb'
20
20
  require_relative '../types/constants.rb'
21
21
  require_relative '../serialization/cl_value_bytes_parsers.rb'
22
22
 
23
+ # Byte serializer for CLValue
23
24
  class CLValueSerializer
24
25
 
25
26
  def to_bytes(clvalue)
@@ -3,6 +3,7 @@ require_relative '../serialization/cl_value_bytes_parsers.rb'
3
3
  require_relative '../utils/time_utils.rb'
4
4
  require_relative '../utils/byte_utils.rb'
5
5
 
6
+ # Byte serializer for DeployApproval object
6
7
  class DeployApprovalSerializer
7
8
  def to_bytes(deploy_approval)
8
9
  @approval_serializer = ""
@@ -1,6 +1,6 @@
1
1
  require_relative '../entity/deploy_executable.rb'
2
2
 
3
-
3
+ # Byte serializer for DeployExecutable object
4
4
  class DeployExecutableSerializer
5
5
 
6
6
  def initialize
@@ -3,7 +3,7 @@ require_relative '../serialization/cl_value_bytes_parsers.rb'
3
3
  require_relative '../utils/time_utils.rb'
4
4
  require_relative '../utils/byte_utils.rb'
5
5
 
6
-
6
+ # Byte serializer for DeployHeader object
7
7
  class DeployHeaderSerializer
8
8
 
9
9
  # @param [DeployerHeader] deploy_header
@@ -4,6 +4,7 @@ require_relative '../utils/byte_utils.rb'
4
4
  require_relative './cl_type_serializer.rb'
5
5
  require_relative './cl_value_serializer.rb'
6
6
 
7
+ # Byte serializer for DeployNamedArg object
7
8
  class DeployNamedArgSerializer
8
9
 
9
10
  def to_bytes(arg)
@@ -4,6 +4,7 @@ require_relative './deploy_executable_serializer'
4
4
  require_relative './deploy_named_arg_serializer'
5
5
  require_relative '../utils/byte_utils.rb'
6
6
 
7
+ # Byte serializer for Deploy object
7
8
  class DeploySerializer
8
9
 
9
10
  def to_bytes(deploy)
data/lib/test_sdk1.rb CHANGED
@@ -15,10 +15,8 @@ require_relative './rpc/rpc_client.rb'
15
15
  # Dir["./serialization/*.rb"].each {|file| require file }
16
16
  # Dir["./types/*.rb"].each {|file| require file }
17
17
  require_relative './include.rb'
18
- # Class for interacting with the network via RPC
19
- # puts "Hello"
20
18
  module Casper
21
- # Interacting with the network
19
+ # Interacting with the network
22
20
  class CasperClient
23
21
  attr_accessor :ip_address, :port, :url, :state_root_hash
24
22
 
data/lib/types/cl_type.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require 'json'
2
+
2
3
  # Casper types, i.e. types which can be stored and manipulated by smart contracts.
3
4
  # Provides a description of the underlying data type of a CLValue.
4
5
  class CLType
data/lib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module CasperNetworkSDK
2
- VERSION = '1.0.2'
2
+ VERSION = '1.0.3'
3
3
  end
data/spec/client_spec.rb CHANGED
@@ -1,25 +1,25 @@
1
1
  # client_spec.rb
2
- # require './lib/casper_network.rb'
2
+ require './lib/rpc/rpc_client.rb'
3
3
 
4
- # describe CasperClient do
5
- # client1 = CasperClient.new("185.246.84.43")
6
- # # Test info_get_peers()
7
- # describe "#info_get_peers" do
8
- # it "returns peers array." do
9
- # # Check whether ıt is an array or not
10
- # expect(client1.info_get_peers).to be_an(Array)
11
- # # Check the length of the peers array
12
- # expect(client1.info_get_peers.length).to be > 0
4
+ describe Casper::RpcClient do
5
+ client1 = Casper::RpcClient.new("185.246.84.43")
6
+ # Test info_get_peers()
7
+ describe "#info_get_peers" do
8
+ it "returns peers array." do
9
+ # Check whether ıt is an array or not
10
+ expect(client1.info_get_peers).to be_an(Array)
11
+ # Check the length of the peers array
12
+ expect(client1.info_get_peers.length).to be > 0
13
13
 
14
- # end
15
- # end
16
- # # Test chain_get_StateRootHash()
17
- # describe "#chain_get_StateRootHash" do
18
- # it "returns current state_root_hash." do
19
- # # Check whether its type is string or not
20
- # expect(client1.chain_get_StateRootHash).to be_an(String)
21
- # end
22
- # end
14
+ end
15
+ end
16
+ # Test chain_get_StateRootHash()
17
+ describe "#chain_get_StateRootHash" do
18
+ it "returns current state_root_hash." do
19
+ # Check whether its type is string or not
20
+ expect(client1.chain_get_StateRootHash).to be_an(String)
21
+ end
22
+ end
23
23
 
24
24
 
25
- # end
25
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: test_sdk1
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mehmet Sait Gülmez
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-09-20 00:00:00.000000000 Z
11
+ date: 2022-09-22 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Ruby gem enables developers to interact with the Casper Network.
14
14
  email: cenggulmez.65@gmail.com