Skip to content

Commit

Permalink
feat(vats): fully-working decentral services
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelfig committed Apr 25, 2021
1 parent e54e13d commit 3525283
Show file tree
Hide file tree
Showing 8 changed files with 111 additions and 20 deletions.
23 changes: 10 additions & 13 deletions packages/vats/decentral-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,40 +7,37 @@
},
"vats": {
"board": {
"sourceSpec": "vat-board.js"
},
"spawner": {
"sourceSpec": "vat-spawner.js"
"sourceSpec": "./src/vat-board.js"
},
"ibc": {
"sourceSpec": "vat-ibc.js"
"sourceSpec": "./src/vat-ibc.js"
},
"mints": {
"sourceSpec": "vat-mints.js"
"sourceSpec": "./src/vat-mints.js"
},
"network": {
"sourceSpec": "vat-network.js"
"sourceSpec": "./src/vat-network.js"
},
"priceAuthority": {
"sourceSpec": "vat-priceAuthority.js"
"sourceSpec": "./src/vat-priceAuthority.js"
},
"provisioning": {
"sourceSpec": "vat-provisioning.js"
"sourceSpec": "./src/vat-provisioning.js"
},
"registrar": {
"sourceSpec": "vat-registrar.js"
"sourceSpec": "./src/vat-registrar.js"
},
"sharing": {
"sourceSpec": "vat-sharing.js"
"sourceSpec": "./src/vat-sharing.js"
},
"zoe": {
"sourceSpec": "vat-zoe.js",
"sourceSpec": "./src/vat-zoe.js",
"parameters": {
"zcfBundleName": "zcf"
}
},
"bootstrap": {
"sourceSpec": "bootstrap.js"
"sourceSpec": "./src/bootstrap.js"
}
}
}
2 changes: 1 addition & 1 deletion packages/vats/exported.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
import './lib/ag-solo/vats/types';
import './src/types';
18 changes: 18 additions & 0 deletions packages/vats/jsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// This file can contain .js-specific Typescript compiler config.
{
"compilerOptions": {
"target": "esnext",

"noEmit": true,
/*
// The following flags are for creating .d.ts files:
"noEmit": false,
"declaration": true,
"emitDeclarationOnly": true,
*/
"downlevelIteration": true,
"strictNullChecks": true,
"moduleResolution": "node",
},
"include": ["src/**/*.js", "exported.js", "globals.d.ts"],
}
79 changes: 79 additions & 0 deletions packages/vats/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
{
"name": "@agoric/vats",
"version": "0.1.0",
"description": "Agoric's Vat library",
"parsers": {
"js": "mjs"
},
"main": "src/bootstrap.js",
"repository": "https://github.com/Agoric/agoric-sdk",
"scripts": {
"build": "exit 0",
"test": "ava",
"test:nyc": "nyc ava",
"test:xs": "exit 0",
"pretty-fix": "prettier --write '**/*.js'",
"pretty-check": "prettier --check '**/*.js'",
"lint-fix": "yarn lint:eslint --fix && yarn lint:types",
"lint-check": "yarn lint",
"lint": "yarn lint:types && yarn lint:eslint",
"lint:types": "tsc -p jsconfig.json",
"lint:eslint": "eslint '**/*.js'"
},
"keywords": [],
"author": "Agoric",
"license": "Apache-2.0",
"dependencies": {
"@agoric/assert": "^0.2.8",
"@agoric/dapp-svelte-wallet": "^0.9.3",
"@agoric/ertp": "^0.10.7",
"@agoric/eventual-send": "^0.13.10",
"@agoric/import-bundle": "^0.2.10",
"@agoric/install-ses": "^0.5.9",
"@agoric/marshal": "^0.4.7",
"@agoric/nat": "^4.0.0",
"@agoric/pegasus": "^0.2.3",
"@agoric/promise-kit": "^0.2.9",
"@agoric/registrar": "^0.2.10",
"@agoric/same-structure": "^0.1.9",
"@agoric/sharing-service": "^0.1.10",
"@agoric/sparse-ints": "^0.1.6",
"@agoric/store": "^0.4.10",
"@agoric/swingset-vat": "^0.16.3",
"@agoric/transform-eventual-send": "^1.4.6",
"@agoric/treasury": "^0.3.3",
"@agoric/zoe": "^0.15.3",
"@babel/generator": "^7.6.4",
"polycrc": "https://github.com/agoric-labs/node-polycrc",
"esm": "^3.2.25"
},
"devDependencies": {
"@agoric/babel-parser": "^7.6.4",
"ava": "^3.12.1",
"nyc": "^15.1.0"
},
"eslintConfig": {
"extends": [
"@agoric"
]
},
"prettier": {
"trailingComma": "all",
"singleQuote": true
},
"publishConfig": {
"access": "public"
},
"engines": {
"node": ">=11.0"
},
"ava": {
"files": [
"test/**/test-*.js"
],
"require": [
"esm"
],
"timeout": "20m"
}
}
3 changes: 0 additions & 3 deletions packages/vats/src/bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,13 @@ export function buildRootObject(vatPowers, vatParameters) {
board,
chainTimerService,
zoe,
contractHost,
{ priceAuthority, adminFacet: priceAuthorityAdmin },
] = await Promise.all([
E(vats.sharing).getSharingService(),
E(vats.registrar).getSharedRegistrar(),
E(vats.board).getBoard(),
E(vats.timer).createTimerService(timerDevice),
/** @type {ERef<ZoeService>} */ (E(vats.zoe).buildZoe(vatAdminSvc)),
E(vats.spawner).buildSpawner(vatAdminSvc),
E(vats.priceAuthority).makePriceAuthority(),
]);

Expand Down Expand Up @@ -471,7 +469,6 @@ export function buildRootObject(vatPowers, vatParameters) {
agoricNames,
chainTimerService,
sharingService,
contractHost,
faucet,
ibcport,
myAddressNameAdmin,
Expand Down
2 changes: 1 addition & 1 deletion packages/vats/test/test-lib-board.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { test } from '@agoric/swingset-vat/tools/prepare-test-env-ava';

import { Far } from '@agoric/marshal';
import { makeBoard } from '../../lib/ag-solo/vats/lib-board';
import { makeBoard } from '../src/lib-board';

test('makeBoard', async t => {
const board = makeBoard();
Expand Down
2 changes: 1 addition & 1 deletion packages/vats/test/test-name-hub.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { test } from '@agoric/swingset-vat/tools/prepare-test-env-ava';

import { makeNameHubKit } from '../../lib/ag-solo/vats/nameHub';
import { makeNameHubKit } from '../src/nameHub';

test('makeNameHubKit - lookup paths', async t => {
const { nameAdmin: na1, nameHub: nh1 } = makeNameHubKit();
Expand Down
2 changes: 1 addition & 1 deletion packages/vats/test/test-repl.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { makeTransform } from '@agoric/transform-eventual-send';
import * as babelParser from '@agoric/babel-parser';
import babelGenerate from '@babel/generator';
import test from 'ava';
import { getReplHandler } from '../../lib/ag-solo/vats/repl';
import { getReplHandler } from '../src/repl';

function make() {
const homeObjects = { base: 1, fries: 2, cooking: 3 };
Expand Down

0 comments on commit 3525283

Please sign in to comment.