-
Notifications
You must be signed in to change notification settings - Fork 215
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(inter-protocol): psm-tool CLI, Google Sheets support #6015
Conversation
notes, in progress Set up
|
handles both
|
@dtribble suggested making 1000 trades with this tool. I got as far as making 1 in psm-load.mjs in instagoric 46d29db. |
Managing this on an agoric-sdk branch is awkward because I want to use it to test other branches. a recent version: cc @gibson042 |
Spreadsheet front-end for PSM / walletI made a spreadsheet that works like the cc @rowgraus @nalinbhatt @btulloh @samsiegart @Chris-Hibbert @kennyrowe @turadg |
no longer aimed for the product |
refactor: use types of observedSpendAction feat: miniMarshal chore: separate flags from opts fixup: typeof fetch comment fixup: types for main refactor: parseCapData feat: getOfferState (WIP) fixup: opts / flags
fixup: docs for --addr feat(psm-tool): show purse balances scaled, with petnames - refactor: vstorage.read, storageNode.unserialize, fromBoard feat(psm-tool): format offers nicely fix!(psm-tool): --addr => --wallet, --lookup => --contract - format fee ratios with asPercent() feat!(psm-tool): --wantStable, --giveStable, --feePct fix(psm-tool): include Fee when showing WantStableFee chore(psm-tool): updated PSM, vstorage APIs - PSM API: - split invitation making methods - published.psm.IST.AUSD.governance storage path - handle multi-valued vstorage - a bit of error handling in vstorage query - support local, ollinet, xnet networks - avoid assert module dependency - assert .at(-1) doesn't return undefined
chore(psm-tool): capData debugging fix(psm-tool): fee handling
chore(psm-tool): sync with Google sheet chore(psm-tool): move psm-tool.js to src/ chore(psm-tool): split between script and lib chore(psm-tool): rename Code.js from google sheets refactor(psm-tool): move CLI details out of src/psm-lib.js chore(psm-tool): move Google apps scripts stuff to app/ fixup(psm-tool): duplicate assert in sheets-lib.js feat(psm-tool): simpleWalletState for use in Google Sheets - theWeb fix(psm-tool): avoid xs.last() in Google Apps Script also: - 1_000_000 - 123n build(psm-tool): build, clasp:push chore(psm-tool): ignore google apps scripts config
test(psm-tool): testFormatOffer apps script style(psm-tool): lint refactor(psm-tool): getContractState
feat(psm-tool): updateClock to trigger wallet update
- ignore Google Apps Scripts config
@Chris-Hibbert for voting stuff: https://gist.github.com/dckc/096b2803c33307426ac78484755a51e3 |
throw-away prototype (unless/until we reconsider) |
@arirubinstein @turadg @dtribble @Hibbert I hacked together a quick update to
as well as finding a trade by id:
I like to run it as The single-file form is in a gist: psm-tool |
In my copy of psm-tool, I added const makePSMVoteProposal = (instance, brands, opts, timeStamp) => {
/** @type {OfferSpec} */
const offer = {
id: timeStamp,
invitationSpec: {
source: 'purse',
instance,
publicInvitationMaker: 'VoteOnPauseOffers',
description: 'PSM charter member invitation',
},
proposal: {},
};
/** @type {BridgeAction} */
const spendAction = {
method: 'executeOffer',
offer,
};
return spendAction;
}; and then changed main to look like this: const main = async (argv, { fetch, clock }) => {
const { opts, flags } = parseArgs(argv, ['--contract', '--verbose']);
if (flags.contract || opts.wallet) {
assert(fetch, 'missing fetch API; try --experimental-fetch?');
// @ts-expect-error what's up with typeof fetch???
return online(opts, flags, { fetch });
}
if (!(opts.wantStable || opts.giveStable)) {
console.error(USAGE);
return 1;
}
const fromBoard = makeFromBoard();
const net = networks[opts.net || 'local'];
assert(net, opts.net);
const getJSON = async url => (await fetch(log('url')(net.rpc + url))).json();
const agoricNames = await makeAgoricNames(fromBoard, getJSON);
const instance = agoricNames.instance.psmCharter;
const spendAction = makePSMVoteProposal(
instance,
agoricNames.brand,
// @ts-expect-error
opts,
clock().valueOf(),
);
console.log(JSON.stringify(miniMarshal().serialize(spendAction)));
return 0;
}; We'll clearly need a main that discriminates more options, but this is sufficient to create requests that look like this for me: {"body":"{\"method\":\"executeOffer\",\"offer\":{\"id\":1662759063666,\"invitationSpec\":{\"source\":\"purse\",\"instance\":{\"@qclass\":\"slot\",\"index\":0},\"publicInvitationMaker\":\"VoteOnPauseOffers\",\"description\":\"PSM charter member invitation\"},\"proposal\":{}}}","slots":["board0371"]} Also, can we put |
It's in the Meanwhile, we're garbage-collecting it in favor of #6176 . |
@Chris-Hibbert thanks for the snippet. 8aaedcb incorporates it in 6176. One nice thing about having the code in the repo is type checking works, which errored on the |
fixes: #5119
refs: #3628
todo:
Description
The tool describes itself as follows:
Security Considerations
This tool only reads the chain and formats offers; it relies on
agd
for key management, signing, and broadcasting.Documentation Considerations
???
Testing Considerations
I tested it on xnet manually with a ledger hardware signer (details to appear in subsequent comments).
I'd like someone to reproduce my results.