Skip to content

Commit

Permalink
test-wallet: Adapt to new wallet-core
Browse files Browse the repository at this point in the history
Co-authored-by: Daksh <[email protected]>

Fix merge conflicts
  • Loading branch information
Daksh14 committed Sep 10, 2024
1 parent 208d911 commit ce2a43d
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 5 deletions.
5 changes: 2 additions & 3 deletions rusk-wallet/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,8 @@ use execution_core::{
signatures::bls::PublicKey as AccountPublicKey,
stake::StakeData,
transfer::phoenix::{
ArchivedNoteLeaf, Note, NoteLeaf, NoteOpening,
PublicKey as PhoenixPublicKey, SecretKey as PhoenixSecretKey,
ViewKey as PhoenixViewKey,
ArchivedNoteLeaf, Note, NoteOpening, PublicKey as PhoenixPublicKey,
SecretKey as PhoenixSecretKey, ViewKey as PhoenixViewKey,
},
BlsScalar,
};
Expand Down
4 changes: 2 additions & 2 deletions rusk-wallet/src/wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ use wallet_core::{

use execution_core::{
signatures::bls::{PublicKey as BlsPublicKey, SecretKey as BlsSecretKey},
transfer::{data::TransactionData, Transaction},
transfer::{data::ContractCall, data::TransactionData, Transaction},
};

use zeroize::Zeroize;
Expand Down Expand Up @@ -539,7 +539,7 @@ impl<F: SecureWalletFile + Debug> Wallet<F> {
gas.limit,
gas.price,
chain_id,
data,
Some(data),
&Prover,
)?;

Expand Down
22 changes: 22 additions & 0 deletions wallet-core/src/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -544,3 +544,25 @@ fn withdraw_to_moonlight<R: RngCore + CryptoRng>(
gas_payment_token,
)
}

/// Create a [`Withdraw`] struct to be used to withdraw funds from a contract
/// into a Moonlight account.
///
/// The gas payment can be done by either Phoenix or Moonlight by setting the
/// `gas_payment_token` accordingly.
fn withdraw_to_moonlight<R: RngCore + CryptoRng>(
rng: &mut R,
receiver_sk: &BlsSecretKey,
contract: impl Into<ContractId>,
gas_payment_token: WithdrawReplayToken,
value: u64,
) -> Withdraw {
Withdraw::new(
rng,
receiver_sk,
contract.into(),
value,
WithdrawReceiver::Moonlight(BlsPublicKey::from(receiver_sk)),
gas_payment_token,
)
}

0 comments on commit ce2a43d

Please sign in to comment.