Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deps: bump near-workspaces-rs to 0.8 #855

Merged
merged 1 commit into from
Oct 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2,000 changes: 1,066 additions & 934 deletions Cargo.lock

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,15 @@ impl-serde = { version = "0.4", default-features = false}
lazy_static = "1"
libsecp256k1 = { version = "0.7", default-features = false }
near-crypto = "0.17"
near-gas = "0.2"
near-primitives = "0.17"
near-primitives-core = "0.17"
near-sdk = "4"
near-vm-errors = "0.17"
near-vm-logic = "0.17"
near-vm-runner = { version = "0.17", default-features = false, features = [ "wasmer2_vm", "wasmtime_vm" ] }
near-units = "0.2"
near-workspaces = "0.8"
num = { version = "0.4", default-features = false, features = ["alloc"] }
postgres = "0.19"
primitive-types = { version = "0.12", default-features = false, features = ["rlp", "serde_no_std"] }
Expand All @@ -70,7 +72,6 @@ tokio = { version = "1", default-features = false, features = ["macros"] }
test-case = "3.1"
walrus = "0.20"
wee_alloc = { version = "0.4", default-features = false }
workspaces = "0.7"

[workspace]
resolver = "2"
Expand Down
7 changes: 4 additions & 3 deletions engine-tests-connector/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,20 @@ publish.workspace = true
autobenches = false

[dev-dependencies]
aurora-engine = { workspace = true, features = ["std", "tracing", "impl-serde", "borsh-compat"] }
aurora-engine-types = { workspace = true, features = ["std", "impl-serde", "borsh-compat"] }
aurora-engine = { workspace = true, features = ["std", "tracing", "impl-serde"] }
aurora-engine-types = { workspace = true, features = ["std", "impl-serde"] }

anyhow.workspace = true
byte-slice-cast.workspace = true
near-gas.workspace = true
near-sdk.workspace = true
near-units.workspace = true
near-workspaces.workspace = true
tokio = { workspace = true, features = ["macros"] }
hex.workspace = true
ethabi.workspace = true
rlp.workspace = true
serde = { workspace = true, features = ["derive"] }
workspaces = "0.7.0"

[features]
mainnet-test = []
Expand Down
2 changes: 1 addition & 1 deletion engine-tests-connector/src/connector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ use aurora_engine_types::{
use byte_slice_cast::AsByteSlice;
use near_sdk::serde_json::json;
use near_sdk::{json_types::U128, serde, ONE_YOCTO};
use near_workspaces::AccountId;
use std::str::FromStr;
use workspaces::AccountId;

/// Bytes for a NEAR smart contract implementing `ft_on_transfer`
fn dummy_ft_receiver_bytes() -> Vec<u8> {
Expand Down
12 changes: 6 additions & 6 deletions engine-tests-connector/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ use aurora_engine_types::parameters::connector::WithdrawSerializeType;
use aurora_engine_types::types::{Address, Wei};
use near_sdk::serde_json::json;
use near_sdk::{json_types::U128, serde_json};
use near_workspaces::network::NetworkClient;
use near_workspaces::{result::ExecutionFinalResult, Account, AccountId, Contract, Worker};
use std::path::Path;
use workspaces::network::NetworkClient;
use workspaces::{result::ExecutionFinalResult, Account, AccountId, Contract, Worker};

pub const PROOF_DATA_NEAR: &str = r#"{"log_index":0,"log_entry_data":[248,251,148,9,109,233,194,184,165,184,194,44,238,50,137,177,1,246,150,13,104,229,30,248,66,160,209,66,67,156,39,142,37,218,217,165,7,102,241,83,208,227,210,215,191,43,209,111,194,120,28,75,212,148,178,177,90,157,160,0,0,0,0,0,0,0,0,0,0,0,0,121,24,63,219,216,14,45,138,234,26,202,162,246,123,251,138,54,212,10,141,184,160,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,96,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,54,144,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,144,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,18,101,116,104,95,114,101,99,105,112,105,101,110,116,46,114,111,111,116,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"receipt_index":0,"receipt_data":[249,2,6,1,130,107,17,185,1,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,0,0,0,0,0,0,0,0,0,0,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,248,253,248,251,148,9,109,233,194,184,165,184,194,44,238,50,137,177,1,246,150,13,104,229,30,248,66,160,209,66,67,156,39,142,37,218,217,165,7,102,241,83,208,227,210,215,191,43,209,111,194,120,28,75,212,148,178,177,90,157,160,0,0,0,0,0,0,0,0,0,0,0,0,121,24,63,219,216,14,45,138,234,26,202,162,246,123,251,138,54,212,10,141,184,160,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,96,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,54,144,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,144,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,18,101,116,104,95,114,101,99,105,112,105,101,110,116,46,114,111,111,116,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"header_data":[249,2,10,160,177,33,112,26,26,176,12,12,163,2,249,133,245,12,51,201,55,50,148,156,122,67,27,26,101,178,36,153,54,100,53,137,160,29,204,77,232,222,199,93,122,171,133,181,103,182,204,212,26,211,18,69,27,148,138,116,19,240,161,66,253,64,212,147,71,148,124,28,230,160,8,239,64,193,62,78,177,68,166,204,116,240,224,174,172,126,160,197,65,5,202,188,134,5,164,246,19,133,35,57,28,114,241,186,81,123,163,166,161,24,32,157,168,170,13,108,58,61,46,160,6,199,163,13,91,119,225,39,168,255,213,10,107,252,143,246,138,241,108,139,59,35,187,185,162,223,53,108,222,73,181,109,160,27,154,49,63,26,170,15,177,97,255,6,204,84,221,234,197,159,172,114,47,148,126,32,199,241,127,101,120,182,51,52,100,185,1,0,0,0,8,0,0,0,0,0,0,0,32,0,0,0,0,0,2,0,8,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,8,32,0,32,0,0,128,0,2,0,0,0,1,0,32,0,0,0,2,0,0,0,0,32,0,0,0,0,0,4,0,0,0,0,0,0,0,8,0,0,0,0,0,0,0,128,64,0,0,0,0,1,32,0,0,0,0,0,0,96,32,0,64,0,0,0,128,1,0,0,0,0,1,0,0,0,8,0,0,0,18,32,0,0,64,145,1,8,0,4,0,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,33,16,0,128,0,0,0,0,0,0,128,0,2,0,0,0,0,0,0,0,0,0,0,2,0,80,0,0,0,0,0,0,0,0,1,128,0,8,0,0,0,0,4,0,0,0,128,2,0,32,0,128,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,128,0,0,0,0,0,0,0,16,0,8,0,0,0,0,0,0,0,0,0,0,128,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,132,25,1,227,23,131,157,85,14,131,122,18,0,131,75,91,132,132,96,174,58,224,140,115,112,105,100,101,114,49,48,1,2,8,230,160,188,212,199,183,154,22,223,85,103,215,24,122,240,235,79,129,44,93,184,88,161,218,79,5,44,226,106,100,50,40,163,97,136,155,158,202,3,149,91,200,78],"proof":[[248,113,160,46,156,31,85,241,226,241,13,5,56,73,146,176,67,195,109,6,189,172,104,44,103,44,88,32,15,181,152,136,29,121,252,160,191,48,87,174,71,151,208,114,164,150,51,200,171,90,90,106,46,200,79,77,222,145,95,89,141,137,138,149,67,73,8,87,128,128,128,128,128,128,160,175,9,219,77,174,13,247,133,55,172,92,185,202,7,160,10,204,112,44,133,36,96,30,234,235,134,30,209,205,166,212,255,128,128,128,128,128,128,128,128],[249,2,13,48,185,2,9,249,2,6,1,130,107,17,185,1,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,0,0,0,0,0,0,0,0,0,0,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,248,253,248,251,148,9,109,233,194,184,165,184,194,44,238,50,137,177,1,246,150,13,104,229,30,248,66,160,209,66,67,156,39,142,37,218,217,165,7,102,241,83,208,227,210,215,191,43,209,111,194,120,28,75,212,148,178,177,90,157,160,0,0,0,0,0,0,0,0,0,0,0,0,121,24,63,219,216,14,45,138,234,26,202,162,246,123,251,138,54,212,10,141,184,160,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,96,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,54,144,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,144,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,18,101,116,104,95,114,101,99,105,112,105,101,110,116,46,114,111,111,116,0,0,0,0,0,0,0,0,0,0,0,0,0,0]]}"#;
pub const DEPOSITED_RECIPIENT: &str = "eth_recipient.root";
pub const DEPOSITED_RECIPIENT_NAME: &str = "eth_recipient";
pub const CUSTODIAN_ADDRESS: &str = "096DE9C2B8A5B8c22cEe3289B101f6960d68E51E";
pub const DEFAULT_GAS: u64 = 300_000_000_000_000;
pub const DEFAULT_GAS: near_gas::NearGas = near_gas::NearGas::from_tgas(300);
pub const DEPOSITED_AMOUNT: u128 = 800400;
pub const DEPOSITED_FEE: u128 = 400;
pub const RECIPIENT_ETH_ADDRESS: &str = "891b2749238b27ff58e951088e55b04de71dc374";
Expand All @@ -39,14 +39,14 @@ pub struct TestContract {

impl TestContract {
pub async fn deploy_aurora_contract() -> anyhow::Result<(Contract, Contract, Account)> {
use workspaces::{
use near_workspaces::{
types::{KeyType, SecretKey},
AccessKey,
};
let worker = workspaces::sandbox()
let worker = near_workspaces::sandbox()
.await
.map_err(|err| anyhow::anyhow!("Failed init sandbox: {:?}", err))?;
let testnet = workspaces::testnet()
let testnet = near_workspaces::testnet()
.await
.map_err(|err| anyhow::anyhow!("Failed init testnet: {:?}", err))?;
let registrar: AccountId = "registrar".parse()?;
Expand Down
3 changes: 2 additions & 1 deletion engine-tests/src/tests/erc20_connector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -761,6 +761,7 @@ pub mod workspace {
);
}

#[allow(clippy::future_not_send)]
async fn test_exit_to_near_eth_common() -> anyhow::Result<TestExitToNearEthContext> {
let aurora = deploy_engine().await;
let chain_id = aurora.get_chain_id().await?.result.as_u64();
Expand Down Expand Up @@ -807,7 +808,7 @@ pub mod workspace {
})
}

#[allow(clippy::cognitive_complexity)]
#[allow(clippy::future_not_send, clippy::cognitive_complexity)]
async fn test_exit_to_near_common() -> anyhow::Result<TestExitToNearContext> {
// 1. deploy Aurora
let aurora = deploy_engine().await;
Expand Down
1 change: 1 addition & 0 deletions engine-tests/src/tests/erc20_mirror.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ async fn test_mirroring_erc20_token() {
assert_eq!(nep_141_balance_of(&nep141, &ft_owner.id()).await, 1_000_000);
}

#[allow(clippy::future_not_send)]
async fn deploy_main_contract() -> EngineContract {
let code = get_main_contract_code().await.unwrap();
deploy_engine_with_code(code).await
Expand Down
2 changes: 2 additions & 0 deletions engine-tests/src/tests/sanity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1266,6 +1266,8 @@ mod workspace {
INITIAL_BALANCE.raw(),
);
}

#[allow(clippy::future_not_send)]
async fn initialize_engine() -> (EngineContract, utils::Signer, Address) {
let engine = utils::workspace::deploy_engine().await;
let signer = utils::Signer::random();
Expand Down
1 change: 1 addition & 0 deletions engine-tests/src/tests/silo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1004,6 +1004,7 @@ pub mod workspace {
}

/// Deploys the EVM, deploys nep141 contract, and calls `set_silo_params`
#[allow(clippy::future_not_send)]
async fn init_silo() -> SiloTestContext {
// Deploy Aurora Engine
let aurora = deploy_engine().await;
Expand Down
3 changes: 2 additions & 1 deletion engine-tests/src/tests/xcc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,7 @@ pub mod workspace {
check_fib_result(&output, usize::try_from(n).unwrap());
}

#[allow(clippy::too_many_lines)]
#[allow(clippy::too_many_lines, clippy::future_not_send)]
async fn test_xcc_precompile_common(is_scheduled: bool) {
let XccTestContext {
aurora,
Expand Down Expand Up @@ -753,6 +753,7 @@ pub mod workspace {

/// Deploys the EVM, sets xcc router code, deploys wnear contract, bridges wnear into EVM,
/// and calls `factory_set_wnear_address`
#[allow(clippy::future_not_send)]
async fn init_xcc() -> anyhow::Result<XccTestContext> {
let aurora = deploy_engine().await;
let chain_id = aurora.get_chain_id().await?.result.as_u64();
Expand Down
3 changes: 2 additions & 1 deletion engine-tests/src/utils/workspace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const STORAGE_AMOUNT: u128 = 50_000_000_000_000_000_000_000_000;
const AURORA_ETH_CONNECTOR: &str = "aurora_eth_connector";

/// Deploy Aurora smart contract WITHOUT init external eth-connector.
#[allow(clippy::future_not_send)]
pub async fn deploy_engine_with_code(code: Vec<u8>) -> EngineContract {
let chain_id = AuroraRunner::get_default_chain_id();
aurora_engine_workspace::EngineContractBuilder::new()
Expand All @@ -34,7 +35,7 @@ pub async fn deploy_engine_with_code(code: Vec<u8>) -> EngineContract {
.unwrap()
}

#[allow(clippy::let_and_return)]
#[allow(clippy::let_and_return, clippy::future_not_send)]
pub async fn deploy_engine() -> EngineContract {
let code = AuroraRunner::get_engine_code();
let contract = deploy_engine_with_code(code).await;
Expand Down
5 changes: 3 additions & 2 deletions engine-workspace/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@ publish.workspace = true
autobenches = false

[dependencies]
aurora-engine-types = { workspace = true, features = ["borsh-compat", "impl-serde", "std"] }
aurora-engine-types = { workspace = true, features = ["impl-serde", "std"] }
anyhow.workspace = true
near-gas.workspace = true
near-sdk.workspace = true
near-units.workspace = true
near-workspaces.workspace = true
serde.workspace = true
serde_json.workspace = true
workspaces.workspace = true
tokio = { workspace = true, features = [ "time" ] }

[dev-dependencies]
Expand Down
8 changes: 4 additions & 4 deletions engine-workspace/src/account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,23 @@ pub use near_units::parse_near;

#[derive(Debug, Clone)]
pub struct Account {
inner: workspaces::Account,
inner: near_workspaces::Account,
}

impl Account {
pub(crate) fn from_inner(inner: workspaces::Account) -> Self {
pub(crate) fn from_inner(inner: near_workspaces::Account) -> Self {
Self { inner }
}

pub fn call<F: AsRef<str>>(&self, contract_id: &AccountId, function: F) -> CallTransaction {
let contract_id = workspaces::AccountId::from_str(contract_id.as_ref()).unwrap();
let contract_id = near_workspaces::AccountId::from_str(contract_id.as_ref()).unwrap();
let transaction = self.inner.call(&contract_id, function.as_ref());

CallTransaction::new(transaction)
}

pub fn view<F: AsRef<str>>(&self, contract_id: &AccountId, function: F) -> ViewTransaction {
let contract_id = workspaces::AccountId::from_str(contract_id.as_ref()).unwrap();
let contract_id = near_workspaces::AccountId::from_str(contract_id.as_ref()).unwrap();
let transaction = self.inner.view(&contract_id, function.as_ref());

ViewTransaction::new(transaction)
Expand Down
8 changes: 4 additions & 4 deletions engine-workspace/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ use aurora_engine_types::parameters::xcc::FundXccArgs;
use aurora_engine_types::types::{Address, RawU256, WeiU256};
use aurora_engine_types::{H256, U256};
use near_sdk::json_types::U128;
use near_workspaces::types::SecretKey;
use serde_json::json;
use workspaces::types::SecretKey;

#[derive(Debug, Clone)]
pub struct EngineContract {
Expand All @@ -60,7 +60,7 @@ impl EngineContract {
}

pub fn create_account(&self, account_id: &AccountId, secret_key: SecretKey) -> Account {
let inner = workspaces::Account::from_secret_key(
let inner = near_workspaces::Account::from_secret_key(
account_id.as_ref().parse().unwrap(),
secret_key,
self.node.worker(),
Expand Down Expand Up @@ -497,11 +497,11 @@ impl EngineContract {

#[derive(Debug, Clone)]
pub struct RawContract {
inner: workspaces::Contract,
inner: near_workspaces::Contract,
}

impl RawContract {
pub fn from_contract(contract: workspaces::Contract) -> Self {
pub fn from_contract(contract: near_workspaces::Contract) -> Self {
Self { inner: contract }
}

Expand Down
4 changes: 2 additions & 2 deletions engine-workspace/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ pub mod result;
pub mod transaction;

pub mod types {
pub use workspaces::result::{ExecutionFinalResult, ExecutionOutcome};
pub use workspaces::types::{KeyType, SecretKey};
pub use near_workspaces::result::{ExecutionFinalResult, ExecutionOutcome};
pub use near_workspaces::types::{KeyType, SecretKey};
}

const AURORA_LOCAL_CHAIN_ID: u64 = 1313161556;
Expand Down
14 changes: 7 additions & 7 deletions engine-workspace/src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ macro_rules! impl_view_return {

impl<'a> std::future::IntoFuture for $name<'a> {
type Output = anyhow::Result<ViewResult<$return>>;
type IntoFuture = workspaces::rpc::BoxFuture<'a, Self::Output>;
type IntoFuture = near_workspaces::rpc::BoxFuture<'a, Self::Output>;

fn into_future(self) -> Self::IntoFuture {
Box::pin(async { ViewResult::$deserialize_fn(self.0.await?) }.into_future())
Expand All @@ -35,9 +35,9 @@ macro_rules! impl_view_return {
#[macro_export]
macro_rules! impl_call_return {
($(($name:ident => $return:ty, $fn_name:expr, $deserialize_fn:ident)),* $(,)?) => {
$(pub struct $name<'a>(CallTransaction<'a>);
impl<'a> $name<'a> {
pub(crate) fn call(contract: &'a RawContract) -> Self {
$(pub struct $name(CallTransaction);
impl $name {
pub(crate) fn call(contract: &RawContract) -> Self {
Self(contract.call(&$fn_name))
}
pub fn gas(mut self, gas: u64) -> Self {
Expand Down Expand Up @@ -70,9 +70,9 @@ macro_rules! impl_call_return {
})*
};
($(($name:ident, $fn_name:expr)),* $(,)?) => {
$(pub struct $name<'a>(CallTransaction<'a>);
impl<'a> $name<'a> {
pub(crate) fn call(contract: &'a RawContract) -> Self {
$(pub struct $name(CallTransaction);
impl $name {
pub(crate) fn call(contract: &RawContract) -> Self {
Self(contract.call(&$fn_name))
}
pub fn gas(mut self, gas: u64) -> Self {
Expand Down
22 changes: 11 additions & 11 deletions engine-workspace/src/node.rs
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
use aurora_engine_types::account_id::AccountId;
use near_workspaces::network::{NetworkClient, Sandbox};
use near_workspaces::types::{KeyType, SecretKey};
use near_workspaces::Worker;
use std::str::FromStr;
use std::time::Duration;
use tokio::time::Instant;
use workspaces::network::{NetworkClient, Sandbox};
use workspaces::types::{KeyType, SecretKey};
use workspaces::Worker;

use crate::account::Account;

#[derive(Debug, Clone)]
pub struct Node {
root: workspaces::Account,
root: near_workspaces::Account,
worker: Worker<Sandbox>,
}

impl Node {
pub async fn new(root: &str, root_balance: u128) -> anyhow::Result<Self> {
let worker = workspaces::sandbox().await?;
let worker = near_workspaces::sandbox().await?;
let root = Self::create_root_account(&worker, root, root_balance).await?;

Ok(Self { root, worker })
Expand All @@ -31,7 +31,7 @@ impl Node {
}

pub async fn get_balance(&self, account_id: &AccountId) -> anyhow::Result<u128> {
let account_id = workspaces::AccountId::from_str(account_id.as_ref())?;
let account_id = near_workspaces::AccountId::from_str(account_id.as_ref())?;

self.worker
.view_account(&account_id)
Expand All @@ -44,8 +44,8 @@ impl Node {
worker: &Worker<Sandbox>,
root_acc_name: &str,
balance: u128,
) -> anyhow::Result<workspaces::Account> {
use workspaces::AccessKey;
) -> anyhow::Result<near_workspaces::Account> {
use near_workspaces::AccessKey;

if root_acc_name == "test.near" {
return Ok(worker.root_account()?);
Expand All @@ -57,7 +57,7 @@ impl Node {
.transact()
.await?
} else {
let testnet = workspaces::testnet()
let testnet = near_workspaces::testnet()
.await
.map_err(|err| anyhow::anyhow!("Failed init testnet: {:?}", err))?;
let registrar = "registrar".parse()?;
Expand All @@ -81,13 +81,13 @@ impl Node {
.await?
.into_result()?;

Ok(workspaces::Account::from_secret_key(root, sk, worker))
Ok(near_workspaces::Account::from_secret_key(root, sk, worker))
}

/// Waiting for the account creation
async fn waiting_account_creation<T: NetworkClient + ?Sized>(
worker: &Worker<T>,
account_id: &workspaces::AccountId,
account_id: &near_workspaces::AccountId,
) -> anyhow::Result<()> {
let timer = Instant::now();
// Try to get account within 30 secs
Expand Down
Loading
Loading