-
Notifications
You must be signed in to change notification settings - Fork 206
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
9693 lint flow #9726
9693 lint flow #9726
Changes from all commits
6d93548
9d001a5
d283cdd
cf4ce90
a74b32b
05b7ba1
371fa94
1a91e7b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,6 +61,6 @@ | |
"workerThreads": false | ||
}, | ||
"typeCoverage": { | ||
"atLeast": 76.94 | ||
"atLeast": 77.01 | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -92,6 +92,6 @@ | |
"access": "public" | ||
}, | ||
"typeCoverage": { | ||
"atLeast": 98.09 | ||
"atLeast": 98.05 | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,7 @@ import { preparePortfolioHolder } from '../exos/portfolio-holder-kit.js'; | |
* @import {Remote} from '@agoric/vow'; | ||
* @import {Zone} from '@agoric/zone'; | ||
* @import {GuestInterface} from '@agoric/async-flow'; | ||
* @import {CosmosValidatorAddress, Orchestrator, CosmosInterchainService, Denom, OrchestrationAccount, StakingAccountActions} from '@agoric/orchestration'; | ||
* @import {CosmosValidatorAddress, Orchestrator, CosmosInterchainService, Denom, OrchestrationAccount, StakingAccountActions, OrchestrationFlow} from '@agoric/orchestration'; | ||
* @import {MakeStakingTap} from './auto-stake-it-tap-kit.js'; | ||
* @import {MakePortfolioHolder} from '../exos/portfolio-holder-kit.js'; | ||
* @import {ChainHub} from '../exos/chain-hub.js'; | ||
|
@@ -35,6 +35,7 @@ import { preparePortfolioHolder } from '../exos/portfolio-holder-kit.js'; | |
*/ | ||
|
||
/** | ||
* @satisfies {OrchestrationFlow} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
* @param {Orchestrator} orch | ||
* @param {{ | ||
* makeStakingTap: MakeStakingTap; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ import { Fail } from '@endo/errors'; | |
import { E } from '@endo/far'; | ||
import { M } from '@endo/patterns'; | ||
import { withOrchestration } from '../utils/start-helper.js'; | ||
import { orchestrationFns } from './sendAnywhereFlows.js'; | ||
import * as flows from './sendAnywhere.flows.js'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
import { prepareChainHubAdmin } from '../exos/chain-hub-admin.js'; | ||
|
||
/** | ||
|
@@ -76,7 +76,7 @@ const contract = async ( | |
); | ||
|
||
// orchestrate uses the names on orchestrationFns to do a "prepare" of the associated behavior | ||
const orchFns = orchestrateAll(orchestrationFns, { | ||
const orchFns = orchestrateAll(flows, { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
zcf, | ||
contractState, | ||
localTransfer: zoeTools.localTransfer, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import { M, mustMatch } from '@endo/patterns'; | ||
|
||
/** | ||
* @import {GuestOf} from '@agoric/async-flow'; | ||
* @import {VBankAssetDetail} from '@agoric/vats/tools/board-utils.js'; | ||
* @import {ZoeTools} from '../utils/zoe-tools.js'; | ||
* @import {Orchestrator, LocalAccountMethods, OrchestrationAccountI, OrchestrationFlow} from '../types.js'; | ||
*/ | ||
|
||
const { entries } = Object; | ||
|
||
// in guest file (the orchestration functions) | ||
// the second argument is all the endowments provided | ||
|
||
/** | ||
* @satisfies {OrchestrationFlow} | ||
* @param {Orchestrator} orch | ||
* @param {object} ctx | ||
* @param {{ account?: OrchestrationAccountI & LocalAccountMethods }} ctx.contractState | ||
* @param {GuestOf<ZoeTools['localTransfer']>} ctx.localTransfer | ||
* @param {(brand: Brand) => Promise<VBankAssetDetail>} ctx.findBrandInVBank | ||
* @param {ZCFSeat} seat | ||
* @param {{ chainName: string; destAddr: string }} offerArgs | ||
*/ | ||
export async function sendIt( | ||
orch, | ||
{ contractState, localTransfer, findBrandInVBank }, | ||
seat, | ||
offerArgs, | ||
) { | ||
mustMatch(offerArgs, harden({ chainName: M.scalar(), destAddr: M.string() })); | ||
const { chainName, destAddr } = offerArgs; | ||
// NOTE the proposal shape ensures that the `give` is a single asset | ||
const { give } = seat.getProposal(); | ||
const [[_kw, amt]] = entries(give); | ||
const { denom } = await findBrandInVBank(amt.brand); | ||
const chain = await orch.getChain(chainName); | ||
|
||
if (!contractState.account) { | ||
const agoricChain = await orch.getChain('agoric'); | ||
contractState.account = await agoricChain.makeAccount(); | ||
} | ||
|
||
const info = await chain.getChainInfo(); | ||
const { chainId } = info; | ||
assert(typeof chainId === 'string', 'bad chainId'); | ||
|
||
await localTransfer(seat, contractState.account, give); | ||
|
||
await contractState.account.transfer( | ||
{ denom, value: amt.value }, | ||
{ | ||
value: destAddr, | ||
encoding: 'bech32', | ||
chainId, | ||
}, | ||
); | ||
} | ||
harden(sendIt); |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/** | ||
* @file Module with linting errors, to verify the linting config detects them. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👏 |
||
* This assumes `reportUnusedDisableDirectives` is enabled in the local | ||
* config. | ||
*/ | ||
|
||
// TODO error on exports that: | ||
// - aren't hardened (probably a new rule in @endo/eslint-plugin ) | ||
// - don't satisfy orchestration flow type | ||
|
||
// eslint-disable-next-line no-restricted-syntax -- intentional for test | ||
import { E } from '@endo/far'; | ||
|
||
export function notFlow() { | ||
console.log('This function is not a flow'); | ||
} | ||
|
||
export async function notHardened() { | ||
console.log('This function is the most minimal flow, but it’s not hardened'); | ||
} | ||
|
||
export async function usesE(orch, { someEref }) { | ||
// eslint-disable-next-line no-restricted-syntax -- intentional for test | ||
await E(someEref).foo(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
only skimmed this