forked from kaspanet/rusty-kaspa
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Custom input signatureScript ability (kaspanet#69)
* Refactorize some addresses and Script related parts * A ScriptBuilder example on TypeScript * addOps Opcodes are now BinaryT * Move txscript bindings to relevant folders * Sort lines of deps and imports * Lint * Prototype of custom sighash operations * Experimental * Add SighashType enum and option on SignInput * Format and a small fix * Clippy
- Loading branch information
Showing
5 changed files
with
87 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
use super::sighash_type::{self, SigHashType}; | ||
use wasm_bindgen::prelude::*; | ||
|
||
/// Kaspa Sighash types allowed by consensus | ||
/// @see {@link signInput} | ||
/// @category Consensus | ||
#[wasm_bindgen] | ||
pub enum SighashType { | ||
All, | ||
None, | ||
Single, | ||
AllAnyOneCanPay, | ||
NoneAnyOneCanPay, | ||
SingleAnyOneCanPay, | ||
} | ||
|
||
impl From<SighashType> for SigHashType { | ||
fn from(sighash_type: SighashType) -> SigHashType { | ||
match sighash_type { | ||
SighashType::All => sighash_type::SIG_HASH_ALL, | ||
SighashType::None => sighash_type::SIG_HASH_NONE, | ||
SighashType::Single => sighash_type::SIG_HASH_SINGLE, | ||
SighashType::AllAnyOneCanPay => sighash_type::SIG_HASH_ANY_ONE_CAN_PAY, | ||
SighashType::NoneAnyOneCanPay => SigHashType(sighash_type::SIG_HASH_NONE.0 | sighash_type::SIG_HASH_ANY_ONE_CAN_PAY.0), | ||
SighashType::SingleAnyOneCanPay => SigHashType(sighash_type::SIG_HASH_SINGLE.0 | sighash_type::SIG_HASH_ANY_ONE_CAN_PAY.0), | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters