sigma_rb 0.1.5 → 0.2.0
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 +2 -2
- data/lib/sigma/ergo_box.rb +4 -0
- data/lib/sigma/token.rb +1 -1
- data/lib/sigma.rb +1 -1
- data/sigma.gemspec +2 -2
- data/tests/sigma/token_test.rb +6 -4
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c92fe136337de8a807df096f11be91adc0adbbcdd3ec1954e1d709330f0923ce
|
4
|
+
data.tar.gz: 9b8e1184fbfb6b4bc3fac7f1ae17c9af6ff944b1fef162610a59c424115ddf35
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3f074423dd70b380e840e38a3c1a30569c019578e0e0cb57db8254f135ee8e8572ea8a9b4cf33fe10764c60ab968bd504a385532e74e963bacf8113b5ef18f9a
|
7
|
+
data.tar.gz: 9b22745d040d9ff79166bc8a14226ad6582796faf248b0d3a449d637c13a629387330564ac4a31af5af3f779f940117783447ab609ea083f92e7469fcae110ba
|
data/README.md
CHANGED
@@ -6,6 +6,7 @@ This project wraps the C bindings of Sigma-Rust and so they are required for usi
|
|
6
6
|
|
7
7
|
| Sigma_rb Version | Sigma-Rust Version |
|
8
8
|
| ---------------- | -------------------|
|
9
|
+
| 0.2.0 | 0.18.0 |
|
9
10
|
| 0.1.3 - 0.1.5 | 0.16.0 |
|
10
11
|
|
11
12
|
|
@@ -25,7 +26,6 @@ cargo build --release -p ergo-lib-c
|
|
25
26
|
|
26
27
|
This will build a release version of `libergo.a` located at `target/release/libergo.a` from the root directory. You will need to copy/move this to a C LIBRARY search path on your system. For my system I can use `/usr/local/lib` . This usually depends on OS.
|
27
28
|
|
28
|
-
So I did this to copy `libergo.a` to `/usr/local/lib` :
|
29
29
|
```
|
30
30
|
sudo cp ../../target/release/libergo.a /usr/local/lib/
|
31
31
|
```
|
@@ -36,7 +36,7 @@ While still in the `bindings/ergo-lib_c` directory you can generate the header f
|
|
36
36
|
cbindgen --config cbindgen.toml --crate ergo-lib-c --output h/ergo_lib.h
|
37
37
|
```
|
38
38
|
|
39
|
-
You will need to copy/move this header to a C INCLUDE search path. On my system I can use `/usr/local/include` .
|
39
|
+
You will need to copy/move this header to a C INCLUDE search path. On my system I can use `/usr/local/include` .
|
40
40
|
```
|
41
41
|
sudo cp h/ergo_lib.h /usr/local/include/
|
42
42
|
```
|
data/lib/sigma/ergo_box.rb
CHANGED
@@ -359,6 +359,10 @@ module Sigma
|
|
359
359
|
|
360
360
|
attr_accessor :pointer
|
361
361
|
|
362
|
+
# Safe maximum number of tokens in the box
|
363
|
+
# Calculated from the max box size (4kb) limit and the size of the token (32 bytes)
|
364
|
+
MAX_TOKENS_COUNT = 100
|
365
|
+
|
362
366
|
# Create a new box
|
363
367
|
# @param box_value: [BoxValue] amount of money associated with box
|
364
368
|
# @param creation_height: [Integer] height when a transaction containing the box is created
|
data/lib/sigma/token.rb
CHANGED
@@ -262,7 +262,7 @@ module Sigma
|
|
262
262
|
end
|
263
263
|
end
|
264
264
|
|
265
|
-
# Add to collection
|
265
|
+
# Add to collection. Max capacity of ErgoBox::MAX_TOKENS_COUNT tokens. Will throw error if adding more.
|
266
266
|
# @param token [Token]
|
267
267
|
def add(token)
|
268
268
|
error = ergo_lib_tokens_add(token.pointer, self.pointer)
|
data/lib/sigma.rb
CHANGED
data/sigma.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'sigma_rb'
|
3
|
-
s.version = '0.
|
3
|
+
s.version = '0.2.0'
|
4
4
|
s.summary = "Ruby bindings for Ergo types, abstractions, and interfaces provided by Sigma-Rust."
|
5
5
|
s.description = "Ruby bindings for the Ergo-Lib crate of Sigma-Rust. Specifically for chain types and abstractions, json serialization, box selection for tx inputs, tx creation, and signing."
|
6
6
|
s.authors = ["Dark Lord of Programming"]
|
@@ -13,7 +13,7 @@ Gem::Specification.new do |s|
|
|
13
13
|
s.add_dependency 'rake', '~> 13.0'
|
14
14
|
s.add_development_dependency 'ffi', '1.15.5'
|
15
15
|
s.add_development_dependency 'test-unit', '~> 3.5'
|
16
|
-
s.add_development_dependency 'yard', '
|
16
|
+
s.add_development_dependency 'yard', '~> 0.9.20'
|
17
17
|
s.extensions << "ext/Rakefile"
|
18
18
|
s.test_files = Dir["tests/**/*.rb"]
|
19
19
|
s.require_paths = ["lib"]
|
data/tests/sigma/token_test.rb
CHANGED
@@ -73,13 +73,15 @@ class Sigma::Token::Test < Test::Unit::TestCase
|
|
73
73
|
token_amount = Sigma::TokenAmount.with_i64(amount)
|
74
74
|
token = Sigma::Token.create(token_id: token_id, token_amount: token_amount)
|
75
75
|
|
76
|
-
|
76
|
+
max_tokens_count = ErgoBox::MAX_TOKENS_COUNT
|
77
|
+
|
78
|
+
max_tokens_count.times do |i|
|
77
79
|
tokens.add(token)
|
78
80
|
end
|
79
|
-
assert_equal(
|
80
|
-
assert_equal(tokens.get(
|
81
|
+
assert_equal(max_tokens_count, tokens.len)
|
82
|
+
assert_equal(tokens.get(max_tokens_count - 1), token)
|
81
83
|
|
82
|
-
#
|
84
|
+
# Next raises error
|
83
85
|
assert_raise do
|
84
86
|
tokens.add(token)
|
85
87
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sigma_rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dark Lord of Programming
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-07-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ffi-compiler
|
@@ -70,14 +70,14 @@ dependencies:
|
|
70
70
|
name: yard
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - "
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: 0.9.20
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - "
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: 0.9.20
|
83
83
|
description: Ruby bindings for the Ergo-Lib crate of Sigma-Rust. Specifically for
|