From 86b30e594114ad4760dc0884e7822240a3338cb2 Mon Sep 17 00:00:00 2001 From: febo Date: Thu, 9 Nov 2023 21:00:55 +0000 Subject: [PATCH 1/2] Fix formatting --- .../plugins/irysStorage/IrysStorageDriver.ts | 49 +++++++++++-------- 1 file changed, 28 insertions(+), 21 deletions(-) diff --git a/packages/js/src/plugins/irysStorage/IrysStorageDriver.ts b/packages/js/src/plugins/irysStorage/IrysStorageDriver.ts index 343b62026..3262b7ccb 100644 --- a/packages/js/src/plugins/irysStorage/IrysStorageDriver.ts +++ b/packages/js/src/plugins/irysStorage/IrysStorageDriver.ts @@ -1,6 +1,5 @@ import type { default as NodeIrys, WebIrys } from '@irys/sdk'; - import BigNumber from 'bignumber.js'; import { Connection, @@ -30,7 +29,10 @@ import { toBigNumber, } from '@/types'; import { - AssetUploadFailedError, FailedToConnectToIrysAddressError, FailedToInitializeIrysError, IrysWithdrawError, + AssetUploadFailedError, + FailedToConnectToIrysAddressError, + FailedToInitializeIrysError, + IrysWithdrawError, } from '@/errors'; import { _removeDoubleDefault } from '@/utils'; @@ -104,8 +106,10 @@ export class IrysStorageDriver implements StorageDriver { await this.fund(amount); const promises = files.map(async (file) => { - const irysTx = irys.createTransaction(file.buffer, { tags: getMetaplexFileTagsWithContentType(file)}) - await irysTx.sign() + const irysTx = irys.createTransaction(file.buffer, { + tags: getMetaplexFileTagsWithContentType(file), + }); + await irysTx.sign(); const { status, data } = await irys.uploader.uploadTransaction(irysTx); @@ -162,10 +166,12 @@ export class IrysStorageDriver implements StorageDriver { async withdraw(amount: Amount): Promise { const irys = await this.irys(); - try{ + try { await irys.withdrawBalance(amountToBigNumber(amount)); - }catch(e: any){ - throw new IrysWithdrawError( (e instanceof Error) ? e.message : e.toString()); + } catch (e: any) { + throw new IrysWithdrawError( + e instanceof Error ? e.message : e.toString() + ); } } @@ -203,12 +209,7 @@ export class IrysStorageDriver implements StorageDriver { Keypair.fromSecretKey((identity as KeypairSigner).secretKey) ); - irys = await this.initWebirys( - address, - currency, - identitySigner, - options - ); + irys = await this.initWebirys(address, currency, identitySigner, options); } try { @@ -227,10 +228,13 @@ export class IrysStorageDriver implements StorageDriver { keypair: KeypairSigner, options: any ): Promise { - const bPackage = _removeDoubleDefault( - await import('@irys/sdk') - ); - return new bPackage.default({url: address, token: currency, key: keypair.secretKey, config: options}); + const bPackage = _removeDoubleDefault(await import('@irys/sdk')); + return new bPackage.default({ + url: address, + token: currency, + key: keypair.secretKey, + config: options, + }); } async initWebirys( @@ -259,10 +263,13 @@ export class IrysStorageDriver implements StorageDriver { }, }; - const bPackage = _removeDoubleDefault( - await import('@irys/sdk') - ); - const irys = new bPackage.WebIrys({url: address, token: currency, wallet: {provider: wallet}, config: options}); + const bPackage = _removeDoubleDefault(await import('@irys/sdk')); + const irys = new bPackage.WebIrys({ + url: address, + token: currency, + wallet: { provider: wallet }, + config: options, + }); try { // Try to initiate irys. From 1067c0b86a57daed48df0483859c1e0943102957 Mon Sep 17 00:00:00 2001 From: febo Date: Thu, 9 Nov 2023 21:02:25 +0000 Subject: [PATCH 2/2] Add changeset --- .changeset/strong-paws-sparkle.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/strong-paws-sparkle.md diff --git a/.changeset/strong-paws-sparkle.md b/.changeset/strong-paws-sparkle.md new file mode 100644 index 000000000..f9f22fe0f --- /dev/null +++ b/.changeset/strong-paws-sparkle.md @@ -0,0 +1,5 @@ +--- +'@metaplex-foundation/js': patch +--- + +Fix formatting