mirror of
https://github.com/aljazceru/cdk.git
synced 2025-12-24 08:05:02 +01:00
Merge pull request #559 from thesimplekid/fix_multi_mint_token_check
fix: multi mint check
This commit is contained in:
@@ -32,6 +32,7 @@
|
||||
* `Wallet::receive_raw` which receives raw binary tokens ([lollerfirst]).
|
||||
|
||||
### Fixed
|
||||
* Multimint unit check when wallet receiving token ([thesimplekid])
|
||||
|
||||
### Removed
|
||||
|
||||
|
||||
@@ -272,6 +272,10 @@ impl TokenV3 {
|
||||
|
||||
mint_urls
|
||||
}
|
||||
|
||||
pub fn is_multi_mint(&self) -> bool {
|
||||
self.token.len() > 1
|
||||
}
|
||||
}
|
||||
|
||||
impl FromStr for TokenV3 {
|
||||
|
||||
@@ -190,20 +190,23 @@ impl Wallet {
|
||||
p2pk_signing_keys: &[SecretKey],
|
||||
preimages: &[String],
|
||||
) -> Result<Amount, Error> {
|
||||
let token_data = Token::from_str(encoded_token)?;
|
||||
let token = Token::from_str(encoded_token)?;
|
||||
|
||||
let unit = token_data.unit().unwrap_or_default();
|
||||
let unit = token.unit().unwrap_or_default();
|
||||
|
||||
if unit != self.unit {
|
||||
return Err(Error::UnitUnsupported);
|
||||
}
|
||||
|
||||
let proofs = token_data.proofs();
|
||||
if proofs.len() != 1 {
|
||||
return Err(Error::MultiMintTokenNotSupported);
|
||||
let proofs = token.proofs();
|
||||
|
||||
if let Token::TokenV3(token) = &token {
|
||||
if token.is_multi_mint() {
|
||||
return Err(Error::MultiMintTokenNotSupported);
|
||||
}
|
||||
}
|
||||
|
||||
if self.mint_url != token_data.mint_url()? {
|
||||
if self.mint_url != token.mint_url()? {
|
||||
return Err(Error::IncorrectMint);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user