-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: initial implementation of NEP-413 support * nep413 tested and works * removed redundant doc line * added example for nep413 * doctest * renamed method * added test suite without callback * review
- Loading branch information
Showing
7 changed files
with
296 additions
and
172 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
use near_api::*; | ||
|
||
use openssl::rand::rand_bytes; | ||
|
||
#[tokio::main] | ||
async fn main() { | ||
let signer = Signer::from_seed_phrase( | ||
"fatal edge jacket cash hard pass gallery fabric whisper size rain biology", | ||
None, | ||
) | ||
.unwrap(); | ||
|
||
let mut nonce = [0u8; 32]; | ||
rand_bytes(&mut nonce).unwrap(); | ||
|
||
let payload = near_api::signer::NEP413Payload { | ||
message: "Hello NEAR!".to_string(), | ||
nonce, | ||
recipient: "example.near".to_string(), | ||
callback_url: None, | ||
}; | ||
|
||
let signature = signer | ||
.sign_message_nep413( | ||
"round-toad.testnet".parse().unwrap(), | ||
signer.get_public_key().unwrap(), | ||
payload, | ||
) | ||
.await | ||
.unwrap(); | ||
|
||
println!("Signature: {}", signature); | ||
} |
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 was deleted.
Oops, something went wrong.
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
Oops, something went wrong.