Skip to content

Commit 194a2a7

Browse files
authored
Merge pull request #255 from ardriveapp/factory-backwards-compat
refactor: restore Utf8ArrayToStr export PE-4841
2 parents 6b4e8bc + 788f754 commit 194a2a7

File tree

5 files changed

+17
-12
lines changed

5 files changed

+17
-12
lines changed

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
{
22
"name": "ardrive-core-js",
3-
"version": "3.0.1",
3+
"version": "3.0.2",
44
"description": "ArDrive Core contains the essential back end application features to support the ArDrive CLI and Desktop apps, such as file management, Permaweb upload/download, wallet management and other common functions.",
55
"main": "./lib/exports.js",
66
"types": "./lib/exports.d.ts",
77
"engines": {
88
"node": ">=18"
99
},
1010
"dependencies": {
11-
"@alexsasharegan/simple-cache": "^3.3.3",
1211
"@ardrive/ardrive-promise-cache": "^1.1.4",
1312
"@ardrive/turbo-sdk": "^1.0.1",
1413
"@dha-team/arbundles": "^1.0.3",

src/ardrive_factory.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,8 @@ export function arDriveFactory({
102102
: new Turbo({
103103
turboUploadUrl: turboSettings.turboUploadUrl,
104104
turboPaymentUrl: turboSettings.turboPaymentUrl,
105-
isDryRun: dryRun
105+
isDryRun: dryRun,
106+
turboUrl: turboSettings.turboUrl // for backwards compatibility
106107
})
107108
)
108109
}: ArDriveSettings): ArDrive {

src/utils/common.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -421,12 +421,19 @@ export function createPublicDriveSharingLink(driveToShare: types.ArFSDriveMetaDa
421421
return driveSharingUrl;
422422
}
423423

424+
/** @deprecated use Uint8ArrayToString */
425+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
426+
export function Utf8ArrayToStr(array: Uint8Array | any): string {
427+
return Uint8ArrayToString(array);
428+
}
424429
export function BufferToString(buffer: Buffer): string {
425-
let out, i, c;
426-
let char2, char3;
427-
428430
// to keep our existing logic
429431
const array = new Uint8Array(buffer);
432+
return Uint8ArrayToString(array);
433+
}
434+
export function Uint8ArrayToString(array: Uint8Array): string {
435+
let out, i, c;
436+
let char2, char3;
430437

431438
out = '';
432439
const len = array.length;

tests/test_helpers.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,10 @@ export async function mineArLocalBlock(arweave: Arweave): Promise<void> {
5555
}
5656

5757
export async function getTxDataFromGateway(arweave: Arweave, txId: TransactionID): Promise<Buffer> {
58-
const { data } =
59-
await arweave.api.get<Buffer>(`${txId}`, {
60-
responseType: 'arraybuffer'
61-
})
62-
return data;
58+
const { data } = await arweave.api.get<Buffer>(`${txId}`, {
59+
responseType: 'arraybuffer'
60+
});
61+
return data;
6362
}
6463

6564
export async function getMetaDataJSONFromGateway(

yarn.lock

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2310,7 +2310,6 @@ __metadata:
23102310
version: 0.0.0-use.local
23112311
resolution: "ardrive-core-js@workspace:."
23122312
dependencies:
2313-
"@alexsasharegan/simple-cache": ^3.3.3
23142313
"@ardrive/ardrive-promise-cache": ^1.1.4
23152314
"@ardrive/turbo-sdk": ^1.0.1
23162315
"@dha-team/arbundles": ^1.0.3

0 commit comments

Comments
 (0)