zold 0.31.10 → 0.32.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/.0pdd.yml +2 -19
- data/.github/typos.toml +11 -0
- data/.github/workflows/actionlint.yml +5 -21
- data/.github/workflows/bashate.yml +25 -0
- data/.github/workflows/codecov.yml +11 -24
- data/.github/workflows/copyrights.yml +6 -21
- data/.github/workflows/hadolint.yml +14 -0
- data/.github/workflows/markdown-lint.yml +19 -0
- data/.github/workflows/pdd.yml +5 -20
- data/.github/workflows/rake.yml +8 -22
- data/.github/workflows/reuse.yml +19 -0
- data/.github/workflows/shellcheck.yml +19 -0
- data/.github/workflows/typos.yml +21 -0
- data/.github/workflows/xcop.yml +5 -20
- data/.github/workflows/yamllint.yml +5 -20
- data/.gitignore +9 -6
- data/.rubocop.yml +16 -20
- data/.ruby-version +1 -1
- data/.rultor.yml +6 -22
- data/Dockerfile +11 -27
- data/Gemfile +21 -33
- data/Gemfile.lock +181 -126
- data/Guardfile +0 -0
- data/INSTALL.md +80 -59
- data/LICENSE.txt +1 -1
- data/LICENSES/MIT.txt +21 -0
- data/README.md +183 -154
- data/REUSE.toml +40 -0
- data/Rakefile +4 -38
- data/bin/zold +7 -37
- data/cucumber.yml +2 -19
- data/deploy.sh +4 -22
- data/features/cli.feature +2 -0
- data/features/gem_package.feature +2 -0
- data/features/step_definitions/steps.rb +2 -19
- data/features/support/env.rb +2 -19
- data/fixtures/merge/asserts.rb +3 -19
- data/fixtures/merge/into_no_wallet/assert.rb +2 -19
- data/fixtures/merge/legacy_negatives_stay/assert.rb +2 -19
- data/fixtures/merge/legacy_negatives_stay/copies/0123456789abcdef/scores.zc +1 -1
- data/fixtures/merge/missed_wallets/0123456789abcdef.z +0 -2
- data/fixtures/merge/missed_wallets/assert.rb +2 -19
- data/fixtures/merge/missed_wallets/copies/0123456789abcdef/scores.zc +1 -1
- data/fixtures/merge/negative_overwriting/assert.rb +2 -19
- data/fixtures/merge/negatives_in_between/0123456789abcdef.z +0 -1
- data/fixtures/merge/negatives_in_between/assert.rb +2 -19
- data/fixtures/merge/negatives_in_between/copies/0123456789abcdef/2.zc +0 -1
- data/fixtures/merge/negatives_in_between/opts +1 -1
- data/fixtures/merge/random_expenses/assert.rb +2 -19
- data/fixtures/merge/random_expenses/opts +1 -1
- data/fixtures/merge/simple_case/assert.rb +2 -19
- data/fixtures/merge/simple_case/opts +1 -1
- data/fixtures/merge/unconfirmed_income/assert.rb +2 -19
- data/fixtures/scripts/_head.sh +16 -33
- data/fixtures/scripts/calculate-scores.sh +3 -20
- data/fixtures/scripts/distribute-wallet.sh +26 -43
- data/fixtures/scripts/print-helps.sh +5 -23
- data/fixtures/scripts/pull-on-start.sh +12 -29
- data/fixtures/scripts/push-and-pull.sh +10 -27
- data/fixtures/scripts/redeploy-on-upgrade.sh +18 -34
- data/fixtures/scripts/spread-wallets.sh +24 -40
- data/lib/zold/age.rb +3 -20
- data/lib/zold/amount.rb +3 -20
- data/lib/zold/cached_wallets.rb +3 -20
- data/lib/zold/commands/alias.rb +4 -21
- data/lib/zold/commands/args.rb +4 -21
- data/lib/zold/commands/calculate.rb +5 -22
- data/lib/zold/commands/clean.rb +6 -23
- data/lib/zold/commands/create.rb +5 -22
- data/lib/zold/commands/diff.rb +5 -22
- data/lib/zold/commands/fetch.rb +6 -23
- data/lib/zold/commands/invoice.rb +5 -22
- data/lib/zold/commands/list.rb +5 -22
- data/lib/zold/commands/merge.rb +7 -24
- data/lib/zold/commands/next.rb +5 -22
- data/lib/zold/commands/node.rb +4 -21
- data/lib/zold/commands/pay.rb +6 -23
- data/lib/zold/commands/propagate.rb +5 -22
- data/lib/zold/commands/pull.rb +5 -22
- data/lib/zold/commands/push.rb +5 -22
- data/lib/zold/commands/remote.rb +7 -24
- data/lib/zold/commands/remove.rb +5 -22
- data/lib/zold/commands/routines/audit.rb +4 -21
- data/lib/zold/commands/routines/gc.rb +6 -23
- data/lib/zold/commands/routines/reconcile.rb +5 -22
- data/lib/zold/commands/routines/reconnect.rb +4 -21
- data/lib/zold/commands/routines/retire.rb +4 -21
- data/lib/zold/commands/routines/spread.rb +5 -22
- data/lib/zold/commands/routines.rb +3 -20
- data/lib/zold/commands/show.rb +5 -22
- data/lib/zold/commands/taxes.rb +5 -22
- data/lib/zold/commands/thread_badge.rb +3 -20
- data/lib/zold/copies.rb +6 -25
- data/lib/zold/dir_items.rb +3 -20
- data/lib/zold/endless.rb +5 -22
- data/lib/zold/gem.rb +3 -20
- data/lib/zold/hands.rb +6 -23
- data/lib/zold/head.rb +4 -21
- data/lib/zold/hexnum.rb +3 -20
- data/lib/zold/http.rb +3 -20
- data/lib/zold/hungry_wallets.rb +6 -23
- data/lib/zold/id.rb +3 -20
- data/lib/zold/json_page.rb +5 -22
- data/lib/zold/key.rb +3 -20
- data/lib/zold/metronome.rb +5 -22
- data/lib/zold/node/async_entrance.rb +6 -23
- data/lib/zold/node/entrance.rb +7 -24
- data/lib/zold/node/farm.rb +5 -22
- data/lib/zold/node/farmers.rb +15 -32
- data/lib/zold/node/front.rb +6 -23
- data/lib/zold/node/journaled_pipeline.rb +8 -25
- data/lib/zold/node/nodup_entrance.rb +6 -23
- data/lib/zold/node/nospam_entrance.rb +6 -23
- data/lib/zold/node/pipeline.rb +6 -23
- data/lib/zold/node/safe_entrance.rb +4 -22
- data/lib/zold/node/soft_error.rb +3 -20
- data/lib/zold/node/spread_entrance.rb +5 -22
- data/lib/zold/node/sync_entrance.rb +5 -22
- data/lib/zold/node/trace.rb +3 -20
- data/lib/zold/patch.rb +6 -23
- data/lib/zold/prefixes.rb +3 -20
- data/lib/zold/remotes.rb +5 -22
- data/lib/zold/signature.rb +3 -20
- data/lib/zold/size.rb +3 -20
- data/lib/zold/sync_wallets.rb +5 -22
- data/lib/zold/tax.rb +4 -21
- data/lib/zold/thread_pool.rb +4 -21
- data/lib/zold/tree_wallets.rb +3 -20
- data/lib/zold/txn.rb +4 -21
- data/lib/zold/txns.rb +4 -21
- data/lib/zold/upgrades.rb +4 -21
- data/lib/zold/verbose_thread.rb +5 -22
- data/lib/zold/version.rb +4 -21
- data/lib/zold/version_file.rb +4 -21
- data/lib/zold/wallet.rb +6 -23
- data/lib/zold/wallets.rb +5 -23
- data/lib/zold.rb +3 -21
- data/resources/banned-wallets.log +6 -6
- data/test/commands/routines/test_audit.rb +3 -21
- data/test/commands/routines/test_gc.rb +3 -21
- data/test/commands/routines/test_reconcile.rb +3 -21
- data/test/commands/routines/test_reconnect.rb +3 -21
- data/test/commands/routines/test_retire.rb +3 -21
- data/test/commands/test_alias.rb +2 -20
- data/test/commands/test_calculate.rb +5 -23
- data/test/commands/test_clean.rb +5 -23
- data/test/commands/test_create.rb +6 -24
- data/test/commands/test_diff.rb +4 -22
- data/test/commands/test_fetch.rb +3 -21
- data/test/commands/test_invoice.rb +3 -21
- data/test/commands/test_list.rb +3 -21
- data/test/commands/test_merge.rb +12 -35
- data/test/commands/test_node.rb +3 -21
- data/test/commands/test_pay.rb +5 -23
- data/test/commands/test_propagate.rb +6 -24
- data/test/commands/test_pull.rb +4 -22
- data/test/commands/test_push.rb +3 -21
- data/test/commands/test_remote.rb +10 -28
- data/test/commands/test_remove.rb +7 -25
- data/test/commands/test_show.rb +3 -21
- data/test/commands/test_taxes.rb +5 -23
- data/test/fake_home.rb +5 -22
- data/test/node/fake_entrance.rb +3 -20
- data/test/node/fake_node.rb +5 -22
- data/test/node/test_async_entrance.rb +3 -21
- data/test/node/test_entrance.rb +7 -25
- data/test/node/test_farm.rb +15 -33
- data/test/node/test_farmers.rb +3 -21
- data/test/node/test_front.rb +22 -42
- data/test/node/test_nodup_entrance.rb +4 -22
- data/test/node/test_nospam_entrance.rb +6 -24
- data/test/node/test_safe_entrance.rb +3 -21
- data/test/node/test_spread_entrance.rb +4 -22
- data/test/node/test_sync_entrance.rb +4 -22
- data/test/node/test_trace.rb +4 -22
- data/test/test__helper.rb +32 -31
- data/test/test_age.rb +5 -23
- data/test/test_amount.rb +15 -34
- data/test/test_cached_wallets.rb +3 -21
- data/test/test_copies.rb +10 -28
- data/test/test_dir_items.rb +4 -22
- data/test/test_gem.rb +3 -21
- data/test/test_hands.rb +3 -21
- data/test/test_hexnum.rb +3 -21
- data/test/test_http.rb +9 -27
- data/test/test_hungry_wallets.rb +6 -24
- data/test/test_id.rb +10 -28
- data/test/test_json_page.rb +3 -21
- data/test/test_key.rb +5 -23
- data/test/test_metronome.rb +6 -24
- data/test/test_patch.rb +10 -28
- data/test/test_prefixes.rb +3 -21
- data/test/test_remotes.rb +17 -35
- data/test/test_signature.rb +3 -21
- data/test/test_size.rb +3 -21
- data/test/test_sync_wallets.rb +3 -21
- data/test/test_tax.rb +6 -24
- data/test/test_thread_pool.rb +6 -24
- data/test/test_tree_wallets.rb +4 -22
- data/test/test_txn.rb +3 -21
- data/test/test_upgrades.rb +3 -21
- data/test/test_verbose_thread.rb +6 -24
- data/test/test_version.rb +2 -20
- data/test/test_wallet.rb +15 -33
- data/test/test_wallets.rb +4 -22
- data/test/test_zold.rb +7 -25
- data/test/upgrades/test_delete_banned_wallets.rb +4 -22
- data/test/upgrades/test_protocol_up.rb +3 -21
- data/upgrades/2.rb +3 -20
- data/upgrades/delete_banned_wallets.rb +3 -20
- data/upgrades/move_wallets_into_tree.rb +3 -20
- data/upgrades/protocol_up.rb +3 -20
- data/upgrades/rename_foreign_wallets.rb +3 -20
- data/views/journal.haml +25 -0
- data/views/layout.haml +25 -0
- data/views/wallet.haml +25 -0
- data/zold.gemspec +5 -21
- metadata +33 -15
- data/.simplecov +0 -36
- data/lib/zold/log.rb +0 -139
- data/test/test_log.rb +0 -49
data/test/test_verbose_thread.rb
CHANGED
|
@@ -1,37 +1,19 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# Copyright (c) 2018-
|
|
4
|
-
#
|
|
5
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
# of this software and associated documentation files (the 'Software'), to deal
|
|
7
|
-
# in the Software without restriction, including without limitation the rights
|
|
8
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
# copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
# furnished to do so, subject to the following conditions:
|
|
11
|
-
#
|
|
12
|
-
# The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
# copies or substantial portions of the Software.
|
|
14
|
-
#
|
|
15
|
-
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
# SOFTWARE.
|
|
3
|
+
# SPDX-FileCopyrightText: Copyright (c) 2018-2025 Zerocracy
|
|
4
|
+
# SPDX-License-Identifier: MIT
|
|
22
5
|
|
|
23
|
-
require 'minitest/autorun'
|
|
24
6
|
require_relative 'test__helper'
|
|
25
7
|
require_relative '../lib/zold/verbose_thread'
|
|
26
8
|
|
|
27
9
|
# VerboseThread test.
|
|
28
10
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
|
29
|
-
# Copyright:: Copyright (c) 2018-
|
|
11
|
+
# Copyright:: Copyright (c) 2018-2025 Zerocracy
|
|
30
12
|
# License:: MIT
|
|
31
13
|
class TestVerboseThread < Zold::Test
|
|
32
14
|
def test_exceptions_are_logged
|
|
33
15
|
assert_raises RuntimeError do
|
|
34
|
-
Zold::VerboseThread.new(
|
|
16
|
+
Zold::VerboseThread.new(Loog::NULL).run do
|
|
35
17
|
raise 'Intentional'
|
|
36
18
|
end
|
|
37
19
|
end
|
|
@@ -39,7 +21,7 @@ class TestVerboseThread < Zold::Test
|
|
|
39
21
|
|
|
40
22
|
def test_syntax_exceptions_are_logged
|
|
41
23
|
assert_raises NoMethodError do
|
|
42
|
-
Zold::VerboseThread.new(
|
|
24
|
+
Zold::VerboseThread.new(Loog::NULL).run do
|
|
43
25
|
this_method_doesnt_exist(1)
|
|
44
26
|
end
|
|
45
27
|
end
|
|
@@ -47,7 +29,7 @@ class TestVerboseThread < Zold::Test
|
|
|
47
29
|
|
|
48
30
|
def test_grammar_exceptions_are_logged
|
|
49
31
|
assert_raises NameError do
|
|
50
|
-
Zold::VerboseThread.new(
|
|
32
|
+
Zold::VerboseThread.new(Loog::NULL).run do
|
|
51
33
|
the syntax is broken here
|
|
52
34
|
end
|
|
53
35
|
end
|
data/test/test_version.rb
CHANGED
|
@@ -1,28 +1,10 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# Copyright (c) 2018-
|
|
4
|
-
#
|
|
5
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
# of this software and associated documentation files (the 'Software'), to deal
|
|
7
|
-
# in the Software without restriction, including without limitation the rights
|
|
8
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
# copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
# furnished to do so, subject to the following conditions:
|
|
11
|
-
#
|
|
12
|
-
# The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
# copies or substantial portions of the Software.
|
|
14
|
-
#
|
|
15
|
-
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
# SOFTWARE.
|
|
3
|
+
# SPDX-FileCopyrightText: Copyright (c) 2018-2025 Zerocracy
|
|
4
|
+
# SPDX-License-Identifier: MIT
|
|
22
5
|
|
|
23
6
|
require 'semantic'
|
|
24
7
|
require 'zold/version'
|
|
25
|
-
require 'minitest/autorun'
|
|
26
8
|
|
|
27
9
|
class TestVersion < Zold::Test
|
|
28
10
|
def test_has_version
|
data/test/test_wallet.rb
CHANGED
|
@@ -1,26 +1,8 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# Copyright (c) 2018-
|
|
4
|
-
#
|
|
5
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
# of this software and associated documentation files (the 'Software'), to deal
|
|
7
|
-
# in the Software without restriction, including without limitation the rights
|
|
8
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
# copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
# furnished to do so, subject to the following conditions:
|
|
11
|
-
#
|
|
12
|
-
# The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
# copies or substantial portions of the Software.
|
|
14
|
-
#
|
|
15
|
-
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
# SOFTWARE.
|
|
3
|
+
# SPDX-FileCopyrightText: Copyright (c) 2018-2025 Zerocracy
|
|
4
|
+
# SPDX-License-Identifier: MIT
|
|
22
5
|
|
|
23
|
-
require 'minitest/autorun'
|
|
24
6
|
require 'tmpdir'
|
|
25
7
|
require_relative 'test__helper'
|
|
26
8
|
require_relative 'fake_home'
|
|
@@ -35,13 +17,13 @@ require_relative '../lib/zold/commands/pay'
|
|
|
35
17
|
|
|
36
18
|
# Wallet test.
|
|
37
19
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
|
38
|
-
# Copyright:: Copyright (c) 2018-
|
|
20
|
+
# Copyright:: Copyright (c) 2018-2025 Zerocracy
|
|
39
21
|
# License:: MIT
|
|
40
22
|
class TestWallet < Zold::Test
|
|
41
23
|
def test_reads_empty_wallet
|
|
42
24
|
FakeHome.new(log: fake_log).run do |home|
|
|
43
25
|
wallet = home.create_wallet
|
|
44
|
-
|
|
26
|
+
assert_empty(wallet.txns)
|
|
45
27
|
assert_equal(Zold::Amount::ZERO, wallet.balance)
|
|
46
28
|
end
|
|
47
29
|
end
|
|
@@ -49,7 +31,7 @@ class TestWallet < Zold::Test
|
|
|
49
31
|
def test_generates_memo
|
|
50
32
|
FakeHome.new(log: fake_log).run do |home|
|
|
51
33
|
wallet = home.create_wallet
|
|
52
|
-
|
|
34
|
+
refute_nil(wallet.mnemo)
|
|
53
35
|
end
|
|
54
36
|
end
|
|
55
37
|
|
|
@@ -62,7 +44,7 @@ class TestWallet < Zold::Test
|
|
|
62
44
|
wallet.txns
|
|
63
45
|
wallet.sub(Zold::Amount.new(zld: 39.99), "NOPREFIX@#{Zold::Id.new}", key)
|
|
64
46
|
time = Time.now - start
|
|
65
|
-
|
|
47
|
+
assert_operator(time, :<, 0.5, "Too slow: #{Zold::Age.new(start)} seconds")
|
|
66
48
|
end
|
|
67
49
|
end
|
|
68
50
|
|
|
@@ -74,8 +56,8 @@ class TestWallet < Zold::Test
|
|
|
74
56
|
wallet.sub(amount, "NOPREFIX@#{Zold::Id.new}", key)
|
|
75
57
|
wallet.sub(amount, "NOPREFIX@#{Zold::Id.new}", key)
|
|
76
58
|
wallet.sub(amount, "NOPREFIX@#{Zold::Id.new}", key)
|
|
77
|
-
|
|
78
|
-
wallet.balance
|
|
59
|
+
assert_equal(
|
|
60
|
+
wallet.balance, amount * -3,
|
|
79
61
|
"#{wallet.balance} is not equal to #{amount * -3}"
|
|
80
62
|
)
|
|
81
63
|
end
|
|
@@ -95,7 +77,7 @@ class TestWallet < Zold::Test
|
|
|
95
77
|
assert_raises do
|
|
96
78
|
wallet.add(Zold::Txn.new(1, Time.now, amount * -1, 'NOPREFIX', id, '-'))
|
|
97
79
|
end
|
|
98
|
-
|
|
80
|
+
assert_predicate(wallet.balance, :zero?)
|
|
99
81
|
end
|
|
100
82
|
end
|
|
101
83
|
|
|
@@ -146,7 +128,7 @@ class TestWallet < Zold::Test
|
|
|
146
128
|
wallet.sub(Zold::Amount.new(zents: 2), "NOPREFIX@#{Zold::Id.new}", key, time: time)
|
|
147
129
|
wallet.add(Zold::Txn.new(2, time, Zold::Amount.new(zents: 3), 'NOPREFIX', Zold::Id.new, '-'))
|
|
148
130
|
wallet.sub(Zold::Amount.new(zents: 4), "NOPREFIX@#{Zold::Id.new}", key, time: time)
|
|
149
|
-
assert_equal('3, 1, -2, -4', wallet.txns.map
|
|
131
|
+
assert_equal('3, 1, -2, -4', wallet.txns.map { |t| t.amount.to_i }.join(', '))
|
|
150
132
|
end
|
|
151
133
|
end
|
|
152
134
|
|
|
@@ -168,7 +150,7 @@ class TestWallet < Zold::Test
|
|
|
168
150
|
key = Zold::Key.new(file: 'fixtures/id_rsa')
|
|
169
151
|
txn = wallet.sub(amount, "NOPREFIX@#{Zold::Id.new}", key)
|
|
170
152
|
wallet.add(txn.inverse(Zold::Id.new))
|
|
171
|
-
|
|
153
|
+
refute(Zold::Wallet.new(wallet.path).txns[1].sign.end_with?("\n"))
|
|
172
154
|
end
|
|
173
155
|
end
|
|
174
156
|
|
|
@@ -210,7 +192,7 @@ class TestWallet < Zold::Test
|
|
|
210
192
|
def test_returns_modified_time
|
|
211
193
|
FakeHome.new(log: fake_log).run do |home|
|
|
212
194
|
wallet = home.create_wallet
|
|
213
|
-
|
|
195
|
+
assert_operator(wallet.mtime, :>, Time.now - (60 * 60))
|
|
214
196
|
end
|
|
215
197
|
end
|
|
216
198
|
|
|
@@ -260,8 +242,8 @@ class TestWallet < Zold::Test
|
|
|
260
242
|
wallet.txns.each do |t|
|
|
261
243
|
sum += t.amount unless t.amount.negative?
|
|
262
244
|
end
|
|
263
|
-
|
|
264
|
-
sum
|
|
245
|
+
assert_equal(
|
|
246
|
+
sum, Zold::Amount.new(zents: 235_965_503_242),
|
|
265
247
|
"#{sum} (#{sum.to_i}) is not equal to #{Zold::Amount.new(zld: 54.94)}"
|
|
266
248
|
)
|
|
267
249
|
end
|
|
@@ -313,6 +295,6 @@ class TestWallet < Zold::Test
|
|
|
313
295
|
diff = GetProcessMem.new.bytes.to_i - start
|
|
314
296
|
GC.stress = false
|
|
315
297
|
fake_log.debug("Memory diff is #{diff}")
|
|
316
|
-
|
|
298
|
+
assert_operator(diff, :<, 20_000_000)
|
|
317
299
|
end
|
|
318
300
|
end
|
data/test/test_wallets.rb
CHANGED
|
@@ -1,26 +1,8 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# Copyright (c) 2018-
|
|
4
|
-
#
|
|
5
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
# of this software and associated documentation files (the 'Software'), to deal
|
|
7
|
-
# in the Software without restriction, including without limitation the rights
|
|
8
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
# copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
# furnished to do so, subject to the following conditions:
|
|
11
|
-
#
|
|
12
|
-
# The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
# copies or substantial portions of the Software.
|
|
14
|
-
#
|
|
15
|
-
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
# SOFTWARE.
|
|
3
|
+
# SPDX-FileCopyrightText: Copyright (c) 2018-2025 Zerocracy
|
|
4
|
+
# SPDX-License-Identifier: MIT
|
|
22
5
|
|
|
23
|
-
require 'minitest/autorun'
|
|
24
6
|
require 'tmpdir'
|
|
25
7
|
require_relative 'test__helper'
|
|
26
8
|
require_relative 'fake_home'
|
|
@@ -31,7 +13,7 @@ require_relative '../lib/zold/amount'
|
|
|
31
13
|
|
|
32
14
|
# Wallets test.
|
|
33
15
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
|
34
|
-
# Copyright:: Copyright (c) 2018-
|
|
16
|
+
# Copyright:: Copyright (c) 2018-2025 Zerocracy
|
|
35
17
|
# License:: MIT
|
|
36
18
|
class TestWallets < Zold::Test
|
|
37
19
|
def test_adds_wallet
|
|
@@ -59,7 +41,7 @@ class TestWallets < Zold::Test
|
|
|
59
41
|
end
|
|
60
42
|
end
|
|
61
43
|
|
|
62
|
-
def
|
|
44
|
+
def test_subtracts_dir_path_from_full_path
|
|
63
45
|
Dir.mktmpdir do |dir|
|
|
64
46
|
Dir.chdir(dir) do
|
|
65
47
|
wallets = Zold::Wallets.new(Dir.pwd)
|
data/test/test_zold.rb
CHANGED
|
@@ -1,26 +1,8 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# Copyright (c) 2018-
|
|
4
|
-
#
|
|
5
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
# of this software and associated documentation files (the 'Software'), to deal
|
|
7
|
-
# in the Software without restriction, including without limitation the rights
|
|
8
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
# copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
# furnished to do so, subject to the following conditions:
|
|
11
|
-
#
|
|
12
|
-
# The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
# copies or substantial portions of the Software.
|
|
14
|
-
#
|
|
15
|
-
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
# SOFTWARE.
|
|
3
|
+
# SPDX-FileCopyrightText: Copyright (c) 2018-2025 Zerocracy
|
|
4
|
+
# SPDX-License-Identifier: MIT
|
|
22
5
|
|
|
23
|
-
require 'minitest/autorun'
|
|
24
6
|
require 'tmpdir'
|
|
25
7
|
require 'open3'
|
|
26
8
|
require 'English'
|
|
@@ -30,7 +12,7 @@ require_relative '../lib/zold/age'
|
|
|
30
12
|
|
|
31
13
|
# Zold main module test.
|
|
32
14
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
|
33
|
-
# Copyright:: Copyright (c) 2018-
|
|
15
|
+
# Copyright:: Copyright (c) 2018-2025 Zerocracy
|
|
34
16
|
# License:: MIT
|
|
35
17
|
class TestZold < Zold::Test
|
|
36
18
|
Dir.new('fixtures/scripts').select { |f| f =~ /\.sh$/ && !f.start_with?('_') }.each do |f|
|
|
@@ -65,12 +47,12 @@ class TestZold < Zold::Test
|
|
|
65
47
|
|
|
66
48
|
def test_help
|
|
67
49
|
stdout = exec('--help')
|
|
68
|
-
|
|
50
|
+
assert_includes(stdout, 'Usage: zold')
|
|
69
51
|
end
|
|
70
52
|
|
|
71
53
|
def test_show_version
|
|
72
54
|
stdout = exec('--version')
|
|
73
|
-
|
|
55
|
+
assert_includes(stdout, Zold::VERSION)
|
|
74
56
|
end
|
|
75
57
|
|
|
76
58
|
def test_create_new_wallet
|
|
@@ -81,7 +63,7 @@ class TestZold < Zold::Test
|
|
|
81
63
|
'--verbose --trace create --public-key=id_rsa.pub',
|
|
82
64
|
dir
|
|
83
65
|
)
|
|
84
|
-
|
|
66
|
+
assert_includes(stdout, 'created at')
|
|
85
67
|
end
|
|
86
68
|
end
|
|
87
69
|
|
|
@@ -92,7 +74,7 @@ class TestZold < Zold::Test
|
|
|
92
74
|
stdout = `cd #{dir} && #{bin} #{tail} 2>&1`
|
|
93
75
|
unless $CHILD_STATUS.exitstatus.zero?
|
|
94
76
|
puts stdout
|
|
95
|
-
assert_equal($CHILD_STATUS.exitstatus
|
|
77
|
+
assert_equal(0, $CHILD_STATUS.exitstatus)
|
|
96
78
|
end
|
|
97
79
|
stdout
|
|
98
80
|
end
|
|
@@ -1,26 +1,8 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# Copyright (c) 2018-
|
|
4
|
-
#
|
|
5
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
# of this software and associated documentation files (the 'Software'), to deal
|
|
7
|
-
# in the Software without restriction, including without limitation the rights
|
|
8
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
# copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
# furnished to do so, subject to the following conditions:
|
|
11
|
-
#
|
|
12
|
-
# The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
# copies or substantial portions of the Software.
|
|
14
|
-
#
|
|
15
|
-
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
# SOFTWARE.
|
|
3
|
+
# SPDX-FileCopyrightText: Copyright (c) 2018-2025 Zerocracy
|
|
4
|
+
# SPDX-License-Identifier: MIT
|
|
22
5
|
|
|
23
|
-
require 'minitest/autorun'
|
|
24
6
|
require_relative '../test__helper'
|
|
25
7
|
require_relative '../../lib/zold/id'
|
|
26
8
|
require_relative '../../upgrades/delete_banned_wallets'
|
|
@@ -28,7 +10,7 @@ require_relative '../fake_home'
|
|
|
28
10
|
|
|
29
11
|
# Delete banned wallets.
|
|
30
12
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
|
31
|
-
# Copyright:: Copyright (c) 2018-
|
|
13
|
+
# Copyright:: Copyright (c) 2018-2025 Zerocracy
|
|
32
14
|
# License:: MIT
|
|
33
15
|
class TestDeleteBannedWallets < Zold::Test
|
|
34
16
|
def test_delete_them
|
|
@@ -41,7 +23,7 @@ class TestDeleteBannedWallets < Zold::Test
|
|
|
41
23
|
File.join(home.dir, "a/b/c/#{id}#{Zold::Wallet::EXT}")
|
|
42
24
|
)
|
|
43
25
|
Zold::DeleteBannedWallets.new(home.dir, fake_log).exec
|
|
44
|
-
|
|
26
|
+
assert_path_exists(File.join(home.dir, "a/b/c/#{id}#{Zold::Wallet::EXT}-banned"))
|
|
45
27
|
end
|
|
46
28
|
end
|
|
47
29
|
end
|
|
@@ -1,33 +1,15 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# Copyright (c) 2018-
|
|
4
|
-
#
|
|
5
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
# of this software and associated documentation files (the 'Software'), to deal
|
|
7
|
-
# in the Software without restriction, including without limitation the rights
|
|
8
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
# copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
# furnished to do so, subject to the following conditions:
|
|
11
|
-
#
|
|
12
|
-
# The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
# copies or substantial portions of the Software.
|
|
14
|
-
#
|
|
15
|
-
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
# SOFTWARE.
|
|
3
|
+
# SPDX-FileCopyrightText: Copyright (c) 2018-2025 Zerocracy
|
|
4
|
+
# SPDX-License-Identifier: MIT
|
|
22
5
|
|
|
23
|
-
require 'minitest/autorun'
|
|
24
6
|
require_relative '../test__helper'
|
|
25
7
|
require_relative '../../upgrades/protocol_up'
|
|
26
8
|
require_relative '../fake_home'
|
|
27
9
|
|
|
28
10
|
# Protocol up.
|
|
29
11
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
|
30
|
-
# Copyright:: Copyright (c) 2018-
|
|
12
|
+
# Copyright:: Copyright (c) 2018-2025 Zerocracy
|
|
31
13
|
# License:: MIT
|
|
32
14
|
class TestProtocolUp < Zold::Test
|
|
33
15
|
def test_upgrades_protocol_in_wallet
|
data/upgrades/2.rb
CHANGED
|
@@ -1,24 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# Copyright (c) 2018-
|
|
4
|
-
#
|
|
5
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
# of this software and associated documentation files (the 'Software'), to deal
|
|
7
|
-
# in the Software without restriction, including without limitation the rights
|
|
8
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
# copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
# furnished to do so, subject to the following conditions:
|
|
11
|
-
#
|
|
12
|
-
# The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
# copies or substantial portions of the Software.
|
|
14
|
-
#
|
|
15
|
-
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
# SOFTWARE.
|
|
3
|
+
# SPDX-FileCopyrightText: Copyright (c) 2018-2025 Zerocracy
|
|
4
|
+
# SPDX-License-Identifier: MIT
|
|
22
5
|
|
|
23
6
|
# https://github.com/zold-io/zold/issues/358
|
|
24
7
|
# rename all wallets from their current names into *.z
|
|
@@ -33,7 +16,7 @@ module Zold
|
|
|
33
16
|
|
|
34
17
|
def exec
|
|
35
18
|
Dir.new(@home).each do |path|
|
|
36
|
-
next unless
|
|
19
|
+
next unless /^[a-f0-9]{16}$/.match?(path)
|
|
37
20
|
File.rename(path, "#{path}.z")
|
|
38
21
|
@log.info("Renamed #{path} to #{path}.z")
|
|
39
22
|
end
|
|
@@ -1,24 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# Copyright (c) 2018-
|
|
4
|
-
#
|
|
5
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
# of this software and associated documentation files (the 'Software'), to deal
|
|
7
|
-
# in the Software without restriction, including without limitation the rights
|
|
8
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
# copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
# furnished to do so, subject to the following conditions:
|
|
11
|
-
#
|
|
12
|
-
# The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
# copies or substantial portions of the Software.
|
|
14
|
-
#
|
|
15
|
-
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
# SOFTWARE.
|
|
3
|
+
# SPDX-FileCopyrightText: Copyright (c) 2018-2025 Zerocracy
|
|
4
|
+
# SPDX-License-Identifier: MIT
|
|
22
5
|
|
|
23
6
|
require 'rainbow'
|
|
24
7
|
require_relative '../lib/zold/version'
|
|
@@ -35,7 +18,7 @@ module Zold
|
|
|
35
18
|
def exec
|
|
36
19
|
DirItems.new(@home).fetch.each do |path|
|
|
37
20
|
name = File.basename(path)
|
|
38
|
-
next unless
|
|
21
|
+
next unless /^[a-f0-9]{16}#{Wallet::EXT}$/o.match?(name)
|
|
39
22
|
id = Id.new(name[0..15])
|
|
40
23
|
next unless Id::BANNED.include?(id.to_s)
|
|
41
24
|
path = File.join(@home, path)
|
|
@@ -1,24 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# Copyright (c) 2018-
|
|
4
|
-
#
|
|
5
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
# of this software and associated documentation files (the 'Software'), to deal
|
|
7
|
-
# in the Software without restriction, including without limitation the rights
|
|
8
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
# copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
# furnished to do so, subject to the following conditions:
|
|
11
|
-
#
|
|
12
|
-
# The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
# copies or substantial portions of the Software.
|
|
14
|
-
#
|
|
15
|
-
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
# SOFTWARE.
|
|
3
|
+
# SPDX-FileCopyrightText: Copyright (c) 2018-2025 Zerocracy
|
|
4
|
+
# SPDX-License-Identifier: MIT
|
|
22
5
|
|
|
23
6
|
require 'fileutils'
|
|
24
7
|
require_relative '../lib/zold/version'
|
|
@@ -34,7 +17,7 @@ module Zold
|
|
|
34
17
|
|
|
35
18
|
def exec
|
|
36
19
|
Dir.new(@home).each do |path|
|
|
37
|
-
next unless
|
|
20
|
+
next unless /^[a-f0-9]{16}#{Wallet::EXT}$/o.match?(path)
|
|
38
21
|
f = File.join(@home, path)
|
|
39
22
|
target = File.join(@home, (path.split('', 5).take(4) + [path]).join('/'))
|
|
40
23
|
FileUtils.mkdir_p(File.dirname(target))
|
data/upgrades/protocol_up.rb
CHANGED
|
@@ -1,24 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# Copyright (c) 2018-
|
|
4
|
-
#
|
|
5
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
# of this software and associated documentation files (the 'Software'), to deal
|
|
7
|
-
# in the Software without restriction, including without limitation the rights
|
|
8
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
# copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
# furnished to do so, subject to the following conditions:
|
|
11
|
-
#
|
|
12
|
-
# The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
# copies or substantial portions of the Software.
|
|
14
|
-
#
|
|
15
|
-
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
# SOFTWARE.
|
|
3
|
+
# SPDX-FileCopyrightText: Copyright (c) 2018-2025 Zerocracy
|
|
4
|
+
# SPDX-License-Identifier: MIT
|
|
22
5
|
|
|
23
6
|
require_relative '../lib/zold/version'
|
|
24
7
|
require_relative '../lib/zold/wallet'
|
|
@@ -33,7 +16,7 @@ module Zold
|
|
|
33
16
|
|
|
34
17
|
def exec
|
|
35
18
|
Dir.new(@home).each do |path|
|
|
36
|
-
next unless
|
|
19
|
+
next unless /^[a-f0-9]{16}#{Wallet::EXT}$/o.match?(path)
|
|
37
20
|
f = File.join(@home, path)
|
|
38
21
|
lines = File.read(f).split("\n")
|
|
39
22
|
next if lines[1].to_i == Zold::PROTOCOL
|
|
@@ -1,24 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# Copyright (c) 2018-
|
|
4
|
-
#
|
|
5
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
# of this software and associated documentation files (the 'Software'), to deal
|
|
7
|
-
# in the Software without restriction, including without limitation the rights
|
|
8
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
# copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
# furnished to do so, subject to the following conditions:
|
|
11
|
-
#
|
|
12
|
-
# The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
# copies or substantial portions of the Software.
|
|
14
|
-
#
|
|
15
|
-
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
# SOFTWARE.
|
|
3
|
+
# SPDX-FileCopyrightText: Copyright (c) 2018-2025 Zerocracy
|
|
4
|
+
# SPDX-License-Identifier: MIT
|
|
22
5
|
|
|
23
6
|
require 'rainbow'
|
|
24
7
|
require_relative '../lib/zold/version'
|
|
@@ -35,7 +18,7 @@ module Zold
|
|
|
35
18
|
|
|
36
19
|
def exec
|
|
37
20
|
Dir.new(@home).each do |path|
|
|
38
|
-
next unless
|
|
21
|
+
next unless /^[a-f0-9]{16}#{Wallet::EXT}$/o.match?(path)
|
|
39
22
|
f = File.join(@home, path)
|
|
40
23
|
wallet = Wallet.new(f)
|
|
41
24
|
next if wallet.network == @network
|
data/views/journal.haml
CHANGED
|
@@ -1,3 +1,28 @@
|
|
|
1
|
+
-# SPDX-FileCopyrightText: Copyright (c) 2018-2025 Zerocracy
|
|
2
|
+
-# SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
4
|
+
- # (The MIT License)
|
|
5
|
+
- #
|
|
6
|
+
- # Copyright (c) 2018-2025 Zerocracy
|
|
7
|
+
- #
|
|
8
|
+
- # Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
9
|
+
- # of this software and associated documentation files (the 'Software'), to deal
|
|
10
|
+
- # in the Software without restriction, including without limitation the rights
|
|
11
|
+
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
12
|
+
- # copies of the Software, and to permit persons to whom the Software is
|
|
13
|
+
- # furnished to do so, subject to the following conditions:
|
|
14
|
+
- #
|
|
15
|
+
- # The above copyright notice and this permission notice shall be included in all
|
|
16
|
+
- # copies or substantial portions of the Software.
|
|
17
|
+
- #
|
|
18
|
+
- # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
19
|
+
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
20
|
+
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
21
|
+
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
22
|
+
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
23
|
+
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
24
|
+
- # SOFTWARE.
|
|
25
|
+
|
|
1
26
|
- if id
|
|
2
27
|
%p
|
|
3
28
|
Showing only wallet
|
data/views/layout.haml
CHANGED
|
@@ -1,3 +1,28 @@
|
|
|
1
|
+
-# SPDX-FileCopyrightText: Copyright (c) 2018-2025 Zerocracy
|
|
2
|
+
-# SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
4
|
+
- # (The MIT License)
|
|
5
|
+
- #
|
|
6
|
+
- # Copyright (c) 2018-2025 Zerocracy
|
|
7
|
+
- #
|
|
8
|
+
- # Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
9
|
+
- # of this software and associated documentation files (the 'Software'), to deal
|
|
10
|
+
- # in the Software without restriction, including without limitation the rights
|
|
11
|
+
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
12
|
+
- # copies of the Software, and to permit persons to whom the Software is
|
|
13
|
+
- # furnished to do so, subject to the following conditions:
|
|
14
|
+
- #
|
|
15
|
+
- # The above copyright notice and this permission notice shall be included in all
|
|
16
|
+
- # copies or substantial portions of the Software.
|
|
17
|
+
- #
|
|
18
|
+
- # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
19
|
+
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
20
|
+
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
21
|
+
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
22
|
+
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
23
|
+
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
24
|
+
- # SOFTWARE.
|
|
25
|
+
|
|
1
26
|
!!! 5
|
|
2
27
|
%html
|
|
3
28
|
%head
|