Skip to content

Commit

Permalink
chore!: updated neard to 2.0.0 (#88)
Browse files Browse the repository at this point in the history
  • Loading branch information
akorchyn authored Aug 15, 2024
1 parent 681603f commit c25915f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
12 changes: 7 additions & 5 deletions crate/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,16 @@ pub mod sync;

// The current version of the sandbox node we want to point to.
// Should be updated to the latest release of nearcore.
// Currently pointing to nearcore@v1.40.0 released on June 17, 2024
pub const DEFAULT_NEAR_SANDBOX_VERSION: &str = "1.40.0/7dd0b5993577f592be15eb102e5a3da37be66271";
// Currently pointing to nearcore@v2.0.0 released on August 5, 2024
pub const DEFAULT_NEAR_SANDBOX_VERSION: &str = "2.0.0";

const fn platform() -> Option<&'static str> {
#[cfg(all(target_os = "linux", target_arch = "x86_64"))]
return Some("Linux-x86_64");

// Darwin-x86_64 is not supported for some time now.
#[cfg(all(target_os = "macos", target_arch = "x86_64"))]
return Some("Darwin-x86_64");
return None;

#[cfg(all(target_os = "macos", target_arch = "aarch64"))]
return Some("Darwin-arm64");
Expand Down Expand Up @@ -95,8 +96,9 @@ pub fn install_with_version(version: &str) -> anyhow::Result<PathBuf> {
// Download binary into temp dir
let bin_name = format!("near-sandbox-{}", normalize_name(version));
let dl_cache = Cache::at(&download_path(version));
let bin_path = bin_url(version)
.ok_or_else(|| anyhow!("Unsupported platform: only linux-x86 and macos are supported"))?;
let bin_path = bin_url(version).ok_or_else(|| {
anyhow!("Unsupported platform: only linux-x86 and darwin-arm are supported")
})?;
let dl = dl_cache
.download(true, &bin_name, &["near-sandbox"], &bin_path)
.map_err(anyhow::Error::msg)
Expand Down
5 changes: 5 additions & 0 deletions npm/.changeset/slimy-tables-matter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"near-sandbox": patch
---

Updated sandbox to 2.0.0 release. Removed ability to fetch darwin-x86_64 as it is not working for quite some time"
5 changes: 3 additions & 2 deletions npm/src/getBinary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ function getPlatform() {
const type = os.type();
const arch = os.arch();

if ((type === "Linux" || type === "Darwin") && arch === "x64") {
// Darwind x86_64 is not supported for quite some time :(
if (type === "Linux" && arch === "x64") {
return [type, "x86_64"];
} else if (type === "Darwin" && arch === "arm64") {
return [type, "arm64"];
Expand All @@ -17,7 +18,7 @@ function getPlatform() {

export function AWSUrl(): string {
const [platform, arch] = getPlatform();
return `https://s3-us-west-1.amazonaws.com/build.nearprotocol.com/nearcore/${platform}-${arch}/1.40.0/7dd0b5993577f592be15eb102e5a3da37be66271/near-sandbox.tar.gz`;
return `https://s3-us-west-1.amazonaws.com/build.nearprotocol.com/nearcore/${platform}-${arch}/2.0.0/sandbox.tar.gz`;
}

export function getBinary(name: string = "near-sandbox"): Promise<Binary> {
Expand Down

0 comments on commit c25915f

Please sign in to comment.