test_sdk1 1.0.2 → 1.0.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 +34 -4
- data/lib/entity/group.rb +1 -1
- data/lib/entity/stored_contract_by_name.rb +2 -1
- data/lib/entity/stored_versioned_contract_by_hash.rb +2 -1
- data/lib/entity/stored_versioned_contract_by_name.rb +1 -1
- data/lib/rpc/rpc_client.rb +1 -2
- data/lib/serialization/cl_type_serializer.rb +1 -0
- data/lib/serialization/cl_value_serializer.rb +1 -0
- data/lib/serialization/deploy_approval_serializer.rb +1 -0
- data/lib/serialization/deploy_executable_serializer.rb +1 -1
- data/lib/serialization/deploy_header_serializer.rb +1 -1
- data/lib/serialization/deploy_named_arg_serializer.rb +1 -0
- data/lib/serialization/deploy_serializer.rb +1 -0
- data/lib/test_sdk1.rb +1 -3
- data/lib/types/cl_type.rb +1 -0
- data/lib/version.rb +1 -1
- data/spec/client_spec.rb +20 -20
- 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: 5b89def3f15a842a7ddc8c15b72f04e2cddf49b781fb8d838addcd7854e5dfc4
|
4
|
+
data.tar.gz: 980521ad36c1ea8acc77e573ff24cd961d3de5f55e12e3a609d2a64b2ec5e074
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
- [
|
143
|
-
- [
|
144
|
-
- [
|
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
|
-
- [
|
177
|
+
- [ ] SDK calls will return Casper domain-specific objects
|
data/lib/entity/group.rb
CHANGED
@@ -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,
|
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,
|
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
|
-
#
|
6
|
+
# entry point and an instance of RuntimeArgs.
|
7
7
|
class StoredVersionedContractByName < DeployExecutableItemInternal
|
8
8
|
|
9
9
|
# @param [String] name
|
data/lib/rpc/rpc_client.rb
CHANGED
@@ -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
|
-
#
|
12
|
+
# Interacting with the network via RPC
|
14
13
|
class RpcClient
|
15
14
|
attr_accessor :ip_address, :port, :url, :state_root_hash
|
16
15
|
|
@@ -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 = ""
|
@@ -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
|
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
|
-
|
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
data/lib/version.rb
CHANGED
data/spec/client_spec.rb
CHANGED
@@ -1,25 +1,25 @@
|
|
1
1
|
# client_spec.rb
|
2
|
-
|
2
|
+
require './lib/rpc/rpc_client.rb'
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
#
|
7
|
-
|
8
|
-
|
9
|
-
#
|
10
|
-
|
11
|
-
#
|
12
|
-
|
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
|
-
|
15
|
-
|
16
|
-
#
|
17
|
-
|
18
|
-
|
19
|
-
#
|
20
|
-
|
21
|
-
|
22
|
-
|
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
|
-
|
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.
|
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-
|
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
|