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

[JS->TS] Migrate wait_seconds.js #832

Merged
merged 2 commits into from
Jun 2, 2020
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
11 changes: 10 additions & 1 deletion scripts/invoke_view_function.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
import { parseArgs, getBatchExchange } from "./util";
import { getBatchExchange } from "./util";

function parseArgs(): string[] {
const args = process.argv.slice(4);
const index = args.indexOf("--network");
if (index > -1) {
args.splice(index, 2);
}
return args;
}

module.exports = async (callback: Truffle.ScriptCallback) => {
try {
Expand Down
9 changes: 0 additions & 9 deletions scripts/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,3 @@ export async function addTokens(
// Return token information
return tokens;
}

export function parseArgs(): string[] {
const args = process.argv.slice(4);
const index = args.indexOf("--network");
if (index > -1) {
args.splice(index, 2);
}
return args;
}
17 changes: 0 additions & 17 deletions scripts/wait_seconds.js

This file was deleted.

22 changes: 22 additions & 0 deletions scripts/wait_seconds.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { waitForNSeconds } from "..//test/utilities";
import { factory } from "../src/logging";
const log = factory.getLogger("scripts.wait_seconds");

const argv = require("yargs")
.option("seconds", {
describe: "Number of seconds to wait",
type: "int",
demandOption: true,
})
.help(false)
.version(false).argv;

module.exports = async (callback: Truffle.ScriptCallback) => {
try {
await waitForNSeconds(argv.seconds, web3);
log.info(`waited ${argv.seconds} seconds`);
callback();
} catch (error) {
callback(error);
}
};