From 23312f19c84134a940b80e14c0cde8bd8271b064 Mon Sep 17 00:00:00 2001 From: Crypto2099 <63186174+Crypto2099@users.noreply.github.com> Date: Wed, 24 Jul 2024 17:03:26 -0700 Subject: [PATCH] Revert early changes to the TS files as part of the troubleshooting process --- jsapi/src/cardano-addresses.ts | 18 +++++++++--------- jsapi/src/cli.ts | 6 +++--- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/jsapi/src/cardano-addresses.ts b/jsapi/src/cardano-addresses.ts index b1572ad8d..ead25f8f6 100644 --- a/jsapi/src/cardano-addresses.ts +++ b/jsapi/src/cardano-addresses.ts @@ -26,7 +26,7 @@ import { CardanoAddressesJSModule, CardanoAddressesApi } from '../src/foreign'; * @returns The fields parsed from the address. */ export async function inspectAddress(address: Address, rootXPub?: XPub): Promise { - var api = await init(); + const api = await init(); return new Promise((resolve, reject) => api.inspectAddress(rootXPub || null, address, resolve, reject)); } @@ -35,7 +35,7 @@ export async function inspectAddress(address: Address, rootXPub?: XPub): Promise * @returns The Cabal package version string and git revision. */ export async function version(): Promise { - var api = await init(); + const api = await init(); return new Promise(done => api.version(done)); } @@ -53,7 +53,7 @@ var apiDestroy: undefined|(() => void) = () => {}; export function init(): Promise { if (!apiCreate) { apiCreate = loadJSAPI().then(mod => { - var run = mod.runCardanoAddressesApi; + const run = mod.runCardanoAddressesApi; return new Promise(resolve => run((api, cleanup) => { apiDestroy = cleanup; resolve(api); @@ -64,12 +64,12 @@ export function init(): Promise { } async function loadJSAPI(): Promise { - var haveProcess = typeof process != 'undefined'; - var nixPath = haveProcess && process.env?.CARDANO_ADDRESSES_JS; - var isNode = haveProcess && process.versions?.node !== 'undefined'; - var mod = isNode ? 'cjs' : 'esm'; - var dir = nixPath || '.'; - var file = `${dir}/cardano-addresses-jsapi.${mod}.js`; + const haveProcess = typeof process != 'undefined'; + const nixPath = haveProcess && process.env?.CARDANO_ADDRESSES_JS; + const isNode = haveProcess && process.versions?.node !== 'undefined'; + const mod = isNode ? 'cjs' : 'esm'; + const dir = nixPath || '.'; + const file = `${dir}/cardano-addresses-jsapi.${mod}.js`; try { console.log(`Importing File: ${file}`); return await import(file); diff --git a/jsapi/src/cli.ts b/jsapi/src/cli.ts index 5637a1b87..7cb01a4dc 100644 --- a/jsapi/src/cli.ts +++ b/jsapi/src/cli.ts @@ -26,7 +26,7 @@ function usage(): void { * @hidden */ export function cli(argv: Process['argv']): void { - var args = argv; + const args = argv; args.shift(); // /usr/bin/node args.shift(); // js-inspect-address @@ -35,9 +35,9 @@ export function cli(argv: Process['argv']): void { usage(); } - var address = args.shift() as string; + const address = args.shift() as string; - var waitForExit = setInterval(() => undefined, 3600000); + const waitForExit = setInterval(() => undefined, 3600000); inspectAddress(address) .then(res => {