@pioneer-platform/thor-network 8.1.30 → 8.1.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.d.ts CHANGED
@@ -3,6 +3,7 @@ declare const prettyjson: any;
3
3
  declare const Axios: any;
4
4
  declare const https: any;
5
5
  declare const axios: any;
6
+ declare const axiosRetry: any;
6
7
  declare const log: any;
7
8
  declare let URL_THORNODE: string;
8
9
  declare let BASE_THOR: number;
package/lib/index.js CHANGED
@@ -61,6 +61,19 @@ var axios = Axios.create({
61
61
  rejectUnauthorized: false
62
62
  })
63
63
  });
64
+ var axiosRetry = require('axios-retry');
65
+ axiosRetry(axios, {
66
+ retries: 3,
67
+ retryDelay: function (retryCount) {
68
+ console.log("retry attempt: " + retryCount);
69
+ return retryCount * 2000; // time interval between retries
70
+ },
71
+ retryCondition: function (error) {
72
+ console.error(error);
73
+ // if retry condition is not specified, by default idempotent requests are retried
74
+ return error.response.status === 503;
75
+ },
76
+ });
64
77
  var log = require('@pioneer-platform/loggerdog')();
65
78
  var URL_THORNODE = process.env['URL_THORNODE'] || 'https://thornode.ninerealms.com';
66
79
  //let URL_MIDGARD = process.env['URL_THORNODE'] || 'https://testnet.midgard.thorchain.info/v2'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pioneer-platform/thor-network",
3
- "version": "8.1.30",
3
+ "version": "8.1.31",
4
4
  "main": "./lib/index.js",
5
5
  "types": "./lib/index.d.ts",
6
6
  "scripts": {
@@ -12,6 +12,7 @@
12
12
  },
13
13
  "dependencies": {
14
14
  "@pioneer-platform/loggerdog": "^8.1.17",
15
+ "axios-retry": "^3.3.1",
15
16
  "bech32": "^1.1.4",
16
17
  "bip32": "^2.0.5",
17
18
  "bip39": "^3.0.2",