From 3bc1698e2f732a581868a98b5f23cdf85fa8c24e Mon Sep 17 00:00:00 2001 From: liu9293 Date: Wed, 14 Dec 2022 00:20:02 +0800 Subject: [PATCH] fix temp --- src/wallet/index.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/wallet/index.js b/src/wallet/index.js index bbe5ecd..9e03188 100644 --- a/src/wallet/index.js +++ b/src/wallet/index.js @@ -27,12 +27,17 @@ export async function callContractMethod ({ const pathBuffer = path ? Buffer.from(path) : '' if (method === 'upload') { - await contract.upload(pathBuffer, file) + const uploadResult = await contract.upload(pathBuffer, file) + console.error(`=== upload file ${path} result ===`) + console.error(uploadResult) } if (method === 'download') { const res = await contract.download(pathBuffer) const buf = Buffer.from(res[0].slice(2), 'hex') + + console.error(`=== download file ${path} result ===`) + console.error(buf.toString('utf-8')) return buf } @@ -42,10 +47,12 @@ export async function callContractMethod ({ if (method === 'listRefs') { const res = await contract.listRefs() - const refs = res.map(i => ({ + let refs = res.map(i => ({ ref: i[1], sha: i[0].slice(2) })) + + refs = refs.concat([{ ref: 'HEAD', sha: 'refs/heads/main' }]) return refs } }