dkg.js 8.2.1 → 8.2.4
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/.github/workflows/check-package-lock.yml +75 -0
- package/constants/constants.js +6 -0
- package/index.cjs +372 -111
- package/managers/asset-operations-manager.js +141 -28
- package/package.json +2 -2
- package/services/blockchain-service/blockchain-service-base.js +161 -80
- package/services/blockchain-service/implementations/node-blockchain-service.js +36 -5
- package/services/input-service.js +20 -0
- package/services/node-api-service/implementations/http-service.js +16 -0
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
PARANET_MINERS_ACCESS_POLICY,
|
|
8
8
|
PARANET_KC_SUBMISSION_POLICY,
|
|
9
9
|
ZERO_ADDRESS,
|
|
10
|
+
GAS_MODES,
|
|
10
11
|
} from '../constants/constants.js';
|
|
11
12
|
|
|
12
13
|
export default class InputService {
|
|
@@ -192,12 +193,29 @@ export default class InputService {
|
|
|
192
193
|
BLOCKCHAINS[environment][name]?.gasPriceOracleLink ??
|
|
193
194
|
undefined;
|
|
194
195
|
|
|
196
|
+
const getEnvGasMode = () =>
|
|
197
|
+
typeof process !== 'undefined' && process?.env ? process.env.DKG_GAS_MODE : undefined;
|
|
198
|
+
|
|
199
|
+
const requestedGasMode =
|
|
200
|
+
options.blockchain?.gasMode ??
|
|
201
|
+
this.config.blockchain?.gasMode ??
|
|
202
|
+
getEnvGasMode() ??
|
|
203
|
+
DEFAULT_PARAMETERS.GAS_MODE;
|
|
204
|
+
const normalizedRequestedGasMode = (requestedGasMode || '').toLowerCase();
|
|
205
|
+
const normalizedGasMode = Object.values(GAS_MODES).includes(normalizedRequestedGasMode)
|
|
206
|
+
? normalizedRequestedGasMode
|
|
207
|
+
: DEFAULT_PARAMETERS.GAS_MODE;
|
|
208
|
+
|
|
195
209
|
const maxAllowance =
|
|
196
210
|
options.blockchain?.maxAllowance ?? this.config.blockchain?.maxAllowance ?? undefined;
|
|
197
211
|
const gasPriceBufferPercent =
|
|
198
212
|
options.blockchain?.gasPriceBufferPercent ??
|
|
199
213
|
this.config.blockchain?.gasPriceBufferPercent ??
|
|
200
214
|
undefined;
|
|
215
|
+
const priorityFeePercentile =
|
|
216
|
+
options.blockchain?.priorityFeePercentile ??
|
|
217
|
+
this.config.blockchain?.priorityFeePercentile ??
|
|
218
|
+
undefined;
|
|
201
219
|
const retryTxGasPriceMultiplier =
|
|
202
220
|
options.blockchain?.retryTxGasPriceMultiplier ??
|
|
203
221
|
this.config.blockchain?.retryTxGasPriceMultiplier ??
|
|
@@ -216,8 +234,10 @@ export default class InputService {
|
|
|
216
234
|
simulateTxs,
|
|
217
235
|
forceReplaceTxs,
|
|
218
236
|
gasPriceOracleLink,
|
|
237
|
+
gasMode: normalizedGasMode,
|
|
219
238
|
maxAllowance,
|
|
220
239
|
gasPriceBufferPercent,
|
|
240
|
+
priorityFeePercentile,
|
|
221
241
|
retryTxGasPriceMultiplier,
|
|
222
242
|
};
|
|
223
243
|
|
|
@@ -57,6 +57,22 @@ export default class HttpService {
|
|
|
57
57
|
|
|
58
58
|
return response.data.operationId;
|
|
59
59
|
} catch (error) {
|
|
60
|
+
const status = error?.response?.status;
|
|
61
|
+
const body = error?.response?.data;
|
|
62
|
+
const url = `${this.getBaseUrl(endpoint, port)}/publish`;
|
|
63
|
+
console.error(
|
|
64
|
+
'Unable to publish',
|
|
65
|
+
JSON.stringify(
|
|
66
|
+
{
|
|
67
|
+
url,
|
|
68
|
+
status,
|
|
69
|
+
body,
|
|
70
|
+
message: error?.message,
|
|
71
|
+
},
|
|
72
|
+
null,
|
|
73
|
+
2,
|
|
74
|
+
),
|
|
75
|
+
);
|
|
60
76
|
throw Error(`Unable to publish: ${error.message}`);
|
|
61
77
|
}
|
|
62
78
|
}
|