From cf7c78cfaff9e9f1e33b41a7ce6241483c285f55 Mon Sep 17 00:00:00 2001 From: William Chong Date: Tue, 19 Oct 2021 21:31:55 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20Rename=20AR=20functions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/util/arweave.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/util/arweave.js b/src/util/arweave.js index 0bfd92bbe..76a84dbb4 100644 --- a/src/util/arweave.js +++ b/src/util/arweave.js @@ -18,7 +18,7 @@ const jwk = require('../../config/arweave-key.json'); const arweave = Arweave.init({ host: 'arweave.net', port: 443, protocol: 'https' }); -export async function getArIdFromHashes(ipfsHash) { +export async function getArweaveIdFromHashes(ipfsHash) { const res = await arweave.arql( { op: 'and', @@ -77,7 +77,7 @@ function generateManifestFile(files, { stub = false } = {}) { export async function estimateARPrice(data) { const { buffer, key } = data; const ipfsHash = await getFileIPFSHash(data); - const id = await getArIdFromHashes(ipfsHash); + const id = await getArweaveIdFromHashes(ipfsHash); if (id) { return { key, @@ -168,7 +168,7 @@ export async function submitToArweave(data, ipfsHash) { export async function uploadFileToArweave(data) { const ipfsHash = await getFileIPFSHash(data); - const id = await getArIdFromHashes(ipfsHash); + const id = await getArweaveIdFromHashes(ipfsHash); if (id) { return { arweaveId: id, @@ -190,7 +190,7 @@ export async function uploadFileToArweave(data) { async function uploadManifestFile(filesWithId) { const manifest = generateManifestFile(filesWithId); const manifestIPFSHash = await getFileIPFSHash(manifest); - let arweaveId = await getArIdFromHashes(manifestIPFSHash); + let arweaveId = await getArweaveIdFromHashes(manifestIPFSHash); if (!arweaveId) { [arweaveId] = await Promise.all([ submitToArweave(manifest, manifestIPFSHash), @@ -213,7 +213,7 @@ export async function uploadFilesToArweave(files) { getFolderIPFSHash(files), Promise.all(files.map(f => getFileIPFSHash(f))), ]); - const arweaveIds = await Promise.all(ipfsHashes.map(h => getArIdFromHashes(h))); + const arweaveIds = await Promise.all(ipfsHashes.map(h => getArweaveIdFromHashes(h))); if (!arweaveIds.some(id => !id)) { const filesWithId = files.map((f, i) => ({ ...f, arweaveId: arweaveIds[i] })); const { manifest, ipfsHash: manifestIPFSHash } = await uploadManifestFile(filesWithId);