Skip to content

Commit

Permalink
feat(psm-tool): format agd commands to execute PSM trade
Browse files Browse the repository at this point in the history
  • Loading branch information
dckc committed Sep 2, 2022
1 parent 072d2df commit 558651f
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions packages/psm-tool/app/psm-sheets-lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,16 @@ const testContract = async () => {
};

const simpleWalletState = async (addr, origin) => {
const state = await getWalletState(addr, fromBoard, theWeb(origin));
const { getJSON } = theWeb(origin);
const state = await getWalletState(addr, fromBoard, { getJSON });
const agoricNames = await makeAgoricNames(fromBoard, getJSON);
return [
...simplePurseBalances(state.purses).map(([val, brand]) => [
'purse',
val,
brand,
]),
...simpleOffers(state),
...simpleOffers(state, agoricNames),
];
};

Expand All @@ -77,6 +79,20 @@ const testFormatOffer = () => {
console.log(offer);
};

const formatCommands = (action, fromAddr, node, chainId) => {
const script = `read -r -d '' psmTrade <<'EOF'
${action}
EOF
agd tx swingset wallet-action --allow-spend "$psmTrade" --from ${fromAddr} --node=${node} --chain-id=${chainId}
`;
return script;
};

function testFormatCommands() {
const actual = formatCommands('{give}', 'agoric123', 'https://rpc');
console.log(actual);
}

function votingPower() {
const stuff = UrlFetchApp.fetch('https://ollinet.rpc.agoric.net/status?');
const data = JSON.parse(stuff);
Expand Down

0 comments on commit 558651f

Please sign in to comment.