Skip to content

Commit

Permalink
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 0652f56 commit 1b2d4c3
Show file tree
Hide file tree
Showing 21 changed files with 138 additions and 387 deletions.
2 changes: 1 addition & 1 deletion contract/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"build:deployer": "rollup -c rollup.config.mjs",
"build:deployer2": "echo \"deployer2\"; agoric run scripts/build-contract-deployer.js",
"deploy": "make dev-working",
"test": "ava --verbose ./test/orca-contract.test.js",
"test": "ava",
"lint": "tsc && eslint '**/*.js'",
"lint:fix": "eslint --fix '**/*.js'",
"_postinstall": "cd node_modules/@noble; npx tsc --init; npm install @noble/hashes; npx tsc; yarn; npm run build"
Expand Down
66 changes: 59 additions & 7 deletions contract/src/orca.contract.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,14 @@ import { Fail } from '@endo/errors';
import { E } from '@endo/far';
import { M } from '@endo/patterns';
import * as flows from './orca.flows.js';

import '@agoric/zoe/src/zoeService/types-ambient.js';
// import {ZCF} from "@agoric/zoe/src/contractFacet/types-ambient.js"
// import '@agoric/zoe/src/zoeService/types-ambient.js';
// import '@agoric/zoe/src/contractFacet/types-ambient.js';
// import '@agoric/vats/src/core/types-ambient.js';
// import '@agoric/vow/src/types.js';
// import { Remote } from '@agoric/internal/src/types.js';
// import '@agoric/orchestration/src/types.js';
// import '@agoric/orchestration/src/exos/int'

/**
* @import {GuestOf} from '@agoric/async-flow';
Expand All @@ -19,8 +25,39 @@ import '@agoric/zoe/src/zoeService/types-ambient.js';
* @import {ZoeTools} from '@agoric/orchestration/src/utils/zoe-tools.js';
* @import {Baggage} from '@agoric/vat-data';
* @import {Zone} from '@agoric/zone';
* @import {Remote} from '@agoric/vow';
* @import {CosmosInterchainService} from '@agoric/orchestration';
* @import {TimerService} from '@agoric/time';
* @import {NameHub} from '@agoric/vats';
*
*/

// /**
// * @typedef {import('@agoric/zoe/src/').ZCF<Record<string, unknown>>} OrcaZCF
// */

/**
* @typedef {import('@agoric/vats/src/localchain.js').LocalChain} LocalChain
* @typedef {import('@agoric/zoe/src/zoeService/utils.js').ContractStartFunction} ContractStartFunction
*/

// /**
// * @typedef {import('@agoric/zoe/src/contractFacet/types-ambient.js').ZCF} ZCF
// */


// /**
// * @typedef {import('@agoric/zoe/src/contractFacet/types-ambient.js').ContractStartFn} ContractStartFunction
// */

/// <reference types="@agoric/vats/src/core/types-ambient"/>
/// <reference types="@agoric/zoe/src/contractFacet/types-ambient"/>

/**
*/



const trace = makeTracer('OrchDev1');

const SingleAmountRecord = M.and(
Expand All @@ -47,7 +84,7 @@ const OrchestrationPowersShape = M.splitRecord({
orchestrationService: M.remotable('orchestrationService'),
storageNode: M.remotable('storageNode'),
timerService: M.remotable('timerService'),
agoricNames: M.remotable('localchagoricNamesain'),
agoricNames: M.remotable('agoricNames'),
});

/** @type {ContractMeta} */
Expand All @@ -61,27 +98,39 @@ export const meta = {
};
harden(meta);


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

/**
* @param {ZCF} zcf
* @param {ZCF<Record<string, unknown>> | undefined} zcf
* @param {OrchestrationPowers & {
* marshaller: Marshaller;
* }} privateArgs
* @param {Zone} zone
* @param {OrchestrationTools} tools
*/
const contract = async (
/** @type {ZCF<Record<string, unknown>>} */
zcf,
privateArgs,
zone,
{ orchestrateAll, vowTools, zoeTools },
) => {
trace('inside start function: v1.1.96');
trace('privateArgs', privateArgs);


// @ts-expect-error XXX ZCFSeat not Passable
const { makeAccount, makeCreateAndFund } = orchestrateAll(flows, {
localTransfer: zoeTools.localTransfer,
setValue: privateArgs.storageNode.setValue,
});

const publicFacet = zone.exo(
Expand All @@ -108,6 +157,9 @@ const contract = async (
return { publicFacet };
};

export const start = withOrchestration(contract);
/** @type {ContractStartFunction} */
export const start = /** @type {ContractStartFunction} */ (withOrchestration(contract));
harden(start);
/** @typedef {typeof start} OrcaSF */

// /** @typedef {typeof start} OrcaSF */
/** @typedef {ContractStartFunction} OrcaSF */
4 changes: 1 addition & 3 deletions contract/src/orca.flows.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,12 @@ harden(makeAccount);
* @param {Orchestrator} orch
* @param {object} ctx
* @param {ZoeTools['localTransfer']} ctx.localTransfer
* @param {StorageNode['setValue']} ctx.setValue
* @param {ZCFSeat} seat
* @param {{ chainName: string, denom: DenomArg }} offerArgs
*/
export const makeCreateAndFund = async (
orch,
{ localTransfer, setValue },
{ localTransfer },
seat,
{ chainName, denom },
) => {
Expand All @@ -66,7 +65,6 @@ export const makeCreateAndFund = async (
trace('amt', amt);
trace('give:', give);

trace('setValue:', setValue);

const [agoric, chain] = await Promise.all([
orch.getChain('agoric'),
Expand Down
36 changes: 31 additions & 5 deletions contract/src/orca.proposal.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,34 @@
import { E } from '@endo/far';
import { installContract } from './platform-goals/start-contract.js';
import { makeTracer } from './tools/debug.js';
// import '@agoric/orchestration/src/types.js';
// import '@agoric/vats/src/types.js';
// import '@agoric/vats/src/localchain.js';
// import '@agoric/vow/src/types.js';

/// <reference types="@agoric/vats/src/core/types-ambient"/>
// 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';
* @import {OrchestrationPowers} from './exos/cosmos-interchain-service.js';
* @import {Remote} from '@agoric/vow';
* @import {OrcaSF} from './orca.contract.js';
*/

/**
* * @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 @@ -93,18 +114,23 @@ export const startOrcaContract = async (permittedPowers, config) => {
const marshaller = await E(board).getPublishingMarshaller();
console.log(marshaller);

/** @type {StartUpgradableOpts<OrcaSF>} */




/** @type {StartUpgradableOpts<OrcaSF>} **/
const startOpts = {
label: 'orca',
installation,
terms: undefined,
privateArgs: {
storageNode,
marshaller,
privateArgs: {
localchain: await localchain,
// localchain: await E(localchain),
orchestrationService: await cosmosInterchainService,
storageNode,
timerService: await chainTimerService,
localchain: await localchain,
agoricNames: await agoricNames,
marshaller,
},
};

Expand Down
Loading

0 comments on commit 1b2d4c3

Please sign in to comment.