Skip to content

Commit

Permalink
fixup! chore: fixed new lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Jovonni committed Sep 13, 2024
1 parent 1b2d4c3 commit a927fb8
Show file tree
Hide file tree
Showing 15 changed files with 62 additions and 50 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion contract/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
27 changes: 12 additions & 15 deletions contract/src/orca.contract.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
*
*
*/

// /**
Expand All @@ -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
// */
Expand All @@ -54,9 +53,7 @@ import * as flows from './orca.flows.js';
/// <reference types="@agoric/zoe/src/contractFacet/types-ambient"/>

/**
*/


*/

const trace = makeTracer('OrchDev1');

Expand Down Expand Up @@ -98,16 +95,15 @@ export const meta = {
};
harden(meta);


/**
* @typedef {{
* localchain: Remote<LocalChain>;
* orchestrationService: Remote<CosmosInterchainService>;
* storageNode: Remote<StorageNode>;
* timerService: Remote<TimerService>;
* agoricNames: Remote<NameHub>;
* }} OrchestrationPowers
*/
* localchain: Remote<LocalChain>;
* orchestrationService: Remote<CosmosInterchainService>;
* storageNode: Remote<StorageNode>;
* timerService: Remote<TimerService>;
* agoricNames: Remote<NameHub>;
* }} OrchestrationPowers
*/

/**
* @param {ZCF<Record<string, unknown>> | undefined} zcf
Expand All @@ -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, {
Expand Down Expand Up @@ -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 */
Expand Down
1 change: 0 additions & 1 deletion contract/src/orca.flows.js
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
15 changes: 4 additions & 11 deletions contract/src/orca.proposal.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { makeTracer } from './tools/debug.js';
// import { atomicTransfer } from '@agoric/zoe/src/contractSupport/index.js';
/// <reference types="@agoric/zoe/src/contractFacet/types-ambient"/>


/**
* @import {ERef} from '@endo/far';
* @import {BootstrapManifest} from '@agoric/vats/src/core/lib-boot.js';
Expand All @@ -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<import('@agoric/vats/src/localchain.js').LocalChain>} LocalChain
*/


const trace = makeTracer('OrCE');
const { entries, fromEntries } = Object;

Expand Down Expand Up @@ -114,16 +111,12 @@ export const startOrcaContract = async (permittedPowers, config) => {
const marshaller = await E(board).getPublishingMarshaller();
console.log(marshaller);





/** @type {StartUpgradableOpts<OrcaSF>} **/
const startOpts = {
label: 'orca',
installation,
terms: undefined,
privateArgs: {
privateArgs: {
localchain: await localchain,
// localchain: await E(localchain),
orchestrationService: await cosmosInterchainService,
Expand Down
4 changes: 1 addition & 3 deletions contract/test/boot-tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -66,7 +64,7 @@ export const mockBootstrapPowers = async (

/**
* @typedef {Record<Keyword, Issuer<any, any>>} IssuerKeywordRecord
*/
*/
const startUpgradable = ({
installation,
issuerKeywordRecord,
Expand Down
2 changes: 1 addition & 1 deletion contract/test/mintStable.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion contract/test/orca-contract.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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`,
Expand Down
10 changes: 7 additions & 3 deletions contract/test/support.js
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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' },
Expand Down
4 changes: 2 additions & 2 deletions contract/test/wallet-tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export const mockWalletFactory = (
const brand = await E(issuer).getBrand();
// /** @type {[Brand, Purse]} */
/** @type {[Brand<any>, Purse<any, any>]} */
const entry = [brand, purse];
const entry = [brand, purse];
return entry;
}),
);
Expand All @@ -65,7 +65,7 @@ export const mockWalletFactory = (

const depositFacet = Far('DepositFacet', {
// /** @param {Payment} pmt */
/** @param {Payment<any, any>} pmt */
/** @param {Payment<any, any>} pmt */

receive: async pmt => {
const pBrand = await E(pmt).getAllegedBrand();
Expand Down
4 changes: 0 additions & 4 deletions contract/tools/e2e-tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,6 @@ const installBundle = async (fullPath, opts) => {
return { tx, confirm: true };
};




/**
* @param {string} address
* @param {Record<string, number | bigint>} balances
Expand Down Expand Up @@ -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 {}
Expand Down
9 changes: 7 additions & 2 deletions contract/tools/queryKit.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,13 @@ export const makeWalletView = (addr, { query, vstorage }) => {
* @param {import('@endo/marshal').Marshal<string | null>} [m]
*/
// export const makeQueryKit = (vstorage, m = makeClientMarshaller()) => {
export const makeQueryKit = (vstorage, m = /** @type {import('@endo/marshal').Marshal<string | null>} */ (makeClientMarshaller())) => {
/** @param {['children' | 'data', string][]} paths */
export const makeQueryKit = (
vstorage,
m = /** @type {import('@endo/marshal').Marshal<string | null>} */ (
makeClientMarshaller()
),
) => {
/** @param {['children' | 'data', string][]} paths */
const batchQuery = async paths =>
batchVstorageQuery(vstorage, m.fromCapData, paths);

Expand Down
23 changes: 21 additions & 2 deletions contract/tools/registry.js
Original file line number Diff line number Diff line change
@@ -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;

Expand Down
4 changes: 2 additions & 2 deletions contract/tools/sleep.js
Original file line number Diff line number Diff line change
@@ -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);
Expand All @@ -13,7 +13,7 @@ const retryUntilCondition = async (
{
maxRetries = 6,
retryIntervalMs = 3500,
log = (msg) => {},
log = msg => {},
setTimeout = ambientSetTimeout,
} = {},
) => {
Expand Down
4 changes: 2 additions & 2 deletions contract/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"outDir": "./dist",
"outDir": "./dist"
},
"include": ["tools", "test"],
"exclude": ["node_modules"]
}
}

0 comments on commit a927fb8

Please sign in to comment.