create-near-app 7.0.0 → 7.0.1
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/README.md
CHANGED
|
@@ -9,7 +9,7 @@ Quickly build apps backed by the [NEAR](https://near.org) blockchain
|
|
|
9
9
|
|
|
10
10
|
Make sure you have a [current version of Node.js](https://nodejs.org) installed – we are targeting versions `16+` for JS contracts and `18+` for frontend/gateways.
|
|
11
11
|
|
|
12
|
-
Read about other [prerequisites](https://docs.near.org/
|
|
12
|
+
Read about other [prerequisites](https://docs.near.org/build/smart-contracts/quickstart#prerequisites) in our docs.
|
|
13
13
|
|
|
14
14
|
## Getting Started
|
|
15
15
|
|
|
@@ -26,7 +26,7 @@ You can create contracts written in:
|
|
|
26
26
|
- `Rust`
|
|
27
27
|
|
|
28
28
|
:::
|
|
29
|
-
We strongly recommend you to follow our [smart contract quickstart](https://docs.near.org/
|
|
29
|
+
We strongly recommend you to follow our [smart contract quickstart](https://docs.near.org/build/smart-contracts/quickstart) if you are new to NEAR contracts.
|
|
30
30
|
:::
|
|
31
31
|
|
|
32
32
|
For testing we use a sandboxed environment. You can write the tests in JavaScript or Rust.
|
|
@@ -40,7 +40,7 @@ You can create a web application in:
|
|
|
40
40
|
|
|
41
41
|
|
|
42
42
|
:::
|
|
43
|
-
We strongly recommend you to follow our [web app quickstart](https://docs.near.org/build/
|
|
43
|
+
We strongly recommend you to follow our [web app quickstart](https://docs.near.org/build/web3-apps/quickstart) if you are new to NEAR WebApps.
|
|
44
44
|
:::
|
|
45
45
|
|
|
46
46
|
> Consider using `pnpm` to handle the frontend, since it is much faster than `npm` and `yarn`.
|
package/package.json
CHANGED
|
@@ -8,16 +8,14 @@
|
|
|
8
8
|
"test": "$npm_execpath run build && ava -- ./build/hello_near.wasm"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"near-cli": "^4.0.8",
|
|
12
11
|
"near-sdk-js": "1.0.0"
|
|
13
12
|
},
|
|
14
13
|
"devDependencies": {
|
|
15
|
-
"
|
|
16
|
-
"ava": "^6.1.2",
|
|
14
|
+
"ava": "^6.1.3",
|
|
17
15
|
"near-workspaces": "^3.5.0",
|
|
18
|
-
"
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
"
|
|
16
|
+
"typescript": "^5.4.5"
|
|
17
|
+
},
|
|
18
|
+
"ava": {
|
|
19
|
+
"files": ["sandbox-test/*.ava.js"]
|
|
22
20
|
}
|
|
23
21
|
}
|
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import anyTest from 'ava';
|
|
2
|
+
import { Worker } from 'near-workspaces';
|
|
3
3
|
import { setDefaultResultOrder } from 'dns'; setDefaultResultOrder('ipv4first'); // temp fix for node >v17
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
/**
|
|
6
|
+
* @typedef {import('near-workspaces').NearAccount} NearAccount
|
|
7
|
+
* @type {import('ava').TestFn<{worker: Worker, accounts: Record<string, NearAccount>}>}
|
|
8
|
+
*/
|
|
9
|
+
const test = anyTest;
|
|
7
10
|
|
|
8
|
-
test.beforeEach(async
|
|
9
|
-
// Create sandbox
|
|
11
|
+
test.beforeEach(async t => {
|
|
12
|
+
// Create sandbox
|
|
10
13
|
const worker = t.context.worker = await Worker.init();
|
|
11
14
|
|
|
12
15
|
// Deploy contract
|
|
@@ -23,7 +26,6 @@ test.beforeEach(async (t) => {
|
|
|
23
26
|
});
|
|
24
27
|
|
|
25
28
|
test.afterEach.always(async (t) => {
|
|
26
|
-
// Stop Sandbox server
|
|
27
29
|
await t.context.worker.tearDown().catch((error) => {
|
|
28
30
|
console.log('Failed to stop the Sandbox:', error);
|
|
29
31
|
});
|
|
@@ -31,13 +33,13 @@ test.afterEach.always(async (t) => {
|
|
|
31
33
|
|
|
32
34
|
test('returns the default greeting', async (t) => {
|
|
33
35
|
const { contract } = t.context.accounts;
|
|
34
|
-
const greeting
|
|
36
|
+
const greeting = await contract.view('get_greeting', {});
|
|
35
37
|
t.is(greeting, 'Hello');
|
|
36
38
|
});
|
|
37
39
|
|
|
38
40
|
test('changes the greeting', async (t) => {
|
|
39
41
|
const { root, contract } = t.context.accounts;
|
|
40
42
|
await root.call(contract, 'set_greeting', { greeting: 'Howdy' });
|
|
41
|
-
const greeting
|
|
43
|
+
const greeting = await contract.view('get_greeting', {});
|
|
42
44
|
t.is(greeting, 'Howdy');
|
|
43
45
|
});
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
require('util').inspect.defaultOptions.depth = 5; // Increase AVA's printing depth
|
|
2
|
-
|
|
3
|
-
module.exports = {
|
|
4
|
-
timeout: '10000',
|
|
5
|
-
files: ['sandbox-ts/*.ava.ts'],
|
|
6
|
-
failWithoutAssertions: false,
|
|
7
|
-
extensions: {
|
|
8
|
-
js: true,
|
|
9
|
-
ts: 'module'
|
|
10
|
-
},
|
|
11
|
-
require: ['ts-node/register', 'near-workspaces'],
|
|
12
|
-
"nodeArguments": [
|
|
13
|
-
"--import=tsimp"
|
|
14
|
-
]
|
|
15
|
-
};
|