Merge pull request #152 from CosmWasm/improve-cli

Add axios, fs and FeeTable to CLI by default
This commit is contained in:
Ethan Frey 2020-03-20 12:18:29 +01:00 committed by GitHub
commit 8cf5c68b7e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 5 deletions

View File

@ -42,6 +42,7 @@
"@iov/encoding": "^2.1.0",
"@iov/utils": "^2.0.2",
"argparse": "^1.0.10",
"axios": "^0.19.2",
"babylon": "^6.18.0",
"colors": "^1.3.3",
"diff": "^4",

View File

@ -69,6 +69,7 @@ export function main(originalArgs: readonly string[]): void {
"SearchTxFilter",
// signingcosmwasmclient
"ExecuteResult",
"FeeTable",
"InstantiateResult",
"SigningCallback",
"SigningCosmWasmClient",
@ -110,8 +111,8 @@ export function main(originalArgs: readonly string[]): void {
console.info(colors.green("Initializing session for you. Have fun!"));
console.info(colors.yellow("Available imports:"));
console.info(colors.yellow(" * http"));
console.info(colors.yellow(" * https"));
console.info(colors.yellow(" * axios"));
console.info(colors.yellow(" * fs"));
for (const [moduleName, symbols] of imports.entries()) {
console.info(colors.yellow(` * from ${moduleName}: ${symbols.join(", ")}`));
}
@ -128,8 +129,8 @@ export function main(originalArgs: readonly string[]): void {
console.info(colors.yellow(` * helper functions: ${encodingHelpers.join(", ")}`));
let init = `
import * as http from 'http';
import * as https from 'https';
import axios from "axios";
import * as fs from "fs";
`;
for (const [moduleName, symbols] of imports.entries()) {
init += `import { ${symbols.join(", ")} } from "${moduleName}";\n`;
@ -141,6 +142,10 @@ export function main(originalArgs: readonly string[]): void {
// execute some trival stuff and exit
init += `
await sleep(123);
const readmeContent = fs.readFileSync(process.cwd() + "/README.md");
fs.writeFileSync(process.cwd() + "/README.md", readmeContent);
const hash = new Sha512(new Uint8Array([])).digest();
const hexHash = toHex(hash);
export class NewDummyClass {};

View File

@ -1747,7 +1747,7 @@ aws4@^1.8.0:
resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.9.1.tgz#7e33d8f7d449b3f673cd72deb9abdc552dbe528e"
integrity sha512-wMHVg2EOHaMRxbzgFJ9gtjOOCrI80OHLG14rxi28XwOW8ux6IiEbRCGGGqCtdAIg4FQCbW20k9RsT4y3gJlFug==
axios@^0.19.0:
axios@^0.19.0, axios@^0.19.2:
version "0.19.2"
resolved "https://registry.yarnpkg.com/axios/-/axios-0.19.2.tgz#3ea36c5d8818d0d5f8a8a97a6d36b86cdc00cb27"
integrity sha512-fjgm5MvRHLhx+osE2xoekY70AhARk3a6hkN+3Io1jc00jtquGvxYlKlsFUhmUET0V5te6CcZI7lcv2Ym61mjHA==