From a927fb8720bccbde3d3eb7c3f9f3ea2fbcd59876 Mon Sep 17 00:00:00 2001 From: jovonni Date: Thu, 12 Sep 2024 22:03:57 -0400 Subject: [PATCH] fixup! chore: fixed new lint errors --- .github/workflows/pr.yml | 2 ++ contract/package.json | 1 - contract/src/orca.contract.js | 27 ++++++++++++--------------- contract/src/orca.flows.js | 1 - contract/src/orca.proposal.js | 15 ++++----------- contract/test/boot-tools.js | 4 +--- contract/test/mintStable.js | 2 +- contract/test/orca-contract.test.js | 2 +- contract/test/support.js | 10 +++++++--- contract/test/wallet-tools.js | 4 ++-- contract/tools/e2e-tools.js | 4 ---- contract/tools/queryKit.js | 9 +++++++-- contract/tools/registry.js | 23 +++++++++++++++++++++-- contract/tools/sleep.js | 4 ++-- contract/tsconfig.json | 4 ++-- 15 files changed, 62 insertions(+), 50 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index d10f220..3602f84 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -20,6 +20,8 @@ jobs: - run: corepack enable - run: yarn install - run: yarn build + - run: ls ./ + - run: ls ./contract - run: yarn test integration: runs-on: ubuntu-latest diff --git a/contract/package.json b/contract/package.json index ef25ff3..b25a227 100644 --- a/contract/package.json +++ b/contract/package.json @@ -131,7 +131,6 @@ "src" ], "resolutions": { - "node-fetch": "2.6.12", "axios": "1.6.7", "@noble/hashes": "https://github.com/paulmillr/noble-hashes.git#ae060daa6252f3ff2aa2f84e887de0aab491281d" }, diff --git a/contract/src/orca.contract.js b/contract/src/orca.contract.js index 54fa19e..3d136f8 100644 --- a/contract/src/orca.contract.js +++ b/contract/src/orca.contract.js @@ -29,7 +29,7 @@ import * as flows from './orca.flows.js'; * @import {CosmosInterchainService} from '@agoric/orchestration'; * @import {TimerService} from '@agoric/time'; * @import {NameHub} from '@agoric/vats'; - * + * */ // /** @@ -45,7 +45,6 @@ import * as flows from './orca.flows.js'; // * @typedef {import('@agoric/zoe/src/contractFacet/types-ambient.js').ZCF} ZCF // */ - // /** // * @typedef {import('@agoric/zoe/src/contractFacet/types-ambient.js').ContractStartFn} ContractStartFunction // */ @@ -54,9 +53,7 @@ import * as flows from './orca.flows.js'; /// /** -*/ - - + */ const trace = makeTracer('OrchDev1'); @@ -98,16 +95,15 @@ export const meta = { }; harden(meta); - /** * @typedef {{ -* localchain: Remote; -* orchestrationService: Remote; -* storageNode: Remote; -* timerService: Remote; -* agoricNames: Remote; -* }} OrchestrationPowers -*/ + * localchain: Remote; + * orchestrationService: Remote; + * storageNode: Remote; + * timerService: Remote; + * agoricNames: Remote; + * }} OrchestrationPowers + */ /** * @param {ZCF> | undefined} zcf @@ -126,7 +122,6 @@ const contract = async ( ) => { trace('inside start function: v1.1.96'); trace('privateArgs', privateArgs); - // @ts-expect-error XXX ZCFSeat not Passable const { makeAccount, makeCreateAndFund } = orchestrateAll(flows, { @@ -158,7 +153,9 @@ const contract = async ( }; /** @type {ContractStartFunction} */ -export const start = /** @type {ContractStartFunction} */ (withOrchestration(contract)); +export const start = /** @type {ContractStartFunction} */ ( + withOrchestration(contract) +); harden(start); // /** @typedef {typeof start} OrcaSF */ diff --git a/contract/src/orca.flows.js b/contract/src/orca.flows.js index 54c85ee..bc9a38b 100644 --- a/contract/src/orca.flows.js +++ b/contract/src/orca.flows.js @@ -65,7 +65,6 @@ export const makeCreateAndFund = async ( trace('amt', amt); trace('give:', give); - const [agoric, chain] = await Promise.all([ orch.getChain('agoric'), orch.getChain(chainName), diff --git a/contract/src/orca.proposal.js b/contract/src/orca.proposal.js index ab14b93..2e26769 100644 --- a/contract/src/orca.proposal.js +++ b/contract/src/orca.proposal.js @@ -10,7 +10,6 @@ import { makeTracer } from './tools/debug.js'; // import { atomicTransfer } from '@agoric/zoe/src/contractSupport/index.js'; /// - /** * @import {ERef} from '@endo/far'; * @import {BootstrapManifest} from '@agoric/vats/src/core/lib-boot.js'; @@ -19,16 +18,14 @@ import { makeTracer } from './tools/debug.js'; * @import {OrcaSF} from './orca.contract.js'; */ - /** - * * @typedef {import('./orca.contract.js').OrcaSF} OrcaSF - */ - +/** + * * @typedef {import('./orca.contract.js').OrcaSF} OrcaSF + */ /** * @typedef {import('@agoric/vow').Remote} LocalChain */ - const trace = makeTracer('OrCE'); const { entries, fromEntries } = Object; @@ -114,16 +111,12 @@ export const startOrcaContract = async (permittedPowers, config) => { const marshaller = await E(board).getPublishingMarshaller(); console.log(marshaller); - - - - /** @type {StartUpgradableOpts} **/ const startOpts = { label: 'orca', installation, terms: undefined, - privateArgs: { + privateArgs: { localchain: await localchain, // localchain: await E(localchain), orchestrationService: await cosmosInterchainService, diff --git a/contract/test/boot-tools.js b/contract/test/boot-tools.js index 31228dd..3cb883a 100644 --- a/contract/test/boot-tools.js +++ b/contract/test/boot-tools.js @@ -19,8 +19,6 @@ import '@agoric/vats/src/core/types-ambient.js'; import '@agoric/zoe/src/zoeService/types-ambient.js'; const { entries } = Object; - - /** * Make powers (zoe, timer and name services, etc.) sufficient to test * deploying and using contracts. priceAuthority is a dummy. @@ -66,7 +64,7 @@ export const mockBootstrapPowers = async ( /** * @typedef {Record>} IssuerKeywordRecord - */ + */ const startUpgradable = ({ installation, issuerKeywordRecord, diff --git a/contract/test/mintStable.js b/contract/test/mintStable.js index bb28f37..6f4f913 100644 --- a/contract/test/mintStable.js +++ b/contract/test/mintStable.js @@ -59,7 +59,7 @@ export const makeStableFaucet = ({ const { creatorFacet: bootstrapSupplier } = await E(zoe).startInstance( centralSupply, {}, - /** @type {any} */ ({ bootstrapPaymentValue: value }), + /** @type {any} */ ({ bootstrapPaymentValue: value }), { feeMintAccess }, ); return E(bootstrapSupplier).getBootstrapPayment(); diff --git a/contract/test/orca-contract.test.js b/contract/test/orca-contract.test.js index a20707c..740b9dc 100644 --- a/contract/test/orca-contract.test.js +++ b/contract/test/orca-contract.test.js @@ -221,7 +221,7 @@ const makeTestContext = async t => { registerChain: async (name, details) => { console.log(`chain registered: ${name}`, details); }, - getChain: async (chainName) => { + getChain: async chainName => { const state = harden({ name: 'agoric', chainId: `agoriclocal`, diff --git a/contract/test/support.js b/contract/test/support.js index b39af85..4c1335d 100644 --- a/contract/test/support.js +++ b/contract/test/support.js @@ -1,4 +1,4 @@ -import { dirname, join } from 'path'; +import path from 'path'; import { execa } from 'execa'; import fse from 'fs-extra'; import childProcess from 'child_process'; @@ -8,8 +8,12 @@ import { generateMnemonic } from '../tools/wallet.js'; import { makeRetryUntilCondition } from '../tools/sleep.js'; import { makeDeployBuilder } from '../tools/deploy.js'; -// const setupRegistry = makeSetupRegistry(makeGetFile({ dirname, join })); -const setupRegistry = makeSetupRegistry(makeGetFile()); +const setupRegistry = makeSetupRegistry( + makeGetFile({ + dirname: path.dirname(new URL(import.meta.url).pathname), + join: path.join, + }), +); const chainConfig = { cosmoshub: { expectedAddressPrefix: 'cosmos' }, diff --git a/contract/test/wallet-tools.js b/contract/test/wallet-tools.js index 1589185..3e6bf60 100644 --- a/contract/test/wallet-tools.js +++ b/contract/test/wallet-tools.js @@ -52,7 +52,7 @@ export const mockWalletFactory = ( const brand = await E(issuer).getBrand(); // /** @type {[Brand, Purse]} */ /** @type {[Brand, Purse]} */ - const entry = [brand, purse]; + const entry = [brand, purse]; return entry; }), ); @@ -65,7 +65,7 @@ export const mockWalletFactory = ( const depositFacet = Far('DepositFacet', { // /** @param {Payment} pmt */ - /** @param {Payment} pmt */ + /** @param {Payment} pmt */ receive: async pmt => { const pBrand = await E(pmt).getAllegedBrand(); diff --git a/contract/tools/e2e-tools.js b/contract/tools/e2e-tools.js index be217f2..bcb9d01 100644 --- a/contract/tools/e2e-tools.js +++ b/contract/tools/e2e-tools.js @@ -112,9 +112,6 @@ const installBundle = async (fullPath, opts) => { return { tx, confirm: true }; }; - - - /** * @param {string} address * @param {Record} balances @@ -142,7 +139,6 @@ export const provisionSmartWallet = async ( // q = makeQueryKit(makeVStorage(lcd)).query, }, ) => { - const q = makeQueryKit(makeVStorage(lcd)).query; // TODO: skip this query if balances is {} diff --git a/contract/tools/queryKit.js b/contract/tools/queryKit.js index 9b7cccf..d12a742 100644 --- a/contract/tools/queryKit.js +++ b/contract/tools/queryKit.js @@ -103,8 +103,13 @@ export const makeWalletView = (addr, { query, vstorage }) => { * @param {import('@endo/marshal').Marshal} [m] */ // export const makeQueryKit = (vstorage, m = makeClientMarshaller()) => { -export const makeQueryKit = (vstorage, m = /** @type {import('@endo/marshal').Marshal} */ (makeClientMarshaller())) => { -/** @param {['children' | 'data', string][]} paths */ +export const makeQueryKit = ( + vstorage, + m = /** @type {import('@endo/marshal').Marshal} */ ( + makeClientMarshaller() + ), +) => { + /** @param {['children' | 'data', string][]} paths */ const batchQuery = async paths => batchVstorageQuery(vstorage, m.fromCapData, paths); diff --git a/contract/tools/registry.js b/contract/tools/registry.js index f2e8230..e47ff6c 100644 --- a/contract/tools/registry.js +++ b/contract/tools/registry.js @@ -1,10 +1,29 @@ import { useRegistry, useChain, ConfigContext } from 'starshipjs'; import path from 'path'; -export const makeGetFile = () => filePath => { - return path.join(path.dirname(new URL(import.meta.url).pathname), filePath); +// export const makeGetFile = () => filePath => { +// return path.join(path.dirname(new URL(import.meta.url).pathname), filePath); +// }; + +/** + * @param {Object} [options] + * @param {string} [options.dirname] + * @param {Function} [options.join] + * @returns {(filePath: string) => string} + */ +export const makeGetFile = ({ + dirname = path.dirname(new URL(import.meta.url).pathname), + join = path.join, +} = {}) => { + return filePath => { + return join(dirname, filePath); + }; }; +/** + * @param {(path: string) => string} getFile + * @returns { (options?: { config?: string }) => Promise<{ useChain: any }> } + */ export const makeSetupRegistry = getFile => { let initialized = false; diff --git a/contract/tools/sleep.js b/contract/tools/sleep.js index d1ba491..8ee2cef 100644 --- a/contract/tools/sleep.js +++ b/contract/tools/sleep.js @@ -1,6 +1,6 @@ const ambientSetTimeout = globalThis.setTimeout; -const sleep = (ms, { log = (msg) => {}, setTimeout = ambientSetTimeout } = {}) => +const sleep = (ms, { log = msg => {}, setTimeout = ambientSetTimeout } = {}) => new Promise(resolve => { log(`Sleeping for ${ms}ms...`); setTimeout(resolve, ms); @@ -13,7 +13,7 @@ const retryUntilCondition = async ( { maxRetries = 6, retryIntervalMs = 3500, - log = (msg) => {}, + log = msg => {}, setTimeout = ambientSetTimeout, } = {}, ) => { diff --git a/contract/tsconfig.json b/contract/tsconfig.json index 04cc319..4646fe5 100644 --- a/contract/tsconfig.json +++ b/contract/tsconfig.json @@ -12,8 +12,8 @@ "skipLibCheck": true, "forceConsistentCasingInFileNames": true, "resolveJsonModule": true, - "outDir": "./dist", + "outDir": "./dist" }, "include": ["tools", "test"], "exclude": ["node_modules"] -} \ No newline at end of file +}