mirror of
https://github.com/logos-blockchain/lssa.git
synced 2026-03-21 11:23:10 +00:00
fix: final fixes & polishing
This commit is contained in:
parent
9d87e3b046
commit
b631ef02c6
12
Cargo.lock
generated
12
Cargo.lock
generated
@ -1498,22 +1498,16 @@ name = "common"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"base64 0.22.1",
|
||||
"borsh",
|
||||
"bytesize",
|
||||
"hex",
|
||||
"log",
|
||||
"logos-blockchain-common-http-client",
|
||||
"nssa",
|
||||
"nssa_core",
|
||||
"reqwest",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"serde_with",
|
||||
"sha2",
|
||||
"thiserror 2.0.18",
|
||||
"tokio-retry",
|
||||
"url",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -3556,8 +3550,6 @@ name = "integration_tests"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"base64 0.22.1",
|
||||
"borsh",
|
||||
"bytesize",
|
||||
"common",
|
||||
"env_logger",
|
||||
@ -7200,7 +7192,6 @@ dependencies = [
|
||||
"jsonrpsee",
|
||||
"nssa",
|
||||
"nssa_core",
|
||||
"serde_json",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -8652,8 +8643,6 @@ dependencies = [
|
||||
"anyhow",
|
||||
"async-stream",
|
||||
"base58",
|
||||
"base64 0.22.1",
|
||||
"borsh",
|
||||
"clap",
|
||||
"common",
|
||||
"env_logger",
|
||||
@ -8684,7 +8673,6 @@ name = "wallet-ffi"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"cbindgen",
|
||||
"common",
|
||||
"nssa",
|
||||
"nssa_core",
|
||||
"sequencer_service_rpc",
|
||||
|
||||
2
Justfile
2
Justfile
@ -33,7 +33,7 @@ run-bedrock:
|
||||
[working-directory: 'sequencer/service']
|
||||
run-sequencer:
|
||||
@echo "🧠 Running sequencer"
|
||||
RUST_LOG=info RISC0_DEV_MODE=1 cargo run --release -p sequencer_service configs/debug
|
||||
RUST_LOG=info RISC0_DEV_MODE=1 cargo run --release -p sequencer_service configs/debug/sequencer_config.json
|
||||
|
||||
# Run Indexer
|
||||
[working-directory: 'indexer/service']
|
||||
|
||||
@ -13,16 +13,10 @@ nssa_core.workspace = true
|
||||
|
||||
anyhow.workspace = true
|
||||
thiserror.workspace = true
|
||||
serde_json.workspace = true
|
||||
serde.workspace = true
|
||||
serde_with.workspace = true
|
||||
reqwest.workspace = true
|
||||
sha2.workspace = true
|
||||
log.workspace = true
|
||||
hex.workspace = true
|
||||
borsh.workspace = true
|
||||
bytesize.workspace = true
|
||||
base64.workspace = true
|
||||
url.workspace = true
|
||||
logos-blockchain-common-http-client.workspace = true
|
||||
tokio-retry.workspace = true
|
||||
|
||||
@ -27,11 +27,9 @@ url.workspace = true
|
||||
anyhow.workspace = true
|
||||
env_logger.workspace = true
|
||||
log.workspace = true
|
||||
base64.workspace = true
|
||||
tokio = { workspace = true, features = ["rt-multi-thread", "macros"] }
|
||||
hex.workspace = true
|
||||
tempfile.workspace = true
|
||||
borsh.workspace = true
|
||||
bytesize.workspace = true
|
||||
futures.workspace = true
|
||||
testcontainers = { version = "0.27.0", features = ["docker-compose"] }
|
||||
|
||||
@ -480,5 +480,7 @@ pub async fn verify_commitment_is_in_state(
|
||||
seq_client
|
||||
.get_proof_for_commitment(commitment)
|
||||
.await
|
||||
.is_ok()
|
||||
.ok()
|
||||
.flatten()
|
||||
.is_some()
|
||||
}
|
||||
|
||||
@ -19,10 +19,12 @@ serde.workspace = true
|
||||
k256.workspace = true
|
||||
sha2.workspace = true
|
||||
rand.workspace = true
|
||||
base58.workspace = true
|
||||
hex.workspace = true
|
||||
aes-gcm.workspace = true
|
||||
bip39.workspace = true
|
||||
hmac-sha512.workspace = true
|
||||
thiserror.workspace = true
|
||||
itertools.workspace = true
|
||||
|
||||
[dev-dependencies]
|
||||
base58.workspace = true
|
||||
|
||||
@ -10,16 +10,16 @@ use sha2::{Digest as _, digest::FixedOutput as _};
|
||||
|
||||
const NSSA_ENTROPY_BYTES: [u8; 32] = [0; 32];
|
||||
|
||||
#[derive(Debug)]
|
||||
/// Seed holder. Non-clonable to ensure that different holders use different seeds.
|
||||
/// Produces `TopSecretKeyHolder` objects.
|
||||
#[derive(Debug)]
|
||||
pub struct SeedHolder {
|
||||
// ToDo: Needs to be vec as serde derives is not implemented for [u8; 64]
|
||||
pub(crate) seed: Vec<u8>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
|
||||
/// Secret spending key object. Can produce `PrivateKeyHolder` objects.
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
|
||||
pub struct SecretSpendingKey(pub(crate) [u8; 32]);
|
||||
|
||||
pub type ViewingSecretKey = Scalar;
|
||||
|
||||
@ -66,13 +66,13 @@ impl NSSAUserData {
|
||||
) -> Result<Self> {
|
||||
if !Self::valid_public_key_transaction_pairing_check(&default_accounts_keys) {
|
||||
anyhow::bail!(
|
||||
"Key transaction pairing check not satisfied, there is account_ids, which is not derived from keys"
|
||||
"Key transaction pairing check not satisfied, there are public account_ids, which is not derived from keys"
|
||||
);
|
||||
}
|
||||
|
||||
if !Self::valid_private_key_transaction_pairing_check(&default_accounts_key_chains) {
|
||||
anyhow::bail!(
|
||||
"Key transaction pairing check not satisfied, there is account_ids, which is not derived from keys"
|
||||
"Key transaction pairing check not satisfied, there are private account_ids, which is not derived from keys"
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -97,7 +97,7 @@ COPY --from=builder --chown=sequencer_user:sequencer_user /usr/local/bin/r0vm /u
|
||||
COPY --from=builder --chown=sequencer_user:sequencer_user /root/.logos-blockchain-circuits /home/sequencer_user/.logos-blockchain-circuits
|
||||
|
||||
# Copy entrypoint script
|
||||
COPY sequencer_service/docker-entrypoint.sh /docker-entrypoint.sh
|
||||
COPY sequencer/service/docker-entrypoint.sh /docker-entrypoint.sh
|
||||
RUN chmod +x /docker-entrypoint.sh
|
||||
|
||||
# Expose default port
|
||||
@ -125,4 +125,4 @@ USER root
|
||||
ENTRYPOINT ["/docker-entrypoint.sh"]
|
||||
|
||||
WORKDIR /sequencer_service
|
||||
CMD ["sequencer_service", "/etc/sequencer_service"]
|
||||
CMD ["sequencer_service", "/etc/sequencer_service/sequencer_config.json"]
|
||||
|
||||
@ -2,13 +2,13 @@ services:
|
||||
sequencer_service:
|
||||
image: lssa/sequencer_service
|
||||
build:
|
||||
context: ..
|
||||
context: ../..
|
||||
dockerfile: sequencer/service/Dockerfile
|
||||
container_name: sequencer_service
|
||||
ports:
|
||||
- "3040:3040"
|
||||
volumes:
|
||||
# Mount configuration folder
|
||||
- ./configs/docker:/etc/sequencer_service
|
||||
# Mount configuration file
|
||||
- ./configs/docker/sequencer_config.json:/etc/sequencer_service/sequencer_config.json
|
||||
# Mount data folder
|
||||
- ./data:/var/lib/sequencer_service
|
||||
|
||||
@ -13,7 +13,6 @@ nssa.workspace = true
|
||||
nssa_core.workspace = true
|
||||
|
||||
jsonrpsee = { workspace = true, features = ["macros"] }
|
||||
serde_json.workspace = true
|
||||
|
||||
[features]
|
||||
client = ["jsonrpsee/client"]
|
||||
|
||||
@ -79,7 +79,7 @@ pub trait Rpc {
|
||||
async fn get_proof_for_commitment(
|
||||
&self,
|
||||
commitment: Commitment,
|
||||
) -> Result<MembershipProof, ErrorObjectOwned>;
|
||||
) -> Result<Option<MembershipProof>, ErrorObjectOwned>;
|
||||
|
||||
#[method(name = "getAccount")]
|
||||
async fn get_account(&self, account_id: AccountId) -> Result<Account, ErrorObjectOwned>;
|
||||
|
||||
@ -160,18 +160,9 @@ impl<BC: BlockSettlementClientTrait + Send + 'static, IC: IndexerClientTrait + S
|
||||
async fn get_proof_for_commitment(
|
||||
&self,
|
||||
commitment: Commitment,
|
||||
) -> Result<MembershipProof, ErrorObjectOwned> {
|
||||
) -> Result<Option<MembershipProof>, ErrorObjectOwned> {
|
||||
let sequencer = self.sequencer.lock().await;
|
||||
sequencer
|
||||
.state()
|
||||
.get_proof_for_commitment(&commitment)
|
||||
.ok_or_else(|| {
|
||||
ErrorObjectOwned::owned(
|
||||
NOT_FOUND_ERROR_CODE,
|
||||
"Proof for commitment not found",
|
||||
None::<()>,
|
||||
)
|
||||
})
|
||||
Ok(sequencer.state().get_proof_for_commitment(&commitment))
|
||||
}
|
||||
|
||||
async fn get_account(&self, account_id: AccountId) -> Result<Account, ErrorObjectOwned> {
|
||||
|
||||
@ -13,7 +13,6 @@ crate-type = ["rlib", "cdylib", "staticlib"]
|
||||
[dependencies]
|
||||
wallet.workspace = true
|
||||
nssa.workspace = true
|
||||
common.workspace = true
|
||||
nssa_core.workspace = true
|
||||
sequencer_service_rpc = { workspace = true, features = ["client"] }
|
||||
tokio.workspace = true
|
||||
|
||||
@ -27,8 +27,6 @@ humantime.workspace = true
|
||||
tokio = { workspace = true, features = ["macros"] }
|
||||
clap.workspace = true
|
||||
base58.workspace = true
|
||||
base64.workspace = true
|
||||
borsh.workspace = true
|
||||
hex.workspace = true
|
||||
rand.workspace = true
|
||||
itertools.workspace = true
|
||||
|
||||
@ -161,105 +161,44 @@ impl WalletChainStore {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::str::FromStr as _;
|
||||
|
||||
use key_protocol::key_management::key_tree::{
|
||||
keys_private::ChildKeysPrivate, keys_public::ChildKeysPublic, traits::KeyNode as _,
|
||||
};
|
||||
use nssa::PrivateKey;
|
||||
|
||||
use super::*;
|
||||
use crate::config::{
|
||||
InitialAccountData, PersistentAccountDataPrivate, PersistentAccountDataPublic,
|
||||
InitialAccountData, InitialAccountDataPublic, PersistentAccountDataPrivate,
|
||||
PersistentAccountDataPublic,
|
||||
};
|
||||
|
||||
fn create_initial_accounts() -> Vec<InitialAccountData> {
|
||||
let initial_acc1 = serde_json::from_str(
|
||||
r#"{
|
||||
"Public": {
|
||||
"account_id": "CbgR6tj5kWx5oziiFptM7jMvrQeYY3Mzaao6ciuhSr2r",
|
||||
"pub_sign_key": [
|
||||
127,
|
||||
39,
|
||||
48,
|
||||
152,
|
||||
242,
|
||||
91,
|
||||
113,
|
||||
230,
|
||||
192,
|
||||
5,
|
||||
169,
|
||||
81,
|
||||
159,
|
||||
38,
|
||||
120,
|
||||
218,
|
||||
141,
|
||||
28,
|
||||
127,
|
||||
1,
|
||||
246,
|
||||
162,
|
||||
119,
|
||||
120,
|
||||
226,
|
||||
217,
|
||||
148,
|
||||
138,
|
||||
189,
|
||||
249,
|
||||
1,
|
||||
251
|
||||
]
|
||||
}
|
||||
}"#,
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
let initial_acc2 = serde_json::from_str(
|
||||
r#"{
|
||||
"Public": {
|
||||
"account_id": "2RHZhw9h534Zr3eq2RGhQete2Hh667foECzXPmSkGni2",
|
||||
"pub_sign_key": [
|
||||
244,
|
||||
52,
|
||||
248,
|
||||
116,
|
||||
23,
|
||||
32,
|
||||
1,
|
||||
69,
|
||||
134,
|
||||
174,
|
||||
67,
|
||||
53,
|
||||
109,
|
||||
42,
|
||||
236,
|
||||
98,
|
||||
87,
|
||||
218,
|
||||
8,
|
||||
98,
|
||||
34,
|
||||
246,
|
||||
4,
|
||||
221,
|
||||
183,
|
||||
93,
|
||||
105,
|
||||
115,
|
||||
59,
|
||||
134,
|
||||
252,
|
||||
76
|
||||
]
|
||||
}
|
||||
}"#,
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
let initial_accounts = vec![initial_acc1, initial_acc2];
|
||||
|
||||
initial_accounts
|
||||
vec![
|
||||
InitialAccountData::Public(InitialAccountDataPublic {
|
||||
account_id: nssa::AccountId::from_str(
|
||||
"CbgR6tj5kWx5oziiFptM7jMvrQeYY3Mzaao6ciuhSr2r",
|
||||
)
|
||||
.unwrap(),
|
||||
pub_sign_key: PrivateKey::try_new([
|
||||
127, 39, 48, 152, 242, 91, 113, 230, 192, 5, 169, 81, 159, 38, 120, 218, 141,
|
||||
28, 127, 1, 246, 162, 119, 120, 226, 217, 148, 138, 189, 249, 1, 251,
|
||||
])
|
||||
.unwrap(),
|
||||
}),
|
||||
InitialAccountData::Public(InitialAccountDataPublic {
|
||||
account_id: nssa::AccountId::from_str(
|
||||
"2RHZhw9h534Zr3eq2RGhQete2Hh667foECzXPmSkGni2",
|
||||
)
|
||||
.unwrap(),
|
||||
pub_sign_key: PrivateKey::try_new([
|
||||
244, 52, 248, 116, 23, 32, 1, 69, 134, 174, 67, 53, 109, 42, 236, 98, 87, 218,
|
||||
8, 98, 34, 246, 4, 221, 183, 93, 105, 115, 59, 134, 252, 76,
|
||||
])
|
||||
.unwrap(),
|
||||
}),
|
||||
]
|
||||
}
|
||||
|
||||
fn create_sample_wallet_config() -> WalletConfig {
|
||||
|
||||
@ -62,7 +62,7 @@ impl WalletSubcommand for AuthTransferSubcommand {
|
||||
.register_account(account_id)
|
||||
.await?;
|
||||
|
||||
println!("Results of tx send are {tx_hash:#?}");
|
||||
println!("Transaction hash is {tx_hash}");
|
||||
|
||||
let transfer_tx = wallet_core.poll_native_token_transfer(tx_hash).await?;
|
||||
|
||||
@ -77,7 +77,7 @@ impl WalletSubcommand for AuthTransferSubcommand {
|
||||
.register_account_private(account_id)
|
||||
.await?;
|
||||
|
||||
println!("Results of tx send are {tx_hash:#?}");
|
||||
println!("Transaction hash is {tx_hash}");
|
||||
|
||||
let transfer_tx = wallet_core.poll_native_token_transfer(tx_hash).await?;
|
||||
|
||||
@ -313,7 +313,7 @@ impl WalletSubcommand for NativeTokenTransferProgramSubcommandPrivate {
|
||||
.send_private_transfer_to_owned_account(from, to, amount)
|
||||
.await?;
|
||||
|
||||
println!("Transaction hash is {tx_hash:#?}");
|
||||
println!("Transaction hash is {tx_hash}");
|
||||
|
||||
let transfer_tx = wallet_core.poll_native_token_transfer(tx_hash).await?;
|
||||
|
||||
@ -352,7 +352,7 @@ impl WalletSubcommand for NativeTokenTransferProgramSubcommandPrivate {
|
||||
.send_private_transfer_to_outer_account(from, to_npk, to_vpk, amount)
|
||||
.await?;
|
||||
|
||||
println!("Transaction hash is {tx_hash:#?}");
|
||||
println!("Transaction hash is {tx_hash}");
|
||||
|
||||
let transfer_tx = wallet_core.poll_native_token_transfer(tx_hash).await?;
|
||||
|
||||
@ -387,7 +387,7 @@ impl WalletSubcommand for NativeTokenTransferProgramSubcommandShielded {
|
||||
.send_shielded_transfer(from, to, amount)
|
||||
.await?;
|
||||
|
||||
println!("Transaction hash is {tx_hash:#?}");
|
||||
println!("Transaction hash is {tx_hash}");
|
||||
|
||||
let transfer_tx = wallet_core.poll_native_token_transfer(tx_hash).await?;
|
||||
|
||||
@ -427,7 +427,7 @@ impl WalletSubcommand for NativeTokenTransferProgramSubcommandShielded {
|
||||
.send_shielded_transfer_to_outer_account(from, to_npk, to_vpk, amount)
|
||||
.await?;
|
||||
|
||||
println!("Transaction hash is {tx_hash:#?}");
|
||||
println!("Transaction hash is {tx_hash}");
|
||||
|
||||
wallet_core.store_persistent_data().await?;
|
||||
|
||||
@ -457,7 +457,7 @@ impl WalletSubcommand for NativeTokenTransferProgramSubcommand {
|
||||
.send_deshielded_transfer(from, to, amount)
|
||||
.await?;
|
||||
|
||||
println!("Transaction hash is {tx_hash:#?}");
|
||||
println!("Transaction hash is {tx_hash}");
|
||||
|
||||
let transfer_tx = wallet_core.poll_native_token_transfer(tx_hash).await?;
|
||||
|
||||
@ -482,7 +482,7 @@ impl WalletSubcommand for NativeTokenTransferProgramSubcommand {
|
||||
.send_public_transfer(from, to, amount)
|
||||
.await?;
|
||||
|
||||
println!("Transaction hash is {tx_hash:#?}");
|
||||
println!("Transaction hash is {tx_hash}");
|
||||
|
||||
let transfer_tx = wallet_core.poll_native_token_transfer(tx_hash).await?;
|
||||
|
||||
|
||||
@ -116,7 +116,7 @@ impl WalletSubcommand for PinataProgramSubcommandPublic {
|
||||
.claim(pinata_account_id, winner_account_id, solution)
|
||||
.await?;
|
||||
|
||||
println!("Transaction hash is {tx_hash:#?}");
|
||||
println!("Transaction hash is {tx_hash}");
|
||||
|
||||
let transfer_tx = wallet_core.poll_native_token_transfer(tx_hash).await?;
|
||||
|
||||
@ -151,7 +151,7 @@ impl WalletSubcommand for PinataProgramSubcommandPrivate {
|
||||
.claim_private_owned_account(pinata_account_id, winner_account_id, solution)
|
||||
.await?;
|
||||
|
||||
println!("Transaction hash is {tx_hash:#?}");
|
||||
println!("Transaction hash is {tx_hash}");
|
||||
|
||||
let transfer_tx = wallet_core.poll_native_token_transfer(tx_hash).await?;
|
||||
|
||||
|
||||
@ -721,7 +721,7 @@ impl WalletSubcommand for TokenProgramSubcommandPrivate {
|
||||
)
|
||||
.await?;
|
||||
|
||||
println!("Transaction hash is {tx_hash:#?}");
|
||||
println!("Transaction hash is {tx_hash}");
|
||||
|
||||
let transfer_tx = wallet_core.poll_native_token_transfer(tx_hash).await?;
|
||||
|
||||
@ -769,7 +769,7 @@ impl WalletSubcommand for TokenProgramSubcommandPrivate {
|
||||
)
|
||||
.await?;
|
||||
|
||||
println!("Transaction hash is {tx_hash:#?}");
|
||||
println!("Transaction hash is {tx_hash}");
|
||||
|
||||
let transfer_tx = wallet_core.poll_native_token_transfer(tx_hash).await?;
|
||||
|
||||
@ -802,7 +802,7 @@ impl WalletSubcommand for TokenProgramSubcommandPrivate {
|
||||
)
|
||||
.await?;
|
||||
|
||||
println!("Transaction hash is {tx_hash:#?}");
|
||||
println!("Transaction hash is {tx_hash}");
|
||||
|
||||
let transfer_tx = wallet_core.poll_native_token_transfer(tx_hash).await?;
|
||||
|
||||
@ -838,7 +838,7 @@ impl WalletSubcommand for TokenProgramSubcommandPrivate {
|
||||
)
|
||||
.await?;
|
||||
|
||||
println!("Transaction hash is {tx_hash:#?}");
|
||||
println!("Transaction hash is {tx_hash}");
|
||||
|
||||
let transfer_tx = wallet_core.poll_native_token_transfer(tx_hash).await?;
|
||||
|
||||
@ -887,7 +887,7 @@ impl WalletSubcommand for TokenProgramSubcommandPrivate {
|
||||
)
|
||||
.await?;
|
||||
|
||||
println!("Transaction hash is {tx_hash:#?}");
|
||||
println!("Transaction hash is {tx_hash}");
|
||||
|
||||
let transfer_tx = wallet_core.poll_native_token_transfer(tx_hash).await?;
|
||||
|
||||
@ -930,7 +930,7 @@ impl WalletSubcommand for TokenProgramSubcommandDeshielded {
|
||||
)
|
||||
.await?;
|
||||
|
||||
println!("Transaction hash is {tx_hash:#?}");
|
||||
println!("Transaction hash is {tx_hash}");
|
||||
|
||||
let transfer_tx = wallet_core.poll_native_token_transfer(tx_hash).await?;
|
||||
|
||||
@ -963,7 +963,7 @@ impl WalletSubcommand for TokenProgramSubcommandDeshielded {
|
||||
)
|
||||
.await?;
|
||||
|
||||
println!("Transaction hash is {tx_hash:#?}");
|
||||
println!("Transaction hash is {tx_hash}");
|
||||
|
||||
let transfer_tx = wallet_core.poll_native_token_transfer(tx_hash).await?;
|
||||
|
||||
@ -996,7 +996,7 @@ impl WalletSubcommand for TokenProgramSubcommandDeshielded {
|
||||
)
|
||||
.await?;
|
||||
|
||||
println!("Transaction hash is {tx_hash:#?}");
|
||||
println!("Transaction hash is {tx_hash}");
|
||||
|
||||
let transfer_tx = wallet_core.poll_native_token_transfer(tx_hash).await?;
|
||||
|
||||
@ -1051,7 +1051,7 @@ impl WalletSubcommand for TokenProgramSubcommandShielded {
|
||||
)
|
||||
.await?;
|
||||
|
||||
println!("Transaction hash is {tx_hash:#?}");
|
||||
println!("Transaction hash is {tx_hash}");
|
||||
|
||||
let transfer_tx = wallet_core.poll_native_token_transfer(tx_hash).await?;
|
||||
|
||||
@ -1079,7 +1079,7 @@ impl WalletSubcommand for TokenProgramSubcommandShielded {
|
||||
)
|
||||
.await?;
|
||||
|
||||
println!("Transaction hash is {tx_hash:#?}");
|
||||
println!("Transaction hash is {tx_hash}");
|
||||
|
||||
let transfer_tx = wallet_core.poll_native_token_transfer(tx_hash).await?;
|
||||
|
||||
@ -1112,7 +1112,7 @@ impl WalletSubcommand for TokenProgramSubcommandShielded {
|
||||
)
|
||||
.await?;
|
||||
|
||||
println!("Transaction hash is {tx_hash:#?}");
|
||||
println!("Transaction hash is {tx_hash}");
|
||||
|
||||
let transfer_tx = wallet_core.poll_native_token_transfer(tx_hash).await?;
|
||||
|
||||
@ -1145,7 +1145,7 @@ impl WalletSubcommand for TokenProgramSubcommandShielded {
|
||||
)
|
||||
.await?;
|
||||
|
||||
println!("Transaction hash is {tx_hash:#?}");
|
||||
println!("Transaction hash is {tx_hash}");
|
||||
|
||||
let transfer_tx = wallet_core.poll_native_token_transfer(tx_hash).await?;
|
||||
|
||||
@ -1191,7 +1191,7 @@ impl WalletSubcommand for TokenProgramSubcommandShielded {
|
||||
)
|
||||
.await?;
|
||||
|
||||
println!("Transaction hash is {tx_hash:#?}");
|
||||
println!("Transaction hash is {tx_hash}");
|
||||
|
||||
let transfer_tx = wallet_core.poll_native_token_transfer(tx_hash).await?;
|
||||
|
||||
@ -1231,7 +1231,7 @@ impl WalletSubcommand for CreateNewTokenProgramSubcommand {
|
||||
)
|
||||
.await?;
|
||||
|
||||
println!("Transaction hash is {tx_hash:#?}");
|
||||
println!("Transaction hash is {tx_hash}");
|
||||
|
||||
let transfer_tx = wallet_core.poll_native_token_transfer(tx_hash).await?;
|
||||
|
||||
@ -1269,7 +1269,7 @@ impl WalletSubcommand for CreateNewTokenProgramSubcommand {
|
||||
)
|
||||
.await?;
|
||||
|
||||
println!("Transaction hash is {tx_hash:#?}");
|
||||
println!("Transaction hash is {tx_hash}");
|
||||
|
||||
let transfer_tx = wallet_core.poll_native_token_transfer(tx_hash).await?;
|
||||
|
||||
@ -1304,7 +1304,7 @@ impl WalletSubcommand for CreateNewTokenProgramSubcommand {
|
||||
)
|
||||
.await?;
|
||||
|
||||
println!("Transaction hash is {tx_hash:#?}");
|
||||
println!("Transaction hash is {tx_hash}");
|
||||
|
||||
let transfer_tx = wallet_core.poll_native_token_transfer(tx_hash).await?;
|
||||
|
||||
|
||||
@ -2,6 +2,7 @@ use std::{
|
||||
collections::HashMap,
|
||||
io::{BufReader, Write as _},
|
||||
path::Path,
|
||||
str::FromStr as _,
|
||||
time::Duration,
|
||||
};
|
||||
|
||||
@ -217,481 +218,52 @@ impl Default for WalletConfig {
|
||||
seq_poll_max_retries: 5,
|
||||
seq_block_poll_max_amount: 100,
|
||||
basic_auth: None,
|
||||
initial_accounts: {
|
||||
let init_acc_json = r#"
|
||||
[
|
||||
{
|
||||
"Public": {
|
||||
"account_id": "CbgR6tj5kWx5oziiFptM7jMvrQeYY3Mzaao6ciuhSr2r",
|
||||
"pub_sign_key": [
|
||||
127,
|
||||
39,
|
||||
48,
|
||||
152,
|
||||
242,
|
||||
91,
|
||||
113,
|
||||
230,
|
||||
192,
|
||||
5,
|
||||
169,
|
||||
81,
|
||||
159,
|
||||
38,
|
||||
120,
|
||||
218,
|
||||
141,
|
||||
28,
|
||||
127,
|
||||
1,
|
||||
246,
|
||||
162,
|
||||
119,
|
||||
120,
|
||||
226,
|
||||
217,
|
||||
148,
|
||||
138,
|
||||
189,
|
||||
249,
|
||||
1,
|
||||
251
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"Public": {
|
||||
"account_id": "2RHZhw9h534Zr3eq2RGhQete2Hh667foECzXPmSkGni2",
|
||||
"pub_sign_key": [
|
||||
244,
|
||||
52,
|
||||
248,
|
||||
116,
|
||||
23,
|
||||
32,
|
||||
1,
|
||||
69,
|
||||
134,
|
||||
174,
|
||||
67,
|
||||
53,
|
||||
109,
|
||||
42,
|
||||
236,
|
||||
98,
|
||||
87,
|
||||
218,
|
||||
8,
|
||||
98,
|
||||
34,
|
||||
246,
|
||||
4,
|
||||
221,
|
||||
183,
|
||||
93,
|
||||
105,
|
||||
115,
|
||||
59,
|
||||
134,
|
||||
252,
|
||||
76
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"Private": {
|
||||
"account_id": "HWkW5qd4XK3me6sCAb4bfPj462k33DjtKtEcYpuzNwB",
|
||||
"account": {
|
||||
"program_owner": [
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"balance": 10000,
|
||||
"data": [],
|
||||
"nonce": 0
|
||||
},
|
||||
"key_chain": {
|
||||
"secret_spending_key": [
|
||||
14,
|
||||
202,
|
||||
241,
|
||||
109,
|
||||
32,
|
||||
181,
|
||||
152,
|
||||
140,
|
||||
76,
|
||||
153,
|
||||
108,
|
||||
57,
|
||||
77,
|
||||
192,
|
||||
181,
|
||||
97,
|
||||
108,
|
||||
144,
|
||||
122,
|
||||
45,
|
||||
219,
|
||||
5,
|
||||
203,
|
||||
193,
|
||||
82,
|
||||
123,
|
||||
83,
|
||||
34,
|
||||
250,
|
||||
214,
|
||||
137,
|
||||
63
|
||||
],
|
||||
"private_key_holder": {
|
||||
"nullifier_secret_key": [
|
||||
174,
|
||||
56,
|
||||
101,
|
||||
30,
|
||||
248,
|
||||
249,
|
||||
100,
|
||||
0,
|
||||
122,
|
||||
199,
|
||||
209,
|
||||
246,
|
||||
58,
|
||||
163,
|
||||
223,
|
||||
146,
|
||||
59,
|
||||
143,
|
||||
78,
|
||||
95,
|
||||
41,
|
||||
186,
|
||||
106,
|
||||
187,
|
||||
53,
|
||||
63,
|
||||
75,
|
||||
244,
|
||||
233,
|
||||
185,
|
||||
110,
|
||||
199
|
||||
],
|
||||
"viewing_secret_key": [
|
||||
251,
|
||||
85,
|
||||
223,
|
||||
73,
|
||||
142,
|
||||
127,
|
||||
134,
|
||||
132,
|
||||
185,
|
||||
210,
|
||||
100,
|
||||
103,
|
||||
198,
|
||||
108,
|
||||
229,
|
||||
80,
|
||||
176,
|
||||
211,
|
||||
249,
|
||||
114,
|
||||
110,
|
||||
7,
|
||||
225,
|
||||
17,
|
||||
7,
|
||||
69,
|
||||
204,
|
||||
32,
|
||||
47,
|
||||
242,
|
||||
103,
|
||||
247
|
||||
]
|
||||
initial_accounts: vec![
|
||||
InitialAccountData::Public(InitialAccountDataPublic {
|
||||
account_id: nssa::AccountId::from_str(
|
||||
"CbgR6tj5kWx5oziiFptM7jMvrQeYY3Mzaao6ciuhSr2r",
|
||||
)
|
||||
.unwrap(),
|
||||
pub_sign_key: nssa::PrivateKey::try_new([
|
||||
127, 39, 48, 152, 242, 91, 113, 230, 192, 5, 169, 81, 159, 38, 120, 218,
|
||||
141, 28, 127, 1, 246, 162, 119, 120, 226, 217, 148, 138, 189, 249, 1, 251,
|
||||
])
|
||||
.unwrap(),
|
||||
}),
|
||||
InitialAccountData::Public(InitialAccountDataPublic {
|
||||
account_id: nssa::AccountId::from_str(
|
||||
"7wHg9sbJwc6h3NP1S9bekfAzB8CHifEcxKswCKUt3YQo",
|
||||
)
|
||||
.unwrap(),
|
||||
pub_sign_key: nssa::PrivateKey::try_new([
|
||||
244, 52, 248, 116, 23, 32, 1, 69, 134, 174, 67, 53, 109, 42, 236, 98, 87,
|
||||
218, 8, 98, 34, 246, 4, 221, 183, 93, 105, 115, 59, 134, 252, 76,
|
||||
])
|
||||
.unwrap(),
|
||||
}),
|
||||
InitialAccountData::Private(Box::new(InitialAccountDataPrivate {
|
||||
account_id: nssa::AccountId::from_str(
|
||||
"HWkW5qd4XK3me6sCAb4bfPj462k33DjtKtEcYpuzNwB",
|
||||
)
|
||||
.unwrap(),
|
||||
account: nssa::Account {
|
||||
balance: 10_000,
|
||||
..Default::default()
|
||||
},
|
||||
"nullifier_public_key": [
|
||||
139,
|
||||
19,
|
||||
158,
|
||||
11,
|
||||
155,
|
||||
231,
|
||||
85,
|
||||
206,
|
||||
132,
|
||||
228,
|
||||
220,
|
||||
114,
|
||||
145,
|
||||
89,
|
||||
113,
|
||||
156,
|
||||
238,
|
||||
142,
|
||||
242,
|
||||
74,
|
||||
182,
|
||||
91,
|
||||
43,
|
||||
100,
|
||||
6,
|
||||
190,
|
||||
31,
|
||||
15,
|
||||
31,
|
||||
88,
|
||||
96,
|
||||
204
|
||||
],
|
||||
"viewing_public_key": [
|
||||
3,
|
||||
136,
|
||||
153,
|
||||
50,
|
||||
191,
|
||||
184,
|
||||
135,
|
||||
36,
|
||||
29,
|
||||
107,
|
||||
57,
|
||||
9,
|
||||
218,
|
||||
135,
|
||||
249,
|
||||
213,
|
||||
118,
|
||||
215,
|
||||
118,
|
||||
173,
|
||||
30,
|
||||
137,
|
||||
116,
|
||||
77,
|
||||
17,
|
||||
86,
|
||||
62,
|
||||
154,
|
||||
31,
|
||||
173,
|
||||
19,
|
||||
167,
|
||||
211
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"Private": {
|
||||
"account_id": "HUpbRQ1vEcZv5y6TDYv9tpt1VA64ji2v4RDLJfK2rpZn",
|
||||
"account": {
|
||||
"program_owner": [
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"balance": 20000,
|
||||
"data": [],
|
||||
"nonce": 0
|
||||
},
|
||||
"key_chain": {
|
||||
"secret_spending_key": [
|
||||
32,
|
||||
162,
|
||||
244,
|
||||
221,
|
||||
2,
|
||||
133,
|
||||
168,
|
||||
250,
|
||||
240,
|
||||
52,
|
||||
92,
|
||||
187,
|
||||
157,
|
||||
116,
|
||||
249,
|
||||
203,
|
||||
143,
|
||||
194,
|
||||
214,
|
||||
112,
|
||||
115,
|
||||
142,
|
||||
153,
|
||||
78,
|
||||
241,
|
||||
173,
|
||||
103,
|
||||
242,
|
||||
192,
|
||||
196,
|
||||
29,
|
||||
133
|
||||
],
|
||||
"private_key_holder": {
|
||||
"nullifier_secret_key": [
|
||||
188,
|
||||
235,
|
||||
121,
|
||||
54,
|
||||
131,
|
||||
206,
|
||||
7,
|
||||
215,
|
||||
94,
|
||||
231,
|
||||
102,
|
||||
22,
|
||||
12,
|
||||
27,
|
||||
253,
|
||||
161,
|
||||
248,
|
||||
206,
|
||||
41,
|
||||
160,
|
||||
206,
|
||||
149,
|
||||
5,
|
||||
217,
|
||||
127,
|
||||
235,
|
||||
154,
|
||||
230,
|
||||
198,
|
||||
232,
|
||||
102,
|
||||
31
|
||||
],
|
||||
"viewing_secret_key": [
|
||||
89,
|
||||
116,
|
||||
140,
|
||||
122,
|
||||
211,
|
||||
179,
|
||||
190,
|
||||
229,
|
||||
18,
|
||||
94,
|
||||
56,
|
||||
235,
|
||||
48,
|
||||
99,
|
||||
104,
|
||||
228,
|
||||
111,
|
||||
72,
|
||||
231,
|
||||
18,
|
||||
247,
|
||||
97,
|
||||
110,
|
||||
60,
|
||||
238,
|
||||
138,
|
||||
0,
|
||||
25,
|
||||
92,
|
||||
44,
|
||||
30,
|
||||
145
|
||||
]
|
||||
key_chain: KeyChain::new_mnemonic("default_private_account_1".to_owned()),
|
||||
})),
|
||||
InitialAccountData::Private(Box::new(InitialAccountDataPrivate {
|
||||
account_id: nssa::AccountId::from_str(
|
||||
"HUpbRQ1vEcZv5y6TDYv9tpt1VA64ji2v4RDLJfK2rpZn",
|
||||
)
|
||||
.unwrap(),
|
||||
account: nssa::Account {
|
||||
balance: 20_000,
|
||||
..Default::default()
|
||||
},
|
||||
"nullifier_public_key": [
|
||||
173,
|
||||
134,
|
||||
33,
|
||||
223,
|
||||
54,
|
||||
226,
|
||||
10,
|
||||
71,
|
||||
215,
|
||||
254,
|
||||
143,
|
||||
172,
|
||||
24,
|
||||
244,
|
||||
243,
|
||||
208,
|
||||
65,
|
||||
112,
|
||||
118,
|
||||
70,
|
||||
217,
|
||||
240,
|
||||
69,
|
||||
100,
|
||||
129,
|
||||
3,
|
||||
121,
|
||||
25,
|
||||
213,
|
||||
132,
|
||||
42,
|
||||
45
|
||||
],
|
||||
"viewing_public_key": [
|
||||
2,
|
||||
43,
|
||||
42,
|
||||
253,
|
||||
112,
|
||||
83,
|
||||
195,
|
||||
164,
|
||||
26,
|
||||
141,
|
||||
92,
|
||||
28,
|
||||
224,
|
||||
120,
|
||||
155,
|
||||
119,
|
||||
225,
|
||||
1,
|
||||
45,
|
||||
42,
|
||||
245,
|
||||
172,
|
||||
134,
|
||||
136,
|
||||
52,
|
||||
183,
|
||||
170,
|
||||
96,
|
||||
115,
|
||||
212,
|
||||
114,
|
||||
120,
|
||||
37
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
"#;
|
||||
serde_json::from_str(init_acc_json).unwrap()
|
||||
},
|
||||
key_chain: KeyChain::new_mnemonic("default_private_account_2".to_owned()),
|
||||
})),
|
||||
],
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -299,8 +299,7 @@ impl WalletCore {
|
||||
self.sequencer_client
|
||||
.get_proof_for_commitment(acc_comm)
|
||||
.await
|
||||
.map(Some)
|
||||
.map_err(anyhow::Error::from)
|
||||
.map_err(Into::into)
|
||||
} else {
|
||||
Ok(None)
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user