How to use nethereum-codegen - 2 common examples

To help you get started, we’ve selected a few nethereum-codegen examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github juanfranblanco / vscode-solidity / src / codegen.ts View on Github external
}
            }
            const outputPathInfo = path.parse(fileName);
            const contractName = outputPathInfo.name;

            const compilationOutput = JSON.parse(fs.readFileSync(fileName, 'utf8'));
            if (compilationOutput.abi !== undefined) {
                const abi = JSON.stringify(compilationOutput.abi);
                const contractByteCode = compilationOutput.bytecode;
                const projectFullPath = path.join(projectPath, projectName + extension);

                if (!fs.existsSync(projectFullPath)) {
                    codegen.generateNetStandardClassLibrary(projectName, projectPath, lang);
                }

                codegen.generateAllClasses(abi,
                    contractByteCode,
                    contractName,
                    baseNamespace,
                    projectPath,
                    lang);
            }
        } catch (e) {
            const outputChannel = vscode.window.createOutputChannel('solidity code generation');
            outputChannel.clear();
            outputChannel.appendLine('Error generating code:');
            outputChannel.appendLine(e.message);
            outputChannel.show();
        }
    }
github juanfranblanco / vscode-solidity / src / codegen.ts View on Github external
if (settings.projectPath !== undefined) {
                    projectPath = path.join(projectPath, settings.projectPath);
                }
            }
            const outputPathInfo = path.parse(fileName);
            const contractName = outputPathInfo.name;

            const compilationOutput = JSON.parse(fs.readFileSync(fileName, 'utf8'));
            if (compilationOutput.abi !== undefined) {
                const abi = JSON.stringify(compilationOutput.abi);
                const contractByteCode = compilationOutput.bytecode;
                const projectFullPath = path.join(projectPath, projectName + extension);

                if (!fs.existsSync(projectFullPath)) {
                    codegen.generateNetStandardClassLibrary(projectName, projectPath, lang);
                }

                codegen.generateAllClasses(abi,
                    contractByteCode,
                    contractName,
                    baseNamespace,
                    projectPath,
                    lang);
            }
        } catch (e) {
            const outputChannel = vscode.window.createOutputChannel('solidity code generation');
            outputChannel.clear();
            outputChannel.appendLine('Error generating code:');
            outputChannel.appendLine(e.message);
            outputChannel.show();
        }

nethereum-codegen

Code generator of Nethereum and Ethereum integration classes and projects

MIT
Latest version published 19 days ago

Package Health Score

78 / 100
Full package analysis