Skip to content

Commit

Permalink
fix: Update bundler node to turbo
Browse files Browse the repository at this point in the history
  • Loading branch information
pawanpaudel93 committed Dec 22, 2023
1 parent ca1a21b commit 84ca9d1
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/lib/arweaveHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ export async function getAddress() {

export async function uploadRepo(zipBuffer: Buffer, tags: Tag[]) {
try {
// upload compressed repo using bundlr
const bundlrTxId = await bundlrUpload(zipBuffer, tags);
console.log('Posted Tx to Bundlr: ', bundlrTxId);
return bundlrTxId;
// upload compressed repo using turbo
const turboTxId = await turboUpload(zipBuffer, tags);
console.log('Posted Tx to Turbo: ', turboTxId);
return turboTxId;
} catch (error) {
console.log('Error uploading using bundlr, trying with Arweave...');
console.log('Error uploading using turbo, trying with Arweave...');
// let Arweave throw if it encounters errors
const arweaveTxId = await arweaveUpload(zipBuffer, tags);
console.log('Posted Tx to Arweave: ', arweaveTxId);
Expand Down Expand Up @@ -60,11 +60,11 @@ async function arweaveUpload(zipBuffer: Buffer, tags: Tag[]) {
return tx.id;
}

export async function bundlrUpload(zipBuffer: Buffer, tags: Tag[]) {
if (!jwk) throw '[ bundlr ] No jwk wallet supplied';
export async function turboUpload(zipBuffer: Buffer, tags: Tag[]) {
if (!jwk) throw '[ turbo ] No jwk wallet supplied';

// Testing upload with arbundles
const node = 'https://node2.bundlr.network';
const node = 'https://turbo.ardrive.io';
const uint8ArrayZip = new Uint8Array(zipBuffer);
const signer = new ArweaveSigner(getWallet());

Expand All @@ -82,7 +82,7 @@ export async function bundlrUpload(zipBuffer: Buffer, tags: Tag[]) {

if (res.status >= 400)
throw new Error(
`[ bundlr ] Posting repo w/bundlr faile. Error: ${res.status} - ${res.statusText}`
`[ turbo ] Posting repo with turbo failed. Error: ${res.status} - ${res.statusText}`
);

return dataItem.id;
Expand Down

0 comments on commit 84ca9d1

Please sign in to comment.