create-near-app 4.0.0-beta.1.0 → 4.0.0
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 +30 -24
- package/dist/app.js +35 -66
- package/dist/make.js +44 -38
- package/dist/messages.js +47 -24
- package/dist/package-json.js +81 -49
- package/dist/tracking.js +1 -1
- package/dist/types.js +4 -0
- package/dist/user-input.js +124 -42
- package/package.json +32 -35
- package/templates/contracts/assemblyscript/README.md +4 -4
- package/templates/contracts/assemblyscript/package.json +2 -2
- package/templates/contracts/js/README.md +23 -0
- package/templates/contracts/js/package.json +5 -5
- package/templates/contracts/js/src/contract.ts +8 -6
- package/templates/contracts/rust/README.md +3 -3
- package/templates/frontend/react/frontend/App.js +5 -2
- package/templates/frontend/react/frontend/assets/global.css +62 -4
- package/templates/frontend/react/frontend/package.json +16 -16
- package/templates/frontend/react/frontend/ui-components.js +1 -1
- package/templates/frontend/vanilla/frontend/assets/global.css +64 -4
- package/templates/frontend/vanilla/frontend/index.html +8 -5
- package/templates/frontend/vanilla/frontend/package.json +5 -5
- package/templates/integration-tests/overrides/js-contract/js-tests/src/main.ava.ts +46 -0
- package/templates/integration-tests/overrides/js-contract/rust-tests/src/tests.rs +74 -0
- package/templates/integration-tests/{classic-tests → shared/js-tests}/ava.config.cjs +0 -0
- package/templates/integration-tests/{classic-tests → shared/js-tests}/package.json +6 -6
- package/templates/integration-tests/{workspaces-tests/ts → shared/js-tests}/src/main.ava.ts +0 -1
- package/templates/integration-tests/{workspaces-tests/rs → shared/rust-tests}/Cargo.toml +1 -1
- package/templates/integration-tests/{workspaces-tests/rs → shared/rust-tests}/src/tests.rs +2 -2
- package/templates/shared/.gitpod.yml +2 -2
- package/templates/shared/README.md +10 -10
- package/dist/checks.js +0 -34
- package/templates/contracts/assemblyscript/yarn.lock +0 -2952
- package/templates/contracts/js/yarn.lock +0 -2534
- package/templates/frontend/react/frontend/yarn.lock +0 -4550
- package/templates/frontend/vanilla/frontend/yarn.lock +0 -2328
- package/templates/integration-tests/classic-tests/src/config.ts +0 -34
- package/templates/integration-tests/classic-tests/src/main.ava.ts +0 -32
- package/templates/integration-tests/classic-tests/yarn.lock +0 -1323
- package/templates/integration-tests/workspaces-tests/ts/ava.config.cjs +0 -9
- package/templates/integration-tests/workspaces-tests/ts/package.json +0 -17
- package/templates/integration-tests/workspaces-tests/ts/yarn.lock +0 -1653
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import {KeyPair, keyStores} from 'near-api-js';
|
|
2
|
-
|
|
3
|
-
const fs = require('fs');
|
|
4
|
-
const path = require('path');
|
|
5
|
-
|
|
6
|
-
// first make sure you deployed your contract with dev-deploy, see ../package.json deploy script
|
|
7
|
-
// here we take the contract from the auto-generated neardev folder
|
|
8
|
-
const CONTRACT_NAME = fs.readFileSync(path.resolve(__dirname, '../../contract/neardev/dev-account'), 'utf-8');
|
|
9
|
-
const NETWORK_ID = 'testnet';
|
|
10
|
-
|
|
11
|
-
// Create an InMemoryKeyStore
|
|
12
|
-
const keyStore = new keyStores.InMemoryKeyStore();
|
|
13
|
-
|
|
14
|
-
// Load credentials
|
|
15
|
-
const credPath = `${process.env.HOME}/.near-credentials/${NETWORK_ID}/${CONTRACT_NAME}.json`;
|
|
16
|
-
let credentials = JSON.parse(fs.readFileSync(credPath));
|
|
17
|
-
|
|
18
|
-
// Save key in the key store
|
|
19
|
-
keyStore.setKey(
|
|
20
|
-
NETWORK_ID,
|
|
21
|
-
CONTRACT_NAME,
|
|
22
|
-
KeyPair.fromString(credentials.private_key)
|
|
23
|
-
);
|
|
24
|
-
|
|
25
|
-
export const nearConfig = {
|
|
26
|
-
networkId: NETWORK_ID,
|
|
27
|
-
nodeUrl: 'https://rpc.testnet.near.org',
|
|
28
|
-
contractName: CONTRACT_NAME,
|
|
29
|
-
walletUrl: 'https://wallet.testnet.near.org',
|
|
30
|
-
helperUrl: 'https://helper.testnet.near.org',
|
|
31
|
-
explorerUrl: 'https://explorer.testnet.near.org',
|
|
32
|
-
headers: {},
|
|
33
|
-
deps: {keyStore}
|
|
34
|
-
};
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import anyTest, { TestFn } from 'ava';
|
|
2
|
-
|
|
3
|
-
import { Near, Account, Contract } from 'near-api-js';
|
|
4
|
-
import { nearConfig } from './config';
|
|
5
|
-
|
|
6
|
-
const test = anyTest as TestFn<{
|
|
7
|
-
accounts: Record<string, any>;
|
|
8
|
-
}>;
|
|
9
|
-
|
|
10
|
-
test.beforeEach(async (t) => {
|
|
11
|
-
const near = await new Near(nearConfig);
|
|
12
|
-
const user = await new Account(near.connection, nearConfig.contractName);
|
|
13
|
-
const contract = await new Contract(
|
|
14
|
-
user,
|
|
15
|
-
nearConfig.contractName,
|
|
16
|
-
{ viewMethods: ['get_greeting'], changeMethods: ['set_greeting'] }
|
|
17
|
-
);
|
|
18
|
-
t.context.accounts = { contract };
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
test('returns the default greeting', async (t) => {
|
|
22
|
-
const { contract } = t.context.accounts;
|
|
23
|
-
const message: string = await contract.get_greeting({});
|
|
24
|
-
t.is(message, 'Hello');
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
test('changes the message', async (t) => {
|
|
28
|
-
const { contract } = t.context.accounts;
|
|
29
|
-
await contract.set_greeting({args:{ message: 'Howdy' }});
|
|
30
|
-
const message: string = await contract.get_greeting({});
|
|
31
|
-
t.is(message, 'Howdy');
|
|
32
|
-
});
|