Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/five-needles-mix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@thirdweb-dev/auth": patch
"thirdweb": patch
---

Fix deploy/release CLI uploads
15 changes: 6 additions & 9 deletions packages/cli/src/common/processor.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { THIRDWEB_URL, cliVersion } from "../constants/urls";
import { cliVersion, THIRDWEB_URL } from "../constants/urls";
import build from "../core/builder/build";
import detect from "../core/detection/detect";
import { execute } from "../core/helpers/exec";
Expand Down Expand Up @@ -142,10 +142,9 @@ export async function processProject(
const metadataURIs = await Promise.all(
selectedContracts.map(async (c) => {
logger.debug(`Uploading ${c.name}...`);
const hash = await storage.upload(c.metadata, {
return await storage.upload(JSON.parse(c.metadata), {
uploadWithoutDirectory: true,
});
return `ipfs://${hash}`;
}),
);

Expand Down Expand Up @@ -173,15 +172,13 @@ export async function processProject(
let combinedURIs: string[] = [];
if (combinedContents.length === 1) {
// use upload single if only one contract to get a clean IPFS hash
const metadataUri = await storage.upload(
JSON.stringify(combinedContents[0]),
{ uploadWithoutDirectory: true },
);
const metadataUri = await storage.upload(combinedContents[0], {
uploadWithoutDirectory: true,
});
combinedURIs.push(metadataUri);
} else {
// otherwise upload batch
const uris = await storage.uploadBatch(combinedContents);
combinedURIs = uris;
combinedURIs = await storage.uploadBatch(combinedContents);
}

loader.succeed("Upload successful");
Expand Down
7 changes: 6 additions & 1 deletion packages/storage/src/core/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,12 @@ export class ThirdwebStorage<T extends UploadOptions = IpfsUploadBatchOptions> {
// Otherwise it is an array of JSON objects, so we have to prepare it first
const metadata = (
await this.uploadAndReplaceFilesWithHashes(data as Json[], options)
).map((item) => JSON.stringify(item));
).map((item) => {
if (typeof item === "string") {
return item;
}
return JSON.stringify(item);
});

return this.uploader.uploadBatch(metadata, options);
}
Expand Down