-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add
sign_delete_key_secp256k1
example
- Loading branch information
dj8yf0μl
committed
Jan 25, 2024
1 parent
2217c2d
commit e269313
Showing
3 changed files
with
32 additions
and
0 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
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,22 @@ | ||
use near_crypto::SecretKey; | ||
use near_ledger::NEARLedgerError; | ||
|
||
#[path = "../common/lib.rs"] | ||
mod common; | ||
|
||
fn tx(ledger_pub_key: ed25519_dalek::PublicKey) -> near_primitives::transaction::Transaction { | ||
let mut tx = common::tx_template(ledger_pub_key.clone()); | ||
let sk = SecretKey::from_seed( | ||
near_crypto::KeyType::SECP256K1, | ||
&format!("{:?}", ledger_pub_key), | ||
); | ||
let public_key = sk.public_key(); | ||
tx.actions = vec![near_primitives::transaction::Action::DeleteKey( | ||
near_primitives::transaction::DeleteKeyAction { public_key }, | ||
)]; | ||
tx | ||
} | ||
|
||
fn main() -> Result<(), NEARLedgerError> { | ||
common::get_key_sign_and_verify_flow(tx) | ||
} |