create-near-app 5.1.1 → 5.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -23,7 +23,7 @@ test.beforeEach(async (t) => {
|
|
|
23
23
|
t.context.accounts = { root, contract };
|
|
24
24
|
});
|
|
25
25
|
|
|
26
|
-
test.afterEach(async (t) => {
|
|
26
|
+
test.afterEach.always(async (t) => {
|
|
27
27
|
// Stop Sandbox server
|
|
28
28
|
await t.context.worker.tearDown().catch((error) => {
|
|
29
29
|
console.log('Failed to stop the Sandbox:', error);
|
|
@@ -14,7 +14,7 @@ serde_json = { version = "1.0", features = ["arbitrary_precision"] }
|
|
|
14
14
|
tokio = { version = "1.18.1", features = ["full"] }
|
|
15
15
|
tracing = "0.1"
|
|
16
16
|
tracing-subscriber = { version = "0.3.11", features = ["env-filter"] }
|
|
17
|
-
workspaces = "0.
|
|
17
|
+
workspaces = "0.6.0"
|
|
18
18
|
pkg-config = "0.3.1"
|
|
19
19
|
|
|
20
20
|
[[example]]
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
use std::{env, fs};
|
|
2
2
|
use near_units::parse_near;
|
|
3
3
|
use serde_json::json;
|
|
4
|
-
use workspaces::
|
|
5
|
-
use workspaces::{network::Sandbox, Account, Contract, Worker};
|
|
4
|
+
use workspaces::{Account, Contract};
|
|
6
5
|
|
|
7
6
|
#[tokio::main]
|
|
8
7
|
async fn main() -> anyhow::Result<()> {
|
|
@@ -16,26 +15,25 @@ async fn main() -> anyhow::Result<()> {
|
|
|
16
15
|
// create accounts
|
|
17
16
|
let account = worker.dev_create_account().await?;
|
|
18
17
|
let alice = account
|
|
19
|
-
.create_subaccount(
|
|
18
|
+
.create_subaccount( "alice")
|
|
20
19
|
.initial_balance(parse_near!("30 N"))
|
|
21
20
|
.transact()
|
|
22
21
|
.await?
|
|
23
22
|
.into_result()?;
|
|
24
23
|
|
|
25
24
|
// begin tests
|
|
26
|
-
test_default_message(&alice, &contract
|
|
27
|
-
test_changes_message(&alice, &contract
|
|
25
|
+
test_default_message(&alice, &contract).await?;
|
|
26
|
+
test_changes_message(&alice, &contract).await?;
|
|
28
27
|
Ok(())
|
|
29
28
|
}
|
|
30
29
|
|
|
31
30
|
async fn test_default_message(
|
|
32
31
|
user: &Account,
|
|
33
32
|
contract: &Contract,
|
|
34
|
-
worker: &Worker<Sandbox>,
|
|
35
33
|
) -> anyhow::Result<()> {
|
|
36
34
|
let message: String = user
|
|
37
|
-
.call(
|
|
38
|
-
.args_json(json!({}))
|
|
35
|
+
.call( contract.id(), "get_greeting")
|
|
36
|
+
.args_json(json!({}))
|
|
39
37
|
.transact()
|
|
40
38
|
.await?
|
|
41
39
|
.json()?;
|
|
@@ -48,16 +46,16 @@ async fn test_default_message(
|
|
|
48
46
|
async fn test_changes_message(
|
|
49
47
|
user: &Account,
|
|
50
48
|
contract: &Contract,
|
|
51
|
-
worker: &Worker<Sandbox>,
|
|
52
49
|
) -> anyhow::Result<()> {
|
|
53
|
-
user.call(
|
|
54
|
-
.args_json(json!({"message": "Howdy"}))
|
|
50
|
+
user.call(contract.id(), "set_greeting")
|
|
51
|
+
.args_json(json!({"message": "Howdy"}))
|
|
55
52
|
.transact()
|
|
56
|
-
.await
|
|
53
|
+
.await?
|
|
54
|
+
.into_result()?;
|
|
57
55
|
|
|
58
56
|
let message: String = user
|
|
59
|
-
.call(
|
|
60
|
-
.args_json(json!({}))
|
|
57
|
+
.call(contract.id(), "get_greeting")
|
|
58
|
+
.args_json(json!({}))
|
|
61
59
|
.transact()
|
|
62
60
|
.await?
|
|
63
61
|
.json()?;
|