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

fix(docs,cli): fixup some docs and client settings #2498

Merged
merged 1 commit into from
Jun 28, 2021
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
4 changes: 2 additions & 2 deletions packages/neo-one-cli-common-node/src/networks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ export const defaultNetworks = {
userAccountProvider: createUserAccountProviderFunc('main', commonRpcURL.main),
},
test: {
userAccountProvider: createUserAccountProviderFunc('test', commonRpcURL.test),
userAccountProvider: createUserAccountProviderFunc('test', commonRpcURL.staging),
},
local: {
userAccountProvider: createUserAccountProviderFunc('neo-one', 'localhost:9040'), // TODO: should this end with /rpc ? abstrac this if not
userAccountProvider: createUserAccountProviderFunc('neo-one', 'localhost:9040/rpc'),
},
};
1 change: 1 addition & 0 deletions packages/neo-one-cli-common/src/rpcURL.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export const rpcURL = {
staging: 'https://staging.neotracker.io/rpc',
test: 'https://testnet.neotracker.io/rpc',
main: 'https://neotracker.io/rpc',
};
44 changes: 22 additions & 22 deletions packages/neo-one-cli/src/__e2e__/cmd/compile.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ import path from 'path';

interface CLICompileOptions {
readonly json: boolean;
readonly avm: boolean;
readonly nef: boolean;
readonly debug: boolean;
readonly opcodes: boolean;
}

// this is just a helper to replicate the coercing we do for the CLI command
const createOptions = (options: Partial<CLICompileOptions> = {}): CLICompileOptions => ({
avm: options.avm ? options.avm : false,
json: options.json ? options.json : !options.avm,
nef: options.nef ? options.nef : false,
json: options.json ? options.json : !options.nef,
debug: options.debug ? options.debug : false,
opcodes: options.opcodes ? options.opcodes : false,
});
Expand Down Expand Up @@ -65,16 +65,16 @@ const testCompileProject = async (project: string, options: CLICompileOptions) =
);
const neooneABIFiles = outFiles.filter((filename) => filename.endsWith('.neoone.abi.json'));
const debugFiles = outFiles.filter((filename) => filename.endsWith('.debug.json'));
const avmFiles = outFiles.filter((filename) => filename.endsWith('.avm'));
const avmDebugFiles = outFiles.filter((filename) => filename.endsWith('.avmdbgnfo'));
const opcodeFiles = outFiles.filter((filename) => filename.endsWith('.avm.txt'));
const avmFiles = outFiles.filter((filename) => filename.endsWith('.nef'));
const avmDebugFiles = outFiles.filter((filename) => filename.endsWith('.nefdbgnfo'));
const opcodeFiles = outFiles.filter((filename) => filename.endsWith('.nef.txt'));

if (!options.json) {
expect(contractFiles.length).toEqual(0);
expect(neooneABIFiles.length).toEqual(0);
}

if (!options.avm) {
if (!options.nef) {
expect(avmFiles.length).toEqual(0);
expect(avmABIFiles.length).toEqual(0);
}
Expand All @@ -99,9 +99,9 @@ const testCompileProject = async (project: string, options: CLICompileOptions) =
expect(contents.returnType).toBeDefined();
expect(contents.name).toBeDefined();

// we won't always check the avm buffer (it won't always check but will be enough)
if (options.avm) {
const avmFile = filename.replace('.contract.json', '.avm');
// we won't always check the nef buffer (it won't always check but will be enough)
if (options.nef) {
const avmFile = filename.replace('.contract.json', '.nef');
const avmScript = await fs.readFile(getTmpPath(avmFile));
expect(Buffer.from(contents.script, 'hex')).toEqual(avmScript);
}
Expand All @@ -111,7 +111,7 @@ const testCompileProject = async (project: string, options: CLICompileOptions) =
await Promise.all(
neooneABIFiles.map(async (filename) => {
const contents = await fs.readJSON(getTmpPath(filename));
expect(() => args.assertABI(filename, contents)).not.toThrow();
expect(() => args.assertContractManifestClient(filename, contents)).not.toThrow();
}),
);
}
Expand All @@ -131,14 +131,14 @@ const testCompileProject = async (project: string, options: CLICompileOptions) =
);
}

if (options.avm) {
if (options.nef) {
expect(avmDebugFiles.length).toEqual(3);
expect(avmFiles.length).toEqual(3);
await Promise.all(
avmDebugFiles.map(async (filename) => {
const rawFile = await fs.readFile(getTmpPath(filename));
const zipped = await JSZip.loadAsync(rawFile);
const zipContents = await zipped.file(filename.replace('.avmdbgnfo', '.debug.json'))?.async('text');
const zipContents = await zipped.file(filename.replace('.nefdbgnfo', '.debug.json'))?.async('text');
if (zipContents === undefined) {
throw new Error('contents should be defined here');
}
Expand All @@ -156,26 +156,26 @@ describe('Compile ICO', () => {
});

test('compile -- avm flag', async () => {
await testCompileProject('ico', createOptions({ avm: true }));
await testCompileProject('ico', createOptions({ nef: true }));
});

test('compile -- json & avm flag', async () => {
await testCompileProject('ico', createOptions({ avm: true, json: true }));
test('compile -- json & nef flag', async () => {
await testCompileProject('ico', createOptions({ nef: true, json: true }));
});

test('compile -- debug flag', async () => {
await testCompileProject('ico', createOptions({ debug: true }));
});

test('compile -- avm & debug flag', async () => {
await testCompileProject('ico', createOptions({ avm: true, debug: true }));
test('compile -- nef & debug flag', async () => {
await testCompileProject('ico', createOptions({ nef: true, debug: true }));
});

test('compile -- avm && debug && opcodes flag', async () => {
await testCompileProject('ico', createOptions({ avm: true, debug: true, opcodes: true }));
test('compile -- nef && debug && opcodes flag', async () => {
await testCompileProject('ico', createOptions({ nef: true, debug: true, opcodes: true }));
});

test('compile -- json & avm & debug', async () => {
await testCompileProject('ico', createOptions({ json: true, avm: true, debug: true }));
test('compile -- json & nef & debug', async () => {
await testCompileProject('ico', createOptions({ json: true, nef: true, debug: true }));
});
});
7 changes: 5 additions & 2 deletions packages/neo-one-cli/src/generate/createTasks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@ export const createTasks = (_cmd: Command, config: Configuration) =>
{
title: 'Generate common code',
task: async (ctx) => {
// TODO: add more network definition here for non-local dev purposes?
// should these new definitions be in build createTasks
const networks = [
{
name: 'local',
Expand All @@ -89,6 +87,11 @@ export const createTasks = (_cmd: Command, config: Configuration) =>
rpcURL: rpcURL.main,
dev: false,
},
{
name: 'staging',
rpcURL: rpcURL.staging,
dev: false,
},
];
await generateCommonCode(config, ctx.contracts, networks, ctx.sourceMaps);
},
Expand Down
2 changes: 1 addition & 1 deletion packages/neo-one-node-protocol/src/Node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -899,7 +899,7 @@ export class Node implements INode {
}),
);
}
logger.debug({
logger.info({
name: 'neo_relay_block',
[Labels.NEO_BLOCK_INDEX]: block.index,
['neo.block.transactions']: block.transactions.length,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ You may or may not run into environment problems when using the CLI, trying to t
- Try running the NEO•ONE CLI command using `sudo`, such as: `sudo npx neo-one init`
- If problems persist then please reach out to us on [Discord](https://discord.gg/S86PqDE)

To see a demonstration of environment setup go to our YouTube channel for helpful videos: https://www.youtube.com/channel/UCya5J1Tt2h-kX-I3a7LOvtw
To see a demonstration of environment setup go to our [YouTube channel](https://www.youtube.com/channel/UCya5J1Tt2h-kX-I3a7LOvtw) for helpful videos.

---

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ This tells your local C# .NET runtime to use version 3.1.401 in this repo, even
- Try running the NEO•ONE CLI command using `sudo`, such as: `sudo npx neo-one init`
- If problems persist then please reach out to us on [Discord](https://discord.gg/S86PqDE)

To see a demonstration of environment setup go to our YouTube channel for helpful videos: https://www.youtube.com/channel/UCya5J1Tt2h-kX-I3a7LOvtw
To see a demonstration of environment setup go to our [YouTube channel](https://www.youtube.com/channel/UCya5J1Tt2h-kX-I3a7LOvtw) for helpful videos.

**Once you have a project setup**, the next step is to add NEO•ONE to it. NEO•ONE is organized into multiple individual packages. Use as much or as little as you like. Each package may be installed using either [yarn](https://yarnpkg.com/) (`yarn add <package name>`) or [npm](https://www.npmjs.com/) (`npm install <package name>`). Each package has the form `@neo-one/<name>`, for example, `@neo-one/client`.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ export default {
path: 'neo-one/contracts',
// Set this to true if you want the compile command to output JSON.
json: true,
// Set this to true if you want the compile command to output AVM.
avm: false,
// Set this to true if you want the compile command to output a Nef (Neo Executable Format 3) file.
nef: false,
// Set this to true if you want the compile command to output additional debug information.
debug: false,
// Set this to true if you want the compile command to output the AVM in a human-readable format for debugging (requires debug: true).
Expand Down
2 changes: 1 addition & 1 deletion packages/neo-one-website/tutorial/tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ You may or may not run into environment problems when using the CLI, trying to t
- You then need to re-install your node modules by deleting the `node_modules` folder and then running `npm install` again
- Try running the NEO•ONE CLI command using `sudo`, such as: `sudo npx neo-one init`

To see a demonstration of environment setup go to our YouTube channel for helpful videos: https://www.youtube.com/channel/UCya5J1Tt2h-kX-I3a7LOvtw
To see a demonstration of environment setup go to our [YouTube channel](https://www.youtube.com/channel/UCya5J1Tt2h-kX-I3a7LOvtw) for helpful videos.

### Help, I'm Stuck!

Expand Down