diff --git a/examples/web/index.html b/examples/web/index.html
index fdadfbb7..a521a591 100644
--- a/examples/web/index.html
+++ b/examples/web/index.html
@@ -37,7 +37,7 @@
Upload File
import {
TurboFactory,
developmentTurboConfiguration,
- } from 'https://unpkg.com/@ardrive/turbo-sdk@1.13.0';
+ } from 'https://unpkg.com/@ardrive/turbo-sdk';
/**
* Set up our authenticated client factory
@@ -58,7 +58,9 @@ Upload File
/**
* Fetch fiat rates.
*/
- const rates = await turbo.getFiatRates();
+ const rates = await turbo.getFiatRates().catch((err) => {
+ console.log('Error fetching rates!', err);
+ });
console.log(
'Successfully fetched rates!',
@@ -80,7 +82,7 @@ Upload File
balance,
null,
2,
- );
+ ).catch((err) => console.log('Error fetching balance!', err));
/**
* Handle file upload
diff --git a/src/common/token/arweave.ts b/src/common/token/arweave.ts
index c494d17c..d0c7ce35 100644
--- a/src/common/token/arweave.ts
+++ b/src/common/token/arweave.ts
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-import Arweave from 'arweave';
+import ArweaveModule from 'arweave';
import { BigNumber } from 'bignumber.js';
import { Buffer } from 'node:buffer';
@@ -27,9 +27,14 @@ import { sha256B64Url, toB64Url } from '../../utils/base64.js';
import { sleep } from '../../utils/common.js';
import { TurboWinstonLogger } from '../logger.js';
+const ArweaveClass =
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
+ // @ts-ignore -- Access the correct class constructor for Arweave
+ ArweaveModule.default?.default || ArweaveModule.default || ArweaveModule;
+
export class ArweaveToken implements TokenTools {
protected logger: TurboLogger;
- protected arweave: Arweave;
+ protected arweave: ArweaveModule;
protected mintU: boolean;
protected pollingOptions: TokenPollingOptions;
@@ -45,7 +50,7 @@ export class ArweaveToken implements TokenTools {
},
}: {
gatewayUrl?: string;
- arweave?: Arweave;
+ arweave?: ArweaveModule;
logger?: TurboLogger;
mintU?: boolean;
pollingOptions?: TokenPollingOptions;
@@ -54,7 +59,7 @@ export class ArweaveToken implements TokenTools {
this.arweave =
arweave ??
- new Arweave({
+ new ArweaveClass({
host: url.hostname,
port: url.port,
protocol: url.protocol.replace(':', ''),