@super-protocol/sdk-js 0.12.7-beta.2 → 0.12.8-beta.0
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/build/connectors/BaseConnector.d.ts +1 -0
- package/build/connectors/BlockchainConnector.js +2 -0
- package/build/constants.d.ts +1 -0
- package/build/constants.js +2 -1
- package/build/store.d.ts +1 -0
- package/build/store.js +1 -0
- package/build/types/Web3.d.ts +1 -0
- package/build/utils/TxManager.js +3 -0
- package/build/utils.js +4 -1
- package/package.json +1 -1
|
@@ -125,6 +125,8 @@ var BlockchainConnector = /** @class */ (function (_super) {
|
|
|
125
125
|
store_1.default.gasLimit = config.gasLimit;
|
|
126
126
|
if (config === null || config === void 0 ? void 0 : config.gasLimitMultiplier)
|
|
127
127
|
store_1.default.gasLimitMultiplier = config.gasLimitMultiplier;
|
|
128
|
+
if (config === null || config === void 0 ? void 0 : config.gasPriceMultiplier)
|
|
129
|
+
store_1.default.gasPriceMultiplier = config.gasPriceMultiplier;
|
|
128
130
|
Superpro_1.default.address = config.contractAddress;
|
|
129
131
|
this.contract = new store_1.default.web3Https.eth.Contract(app_json_1.default.abi, Superpro_1.default.address);
|
|
130
132
|
TxManager_1.default.init(store_1.default.web3Https);
|
package/build/constants.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export declare const defaultBlockchainUrl = "http://127.0.0.1:8545";
|
|
2
2
|
export declare const defaultGasLimit = 7000000;
|
|
3
3
|
export declare const defaultGasPrice = "30000000000";
|
|
4
|
+
export declare const defaultGasPriceMultiplier = 1;
|
|
4
5
|
export declare const defaultGasLimitMultiplier = 1.2;
|
|
5
6
|
export declare const ONE_DAY: number;
|
|
6
7
|
export declare const BLOCK_SIZE_TO_FETCH_TRANSACTION = 500;
|
package/build/constants.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.POLYGON_MATIC_EVENT_PATH = exports.BLOCK_SIZE_TO_FETCH_TRANSACTION = exports.ONE_DAY = exports.defaultGasLimitMultiplier = exports.defaultGasPrice = exports.defaultGasLimit = exports.defaultBlockchainUrl = void 0;
|
|
3
|
+
exports.POLYGON_MATIC_EVENT_PATH = exports.BLOCK_SIZE_TO_FETCH_TRANSACTION = exports.ONE_DAY = exports.defaultGasLimitMultiplier = exports.defaultGasPriceMultiplier = exports.defaultGasPrice = exports.defaultGasLimit = exports.defaultBlockchainUrl = void 0;
|
|
4
4
|
exports.defaultBlockchainUrl = "http://127.0.0.1:8545";
|
|
5
5
|
exports.defaultGasLimit = 7000000;
|
|
6
6
|
exports.defaultGasPrice = "30000000000";
|
|
7
|
+
exports.defaultGasPriceMultiplier = 1;
|
|
7
8
|
exports.defaultGasLimitMultiplier = 1.2;
|
|
8
9
|
exports.ONE_DAY = 24 * 60 * 60;
|
|
9
10
|
exports.BLOCK_SIZE_TO_FETCH_TRANSACTION = 500;
|
package/build/store.d.ts
CHANGED
package/build/store.js
CHANGED
package/build/types/Web3.d.ts
CHANGED
package/build/utils/TxManager.js
CHANGED
|
@@ -142,6 +142,9 @@ var TxManager = /** @class */ (function () {
|
|
|
142
142
|
}
|
|
143
143
|
txData.gas = options.gas;
|
|
144
144
|
}
|
|
145
|
+
TxManager.logger.debug({ price: txData.gasPrice }, "gasPrice before multipling");
|
|
146
|
+
txData.gasPrice = Math.ceil(txData.gasPrice * store_1.default.gasPriceMultiplier);
|
|
147
|
+
TxManager.logger.debug({ price: txData.gasPrice }, "gasPrice after multipling");
|
|
145
148
|
_a.label = 6;
|
|
146
149
|
case 6:
|
|
147
150
|
if (!(!(0, utils_1.checkForUsingExternalTxManager)(transactionOptions) && this.nonceTrackers[options.from])) return [3 /*break*/, 8];
|
package/build/utils.js
CHANGED
|
@@ -84,6 +84,8 @@ var createTransactionOptions = function (options) { return __awaiter(void 0, voi
|
|
|
84
84
|
options.from = store_1.default.actionAccount;
|
|
85
85
|
if (!options.gas)
|
|
86
86
|
options.gas = store_1.default.gasLimit;
|
|
87
|
+
if (!options.gasPriceMultiplier)
|
|
88
|
+
options.gasPriceMultiplier = store_1.default.gasPriceMultiplier;
|
|
87
89
|
if (!!options.gasPrice) return [3 /*break*/, 3];
|
|
88
90
|
if (!store_1.default.gasPrice) return [3 /*break*/, 1];
|
|
89
91
|
options.gasPrice = store_1.default.gasPrice;
|
|
@@ -205,6 +207,7 @@ function unpackDeviceId(bytes32) {
|
|
|
205
207
|
if (bytes32.length !== 66) {
|
|
206
208
|
throw new Error("DeviceId bytes must be equal 66 symbols");
|
|
207
209
|
}
|
|
208
|
-
|
|
210
|
+
// removes '0x'
|
|
211
|
+
return bytes32.slice(2, 66);
|
|
209
212
|
}
|
|
210
213
|
exports.unpackDeviceId = unpackDeviceId;
|