Skip to content
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

feat: install from npm without clone / agoric install / links #8

Merged
merged 10 commits into from
Nov 29, 2023
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ On top of that, we add
Prerequisites: `agoric` CLI from [Installing the Agoric SDK](https://docs.agoric.com/guides/getting-started/). _Work is in progress to address [#3857](https://github.com/Agoric/agoric-sdk/issues/3857), making installing from npm more stragithforward._

```sh
agoric --version
agoric install
cd contract
yarn
yarn test
```
Expand Down
16 changes: 8 additions & 8 deletions contract/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,11 @@
"lint-jessie": "eslint -c '.eslintrc-jessie.js' '**/*.{js,jsx}'"
},
"devDependencies": {
"@endo/bundle-source": "^2.7.0",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need agoric for build:proposal:

   "devDependencies": {
+    "agoric": "^0.21.2-u12.0",
     "@agoric/deploy-script-support": "^0.10.4-u12.0",

"@endo/eslint-plugin": "^0.5.1",
"@endo/init": "^0.5.59",
"@endo/ses-ava": "^0.2.43",
"@agoric/zoe": "^0.26.2",
"@agoric/deploy-script-support": "^0.10.3",
"@agoric/deploy-script-support": "^0.10.4-u12.0",
"@endo/bundle-source": "^2.8.0",
"@endo/eslint-plugin": "^0.5.2",
"@endo/init": "^0.5.60",
"@endo/ses-ava": "^0.2.44",
"@jessie.js/eslint-plugin": "^0.4.0",
"@typescript-eslint/eslint-plugin": "^6.7.0",
"@typescript-eslint/parser": "^6.7.0",
Expand All @@ -49,8 +48,9 @@
"@babel/highlight": "7.22.5"
},
"dependencies": {
"@agoric/ertp": "^0.16.2",
"@endo/far": "^0.2.21",
"@agoric/zoe": "^0.26.3-u12.0",
"@agoric/ertp": "^0.16.3-u12.0",
"@endo/far": "^0.2.22",
"@endo/marshal": "^0.8.9",
"@endo/patterns": "^0.2.5"
},
Expand Down
21 changes: 12 additions & 9 deletions contract/src/gameAssetContract.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
/** @file illustrates using non-vbank assets */
/* eslint @typescript-eslint/no-floating-promises: "warn" */
/** @file Contract to mint and sell Place NFTs for a hypothetical game. */
// @ts-check

// deep import to avoid dependency on all of ERTP, vat-data
import { AmountShape } from '@agoric/ertp/src/typeGuards.js';
import { AmountMath, AssetKind } from '@agoric/ertp/src/amountMath.js';
import { M, getCopyBagEntries } from '@endo/patterns';
import { E, Far } from '@endo/far';
import { Far } from '@endo/far';
// Use the deprecated atomicRearrange API
// for compatibility with mainnet1B.
import { atomicRearrange } from '@agoric/zoe/src/contractSupport/atomicTransfer.js';
import '@agoric/zoe/exported.js';

import { makeTracer } from './debug.js';

Expand Down Expand Up @@ -46,12 +49,12 @@ export const start = async zcf => {

totalPlaces(want.Places) <= 3n || Fail`only 3 places allowed when joining`;

// We use the deprecated stage/reallocate API
// so that we can test this with the version of zoe on mainnet1B.
playerSeat.decrementBy(gameSeat.incrementBy(give));
const tmp = mint.mintGains(want);
playerSeat.incrementBy(tmp.decrementBy(want));
zcf.reallocate(playerSeat, tmp, gameSeat);
atomicRearrange(zcf, [
[playerSeat, gameSeat, give],
[tmp, playerSeat, want],
]);

playerSeat.exit(true);
return 'welcome to the game';
};
Expand Down
17 changes: 12 additions & 5 deletions contract/test/test-contract.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,20 @@

/* eslint-disable import/order -- https://github.com/endojs/endo/issues/1235 */
import { test as anyTest } from './prepare-test-env-ava.js';
import url from 'url';
import { createRequire } from 'module';

import bundleSource from '@endo/bundle-source';
import { unsafeMakeBundleCache } from '@agoric/swingset-vat/tools/bundleTool.js';

import { E } from '@endo/far';
import { makeCopyBag } from '@endo/patterns';
import { AmountMath } from '@agoric/ertp';
import { makeZoeKitForTest } from '@agoric/zoe/tools/setup-zoe.js';
import centralSupplyBundle from '@agoric/vats/bundles/bundle-centralSupply.js';
import { mintStablePayment } from './mintStable.js';

/** @param {string} ref */
const asset = ref => url.fileURLToPath(new URL(ref, import.meta.url));
const myRequire = createRequire(import.meta.url);
/** @param {string} specifier */
const asset = specifier => myRequire.resolve(specifier);

const contractPath = asset(`../src/gameAssetContract.js`);

Expand All @@ -30,9 +31,15 @@ const CENT = UNIT6 / 100n;
* @param {unknown} _t
*/
const makeTestContext = async _t => {
const bundleCache = await unsafeMakeBundleCache('bundles/');
const bundle = await bundleSource(contractPath);
const { zoeService: zoe, feeMintAccess } = makeZoeKitForTest();

const centralSupplyBundle = await bundleCache.load(
asset('@agoric/vats/src/centralSupply.js'),
'centralSupply',
);

const centralSupply = await E(zoe).install(centralSupplyBundle);

const stableIssuer = await E(zoe).getFeeIssuer();
Expand All @@ -53,7 +60,7 @@ const makeTestContext = async _t => {
return { zoe, bundle, faucet };
};

test.before(async t => (t.context = await makeTestContext()));
test.before(async t => (t.context = await makeTestContext(t)));

test('buy some game places', async t => {
const { zoe, bundle, faucet } = t.context;
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
"@babel/highlight": "7.22.5"
},
"scripts": {
"preinstall": "node -e \"process.env.AGORIC_INSTALL && process.exit(0); console.warn('please use: agoric install . For details, see https://agoric.com/documentation/'); process.exit(1)\"",
"lint": "yarn workspaces run lint",
"test": "yarn workspaces run test",
"build": "yarn workspaces run build"
Expand Down
8 changes: 1 addition & 7 deletions ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,7 @@
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"build:contract": "cd contract; yarn",
"build:proposal": "yarn build:contract; HOME=$PWD/dist; cd contract; yarn build:proposal",
"start:docker": "docker-compose up -d",
"docker:logs": "docker-compose logs --tail 200 -f",
"docker:bash": "docker-compose exec agd bash",
"docker:make": "docker-compose exec agd make -C /workspace/contract",
"make:help": "echo 'USAGE: yarn docker:make TARGET\nwhere TARGET is one of...'; cd contract; make list",
"test": "exit 0",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview"
},
Expand Down
95 changes: 67 additions & 28 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -74,25 +74,25 @@
dependencies:
protobufjs "^7.0.0"

"@agoric/deploy-script-support@^0.10.3":
version "0.10.3"
resolved "https://registry.yarnpkg.com/@agoric/deploy-script-support/-/deploy-script-support-0.10.3.tgz#6c0d3e7869b7f3abe1814a07332d2d39e05d53c7"
integrity sha512-X4Ory0ildhpDNVO5l64nA1MQqepTR8jGICp7EJisSE2sWRPaDX3Wy+Y/K8JPKoETBhxgw7w1Nt0nay6UEl18Tg==
"@agoric/deploy-script-support@^0.10.4-u12.0":
version "0.10.4-u12.0"
resolved "https://registry.yarnpkg.com/@agoric/deploy-script-support/-/deploy-script-support-0.10.4-u12.0.tgz#6f92da96b9689d11957864eb84180fadab704b2b"
integrity sha512-d6E9Uqd/yEKY5fmKCBF0LPZGcWjeCjIofA6uDfcNw72BLerj/wjkXTZDAz4cIOFYjYkDdXD40sTIHaaRiMLGLg==
dependencies:
"@agoric/assert" "^0.6.0"
"@agoric/ertp" "^0.16.2"
"@agoric/import-manager" "^0.3.11"
"@agoric/internal" "^0.3.2"
"@agoric/notifier" "^0.6.2"
"@agoric/store" "^0.9.2"
"@agoric/zoe" "^0.26.2"
"@endo/base64" "^0.2.31"
"@endo/bundle-source" "^2.5.1"
"@endo/far" "^0.2.18"
"@endo/marshal" "^0.8.5"
"@endo/nat" "^4.1.27"
"@endo/promise-kit" "^0.2.56"
"@endo/zip" "^0.2.31"
"@agoric/assert" "^0.6.1-u11wf.0"
"@agoric/ertp" "^0.16.3-u12.0"
"@agoric/import-manager" "^0.3.12-u12.0"
"@agoric/internal" "^0.4.0-u12.0"
"@agoric/notifier" "^0.6.3-u12.0"
"@agoric/store" "^0.9.3-u12.0"
"@agoric/zoe" "^0.26.3-u12.0"
"@endo/base64" "0.2.31"
"@endo/bundle-source" "2.5.2-upstream-rollup"
"@endo/far" "0.2.18"
"@endo/marshal" "0.8.5"
"@endo/nat" "4.1.27"
"@endo/promise-kit" "0.2.56"
"@endo/zip" "0.2.31"

"@agoric/ertp@^0.16.2":
version "0.16.2"
Expand All @@ -110,6 +110,22 @@
"@endo/nat" "^4.1.27"
"@endo/promise-kit" "^0.2.56"

"@agoric/ertp@^0.16.3-u12.0":
version "0.16.3-u12.0"
resolved "https://registry.yarnpkg.com/@agoric/ertp/-/ertp-0.16.3-u12.0.tgz#276efde19131d1f3a339e7d98efee064d9d4ebec"
integrity sha512-g9dzcY94SuOdMi+RGYAffOVA/BmSzTv/t4KzKwZlAUZrgZ2E88z6REnpkvdzT5fK9M+D5PHejjbfwQnyx6upPA==
dependencies:
"@agoric/assert" "^0.6.1-u11wf.0"
"@agoric/notifier" "^0.6.3-u12.0"
"@agoric/store" "^0.9.3-u12.0"
"@agoric/swingset-vat" "^0.32.3-u12.0"
"@agoric/vat-data" "^0.5.3-u12.0"
"@endo/eventual-send" "0.17.2"
"@endo/far" "0.2.18"
"@endo/marshal" "0.8.5"
"@endo/nat" "4.1.27"
"@endo/promise-kit" "0.2.56"

"@agoric/eventual-send@^0.14.1":
version "0.14.1"
resolved "https://registry.yarnpkg.com/@agoric/eventual-send/-/eventual-send-0.14.1.tgz#b414888bed67cf003a61bd22da30a70f79b8f9dc"
Expand Down Expand Up @@ -137,10 +153,10 @@
"@endo/nat" "^4.1.27"
"@endo/promise-kit" "^0.2.56"

"@agoric/import-manager@^0.3.11":
version "0.3.11"
resolved "https://registry.yarnpkg.com/@agoric/import-manager/-/import-manager-0.3.11.tgz#132ccd031e1036fac7711738f0606d9053b5ddd4"
integrity sha512-GnW+rsuV0F7qHYrZrL4PmOkvNtu6FPG7z9kctfjBE41UNYLC1Frd3zIquoo1vKLiSEOZEdwPWO8tE8nIk5/1Bw==
"@agoric/import-manager@^0.3.12-u12.0":
version "0.3.12-u12.0"
resolved "https://registry.yarnpkg.com/@agoric/import-manager/-/import-manager-0.3.12-u12.0.tgz#0c3e5144ce35c64e2208c2373eafff72ba512f9d"
integrity sha512-p5Cyf8uEpUwsHlRCUSQUnM7rVdn/VBk0vMceo2A4ESKT127HmhYhbggx/4KzmcweU1miFvONglIRcdCyN52EHQ==

"@agoric/inter-protocol@^0.16.1":
version "0.16.1"
Expand Down Expand Up @@ -208,7 +224,7 @@
"@endo/marshal" "^0.8.5"
"@endo/promise-kit" "^0.2.56"

"@agoric/notifier@^0.6.3-dev-8c14632.0":
"@agoric/notifier@^0.6.3-dev-8c14632.0", "@agoric/notifier@^0.6.3-u12.0":
version "0.6.3-u12.0"
resolved "https://registry.yarnpkg.com/@agoric/notifier/-/notifier-0.6.3-u12.0.tgz#521393a073ca7f5c900af3dd818061a928d26089"
integrity sha512-9axwVeBHTZhvkSeK73+xDaEQAYk75tIH71/Diw98rohWiaJ2ZcHZgiwlgn4CLC+++bY312cxAGKDiuLtU6CedA==
Expand Down Expand Up @@ -620,6 +636,29 @@
"@endo/patterns" "^0.2.2"
"@endo/promise-kit" "^0.2.56"

"@agoric/zoe@^0.26.3-u12.0":
version "0.26.3-u12.0"
resolved "https://registry.yarnpkg.com/@agoric/zoe/-/zoe-0.26.3-u12.0.tgz#ca478b7f5219ae2c8ec20f9a85aca1facd8e6ec0"
integrity sha512-OznJJxbzRvOy4E8NJc3/zqasCleTJ8in/7ebrw7DyQAYaHg4e4wsV7a/Uuy1BUbB0h061saqVlhOM9xg1r0zhg==
dependencies:
"@agoric/assert" "^0.6.1-u11wf.0"
"@agoric/ertp" "^0.16.3-u12.0"
"@agoric/internal" "^0.4.0-u12.0"
"@agoric/notifier" "^0.6.3-u12.0"
"@agoric/store" "^0.9.3-u12.0"
"@agoric/swingset-vat" "^0.32.3-u12.0"
"@agoric/time" "^0.3.3-u12.0"
"@agoric/vat-data" "^0.5.3-u12.0"
"@endo/bundle-source" "2.5.2-upstream-rollup"
"@endo/captp" "3.1.1"
"@endo/eventual-send" "0.17.2"
"@endo/far" "0.2.18"
"@endo/import-bundle" "0.3.4"
"@endo/marshal" "0.8.5"
"@endo/nat" "4.1.27"
"@endo/patterns" "0.2.2"
"@endo/promise-kit" "0.2.56"

"@agoric/zone@^0.2.2":
version "0.2.2"
resolved "https://registry.yarnpkg.com/@agoric/zone/-/zone-0.2.2.tgz#df5cc091d4a83842b87888e74159a723a424a82e"
Expand Down Expand Up @@ -1115,7 +1154,7 @@
rollup "^2.79.1"
source-map "^0.7.3"

"@endo/bundle-source@^2.5.1", "@endo/bundle-source@^2.7.0":
"@endo/bundle-source@^2.5.1", "@endo/bundle-source@^2.8.0":
version "2.8.0"
resolved "https://registry.yarnpkg.com/@endo/bundle-source/-/bundle-source-2.8.0.tgz#56f25b3d9c74d3d0bede5c526647aaf02c0a8f94"
integrity sha512-nDiM3u/LKWq5xAnJ+zm35HC6kMKF3IG6Y5V0385slFHZVT8mXzRJ5ztEqRsVzvVeITfz3ZRFOaFer6v4V8Lkjg==
Expand Down Expand Up @@ -1211,7 +1250,7 @@
resolved "https://registry.yarnpkg.com/@endo/env-options/-/env-options-0.1.4.tgz#e516bc3864f00b154944e444fb8996a9a0c23a45"
integrity sha512-Ol8ct0aW8VK1ZaqntnUJfrYT59P6Xn36XPbHzkqQhsYkpudKDn5ILYEwGmSO/Ff+XJjv/pReNI0lhOyyrDa9mg==

"@endo/eslint-plugin@^0.5.1":
"@endo/eslint-plugin@^0.5.2":
version "0.5.2"
resolved "https://registry.yarnpkg.com/@endo/eslint-plugin/-/eslint-plugin-0.5.2.tgz#835d22e9ff17d9935f7f565e50a21ef07aa92ca2"
integrity sha512-WzQmzBXoGGm5vb2mX/Ho9dS5wSaajmeE2PnFqiBUwPQ5ml7B0T7/QwzV5MSAv1ClyzDt3t5j36ENWxeibb2C9Q==
Expand Down Expand Up @@ -1259,7 +1298,7 @@
"@endo/eventual-send" "^0.17.2"
"@endo/pass-style" "^0.1.3"

"@endo/far@^0.2.18", "@endo/far@^0.2.21", "@endo/far@^0.2.22", "@endo/far@^0.2.3":
"@endo/far@^0.2.18", "@endo/far@^0.2.22", "@endo/far@^0.2.3":
version "0.2.22"
resolved "https://registry.yarnpkg.com/@endo/far/-/far-0.2.22.tgz#fda187289a903ee3f9d6dcc5664ee7fef1994b1f"
integrity sha512-LFOicqyHslKOSk/H5EfGOcw347ftDSwYHARPasnrG4UJOEkcU1ZG5bN/BmfONtcidB776gWZKrV/tNl4WLIlyw==
Expand Down Expand Up @@ -1293,7 +1332,7 @@
"@endo/lockdown" "^0.1.28"
"@endo/promise-kit" "^0.2.56"

"@endo/init@^0.5.56", "@endo/init@^0.5.59", "@endo/init@^0.5.60":
"@endo/init@^0.5.56", "@endo/init@^0.5.60":
version "0.5.60"
resolved "https://registry.yarnpkg.com/@endo/init/-/init-0.5.60.tgz#e78051b13cd4a04c72d5ec1d2a6011b7f987f7ff"
integrity sha512-AbAvs6Nk01fyJ+PaW0RzwemIWyomjzDf8ZEhVa3jCOhr8kBBsTnJdX0v7XkbZ/Y8NQxlrFaW0fPqlJK6aMWTlQ==
Expand Down Expand Up @@ -1413,7 +1452,7 @@
dependencies:
ses "^0.18.4"

"@endo/ses-ava@^0.2.43":
"@endo/ses-ava@^0.2.44":
version "0.2.44"
resolved "https://registry.yarnpkg.com/@endo/ses-ava/-/ses-ava-0.2.44.tgz#b97b0d5a457b30b73c74b19091d67840984cf47e"
integrity sha512-Pp0os/ZN7r0L94eCxWFYhSWt+DIdIASIVlY4oYCwMLxLa28cuswCjRQvPKLINBpZezogCKKptEWJTyHhGWpVQw==
Expand Down