From b03bc9dc74d7407deafdab36ca7ae7ceba27739d Mon Sep 17 00:00:00 2001 From: Spencer Corwin <29364457+spencercorwin@users.noreply.github.com> Date: Mon, 28 Jun 2021 16:14:42 -0700 Subject: [PATCH] fix(docs,cli): fixup some docs and client settings (#2498) --- .../neo-one-cli-common-node/src/networks.ts | 4 +- packages/neo-one-cli-common/src/rpcURL.ts | 1 + .../src/__e2e__/cmd/compile.test.ts | 44 +++++++++---------- .../neo-one-cli/src/generate/createTasks.ts | 7 ++- packages/neo-one-node-protocol/src/Node.ts | 2 +- .../docs/0-installation/0-quick-start.md | 2 +- .../0-installation/2-environment-setup.md | 2 +- .../08-configuration-options.md | 4 +- packages/neo-one-website/tutorial/tutorial.md | 2 +- 9 files changed, 36 insertions(+), 32 deletions(-) diff --git a/packages/neo-one-cli-common-node/src/networks.ts b/packages/neo-one-cli-common-node/src/networks.ts index 17c37f9044..b79781354b 100644 --- a/packages/neo-one-cli-common-node/src/networks.ts +++ b/packages/neo-one-cli-common-node/src/networks.ts @@ -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'), }, }; diff --git a/packages/neo-one-cli-common/src/rpcURL.ts b/packages/neo-one-cli-common/src/rpcURL.ts index d29ffbd37b..1669fb4c79 100644 --- a/packages/neo-one-cli-common/src/rpcURL.ts +++ b/packages/neo-one-cli-common/src/rpcURL.ts @@ -1,4 +1,5 @@ export const rpcURL = { + staging: 'https://staging.neotracker.io/rpc', test: 'https://testnet.neotracker.io/rpc', main: 'https://neotracker.io/rpc', }; diff --git a/packages/neo-one-cli/src/__e2e__/cmd/compile.test.ts b/packages/neo-one-cli/src/__e2e__/cmd/compile.test.ts index 642085e396..3f557e9df9 100644 --- a/packages/neo-one-cli/src/__e2e__/cmd/compile.test.ts +++ b/packages/neo-one-cli/src/__e2e__/cmd/compile.test.ts @@ -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 => ({ - 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, }); @@ -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); } @@ -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); } @@ -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(); }), ); } @@ -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'); } @@ -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 })); }); }); diff --git a/packages/neo-one-cli/src/generate/createTasks.ts b/packages/neo-one-cli/src/generate/createTasks.ts index 31f606e0b4..100b93cc46 100644 --- a/packages/neo-one-cli/src/generate/createTasks.ts +++ b/packages/neo-one-cli/src/generate/createTasks.ts @@ -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', @@ -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); }, diff --git a/packages/neo-one-node-protocol/src/Node.ts b/packages/neo-one-node-protocol/src/Node.ts index 54f3bc514e..b6fac347a8 100644 --- a/packages/neo-one-node-protocol/src/Node.ts +++ b/packages/neo-one-node-protocol/src/Node.ts @@ -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, diff --git a/packages/neo-one-website/docs/0-installation/0-quick-start.md b/packages/neo-one-website/docs/0-installation/0-quick-start.md index 774ddfa107..4be3ed9e3b 100644 --- a/packages/neo-one-website/docs/0-installation/0-quick-start.md +++ b/packages/neo-one-website/docs/0-installation/0-quick-start.md @@ -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. --- diff --git a/packages/neo-one-website/docs/0-installation/2-environment-setup.md b/packages/neo-one-website/docs/0-installation/2-environment-setup.md index f17118c6d2..dee71803cb 100644 --- a/packages/neo-one-website/docs/0-installation/2-environment-setup.md +++ b/packages/neo-one-website/docs/0-installation/2-environment-setup.md @@ -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 `) or [npm](https://www.npmjs.com/) (`npm install `). Each package has the form `@neo-one/`, for example, `@neo-one/client`. diff --git a/packages/neo-one-website/docs/2-advanced-guides/08-configuration-options.md b/packages/neo-one-website/docs/2-advanced-guides/08-configuration-options.md index accfabd4d9..78f958c212 100644 --- a/packages/neo-one-website/docs/2-advanced-guides/08-configuration-options.md +++ b/packages/neo-one-website/docs/2-advanced-guides/08-configuration-options.md @@ -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). diff --git a/packages/neo-one-website/tutorial/tutorial.md b/packages/neo-one-website/tutorial/tutorial.md index 51b21a0702..645d8655d9 100644 --- a/packages/neo-one-website/tutorial/tutorial.md +++ b/packages/neo-one-website/tutorial/tutorial.md @@ -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!