dash-shielded-native 0.0.1
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.
- package/CHANGELOG.md +5 -0
- package/LICENSE +27 -0
- package/README.md +36 -0
- package/android/build.gradle +56 -0
- package/android/src/main/AndroidManifest.xml +1 -0
- package/android/src/main/java/app/edge/rndashshielded/RNDashShieldedModule.kt +215 -0
- package/android/src/main/java/app/edge/rndashshielded/RNDashShieldedPackage.kt +16 -0
- package/android/src/main/java/uniffi/dash/dash.kt +1665 -0
- package/android/src/main/jniLibs/arm64-v8a/libdashshielded.so +0 -0
- package/dash-shielded-native.podspec +32 -0
- package/ios/.uniffi-generated +1 -0
- package/ios/EdgeDashClient.swift +88 -0
- package/ios/RNDashShielded.m +83 -0
- package/ios/RNDashShielded.swift +214 -0
- package/ios/dash-shielded-native-Bridging-Header.h +2 -0
- package/ios/dash.swift +1124 -0
- package/ios/libdashshielded.xcframework/Info.plist +47 -0
- package/ios/libdashshielded.xcframework/ios-arm64/Headers/dashFFI.h +696 -0
- package/ios/libdashshielded.xcframework/ios-arm64/Headers/module.modulemap +7 -0
- package/ios/libdashshielded.xcframework/ios-arm64/libdashshielded.a +0 -0
- package/ios/libdashshielded.xcframework/ios-arm64-simulator/Headers/dashFFI.h +696 -0
- package/ios/libdashshielded.xcframework/ios-arm64-simulator/Headers/module.modulemap +7 -0
- package/ios/libdashshielded.xcframework/ios-arm64-simulator/libdashshielded.a +0 -0
- package/lib/load-addon.d.ts +34 -0
- package/lib/node.d.ts +50 -0
- package/lib/react-native.d.ts +31 -0
- package/lib/rndash.rn.js +267 -0
- package/lib/rndash.rn.js.map +1 -0
- package/lib/src/node.js +328 -0
- package/lib/src/node.js.map +1 -0
- package/lib/types.d.ts +73 -0
- package/node.d.ts +1 -0
- package/node.js +2 -0
- package/package.json +105 -0
- package/prebuilds/darwin-arm64/dashshielded.node +0 -0
- package/rust/Cargo.lock +6795 -0
- package/rust/Cargo.toml +63 -0
- package/rust/build.rs +7 -0
- package/rust/rust-toolchain.toml +3 -0
- package/rust/src/dash.udl +90 -0
- package/rust/src/lib.rs +16 -0
- package/rust/src/napi_api.rs +164 -0
- package/rust/src/uniffi_api.rs +116 -0
- package/rust/src/wallet.rs +888 -0
- package/rust/uniffi-bindgen.rs +3 -0
- package/src/load-addon.ts +99 -0
- package/src/node.ts +248 -0
- package/src/react-native.ts +212 -0
- package/src/types.ts +88 -0
package/rust/Cargo.toml
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
[package]
|
|
2
|
+
name = "edge-dash-shielded"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
edition = "2021"
|
|
5
|
+
publish = false
|
|
6
|
+
|
|
7
|
+
[lib]
|
|
8
|
+
name = "dashshielded"
|
|
9
|
+
crate-type = ["cdylib", "staticlib"]
|
|
10
|
+
|
|
11
|
+
[features]
|
|
12
|
+
default = ["napi-backend"]
|
|
13
|
+
napi-backend = ["dep:napi", "dep:napi-derive", "dep:napi-build"]
|
|
14
|
+
uniffi-backend = ["dep:uniffi", "dep:thiserror"]
|
|
15
|
+
|
|
16
|
+
[dependencies]
|
|
17
|
+
dash-sdk = { git = "https://github.com/dashpay/platform.git", tag = "v4.1.1", default-features = false, features = ["wallet"] }
|
|
18
|
+
dashcore = { git = "https://github.com/dashpay/rust-dashcore", rev = "70d4bf8e36057c58e02d56769a6e9760f701dd06" }
|
|
19
|
+
key-wallet = { git = "https://github.com/dashpay/rust-dashcore", rev = "70d4bf8e36057c58e02d56769a6e9760f701dd06" }
|
|
20
|
+
platform-wallet-storage = { git = "https://github.com/dashpay/platform.git", tag = "v4.1.1", features = ["sqlite"] }
|
|
21
|
+
dash-spv = { git = "https://github.com/dashpay/rust-dashcore", rev = "70d4bf8e36057c58e02d56769a6e9760f701dd06" }
|
|
22
|
+
dash-network-seeds = { git = "https://github.com/dashpay/rust-dashcore", rev = "70d4bf8e36057c58e02d56769a6e9760f701dd06" }
|
|
23
|
+
rs-sdk-trusted-context-provider = { git = "https://github.com/dashpay/platform.git", tag = "v4.1.1" }
|
|
24
|
+
reqwest = { version = "0.12", default-features = false, features = ["rustls-tls"] }
|
|
25
|
+
platform-wallet = { git = "https://github.com/dashpay/platform.git", tag = "v4.1.1", features = ["shielded"] }
|
|
26
|
+
bech32 = "0.11"
|
|
27
|
+
bip0039 = { version = "0.12", features = ["rand"] }
|
|
28
|
+
hex = "0.4"
|
|
29
|
+
json = "0.12"
|
|
30
|
+
napi = { version = "2.16", default-features = false, features = [
|
|
31
|
+
"napi8",
|
|
32
|
+
"async",
|
|
33
|
+
"tokio_rt",
|
|
34
|
+
], optional = true }
|
|
35
|
+
napi-derive = { version = "2.16", optional = true }
|
|
36
|
+
once_cell = "1"
|
|
37
|
+
orchard = { git = "https://github.com/dashpay/orchard.git", tag = "dashified-0.14.1", default-features = false }
|
|
38
|
+
thiserror = { version = "2", optional = true }
|
|
39
|
+
tokio = { version = "1", features = ["rt-multi-thread", "sync"] }
|
|
40
|
+
uniffi = { version = "0.29", optional = true, features = ["cli"] }
|
|
41
|
+
zip32 = "0.2"
|
|
42
|
+
|
|
43
|
+
[build-dependencies]
|
|
44
|
+
napi-build = { version = "2.1", optional = true }
|
|
45
|
+
uniffi = { version = "0.29", optional = true, features = ["build"] }
|
|
46
|
+
|
|
47
|
+
[[bin]]
|
|
48
|
+
name = "uniffi-bindgen"
|
|
49
|
+
path = "uniffi-bindgen.rs"
|
|
50
|
+
required-features = ["uniffi-backend"]
|
|
51
|
+
|
|
52
|
+
# The iOS app links every native module into one binary, and ARM64 direct
|
|
53
|
+
# branches only reach ±128 MB. With the full Dash Platform SDK compiled in,
|
|
54
|
+
# the default release profile pushed __TEXT past that limit and the link
|
|
55
|
+
# failed with `B/BL out of range` from monero's pre-linked blob, which the
|
|
56
|
+
# linker cannot split to insert branch islands. Optimize for size.
|
|
57
|
+
[profile.release]
|
|
58
|
+
opt-level = "z"
|
|
59
|
+
lto = "fat"
|
|
60
|
+
codegen-units = 1
|
|
61
|
+
strip = true
|
|
62
|
+
# Deliberately NOT `panic = "abort"`: both backends turn a Rust panic into a
|
|
63
|
+
# host-side error, and aborting would take the whole app down instead.
|
package/rust/build.rs
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
[Error]
|
|
2
|
+
interface DashError {
|
|
3
|
+
Internal(string message);
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
dictionary Addresses {
|
|
7
|
+
string shielded_address;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
dictionary Transaction {
|
|
11
|
+
string txid;
|
|
12
|
+
i64 block_time_in_seconds;
|
|
13
|
+
i64 mined_height;
|
|
14
|
+
string value;
|
|
15
|
+
string? fee;
|
|
16
|
+
string? to_address;
|
|
17
|
+
sequence<string> memos;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
dictionary Poll {
|
|
21
|
+
string alias;
|
|
22
|
+
string status;
|
|
23
|
+
f64 scan_progress;
|
|
24
|
+
u32 network_block_height;
|
|
25
|
+
string available_credits;
|
|
26
|
+
string total_credits;
|
|
27
|
+
sequence<Transaction> transactions;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
namespace dash {
|
|
31
|
+
[Throws=DashError]
|
|
32
|
+
void set_document_directory(string path);
|
|
33
|
+
|
|
34
|
+
[Throws=DashError]
|
|
35
|
+
void initialize(
|
|
36
|
+
string mnemonic_seed,
|
|
37
|
+
u32 account,
|
|
38
|
+
string alias,
|
|
39
|
+
string network_name,
|
|
40
|
+
string default_host,
|
|
41
|
+
u32 default_port
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
[Throws=DashError]
|
|
45
|
+
string stop(string alias);
|
|
46
|
+
|
|
47
|
+
[Throws=DashError]
|
|
48
|
+
void start_sync(string alias);
|
|
49
|
+
|
|
50
|
+
[Throws=DashError]
|
|
51
|
+
void stop_sync(string alias);
|
|
52
|
+
|
|
53
|
+
[Throws=DashError]
|
|
54
|
+
Addresses derive_shielded_address(string alias);
|
|
55
|
+
|
|
56
|
+
boolean is_valid_address(string address, string network);
|
|
57
|
+
|
|
58
|
+
[Throws=DashError]
|
|
59
|
+
string derive_viewing_key(string mnemonic_seed, string network);
|
|
60
|
+
|
|
61
|
+
[Throws=DashError]
|
|
62
|
+
void warm_up_prover();
|
|
63
|
+
|
|
64
|
+
boolean is_prover_ready();
|
|
65
|
+
|
|
66
|
+
[Throws=DashError]
|
|
67
|
+
Poll poll(string alias);
|
|
68
|
+
|
|
69
|
+
[Throws=DashError]
|
|
70
|
+
string propose_transfer(
|
|
71
|
+
string alias,
|
|
72
|
+
string amount_credits,
|
|
73
|
+
string to_address,
|
|
74
|
+
string? memo
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
[Throws=DashError]
|
|
78
|
+
string create_transfer(
|
|
79
|
+
string alias,
|
|
80
|
+
string proposal_id,
|
|
81
|
+
string mnemonic_seed
|
|
82
|
+
);
|
|
83
|
+
|
|
84
|
+
[Throws=DashError]
|
|
85
|
+
string derive_shielded_address_from_seed(
|
|
86
|
+
string mnemonic_seed,
|
|
87
|
+
string network,
|
|
88
|
+
u32 account
|
|
89
|
+
);
|
|
90
|
+
};
|
package/rust/src/lib.rs
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
mod wallet;
|
|
2
|
+
|
|
3
|
+
#[cfg(feature = "napi-backend")]
|
|
4
|
+
mod napi_api;
|
|
5
|
+
|
|
6
|
+
#[cfg(feature = "uniffi-backend")]
|
|
7
|
+
mod uniffi_api;
|
|
8
|
+
|
|
9
|
+
#[cfg(feature = "uniffi-backend")]
|
|
10
|
+
pub use uniffi_api::*;
|
|
11
|
+
|
|
12
|
+
#[cfg(feature = "uniffi-backend")]
|
|
13
|
+
pub use wallet::{Addresses, Poll, Transaction};
|
|
14
|
+
|
|
15
|
+
#[cfg(feature = "uniffi-backend")]
|
|
16
|
+
uniffi::include_scaffolding!("dash");
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
use napi::bindgen_prelude::*;
|
|
2
|
+
use napi_derive::napi;
|
|
3
|
+
|
|
4
|
+
use crate::wallet;
|
|
5
|
+
|
|
6
|
+
fn err(msg: impl ToString) -> Error {
|
|
7
|
+
Error::from_reason(msg.to_string())
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
fn map<T>(value: wallet::WalletResult<T>) -> Result<T> {
|
|
11
|
+
value.map_err(err)
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
#[napi(object)]
|
|
15
|
+
pub struct JsAddresses {
|
|
16
|
+
pub shielded_address: String,
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
#[napi(object)]
|
|
20
|
+
pub struct JsTransaction {
|
|
21
|
+
pub txid: String,
|
|
22
|
+
pub block_time_in_seconds: i64,
|
|
23
|
+
pub mined_height: i64,
|
|
24
|
+
pub value: String,
|
|
25
|
+
pub fee: Option<String>,
|
|
26
|
+
pub to_address: Option<String>,
|
|
27
|
+
pub memos: Vec<String>,
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
#[napi(object)]
|
|
31
|
+
pub struct JsPoll {
|
|
32
|
+
pub alias: String,
|
|
33
|
+
pub status: String,
|
|
34
|
+
pub scan_progress: f64,
|
|
35
|
+
pub network_block_height: u32,
|
|
36
|
+
pub available_credits: String,
|
|
37
|
+
pub total_credits: String,
|
|
38
|
+
pub transactions: Vec<JsTransaction>,
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
impl From<wallet::Addresses> for JsAddresses {
|
|
42
|
+
fn from(value: wallet::Addresses) -> Self {
|
|
43
|
+
Self {
|
|
44
|
+
shielded_address: value.shielded_address,
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
impl From<wallet::Transaction> for JsTransaction {
|
|
50
|
+
fn from(value: wallet::Transaction) -> Self {
|
|
51
|
+
Self {
|
|
52
|
+
txid: value.txid,
|
|
53
|
+
block_time_in_seconds: value.block_time_in_seconds,
|
|
54
|
+
mined_height: value.mined_height,
|
|
55
|
+
value: value.value,
|
|
56
|
+
fee: value.fee,
|
|
57
|
+
to_address: value.to_address,
|
|
58
|
+
memos: value.memos,
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
impl From<wallet::Poll> for JsPoll {
|
|
64
|
+
fn from(value: wallet::Poll) -> Self {
|
|
65
|
+
Self {
|
|
66
|
+
alias: value.alias,
|
|
67
|
+
status: value.status,
|
|
68
|
+
scan_progress: value.scan_progress,
|
|
69
|
+
network_block_height: value.network_block_height,
|
|
70
|
+
available_credits: value.available_credits,
|
|
71
|
+
total_credits: value.total_credits,
|
|
72
|
+
transactions: value.transactions.into_iter().map(Into::into).collect(),
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
#[napi]
|
|
78
|
+
pub fn set_document_directory(path: String) -> Result<()> {
|
|
79
|
+
map(wallet::set_document_directory(path))
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
#[napi]
|
|
83
|
+
pub async fn initialize(
|
|
84
|
+
mnemonic_seed: String,
|
|
85
|
+
account: u32,
|
|
86
|
+
alias: String,
|
|
87
|
+
network_name: String,
|
|
88
|
+
default_host: String,
|
|
89
|
+
default_port: u32,
|
|
90
|
+
) -> Result<()> {
|
|
91
|
+
map(wallet::initialize(
|
|
92
|
+
mnemonic_seed,
|
|
93
|
+
account,
|
|
94
|
+
alias,
|
|
95
|
+
network_name,
|
|
96
|
+
default_host,
|
|
97
|
+
default_port,
|
|
98
|
+
)
|
|
99
|
+
.await)
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
#[napi]
|
|
103
|
+
pub async fn stop(alias: String) -> Result<String> {
|
|
104
|
+
map(wallet::stop(alias).await)
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
#[napi]
|
|
108
|
+
pub async fn start_sync(alias: String) -> Result<()> {
|
|
109
|
+
map(wallet::start_sync(alias).await)
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
#[napi]
|
|
113
|
+
pub async fn stop_sync(alias: String) -> Result<()> {
|
|
114
|
+
map(wallet::stop_sync(alias).await)
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
#[napi]
|
|
118
|
+
pub async fn derive_shielded_address(alias: String) -> Result<JsAddresses> {
|
|
119
|
+
map(wallet::derive_shielded_address(alias).await).map(Into::into)
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
#[napi]
|
|
123
|
+
pub fn is_valid_address(address: String, network: String) -> bool {
|
|
124
|
+
wallet::is_valid_address(address, network)
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
#[napi]
|
|
128
|
+
pub fn derive_viewing_key(mnemonic_seed: String, network: String) -> Result<String> {
|
|
129
|
+
map(wallet::derive_viewing_key(mnemonic_seed, network))
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
#[napi]
|
|
133
|
+
pub async fn warm_up_prover() -> Result<()> {
|
|
134
|
+
map(wallet::warm_up_prover().await)
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
#[napi]
|
|
138
|
+
pub fn is_prover_ready() -> bool {
|
|
139
|
+
wallet::is_prover_ready()
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
#[napi]
|
|
143
|
+
pub async fn poll(alias: String) -> Result<JsPoll> {
|
|
144
|
+
map(wallet::poll(alias).await).map(Into::into)
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
#[napi]
|
|
148
|
+
pub async fn propose_transfer(
|
|
149
|
+
alias: String,
|
|
150
|
+
amount_credits: String,
|
|
151
|
+
to_address: String,
|
|
152
|
+
memo: Option<String>,
|
|
153
|
+
) -> Result<String> {
|
|
154
|
+
map(wallet::propose_transfer(alias, amount_credits, to_address, memo).await)
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
#[napi]
|
|
158
|
+
pub async fn create_transfer(
|
|
159
|
+
alias: String,
|
|
160
|
+
proposal_id: String,
|
|
161
|
+
mnemonic_seed: String,
|
|
162
|
+
) -> Result<String> {
|
|
163
|
+
map(wallet::create_transfer(alias, proposal_id, mnemonic_seed).await)
|
|
164
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
use once_cell::sync::Lazy;
|
|
2
|
+
use tokio::runtime::Runtime;
|
|
3
|
+
|
|
4
|
+
use crate::wallet;
|
|
5
|
+
|
|
6
|
+
static RT: Lazy<Runtime> = Lazy::new(|| Runtime::new().expect("tokio runtime"));
|
|
7
|
+
|
|
8
|
+
#[derive(Debug, thiserror::Error)]
|
|
9
|
+
pub enum DashError {
|
|
10
|
+
#[error("{message}")]
|
|
11
|
+
Internal { message: String },
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
fn map<T>(value: wallet::WalletResult<T>) -> Result<T, DashError> {
|
|
15
|
+
value.map_err(|message| DashError::Internal { message })
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
fn block_on<F: std::future::Future>(future: F) -> F::Output {
|
|
19
|
+
RT.block_on(future)
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
pub fn set_document_directory(path: String) -> Result<(), DashError> {
|
|
23
|
+
map(wallet::set_document_directory(path))
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
pub fn initialize(
|
|
27
|
+
mnemonic_seed: String,
|
|
28
|
+
account: u32,
|
|
29
|
+
alias: String,
|
|
30
|
+
network_name: String,
|
|
31
|
+
default_host: String,
|
|
32
|
+
default_port: u32,
|
|
33
|
+
) -> Result<(), DashError> {
|
|
34
|
+
map(block_on(wallet::initialize(
|
|
35
|
+
mnemonic_seed,
|
|
36
|
+
account,
|
|
37
|
+
alias,
|
|
38
|
+
network_name,
|
|
39
|
+
default_host,
|
|
40
|
+
default_port,
|
|
41
|
+
)))
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
pub fn stop(alias: String) -> Result<String, DashError> {
|
|
45
|
+
map(block_on(wallet::stop(alias)))
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
pub fn start_sync(alias: String) -> Result<(), DashError> {
|
|
49
|
+
map(block_on(wallet::start_sync(alias)))
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
pub fn stop_sync(alias: String) -> Result<(), DashError> {
|
|
53
|
+
map(block_on(wallet::stop_sync(alias)))
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
pub fn derive_shielded_address(alias: String) -> Result<wallet::Addresses, DashError> {
|
|
57
|
+
map(block_on(wallet::derive_shielded_address(alias)))
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
pub fn is_valid_address(address: String, network: String) -> bool {
|
|
61
|
+
wallet::is_valid_address(address, network)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
pub fn derive_viewing_key(mnemonic_seed: String, network: String) -> Result<String, DashError> {
|
|
65
|
+
map(wallet::derive_viewing_key(mnemonic_seed, network))
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
pub fn warm_up_prover() -> Result<(), DashError> {
|
|
69
|
+
map(block_on(wallet::warm_up_prover()))
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
pub fn is_prover_ready() -> bool {
|
|
73
|
+
wallet::is_prover_ready()
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
pub fn poll(alias: String) -> Result<wallet::Poll, DashError> {
|
|
77
|
+
map(block_on(wallet::poll(alias)))
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
pub fn propose_transfer(
|
|
81
|
+
alias: String,
|
|
82
|
+
amount_credits: String,
|
|
83
|
+
to_address: String,
|
|
84
|
+
memo: Option<String>,
|
|
85
|
+
) -> Result<String, DashError> {
|
|
86
|
+
map(block_on(wallet::propose_transfer(
|
|
87
|
+
alias,
|
|
88
|
+
amount_credits,
|
|
89
|
+
to_address,
|
|
90
|
+
memo,
|
|
91
|
+
)))
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
pub fn create_transfer(
|
|
95
|
+
alias: String,
|
|
96
|
+
proposal_id: String,
|
|
97
|
+
mnemonic_seed: String,
|
|
98
|
+
) -> Result<String, DashError> {
|
|
99
|
+
map(block_on(wallet::create_transfer(
|
|
100
|
+
alias,
|
|
101
|
+
proposal_id,
|
|
102
|
+
mnemonic_seed,
|
|
103
|
+
)))
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
pub fn derive_shielded_address_from_seed(
|
|
107
|
+
mnemonic_seed: String,
|
|
108
|
+
network: String,
|
|
109
|
+
account: u32,
|
|
110
|
+
) -> Result<String, DashError> {
|
|
111
|
+
let alias = format!("tools-addr-{network}-{account}");
|
|
112
|
+
initialize(mnemonic_seed, account, alias.clone(), network, String::new(), 0)?;
|
|
113
|
+
let addresses = derive_shielded_address(alias.clone())?;
|
|
114
|
+
let _ = stop(alias);
|
|
115
|
+
Ok(addresses.shielded_address)
|
|
116
|
+
}
|