arweave-uploader
Advanced tools
Comparing version 1.0.3 to 1.1.2
@@ -47,4 +47,5 @@ "use strict"; | ||
var arweave = arweave_1.default.init({ | ||
host: 'arweave.net', | ||
protocol: 'https', | ||
host: 'lon-1.arweave.net', | ||
protocol: 'http', | ||
port: 1984 | ||
}); | ||
@@ -69,4 +70,4 @@ var upload = function (tx, wallet) { return __awaiter(void 0, void 0, void 0, function () { | ||
case 4: | ||
if (!(status === 404 && wait--)) return [3, 10]; | ||
logger_1.logger('Initial 404 detected. Waiting 5 seconds...', status); | ||
if (!((status === 404 || status === 410) && wait--)) return [3, 10]; | ||
logger_1.logger('Initial 4XX detected. Waiting 5 seconds...', status); | ||
return [4, utils_1.sleep(5000)]; | ||
@@ -92,3 +93,3 @@ case 5: | ||
logger_1.logger('Invalid transaction detected. Status ' + status, 'Throwing error'); | ||
throw new Error('Invalid transaction detected. Status ' + status); | ||
throw new Error('Possible invalid transaction detected. Status ' + status); | ||
} | ||
@@ -122,3 +123,3 @@ _a.label = 11; | ||
} | ||
if (!(status === 404)) return [3, 25]; | ||
if (!(status === 404 || status === 410)) return [3, 25]; | ||
tries = 3; | ||
@@ -153,6 +154,4 @@ _a.label = 18; | ||
case 25: | ||
logger_1.logger('Failure', status, '. Retrying post tx'); | ||
tx.addTag('Retry', (new Date().valueOf() / 1000).toString()); | ||
return [4, exports.upload(tx, wallet)]; | ||
case 26: return [2, _a.sent()]; | ||
logger_1.logger('Possible failure, no retry. Status ', status); | ||
throw new Error('Possible failure. Status ' + status); | ||
} | ||
@@ -159,0 +158,0 @@ }); |
{ | ||
"name": "arweave-uploader", | ||
"version": "1.0.3", | ||
"version": "1.1.2", | ||
"description": "", | ||
@@ -10,3 +10,4 @@ "main": "dist/index.js", | ||
"build": "tsc -p tsconfig.build.json", | ||
"test": "mocha -r ts-node/register tests/**/*.spec.ts" | ||
"test": "mocha -r ts-node/register tests/**/*.spec.ts", | ||
"postversion": "git push && git push --tags" | ||
}, | ||
@@ -13,0 +14,0 @@ "keywords": [], |
# arweave-uploader | ||
Arweave Uploader - detect and handle arweave upload failures | ||
Arweave Uploader - detect ~~and handle~~ arweave upload failures | ||
** N.B. this only works for value transfer or very small data txs | ||
** N.B. retry is currently disabled | ||
## Installation | ||
``` | ||
npm install mcmonkeys1/arweave-uploader | ||
npm install arweave-uploader | ||
``` | ||
N.B. This installs directly from github. You may have issues uninstalling/updating the package, in this case remove node_modules & package-lock.json and try again | ||
@@ -46,2 +48,2 @@ ## Example Usage | ||
`setDebugOutput(false)` to turn off console messages - not advised, but possible. | ||
`setDebugOutput(false)` to turn off console messages - not advised, but possible. |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
49
45639
258