Skip to content
Closed
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
5 changes: 5 additions & 0 deletions .changeset/clever-beds-prove.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"thirdweb": patch
---

revert storage package on cli
3 changes: 2 additions & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
},
"dependencies": {
"@thirdweb-dev/sdk": "*",
"@thirdweb-dev/storage": "0.2.8",
"async-retry": "^1.3.3",
"cbor": "^8.1.0",
"commander": "^9.1.0",
Expand Down Expand Up @@ -81,4 +82,4 @@
"sourcemap": true,
"clean": true
}
}
}
6 changes: 3 additions & 3 deletions packages/cli/src/common/ci-installer.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { spinner } from "../core/helpers/logger";
import { ThirdwebStorage } from "@thirdweb-dev/storage";
import { IpfsStorage } from "@thirdweb-dev/storage";
import { existsSync, mkdirSync, writeFileSync } from "fs";
import path, { join } from "path";

Expand All @@ -13,10 +13,10 @@ export async function installGithubAction(options: any) {
: path.resolve(`${projectPath}/${options.path}`);
projectPath = resolvedPath;
}
const storage = new ThirdwebStorage();
const storage = new IpfsStorage();
const log = spinner("Installing thirdweb Github Action...");
try {
const ghActionData = await (await storage.download(ghActionHash)).text();
const ghActionData = await storage.getRaw(ghActionHash);
const dir = join(projectPath, ".github/workflows");
if (!existsSync(dir)) {
mkdirSync(dir, { recursive: true });
Expand Down
26 changes: 12 additions & 14 deletions packages/cli/src/common/processor.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { cliVersion, THIRDWEB_URL } from "../constants/urls";
import { THIRDWEB_URL, cliVersion } from "../constants/urls";
import build from "../core/builder/build";
import detect from "../core/detection/detect";
import { execute } from "../core/helpers/exec";
import { error, info, logger, spinner } from "../core/helpers/logger";
import { createContractsPrompt } from "../core/helpers/selector";
import { ContractPayload } from "../core/interfaces/ContractPayload";
import { ThirdwebStorage } from "@thirdweb-dev/storage";
import { IpfsStorage } from "@thirdweb-dev/storage";
import chalk from "chalk";
import { readFileSync } from "fs";
import path from "path";
Expand All @@ -15,7 +15,7 @@ export async function processProject(
command: "deploy" | "release",
) {
// TODO: allow overriding the default storage
const storage = new ThirdwebStorage();
const storage = new IpfsStorage();

logger.setSettings({
minLevel: options.debug ? "debug" : "info",
Expand Down Expand Up @@ -129,9 +129,7 @@ export async function processProject(
if (file.includes(soliditySDKPackage)) {
usesSoliditySDK = true;
}
return await storage.upload(file, {
uploadWithoutDirectory: true,
});
return await storage.uploadSingle(file);
}),
);
}
Expand All @@ -142,15 +140,14 @@ export async function processProject(
const metadataURIs = await Promise.all(
selectedContracts.map(async (c) => {
logger.debug(`Uploading ${c.name}...`);
return await storage.upload(JSON.parse(c.metadata), {
uploadWithoutDirectory: true,
});
const hash = await storage.uploadSingle(c.metadata);
return `ipfs://${hash}`;
}),
);

// Upload batch all bytecodes
const bytecodes = selectedContracts.map((c) => c.bytecode);
const bytecodeURIs = await storage.uploadBatch(bytecodes);
const { uris: bytecodeURIs } = await storage.uploadBatch(bytecodes);

const combinedContents = selectedContracts.map((c, i) => {
// attach analytics blob to metadata
Expand All @@ -172,13 +169,14 @@ 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(combinedContents[0], {
uploadWithoutDirectory: true,
});
const metadataUri = await storage.uploadSingle(
JSON.stringify(combinedContents[0]),
);
combinedURIs.push(metadataUri);
} else {
// otherwise upload batch
combinedURIs = await storage.uploadBatch(combinedContents);
const { uris } = await storage.uploadMetadataBatch(combinedContents);
combinedURIs = uris;
}

loader.succeed("Upload successful");
Expand Down
9 changes: 9 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3645,6 +3645,15 @@
resolved "https://registry.yarnpkg.com/@thirdweb-dev/contracts/-/contracts-3.1.8-0.tgz#847af3fe9a53368e7be04b7b6e6afe076d3d1676"
integrity sha512-PiQjdRcAUBlu3poc4g6dN9KvjTgYsA1Vi+B/IgryptCgcJeMY4cldMabKCgPaCg9dPVpUq4O+SOM00P6mBNvGw==

"@thirdweb-dev/storage@0.2.8":
version "0.2.8"
resolved "https://registry.yarnpkg.com/@thirdweb-dev/storage/-/storage-0.2.8.tgz#7c19b41dab363737e0015733a98e8f5252925db9"
integrity sha512-XM3wBlpUVWnMwBnHveWP1NgIsJDtvpzDsORO+DP8CQAsYizILKbiBC3n2w+eW/sLOGLuEYEUZk2zPFD/xpPM3Q==
dependencies:
cross-fetch "^3.1.5"
form-data "^4.0.0"
zod "^3.11.6"

"@trivago/prettier-plugin-sort-imports@^3.3.0":
version "3.3.0"
resolved "https://registry.yarnpkg.com/@trivago/prettier-plugin-sort-imports/-/prettier-plugin-sort-imports-3.3.0.tgz#ee4e9ec1d8e3076b95fcb94311f42f7a61eecd37"
Expand Down