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

clean up, release and use #169

Merged
merged 13 commits into from
Aug 27, 2024
6 changes: 6 additions & 0 deletions packages/synthetic-chain/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@
"js": true,
"ts": "module"
},
"environmentVariables": {
"binary": "fake-agd",
"ATOM_DENOM": "uatom",
"CHAINID": "fakechain",
"HOME": "/tmp/fake-home"
},
"nodeArguments": [
"--import=tsimp"
]
Expand Down
4 changes: 2 additions & 2 deletions packages/synthetic-chain/src/lib/agd-lib.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import assert from 'node:assert';
import { ExecFileSyncOptionsWithStringEncoding } from 'node:child_process';
import { CHAINID, VALIDATORADDR } from './constants';
import { agd } from './cliHelper';
import { CHAINID, VALIDATORADDR } from './constants.js';
import { agd } from './cliHelper.js';

const { freeze } = Object;

Expand Down
12 changes: 3 additions & 9 deletions packages/synthetic-chain/src/lib/cliHelper.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { $, execaCommand } from 'execa';
import { BINARY } from './constants.js';
import { BINARY, SDK_ROOT } from './constants.js';

export const executeCommand = async (
command: string,
Expand Down Expand Up @@ -86,10 +86,7 @@ export const agoric = {
},
};

export const { stdout: agopsLocation } = await $({
shell: true,
cwd: '/usr/src/agoric-sdk',
})`yarn bin agops`;
export const agopsLocation = `${SDK_ROOT}/node_modules/.bin/agops`;

export const agops = {
vaults: async (...params: string[]) => {
Expand Down Expand Up @@ -123,10 +120,7 @@ export const agops = {
},
};

export const { stdout: bundleSourceLocation } = await $({
shell: true,
cwd: '/usr/src/agoric-sdk',
})`yarn bin bundle-source`;
export const bundleSourceLocation = `${SDK_ROOT}/node_modules/.bin/bundle-source`;

/**
* @returns Returns the filepath of the bundle
Expand Down
2 changes: 1 addition & 1 deletion packages/synthetic-chain/src/lib/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ export const ATOM_DENOM = NonNullish(process.env.ATOM_DENOM);
export const CHAINID = NonNullish(process.env.CHAINID);
export const HOME = NonNullish(process.env.HOME);

export const SDK_ROOT = '/usr/src/agoric-sdk';
export const SDK_ROOT = process.env.AGORIC_SDK || '/usr/src/agoric-sdk';
101 changes: 101 additions & 0 deletions packages/synthetic-chain/test/snapshots/test-exports.ts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
# Snapshot report for `test/test-exports.ts`
Copy link
Member

Choose a reason for hiding this comment

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

👏 ooh... nifty idea!


The actual snapshot is saved in `test-exports.ts.snap`.

Generated by [AVA](https://avajs.dev).

## exports

> Snapshot 1

@Module {
ATOM_DENOM: 'uatom',
BINARY: 'fake-agd',
CHAINID: 'fakechain',
GOV1ADDR: 'agoric1ee9hr0jyrxhy999y755mp862ljgycmwyp4pl7q',
GOV2ADDR: 'agoric1wrfh296eu2z34p6pah7q04jjuyj3mxu9v98277',
GOV3ADDR: 'agoric1ydzxwh6f893jvpaslmaz6l8j2ulup9a7x8qvvq',
HOME: '/tmp/fake-home',
SDK_ROOT: '/usr/src/agoric-sdk',
USER1ADDR: 'agoric1rwwley550k9mmk6uq6mm6z4udrg8kyuyvfszjk',
VALIDATORADDR: 'agoric1estsewt6jqsx77pwcxkn5ah0jqgu8rhgflwfdl',
addPreexistingOracles: AsyncFunction {},
addUser: AsyncFunction {},
adjustVault: Function adjustVault {},
agd: {
export: AsyncFunction [],
keys: AsyncFunction [],
query: AsyncFunction [],
tx: AsyncFunction [],
},
agops: {
auctioneer: AsyncFunction [],
ec: AsyncFunction [],
oracle: AsyncFunction [],
perf: AsyncFunction [],
vaults: AsyncFunction [],
},
agopsInter: Function agopsInter {},
agopsLocation: '/usr/src/agoric-sdk/node_modules/.bin/agops',
agoric: {
follow: AsyncFunction [],
run: AsyncFunction [],
wallet: AsyncFunction [],
},
bankSend: Function bankSend {},
bundleDetail: Function bundleDetail {},
bundleSource: AsyncFunction {},
bundleSourceLocation: '/usr/src/agoric-sdk/node_modules/.bin/bundle-source',
calculateWalletState: AsyncFunction {},
checkForOracle: AsyncFunction {},
closeVault: Function closeVault {},
createBid: Function createBid {},
dbTool: Function dbTool {},
ensureISTForInstall: AsyncFunction {},
evalBundles: AsyncFunction {},
executeCommand: AsyncFunction {},
executeOffer: AsyncFunction {},
flags: Function flags {},
generateOracleMap: Function generateOracleMap {},
getAuctionCollateral: AsyncFunction {},
getContractInfo: AsyncFunction {},
getISTBalance: AsyncFunction {},
getIncarnation: AsyncFunction {},
getLiveOffers: AsyncFunction {},
getPriceQuote: AsyncFunction {},
getProvisionPoolMetrics: AsyncFunction [],
getUser: AsyncFunction {},
getVatDetails: AsyncFunction {},
getVaultPrices: AsyncFunction {},
installBundle: AsyncFunction {},
loadedBundleIds: Function loadedBundleIds {},
makeAgd: Function makeAgd {},
makeFileRW: Function makeFileRW {},
makeFileRd: Function makeFileRd {},
makeWebCache: Function makeWebCache {},
makeWebRd: Function makeWebRd {},
mintIST: AsyncFunction {},
mkTemp: AsyncFunction {},
newOfferId: AsyncFunction [],
openVault: Function openVault {},
passCoreEvalProposal: AsyncFunction {},
proposalBuilder: AsyncFunction {},
provisionSmartWallet: AsyncFunction {},
pushPrices: AsyncFunction {},
readBundles: AsyncFunction {},
registerOraclesForBrand: AsyncFunction {},
smallCapsContext: Function smallCapsContext {},
staticConfig: {
collateralPrice: 6,
deposit: '10000000ubld',
installer: 'gov1',
proposer: 'validator',
swingstorePath: '~/.agoric/data/agoric/swingstore.sqlite',
},
step: AsyncFunction {},
submitProposal: AsyncFunction {},
txAbbr: Function txAbbr {},
voteLatestProposalAndWait: AsyncFunction {},
waitForBlock: AsyncFunction [],
wellKnownIdentities: AsyncFunction [],
}
Binary file not shown.
7 changes: 7 additions & 0 deletions packages/synthetic-chain/test/test-exports.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import test from 'ava';

import * as lib from '../src/lib/index.js';

test('exports', t => {
t.snapshot(lib);
});