diff --git a/.github/scripts/changePrice.mjs b/.github/scripts/changePrice.mjs index 981fb8c4..96a57819 100644 --- a/.github/scripts/changePrice.mjs +++ b/.github/scripts/changePrice.mjs @@ -22,25 +22,9 @@ const setAtomPrice = async (amount, containerName, agoricNet) => { AGORIC_NET: agoricNet, }; - const { stdout } = await execa( - 'docker', - [ - 'exec', - containerName, - agops, - 'oracle', - 'setPrice', - '--keys', - 'gov1,gov2', - '--pair', - 'ATOM.USD', - '--price', - amount, - '--keyring-backend', - 'test', - ], - { env }, - ); + const command = `${agops} oracle setPrice --keys gov1,gov2 --pair ATOM.USD --price ${amount} --keyring-backend=test`; + const { stdout } = await execa('docker', ['exec', containerName, command], { env }); + console.log('Standard output:', stdout); } catch (error) { console.error('Error:', error); diff --git a/.github/scripts/createVault.mjs b/.github/scripts/createVault.mjs index 6694c3ec..d4817454 100644 --- a/.github/scripts/createVault.mjs +++ b/.github/scripts/createVault.mjs @@ -2,35 +2,21 @@ import { execa } from 'execa'; const agops = '/usr/src/agoric-sdk/packages/agoric-cli/bin/agops'; -const createVault = async (containerName, agoricNet, commandTimeout, userKey, wantMinted, giveCollateral) => { +const createVault = async (containerName, agoricNet, userKey, wantMinted, giveCollateral) => { console.log('Starting the vault creation process...'); - if (!containerName || !agoricNet || !commandTimeout || !userKey || !wantMinted || !giveCollateral) { - console.error('Error: Missing one or more required parameters:', { - containerName, - agoricNet, - commandTimeout, - userKey, - wantMinted, - giveCollateral, - }); - process.exit(1); - } - - const createVaultCommand = `${agops} vaults open --wantMinted \"${wantMinted}\" --giveCollateral \"${giveCollateral}\" > /tmp/want-ist.json`; - const executeCreateVaultCommand = `docker exec ${containerName} /bin/bash -c "env AGORIC_NET=${agoricNet} timeout ${commandTimeout} ${createVaultCommand}"`; - try { - console.log(`Executing: ${executeCreateVaultCommand}`); - const { stdout: createVaultOutput } = await execa(executeCreateVaultCommand); - console.log('Vault creation output:', createVaultOutput); + const env = { + AGORIC_NET: agoricNet, + }; + + const command = `${agops} vaults open --wantMinted ${wantMinted} --giveCollateral ${giveCollateral} > /tmp/want-ist.json`; + await execa('docker', ['exec', containerName, `bash -c "${command}"`], { env }); - console.log('Executing broadcast command...'); - const broadcastCommand = `timeout ${commandTimeout} ${agops} perf satisfaction --executeOffer /tmp/want-ist.json --from ${userKey} --keyring-backend=test`; - const executeBroadcastCommand = `docker exec ${containerName} bash -c "env AGORIC_NET=${agoricNet} ${broadcastCommand}"`; + const broadCastCommand = `${agops} perf satisfaction --executeOffer /tmp/want-ist.json --from ${userKey} --keyring-backend=test`; + const { stdout } = await execa('docker', ['exec', containerName, broadCastCommand], { env }); - const { stdout: broadcastOutput } = await execa(executeBroadcastCommand); - console.log('Broadcast output:', broadcastOutput); + console.log('Standard output:', stdout); } catch (error) { console.error('Error during vault creation:', error); process.exit(1); @@ -39,9 +25,8 @@ const createVault = async (containerName, agoricNet, commandTimeout, userKey, wa const containerName = process.env.containerName; const agoricNet = process.env.agoricNet; -const commandTimeout = process.env.commandTimeout; const userKey = process.env.userKey; const wantMinted = process.env.wantMinted; const giveCollateral = process.env.giveCollateral; -createVault(containerName, agoricNet, commandTimeout, userKey, wantMinted, giveCollateral); +createVault(containerName, agoricNet, userKey, wantMinted, giveCollateral);