New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

arweave-uploader

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

arweave-uploader - npm Package Compare versions

Comparing version 1.1.3 to 1.1.4

2

dist/index.d.ts

@@ -1,2 +0,2 @@

export declare const uploadTx: (tx: import("arweave/node/lib/transaction").default, wallet: import("arweave/node/lib/wallet").JWKInterface) => Promise<string>;
export declare const uploadTx: (tx: import("arweave/node/lib/transaction").default, wallet: import("arweave/node/lib/wallet").JWKInterface, userReference?: string | undefined) => Promise<string>;
export declare const setDebugOutput: (b: boolean) => boolean;
import Transaction from 'arweave/node/lib/transaction';
import { JWKInterface } from 'arweave/node/lib/wallet';
export declare const upload: (tx: Transaction, wallet: JWKInterface) => Promise<string>;
export declare const upload: (tx: Transaction, wallet: JWKInterface, userReference?: string | undefined) => Promise<string>;

@@ -51,7 +51,12 @@ "use strict";

});
var upload = function (tx, wallet) { return __awaiter(void 0, void 0, void 0, function () {
var tStart, status, wait, err_1, now, err_2, tries, err_3;
var upload = function (tx, wallet, userReference) { return __awaiter(void 0, void 0, void 0, function () {
var uRef, tStart, status, wait, err_1, now, err_2, tries, err_3;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4, arweave.transactions.sign(tx, wallet)];
case 0:
uRef = '';
if (userReference) {
uRef = '[' + userReference + ']';
}
return [4, arweave.transactions.sign(tx, wallet)];
case 1:

@@ -62,3 +67,3 @@ _a.sent();

_a.sent();
logger_1.logger('New txid', tx.id);
logger_1.logger(uRef, 'New txid', tx.id);
tStart = new Date().valueOf();

@@ -72,3 +77,3 @@ return [4, utils_1.getStatus(tx.id)];

if (!((status === 404 || status === 410) && wait--)) return [3, 10];
logger_1.logger('Initial 4XX detected. Waiting 5 seconds...', status);
logger_1.logger(uRef, 'Initial 4XX detected. Waiting 5 seconds...', status);
return [4, utils_1.sleep(5000)];

@@ -86,3 +91,3 @@ case 5:

err_1 = _a.sent();
logger_1.logger('Network error getting status. Ignoring & waiting...', status);
logger_1.logger(uRef, 'Network error getting status. Ignoring & waiting...', status);
wait++;

@@ -94,3 +99,3 @@ status = 404;

if (status === 400 || status === 404 || status === 410) {
logger_1.logger('Invalid transaction detected. Status ' + status, 'Throwing error');
logger_1.logger(uRef, 'Possible invalid transaction detected. Status ' + status, 'Throwing error');
throw new Error('Possible invalid transaction detected. Status ' + status);

@@ -102,3 +107,3 @@ }

now = (new Date().valueOf() - tStart) / (1000 * 60);
logger_1.logger("Mining for " + now.toFixed(1) + " mins. " + status);
logger_1.logger(uRef, "Mining for " + now.toFixed(1) + " mins. " + status);
return [4, utils_1.sleep(30000)];

@@ -116,3 +121,3 @@ case 12:

err_2 = _a.sent();
logger_1.logger('Network error retrieving status.', status, 'Continuing...');
logger_1.logger(uRef, 'Network error retrieving status.', status, 'Continuing...');
status = 202;

@@ -122,9 +127,9 @@ return [3, 16];

case 17:
logger_1.logger('Finished mining period with status', status);
logger_1.logger(uRef, 'Finished mining period with status', status);
if (status === 200) {
logger_1.logger("Success", status);
logger_1.logger(uRef, "Success", status);
return [2, tx.id];
}
if (!(status === 404 || status === 410)) return [3, 25];
tries = 3;
tries = 6;
_a.label = 18;

@@ -140,7 +145,7 @@ case 18: return [4, utils_1.sleep(40000)];

status = _a.sent();
logger_1.logger('tries', tries, 'status', status);
logger_1.logger(uRef, 'tries', tries, 'status', status);
return [3, 23];
case 22:
err_3 = _a.sent();
logger_1.logger('Network error getting status. Ignoring & waiting...', status);
logger_1.logger(uRef, 'Network error getting status. Ignoring & waiting...', status);
tries++;

@@ -151,3 +156,3 @@ status = 404;

if (status === 200) {
logger_1.logger("Success", status);
logger_1.logger(uRef, "Success", status);
return [2, tx.id];

@@ -160,4 +165,4 @@ }

case 25:
logger_1.logger('Possible failure, no retry. Status ', status);
throw new Error('Possible failure. Status ' + status);
logger_1.logger(uRef, 'Possible failure, no retry. Status ', status);
throw new Error("Possible failure. Txid: " + tx.id + " Status: " + status);
}

@@ -164,0 +169,0 @@ });

{
"name": "arweave-uploader",
"version": "1.1.3",
"version": "1.1.4",
"description": "",

@@ -11,2 +11,3 @@ "main": "dist/index.js",

"test": "mocha -r ts-node/register tests/**/*.spec.ts",
"preversion": "npm run build && git commit -m \"auto: dist\" -- ./dist",
"postversion": "git push && git push --tags"

@@ -13,0 +14,0 @@ },

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc