Skip to content

Commit 0d5f9a7

Browse files
committed
add readable cron expressions
1 parent 0393bd0 commit 0d5f9a7

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"@types/bs58": "^4.0.1",
2020
"@types/isomorphic-fetch": "^0.0.35",
2121
"bs58": "^4.0.1",
22+
"cronstrue": "^1.125.0",
2223
"dotenv": "^10.0.0",
2324
"isomorphic-fetch": "^3.0.0",
2425
"node-cron": "^3.0.0",

src/index.ts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,8 @@ import fetch from "isomorphic-fetch";
22
import { Jupiter, TOKEN_LIST_URL } from "@jup-ag/core";
33
import { PublicKey, Connection } from "@solana/web3.js";
44
import * as cron from "node-cron";
5-
import {
6-
ENV,
7-
MINT_ADDRESSES,
8-
SOLANA_RPC_ENDPOINT,
9-
Token,
10-
USER_KEYPAIR,
11-
} from "./constants";
5+
import cronstrue from "cronstrue";
6+
import {Token, MINT_ADDRESSES, USER_KEYPAIR, SOLANA_RPC_ENDPOINT} from "./constants";
127
import { dcaconfig } from './dcaconfig'
138

149
const jupiterSwap = async ({
@@ -100,7 +95,7 @@ const main = async () => {
10095

10196
console.log("Scheduling swaps:");
10297
filteredJobs.map(job => {
103-
console.log(`${job.amount} ${job.inputToken} -> ${job.outputToken}. cron: ${job.cron}`);
98+
console.log(`${job.amount} ${job.inputToken} for ${job.outputToken} ${cronstrue.toString(job.cron)}`);
10499
});
105100

106101
filteredJobs.forEach(job => {

yarn.lock

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -557,6 +557,11 @@ create-require@^1.1.0:
557557
resolved "https://registry.yarnpkg.com/create-require/-/create-require-1.1.1.tgz#c1d7e8f1e5f6cfc9ff65f9cd352d37348756c333"
558558
integrity sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==
559559

560+
cronstrue@^1.125.0:
561+
version "1.125.0"
562+
resolved "https://registry.yarnpkg.com/cronstrue/-/cronstrue-1.125.0.tgz#8030816d033d00caade9b2a9f9b71e69175bcf42"
563+
integrity sha512-qkC5mVbVGuuyBVXmam5anaRtbLcgfBUKajoyZqCdf/XBdgF43PsLSEm8eEi2dsI3YbqDPbLSH2mWNzM1dVqHgQ==
564+
560565
cross-fetch@3.0.6:
561566
version "3.0.6"
562567
resolved "https://registry.yarnpkg.com/cross-fetch/-/cross-fetch-3.0.6.tgz#3a4040bc8941e653e0e9cf17f29ebcd177d3365c"

0 commit comments

Comments
 (0)