Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cumulative PR for Wallet & Metrics Refactoring #360

Merged
merged 235 commits into from
Dec 26, 2023
Merged
Show file tree
Hide file tree
Changes from 218 commits
Commits
Show all changes
235 commits
Select commit Hold shift + click to select a range
57393b7
external access to kaspad core rpc services API
aspect Sep 8, 2023
ede9a67
rename wallet event members for serde serialization
aspect Sep 8, 2023
e50fdca
wip - event renaming
aspect Sep 8, 2023
6c24981
wip - event serialization tuneup
aspect Sep 8, 2023
51c1488
remove default wrpc listening ports on kaspad Args + fix port mapping…
aspect Sep 8, 2023
b3366a7
Box wallet events
aspect Sep 8, 2023
572081f
introduce RpcCtl + isolate wRPC from DynRpcApi
aspect Sep 9, 2023
2caf4df
debug trait for secret
aspect Sep 9, 2023
dea9062
de-couple wRPC from the runtiem wallet making RPC bindings generic
aspect Sep 9, 2023
4ac9052
convert wallet_list to return Vec<WalletDescriptor>
aspect Sep 9, 2023
2427a48
user-friendly error message on decryption error
aspect Sep 13, 2023
ca31934
UtxoProcessor - ignore task shutdown if not running
aspect Sep 13, 2023
15737c6
wallet storage data versioning
aspect Sep 13, 2023
ec7be31
wallet - propagate wallet title
aspect Sep 13, 2023
2083308
sort traits on WalletDescriptor
aspect Sep 14, 2023
1238659
wallet - use precise decimal conversion when parsing strings to sompi
aspect Sep 14, 2023
ec50170
display kaspa on get-balance-by-address-rpc
aspect Sep 15, 2023
dee753b
wallet - rename settings fns to have try_ prefixes
aspect Sep 15, 2023
42b577f
rename library names "kaspad" and "kaspa_cli" to "kaspad_lib" and "ka…
aspect Sep 15, 2023
86d1835
no-unsafe-eval feature
aspect Sep 16, 2023
64edf20
allow for chrome-extension schema in the RPC url
aspect Sep 17, 2023
17c97db
wallet - expose bip32 wordlist for external access
aspect Sep 19, 2023
ccad24c
wallet - delegate rpc ownership to utxo_processor; reorder rpc discon…
aspect Sep 19, 2023
cb1ac60
Merge branch 'master' of github.com:aspectron/rusty-kaspa into wallet…
aspect Sep 20, 2023
e6f12d9
wallet - migrate wallet settings loading to cli
aspect Sep 20, 2023
c22161b
rename RpcCtlOp (Open, Close) to RpcState (Opened, Closed)
aspect Sep 20, 2023
c63dd06
remove automatic RPC disconnect from wallet stop() to allow retention…
aspect Sep 20, 2023
2e747c6
allow UtxoProcessor to bind to an already existing/connected RPC chan…
aspect Sep 20, 2023
6e32ef4
code formatting
aspect Sep 20, 2023
2ee7d7b
fix clippy warnings
aspect Sep 20, 2023
4c7ab28
migrate chrome-extension to use ws:// schema by default
aspect Sep 20, 2023
70e5e21
wallet list formatting
aspect Sep 20, 2023
59e965f
staging for WRS 0.7.0
aspect Sep 20, 2023
c1a40b1
add bip32 word list iterator
aspect Sep 20, 2023
53845f0
update WRS to 0.7.0
aspect Sep 20, 2023
19a394e
fix rustdoc errors
aspect Sep 20, 2023
1161b13
wip - initial WalletApi trait implementation
aspect Sep 22, 2023
66206e5
wallet - macros and account descriptors
aspect Sep 22, 2023
418d83e
wallet - ping_call
aspect Sep 23, 2023
ad1c8c5
cleanup
aspect Sep 23, 2023
b168913
Merge branch 'wallet-api-updates-v1' of github.com:aspectron/rusty-ka…
aspect Sep 23, 2023
4d21727
wip - wallet api cleanup & testing
aspect Sep 25, 2023
99ef567
kaspa-metrics as a separate crate
aspect Sep 29, 2023
cdfc62f
wip - metrics cleanup
aspect Sep 29, 2023
d439a41
Merge branch 'master' of github.com:aspectron/rusty-kaspa into kng
aspect Sep 29, 2023
9b47bc3
cargo.lock update
aspect Sep 29, 2023
c3bd98c
async/sync api changes for storage
surinder83singh Sep 30, 2023
5a504ab
merge
aspect Oct 25, 2023
541b0d2
Merge branch 'master' of github.com:aspectron/rusty-kaspa into kng
aspect Oct 26, 2023
b0e4869
master merge
aspect Oct 26, 2023
9db70c4
Merge branch 'master' of github.com:aspectron/rusty-kaspa into kng
aspect Oct 26, 2023
2ced239
Merge branch 'master' of github.com:aspectron/rusty-kaspa into kng
aspect Oct 31, 2023
22f2d1f
wip
aspect Nov 1, 2023
a3a95d3
Merge branch 'master' of github.com:aspectron/rusty-kaspa into kng
aspect Nov 1, 2023
7ba9175
Merge branch 'kaspanet:master' into kng
aspect Nov 2, 2023
14323ba
Merge branch 'kaspanet:master' into kng
aspect Nov 3, 2023
9987829
Merge branch 'kaspanet:master' into kng
aspect Nov 4, 2023
f9bb3a7
wip
aspect Nov 4, 2023
9eb8682
Merge branch 'kaspanet:master' into kng
aspect Nov 4, 2023
c7e23e3
wip
aspect Nov 4, 2023
bca70f1
wallet - (wip) changes to AccountDescriptor and Wallet API
aspect Nov 5, 2023
78dce47
Merge branch 'master' of github.com:aspectron/rusty-kaspa into kng
aspect Nov 5, 2023
9988602
metrics - make sink future return as optional
aspect Nov 7, 2023
6b087d1
wip - refactor wallet open; improve wallet event ordering; cleanup
aspect Nov 11, 2023
481adcf
Merge branch 'kaspanet:master' into kng
aspect Nov 11, 2023
42beb3f
wip (debugging UtxoChanged notifications) - fix issuance during faile…
aspect Nov 13, 2023
8d21224
adding workflow-rs as github dependency (allows CI)
aspect Nov 13, 2023
552e1ba
revert github deps for WRS
aspect Nov 13, 2023
2cd6531
metrics
aspect Nov 14, 2023
9ed41d1
refactor metrics to include bdi counts and peer counts
aspect Nov 15, 2023
64229e1
wallet api updates
aspect Nov 16, 2023
a45b865
Merge branch 'master' of github.com:aspectron/rusty-kaspa into kng
aspect Nov 16, 2023
36acb03
wallet framework - fix a but resulting in the early issuane of UTXO m…
aspect Nov 17, 2023
e62a1ad
npm 0.13.0
aspect Nov 17, 2023
c27daf8
metrics - cleanup after RPC refactoring
aspect Nov 18, 2023
5a7fb62
rename rust-side of wasm bindings as naming conventions interfere wit…
aspect Nov 18, 2023
d6499f6
Merge branch 'kaspanet:master' into kng
aspect Nov 18, 2023
f71db9f
make metrics data formatting fns as pub
aspect Nov 20, 2023
bfaea16
Merge branch 'kaspanet:master' into kng
aspect Nov 22, 2023
c52c266
expose log levels in kaspa-core::log
aspect Nov 22, 2023
ad0a2a6
rename metrics & improve metrics fetch task
aspect Nov 22, 2023
0124650
add API calls to pre-configure wallet framework stroage folders
aspect Nov 22, 2023
9d86f34
cumulative updates for Cargo.lock
aspect Nov 22, 2023
018004e
Merge branch 'kng' of github.com:aspectron/rusty-kaspa into kng
aspect Nov 22, 2023
f830511
Improve address error messages for human readability
aspect Nov 25, 2023
0c37555
PrvKeyData enumeration, initial account transfer support (wip), walle…
aspect Nov 25, 2023
8c89bbb
Merge branch 'kaspanet:master' into kng
aspect Nov 25, 2023
eacbb94
wallet - change error to retain PrvKeyDataId instead of a String
aspect Nov 25, 2023
f320dcc
propagate bip39 flag to runtime account and it's descriptor
aspect Nov 25, 2023
b05455e
wip - keydata refactoring
aspect Nov 25, 2023
965e186
metrics refactoring (bandwidth)
aspect Nov 25, 2023
1892f9b
Merge branch 'kng' of github.com:aspectron/rusty-kaspa into kng
aspect Nov 25, 2023
a7cbb04
wip (cleanup)
aspect Nov 25, 2023
f582442
misc improvements to metrics
aspect Nov 27, 2023
c3e6294
code formatting
aspect Nov 27, 2023
5d78b0d
wRPC bandwidth monitoring + scaffolding for global bandwidth metrics
aspect Nov 27, 2023
62ae021
bump WRS to 0.9.0
aspect Nov 27, 2023
966595b
metrics - add mempool_size and convert some items to u32/f32
aspect Nov 27, 2023
f97e9ad
metrics cleanup
aspect Nov 27, 2023
fa54d22
wallet and account rename, remove "title" from accounts
aspect Nov 28, 2023
75fbe23
add missing mempool size metric
aspect Nov 28, 2023
1584014
UTXO "stasis" mode for new coinbase transactions
aspect Nov 28, 2023
0e4f829
remove useless Option from the rpc url parser
aspect Nov 29, 2023
61fad94
fix daa score in maturity state check
aspect Nov 29, 2023
4828d58
add name_or_id to PrvKeyDataInfo
aspect Nov 29, 2023
da456b7
Merge branch 'kaspanet:master' into kng
aspect Nov 30, 2023
17ae84a
wallet RPC Connect/Disconnect and GetStatus API calls
aspect Nov 30, 2023
d905f78
cleanup
aspect Nov 30, 2023
d3aadf7
support for 12-word bip39 mnemonics
aspect Nov 30, 2023
7fbc364
Merge branch 'kng' of github.com:aspectron/rusty-kaspa into kng
aspect Nov 30, 2023
973859d
add a hidden --daemon flag to kaspad
aspect Dec 2, 2023
a60d5a3
refactor get_daa_score_timestamp helper to return Vec<u64> instead of…
aspect Dec 2, 2023
485aa61
Add Scan event
aspect Dec 2, 2023
78262ad
Merge branch 'kaspanet:master' into kng
aspect Dec 3, 2023
01efcd8
implement support for unixtime in transactions
aspect Dec 5, 2023
b16fa67
kaspa value formatting functions
aspect Dec 5, 2023
e199dbe
fix a deadlock due to re-entrant mutex lock when loading multiple acc…
aspect Dec 5, 2023
a58c76e
introduce utxo stasis mode + make balance carry utxo counts as well a…
aspect Dec 5, 2023
8258f43
refactor wallet events, replace reset() with close() where appropriate
aspect Dec 5, 2023
d541d8c
Merge branch 'kng' of github.com:aspectron/rusty-kaspa into kng
aspect Dec 5, 2023
458b435
Merge branch 'kaspanet:master' into kng
aspect Dec 6, 2023
cabdd13
manual debug impl for tx components (display script as hex, address a…
aspect Dec 6, 2023
e875814
fix incorrect gas assignment in WASM bindings
aspect Dec 6, 2023
2d8bb66
updates for wallet event handling
aspect Dec 7, 2023
9551c2a
refactor sign_with_multiple to return Err(tx) when partially signed
aspect Dec 7, 2023
d55ccfd
refactor Storage and Wallet descriptors
aspect Dec 7, 2023
b940981
fix account derivation index handling in DerivationCapable
aspect Dec 7, 2023
d28bc3f
track acceptance DAA stamp in outgoing transaction record
aspect Dec 7, 2023
965b070
temporary harness for embedding script engine directly into tx genera…
aspect Dec 7, 2023
1f31946
convert PendingTransaction Utxo entries into HashSet
aspect Dec 7, 2023
6def29f
rename pending tx fns
aspect Dec 7, 2023
6457b99
outgoing tx wrapper around pending tx
aspect Dec 7, 2023
0428b0e
refactor notification events during wallet ops
aspect Dec 7, 2023
2f6cea2
as_ref() for PrvKeyData
aspect Dec 7, 2023
0826906
wip - initial RpcCoreMocks for wallet framework tests
aspect Dec 7, 2023
83e2131
wallet api messages update for StorageDescriptor usage
aspect Dec 7, 2023
e0c562f
update AddressDerivationMeta to track addresses from index 0
aspect Dec 7, 2023
9c60de5
add AHash and async_channel to wallet_core crate
aspect Dec 7, 2023
b0afa05
allow Args to be used externally for daemon argument pre-validation
aspect Dec 7, 2023
c64dc15
impl Hash for UtxoEntryReference and rename "fake()" to "simulated()"
aspect Dec 7, 2023
7c8c2cc
update wallet events
aspect Dec 7, 2023
af94126
expose tx validator check_scripts() as pub
aspect Dec 7, 2023
95226f6
update wallet wasm fns for wallet and storage descriptors
aspect Dec 7, 2023
bcfaeb7
Merge branch 'kaspanet:master' into kng
aspect Dec 10, 2023
e6ad280
rename kaspa-metrics to kaspa-metrics-core
aspect Dec 10, 2023
63ad452
code formatting
aspect Dec 10, 2023
795dd09
code formatting
aspect Dec 10, 2023
3eebd11
migrate transaction console formatting to cli/extensions
aspect Dec 10, 2023
d200d5e
refactor wallet events
aspect Dec 10, 2023
d17f80c
use ahash for faster processing in wallet hash maps (utxo context)
aspect Dec 10, 2023
efd2818
wallet - add SendError handling for error::Error
aspect Dec 10, 2023
bd3621a
wallet event refactoring, scan/discovery process refactoring, wallet …
aspect Dec 10, 2023
7b95a75
refactoring: transfer and deep derivation scan
aspect Dec 10, 2023
74f8721
transaction record refactoring
aspect Dec 10, 2023
ab91864
wallet - support for cross-account transfers in generator
aspect Dec 10, 2023
5070451
wallet - outgoing transaction impl
aspect Dec 10, 2023
f1f87ed
wallet - refactor maturity handling
aspect Dec 10, 2023
1be5a8f
wallet/utxo - initial tests scaffolding
aspect Dec 10, 2023
385d568
minor optimization of the discovery/scan process
aspect Dec 10, 2023
a96fe3f
wallet - utxo processor outgoing tx and discovery timestamp unixtime …
aspect Dec 10, 2023
608476a
refactor utxo context to use output transactions, refactor transfers,…
aspect Dec 10, 2023
1bb9a2d
code formatting + Cargo.lock update
aspect Dec 10, 2023
0611b59
Merge branch 'kng' of github.com:aspectron/rusty-kaspa into kng
aspect Dec 10, 2023
dd59e9f
Merge branch 'kaspanet:master' into kng
aspect Dec 10, 2023
add9116
Signed enum to represent Fully or Partially signed tx
aspect Dec 10, 2023
ba28afd
bind p2p and grpc bandwidth metrics
aspect Dec 10, 2023
7777eab
misc clippy fixes
aspect Dec 10, 2023
dbb3b8b
cleanup
aspect Dec 10, 2023
26590d9
remove --daemon as Args::parse() offers external mutations
aspect Dec 13, 2023
4df50c2
remove previously implemented mnemonic variant in favor of client-sid…
aspect Dec 13, 2023
703e7b6
remove AccessContextT, convert to wallet_secret, wip WalletApi traits…
aspect Dec 13, 2023
d2ec18d
code formatting
aspect Dec 13, 2023
1076df1
separate runtime wallet into multiple modules
aspect Dec 13, 2023
b04a3d8
wallet - revert create_accounts to process a single account at a time
aspect Dec 13, 2023
cea8f8a
cleanup
aspect Dec 13, 2023
daded60
wallet - JSON import and export + preliminary docs
aspect Dec 13, 2023
11dccaf
address - AddressList - fix TryFrom deadlock caused by recursive trai…
aspect Dec 14, 2023
0eba4a8
wallet - api rustdoc + cleanup, transaction calls
aspect Dec 14, 2023
737c62a
wallet docs
aspect Dec 14, 2023
cbdc525
change address debug formatting
aspect Dec 14, 2023
35e60a8
adding cli rpc addpeer
aspect Dec 14, 2023
34679a8
wip - wallet restructuring
aspect Dec 16, 2023
51080e5
wip - restructure wallet modules
aspect Dec 16, 2023
9293600
wip - wallet restructuring - cleanup
aspect Dec 16, 2023
380a4c4
wip - AccountKind refactoring
aspect Dec 17, 2023
b774623
wallet - refactoring storage serialization & encryption
aspect Dec 18, 2023
cb8033a
Merge branch 'kaspanet:master' into wallet-structure
aspect Dec 18, 2023
feed046
fold in PR #349
aspect Dec 18, 2023
fbed3ae
wallet framework - misc helper fns and cleanup
aspect Dec 18, 2023
98b4919
Merge branch 'wallet-structure' of github.com:aspectron/rusty-kaspa i…
aspect Dec 18, 2023
76cab73
storage unit tests + prv key data module restructuring
aspect Dec 18, 2023
64ae668
wallet - account factory registrations
aspect Dec 18, 2023
ea1eb91
Remove panics caused by sudden loss of connection while submitting tr…
aspect Dec 18, 2023
6543366
cleanup
aspect Dec 18, 2023
bcfa066
cleanup
aspect Dec 18, 2023
4cb62b6
cleanup + docs
aspect Dec 18, 2023
f4d5026
docs
aspect Dec 18, 2023
ea78ca6
Merge branch 'kaspanet:master' into wallet-structure
aspect Dec 19, 2023
3a0ffa7
adjust metrics formatting
aspect Dec 19, 2023
c492a37
Merge branch 'master' of github.com:aspectron/rusty-kaspa into wallet…
aspect Dec 19, 2023
f691ffb
cleanup
aspect Dec 19, 2023
82cd830
bump workflow-rs to 0.10.1
aspect Dec 19, 2023
0cadd11
fix wallet storage unit tests
aspect Dec 19, 2023
f319e92
fix generator unit tests
aspect Dec 19, 2023
ee596d7
convert missing listener_id panic to error
aspect Dec 19, 2023
e0e5778
docs
aspect Dec 19, 2023
87ec724
code formatting
aspect Dec 19, 2023
2cb9858
lints
aspect Dec 19, 2023
8b8cc42
misc updates following github reviews
aspect Dec 19, 2023
e49fb58
refactor AccountKind to use fixedstr and implement Copy
aspect Dec 19, 2023
cb48b35
refactor AccountKind to use fixedstr (str64) and re-implement Copy, r…
aspect Dec 19, 2023
e2ab73a
change js-bound fn names from *as* to *to* to follow Rust conventions
aspect Dec 19, 2023
452872e
replace AssocPrvKeyDataIds iter().any() to contains()
aspect Dec 19, 2023
7054987
remove vec![] in MetricsGroup iterator fn; add TODO comment on Metric…
aspect Dec 19, 2023
5d53f41
scope magic numbers within their associated structs
aspect Dec 20, 2023
9eb6549
add try_fully_signed() and try_partially_signed() fns to Signed that …
aspect Dec 20, 2023
5ea8696
refactor local storage cache to use RwLock instead of a Mutex
aspect Dec 20, 2023
980c065
refactor serialization as per github feedback (partial trait impl)
aspect Dec 21, 2023
a05ca54
Optimize AssocPrvKeyDataIds to use Either in the IntoIter impl, remov…
aspect Dec 23, 2023
bf4ffbe
Refactor to bypass aux buffer creation when storing wallet on native …
aspect Dec 23, 2023
d0893fe
impl custom Debug for storage structs to display data in hex
aspect Dec 23, 2023
f848da3
adding misc SAFETY comments on unsafe ops
aspect Dec 23, 2023
5ebaeaf
TODO comments for later SignerT+multisig refactoring
aspect Dec 23, 2023
86e2f40
Change panic!() to unreachable!() to make it clearer that a state sho…
aspect Dec 23, 2023
ae0aa13
rename TransactionRecord::unixtime to unixtime_msec
aspect Dec 23, 2023
99755c0
fix wrong references in comments
aspect Dec 23, 2023
77b4775
Fix min_cosigner_index handling in multisig fns
aspect Dec 23, 2023
03cbccb
add comments to UtxoContext::insert() error handling
aspect Dec 23, 2023
9b88fda
bind AccountStorable:Storable for AccountStorage, migrate Storable in…
aspect Dec 23, 2023
d2628d8
make framework init functions unsafe
aspect Dec 24, 2023
887f10e
update workflow-rs to 0.10.2
aspect Dec 24, 2023
33088c9
fix comments
aspect Dec 24, 2023
1ee65c3
fix data cloning when getting collection counts
aspect Dec 26, 2023
9a69535
adding TODO notes to wasm macros and KAS value decimal parsing
aspect Dec 26, 2023
fa887dd
Merge branch 'kaspanet:master' into wallet-refactoring-q4-2023
aspect Dec 26, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
865 changes: 561 additions & 304 deletions Cargo.lock

Large diffs are not rendered by default.

52 changes: 33 additions & 19 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ members = [
"daemon",
"cli",
"core",
"wallet/macros",
"wallet/core",
"wallet/native",
"wallet/wasm",
Expand Down Expand Up @@ -32,7 +33,6 @@ members = [
"rpc/grpc/core",
"rpc/grpc/client",
"rpc/grpc/server",
"rpc/wrpc/core",
"rpc/wrpc/server",
"rpc/wrpc/client",
"rpc/wrpc/proxy",
Expand All @@ -52,6 +52,7 @@ members = [
"utils/tower",
"rothschild",
"metrics/perf_monitor",
"metrics/core",
]

[workspace.package]
Expand All @@ -73,18 +74,18 @@ include = [

[workspace.dependencies]
# kaspa-testing-integration = { version = "0.13.1", path = "testing/integration" }
kaspa-os = { version = "0.13.1", path = "kaspa-os" }
kaspa-daemon = { version = "0.13.1", path = "daemon" }
kaspa-addresses = { version = "0.13.1", path = "crypto/addresses" }
kaspa-addressmanager = { version = "0.13.1", path = "components/addressmanager" }
kaspa-bip32 = { version = "0.13.1", path = "wallet/bip32" }
kaspa-cli = { version = "0.13.1", path = "cli" }
kaspa-connectionmanager = { version = "0.13.1", path = "components/connectionmanager" }
kaspa-consensus = { version = "0.13.1", path = "consensus" }
kaspa-consensus-core = { version = "0.13.1", path = "consensus/core" }
kaspa-consensus-notify = { version = "0.13.1", path = "consensus/notify" }
kaspa-consensus-wasm = { version = "0.13.1", path = "consensus/wasm" }
kaspa-consensusmanager = { version = "0.13.1", path = "components/consensusmanager" }
kaspa-core = { version = "0.13.1", path = "core" }
kaspa-daemon = { version = "0.13.1", path = "daemon" }
kaspa-database = { version = "0.13.1", path = "database" }
kaspa-grpc-client = { version = "0.13.1", path = "rpc/grpc/client" }
kaspa-grpc-core = { version = "0.13.1", path = "rpc/grpc/core" }
Expand All @@ -94,12 +95,15 @@ kaspa-index-core = { version = "0.13.1", path = "indexes/core" }
kaspa-index-processor = { version = "0.13.1", path = "indexes/processor" }
kaspa-math = { version = "0.13.1", path = "math" }
kaspa-merkle = { version = "0.13.1", path = "crypto/merkle" }
kaspa-metrics-core = { version = "0.13.0", path = "metrics/core" }
kaspa-mining = { version = "0.13.1", path = "mining" }
kaspa-mining-errors = { version = "0.13.1", path = "mining/errors" }
kaspa-muhash = { version = "0.13.1", path = "crypto/muhash" }
kaspa-notify = { version = "0.13.1", path = "notify" }
kaspa-os = { version = "0.13.1", path = "kaspa-os" }
kaspa-p2p-flows = { version = "0.13.1", path = "protocol/flows" }
kaspa-p2p-lib = { version = "0.13.1", path = "protocol/p2p" }
kaspa-perf-monitor = { version = "0.13.1", path = "metrics/perf_monitor" }
kaspa-pow = { version = "0.13.1", path = "consensus/pow" }
kaspa-rpc-core = { version = "0.13.1", path = "rpc/core" }
kaspa-rpc-macros = { version = "0.13.1", path = "rpc/macros" }
Expand All @@ -110,20 +114,20 @@ kaspa-utils = { version = "0.13.1", path = "utils" }
kaspa-utils-tower = { version = "0.13.1", path = "utils/tower" }
kaspa-utxoindex = { version = "0.13.1", path = "indexes/utxoindex" }
kaspa-wallet = { version = "0.13.1", path = "wallet/native" }
kaspa-cli = { version = "0.13.1", path = "cli" }
kaspa-wallet-cli-wasm = { version = "0.13.1", path = "wallet/wasm" }
kaspa-wallet-core = { version = "0.13.1", path = "wallet/core" }
kaspa-wallet-macros = { version = "0.13.0", path = "wallet/macros" }
kaspa-wasm = { version = "0.13.1", path = "wasm" }
kaspa-wrpc-core = { version = "0.13.1", path = "rpc/wrpc/core" }
kaspa-wrpc-client = { version = "0.13.1", path = "rpc/wrpc/client" }
kaspa-wrpc-core = { version = "0.13.1", path = "rpc/wrpc/core" }
kaspa-wrpc-proxy = { version = "0.13.1", path = "rpc/wrpc/proxy" }
kaspa-wrpc-server = { version = "0.13.1", path = "rpc/wrpc/server" }
kaspa-wrpc-wasm = { version = "0.13.1", path = "rpc/wrpc/wasm" }
kaspad = { version = "0.13.1", path = "kaspad" }
kaspa-perf-monitor = { version = "0.13.1", path = "metrics/perf_monitor" }

# external
aes = "0.8.3"
ahash = "0.8.6"
argon2 = "0.5.2"
async-channel = "2.0.0"
async-std = { version = "1.12.0", features = ['attributes'] }
Expand Down Expand Up @@ -155,11 +159,10 @@ enum-primitive-derive = "0.2.2"
event-listener = "2.5.3" # TODO "3.0.1"
evpkdf = "0.2.0"
faster-hex = "0.6.1" # TODO "0.8.1" - fails unit tests
fixedstr = { version = "0.5.4", features = ["serde"] }
flate2 = "1.0.28"
futures = { version = "0.3.29" }
futures-util = { version = "0.3.29", default-features = false, features = [
"alloc",
] }
futures-util = { version = "0.3.29", default-features = false, features = [ "alloc", ] }
getrandom = { version = "0.2.10", features = ["js"] }
h2 = "0.3.21"
heapless = "0.7.16"
Expand Down Expand Up @@ -243,16 +246,16 @@ hyper = "0.14.27"
workflow-perf-monitor = { version = "0.0.2" }

# workflow dependencies
workflow-d3 = { version = "0.8.1" }
workflow-nw = { version = "0.8.1" }
workflow-log = { version = "0.8.1" }
workflow-core = { version = "0.8.1" }
workflow-wasm = { version = "0.8.1" }
workflow-dom = { version = "0.8.1" }
workflow-rpc = { version = "0.8.1" }
workflow-node = { version = "0.8.1" }
workflow-store = { version = "0.8.1" }
workflow-terminal = { version = "0.8.1" }
workflow-d3 = { version = "0.10.1" }
workflow-nw = { version = "0.10.1" }
workflow-log = { version = "0.10.1" }
workflow-core = { version = "0.10.1" }
workflow-wasm = { version = "0.10.1" }
workflow-dom = { version = "0.10.1" }
workflow-rpc = { version = "0.10.1" }
workflow-node = { version = "0.10.1" }
workflow-store = { version = "0.10.1" }
workflow-terminal = { version = "0.10.1" }
nw-sys = "0.1.6"

# if below is enabled, this means that there is an ongoing work
Expand All @@ -268,6 +271,17 @@ nw-sys = "0.1.6"
# workflow-node = { path = "../workflow-rs/node" }
# workflow-store = { path = "../workflow-rs/store" }
# workflow-terminal = { path = "../workflow-rs/terminal" }
# ---
# workflow-d3 = { git = "https://github.com/workflow-rs/workflow-rs.git", branch = "master" }
# workflow-nw = { git = "https://github.com/workflow-rs/workflow-rs.git", branch = "master" }
# workflow-log = { git = "https://github.com/workflow-rs/workflow-rs.git", branch = "master" }
# workflow-core = { git = "https://github.com/workflow-rs/workflow-rs.git", branch = "master" }
# workflow-wasm = { git = "https://github.com/workflow-rs/workflow-rs.git", branch = "master" }
# workflow-dom = { git = "https://github.com/workflow-rs/workflow-rs.git", branch = "master" }
# workflow-rpc = { git = "https://github.com/workflow-rs/workflow-rs.git", branch = "master" }
# workflow-node = { git = "https://github.com/workflow-rs/workflow-rs.git", branch = "master" }
# workflow-store = { git = "https://github.com/workflow-rs/workflow-rs.git", branch = "master" }
# workflow-terminal = { git = "https://github.com/workflow-rs/workflow-rs.git", branch = "master" }
# https://github.com/aspectron/nw-sys
# nw-sys = { path = "../nw-sys" }

Expand Down
1 change: 1 addition & 0 deletions cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ kaspa-bip32.workspace = true
kaspa-consensus-core.workspace = true
kaspa-core.workspace = true
kaspa-daemon.workspace = true
kaspa-metrics-core.workspace = true
kaspa-rpc-core.workspace = true
kaspa-utils.workspace = true
kaspa-wallet-core.workspace = true
Expand Down
102 changes: 62 additions & 40 deletions cli/src/cli.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
use crate::error::Error;
use crate::helpers::*;
use crate::imports::*;
pub use crate::metrics;
use crate::modules::miner::Miner;
use crate::modules::node::Node;
use crate::notifier::{Notification, Notifier};
use crate::result::Result;
use kaspa_daemon::{DaemonEvent, DaemonKind, Daemons};
use kaspa_wallet_core::rpc::DynRpcApi;
use kaspa_wallet_core::runtime::{Account, BalanceStrings};
use kaspa_wallet_core::storage::{IdT, PrvKeyDataInfo};
use kaspa_wallet_core::{runtime::Wallet, Events};
use kaspa_wrpc_client::KaspaRpcClient;
use workflow_core::channel::*;
use workflow_core::time::Instant;
Expand Down Expand Up @@ -192,6 +189,7 @@ impl KaspaCli {
}

pub fn register_metrics(self: &Arc<Self>) -> Result<()> {
use crate::modules::metrics;
register_handlers!(self, self.handlers(), [metrics]);
Ok(())
}
Expand Down Expand Up @@ -282,6 +280,7 @@ impl KaspaCli {

if let Ok(msg) = msg {
match *msg {
Events::Error { message } => { terrorln!(this,"{message}"); },
Events::UtxoProcStart => {},
Events::UtxoProcStop => {},
Events::UtxoProcError { message } => {
Expand Down Expand Up @@ -336,95 +335,117 @@ impl KaspaCli {

},
Events::AccountSelection { .. } => { },
Events::WalletCreate { .. } => { },
Events::WalletError { .. } => { },
Events::WalletOpen |
Events::WalletReload => {

// load all accounts
if let Err(err) = this.wallet().activate_all_stored_accounts().await {
terrorln!(this, "{err}");
}
// Events::WalletReady { .. } => { },

Events::WalletOpen { .. } |
Events::WalletReload { .. } => { },
Events::WalletClose => {
this.term().refresh_prompt();
},
Events::PrvKeyDataCreate { .. } => { },
Events::AccountDeactivation { .. } => { },
Events::AccountActivation { .. } => {
// list all accounts
this.list().await.unwrap_or_else(|err|terrorln!(this, "{err}"));

// load default account if only one account exists
this.wallet().autoselect_default_account_if_single().await.ok();
this.term().refresh_prompt();

},
Events::WalletClose => {
this.term().refresh_prompt();
},
Events::AccountCreate { .. } => { },
Events::AccountUpdate { .. } => { },
Events::DAAScoreChange { current_daa_score } => {
if this.is_mutted() && this.flags.get(Track::Daa) {
tprintln!(this, "{NOTIFY} DAA: {current_daa_score}");
}
},
Events::Discovery { .. } => { }
Events::Reorg {
record
} => {
if !this.is_mutted() || (this.is_mutted() && this.flags.get(Track::Pending)) {
let include_utxos = this.flags.get(Track::Utxo);
let tx = record.format_with_state(&this.wallet,Some("reorg"),include_utxos).await;
let tx = record.format_transaction_with_state(&this.wallet,Some("reorg"),include_utxos).await;
tx.iter().for_each(|line|tprintln!(this,"{NOTIFY} {line}"));
}
},
Events::External {
Events::Stasis {
record
} => {
if !this.is_mutted() || (this.is_mutted() && this.flags.get(Track::Tx)) {
// Pending and coinbase stasis fall under the same `Track` category
if !this.is_mutted() || (this.is_mutted() && this.flags.get(Track::Pending)) {
let include_utxos = this.flags.get(Track::Utxo);
let tx = record.format_with_state(&this.wallet,Some("external"),include_utxos).await;
let tx = record.format_transaction_with_state(&this.wallet,Some("stasis"),include_utxos).await;
tx.iter().for_each(|line|tprintln!(this,"{NOTIFY} {line}"));
}
},
// Events::External {
// record
// } => {
// if !this.is_mutted() || (this.is_mutted() && this.flags.get(Track::Tx)) {
// let include_utxos = this.flags.get(Track::Utxo);
// let tx = record.format_with_state(&this.wallet,Some("external"),include_utxos).await;
// tx.iter().for_each(|line|tprintln!(this,"{NOTIFY} {line}"));
// }
// },
Events::Pending {
record, is_outgoing : _
record
} => {
if !this.is_mutted() || (this.is_mutted() && this.flags.get(Track::Pending)) {
let include_utxos = this.flags.get(Track::Utxo);
let tx = record.format_with_state(&this.wallet,Some("pending"),include_utxos).await;
let tx = record.format_transaction_with_state(&this.wallet,Some("pending"),include_utxos).await;
tx.iter().for_each(|line|tprintln!(this,"{NOTIFY} {line}"));
}
},
Events::Maturity {
record, is_outgoing : _
} => {
if !this.is_mutted() || (this.is_mutted() && this.flags.get(Track::Tx)) {
let include_utxos = this.flags.get(Track::Utxo);
let tx = record.format_with_state(&this.wallet,Some("confirmed"),include_utxos).await;
tx.iter().for_each(|line|tprintln!(this,"{NOTIFY} {line}"));
}
},
Events::Outgoing {
record
} => {
if !this.is_mutted() || (this.is_mutted() && this.flags.get(Track::Tx)) {
let include_utxos = this.flags.get(Track::Utxo);
let tx = record.format_with_state(&this.wallet,Some("confirmed"),include_utxos).await;
let tx = record.format_transaction_with_state(&this.wallet,Some("confirmed"),include_utxos).await;
tx.iter().for_each(|line|tprintln!(this,"{NOTIFY} {line}"));
}
},
// Events::Outgoing {
// record
// } => {
// if !this.is_mutted() || (this.is_mutted() && this.flags.get(Track::Tx)) {
// let include_utxos = this.flags.get(Track::Utxo);
// let tx = record.format_with_state(&this.wallet,Some("confirmed"),include_utxos).await;
// tx.iter().for_each(|line|tprintln!(this,"{NOTIFY} {line}"));
// }
// },
// Events::Change {
// record
// } => {
// if !this.is_mutted() || (this.is_mutted() && this.flags.get(Track::Tx)) {
// let include_utxos = this.flags.get(Track::Utxo);
// let tx = record.format_with_state(&this.wallet,Some("change"),include_utxos).await;
// tx.iter().for_each(|line|tprintln!(this,"{NOTIFY} {line}"));
// }
// },
Events::Balance {
balance,
id,
mature_utxo_size,
pending_utxo_size,
} => {

if !this.is_mutted() || (this.is_mutted() && this.flags.get(Track::Balance)) {
let network_id = this.wallet.network_id().expect("missing network type");
let network_type = NetworkType::from(network_id);
let balance = BalanceStrings::from((&balance,&network_type, None));
let balance_strings = BalanceStrings::from((&balance,&network_type, None));
let id = id.short();

let pending_utxo_info = if pending_utxo_size > 0 {
format!("({pending_utxo_size} pending)")
let mature_utxo_count = balance.as_ref().map(|balance|balance.mature_utxo_count.separated_string()).unwrap_or("N/A".to_string());
let pending_utxo_count = balance.as_ref().map(|balance|balance.pending_utxo_count).unwrap_or(0);

let pending_utxo_info = if pending_utxo_count > 0 {
format!("({} pending)", pending_utxo_count)
} else { "".to_string() };
let utxo_info = style(format!("{} UTXOs {pending_utxo_info}", mature_utxo_size.separated_string())).dim();
let utxo_info = style(format!("{mature_utxo_count} UTXOs {pending_utxo_info}")).dim();

tprintln!(this, "{NOTIFY} {} {id}: {balance} {utxo_info}",style("balance".pad_to_width(8)).blue());
tprintln!(this, "{NOTIFY} {} {id}: {balance_strings} {utxo_info}",style("balance".pad_to_width(8)).blue());
}

this.term().refresh_prompt();
Expand Down Expand Up @@ -757,9 +778,10 @@ impl Cli for KaspaCli {
}
}

if let Some(name) = self.wallet.name() {
if name != "kaspa" {
prompt.push(name);
if let Some(descriptor) = self.wallet.descriptor() {
let title = descriptor.title.unwrap_or(descriptor.filename);
if title.to_lowercase().as_str() != "kaspa" {
prompt.push(title);
}

if let Ok(account) = self.wallet.account() {
Expand Down
3 changes: 3 additions & 0 deletions cli/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ pub enum Error {

#[error("private key {0} already exists")]
PrivateKeyAlreadyExists(String),

#[error(transparent)]
MetricsError(kaspa_metrics_core::error::Error),
}

impl Error {
Expand Down
2 changes: 2 additions & 0 deletions cli/src/extensions/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pub mod transaction;
pub use transaction::*;
Loading