Hello, I am trying to buld simple smart contract, however I am having the error no matching package named parity-secp256k1
found. I have tried all the ways.
[package]
name = "new-near-project"
version = "0.1.0"
edition = "2021"
[dependencies]
near-sdk = "5.1.0"
near-sdk-macros = "5.1.0"
#parity-secp256k1 = "0.7.0"
#[dependencies.parity-secp256k1]
#path = "vendor/parity-secp256k1"
secp256k1 = "0.29.0"
[dependencies.near-crypto]
version = "0.23.0"
features = []
near-sdk-sim = "4.0.0-pre.9"
[lib]
crate-type = ["cdylib", "rlib"]
I have also tried to download and use from local path as mention. but I get following error all the time.
(base) imran@192 new-near-project % cargo build --verbose
warning: /Users/imran/CLionProjects/RustProjects/ImranSmartContract/new-near-project/Cargo.toml: unused manifest key: dependencies.near-crypto.near-sdk-sim
Updating crates.io index
error: no matching package named `parity-secp256k1` found
location searched: registry `crates-io`
required by package `near-crypto v0.1.0`
... which satisfies dependency `near-crypto = "=0.1.0"` of package `near-sdk-sim v3.1.0`
... which satisfies dependency `near-sdk-sim = "^3.1.0"` of package `ImranSmartContract v0.1.0 (/Users/imran/CLionProjects/RustProjects/ImranSmartContract)`
(base) imran@192 new-near-project %
The code is
// src/lib.rs
use near_sdk::borsh::{self, BorshDeserialize, BorshSerialize};
use near_sdk::collections::LookupMap;
use near_sdk::{env, near_bindgen};
#[near_bindgen]
#[derive(BorshDeserialize, BorshSerialize)]
pub struct SimpleContract {
messages: LookupMap<String, String>,
}
impl Default for SimpleContract {
fn default() -> Self {
Self {
messages: LookupMap::new(b"m"),
}
}
}
#[near_bindgen]
impl SimpleContract {
pub fn set_message(&mut self, message: String) {
let account_id = env::signer_account_id();
self.messages.insert(&account_id, &message);
}
pub fn get_message(&self, account_id: String) -> Option<String> {
self.messages.get(&account_id)
}
}