Skip to content

Commit

Permalink
fixes #1885, #1961 (#1970)
Browse files Browse the repository at this point in the history
  • Loading branch information
stegaBOB committed Mar 16, 2022
1 parent b9c4d56 commit 5852443
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
1 change: 1 addition & 0 deletions js/packages/cli/src/candy-machine-v2-cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ programCommand('upload')
rateLimit,
collectionMintPubkey,
setCollectionMint,
rpcUrl,
});
} catch (err) {
log.warn('upload was not successful, please re-run.', err);
Expand Down
3 changes: 3 additions & 0 deletions js/packages/cli/src/commands/upload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export async function uploadV2({
rateLimit,
collectionMintPubkey,
setCollectionMint,
rpcUrl,
}: {
files: string[];
cacheName: string;
Expand Down Expand Up @@ -99,6 +100,7 @@ export async function uploadV2({
rateLimit: number;
collectionMintPubkey: null | PublicKey;
setCollectionMint: boolean;
rpcUrl: null | string;
}): Promise<boolean> {
const savedContent = loadCache(cacheName, env);
const cacheContent = savedContent || {};
Expand Down Expand Up @@ -234,6 +236,7 @@ export async function uploadV2({
: undefined,
storage === StorageType.ArweaveSol ? walletKeyPair : undefined,
batchSize,
rpcUrl,
);

let result = arweaveBundleUploadGenerator.next();
Expand Down
12 changes: 9 additions & 3 deletions js/packages/cli/src/helpers/upload/arweave-bundle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,7 @@ export function* makeArweaveBundleUploadGenerator(
jwk?: any,
walletKeyPair?: Keypair,
batchSize?: number,
rpcUrl?: string,
): Generator<Promise<UploadGeneratorResult>> {
let signer: ArweaveSigner;
const storageType: StorageType = storage;
Expand All @@ -487,6 +488,10 @@ export function* makeArweaveBundleUploadGenerator(
'https://node1.bundlr.network',
'solana',
walletKeyPair.secretKey,
{
timeout: 60000,
providerUrl: rpcUrl ?? 'https://api.metaplex.rpcpool.com',
},
)
: new Bundlr(
'https://devnet.bundlr.network',
Expand Down Expand Up @@ -603,16 +608,17 @@ export function* makeArweaveBundleUploadGenerator(
] as unknown as BundlrTransaction[];
log.info('Uploading bundle via Bundlr... in multiple transactions');
const bytes = (dataItems as unknown as BundlrTransaction[]).reduce(
(c, d) => c + d.getRaw().length,
(c, d) => c + Math.max(d.getRaw().length, 12000),
0,
);
const cost = await bundlr.utils.getPrice('solana', bytes);
const bufferCost = cost.multipliedBy(3).dividedToIntegerBy(2);
log.info(
`${(cost.toNumber() * 2) / LAMPORTS} SOL to upload ${sizeMB(
`${bufferCost.toNumber() / LAMPORTS} SOL to upload ${sizeMB(
bytes,
)}MB with buffer. Sending fund txn...`,
);
await bundlr.fund(cost.multipliedBy(2));
await bundlr.fund(bufferCost);
log.info(`Successfully funded Arweave Bundler, starting upload`);

const progressBar = new cliProgress.SingleBar(
Expand Down
5 changes: 5 additions & 0 deletions js/packages/cli/test/run-test-v2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ SRC_DIR=$PARENT_DIR/src
CMD_CMV2="ts-node ${SRC_DIR}/candy-machine-v2-cli.ts"

# Remote files to test the upload
PNG_MIN="https://arweave.net/N3LqmO6yURUK1JxV9MJtH8YeqppEtZhKuy3RB0Tqm3A/?ext=png"
PNG="https://arweave.net/izpWaFnueKtbRg4TY-CkUYQtwSzPNit3ZvQPY5hOK7E/?ext=png"
GIF="https://arweave.net/3I50hy1dHhRwyxtKPL60WIl4kV0rqjnl7t_DcZPAp2o/?ext=gif"
JPG="https://arweave.net/-KqqzJLtD8Pug-aCjbV6RWbGhfB74MBT71afqGFKYHA/?ext=jpg"
Expand Down Expand Up @@ -257,6 +258,10 @@ else
png)
IMAGE=$PNG
;;
png_min)
IMAGE=$PNG_MIN
EXT="png"
;;
jpg)
IMAGE=$JPG
;;
Expand Down

2 comments on commit 5852443

@vercel
Copy link

@vercel vercel bot commented on 5852443 Mar 16, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

metaplex-web – ./js

metaplex.vercel.app
metaplex-web-git-master-metaplex.vercel.app
metaplex-web-metaplex.vercel.app

@vercel
Copy link

@vercel vercel bot commented on 5852443 Mar 16, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

candy-machine-ui – ./js/packages/candy-machine-ui

candy-machine-ui.vercel.app
candy-machine-ui-git-master-metaplex.vercel.app
candy-machine-ui-metaplex.vercel.app

Please sign in to comment.