diff --git a/apps/batch-sim/index.js b/apps/batch-sim/index.js index f154158653546cd5ee62b792cee212205d26a97e..3aa975010502986f4fe776f30d98ec711900765d 100644 --- a/apps/batch-sim/index.js +++ b/apps/batch-sim/index.js @@ -41,16 +41,23 @@ const simulateCycle = async (arg1, cmd) => { batchId = await createAssetAndSendToCone(apiClient, "simulated asset 2") batchId = await createAssetAndSendToCone(apiClient, "simulated asset 3") - const stockId = await sendToStock(apiClient, { assetId: batchId }) + const selectedStock = await sendToStock(apiClient, { assetId: batchId }) await signInAs(apiClient, otherArgs.cement1User, password) - await bidAsset(apiClient, { assetId: stockId, quantity: 1000, price: 2 }) + await bidAsset(apiClient, { + assetId: selectedStock.id, + price: 2 + }) await signInAs(apiClient, otherArgs.cement2User, password) - await bidAsset(apiClient, { assetId: stockId, quantity: 500, price: 3 }) + await bidAsset(apiClient, { + assetId: selectedStock.id, + quantity: selectedStock.quantity - 500, + price: 3 + }) await signInAs(apiClient, otherArgs.sidenorUser, password) - await acceptBid(apiClient, { assetId: stockId }) + await acceptBid(apiClient, { assetId: selectedStock.id }) } const program = createCLIApp() diff --git a/apps/cement-cli/lib.js b/apps/cement-cli/lib.js index d76da1924639e51385f591c48cacaa1531234335..6f1b0a4abae25d18c8eff6e2def1260020a8fac9 100644 --- a/apps/cement-cli/lib.js +++ b/apps/cement-cli/lib.js @@ -11,6 +11,7 @@ const bidAsset = async ( const biddableAssets = await apiClient.getBiddableAssets() const assetId = paramAssetId || (await promptAssetSelection(biddableAssets)) + const assetToBid = biddableAssets.find(({ id }) => id === assetId) let chosenQuantity = quantity if (!quantity) { @@ -18,19 +19,19 @@ const bidAsset = async ( { type: "number", name: "inputQuantity", - message: "Choose an ammount of slag" + message: `Choose an ammount of slag (in ${assetToBid.units}, max ${assetToBid.quantity}):` } ]) chosenQuantity = inputQuantity } let chosenPrice = price - if (!quantity) { + if (!price) { const { inputPrice } = await inquirer.prompt([ { type: "number", name: "inputPrice", - message: "Provide the offered price" + message: "Provide the offered price (in €):" } ]) chosenPrice = inputPrice diff --git a/apps/sidenor-cli/lib.js b/apps/sidenor-cli/lib.js index 1e87a8282a6081e77227f94b928b7165f44bd4c5..4e6fd7a3c15996e693206333888ecbf7e9505c7d 100644 --- a/apps/sidenor-cli/lib.js +++ b/apps/sidenor-cli/lib.js @@ -169,7 +169,7 @@ const sendToStock = async (apiClient, { assetId: paramAssetId }) => { console.log("Moved to stock", newStockAsset.id) - return newStockAsset.id + return newStockAsset } const bidResponse =