Skip to content

Commit 80e2760

Browse files
authored
fix: update near-workspaces to 0.11.0 (#7)
## Summary `cargo test` failed in near-workspace version 0.7.0. Upgrading it to 0.11.0 and necessary changes to make it work. ## Detail Upgrade near-workspaces from 0.7.0 to 0.11.0 for Darwin arm64 support Convert u128 deposit values to NearToken::from_yoctonear() in tests Add NearToken import to integration_test.rs ## Testing `cargo test` runs test now ## Documentation --- **Requested Reviewers:** @mention
1 parent 6d07903 commit 80e2760

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@ near-sdk-contract-tools = "=1.1.1"
1111
near-sdk = "4.1.1"
1212
near-sys = "0.2.0"
1313
serde = "1.0.144"
14+
near-sandbox = "0.2.0"
1415

1516
[dev-dependencies]
16-
near-workspaces = "=0.7.0"
17+
near-workspaces = "0.11.0"
1718
tokio = "1.21.1"
1819

1920
[lib]

tests/integration_test.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use near_sdk::{
2121
AccountId,
2222
};
2323
use near_sdk_contract_tools::standard::nep148::FungibleTokenMetadata;
24-
use near_workspaces::{Account, Contract};
24+
use near_workspaces::{types::NearToken, Account, Contract};
2525

2626
const FIAT_TOKEN_WASM: &[u8] = include_bytes!("./data/fiat_token.wasm");
2727
// Upgraded version of the contract that changes the multi-sig request's validity period to 1 ns.
@@ -465,7 +465,7 @@ async fn test_approve_increase_decrease_allowance_transfer_from() {
465465
transfer_receiver
466466
.call(contract.id(), "storage_deposit")
467467
.args_json(json!({ "account_id": transfer_receiver.id() }))
468-
.deposit(ACCOUNT_STORAGE_COST)
468+
.deposit(NearToken::from_yoctonear(ACCOUNT_STORAGE_COST))
469469
.transact()
470470
.await
471471
.unwrap()
@@ -543,7 +543,7 @@ async fn test_approve_twice_transfer_from() {
543543
transfer_receiver
544544
.call(contract.id(), "storage_deposit")
545545
.args_json(json!({ "account_id": transfer_receiver.id() }))
546-
.deposit(ACCOUNT_STORAGE_COST)
546+
.deposit(NearToken::from_yoctonear(ACCOUNT_STORAGE_COST))
547547
.transact()
548548
.await
549549
.unwrap()
@@ -1092,7 +1092,7 @@ async fn test_ft_transfer() {
10921092
"receiver_id": transfer_receiver.id(),
10931093
"amount": U128::from(transfer_amount),
10941094
}))
1095-
.deposit(1)
1095+
.deposit(NearToken::from_yoctonear(1))
10961096
.transact()
10971097
.await
10981098
.unwrap();
@@ -1102,7 +1102,7 @@ async fn test_ft_transfer() {
11021102
transfer_receiver
11031103
.call(contract.id(), "storage_deposit")
11041104
.args_json(json!({ "account_id": transfer_receiver.id(), "registration_only": false}))
1105-
.deposit(ACCOUNT_STORAGE_COST)
1105+
.deposit(NearToken::from_yoctonear(ACCOUNT_STORAGE_COST))
11061106
.transact()
11071107
.await
11081108
.unwrap()
@@ -1127,7 +1127,7 @@ async fn test_ft_transfer() {
11271127
"receiver_id": transfer_receiver.id(),
11281128
"amount": U128::from(transfer_amount),
11291129
}))
1130-
.deposit(1)
1130+
.deposit(NearToken::from_yoctonear(1))
11311131
.transact()
11321132
.await
11331133
.unwrap();
@@ -1549,7 +1549,7 @@ async fn mint(contract: Contract, minter: Account, to: Account, mint_amount: u12
15491549
// Register to/receiver with token to be able to receive mints.
15501550
to.call(contract.id(), "storage_deposit")
15511551
.args_json(json!({ "account_id": to.id() }))
1552-
.deposit(ACCOUNT_STORAGE_COST)
1552+
.deposit(NearToken::from_yoctonear(ACCOUNT_STORAGE_COST))
15531553
.transact()
15541554
.await
15551555
.unwrap()

0 commit comments

Comments
 (0)