diff --git a/packages/synthetic-chain/package.json b/packages/synthetic-chain/package.json index d3894e5b..5f711bf7 100644 --- a/packages/synthetic-chain/package.json +++ b/packages/synthetic-chain/package.json @@ -1,6 +1,6 @@ { "name": "@agoric/synthetic-chain", - "version": "0.0.10", + "version": "0.1.0", "description": "Utilities to build a chain and test proposals atop it", "bin": { "synthetic-chain": "dist/cli/cli.js" diff --git a/packages/synthetic-chain/src/lib/core-eval-support.ts b/packages/synthetic-chain/src/lib/core-eval-support.ts index fcbfc770..13355edf 100644 --- a/packages/synthetic-chain/src/lib/core-eval-support.ts +++ b/packages/synthetic-chain/src/lib/core-eval-support.ts @@ -36,29 +36,6 @@ export const getContractInfo = async (path: string, io = {} as any) => { return m.fromCapData({ body, slots }); }; -// not really core-eval related -export const testIncludes = ( - t: ExecutionContext, - needle: unknown, - haystack: unknown[], - label: string, - sense = true, -) => { - t.log(needle, sense ? 'in' : 'not in', haystack.length, label, '?'); - const check = sense ? t.deepEqual : t.notDeepEqual; - if (sense) { - t.deepEqual( - haystack.filter(c => c === needle), - [needle], - ); - } else { - t.deepEqual( - haystack.filter(c => c === needle), - [], - ); - } -}; - /** * @param record - e.g. { color: 'blue' } * @returns e.g. ['--color', 'blue'] diff --git a/packages/synthetic-chain/src/lib/vstorage.js b/packages/synthetic-chain/src/lib/vstorage.js deleted file mode 100644 index 911d10de..00000000 --- a/packages/synthetic-chain/src/lib/vstorage.js +++ /dev/null @@ -1,40 +0,0 @@ -import { assert, Fail } from './assert.js'; - -const { freeze: harden } = Object; // XXX - -// from '@agoric/internal/src/lib-chainStorage.js'; -const isStreamCell = cell => - cell && - typeof cell === 'object' && - Array.isArray(cell.values) && - typeof cell.blockHeight === 'string' && - /^0$|^[1-9][0-9]*$/.test(cell.blockHeight); -harden(isStreamCell); - -/** - * Extract one value from a the vstorage stream cell in a QueryDataResponse - * - * @param {object} data - * @param {number} [index] index of the desired value in a deserialized stream cell - * - * XXX import('@agoric/cosmic-proto/vstorage/query').QueryDataResponse doesn't worksomehow - * @typedef {Awaited>} QueryDataResponseT - */ -export const extractStreamCellValue = (data, index = -1) => { - const { value: serialized } = data; - - serialized.length > 0 || Fail`no StreamCell values: ${data}`; - - const streamCell = JSON.parse(serialized); - if (!isStreamCell(streamCell)) { - throw Fail`not a StreamCell: ${streamCell}`; - } - - const { values } = streamCell; - values.length > 0 || Fail`no StreamCell values: ${streamCell}`; - - const value = values.at(index); - assert.typeof(value, 'string'); - return value; -}; -harden(extractStreamCellValue);