Skip to content

Commit 9a3dfbc

Browse files
committed
log loaded config file
1 parent 76ee685 commit 9a3dfbc

File tree

4 files changed

+10
-11
lines changed

4 files changed

+10
-11
lines changed

cli/src/commands/config.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,12 @@ function parseConfigFile(filePath: string): Config {
3131
if (filePath !== DEFAULT_CONFIG_FILE) {
3232
throw new Error(`Config file not found: ${filePath}`)
3333
}
34+
console.log(`No config file found, using default config`)
3435
return DEFAULT_CONFIG
3536
}
3637
try {
3738
const config = JSON.parse(readFileSync(filePath, 'utf-8'))
39+
console.log(`Using config file: ${filePath}`)
3840
return { ...config, metadatas: makeMetadataArray(config.metadatas) }
3941
} catch (error) {
4042
throw new Error(`Failed to parse file: ${error}`)

cli/src/lib/website/filesInit.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ export async function sendFilesInits(
141141

142142
calls.push({
143143
sc,
144-
functionName: functionName,
144+
functionName,
145145
args,
146146
options: {
147147
coins: coins <= 0n ? 0n : coins,

cli/src/lib/website/read.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { PublicProvider, U32 } from '@massalabs/massa-web3'
1+
import { bytesToStr, PublicProvider, U32 } from '@massalabs/massa-web3'
22
import { sha256 } from 'js-sha256'
33

44
import {
@@ -30,7 +30,7 @@ export async function listFiles(
3030
if (!location) {
3131
notFoundKeys.push(allStorageKeys[i])
3232
} else {
33-
files.push(String.fromCharCode(...new Uint8Array(location)))
33+
files.push(bytesToStr(location))
3434
}
3535
})
3636

cli/src/tasks/estimations.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,20 @@ export function showEstimatedCost(): ListrTask {
1616
title: 'Estimated upload cost',
1717
skip: (ctx: UploadCtx) => ctx.batches.length === 0,
1818
task: async (ctx: UploadCtx, task) => {
19-
const totalEstimatedGas = ctx.batches.reduce((sum, batch) => {
19+
let totalBytes = 0
20+
21+
const chunkStorageCosts = ctx.batches.reduce((sum, batch) => {
2022
const cost = batch.chunks.reduce((sum, chunk) => {
23+
totalBytes += chunk.data.length
2124
return sum + computeChunkCost(chunk.location, chunk.index, chunk.data)
2225
}, 0n)
2326
return sum + cost
2427
}, 0n)
2528

26-
const totalBytes = ctx.batches.reduce(
27-
(sum, batch) =>
28-
sum + batch.chunks.reduce((sum, chunk) => sum + chunk.data.length, 0),
29-
0
30-
)
31-
3229
const opFees = ctx.minimalFees * BigInt(ctx.batches.length)
3330

3431
ctx.currentTotalEstimation += opFees
35-
ctx.currentTotalEstimation += totalEstimatedGas
32+
ctx.currentTotalEstimation += chunkStorageCosts
3633
if (!ctx.sc) {
3734
ctx.currentTotalEstimation += deployCost(ctx.provider, ctx.minimalFees)
3835
}

0 commit comments

Comments
 (0)